@codezee/sixtify-brahma 0.2.335 → 0.2.336

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,5 +20,5 @@ import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import o from"@m
20
20
  opacity: 1;
21
21
  transform: translateY(0) scale(1);
22
22
  }
23
- `,LA=J(x)((({theme:e})=>{const{iron:t,butterflyBlue:i}=e.palette.app.color,{white:o}=e.palette.common;return{display:"inline-flex",alignItems:"center",gap:"2px",padding:"4px",borderRadius:"12px",background:o,border:`1px solid ${R(i[900],.14)}`,boxShadow:`\n 0 12px 32px ${R(t[900],.28)},\n 0 4px 12px ${R(t[900],.18)},\n 0 1px 3px ${R(t[900],.12)}\n `,backdropFilter:"blur(10px)",animation:`${vA} 220ms cubic-bezier(0.22, 1, 0.36, 1)`,position:"relative","&::before":{content:'""',position:"absolute",top:-5,left:"50%",width:10,height:10,background:o,border:`1px solid ${R(i[900],.14)}`,borderBottom:"none",borderRight:"none",transform:"translateX(-50%) rotate(45deg)",zIndex:0}}})),yA=J(n,{shouldForwardProp:e=>"logoSize"!==e&&"delayMs"!==e})((({theme:e,logoSize:t="large",delayMs:i=0})=>{const{butterflyBlue:o,iron:n}=e.palette.app.color,{button:r,icon:l,padding:a}=((e="large")=>"small"===e?{button:26,icon:14,padding:"4px"}:"medium"===e?{button:30,icon:16,padding:"5px"}:{button:34,icon:18,padding:"6px"})(t);return{width:r,height:r,padding:a,color:n[800],zIndex:1,animation:`${RA} 240ms cubic-bezier(0.22, 1, 0.36, 1) both`,animationDelay:`${i}ms`,transition:"background-color 0.18s ease, color 0.18s ease, transform 0.18s ease","& .MuiSvgIcon-root":{fontSize:l},"&:hover":{backgroundColor:R(o[900],.1),color:o[900],transform:"translateY(-1px)"},"&:focus-visible":{outline:`2px solid ${o[900]}`,outlineOffset:1}}})),FA=J(x,{shouldForwardProp:e=>"logoSize"!==e})((({logoSize:e="large"})=>({height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"small"===e?"2px":"6px",padding:"small"===e?"2px":"4px"})));function UA({open:t,anchorEl:i,size:o,actions:n,onClose:r,onMouseEnter:l,onMouseLeave:a}){const s=M(),{slate:C}=s.palette.app.color;return e(Ae,{open:t,anchorEl:i,onClose:r,disableRestoreFocus:!0,disableScrollLock:!0,marginThreshold:8,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},slotProps:{paper:{elevation:0,onMouseEnter:l,onMouseLeave:a,sx:{mt:1,overflow:"visible",background:"transparent",boxShadow:"none"}}},sx:{pointerEvents:"none","& .MuiPaper-root":{pointerEvents:"auto"}},children:e(LA,{role:"toolbar","aria-label":"Logo actions",children:n.map((({key:t,label:i,icon:n,onClick:r},l)=>e(cl,{toolTipLabel:i,placement:"top",children:e(yA,{logoSize:o,delayMs:40*l,"aria-label":i,onClick:e=>{e.stopPropagation(),r(e)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),r(e))},sx:{color:C[900]},children:n})},t)))})})}const ZA=J(x)({display:"flex",flexDirection:"column",gap:"12px"}),DA=J(x)({display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:"10px"}),HA=J(x)((({theme:e})=>{const{mirage:t,butterflyBlue:i,lightBlue:o}=e.palette.app.color;return{position:"relative",width:"100%",height:280,borderRadius:"8px",overflow:"hidden",backgroundColor:t[900],border:`1px solid ${i[700]}`,[e.breakpoints.up("sm")]:{height:360},"& .reactEasyCrop_CropArea":{border:`2px solid ${i[900]} !important`,color:R(t[900],.55)},"& .reactEasyCrop_CropAreaGrid::before, & .reactEasyCrop_CropAreaGrid::after":{borderColor:R(o[50],.35)}}})),KA=J(x)({display:"flex",alignItems:"center",gap:"8px"}),GA=J(n)((({theme:e})=>{const{butterflyBlue:t,iron:i}=e.palette.app.color;return{color:t[900],"&.Mui-disabled":{color:i[700]}}})),YA=J(x)((({theme:e})=>{const{butterflyBlue:t,lightBlue:i}=e.palette.app.color;return{width:40,height:40,borderRadius:"6px",overflow:"hidden",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:i[50],border:`1px solid ${t[700]}`}})),VA=J(x)((({theme:e})=>{const{mirage:t,lightBlue:i}=e.palette.app.color;return{position:"absolute",inset:0,zIndex:5,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"10px",backgroundColor:R(t[900],.7),color:i[50]}}));function TA({imageSrc:t,aspectRatio:i,rotation:o,zoom:n,onZoomChange:r,onCropComplete:l}){const[a,s]=h({x:0,y:0});g((()=>{s({x:0,y:0})}),[i]);const C=u(((e,t)=>{l(t)}),[l]);return e(pi,{image:t,crop:a,zoom:n,rotation:o,aspect:hA[i],onCropChange:s,onZoomChange:r,onCropComplete:C,objectFit:"contain",showGrid:!0,style:{containerStyle:{width:"100%",height:"100%"}}})}function jA({open:i,imageSrc:o,originalFile:n,aspectRatios:r=fA,enabledVariants:l,initialAspectRatio:s="1:1",onClose:C,onApply:A}){const d=M(),{iron:c,butterflyBlue:p}=d.palette.app.color,[m,f]=h(s),[E,I]=h(1),[k,S]=h(0),[w,B]=h(null),[Q,J]=h(!1),[b,v]=h(null),R=u((()=>{I(1),S(0)}),[]);g((()=>{i&&(f(s),R(),B(null),v((e=>(SA(e),null))))}),[i,s,R]),g((()=>{const e=new AbortController;return(async()=>{if(w&&o)try{const t=await QA(o,w,k,void 0,void 0,"image/png");if(e.signal.aborted)return;const i=URL.createObjectURL(t);if(e.signal.aborted)return void SA(i);v((e=>(SA(e),i)))}catch{if(e.signal.aborted)return;v((e=>(SA(e),null)))}})(),()=>{e.abort()}}),[w,o,k]);return e(Ds,{open:i,onClose:C,title:"Crop Logo",maxWidth:"md",actions:t(a,{direction:"row",gap:"10px",justifyContent:"flex-end",children:[e(Ln,{actionType:"cancel",variant:"outlined",onClick:C,disableKeyboardShortcut:Q,disabled:Q}),e(Ln,{onClick:()=>{(async()=>{if(w){J(!0);try{const e=await bA({imageSrc:o,original:n,pixelCrop:w,rotation:k,aspectRatio:m,enabledVariants:l});A({...e,aspectRatio:m}),C()}catch{Is.error({title:"Failed to process cropped image. Please try again."})}finally{J(!1)}}else Is.error({title:"Adjust the crop area before saving."})})()},loading:Q,label:"Apply"})]}),children:t(ZA,{children:[t(DA,{children:[e(bn,{renderButtons:r.map((e=>({icon:null,value:e,label:e,selected:m===e,size:"small",onClick:e=>{const t=r.find((t=>t===e));t&&f(t)}}))),sx:{textTransform:"none",fontWeight:500,boxShadow:"none","&.MuiButton-text":{color:c[800]}}}),t(a,{direction:"row",alignItems:"center",gap:"2px",children:[e(cl,{toolTipLabel:"Drag to reposition. Scroll or use zoom to refine.",children:e(GA,{size:"small","aria-label":"Crop tips",children:e(Gt,{fontSize:"small"})})}),e(cl,{toolTipLabel:"Rotate left",children:e(GA,{size:"small",onClick:()=>S((e=>e-90)),"aria-label":"Rotate left",disabled:Q,children:e(Ci,{fontSize:"small"})})}),e(cl,{toolTipLabel:"Rotate right",children:e(GA,{size:"small",onClick:()=>S((e=>e+90)),"aria-label":"Rotate right",disabled:Q,children:e(Ai,{fontSize:"small"})})}),e(cl,{toolTipLabel:"Reset",children:e(GA,{size:"small",onClick:R,"aria-label":"Reset crop",disabled:Q,children:e(si,{fontSize:"small"})})})]})]}),t(x,{sx:{position:"relative"},children:[e(HA,{children:e(TA,{imageSrc:o,aspectRatio:m,rotation:k,zoom:E,onZoomChange:I,onCropComplete:B})}),Q&&t(VA,{children:[e(N,{size:28,sx:{color:p[900]}}),e(j,{variant:"body2",children:"Processing…"})]})]}),t(KA,{children:[e(cl,{toolTipLabel:"Zoom out",children:e(GA,{size:"small",onClick:()=>{I((e=>Math.max(1,Number((e-.1).toFixed(2)))))},"aria-label":"Zoom out",disabled:E<=1||Q,children:e(ci,{fontSize:"small"})})}),e(hi,{value:E,min:1,max:3,step:.05,"aria-label":"Zoom",onChange:(e,t)=>{"number"==typeof t&&I(t)},size:"small",disabled:Q,sx:{flex:1,color:p[900],"& .MuiSlider-rail":{backgroundColor:c[700]}}}),e(cl,{toolTipLabel:"Zoom in",children:e(GA,{size:"small",onClick:()=>{I((e=>Math.min(3,Number((e+.1).toFixed(2)))))},"aria-label":"Zoom in",disabled:E>=3||Q,children:e(di,{fontSize:"small"})})}),t(j,{variant:"caption",color:c[800],sx:{minWidth:36,textAlign:"right"},children:[Math.round(100*E),"%"]}),b&&e(YA,{children:e(x,{component:"img",src:b,alt:"Crop preview",sx:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}})})]})]})})}const WA="120px",qA="120px",zA=(e,t,i)=>i?"none":t?`1px dashed ${e}`:`1px solid ${e}`,OA=J(x,{shouldForwardProp:e=>"isDragging"!==e&&"hasImage"!==e&&"disabled"!==e&&"frameWidth"!==e&&"frameHeight"!==e&&"frameBorderRadius"!==e&&"isViewMode"!==e&&"hideBorder"!==e})((e=>(({theme:e,isDragging:t,hasImage:i,disabled:o,frameWidth:n,frameHeight:r,frameBorderRadius:l,isViewMode:a,hideBorder:s})=>{const{butterflyBlue:C,iron:A}=e.palette.app.color,d=t||i?C[900]:e.palette.grey[400],c=n??qA,h=a&&i||!a&&!o,p=!o&&!a&&!s;return{width:c,height:r??WA,minWidth:c,maxWidth:c,position:"relative",overflow:"hidden",borderRadius:l??"10px",border:zA(d,t,s),backgroundColor:t?R(C[900],.05):i?e.palette.common.white:A[50],cursor:h?"pointer":"default",opacity:o&&!a?.6:1,transition:"all 0.2s ease-in-out",outline:"none",boxSizing:"border-box","&:focus-visible":{outline:h?`2px solid ${C[900]}`:"none",outlineOffset:2},...p&&{"&:hover":{border:zA(C[900],t)}}}})(e))),PA=J(x)((({theme:e})=>({width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:e.palette.common.white}))),NA=J(x,{shouldForwardProp:e=>"frameBorderRadius"!==e})((({theme:e,frameBorderRadius:t})=>{const{mirage:i}=e.palette.app.color;return{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",gap:"4px",backgroundColor:R(i[600],.2),backdropFilter:"blur(3px)",borderRadius:t??"10px",zIndex:2}})),XA=J(x,{shouldForwardProp:e=>"frameBorderRadius"!==e})((({theme:e,frameBorderRadius:t})=>{const{mirage:i}=e.palette.app.color;return{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:R(i[600],.35),backdropFilter:"blur(2px)",borderRadius:t??"10px",zIndex:3}}));function _A({open:i,size:o,disabled:r,borderRadius:l,onEdit:a,onDelete:s,onHoverChange:C}){const A=M(),{lightBlue:d}=A.palette.app.color,c="small"===o?16:20,h="small"===o?"small":"medium";return e(ri,{in:i,timeout:{enter:300,exit:1e3},children:t(NA,{frameBorderRadius:l,onFocus:()=>C(!0),onBlur:e=>{kA(e.currentTarget,e.relatedTarget)&&C(!1)},children:[e(n,{tabIndex:0,disabled:r,"aria-label":"Replace logo",size:h,onClick:e=>{e.stopPropagation(),a()},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),a())},children:e(oi,{sx:{color:d[50],fontSize:c}})}),e(n,{tabIndex:0,disabled:r,"aria-label":"Remove logo",size:h,onClick:s,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||s(e)},children:e(ii,{sx:{color:d[50],fontSize:c}})})]})})}function $A({size:i,disabled:o=!1,enableCaptureImage:n=!1,onAttach:r,onCapture:l}){const a=M(),{iron:s}=a.palette.app.color,C=e=>t=>{t.stopPropagation(),t.preventDefault(),o||e()};return t(FA,{logoSize:i,children:[n&&e(cl,{toolTipLabel:"Capture photo",placement:"top",children:e(yA,{logoSize:i,delayMs:0,disabled:o,"aria-label":"Capture photo",onClick:C((()=>l?.())),children:e(ti,{sx:{color:s[900]}})})}),e(cl,{toolTipLabel:"Upload logo",placement:"top",children:e(yA,{logoSize:i,delayMs:n?40:0,disabled:o,"aria-label":"Upload logo",onClick:C(r),children:e(ui,{sx:{color:s[900]}})})})]})}const ed={small:{base:60,rectShort:36,rectMaxLong:120,borderRadius:"8px",iconFontSize:20},medium:{base:80,rectShort:48,rectMaxLong:160,borderRadius:"8px",iconFontSize:24},large:{base:120,rectShort:72,rectMaxLong:240,borderRadius:"10px",iconFontSize:28}},td=(e,t="square")=>{const{base:i,borderRadius:o}=ed[e];return{width:i,height:i,borderRadius:"circle"===t?"50%":o}},id=e=>{const{base:t,rectMaxLong:i}=ed[e];return{maxPreviewWidth:i,maxPreviewHeight:t}},od=(e,t)=>{if(!e||!t)return"square";const i=e/t;return Math.abs(i-1)<=.12?"square":i>1?"rectangle":"portrait"},nd=(e,t="large",i,o)=>{const{base:n,rectShort:r,rectMaxLong:l,borderRadius:a}=ed[t];if("circle"===e)return{width:n,height:n,borderRadius:"50%"};if("square"===e)return{width:n,height:n,borderRadius:a};if("rectangle"===e)return{width:l,height:r,borderRadius:a};if(!i||!o)return{width:n,height:n,borderRadius:a};const s=od(i,o);if("square"===s)return{width:n,height:n,borderRadius:a};const C=i/o;if("rectangle"===s){const e=r;return{width:Math.min(l,Math.round(e*C)),height:e,borderRadius:a}}const A=r;return{width:A,height:Math.min(l,Math.round(A/C)),borderRadius:a}},rd=e=>new Promise(((t,i)=>{const o=new Image;o.onload=()=>{const{naturalWidth:e,naturalHeight:i}=o;t({width:e,height:i})},o.onerror=()=>i(new Error("Failed to load image")),o.crossOrigin="anonymous",o.src=e}));function ld({size:t,disabled:i,enableCaptureImage:o,onAttach:n,onCapture:r}){const l=M(),{iron:s}=l.palette.app.color,{iconFontSize:C}=ed[t];return o?e($A,{size:t,disabled:i,enableCaptureImage:o,onAttach:n,onCapture:r}):e(a,{justifyContent:"center",alignItems:"center",sx:{height:"100%"},children:e(gi,{sx:{color:s[700],fontSize:C}})})}function ad({open:i,imageSrc:o,title:r="Logo",onClose:l}){const a=M(),{iron:s}=a.palette.app.color;return e(fi,{open:i,onClose:l,closeAfterTransition:!0,slots:{backdrop:mi},slotProps:{backdrop:{timeout:200,sx:{backgroundColor:R(a.palette.common.white,.45),backdropFilter:"blur(8px) saturate(1.7)",WebkitBackdropFilter:"blur(8px) saturate(9)"}}},"aria-label":r,children:e(ri,{in:i,children:t(x,{sx:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",p:{xs:2,sm:4},outline:"none",overflow:"hidden"},onClick:l,children:[e(n,{"aria-label":"Close",onClick:l,size:"small",sx:{position:"absolute",top:{xs:12,sm:16},right:{xs:12,sm:16},zIndex:2,color:s[400],bgcolor:"transparent",boxShadow:"none","&:hover":{bgcolor:"transparent",opacity:.7}},children:e(st,{fontSize:"small"})}),e(x,{sx:{position:"relative",maxWidth:"min(920px, 100%)",maxHeight:"100%",lineHeight:0},onClick:e=>e.stopPropagation(),children:e(x,{component:"img",src:o,alt:r,sx:{display:"block",maxWidth:"100%",maxHeight:"min(82vh, 680px)",width:"auto",height:"auto",objectFit:"contain",borderRadius:"10px",bgcolor:a.palette.common.white,boxShadow:`0 12px 40px ${R(s[400],.18)}`}})})]})})})}function sd({previewUrl:o,label:r,required:l,hideBorder:s,variant:C,size:A,frame:d,maxPreviewWidth:c,maxPreviewHeight:p,onView:u}){const m=M(),{iron:f,lightBlue:E}=m.palette.app.color,{iconFontSize:I}=ed[A],[k,S]=h(!1),[w,B]=h(!1),[Q,J]=h(!1),b="auto"===C,v=!!o&&!Q,R="small"===A?16:20;g((()=>{J(!1)}),[o]);const L=b?{width:"fit-content",height:"fit-content",minWidth:"unset",maxWidth:"unset"}:void 0,{width:y,height:F,borderRadius:U}=d,Z=b?{display:"block",maxWidth:c,maxHeight:p,width:"auto",height:"auto",borderRadius:U}:{display:"block",width:"100%",height:"100%",objectFit:"cover",objectPosition:"center",borderRadius:U},D=e=>{e?.stopPropagation(),v&&(u?u():B(!0))},H=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),D())},K=e=>{kA(e.currentTarget,e.relatedTarget)&&S(!1)};return v?t(i,{children:[t(a,{direction:"row",alignItems:"center",gap:"15px",children:[t(OA,{hasImage:!0,isViewMode:!0,hideBorder:s,frameWidth:b?"fit-content":y,frameHeight:b?"fit-content":F,frameBorderRadius:U,tabIndex:0,role:"button","aria-label":`View ${r||"logo"}`,onClick:()=>D(),onKeyDown:H,onMouseEnter:()=>S(!0),onFocus:()=>S(!0),onBlur:K,onMouseLeave:()=>S(!1),sx:L,children:[e(ri,{in:k,timeout:{enter:300,exit:1e3},children:e(NA,{frameBorderRadius:U,onFocus:()=>S(!0),onBlur:K,children:e(n,{tabIndex:0,"aria-label":"View logo",size:"small"===A?"small":"medium",onClick:D,onKeyDown:H,children:e(Ot,{sx:{color:E[50],fontSize:R}})})})}),e(PA,{sx:{borderRadius:U,...b?{width:"fit-content",height:"fit-content"}:void 0},children:e(x,{component:"img",src:o,alt:"Logo",onError:()=>J(!0),sx:Z})})]}),r&&e(ze,{required:l,children:r})]}),e(ad,{open:w,imageSrc:o,title:r||"View Logo",onClose:()=>B(!1)})]}):t(a,{direction:"row",alignItems:"center",gap:"15px",children:[e(OA,{hasImage:!1,disabled:!0,isViewMode:!0,frameWidth:y,frameHeight:F,frameBorderRadius:U,role:"img","aria-label":r||"Logo",children:e(x,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",sx:{height:"100%"},children:e(gi,{sx:{color:f[700],fontSize:I}})})}),r&&e(ze,{required:l,children:r})]})}const Cd=({size:i="large"})=>{const{base:o,borderRadius:n}=ed[i],r="small"===i;return t(a,{direction:"row",alignItems:"center",gap:r?"10px":"15px",children:[e(Ie,{variant:"rectangular",sx:{width:o,height:o,minWidth:o,maxWidth:o,borderRadius:n,transform:"scale(1)"}}),t(a,{gap:"5px",children:[e(Ie,{width:r?90:120,height:r?18:24,sx:{transform:"scale(1)"}}),e(Ie,{width:r?100:140,height:r?12:16,sx:{transform:"scale(1)"}})]})]})},Ad=(e,t,i)=>(t&&Is.error({title:e}),{valid:!1,error:e,...i}),dd=async(e,t,i,o)=>{try{const{width:n,height:r}=await(e=>new Promise(((t,i)=>{const o=URL.createObjectURL(e),n=new Image;n.onload=()=>{const{naturalWidth:e,naturalHeight:i}=n;URL.revokeObjectURL(o),t({width:e,height:i})},n.onerror=()=>{URL.revokeObjectURL(o),i(new Error("Failed to load image"))},n.src=o})))(e),l=Math.min(n,r);if(l<t)return Ad(`Image resolution too low. Minimum is ${t}×${t} px.`,o,{width:n,height:r});if(l<i){const e=`Image quality may be low (${n}×${r} px). Consider using a higher-resolution logo.`;return o&&Is.warning({title:e}),{valid:!0,warning:e,width:n,height:r}}return{valid:!0,width:n,height:r}}catch{return Ad("Unable to read image. Please try another file.",o)}};function cd({onChange:o,onDelete:n,onView:r,defaultValue:l="",value:s,label:C="Logo",subTitle:A="PNG, JPEG under 5 MB",mode:d="edit",variant:m="square",size:f="large",maxPreviewWidth:E,maxPreviewHeight:I,hideBorder:k=!1,maxSizeMB:S=5,minResolution:w=256,qualityWarnResolution:B=512,aspectRatios:x=fA,enabledVariants:Q=mA,isUploading:J=!1,loading:b=!1,disabled:v=!1,required:R=!1,enableCaptureImage:L=!1,acceptedTypes:y=nA}){const F=M(),{iron:U,butterflyBlue:Z}=F.palette.app.color,D="view"===d,H=id(f),K=E??H.maxPreviewWidth,G=I??H.maxPreviewHeight,Y="circle"===m?"circle":"square",V=c((()=>td(f,Y)),[f,Y]),T=p(null),W=p(null),q=p(null),z=p(null),[O,P]=h(!1),[X,_]=h(!1),[$,ee]=h(s??l),[te,ie]=h(!1),[oe,ne]=h(null),[re,le]=h(!1),[ae,se]=h(!1),[Ce,Ae]=h(null),[de,ce]=h(null),[he,pe]=h(!1),[ge,ue]=h(!1),[me,fe]=h((()=>nd(m,f))),{inputRef:Ee,setInputRef:Ie,maintainFocusAfterClose:ke}=$o({isOpen:he||ae});g((()=>{void 0!==s&&ee(s)}),[s]),g((()=>{ie(!1)}),[$]),g((()=>{if(!D)return void fe(V);if("auto"!==m)return void fe(nd(m,f));if(!$)return void fe(nd("square",f));let e=!1;return rd($).then((({width:t,height:i})=>{e||fe(nd("auto",f,t,i))})).catch((()=>{e||fe(nd("square",f))})),()=>{e=!0}}),[D,m,$,f,V]);const Se=D?me:V,we=!!$&&!te,Be=u((()=>{SA(W.current),W.current=null}),[]);g((()=>()=>{Be(),SA(q.current),q.current=null,z.current&&clearTimeout(z.current)}),[Be]);const xe=()=>{v||Ee.current?.click()},Qe=()=>{!v&&L&&(ue(!1),pe(!0))},Me=()=>{z.current&&(clearTimeout(z.current),z.current=null)},Je=()=>{!v&&we&&L&&(Me(),ue(!0))},be=()=>{Me(),z.current=setTimeout((()=>{ue(!1)}),160)},ve=e=>{L?e?Je():be():P(e)},Re=async e=>{if(o){ne(null),le(!0),ue(!1);try{const t=await(async(e,{maxSizeMB:t=5,minResolution:i=256,qualityWarnResolution:o=512,acceptedTypes:n=nA,showToasts:r=!0}={})=>sA(e,n)?To(e,t)?IA(e)?{valid:!0}:dd(e,i,o,r):Ad(`File too large. Maximum size is ${t} MB.`,r):Ad("Unsupported file type. Use PNG, JPG, JPEG, SVG, or WEBP.",r))(e,{maxSizeMB:S,minResolution:w,qualityWarnResolution:B,acceptedTypes:y});if(!t.valid)return void ne(t.error??"Invalid file");if(IA(e)){const t=await(async(e,t)=>{const i=URL.createObjectURL(e),o={};for(const i of t)o[i]=e;return{cropped:e,variants:o,previewUrl:i}})(e,Q),{cropped:i,variants:n,previewUrl:r}=t;return Be(),W.current=r,ee(r),void o({original:e,cropped:i,variants:n,aspectRatio:"1:1",previewUrl:r})}const i=URL.createObjectURL(e);ce(e),Ae((e=>(SA(e),q.current=i,i))),se(!0)}finally{le(!1)}}},Le=e=>{const[t]=Array.from(e);t&&Re(t)},ye=e=>{e?.stopPropagation(),e?.preventDefault(),Be(),ee(""),ie(!1),ne(null),ce(null),ue(!1),Ae((e=>(SA(e),q.current=null,null))),n?.()};if(b)return e(Cd,{size:f});if(D)return e(sd,{previewUrl:$,label:C,required:R,hideBorder:k,variant:m,size:f,frame:Se,maxPreviewWidth:K,maxPreviewHeight:G,onView:r});const{width:Fe,height:Ue,borderRadius:Ze}=Se,De="50%"===Ze?"50%":"8px",He=(({enableCaptureImage:t,onEdit:i,onCapture:o,onDelete:n})=>{const r=[{key:"edit",label:"Replace logo",icon:e(oi,{}),onClick:e=>{e.stopPropagation(),i()}}];return t&&r.push({key:"capture",label:"Capture photo",icon:e(ti,{}),onClick:e=>{e.stopPropagation(),o()}}),r.push({key:"delete",label:"Remove logo",icon:e(ii,{}),onClick:e=>{n(e)}}),r})({enableCaptureImage:L,onEdit:xe,onCapture:Qe,onDelete:ye});return t(i,{children:[t(a,{direction:"row",alignItems:"center",gap:"15px",children:[t(OA,{ref:T,isDragging:X,hasImage:we,disabled:v,frameWidth:Fe,frameHeight:Ue,frameBorderRadius:Ze,tabIndex:v?-1:0,role:"button","aria-disabled":v,"aria-label":C||"Logo",onClick:()=>!v&&!we&&!L&&xe(),onKeyDown:e=>{v||we||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),xe())},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),!v&&(e=>e.dataTransfer.types.includes("Files"))(e)&&_(!0)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),v||(e.dataTransfer.dropEffect="copy")},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),kA(e.currentTarget,e.relatedTarget)&&_(!1)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),_(!1),!v&&e.dataTransfer.files.length>0&&Le(e.dataTransfer.files)},onMouseEnter:()=>!v&&ve(!0),onFocus:()=>!v&&ve(!0),onMouseLeave:()=>ve(!1),onBlur:e=>{kA(e.currentTarget,e.relatedTarget)&&ve(!1)},children:[e("input",{ref:Ie,type:"file",accept:rA,onChange:e=>{!v&&e.target.files&&(Le(e.target.files),e.target.value="")},disabled:v,style:{display:"none"},"aria-hidden":!0}),!L&&e(_A,{open:O&&!!$&&!v,size:f,disabled:v,borderRadius:Ze,onEdit:xe,onDelete:ye,onHoverChange:P}),(J||re)&&e(XA,{frameBorderRadius:Ze,children:e(N,{size:"small"===f?16:22,sx:{color:U[600]}})}),X&&e(XA,{frameBorderRadius:Ze,children:e(j,{variant:"caption",color:Z[900],children:"Drop"})}),we?e(PA,{sx:{borderRadius:Ze},children:e("img",{src:$,alt:"Logo",onError:()=>ie(!0),style:{width:"100%",height:"100%",objectFit:"contain",objectPosition:"center",display:"block",borderRadius:De}})}):e(ld,{size:f,disabled:v,enableCaptureImage:L,onAttach:xe,onCapture:Qe})]}),t(a,{gap:"5px",justifyContent:"center",children:[C&&e(ze,{disabled:v,required:R,children:C}),A&&e(j,{noWrap:!0,variant:"caption",color:U[800],children:A}),oe&&e(j,{variant:"caption",color:"error",children:oe})]})]}),L&&we&&!v&&e(UA,{open:ge,anchorEl:T.current,size:f,actions:He,onClose:()=>ue(!1),onMouseEnter:Je,onMouseLeave:be}),ae&&Ce&&de&&o&&e(jA,{open:ae,imageSrc:Ce,originalFile:de,aspectRatios:x,enabledVariants:Q,onClose:()=>{se(!1),ke()},onApply:({cropped:e,variants:t,previewUrl:i,aspectRatio:n})=>{Be(),W.current=i,ee(i),ne(null),se(!1),o({original:de,cropped:e,variants:t,aspectRatio:n,previewUrl:i}),Is.success({title:"Logo cropped successfully"}),ke()}}),L&&he&&e($C,{open:he,isUploading:J||re,onChange:Le,onClose:()=>{pe(!1),ke()}})]})}const hd=J(ne,{shouldForwardProp:e=>"selected"!==e})((({theme:e,selected:t})=>({background:e.palette.app.color.iron[600],color:e.palette.app.color.mirage[900],borderRadius:"4px",border:`1px solid ${e.palette.app.color.butterflyBlue[300]}`,...t?{background:e.palette.app.color.deepAqua[500],color:e.palette.app.color.mirage[900],borderLeft:`6px solid ${e.palette.app.color.butterflyBlue[900]}`}:{}})));function pd({label:i,selected:o,actions:n,companyName:r,href:l,target:s,...A}){const d=M(),{iron:c}=d.palette.app.color,u=p(null),[m,f]=h(!1);g((()=>{const e=u.current;if(!e)return;const t=()=>f(e.scrollWidth>e.clientWidth);return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}),[i,r]);return e(hd,{selected:o,alignItems:"flex-start",...l?{component:C,href:l,target:s,prefetch:!1}:{},...A,children:t(a,{width:"100%",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[t(a,{gap:"5px",direction:"column",flex:1,display:"grid",children:[e(cl,{toolTipLabel:i,checkOverflow:!m,children:e(j,{variant:"body2",fontWeight:500,ref:u,sx:{width:"auto",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:i})}),e(j,{variant:"caption",color:c[800],children:r})]}),n]})})}const gd=new Set(["+","-","e","E","*","/","=","%","^"]),ud=/[+\-eE*/=%^]/,md={string:"Only alphabetic characters are allowed.","string-number":"Only letters and numbers are allowed.","string-number-special":"Special characters are allowed.","string-special":"Only letters, accents, apostrophes, and hyphens are allowed.","string-special-all":"Only letters and Special characters are allowed",custom:"Please enter a valid input"};function fd({control:i,name:o,defaultValue:n,label:r="",rules:l,type:s,required:C,disabled:A,loading:d=!1,placeholder:c="",isCapitalize:h=!1,isTrimStartDisabled:p=!1,rows:g,characterType:u="string-number-special",letterCase:m="mixed",setError:f,containerProps:E,styling:I="custom",infoMessage:k,regexExpression:S={message:null,regex:/^[\s\S]*$/},navigationKey:w,customOnChange:B,size:x,...Q}){const{field:{value:M,onChange:J,onBlur:b,...v},fieldState:{error:R}}=_e({name:o,control:i,defaultValue:n,rules:l}),{navigationKey:L}=Ro(),y=w??L,{inputRef:F,maintainFocus:U,handleKeyDown:Z,handleEnterNavigation:D}=$o({navigationKey:y}),{inputHeight:H,inputFontSize:K}=xs(x),G=Boolean(g??Q.multiline),Y=e=>{let t=e;const i=(e=>{switch(e){case"string":return/^[A-Za-z\s]*$/;case"string-number":return/^[A-Za-z0-9\s]*$/;case"string-number-special":default:return/^[\s\S]*$/;case"string-special":return/^[\p{L}’'\-\s.]+$/u;case"string-special-all":return/^[^\d]+$/;case"custom":return S.regex}})(u);return i.test(t)||(t=t.split("").filter((e=>i.test(e))).join("")),"uppercase"===m?t=t.toUpperCase():"lowercase"===m&&(t=t.toLowerCase()),t},{message:V}=S,T=V||md[u];return d?e(BC,{label:r,multiline:G,styling:I,size:x}):t(a,{...E,gap:"5px",children:[r&&"custom"===I&&t(a,{direction:"row",children:[e(ze,{required:C,disabled:A,children:r}),k&&e(cl,{toolTipLabel:k,children:e(Gt,{sx:{fontSize:13}})})]}),e(Oe,{disabled:A,required:C,fullWidth:!0,inputRef:F,onKeyDown:e=>{"number"===s&&gd.has(e.key)&&e.preventDefault();!Boolean(g??Q.multiline)||"Enter"!==e.key||"enter"!==y||e.shiftKey||e.ctrlKey||e.metaKey||e.altKey?Z(e,void 0,!1):D(e,!0)},onPaste:e=>{"number"===s&&ud.test(e.clipboardData.getData("text"))&&e.preventDefault()},placeholder:"default"===I?c:c||r,type:s,label:"default"===I?r:void 0,sx:{...Js(I),"& .MuiInputBase-root":{...!G&&{height:`${H}px !important`,fontSize:K}}},InputLabelProps:Ms(I,x,G),inputProps:{min:0},error:Boolean(R),helperText:R?.message,onChange:e=>{const t=e.target,{selectionStart:i,selectionEnd:n}=t;let r=e.target.value||null;"string"==typeof r&&""===r.trim()?r=null:p||"string"!=typeof r||(r=r.trimStart());const l=r&&Y(r);if(r!==l&&f)return void f(o,{type:"manual",message:T});let a=l;r&&"number"===s?a=Number(r):h&&l&&(a=l?l.toUpperCase():null),J(a),B&&B(r),requestAnimationFrame((()=>{"text"==s&&t.setSelectionRange(i,n),U()}))},onBlur:()=>{if(!p&&"string"==typeof M){const e=M.trim(),t=""===e?null:e;M!==t&&J(t)}b()},value:"string"==typeof M?M.trimStart():M??"",...v,...Q})]})}function Ed(t){const[i,o]=h(!1);return e(fd,{type:i?"text":"password",InputProps:{startAdornment:e(qe,{position:"start",children:e(Ei,{fontSize:"small"})}),endAdornment:e(qe,{position:"end",children:e(n,{"aria-label":"toggle password visibility",onClick:()=>{o((e=>!e))},edge:"end",children:e(i?Ii:Ot,{fontSize:"small"})})})},...t})}const Id=J(x,{shouldForwardProp:e=>"error"!==e})((({styling:e,theme:t,error:i,size:o})=>{const n={position:"relative"},{red:r,butterflyBlue:l,iron:a,slate:s,black:C}=t.palette.app.color,{fontSize:A}=Qs(o);return"custom"===e?{...n,"&.custom_phone_input":{"& .phone-input-container":{"&:focus-within":{border:`2px solid ${l[900]} !important`}},"& .phone-input-field":{padding:"8.5px 50px 8.5px 30px","&:focus":{"& ~ .flag-dropdown":{borderColor:i?r[900]:l[900]}}},"& .flag-dropdown":{"&.open":{borderColor:i?r[900]:l[900]}}}}:{"&.default_phone_input":{"& .react-tel-input":{"& .form-control":{fontSize:"16px",background:a[600],border:`1px solid ${s[100]}`,borderRadius:"5px",width:"300px",outline:"none",padding:"18.5px 14px 18.5px 58px",transition:"box-shadow ease .25s, border-color ease .25s","&:focus":{borderColor:l[900],boxShadow:`0 0 0 2px ${l[900]}`},"&.invalid-number":{border:`1px solid ${r[900]}`,"&:focus":{boxShadow:`0 0 0 2px ${r[900]}`},"&+div:before":{content:"'Error'",display:"none",color:`${r[900]}`,width:"27px"}}},"& .flag-dropdown":{position:"absolute",top:"0",bottom:"0",padding:"0",backgroundColor:a[600],borderRadius:"3px 0 0 3px","&:hover, &:focus":{cursor:"pointer"}},"& input[disabled]":{"&+.flag-dropdown":{"&:hover":{cursor:"default",borderColor:s[100],"& .selected-flag":{backgroundColor:"transparent"}}}},"& .selected-flag":{outline:"none",position:"relative",height:"100%",padding:"0 0 0 8px",borderRadius:"3px 0 0 3px","&:focus":{"& .arrow":{borderLeftWidth:"4px",borderRightWidth:"4px",borderTop:`5px solid ${l[900]}`}},"& .flag":{position:"absolute",top:"50%",marginTop:"-6px"},"& .arrow":{position:"relative",top:"50%",marginTop:"-1px",width:"0",height:"0",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderTop:"4px solid #555","&.up":{borderTop:"none",borderBottom:"4px solid #555"}}},"& .country-list":{outline:"none",zIndex:1,listStyle:"none",position:"absolute",padding:"0",margin:"10px 0 10px -1px",backgroundColor:"white",width:"300px",maxHeight:"220px",overflowY:"scroll",borderRadius:"7px","& .flag":{display:"inline-block",position:"absolute",left:"13px",top:"8px",marginRight:"7px",marginTop:"2px"},"& .divider":{paddingBottom:"5px",marginBottom:"5px",borderBottom:"1px solid #ccc"},"& .country":{position:"relative",padding:"12px 9px 13px 46px","& .dial-code":{color:"#6b6b6b"},"&:hover":{backgroundColor:"hsl(0, 0.00%, 94.50%)"},"&.highlight":{backgroundColor:s[300]}},"& .country-name":{marginRight:"6px"},"& .search":{zIndex:2,position:"sticky",top:"0",backgroundColor:"#fff",padding:"10px 0 6px 10px"},"& .search-emoji":{display:"none",fontSize:"15px"},"& .search-box":{border:`1px solid ${s[100]}`,borderRadius:"3px",fontSize:"15px",lineHeight:"15px",marginLeft:"6px",padding:"3px 8px 5px",outline:"none","&:hover":{borderColor:s[50]}},"& .no-entries-message":{padding:"7px 10px 11px",opacity:".7"}},"& .invalid-number-message":{position:"absolute",zIndex:1,fontSize:"13px",left:"25px",top:"-7px",background:"#fff",padding:"0 5px",color:r[900]},"& .special-label":{position:"absolute",zIndex:5,top:"small"===o?"-8px":"-9px",left:"0px",display:"block",color:C[900],background:a[600],opacity:"1",fontSize:`${A}px`,whiteSpace:"nowrap",lineHeight:"1.1",scale:"small"===o?.83:.85}},"&.phone-input-required .react-tel-input .special-label::after":{content:"' *'",color:r[900],fontSize:"13px",fontWeight:500}}}})),kd=({rows:i,label:o,styling:n,size:r})=>{const{inputHeight:l}=xs(r),s=void 0===i?l:26.5*i;return t(a,{gap:"5px",children:[o&&"custom"===n&&e(Ie,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(Ie,{height:`${s}px`,sx:{transform:"scale(1)"}})]})};function Sd({control:i,name:o,defaultValue:n,rules:r,label:l,disabled:s=!1,required:C,rows:A,loading:d=!1,placeholder:c="",error:u,helperText:m,navigationKey:f,styling:E="custom",size:I,autoFocus:k=!1,...S}){const w=M(),{iron:B,red:x,slate:Q}=w.palette.app.color,{navigationKey:J}=Ro(),b=f??J,{inputHeight:v,inputFontSize:R}=xs(I),{inputProps:L,...y}=S,F={...L??{},...k&&!s?{autoFocus:!0}:{}},{field:{value:U,onChange:Z,...D}}=_e({name:o,control:i,defaultValue:n,rules:r}),[H,K]=h(!1),{setInputRef:G,maintainFocusAfterClose:Y,handleKeyDown:V}=$o({isOpen:H,navigationKey:b}),T=p(null);return g((()=>{const e=T.current;if(!e||s)return;const t=e.querySelector("input[type='tel']");t&&(G(t),D.ref(t));const i=()=>{const t=e.querySelector(".country-list"),i=e.querySelector(".react-tel-input");if(!t)return;const o=i?.getBoundingClientRect()?.width,n=e.querySelector(".flag-dropdown")?.getBoundingClientRect();n&&(t.style.position="fixed",t.style.top=`${n.bottom}px`,t.style.left=`${n.left}px`,t.style.zIndex="99999",t.style.maxHeight="200px",t.style.overflowY="auto",t.style.width=`${o}px`)},o=()=>{i()};window.addEventListener("resize",o),window.addEventListener("scroll",o,!0);const n=()=>{const t=e.querySelector(".selected-flag");t&&(t.setAttribute("tabindex","-1"),t.addEventListener("focus",(()=>{t.blur()})));const o=!!e.querySelector(".flag-dropdown.open");K(o),o&&(i(),setTimeout((()=>{const t=e.querySelector(".country-list .search-box input");t&&t.focus()}),0))},r=new MutationObserver((e=>{n();e.some((({addedNodes:e})=>!e.length))&&i()}));r.observe(e,{attributes:!0,attributeFilter:["class"],subtree:!0,childList:!0});const l=e=>{const t=e.target;(t.closest(".flag-dropdown")||t.closest(".country-list"))&&setTimeout(n,0)},a=e=>{const t=e.target;t.closest(".flag-dropdown")||t.closest(".country-list")||setTimeout(n,0)};return e.addEventListener("click",l),document.addEventListener("click",a),n(),()=>{window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0),r.disconnect(),e.removeEventListener("click",l),document.removeEventListener("click",a)}}),[G,D,s]),d?e(kd,{label:l,rows:A,styling:E,size:I}):t(a,{gap:"4px",children:[t(a,{gap:"5px",children:[l&&"custom"===E&&e(ze,{required:C,disabled:s,children:l}),e(Id,{ref:T,styling:E,error:u,size:I,className:`${"custom"===E?"custom_phone_input":"default_phone_input"}${C?" phone-input-required":""}`,children:e(ki,{country:"in",enableSearch:!0,disabled:s,specialLabel:l??"",placeholder:c||l,onChange:e=>{Z(e)},value:String(U),onBlur:()=>{D.onBlur(),H||Y()},onKeyDown:e=>{H||V(e,void 0,!1)},containerStyle:{width:"100%",height:`${v}px`,border:u?`1px solid ${x[900]}`:s?`1px solid ${B[700]}`:`1px solid ${B[800]}`,borderRadius:"4px",transition:"all 0.2s ease"},inputStyle:{width:"100%",padding:"8.5px 40px",fontSize:R,height:`${v}px`,border:"none",outline:"none",transition:"all 0.2s ease",color:s?B[100]:Q[900]},containerClass:"phone-input-container",inputClass:"phone-input-field",buttonStyle:{border:"none"},...y,inputProps:F})})]}),u&&e(j,{variant:"caption",sx:{color:"red",whiteSpace:"pre",textWrap:"wrap"},children:m})]})}const wd=e=>"medium"===e?26:20,Bd=({isHorizontal:i,direction:o,optionsLength:n,size:r})=>{const l=wd(r);return t(a,{gap:"10px",direction:i?"row":"column",alignItems:i&&"row"===o?"center":void 0,children:[e(Ie,{height:"18.69px",width:"70px",sx:{transform:"scale(1)"}}),e(a,{direction:o,gap:"column"===o?"5px":"10px",children:Array.from({length:n}).map((()=>t(a,{gap:"10px",direction:"row",alignItems:"center",children:[e(Ie,{variant:"circular",height:l,width:l}),e(Ie,{height:"21px",width:"100px",sx:{transform:"scale(1)"}})]},$t())))})]})};function xd({name:i,rules:o,label:n,control:r,options:l,defaultValue:s,size:C="small",color:A="secondary",loading:d=!1,required:c=!1,direction:h="row",sx:g={},containerProps:u,isHorizontal:m=!1,navigationKey:f,customOnChange:E,...I}){const{field:{value:k,onChange:S,ref:w,...B}}=_e({name:i,control:r,defaultValue:s,rules:o}),{navigationKey:Q}=Ro(),M=f??Q,{inputRef:J,handleKeyDown:b,maintainFocus:v}=$o({navigationKey:M}),R=p(null);return d?e(Bd,{isHorizontal:m,direction:h,optionsLength:l.length,size:C}):t(a,{direction:m?"row":"column",alignItems:m?"center":void 0,gap:m?1:"5px",children:[n&&e(ze,{sx:{whiteSpace:"normal",overflow:"visible",textOverflow:"unset"},required:c,disabled:I.disabled,children:n}),e(Bi,{name:i,value:k,onKeyDown:e=>{b(e,void 0,!1)},onChange:(e,t)=>{let i;if("true"===t?(i=!0,S(!0)):"false"===t?(i=!1,S(!1)):(i=t,S(t)),E){const e=l.find((({values:e})=>e===i));e&&E(e)}const o=e.target;o?J.current=o:!J.current&&R.current&&(J.current=R.current),v()},children:e(a,{gap:"column"===h?"5px":"10px",direction:h,...u,children:l?.map((({label:t,values:i,disabled:o},n)=>e(x,{children:e(Si,{value:i,control:e(wi,{...B,...I,color:A,size:C,inputRef:e=>{if(!e)return;k===i||!J.current&&0===n?(J.current=e,R.current=e):R.current||0!==n||(R.current=e),w&&("function"==typeof w?w(e):w.current=e)},sx:{"& .MuiSvgIcon-root":{fontSize:wd(C)}}}),disabled:o,label:t,sx:g})},n)))})})]})}const Qd={small:17,medium:22,large:28},Md=({label:i,size:o="medium",direction:n="row",max:r=5})=>{const l=Qd[o],s=Array.from({length:r},((e,t)=>`star-${t+1}`));return t(a,{gap:"5px",direction:n,alignItems:"row"===n?"center":"flex-start",children:[i&&e(Ie,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(a,{gap:"2px",direction:"row",children:s.map((t=>e(Ie,{variant:"rectangular",width:l,height:l,sx:{borderRadius:"5px"}},t)))})]})};function Jd({control:o,name:n,defaultValue:r,label:l="",rules:s,disabled:C,loading:A=!1,direction:d="column",required:c=!1,navigationKey:h,size:p,max:g,containerSx:u,...m}){const{field:{value:f,onChange:E,...I},fieldState:{error:k}}=_e({name:n,control:o,defaultValue:r,rules:s}),{navigationKey:S}=Ro(),w=h??S,{maintainFocus:B,handleKeyDown:x}=$o({navigationKey:w});return A?e(Md,{label:l,size:p,direction:d,max:g}):t(i,{children:[t(a,{gap:"5px",direction:d,alignItems:"row"===d?"center":"flex-start",sx:u,children:[l&&e(ze,{required:c,disabled:C,children:l}),e("div",{onKeyDown:e=>{x(e,void 0,!1)},children:e(Qi,{disabled:C,value:f??null,onChange:(e,t)=>{E(t),B()},size:p,max:g,...I,...m})})]}),k&&e(xi,{error:!0,children:k?.message})]})}function bd(t){return e(fd,{placeholder:"Search",InputProps:{startAdornment:e(qe,{position:"start",children:e(Mi,{fontSize:"small"})})},...t,containerProps:{width:{sm:"auto",xs:"100%"},...t.containerProps}})}const vd=({top:t="0px",paperSx:i,boxSx:o,...n})=>e(le,{variant:"outlined",sx:{position:"sticky",top:t,zIndex:100,...i},children:e(Rl,{padding:{padding:"5px"},children:e(x,{sx:{display:"flex",justifyContent:"flex-end",...o},children:e(bd,{...n})})})}),Rd=J(Li)((({theme:e,disabled:t})=>{const{lightBlue:i,iron:o}=e.palette.app.color;return{"& .MuiInputBase-root":{backgroundColor:t?R(i[100],.3):o[600]},"& .MuiSelect-select":{display:"flex",alignItems:"center",gap:"8px",flexWrap:"nowrap",overflow:"hidden"},"& .MuiList-root":{maxHeight:300,overflowY:"auto","&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{backgroundColor:i[100]}}}})),Ld=J(j)((({theme:e})=>{const{butterflyBlue:t}=e.palette.app.color;return{position:"sticky",top:0,padding:"8px 16px",fontSize:"13px",fontWeight:600,color:t[900],backgroundColor:t[500],zIndex:1}}));function yd({control:o,defaultValue:r,name:s,required:C=!1,label:A,multiple:d=!1,disabled:g=!1,options:m=[],rules:f,loading:E=!1,helperText:I,error:k,placeholder:S="",isShowSelectAll:w=!0,isShowAvatar:B=!1,onAction:J,renderOption:b,maxLimit:v,maxDisplayItems:R=2,disableClearable:L=!!C,setOnFinalChange:y=!1,styling:F="custom",navigationKey:U,...Z}){const{field:{onChange:D,value:H,...K}}=_e({name:s,control:o,defaultValue:r,rules:f}),{navigationKey:G}=Ro(),Y=U??G,{t:V}=it(),T=M(),{slate:W,iron:q}=T.palette.app.color,z=g?q[900]:"revert-layer",[O,P]=h(null),N=p(!1),[_,$]=h(!1),{setInputRef:ee,maintainFocusAfterClose:te,handleKeyDown:ie,handleEnterNavigation:oe}=$o({isOpen:_,navigationKey:Y}),ne=c((()=>{if(!d||!w||!Array.isArray(H))return!1;const e=m.filter((e=>!e.disabled));return H.length===e.length}),[d,w,m,H]),re=c((()=>d&&Array.isArray(H)?m.filter((e=>H.includes(e.value))):[]),[d,m,H]),le=c((()=>{const e={};return m.forEach((t=>{const i=t.heading??"";e[i]||(e[i]=[]),e[i].push(t)})),e}),[m]),ae=c((()=>!L&&(!!H&&(Array.isArray(H)?H.length>0:""!==H))),[H,L]),se=u((e=>{e.stopPropagation(),D(d?[]:"")}),[d,D]),Ce=u((e=>{"enter"===Y&&"Enter"===e.key&&(e.stopPropagation(),oe(e))}),[Y,oe]),Ae=u((()=>t(a,{direction:"row",alignItems:"center",gap:"5px",children:[ae&&!_&&e(n,{size:"small",onClick:se,onKeyDown:Ce,children:e(vi,{sx:{fontSize:"14px"}})}),e(n,{size:"small",onClick:e=>{e.stopPropagation(),$((e=>!e))},onKeyDown:e=>{"Enter"===e.key&&(e.stopPropagation(),$((e=>!e)))},children:e(Ri,{fontSize:"small",sx:{transform:_?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease-in-out"}})})]})),[ae,se,Ce,_,$]);if(E)return t(a,{gap:"10px",children:[A&&"custom"===F&&e(Ie,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(Ie,{height:"35.69px",sx:{transform:"scale(1)"}})]});const de=()=>y&&N.current?O:H;return t(a,{gap:"5px",children:[A&&"custom"===F&&e(ze,{required:C,disabled:g,children:A}),t(a,{direction:"row",justifyContent:"space-between",gap:"10px",alignItems:"start",children:[t(Rd,{fullWidth:!0,error:k,disabled:g,required:C,sx:"default"===F?{...bs(F),"& .MuiOutlinedInput-notchedOutline":{"& legend":{maxWidth:0,"& span":{padding:"0 5px"}}},"& .MuiInputLabel-root.MuiInputLabel-shrink + .MuiInputBase-root .MuiOutlinedInput-notchedOutline legend":{maxWidth:"100%"}}:void 0,children:[A&&"default"===F&&e(ze,{id:`${s}-label`,sx:vs(F),children:A}),e(bi,{...K,...Z,multiple:d,value:de()??(d?[]:""),label:"default"===F?A:void 0,labelId:"default"===F&&A?`${s}-label`:void 0,inputProps:{"aria-label":"custom"===F&&A?A:void 0},onChange:e=>{const t=e.target.value;if(y)N.current=!0,d&&Array.isArray(t)&&t.includes("select-all")?P(Array.isArray(O)&&O.length===m.filter((({disabled:e})=>!e)).length?[]:m.filter((({disabled:e})=>!e)).map((({value:e})=>e))):P(t);else{if(d&&Array.isArray(t)){if(t.includes("select-all"))return void(e=>{if(e){const e=m.filter((e=>!e.disabled)).map((e=>e.value));D(e)}else D([])})(!ne);if(v&&t.length>v)return void Is.error({title:V("common.select.limitExceed",{maxLimit:v})})}D(t)}},open:_,onOpen:()=>{$(!0)},onClose:()=>{$(!1),te(),y&&N.current&&(D(O),N.current=!1,P(null))},inputRef:e=>ee(e),onKeyDown:e=>{ie(e,(()=>{$(!1)}),_)},renderValue:Z.renderValue??(i=>{if(!d){const o=m.find((e=>e.value===i)),n=()=>o?o.label:"default"===F&&A?"":S;return t(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[B&&o?.avatar&&e(ke,{src:o.avatar??"",sx:{width:20,height:20}}),e(j,{variant:"body2",color:z,sx:{WebkitTextFillColor:z},noWrap:!0,children:n()})]})}if(!Array.isArray(i)||0===i.length){return e(j,{sx:{WebkitTextFillColor:z},color:z,variant:"body2",noWrap:!0,children:"default"!==F||!A||S?S:""})}const o=re.slice(0,R),n=re.length-R;return t(x,{sx:{display:"flex",alignItems:"center",gap:.5,overflow:"hidden"},children:[o.map((t=>e(j,{variant:"body2",noWrap:!0,color:z,sx:{WebkitTextFillColor:z,backgroundColor:W[800],padding:"2px 5px",borderRadius:"12px",fontSize:"12px",maxWidth:"120px"},children:t.label},t.value))),n>0&&t(j,{variant:"body2",color:z,sx:{WebkitTextFillColor:z,backgroundColor:W[300],padding:"2px 5px",borderRadius:"12px",fontSize:"12px",fontWeight:500},children:["+",n]})]})}),IconComponent:Ae,displayEmpty:!0,MenuProps:{PaperProps:{sx:{width:"inherit",maxHeight:300,"& .MuiList-root":{paddingTop:0,paddingBottom:0}}},MenuListProps:{...Z.MenuProps?.MenuListProps,variant:"menu"}},children:Object.entries(le).length?(()=>{const o=[],n=de();return d&&w&&m.length>0&&(o.push(t(l,{value:"select-all",children:[e(Q,{icon:e(ws,{size:"small"}),checkedIcon:e(Bs,{size:"small"}),indeterminate:Array.isArray(n)&&n.length>0&&n.length<m.filter((({disabled:e})=>!e)).length,checked:Array.isArray(n)&&n.length===m.filter((e=>!e.disabled)).length,sx:{marginRight:1}}),e(Ji,{primary:"Select All"})]},"select-all")),o.push(e(X,{sx:{margin:"0px !important"}},"divider-select-all"))),Object.entries(le).forEach((([r,a])=>{r&&o.push(e(Ld,{children:r},`group-${r}`)),a.forEach((r=>{const a=d?Array.isArray(n)&&n.includes(r.value):n===r.value;o.push(e(l,{value:r.value,disabled:r.disabled,children:b?b(r,a):t(i,{children:[d&&e(Q,{icon:e(ws,{size:"small"}),checkedIcon:e(Bs,{size:"small"}),checked:a,sx:{marginRight:1}}),t(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[B&&r.avatar&&e(ke,{src:r.avatar,alt:r.label,sx:{width:24,height:24}}),e(Ji,{primary:r.label})]})]})},r.value))}))})),o})():e(l,{disabled:!0,children:e(Ji,{primary:"No options"})})}),I&&e(xi,{children:I})]}),J&&e(Il,{disabled:g,onClick:J})]})]})}const Fd=()=>e(Ie,{width:50,height:18,sx:{borderRadius:"10px"},variant:"rectangular"});function Ud({name:t,rules:i,control:o,defaultValue:n,loading:r=!1,navigationKey:l,...a}){const s=M(),{butterflyBlue:C,iron:A}=s.palette.app.color,{field:{value:d=!1,...c}}=_e({name:t,control:o,defaultValue:n,rules:i}),{navigationKey:h}=Ro(),p=l??h,{setInputRef:g,maintainFocus:u,handleKeyDown:m}=$o({navigationKey:p});if(r)return e(Fd,{});return e(yi,{checked:d,...c,...a,inputRef:g,onKeyDown:e=>{m(e,void 0,!1),a.onKeyDown&&a.onKeyDown(e)},onChange:e=>{c.onChange(e),u()},sx:{padding:1,"& .MuiSwitch-track":{borderRadius:11,backgroundColor:A[900],position:"relative","&::before":{content:"unset",position:"absolute",top:"50%",transform:"translateY(-50%)",width:16,height:16,left:12},[Fi.input]:{width:"80px !important"},"&::after":{content:"unset",position:"absolute",top:"50%",transform:"translateY(-50%)",width:16,height:16,right:12}},"& .MuiSwitch-thumb":{boxShadow:"none",width:16,height:16,margin:.15,color:"white"},"& .Mui-checked + .MuiSwitch-track":{backgroundColor:`${C[900]} !important`,opacity:"1 !important"}}})}const Zd=({label:i,styling:o,size:n})=>t(a,{gap:"5px",flex:1,children:[i&&"custom"===o&&e(Ie,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(Ie,{height:`${xs(n).inputHeight}px`,width:"100%",sx:{transform:"scale(1)"}})]});function Dd({control:i,defaultValue:o,disabled:n=!1,label:r,name:l,error:s,helperText:C,loading:A=!1,required:d=!1,rules:c,format:h="HH:mm",isReturnLocalTime:p=!1,isReturnDateWithTime:g=!1,styling:u="custom",navigationKey:m,size:f,...E}){const{field:{value:I,onChange:k,...S}}=_e({name:l,control:i,defaultValue:o,rules:c}),{navigationKey:w}=Ro(),B=m??w,{inputRef:x,maintainFocus:Q,handleKeyDown:J}=$o({navigationKey:B}),{inputHeight:b,inputFontSize:v}=xs(f),R=M(),{butterflyBlue:L}=R.palette.app.color;s&&I&&"object"==typeof I&&(C="Invalid time");const F=I?y.fromISO(I):null;return A?e(Zd,{label:r,styling:u,size:f}):t(a,{gap:"5px",children:[r&&"custom"===u&&e(ze,{required:d,disabled:n,children:r}),e(Ui,{...S,...E,disabled:n,value:F,onChange:e=>{if(e?.isValid){if(p)return k(e.toFormat(h)),void Q();if(g)return k(e.toUTC().toISO()),void Q();k(e.toUTC().toISOTime()),Q()}else k(e),Q()},slotProps:{textField:{disabled:n,helperText:C,error:s,label:"default"===u?r:void 0,required:"default"===u?d:void 0,inputRef:x,InputLabelProps:Ms(u,f),onKeyDown:e=>{J(e,void 0,!1)},sx:{...Js(u),width:"100%","& .MuiInputBase-root":{fontSize:v,height:b},backgroundColor:"white","& .Mui-selected":{backgroundColor:L[900],borderRadius:"5px"}}}},format:h,helperText:C,sx:{backgroundColor:"white","& .Mui-selected":{backgroundColor:L[900],borderRadius:"5px"},"& .MuiOutlinedInput-input":{fontSize:v}}})]})}const Hd=({label:i,styling:o,size:n})=>{const{inputHeight:r}=xs(n);return t(a,{gap:"5px",flex:1,children:[i&&"custom"===o&&e(Ie,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(Ie,{height:`${r}px`,width:"100%",sx:{transform:"scale(1)"}})]})};function Kd({control:i,defaultValue:o,disabled:n=!1,label:r,readOnly:l=!1,name:s,error:C=!1,helperText:A,loading:d=!1,required:c=!1,rules:p,format:g="HH:mm",isReturnLocalTime:u=!1,isReturnDateWithTime:m=!1,timeStepsMinutes:f=1,helperIcon:E,toolTipText:I,containerProps:k,styling:S="custom",navigationKey:w,size:B,...x}){const{field:{value:Q,onChange:J,...b}}=_e({name:s,control:i,defaultValue:o,rules:p}),[v,R]=h(!1),{navigationKey:L}=Ro(),F=w??L,{setInputRef:U,maintainFocus:Z,maintainFocusAfterClose:D,handleKeyDown:H,handleEnterNavigation:K}=$o({isOpen:v,navigationKey:F}),{inputHeight:G,inputFontSize:Y}=xs(B);C&&Q&&"object"==typeof Q&&(A="Invalid time");const V=M(),{butterflyBlue:j}=V.palette.app.color,W=Q?y.fromISO(Q):null;return d?e(Hd,{label:r,styling:S,size:B}):t(a,{gap:"5px",...k,children:[r&&"custom"===S&&t(a,{alignItems:"center",flexDirection:"row",gap:"5px",children:[e(ze,{required:c,disabled:n,children:r}),E&&I&&e(T,{title:I,placement:"bottom",children:E})]}),e(Zi,{...b,...x,disabled:n,readOnly:l,open:v,ampm:!1,value:W,format:g,onOpen:()=>R(!0),onClose:()=>{R(!1),D()},timeSteps:{minutes:f},slotProps:{textField:{disabled:n,helperText:A,error:C,label:"default"===S?r:void 0,required:"default"===S?c:void 0,inputRef:U,InputLabelProps:Ms(S,B),sx:{...Js(S),width:"100%","& .MuiInputBase-root":{fontSize:Y,height:G},backgroundColor:"white","& .Mui-selected":{backgroundColor:j[900],borderRadius:"5px"},"& .MuiOutlinedInput-input":{fontSize:Y}},onKeyDown:e=>{if("enter"===F){if(" "===e.key&&!v&&!n&&!l)return e.preventDefault(),e.stopPropagation(),void R(!0);if("Enter"===e.key&&!v)return e.preventDefault(),e.stopPropagation(),void K(e);if("Enter"===e.key&&v)return e.preventDefault(),e.stopPropagation(),R(!1),D(),void requestAnimationFrame((()=>{K(e)}))}H(e,(()=>R(!1)),v)}},openPickerButton:{..."enter"===F?{onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),K(e))}}:{}},popper:{sx:{"& .MuiMultiSectionDigitalClockSection-root::after":{display:"unset"},"& .MuiList-padding":{padding:"10px"},"& .MuiMultiSectionDigitalClockSection-item":{padding:"4px"},"& .MuiMultiSectionDigitalClockSection-item.Mui-selected":{backgroundColor:j[900],borderRadius:"5px"},"& .MuiMultiSectionDigitalClockSection-item.Mui-selected:hover":{backgroundColor:j[900],borderRadius:"5px"},"& .Mui-selected:hover":{backgroundColor:j[900],borderRadius:"5px"},"& .MuiMultiSectionDigitalClockSection-item.Mui-selected:focus-visible":{backgroundColor:j[900],borderRadius:"5px"},"& .Mui-selected:focus-visible":{backgroundColor:j[900],borderRadius:"5px"}},onKeyDown:e=>{"enter"===F&&"Enter"===e.key&&v&&(e.preventDefault(),e.stopPropagation(),R(!1),D(),requestAnimationFrame((()=>{K(e)})))}}},onChange:e=>{if(e?.isValid){if(u)return J(e.toFormat(g)),void Z();if(m)return J(e.toUTC().toISO()),void Z();J(e.toUTC().toISOTime()),Z()}else J(e),Z()}})]})}function Gd({field:i,control:o,index:n}){const r=M(),{iron:l}=r.palette.app.color;return e(a,{direction:"row",component:"li",children:t(a,{direction:"row",alignItems:"center",border:"1px solid",flexGrow:1,borderColor:l[700],children:[e(Rl,{padding:{paddingLeft:"24px"},children:e(j,{sx:{flexGrow:1},children:i.headerName})}),e(Ud,{control:o,name:`columns.${n}.hide`})]})})}function Yd({column:i}){const o=M(),{lightBlue:n,iron:r}=o.palette.app.color;return e(a,{border:"1px solid",bgcolor:n[100],borderColor:r[700],children:e(Rl,{padding:{padding:"0px 24px"},children:t(a,{direction:"row",alignItems:"center",justifyContent:"space-between",minHeight:"38px",children:[e(j,{children:i.headerName}),e(Di,{htmlColor:r[800]})]})})})}function Vd({lockedColumns:o,fields:n,control:r}){return t(i,{children:[o.map((({field:t="fid",colId:i="cid",headerName:o})=>e(Yd,{column:{field:t,colId:i,headerName:o}},t??i))),e(a,{component:"ul",sx:{m:0,p:0},children:n.map(((t,i)=>e(Gd,{field:t,control:r,index:i},t.id)))})]})}function Td({columns:t,children:i}){const o=c((()=>t.filter((e=>!("hide"in e)))),[t]),n=c((()=>t.filter((e=>"hide"in e)).map((e=>({...e,hide:!e.hide})))),[t]),r=p(n),{control:l,reset:a,getValues:s,setValue:C}=$e({defaultValues:{columns:r.current}}),{fields:A}=et({name:"columns",control:l});return c((()=>{C("columns",n)}),[t]),i({reset:e=>{a({columns:e?Array.isArray(e)?e:[e]:r.current})},getValues:s,columnList:e(Vd,{fields:A,lockedColumns:o,control:l})})}function jd({columns:i,open:o,onClose:n,onSave:r,title:l="Column Chooser"}){const a=(e=>c((()=>e.filter((({field:e,colId:t})=>!!e||!!t)).map((({field:e,hide:t,headerName:i,colId:o})=>{const n={field:e??o,headerName:i};return null!=t&&(n.hide=t),n}))),[e]))(i);return e(Td,{columns:a,children:({columnList:i,reset:a,getValues:s})=>e(Ds,{title:l,open:o,onClose:()=>{n(),a()},maxWidth:"xs",actions:t(Ps,{sx:{justifyContent:"space-between",flex:1},children:[e(Jn,{variant:"outlined",onClick:()=>a(),children:"Reset"}),e(Jn,{onClick:()=>{const e=s(),t=Hi(e.columns.map((({field:e,colId:t,hide:i})=>[e??t,i])));r(t),n()},children:"Apply"})]}),children:i})})}const Wd=()=>e(Gi,{className:"bullet-hover",sx:{fontSize:"6px",borderRadius:"50%"}}),qd=({href:t="/",style:i,scroll:o=!1,...n})=>{const r=Vi(),l=Ti(),a=nn(t),{pathname:s,query:A}=a,d=c((()=>{if("string"!=typeof t)return{pathname:t??"/",query:void 0};if(r!==s)return a;const e=Array.from(l.entries()),i={...e.length?Object.fromEntries(e):void 0,...A};return{pathname:s,query:Object.keys(i).length?i:void 0}}),[r,l,t,s,A]);return e(C,{...n,prefetch:!1,scroll:o,style:{textDecoration:"none",outline:"none",...i},href:d})},zd=({selected:i=!1,icon:o=e(Wd,{}),title:n,endAdornment:r,sx:l,href:s,onClick:C,isShowEndAdornment:A=!1,preventRedirection:d=!1,onPreventRedirection:c,onMenuClick:h,...p})=>{const g=M(),{butterflyBlue:u,iron:m}=g.palette.app.color;return t(Yi,{...p,...A?{}:s?{component:qd,href:s}:{},onClick:e=>{h&&h(),(!s||A||d)&&(c?.(),C(),e.preventDefault())},sx:{padding:"9.5px 16px",...l,margin:"0",cursor:A?"default":"pointer",userSelect:"none",textDecoration:"none",fontSize:"13px",wordBreak:"break-word",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",flex:1,width:"100%",color:i?m[600]:g.palette.primary.light,":hover":{color:m[600],".bullet-hover":{color:i?"":u[900]}}},children:[t(a,{alignItems:"center",direction:"row",flex:1,gap:"10px",justifyContent:"center",children:[o,n&&e(Ji,{primary:n,disableTypography:!0,sx:{...l,padding:"0",textAlign:"left"}})]}),r]})},Od=({icon:t=e(Wd,{}),title:i,isShowEndAdornment:o=!1,selected:n=!1,onMouseEnter:r,href:l,onClick:a,onPreventRedirection:s,preventRedirection:C,onMenuClick:A})=>{const d=M(),{butterflyBlue:c,slate:h}=d.palette.app.color;return e(x,{component:"li",sx:{bgcolor:n&&!o?c[900]:"",padding:i?"0px":"2.5px 0",wordBreak:"break-word"},children:e(zd,{onClick:a,preventRedirection:C,onPreventRedirection:s,sx:{fontSize:"13px",padding:"9.5px 16px",":focus-visible":{border:`1px solid ${c[900]}`,backgroundColor:h[900]},margin:"0"},selected:n,title:i,icon:t,onMenuClick:A,onMouseEnter:r,href:l,isShowEndAdornment:o,endAdornment:o&&e(St,{sx:{fontSize:"16px"}})})})},Pd=({open:t,anchorEl:i,children:o,currentMenuIndex:n})=>{const r=M(),{mirage:l}=r.palette.app.color;return e(ae,{open:t,anchorEl:i,placement:"bottom-end",modifiers:[{name:"offset",options:{offset:[n?79:203,n?43.5*n+37:-40]}}],sx:{background:l[900],width:"203px",zIndex:1300,inset:n?"0px auto auto 0px !important":"1px 0px auto auto !important"},children:o})},Nd=({item:i,parentPath:o,currentPathMenuOpen:n,onCloseMenuPopover:r,level:l=0,onPreventRedirection:a,preventRedirection:s,onMenuClick:C})=>{const[A,d]=h(null),c=Boolean(A),{key:p,title:g,icon:u,menuItems:m,onClick:f,isView:E}=i;if(!1===E)return;const I=()=>{d(null)},k=Boolean(n[p]),S=`${o}/${p}`;return t(x,{onMouseLeave:I,children:[e(Od,{onClick:(e="_self")=>{f&&(f(`${o}/${p}`,e),"_blank"!==e&&(I(),r()))},onPreventRedirection:a,preventRedirection:s,title:g,icon:u,onMenuClick:C,isShowEndAdornment:Boolean(m?.length),selected:k,onMouseEnter:e=>{m?.length&&d(e.currentTarget)},href:S}),m?.length&&c&&e(Pd,{open:!0,anchorEl:A,currentMenuIndex:l,children:e(Ki,{disablePadding:!0,children:m.map((t=>e(Nd,{item:t,parentPath:S,currentPathMenuOpen:n[p]??{},onCloseMenuPopover:r,level:l+1},t.key)))})})]})},Xd=({currentPathMenuOpen:t,currentMenuItem:o,onCloseMenuPopover:n,preventRedirection:r=!1,onPreventRedirection:l,onMenuClick:a})=>o?e(Ki,{disablePadding:!0,children:o.menuItems?.filter((({isView:e})=>!1!==e)).map((i=>e(Nd,{item:i,onMenuClick:a,parentPath:`/${o.key}`,currentPathMenuOpen:t[o.key]??{},onCloseMenuPopover:n,preventRedirection:r,onPreventRedirection:l},i.key)))}):e(i,{children:"Loading..."}),_d=({menuItems:o,currentPathname:n,anchorEl:r,setAnchorEl:l,preventRedirection:a=!1,onPreventRedirection:s,onMenuClick:C})=>{const[A,d]=h(),[p,g]=h(0),[u,m]=h({});c((()=>{const e=xn(n);if(O(e))return m({home:!0});m(e)}),[n]);const f=()=>{l(null)};return t(i,{children:[o.filter((({isView:e})=>!1!==e)).map(((t,i)=>{const{onClick:o,key:n,icon:r,menuItems:A=[]}=t,c=""===n?"/":`/${n}`,h=!!u?.[n];return e(Od,{onClick:e=>{if(o){if(""===n)return void o("/",e);o(`/${n}`,e)}},onMenuClick:C,onMouseEnter:e=>{A?.length?(l(e.currentTarget),d(t),g(i+1)):f()},href:A.length?void 0:c,icon:r,onPreventRedirection:s,preventRedirection:a,selected:h},$t())})),!!r&&e(x,{onMouseLeave:f,children:e(Pd,{open:!0,anchorEl:r,currentMenuIndex:p,children:e(Xd,{currentMenuItem:A,currentPathMenuOpen:u,onCloseMenuPopover:f,preventRedirection:a,onPreventRedirection:s,onMenuClick:C})})})]})};J(x)((({theme:e})=>({width:7,height:7,borderRadius:"50%",background:e.palette.app.color.butterflyBlue[400]})));const $d=J(ji,{shouldForwardProp:e=>"open"!==e})((({theme:e,open:t})=>{const i=e=>({width:300,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden",backgroundColor:e.palette.app.color.mirage[900],[e.breakpoints.down("md")]:{width:"80px"}}),o=e=>({transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:"hidden",width:"0px",[e.breakpoints.up("md")]:{width:"80px"},backgroundColor:e.palette.app.color.mirage[900]});return{width:300,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",...t&&{...i(e),"& .MuiDrawer-paper":i(e)},...!t&&{...o(e),"& .MuiDrawer-paper":o(e)}}})),ec=({children:t,...i})=>e(Wi,{timeout:"auto",unmountOnExit:!0,...i,children:t}),tc=({icon:t=e(Wd,{}),title:i,isShowEndAdornment:o=!1,selected:n=!1,onClick:r,isExpanded:l,sx:a,preventRedirection:s=!1,href:C,onPreventRedirection:A,onMenuClick:d})=>{const c=M(),{butterflyBlue:h}=c.palette.app.color;return e(x,{sx:{bgcolor:n&&!o?h[900]:""},children:e(zd,{sx:a,title:i,icon:t,href:C,onClick:r,onMenuClick:d,selected:n,preventRedirection:s,onPreventRedirection:A,endAdornment:o&&e(l?qi:zi,{})})})},ic=(e,t)=>{if(0===t.length)return!1;if("object"!=typeof e)return!1;const[i,...o]=t;if(!i)return!1;const n=e[i];return 0===o.length?Boolean(n):ic(n,o)},oc=e=>!0===e||"object"==typeof e&&null!==e&&Object.values(e).every(oc),nc=({menuItem:i,level:o=0,parentPath:n="",subMenusOpen:r,setSubMenusOpen:l,currentPathMenuOpen:a,preventRedirection:s=!1,onPreventRedirection:C,onMenuClick:A})=>{const d=M();if(3===o)return;const{butterflyBlue:c,slate:h}=d.palette.app.color,{key:p,icon:g,title:u,isView:m,onClick:f,menuItems:E=[]}=i;if(!1===m)return;const I=n?`${n}/${p}`:p,k=I.split("/"),S=((e,t)=>{const i=ic(e,t);return Boolean(i)})(r,k),w=((e,t)=>{const i=t.reduce(((e,t)=>{if("object"==typeof e&&null!==e&&t in e)return e[t]}),e);return oc(i)})(a,k),B=""===p?"/":`/${I}`;return t(x,{children:[e(tc,{sx:{paddingLeft:3*o+1.5,fontSize:"13px",":focus-visible":{border:`1px solid ${c[900]}`,backgroundColor:h[900]}},onClick:e=>{if(E.length>0){if(w)return;l((e=>{const t={...e};let i=t;for(let e=0;e<k.length-1;e++){const t=k[e];t&&(i[t]="object"==typeof i[t]?i[t]:{},i=i[t])}const o=k[k.length-1];return o&&(i[o]=!S),t}))}else f&&!w&&f(B,e)},onMenuClick:A,href:0===E.length?B:"",icon:0===o?g:void 0,title:u,isShowEndAdornment:E.length>0&&o<2,selected:w,isExpanded:S,preventRedirection:s,onPreventRedirection:C}),E.length>0&&e(ec,{in:S,children:e(Ki,{component:"div",disablePadding:!0,children:E.map((t=>e(nc,{menuItem:t,level:o+1,parentPath:I,onMenuClick:A,subMenusOpen:r,setSubMenusOpen:l,currentPathMenuOpen:a,preventRedirection:s,onPreventRedirection:C},t.key)))})})]},p)},rc=({menuItems:t,currentPathname:i,preventRedirection:o=!1,onPreventRedirection:n,onMenuClick:r})=>{const[l,a]=h({}),[s,C]=h({});return g((()=>{const e=xn(i);if(O(e))return a({home:!0}),void C({home:!0});const t=JSON.parse(JSON.stringify(e)),o=JSON.parse(JSON.stringify(e));a(t),C(o)}),[i]),t.map((t=>e(nc,{menuItem:t,subMenusOpen:l,setSubMenusOpen:a,onMenuClick:r,currentPathMenuOpen:s,preventRedirection:o,onPreventRedirection:n},t.key)))},lc=({menuItems:i=[],open:o,currentPathname:n,preventRedirection:r=!1,onLogoClick:l,onPreventRedirection:a,onMenuClick:s,href:A,preventClick:d=!1})=>{const[c,p]=h(null),g=()=>{p(null)},{layout:u}=en(),m="desktop"===u;return t($d,{variant:"permanent",open:o,children:[t(x,{textAlign:"center",sx:{cursor:A||l?"pointer":"default"},component:A?C:"div",onClick:()=>{l&&!d&&l()},href:A,children:[m&&e(Rl,{padding:{paddingTop:"1.5rem"},children:e(o?Tr:jr,{})}),!m&&e(Rl,{padding:{paddingTop:"0.5rem",paddingBottom:"0.5rem"},children:e(jr,{})})]}),m&&e(Ki,{component:"nav",onMouseLeave:g,children:o?e(rc,{menuItems:i,onMenuClick:s,currentPathname:n,preventRedirection:r,onPreventRedirection:a}):e(_d,{menuItems:i,currentPathname:n,anchorEl:c,onMenuClick:s,setAnchorEl:p,preventRedirection:r,onPreventRedirection:a})}),!m&&e(ie,{onClickAway:g,children:e(Ki,{component:"nav",onMouseLeave:g,children:e(_d,{menuItems:i,onMenuClick:s,currentPathname:n,anchorEl:c,setAnchorEl:p,preventRedirection:r,onPreventRedirection:a})})})]})},ac=e=>e?Array.isArray(e)?e:[e]:[],sc=e=>e.zIndex.drawer+200,Cc=({title:o,children:r,onClose:l,actions:s,headerSlot:C,isHideHeader:A=!1,isHideFooter:d=!1,isHideCloseIcon:c=!1,isHideDividers:h=!1,disableEscapeKeyDown:p=!1,anchor:g="right",sx:u,ModalProps:m,...f})=>{const E=!d&&!!s,I=ac(u),k=ac(m?.sx);return e(ji,{...f,anchor:g,onClose:l,sx:[e=>({zIndex:sc(e),"& .MuiBackdrop-root":{zIndex:sc(e)},"& .MuiDrawer-paper":{display:"flex",flexDirection:"column",zIndex:sc(e)}}),...I],ModalProps:{...m,disableEscapeKeyDown:p,sx:[e=>({zIndex:sc(e)}),...k]},children:t(a,{flex:1,sx:{overflow:"hidden"},children:[!A&&t(i,{children:[e(Rl,{padding:{padding:"10px"},children:t(a,{direction:"row",alignItems:"center",children:[e(x,{flex:1,children:C??e(j,{variant:"h6",fontWeight:500,children:o})}),!c&&e(n,{onClick:e=>l?.(e,"escapeKeyDown"),color:"secondary",size:"small","aria-label":"Close",onMouseDown:e=>e.preventDefault(),children:e(At,{fontSize:"medium"})})]})}),!h&&e(X,{})]}),e(x,{flex:1,sx:{overflowY:"auto",overflowX:"hidden"},children:r}),E&&t(i,{children:[!h&&e(X,{}),e(Rl,{padding:{padding:"10px"},children:s})]})]})})},Ac=({open:i=!1,anchorEl:o,onClose:r,children:l,onApply:s,showDivider:C=!1,title:A,required:d})=>{const c=M(),{slate:h}=c.palette.app.color,p=()=>{$(s)&&s(),$(r)&&r({},"backdropClick")};return t(Ae,{open:i,anchorEl:o,anchorOrigin:{vertical:"bottom",horizontal:"left"},onClose:()=>{p()},onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),p())},sx:{"& .MuiPaper-root":{minWidth:"300px"}},children:[C&&t(a,{alignItems:"flex-end",children:[e(Rl,{padding:{padding:"8px"},children:t(a,{direction:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:[t(a,{direction:"row",alignItems:"center",gap:"5px",children:[t(j,{variant:"h6",children:[A," "]}),d&&e(j,{variant:"h6",color:"error",children:"*"})]}),e(n,{onClick:p,children:e(vi,{})})]})}),e(X,{sx:{width:"100%"}})]}),e(x,{sx:{background:h[600],borderRadius:"5px"},children:l})]})},dc=({open:i,anchorEl:o,onClose:r,children:l,onApply:s,showDivider:C=!1,showFooter:A=!0,title:d,required:c,filterItem:p,reset:u,background:m=!1,currentFilterValue:f})=>{const E=M(),{slate:I}=E.palette.app.color,[k,S]=h(null),[w,B]=h(!0);g((()=>{if(i){if(!k&&f){const e=p?.multiSelect?io(f):f;S(e)}}else S(null);if(f&&k){const e=p?.multiSelect?JSON.stringify(io(f))!==JSON.stringify(k):f!==k;B(!e)}}),[i,f,k,p?.multiSelect]);const Q=()=>{S(null),$(u)&&u(),$(r)&&r({},"backdropClick")};return t(Ae,{open:i,anchorEl:o,anchorOrigin:{vertical:"bottom",horizontal:"left"},onClose:(e,t)=>{$(r)&&(r(e,t),Q())},sx:{"& .MuiPaper-root":{minWidth:"300px"}},children:[C&&t(a,{alignItems:"flex-end",children:[e(Rl,{padding:{padding:"8px"},children:t(a,{direction:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:[t(a,{direction:"row",alignItems:"center",gap:"5px",children:[e(j,{variant:"h6",children:d}),c&&e(j,{variant:"h6",color:"error",children:"*"})]}),e(n,{onClick:Q,children:e(Ye,{})})]})}),e(X,{sx:{width:"100%"}})]}),e(x,{sx:{background:m?I[600]:"transparent",borderRadius:"5px",maxWidth:"300px"},children:l}),A&&e(Rl,{padding:{padding:"10px"},children:e(x,{display:"flex",justifyContent:"flex-end",children:e(Jn,{onClick:()=>{S(null),$(s)&&s()},disabled:w,variant:"text",sx:{maxWidth:"40px"},children:"Apply"})})})]})};function cc({selectedFilter:t,control:i,errors:o,setIsPopupOpen:n,autoFocus:r=!1}){const l=M(),{sapphireBlue:a,black:s}=l.palette.app.color,C=o[t.key],{placeholder:A,label:d}=t,c=A??`Select ${d}`,h=A??d;return{autoComplete:t.options&&e(Zs,{disableClearable:!0,multiple:t.multiSelect??!1,placeholder:c,name:`${t.key}`,disabled:t.isDisabled,loading:t.loading,shouldCloseOnSelect:t.shouldCloseOnSelect,control:i,options:t.options??[],onOpen:()=>n?.(!0),onClose:()=>n?.(!1),autoFocus:r,sx:{maxHeight:"250px",overflowY:"auto",width:"100%","& .MuiAutocomplete-tag":{backgroundColor:a[300],color:s[900]}},...t.employeeAutocomplete&&{isShowEmployeeData:!0,isShowOptionsOnType:!0,getOptionLabel:e=>"string"==typeof e?e:`${e.label} (${e.employee_code}) - ${e.punch_code}`},error:!!C,helperText:C?.message},t.key),text:e(fd,{name:t.key,control:i,disabled:t.isDisabled,placeholder:h,error:!!C,helperText:C?.message,autoFocus:r}),date:e(sC,{name:t.key,control:i,disabled:t.isDisabled,error:!!C,helperText:C?.message,autoFocus:r,minDate:t.minDate?y.fromISO(t.minDate):void 0,maxDate:t.maxDate?y.fromISO(t.maxDate):void 0,...t.monthYearFormat&&{format:"MMM yyyy",views:["year","month"]}}),dateRange:e(gC,{name:t.key,control:i,disabled:t.isDisabled,error:!!C,helperText:C?.message})}}const hc=({open:i,anchorEl:o,filterItem:n,onClose:r,control:l,errors:s,onApply:C,currentFilterValue:A,reset:d})=>e(dc,{title:n.label,required:n.required,filterItem:n,open:i,onClose:r,anchorEl:o,onApply:C,currentFilterValue:A,reset:d,showFooter:!0,showDivider:!0,background:!0,children:t(Rl,{padding:{padding:"10px"},children:[cc({selectedFilter:n,control:l,errors:s})[n.type],"switch"===n.type&&t(a,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{padding:"10px 5px 10px 20px",margin:"auto"},children:[e(j,{variant:"body2",children:n.label}),e(Ud,{control:l,name:n.key})]},n.key)]})}),pc=({open:t,anchorEl:i,filterItem:o,onClose:n,control:r,errors:l,onApply:a})=>e(Ac,{title:o.label,required:o.required,open:t,onClose:n,anchorEl:i,onApply:a,showDivider:!0,background:!0,children:e(Rl,{padding:{padding:"10px"},children:cc({selectedFilter:o,control:r,errors:l})[o.type]})}),gc=(e,t)=>{let i=e;if(t&&"autoComplete"===t.type&&(i=t.multiSelect&&Array.isArray(e)?t.options?.filter((t=>e.includes(t.value))).map((e=>e.label)).join(", "):t.options?.filter((t=>t.value===e)).map((e=>e.label)).join(", ")),"dateRange"===t.type&&Array.isArray(e)&&2===e.length){i=`${e[0]} <= Start Date <= ${e[1]}`}return i};function uc(e,t){return Object.fromEntries(Object.entries(e).flatMap((([e,i])=>{if(i){const o=t.find((t=>t.key===e)),n=o?.monthYearFormat&&"string"==typeof i?y.fromISO(i).toFormat("yyyy-MM"):i;return[[e,n]]}return[]})))}const mc=({filterListItems:o,isDisabled:r=!1,filterListData:l,onApply:s,onClear:C,onChange:A})=>{const d=M(),{iron:u,slate:m}=d.palette.app.color,{layout:f}=en(),E="desktop"===f,I="mobile"===f,[k,S]=h(null),w=p(null),B=p(null),[Q,J]=h(!1),[b,v]=h(!1),[R,L]=h(null),F=p(null),[U,Z]=h(!1),D=c((()=>o.reduce(((e,{key:t,multiSelect:i,options:o,required:n,type:r,value:l,isDefaultCurrentDate:a})=>(e[t]="autoComplete"===r&&n&&1===o?.length?i?[o[0]?.value]:o[0]?.value:i||"dateRange"===r?l||null:"switch"===r?l||!1:a&&"date"===r?l||y.now().toISODate():l||null,e)),{})),[l]),H=to.object((()=>{const e={};return o.forEach((t=>{t.multiSelect||"dateRange"===t.type?e[t.key]=to.array(to.string()).nullable().optional():"switch"===t.type?e[t.key]=to.boolean().nullable().optional():e[t.key]=to.string().nullable().optional()})),e})()).superRefine(((e,t)=>{o.forEach((i=>{i.required&&!e[i.key]?.length&&t.addIssue({path:[i.key],message:`${i.label} is required`,code:to.ZodIssueCode.custom})}))})),{control:K,handleSubmit:G,setValue:Y,reset:V,getValues:T,formState:{errors:W,dirtyFields:q},watch:z}=$e({values:D,resolver:Oi(H),mode:"all"});c((()=>{o&&0!==o.length&&o.forEach((({key:e,multiSelect:t,options:i,required:o})=>{if(o&&1===i?.length){T(e)||Y(e,t?[i[0]?.value]:i[0]?.value)}}))}),[o]);const P=z("company_id"),N=z("business_unit_id"),_=z("department_id"),$=()=>{S(null)},ee=()=>{ae((()=>{const e=new Set;return o.forEach((({type:t,key:i,required:o},n)=>{"switch"!==t&&(n===re||D?.[i]||o)&&e.add(i)})),e}))},te=()=>{V(),C(),ee(),$()},ie=e=>{const t=e instanceof HTMLElement?e:e.currentTarget;S(t)},oe=e=>{J(!1),L(null);const t=eo(uc(e,o),(e=>$i(e)||O(e)));ae((()=>{const e=new Set;return o.forEach((({type:i,key:o,required:n},r)=>{"switch"!==i&&(r===re||t[o]||n)&&e.add(o)})),e})),s(t,Q,R?.key),$()},ne=e=>o.find((t=>t.key===e)),re=o.findIndex((({type:e})=>"switch"!==e&&"dateRange"!==e)),[le,ae]=h((()=>{const e=new Set;return o.forEach((({type:t,key:i,required:o},n)=>{"switch"!==t&&(n===re||l?.[i]||D?.[i]||o)&&e.add(i)})),e})),se=tt({control:K}),Ce=R?.key?"switch"===R.key?z(R.key)?"true":"false":z(R.key):null;g((()=>{A(se,Q)}),[se,A]),g((()=>{V(D)}),[D,V]),g((()=>{ae((e=>{const t=new Set;return o.forEach((({type:i,key:o,required:n},r)=>{"switch"!==i&&(r===re||l?.[o]||D?.[o]||n||e.has(o))&&t.add(o)})),t}))}),[o,l,D,re]),g((()=>{P===l?.company_id||Q||(o.forEach((e=>{e.isDefaultCurrentDate&&"date"===e.type||Y(`${e.key}`,null)})),Y("company_id",P))}),[P]),g((()=>{_i(N,l?.business_unit_id)||Q||Y("business_unit_location_id",null)}),[N]),g((()=>{_i(_,l?.department_id)||Q||Y("sub_department_id",null)}),[_]);const Ae=Boolean(k),de=c((()=>0===Object.keys(q).length&&Object.keys(se).every((e=>$i(se[e])||O(se[e])))),[se,q]);return tn({key:"f",modifierKeys:["ctrl","shift"],onTrigger:()=>{if(r)return;const e=F.current??document.createElement("button");ie(e)}}),t(x,{sx:{flexGrow:1},children:[t(a,{direction:"row",justifyContent:{xs:"end",md:"space-between"},spacing:1,children:[E&&e(a,{direction:"row",alignItems:"center",sx:{maxWidth:{xs:"40vw",md:"45vw",lg:"57vw"}},children:l&&Object.values(l).some((e=>e))&&t(i,{children:[e(j,{variant:"body1",sx:{minWidth:"50px",marginRight:"5px"},children:"Filters:"}),e(a,{direction:"row",gap:"5px",alignItems:"center",sx:{flexWrap:"wrap",maxWidth:"100%"},children:(ce=l,Object.entries(ce).map((([t,i])=>{if("boolean"!=typeof i&&!i)return;const n=ne(t),a=o[(e=>o.findIndex((t=>t.key===e)))(t)],C=n&&gc(i,n),A=function(e){return Array.isArray(e)?e.join(", "):rn.test(e)?y.fromFormat(e,"yyyy-MM").toFormat("MMM yyyy"):ln.test(e)?y.fromFormat(e,"yyyy-MM-dd").toFormat("dd-MM-yyyy"):e}("object"==typeof C?JSON.stringify(C):String(C));return"boolean"==typeof i||A?e(Cs,{label:e(cl,{toolTipLabel:`${A}`,children:e(j,{noWrap:!0,variant:"subtitle2",children:`${n?.label}: ${A}`})}),onDelete:()=>(e=>{const t=ne(e);if(t?.required)return Is.error({title:"This is a required custom filter field and cannot be removed."});Y(`${e}`,null);const i={...l};delete i[e],s(i,!0,e)})(t),onClick:e=>{((e,t)=>{if("company_id"===e&&o?.some((({required:e})=>e)))return;J(!0),w.current=t.currentTarget;const i=ne(e);i&&L(i)})(t,e)},disabled:r,shouldDisableFocus:a?.shouldDisableFocus??!1,shouldDisableRipple:a?.shouldDisableRipple??!1},t):void 0})))})]})}),t(a,{direction:"row",alignItems:"flex-start",children:[l&&Object.values(l).some((e=>e))&&e(Jn,{onClick:()=>te(),variant:"text",sx:{minWidth:{xs:"60px",sm:"100px"}},children:I?"Clear":"Clear Filter"}),!r&&e(Sl,{isFiltered:!O(l),onClick:ie,ref:F})]})]}),e("form",{onSubmit:e=>{e.preventDefault(),de||G((e=>{oe(e)}))()},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),U||de||G((e=>{oe(e)}))())},children:t(ji,{open:Ae,onClose:(e,t)=>{"backdropClick"!==t&&$()},anchor:"right",sx:{zIndex:d.zIndex.drawer+2,"& .MuiPaper-root":{width:"100%",maxWidth:{xs:"270px",sm:"350px"}}},children:[t(a,{sx:{background:u[600]},children:[e(Rl,{padding:{padding:"10px 30px"},children:t(a,{direction:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:[e(j,{variant:"h6",children:"Filter"}),e(n,{onClick:()=>{V(),ee(),$()},children:e(Ye,{})})]})}),e(X,{sx:{width:"100%"}})]}),e(a,{flexGrow:1,sx:{overflowX:"hidden"},children:o.map(((i,o)=>{const{type:n,key:r,label:l,required:s,isDisabled:C,menuInfo:A}=i;return"switch"===n?t(a,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"80%",sx:{padding:"10px 5px 10px 20px ",margin:"auto"},children:[e(j,{variant:"body2",children:l}),e(Ud,{control:K,name:r})]},r):t(Pi,{expanded:le.has(r),onChange:(d=r,(e,t)=>{ae((e=>{const i=new Set(e);return t?i.add(d):i.delete(d),i}))}),disabled:C,sx:{boxShadow:"none","&.MuiAccordion-root.Mui-expanded":{margin:"0 !important"},"&.MuiAccordion-root.Mui-disabled":{backgroundColor:"transparent"}},children:[e(Xi,{expandIcon:e(zi,{}),"aria-controls":"panel1a-content",id:"panel1a-header",sx:{flexDirection:"row-reverse","& MuiAccordionSummary-root.Mui-expanded":{marginRight:"10px",transform:"rotate(-90deg)"},"&.Mui-expanded":{minHeight:"40px",paddingY:"5px"},"& .MuiAccordionSummary-content.Mui-expanded":{margin:"0px"}},children:t(a,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"90%",children:[t(a,{direction:"row",alignItems:"center",gap:"5px",children:[e(j,{variant:"body2",children:l}),s&&e(j,{color:"error",children:"*"})]}),e(j,{variant:"body2",children:A})]})}),e(Ni,{sx:{background:m[600],borderRadius:"5px",padding:"0px"},children:e(Rl,{padding:{paddingLeft:"15px",paddingY:"5px",paddingRight:"15px"},children:"dateRange"===n?t(a,{direction:"row",alignItems:"center",gap:"10px",onClick:e=>{(e=>{L(e),v(!0)})(i),B.current=e.currentTarget},children:[e(x,{sx:{border:"1px solid black",borderRadius:"5px",width:"150px",p:1},children:e(j,{variant:"body2",children:Array.isArray(z(r))&&z(r)[0]?y.fromISO(z(r)[0]).toFormat(rC.dateWithEuropean):"Start Date"})}),e(j,{children:"~"}),e(x,{sx:{border:"1px solid black",borderRadius:"5px",width:"150px",p:1},children:e(j,{variant:"body2",children:Array.isArray(z(r))&&z(r)[1]?y.fromISO(z(r)[1]).toFormat(rC.dateWithEuropean):"End Date"})})]}):e(x,{children:cc({selectedFilter:i,control:K,errors:W,setIsPopupOpen:Z,autoFocus:o===re})[n]})})})]},r);var d}))}),e(X,{}),e(a,{children:e(Rl,{padding:{padding:"10px"},children:t(Ps,{children:[e(Jn,{type:"submit",disabled:de,variant:"contained",onClick:()=>{G(oe)()},children:"Apply"}),e(Jn,{type:"button",onClick:()=>te(),disabled:Object.keys(se).every((e=>!se[e])),variant:"outlined",children:"Reset"})]})})})]})}),R&&e(hc,{open:Q,onClose:()=>{R?.key&&Y(`${R?.key}`,l?.[R.key]),J(!1)},onApply:()=>{G(oe)()},control:K,errors:W,reset:V,anchorEl:w.current,filterItem:R,currentFilterValue:Ce}),R&&e(pc,{open:b,onClose:()=>{R?.key&&Y(`${R?.key}`,l?.[R.key]),v(!1)},onApply:()=>{v(!1)},control:K,errors:W,anchorEl:B.current,filterItem:R})]});var ce},fc=({filter:i,control:o})=>{return e(ne,{children:(n=i.type,t(a,{direction:"row",width:"100%",justifyContent:"space-between",alignItems:"center",children:[e(j,{variant:"body2",children:i.label}),"switch"===n?e(Ud,{control:o,name:i.key}):e(j,{variant:"body2",children:i.menuInfo})]}))});var n},Ec=({filterListItems:i})=>{const[o,r]=h(null),l=p(null),[s,C]=h(!1),[A,d]=h(),[c,g]=h(null),{control:u,handleSubmit:m,setValue:f,reset:E,formState:{errors:I},watch:k}=$e(),S=()=>{r(null)},w=e=>{C(!1),g(null),S();const t=uc(e,i);d(t)},B=e=>{C(!0),r(null),g(e)},Q=e=>i.find((t=>t.key===e)),M=c?.key?k(c.key):null,J=Boolean(o);return t(a,{children:[t(a,{direction:"row",spacing:1,alignItems:"center",children:[A&&(b=A,Object.entries(b).map((([t,i])=>{if(!i)return;const o=Q(t),n=o&&gc(i,o);return e(as,{ref:l,label:e(cl,{toolTipLabel:`${n}`,children:`${o?.label}: ${n}`}),onDelete:()=>(e=>{f(`${e}`,null),d((t=>{const i={...t};return delete i[e],i}))})(t),onClick:e=>{C(!0),l.current=e.currentTarget;const i=Q(t);i&&(g(i),B(i))}},t)}))),e(n,{ref:l,onClick:e=>{r(e.currentTarget)},sx:{height:"40px"},children:e(Mr,{})}),e(Jn,{onClick:()=>(E(),void d(void 0)),variant:"text",children:"Clear Filter"})]}),e(dc,{open:J,anchorEl:o,onClose:S,onApply:()=>{m(w)()},children:i.map((t=>e(x,{onClick:()=>"switch"!==t.type&&B(t),children:e(fc,{filter:t,control:u})},t.key)))}),c&&"switch"!==c.type&&e(hc,{open:s,onClose:()=>{C(!1)},onApply:()=>{m(w)()},control:u,currentFilterValue:M,anchorEl:l.current,filterItem:c,errors:I})]});var b},Ic=({text:t,highlightWords:i})=>{const o=M(),{slate:n}=o.palette.app.color;if(!i?.length)return e(x,{component:"span",children:t});const r=i.map((e=>e.replace(cn,"\\$&"))),l=new RegExp(`(${r.join("|")})`,"gi"),a=t.split(l);return e(x,{component:"span",children:a.map(((t,i)=>l.test(t)?e(x,{component:"span",sx:{padding:"2px 4px",backgroundColor:n[800],border:`1px solid ${n[700]}`,borderRadius:"5px",fontFamily:"monospace",fontSize:"0.9em"},children:t},`highlight-${i}-${t}`):e(x,{component:"span",children:t},`text-${i}-${t}`)))})},kc=({label:i,variant:o,colourCode:n})=>t(a,{gap:"10px",direction:"row",alignItems:"center",children:[e(Yr,{variant:o,colourCode:n}),i]}),Sc=({color:i,label:o,isBackground:n=!1})=>e(x,{sx:{backgroundColor:`${n?R(i,.2):""}`,width:"max-content",borderRadius:"6px"},children:e(Rl,{padding:{padding:n?"5px 8px":"0"},children:t(a,{flexDirection:"row",alignItems:"center",gap:"8px",children:[e(Gi,{sx:{color:i,fontSize:"12px"}}),e(j,{variant:"body2",sx:{fontWeight:500},children:o})]})})}),wc=({count:t,page:i,onPageChange:o,rowsPerPage:n,onRowsPerPageChange:r,sx:l,...a})=>{const s=M(),{grey:C}=s.palette,{layout:A}=en(),d="mobile"===A;return e(oo,{sx:{"& .MuiInputBase-root":{height:"30px"},"& .MuiToolbar-root":{paddingLeft:0},"& .MuiTablePagination-select":{backgroundColor:"transparent !important"},"& .MuiTablePagination-input":{border:`1.5px solid ${C[400]}`,borderRadius:"5px",fontSize:"13px",padding:d?"2px 10px":"4px 8px"},...l},component:"div",count:t,page:i,onPageChange:o,rowsPerPage:n,onRowsPerPageChange:r,rowsPerPageOptions:[20,50,100,200],defaultValue:100,labelRowsPerPage:d?"":"Rows per page",...a})},Bc=({items:i,disabled:o,sx:n})=>{const[r,l]=h(null);return t(x,{sx:{width:"100%",...n},children:[e(El,{onClick:e=>{l(e.currentTarget)},disabled:o}),!!r&&e(yl,{open:!0,anchorEl:r,onClose:()=>{l(null)},children:e(Rl,{padding:{padding:"2px"},children:i.map((t=>e(x,{children:e(ne,{sx:{width:"100%",textAlign:"start"},onClick:()=>{t?.onClick(),l(null)},children:e(j,{variant:"body1",children:t.title})})},t.title)))})})]})},xc="smart-grid-field-input",Qc=e=>({...e,wrapperMinHeight:e.controlMinHeight+2*e.paddingY}),Mc={sm:Qc({controlMinHeight:18,paddingY:2,padding:"2px 6px",autocompletePadding:"2px 2px 2px 6px",fontSize:"12px",borderRadius:"4px",expandIconSize:18,expandMarginLeft:"2px",multipleGap:"2px",chipFontSize:"11px",chipPadding:"1px 6px"}),md:Qc({controlMinHeight:20,paddingY:4,padding:"4px 8px",autocompletePadding:"4px 4px 4px 8px",fontSize:"13px",borderRadius:"4px",expandIconSize:20,expandMarginLeft:"4px",multipleGap:"4px",chipFontSize:"12px",chipPadding:"2px 8px"}),lg:Qc({controlMinHeight:22,paddingY:6,padding:"6px 10px",autocompletePadding:"6px 6px 6px 10px",fontSize:"15px",borderRadius:"6px",expandIconSize:22,expandMarginLeft:"6px",multipleGap:"4px",chipFontSize:"13px",chipPadding:"3px 10px"})},Jc=(e="md")=>Mc[e],bc=e=>e[800],vc=(e,t)=>t?e[800]:e[400],Rc=e=>`\n .${xc}::placeholder {\n color: ${e};\n opacity: 1;\n }\n .${xc}:disabled {\n color: ${e};\n -webkit-text-fill-color: ${e};\n }\n`,Lc=(e,t="md")=>{const{controlMinHeight:i,fontSize:o}=Jc(t);return{width:"100%",border:"none",background:"transparent",padding:0,margin:0,fontSize:o,lineHeight:`${i}px`,minHeight:i,outline:"none",color:e}},yc=(e="md",t="text")=>{const{borderRadius:i,autocompletePadding:o,padding:n,wrapperMinHeight:r}=Jc(e);return{alignItems:"center",borderRadius:i,padding:"autocomplete"===t?o:n,minHeight:r,boxSizing:"border-box"}},Fc=({wrapper:i,title:o,position:n})=>{const r=z(),{iron:l}=r.palette.app.color,a=i.getBoundingClientRect(),s={position:"fixed",zIndex:999999,background:l[200],color:l[600],padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",whiteSpace:"nowrap",transition:"opacity 0.2s ease, transform 0.2s ease",opacity:1},C={position:"absolute",width:0,height:0,borderStyle:"solid"};switch(n){case"top":s.top=a.top-28,s.left=a.left+a.width/2,s.transform="translateX(-50%)",Object.assign(C,{borderWidth:"6px 6px 0 6px",borderColor:`${l[200]} transparent transparent transparent`,bottom:-6,left:"50%",transform:"translateX(-50%)"});break;case"bottom":s.top=a.bottom+4,s.left=a.left+a.width/2,s.transform="translateX(-50%)",Object.assign(C,{borderWidth:"0 6px 6px 6px",borderColor:`transparent transparent ${l[200]} transparent`,top:-6,left:"50%",transform:"translateX(-50%)"});break;case"left":s.top=a.top+a.height/2,s.left=a.left-8,s.transform="translateY(-50%)",Object.assign(C,{borderWidth:"6px 0 6px 6px",borderColor:`transparent transparent transparent ${l[200]}`,right:-6,top:"50%",transform:"translateY(-50%)"});break;case"right":s.top=a.top+a.height/2,s.left=a.right+8,s.transform="translateY(-50%)",Object.assign(C,{borderWidth:"6px 6px 6px 0",borderColor:`transparent ${l[200]} transparent transparent`,left:-6,top:"50%",transform:"translateY(-50%)"})}return t("div",{style:s,children:[o,e("div",{style:C})]})},Uc=({children:o,title:n,position:r="top",delay:l=50})=>{const[a,s]=h(!1),C=p(null),A=p(null);g((()=>()=>{A.current&&clearTimeout(A.current)}),[]);const d=a&&n&&C.current?lo(e(Fc,{wrapper:C.current,title:n,position:r}),document.body):null;return t(i,{children:[e("div",{ref:C,style:{display:"inline-block",width:"100%"},onMouseEnter:()=>{A.current&&clearTimeout(A.current),A.current=setTimeout((()=>s(!0)),l)},onMouseLeave:()=>{A.current&&clearTimeout(A.current),s(!1)},children:o}),d]})},Zc={display:"flex",flexDirection:"column",gap:"4px",width:"100%"},Dc={width:"100%"},Hc=E((({errorMessage:i,size:o="md",currencySymbol:n,decimalCharacter:r,digitGroupSeparator:l,decimalPlaces:a,decimalPlacesShownOnBlur:s,decimalPlacesShownOnFocus:C,minimumValue:A,maximumValue:d,outputFormat:p="number",textAlign:g,allowNegative:m,suffix:f,preDefined:E,navigationKey:I,disabled:k,name:S,value:w,onChange:B,onBlur:x,onFocus:Q,onKeyDown:J,placeholder:b="",style:v,className:R},L)=>{const y=M(),{butterflyBlue:F,iron:U,lipstickRed:Z}=y.palette.app.color,{navigationKey:D}=Ro(),H=I??D,[K,G]=h(!1),[Y,V]=h(""),{handleEnterNavigation:T,setInputRef:j}=$o({navigationKey:H}),W=c((()=>{const e=E??{},{currencySymbol:t,decimalCharacter:i,digitGroupSeparator:o,decimalPlaces:A,decimalPlacesShownOnBlur:d,decimalPlacesShownOnFocus:c,suffix:h,textAlign:p,allowNegative:u}=e;return{currencySymbol:n??t??"",decimalCharacter:r??i??".",digitGroupSeparator:l??o??",",decimalPlaces:a??A??2,decimalPlacesShownOnBlur:s??d,decimalPlacesShownOnFocus:C??c,suffix:f??h,textAlign:g??p??"right",allowNegative:m??u??!1}}),[m,n,r,a,s,C,l,E,f,g]),{currencySymbol:q,decimalCharacter:z,digitGroupSeparator:O,decimalPlaces:P,decimalPlacesShownOnBlur:N,decimalPlacesShownOnFocus:X,suffix:_,textAlign:$,allowNegative:ee}=W,te=c((()=>null!=A?Number(A):ee?void 0:0),[A,ee]),ie=c((()=>null!=d?Number(d):void 0),[d]),oe=K?X:N??P,ne=c((()=>K?Y:null==w||""===w?"":String(w)),[Y,K,w]),re=c((()=>i?Z[900]:K?F[900]:U[800]),[F,i,U,K,Z]),le=bc(U),ae=vc(U,k),{fontSize:se}=Jc(o),Ce=c((()=>Rc(le)),[le]),Ae=c((()=>yc(o,"text")),[o]),de=c((()=>({...Lc(ae,o),textAlign:$,flex:1,minWidth:0,...v})),[ae,$,o,v]),ce=c((()=>({display:"flex",alignItems:"center",border:`2px solid ${re}`,background:U[600],width:"100%",...Ae})),[re,U,Ae]),he=c((()=>({flexShrink:0,fontSize:se,color:k?U[800]:U[400],marginRight:"4px",userSelect:"none"})),[se,k,U]),pe=c((()=>[xc,R].filter(Boolean).join(" ")),[R]),ge=c((()=>!1!==O&&O),[O]),ue=u((e=>{j(e),"function"==typeof L?L(e):L&&(L.current=e)}),[L,j]),me=u((e=>{B?.({target:{name:S,value:e??""}})}),[S,B]),fe=u(((e,t)=>{const i=e.value;V(i),"prop"!==t?.source&&me(""!==i?"string"!==p?No(i):i:null)}),[me,p]),Ee=u((e=>{e.stopPropagation(),G(!0),V(null==w||""===w?"":String(w)),Q?.(e)}),[Q,w]),Ie=u((e=>{e.stopPropagation(),G(!1),x?.(e)}),[x]),ke=u((e=>{"enter"!==H||"Enter"!==e.key||e.ctrlKey||e.metaKey||e.altKey||T(e),J?.(e)}),[T,H,J]),Se=u((e=>{const{floatValue:t,value:i}=e;return!(!ee&&i.includes("-"))&&(null==t||!(!ee&&t<0)&&((null==te||Number.isNaN(te)||t>=te)&&(null==ie||Number.isNaN(ie)||t<=ie)))}),[ee,ie,te]),we=u((e=>{e.stopPropagation()}),[]);return t(Uc,{title:i??"",position:"top",delay:50,children:[e("style",{children:Ce}),e(no.Root,{disabled:k,name:S,style:Dc,children:e("div",{style:Zc,children:t("div",{style:ce,children:[q?e("span",{style:he,children:q}):null,e(Yt,{customInput:ro,value:ne,valueIsNumericString:!0,thousandSeparator:ge,decimalSeparator:z,decimalScale:oe,fixedDecimalScale:!K,allowNegative:ee,suffix:_,isAllowed:Se,disabled:k,name:S,placeholder:b,className:pe,style:de,onValueChange:fe,onFocus:Ee,onBlur:Ie,onKeyDown:ke,onClick:we,inputMode:"decimal",getInputRef:ue})]})})})]})}));Hc.displayName="SmartCurrencyFieldComponent";const Kc=w(Hc,((e,t)=>e.name===t.name&&e.value===t.value&&e.disabled===t.disabled&&e.size===t.size&&e.errorMessage===t.errorMessage&&e.placeholder===t.placeholder&&e.currencySymbol===t.currencySymbol&&e.decimalPlaces===t.decimalPlaces&&e.decimalPlacesShownOnBlur===t.decimalPlacesShownOnBlur&&e.decimalPlacesShownOnFocus===t.decimalPlacesShownOnFocus&&e.allowNegative===t.allowNegative&&e.minimumValue===t.minimumValue&&e.maximumValue===t.maximumValue&&e.digitGroupSeparator===t.digitGroupSeparator&&e.onChange===t.onChange&&e.onBlur===t.onBlur));Kc.displayName="SmartCurrencyField";const Gc=E((function({columns:o,optionsData:n,searchedByColumn:r,labelKey:l,valueKey:a="id",errorMessage:s,loading:C=!1,height:A="400px",dialogSize:d="lg",dialogTitle:g,size:m="md",placeholder:f="",onRowSelect:E,disabled:I,name:k,value:S,onChange:w,onBlur:B,onKeyDown:x,...Q},M){const J=z(),{butterflyBlue:b,iron:v,lipstickRed:R}=J.palette.app.color,{navigationKey:L}=Ro(),[y,F]=h(!1),[U,Z]=h(!1),D=p(null),H=p(null),K=p(null),G=p(null),{handleEnterNavigation:Y}=$o({navigationKey:L}),V=c((()=>null==S||""===S?"":String(S)),[S]),T=c((()=>{if(!V)return"";const e=n.find((e=>String(e[a])===V));return e?String(e[l]):""}),[l,n,V,a]),j=c((()=>n.map((e=>({label:String(e[l]),value:String(e[a])})))),[l,n,a]),W=c((()=>y||U?b[900]:s?R[900]:v[800]),[b,s,v,U,y,R]),q=bc(v),O=vc(v,I),P=c((()=>yc(m,"autocomplete")),[m]),{expandMarginLeft:N,expandIconSize:X}=c((()=>Jc(m)),[m]),_=c((()=>Rc(q)),[q]),$=c((()=>({...Lc(O,m),flex:1,minWidth:0,cursor:I?"default":"pointer"})),[I,O,m]),ee=u((e=>{K.current=e,"function"==typeof M?M(e):M&&(M.current=e)}),[M]),te=u((e=>{const t=K.current;t&&(t.value=e),w?.({target:{name:k,value:e}})}),[k,w]),ie=u((()=>{te(""),E?.(null)}),[te,E]),oe=u((()=>{H.current&&(H.current(),H.current=null),Z(!1),F(!1),G.current?.focus()}),[]),ne=u((()=>{I||(Z(!0),setTimeout((()=>{const e=D.current?.getTable(),t=document.querySelectorAll(".MuiDialog-root table thead input[type='text']"),i=e?.getAllColumns(),o=i?.findIndex((e=>e.id==r));if(void 0!==o&&o>=0&&t[o]){const e=t[o];e.focus();const i=e=>{const t=e;if("ArrowDown"===t.key){t.preventDefault();const e=document.querySelector(".MuiDialog-root table tbody tr");e&&(e.setAttribute("tabindex","0"),e.focus())}};e.addEventListener("keydown",i),H.current=()=>{e.removeEventListener("keydown",i)}}}),100))}),[I,r]),re=u((({id:e})=>{const t=n.find((t=>String(t[a])===String(e)));if(!t)return;const i=String(t[a]);te(i),E?.(t),oe()}),[te,oe,E,n,a]),le=u((e=>"Backspace"===e.key&&V?(e.preventDefault(),void ie()):"enter"!==L||"Enter"!==e.key||U||e.ctrlKey||e.metaKey||e.altKey?"Enter"!==e.key&&" "!==e.key&&"ArrowDown"!==e.key||U||I?void x?.(e):(e.preventDefault(),void ne()):void Y(e)),[ie,I,ne,Y,U,L,x,V]),ae=u((e=>{e.preventDefault(),e.stopPropagation(),I||(U?oe():(F(!0),ne()))}),[I,oe,ne,U]),se=u((e=>{e.stopPropagation(),I||U||ne()}),[I,ne,U]),Ce=u((e=>{e.stopPropagation(),F(!0)}),[]),Ae=u((e=>{e.stopPropagation(),F(!1),B?.(e)}),[B]),de=f||"Click to select";return t(i,{children:[t(Uc,{title:s??"",position:"top",delay:50,children:[e("style",{children:_}),e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%"},children:t("div",{style:{display:"flex",alignItems:"center",border:`2px solid ${W}`,background:v[600],position:"relative",width:"100%",...P},children:[e("input",{ref:G,readOnly:!0,disabled:I,value:T,placeholder:de,className:xc,onClick:se,onFocus:Ce,onBlur:Ae,onKeyDown:le,style:$}),e("button",{type:"button",tabIndex:-1,"aria-label":U?"Close dialog":"Open dialog",disabled:I,onMouseDown:e=>{e.preventDefault()},onClick:ae,style:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"none",background:"transparent",padding:0,marginLeft:N,cursor:I?"not-allowed":"pointer",color:I?v[800]:v[400]},children:e(Me,{sx:{fontSize:X,transform:U?"rotate(180deg)":"none",transition:"transform 0.2s ease"}})}),e("select",{...Q,ref:ee,name:k,value:V,disabled:I,tabIndex:-1,"aria-hidden":!0,style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0,pointerEvents:"none"},children:0===j.length?e("option",{value:"",disabled:!0,children:"No Options"}):t(i,{children:[e("option",{value:"",children:"Select Option"}),j.map((t=>e("option",{value:t.value,children:t.label},t.value)))]})})]})})]}),e(Ds,{open:U,onClose:oe,maxWidth:d,title:g??"Select Option",children:e(ht,{ref:D,columns:o,data:n,height:A,loading:C,totalCount:n.length,onRowActivate:re,focusableRowNavigation:!0})})]})}));Object.assign(Gc,{displayName:"SmartDialogSelectComponent"});const Yc=w(Gc,(({name:e,value:t,disabled:i,optionsData:o,columns:n,errorMessage:r,loading:l,placeholder:a,size:s,labelKey:C,valueKey:A,searchedByColumn:d},{name:c,value:h,disabled:p,optionsData:g,columns:u,errorMessage:m,loading:f,placeholder:E,size:I,labelKey:k,valueKey:S,searchedByColumn:w})=>e===c&&t===h&&i===p&&o===g&&n===u&&r===m&&l===f&&a===E&&s===I&&C===k&&A===S&&d===w));Object.assign(Yc,{displayName:"SmartDialogSelect"});const Vc=E((({errorMessage:o,options:n,onBlur:r,onKeyDown:l,...a},s)=>{const C=z(),{butterflyBlue:A,lipstickRed:d,iron:p}=C.palette.app.color,[g,u]=h(!1),{navigationKey:m}=Ro(),{handleEnterNavigation:f}=$o({navigationKey:m}),E=c((()=>g?A[900]:o?d[900]:g?A[900]:p[800]),[o,g]);return e(Uc,{title:o??"",position:"top",delay:50,children:e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%"},children:e("div",{style:{display:"flex",alignItems:"center",border:`2px solid ${E}`,borderRadius:"4px",padding:"4px 8px",background:"white",minHeight:"20px"},children:e("select",{ref:s,...a,style:{width:"100%",border:"none",background:"transparent",padding:"0",fontSize:"13px",outline:"none",cursor:"pointer"},onClick:e=>e.stopPropagation(),onFocus:e=>{e.stopPropagation(),u(!0)},onBlur:e=>{e.stopPropagation(),u(!1),r&&r(e)},onKeyDown:e=>{"enter"!==m||"Enter"!==e.key||e.ctrlKey||e.metaKey||e.altKey||f(e),l?.(e)},children:0===n.length?e("option",{value:"",disabled:!0,children:"No Options"}):t(i,{children:[e("option",{value:"",children:"Select Option"}),n.map((t=>e("option",{value:String(t.value),children:t.label},t.value)))]})})})})})}));Vc.displayName="SmartSelectFieldComponent";const Tc=w(Vc,((e,t)=>e.name===t.name&&e.value===t.value&&e.disabled===t.disabled&&e.options===t.options&&e.errorMessage===t.errorMessage));Tc.displayName="SmartSelectField";const jc=28,Wc=100,qc=200,zc="select-all",Oc=({label:e})=>e,Pc=({value:e})=>String(e),Nc=e=>Pc(e)===zc,Xc=e=>void 0===e||""===e?[]:Array.isArray(e)?[...new Set(e.map(String))]:[String(e)],_c=(e,t)=>t.trim()?zo({data:e,fieldsToSearch:["label"],term:t.toLowerCase()}):e,$c=(e,t,i)=>{if(!e.length)return null;if(i&&t.length){const i=e.findIndex((e=>!Nc(e)&&t.includes(Pc(e))));if(i>=0)return i}if(!i&&t[0]){const i=e.findIndex((e=>Pc(e)===t[0]));if(i>=0)return i}return 0},eh=w((function({butterflyBlue:t,checked:i,indeterminate:o=!1,iron:n}){const r=i||o;return e("span",{"aria-hidden":!0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"14px",height:"14px",flexShrink:0,borderRadius:"2px",border:`1px solid ${r?t[900]:n[800]}`,background:r?t[900]:n[600],boxSizing:"border-box",pointerEvents:"none"},children:o?e(Co,{sx:{fontSize:12,color:`${n[600]} !important`}}):i?e(Ve,{sx:{fontSize:12,color:`${n[600]} !important`}}):null})})),th=w((function({butterflyBlue:i,highlightedIndex:o,indeterminate:n,isSelected:r,iron:l,itemIndex:a,onHighlightIndex:s,onSelectOption:C,option:A,showCheckbox:d,style:c}){return t(so.Item,{index:a,value:A,disabled:A.disabled,onPointerEnter:()=>{A.disabled||s(a)},onClick:e=>{"preventBaseUIHandler"in e&&e.preventBaseUIHandler(),e.preventDefault(),C(A)},style:e=>{const t=a===o||e.highlighted?l[700]:r&&!d?i[500]:"transparent";return{display:"flex",alignItems:"center",gap:"8px",padding:"0 8px",fontSize:"13px",cursor:A.disabled?"not-allowed":"pointer",boxSizing:"border-box",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",background:t,...c}},children:[d?e(eh,{butterflyBlue:i,checked:r,indeterminate:n,iron:l}):null,Oc(A)]})})),ih=(t,i,o,n)=>{const{butterflyBlue:r,highlightedIndex:l,iron:a,isAllSelected:s,isShowSelectAll:C,isSomeSelected:A,onHighlightIndex:d,onSelectOption:c,selectedValues:h,showCheckbox:p}=o,g=Pc(t),u=Nc(t),m=u?s:h.includes(g);return e(th,{itemIndex:i,butterflyBlue:r,highlightedIndex:l,indeterminate:u&&C&&A&&!s,isSelected:m,iron:a,onHighlightIndex:d,onSelectOption:c,option:t,showCheckbox:p,style:n},`${g}-${i}`)},oh=w((function({butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:n,isShowSelectAll:r,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValues:C,showCheckbox:A}){const d=so.useFilteredItems(),c=p(null),h=be({count:d.length,estimateSize:()=>28,getScrollElement:()=>c.current,overscan:10}),u=h.getVirtualItems();if(g((()=>{null===i||i<0||h.scrollToIndex(i,{align:"auto"})}),[i,h]),!d.length)return null;const m={butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:n,isShowSelectAll:r,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValues:C,showCheckbox:A};return e("div",{ref:c,style:{maxHeight:200,overflowY:"auto",paddingBottom:"4px"},children:e(so.List,{style:{height:h.getTotalSize(),position:"relative",width:"100%"},children:u.map((({index:e,size:t,start:i})=>{const o=d[e];return o?ih(o,e,m,{position:"absolute",top:i,left:0,width:"100%",height:t}):null}))})})})),nh=w((function({butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:n,isShowSelectAll:r,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValues:C,showCheckbox:A,virtualized:d}){if(d)return e(oh,{butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:n,isShowSelectAll:r,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValues:C,showCheckbox:A});const c={butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:n,isShowSelectAll:r,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValues:C,showCheckbox:A};return e(so.List,{style:{maxHeight:200,overflowY:"auto",paddingBottom:"4px"},children:(e,t)=>ih(e,t,c)})})),rh=w((function({iron:i,label:o,onRemove:n,size:r="md"}){const{chipFontSize:l,chipPadding:a}=c((()=>Jc(r)),[r]);return t("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:a,borderRadius:"12px",background:i[700],color:i[900],fontSize:l,fontWeight:500,lineHeight:1.4,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[o,e("button",{type:"button","aria-label":`Remove ${o}`,onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},style:{border:"none",background:"transparent",color:i[900],cursor:"pointer",padding:0,lineHeight:1,fontSize:l},children:"×"})]})})),lh=E((({containerStyle:o,disabled:n,errorMessage:r,freeSolo:l=!1,isShowCheckbox:a=!0,isShowSelectAll:s=!0,multiple:C=!1,name:A,label:d,onBlur:m,onChange:f,onDropdownOptionSelect:E,onKeyDown:I,options:k,placeholder:S="",required:w=!1,disableClearable:B=!!w,size:x="md",value:Q,defaultValue:M,...J},b)=>{const v=z(),{butterflyBlue:R,iron:L,lipstickRed:y}=v.palette.app.color,{navigationKey:F}=Ro(),[U,Z]=h(!1),[D,H]=h(!1),[K,G]=h(""),Y=p(null),V=p(null),T=p(null),[j,W]=h(!1),q=p(void 0),[O,P]=h(null),N=c((()=>Xc(Q)),[Q]),X=C?"":N[0]??"",_=c((()=>C&&s&&k.length?[{label:"Select All",value:zc},...k]:k),[s,C,k]),$=c((()=>_c(_,C||!D||j?K:"")),[K,D,j,_,C]),ee=c((()=>{if(!C||!k.length)return!1;const e=k.filter((e=>!e.disabled));return e.length>0&&e.every((e=>N.includes(Pc(e))))}),[C,k,N]),te=c((()=>C&&k.some((e=>N.includes(Pc(e))))),[C,k,N]),ie=c((()=>{if(C)return"";const e=k.find((e=>Pc(e)===X));return e?Oc(e):l&&X?X:""}),[l,C,k,X]),{handleEnterNavigation:oe,handleKeyDown:ne,inputRef:re,maintainFocusAfterClose:le,setInputRef:ae}=$o({isOpen:D,navigationKey:F}),se=_.length>100,Ce=c((()=>U||D?R[900]:r?y[900]:L[800]),[R,r,L,U,D,y]),Ae=u((e=>{const t=k.find((t=>Pc(t)===e));return t?Oc(t):e}),[k]),de=u((e=>{f?.({target:{name:A,value:e}})}),[A,f]),ce=u((e=>{const t=T.current;t&&(C&&Array.isArray(e)?Array.from(t.options).forEach((t=>{t.selected=e.includes(t.value)})):C||"string"!=typeof e||(t.value=e))}),[C]),he=u(((e,t)=>{ce(e),de(e),t&&E(t)}),[de,E,ce]),pe=u(((e="",t)=>{const i=_c(_,e);P($c(i,t??N,C))}),[_,C,N]),ge=u((e=>{const t=k.filter((e=>e.disabled)).map((e=>Pc(e))),i=e?k.map((e=>Pc(e))):t;he(i),ao((()=>{G("")})),pe("",i)}),[he,pe,k]),ue=u((e=>{const t=Pc(e);if(Nc(e))ge(!ee);else{if(C){const e=N.includes(t)?N.filter((e=>e!==t)):[...N,t];return he(e,t),ao((()=>{G("")})),void pe("",e)}he(t,t),G(Ae(t)),H(!1),le()}}),[he,Ae,ge,ee,le,C,pe,N]),me=u((e=>{const t=e.trim();if(!t)return;const i=k.find((e=>Oc(e).toLowerCase()===t.toLowerCase()||Pc(e)===t));if(i)ue(i);else{if(C){if(N.includes(t))return;const e=[...N,t];return he(e,t),ao((()=>{G("")})),void pe("",e)}he(t,t),G(t),H(!1),le()}}),[he,ue,le,C,pe,k,N]),fe=u((e=>{const t=N.filter((t=>t!==e));he(t)}),[he,N]),Ee=c((()=>!B&&!n&&(C?N.length>0:Boolean(X))),[B,n,C,X,N.length]),Ie=u((e=>{e.preventDefault(),e.stopPropagation();he(C?[]:""),G(""),W(!1),H(!1),P(null),le()}),[he,le,C]),ke=u((()=>{H(!1),W(!1),P(null),G(C?"":ie)}),[C,ie]),Se=u((()=>{H(!0),W(!1),G(C?"":ie),pe()}),[C,pe,ie]),we=u(((e,t)=>{n||!e&&C&&"item-press"===t?.reason||(H(e),e?(W(!1),G(C?"":ie),pe()):(W(!1),G(C?"":ie),P(null),Z(!1)))}),[n,C,pe,ie]),Be=u(((e,t)=>{if(C&&"item-press"===t?.reason){if(G(""),D){const e=_c(_,"");P(e.length?$c(e,N,C):null)}}else if(W(!0),G(e),D){const t=_c(_,e);P(t.length?$c(t,N,C):null)}}),[D,_,C,N]),xe=u((e=>{P(e)}),[]),Qe=u((e=>{$.length?P((t=>null===t?"down"===e?0:$.length-1:"down"===e?Math.min(t+1,$.length-1):Math.max(t-1,0))):P(null)}),[$.length]),Je=e=>{"preventBaseUIHandler"in e&&e.preventBaseUIHandler()},be=u((e=>{e.preventDefault(),Je(e),D?Qe("ArrowDown"===e.key?"down":"up"):(ao((()=>{H(!0),W(!1),G(C?"":ie)})),pe())}),[D,Qe,C,pe,ie]),ve=u((e=>{const t=null!==O?$[O]:void 0;if(t)return e.preventDefault(),Je(e),void ue(t);l&&K.trim()&&(e.preventDefault(),Je(e),me(K))}),[me,$,l,ue,O,K]),Re=u((e=>{if(!("ArrowDown"===e.key||"ArrowUp"===e.key)||n)return"Tab"===e.key&&D?(H(!1),void le()):"enter"!==F||"Enter"!==e.key||D||e.ctrlKey||e.metaKey||e.altKey?void("Enter"===e.key&&D?ve(e):(ne(e,(()=>{H(!1),le()}),D),I?.(e))):(e.preventDefault(),e.stopPropagation(),void oe(e));be(e)}),[n,be,oe,ne,ve,D,le,F,I]),Le=u((e=>{const t=e.relatedTarget;window.setTimeout((()=>{if(t&&(Y.current?.contains(t)||V.current?.contains(t)))return;const e=document.activeElement;Y.current?.contains(e)||V.current?.contains(e)||(D&&(l&&K.trim()&&me(K),ke()),Z(!1))}),0),m?.(e)}),[ke,me,l,K,D,m]),ye=u((e=>{e.preventDefault(),e.stopPropagation(),n||(D?(ke(),Z(!1)):(Se(),Z(!0),re.current?.focus()))}),[ke,n,re,D,Se]);g((()=>{D||(G(C?"":ie),W(!1))}),[D,C,ie]),g((()=>{q.current=null!==O?$[O]:void 0}),[$,O]);const Fe=c((()=>{if(!k.length&&!N.length)return e("option",{value:"",disabled:!0,children:"No Options"});const o=N.filter((e=>!k.some((t=>Pc(t)===e))));return t(i,{children:[C?null:e("option",{value:"",children:"Select Option"}),k.map((t=>e("option",{value:Pc(t),children:Oc(t)},Pc(t)))),o.map((t=>e("option",{value:t,children:t},t)))]})}),[C,k,N]),Ue=u((e=>{T.current=e,"function"==typeof b?b(e):b&&(b.current=e)}),[b]),Ze=u(((e,t)=>!t.trim()||zo({data:[e],fieldsToSearch:["label"],term:t.toLowerCase()}).length>0),[]),De=L,He=R,Ke=C&&a,Ge={width:"var(--anchor-width)",minWidth:"var(--anchor-width)",maxWidth:"var(--anchor-width)"},Ve=bc(L),Te=vc(L,n),je=Jc(x),We=c((()=>Rc(Ve)),[Ve]),qe=c((()=>yc(x,"autocomplete")),[x]),ze=c((()=>({...Lc(Te,x),flex:1,minWidth:C?"80px":0,cursor:n?"default":"text"})),[n,Te,C,x]);return t(Uc,{title:r??"",position:"top",delay:50,children:[e("style",{children:We}),e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%",...o},children:t(so.Root,{items:_,value:K,onValueChange:Be,open:D,onOpenChange:we,disabled:n,name:A,autoHighlight:!1,keepHighlight:!0,virtualized:se,openOnInputClick:!0,filter:Ze,filteredItems:$,itemToStringValue:Oc,onItemHighlighted:(e,t)=>{q.current=e,t.index>=0&&P(t.index)},children:[t("div",{ref:Y,style:{display:"flex",alignItems:"center",flexWrap:C?"wrap":"nowrap",gap:C?je.multipleGap:void 0,border:`2px solid ${Ce}`,background:L[600],position:"relative",width:"100%",...qe},children:[C?N.map((t=>e(rh,{iron:De,size:x,label:Ae(t),onRemove:()=>{fe(t)}},t))):null,e(so.Input,{ref:ae,disabled:n,className:xc,placeholder:C&&X?.length?"":S||`Select ${d??"Option"}`,onClick:e=>{e.stopPropagation()},onFocus:e=>{e.stopPropagation(),Z(!0),n||D||document.activeElement!==e.currentTarget||Se()},onBlur:Le,onKeyDown:Re,style:ze}),Ee?e("button",{type:"button",tabIndex:-1,"aria-label":"Clear selection",onMouseDown:e=>{e.preventDefault()},onClick:Ie,style:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"none",background:"transparent",padding:0,marginLeft:je.expandMarginLeft,cursor:"pointer",color:L[400]},children:e(Ye,{sx:{fontSize:je.expandIconSize-4}})}):null,e("button",{type:"button",tabIndex:-1,"aria-label":D?"Close options":"Open options",disabled:n,onMouseDown:e=>{e.preventDefault()},onClick:ye,style:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"none",background:"transparent",padding:0,marginLeft:je.expandMarginLeft,cursor:n?"not-allowed":"pointer",color:n?L[800]:L[400]},children:e(Me,{sx:{fontSize:je.expandIconSize,transform:D?"rotate(180deg)":"none",transition:"transform 0.2s ease"}})}),e("select",{...J,ref:Ue,name:A,value:C?void 0:X,multiple:C,disabled:n,required:w,tabIndex:-1,"aria-hidden":!0,style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0,pointerEvents:"none"},children:Fe})]}),e(so.Portal,{children:e(so.Positioner,{anchor:Y,sideOffset:2,align:"start",style:{zIndex:999,...Ge},children:t(so.Popup,{ref:V,style:{...Ge,background:L[600],border:`1px solid ${L[300]}`,boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",borderRadius:"4px",overflow:"hidden"},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.stopPropagation()},children:[e(so.Empty,{children:e("div",{style:{padding:je.padding,fontSize:je.fontSize,color:L[800]},children:"No Options"})}),e(nh,{butterflyBlue:He,highlightedIndex:O,iron:De,isAllSelected:ee,isShowSelectAll:s,isSomeSelected:te,onHighlightIndex:xe,onSelectOption:ue,selectedValues:N,showCheckbox:Ke,virtualized:se})]})})})]})})]})}));lh.displayName="SmartAutoCompleteFieldComponent";const ah=w(lh,(({name:e,value:t,disabled:i,options:o,errorMessage:n,freeSolo:r,multiple:l,isShowSelectAll:a,isShowCheckbox:s,placeholder:C,required:A,disableClearable:d,size:c},{name:h,value:p,disabled:g,options:u,errorMessage:m,freeSolo:f,multiple:E,isShowSelectAll:I,isShowCheckbox:k,placeholder:S,required:w,disableClearable:B,size:x})=>e===h&&t===p&&i===g&&o===u&&n===m&&r===f&&l===E&&a===I&&s===k&&C===S&&A===w&&d===B&&c===x));ah.displayName="SmartAutoCompleteField";const sh=E((({errorMessage:t,onKeyDown:i,...o},n)=>{const r=z(),{type:l,disabled:a}=o,{butterflyBlue:s,lipstickRed:C,iron:A}=r.palette.app.color,[d,p]=h(!1),{navigationKey:g}=Ro(),{handleEnterNavigation:u}=$o({navigationKey:g}),m=c((()=>a?A[700]:d?s[900]:t?C[900]:A[800]),[a,t,d]);return e(Uc,{title:t??"",position:"top",delay:50,children:e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%"},children:e("div",{style:{display:"flex",alignItems:"center",border:"checkbox"===l?"none":`2px solid ${m}`,borderRadius:"4px",padding:"4px 8px",background:a?A[50]:"white",minHeight:"20px"},children:e("input",{ref:n,...o,style:{width:"100%",border:"none",background:"transparent",padding:"0",fontSize:"13px",outline:"none"},onClick:e=>e.stopPropagation(),onFocus:e=>{e.stopPropagation(),p(!0)},onBlur:e=>{e.stopPropagation(),p(!1)},onKeyDown:e=>{"enter"!==g||"Enter"!==e.key||"checkbox"===l||e.ctrlKey||e.metaKey||e.altKey||u(e),i?.(e)}})})})})}));sh.displayName="SmartTextFieldComponent";const Ch=w(sh,((e,t)=>e.name===t.name&&e.value===t.value&&e.checked===t.checked&&e.disabled===t.disabled&&e.type===t.type&&e.errorMessage===t.errorMessage));Ch.displayName="SmartTextField";const Ah=E((({errorMessage:i,onKeyDown:o,onFocus:n,onBlur:r,style:l,className:a,size:s="md",...C},A)=>{const d=z(),{type:p,disabled:g,name:m}=C,{butterflyBlue:f,lipstickRed:E,iron:I}=d.palette.app.color,k=bc(I),S=vc(I,g),[w,B]=h(!1),{navigationKey:x}=Ro(),{handleEnterNavigation:Q,setInputRef:M}=$o({navigationKey:x}),J="checkbox"===p,b=c((()=>i?E[900]:w?f[900]:I[800]),[f,i,I,w,E]),v=c((()=>Rc(k)),[k]),R=c((()=>yc(s,"text")),[s]),L=c((()=>({...Lc(S,s),...l})),[s,l,S]),y=[xc,a].filter(Boolean).join(" "),F=u((e=>{J||M(e),"function"==typeof A?A(e):A&&(A.current=e)}),[J,A,M]),U=e=>{"enter"!==x||"Enter"!==e.key||J||e.ctrlKey||e.metaKey||e.altKey||Q(e),o?.(e)},Z=e=>{e.stopPropagation(),B(!0),n?.(e)},D=e=>{e.stopPropagation(),B(!1),r?.(e)},H=e(J?"input":ro,{ref:F,...C,disabled:g,className:y,style:L,onClick:e=>{e.stopPropagation()},onFocus:Z,onBlur:D,onKeyDown:U});return t(Uc,{title:i??"",position:"top",delay:50,children:[J?null:e("style",{children:v}),e(no.Root,{disabled:g,name:m,style:{width:"100%"},children:e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%"},children:e("div",{style:{display:"flex",alignItems:"center",border:J?"none":`2px solid ${b}`,background:I[600],width:"100%",...R},children:H})})})]})}));Ah.displayName="SmartTextFieldV2Component";const dh=w(Ah,(({name:e,value:t,checked:i,disabled:o,type:n,size:r,errorMessage:l,placeholder:a},{name:s,value:C,checked:A,disabled:d,type:c,size:h,errorMessage:p,placeholder:g})=>e===s&&t===C&&i===A&&o===d&&n===c&&r===h&&l===p&&a===g));function ch({items:i,disabled:o=!1,avoidDeleteFocus:r=!1}){const[l,a]=h(null),s=!!l,A=M(),d=A.palette.app.color.red?.[900]??A.palette.error.main,u=p(null),m=p([]),f=c((()=>(i??[]).filter((({isView:e})=>!e))),[i]),E=()=>a(null),I=e=>"delete"===e.toLowerCase();g((()=>{const e=u.current;if(!e)return;const t=t=>{o||"Enter"===t.key&&(t.preventDefault(),a(e))};return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}),[o]);const k=e=>{const t=m.current;if(!t.length)return;const i=document.activeElement,o=t.findIndex((e=>e===i)),n=-1!==o?o:1===e?-1:t.length;for(let i=1;i<=t.length;i++){const o=(n+i*e+t.length)%t.length,l=t[o],a=f[o]?.title??"";if(l&&(!r||!I(a)))return void l.focus()}};return g((()=>{s&&r&&f.length&&requestAnimationFrame((()=>k(1)))}),[r,f.length,s]),f.length?t(x,{sx:{width:"100%"},children:[e(n,{ref:u,component:"div",sx:{width:"100%",cursor:"pointer",alignItems:"center"},onClick:e=>{o||a(e.currentTarget)},disabled:o,"data-clickable":"true",children:e(Ce,{})}),l&&e(Ae,{open:!0,anchorEl:l,onClose:E,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{onKeyDown:e=>{r&&("ArrowDown"===e.key&&(e.preventDefault(),k(1)),"ArrowUp"===e.key&&(e.preventDefault(),k(-1)))}}},children:e(Rl,{padding:{padding:"2px"},children:f.map((({title:t,onClick:i,href:o},n)=>{const l=I(t);return e(x,{children:e(ne,{...o?{component:C,href:o,prefetch:!1}:{},ref:e=>{m.current[n]=e},sx:{borderRadius:"4px",color:l?d:void 0,width:"100%",textAlign:"start",padding:"5px 16px 5px 10px"},tabIndex:l&&r?-1:0,onClick:()=>{i?.(),E()},children:e(j,{variant:"body1",children:t})})},t)}))})})]}):null}dh.displayName="SmartTextFieldV2";const hh=({orientation:t="horizontal",activeStep:i=0,stepLabelProps:o={},steps:n,errorSteps:r=[],onStepClick:l,showActiveStepIcon:a,showTooltips:s=!1,showStepLabels:C=!0,...A})=>{const d=M(),{butterflyBlue:c,red:h}=d.palette.app.color;return e(x,{children:e(ho,{activeStep:i,orientation:t,...A,children:n.map(((t,i)=>{const n=r.includes(i),a=e(co,{...o,error:n,sx:{cursor:l?"pointer":"default",".Mui-active .MuiStepIcon-root":{color:`${c[900]} !important`},".Mui-completed .MuiStepIcon-root":{color:`${c[900]} !important`},...n&&{".MuiStepIcon-root":{color:`${h[900]} !important`},".MuiStepLabel-label":{color:`${h[900]} !important`}},...o.sx},onClick:()=>(e=>{l&&l(e)})(i),children:C&&e(j,{variant:"body2",children:t})});return e(Ao,{children:s?e(T,{title:t,placement:"top",children:a}):a},t)}))})})},ph=J(po)((({theme:e})=>({[`&.${go.alternativeLabel}`]:{top:10,left:"calc(-50% + 16px)",right:"calc(50% + 16px)"},[`&.${go.active}`]:{[`& .${go.line}`]:{borderColor:"#784af4"}},[`&.${go.completed}`]:{[`& .${go.line}`]:{borderColor:"#784af4"}},[`& .${go.line}`]:{borderColor:"#eaeaf0",borderTopWidth:3,borderRadius:1,...e.applyStyles("dark",{borderColor:e.palette.grey[800]})}}))),gh=J("div")((({theme:e})=>({color:"#eaeaf0",display:"flex",height:22,alignItems:"center","& .QontoStepIcon-completedIcon":{color:"#784af4",zIndex:1,fontSize:18},"& .QontoStepIcon-circle":{width:8,height:8,borderRadius:"50%",backgroundColor:"currentColor"},...e.applyStyles("dark",{color:e.palette.grey[700]}),variants:[{props:({ownerState:e})=>e.active,style:{color:"#784af4"}}]})));function uh(t){const{active:i,completed:o,className:n}=t;return e(gh,{ownerState:{active:i},className:n,children:o?e(Ve,{className:"QontoStepIcon-completedIcon"}):e("div",{className:"QontoStepIcon-circle"})})}const mh=({steps:t,alternativeLabel:i=!0,stepLabelProps:o={},...n})=>e(a,{sx:{width:"100%"},spacing:4,children:e(ho,{alternativeLabel:i,activeStep:1,connector:e(ph,{}),...n,children:t.map((t=>e(Ao,{children:e(co,{StepIconComponent:uh,...o,children:t})},t)))})}),fh=({orientation:o="horizontal",activeStep:n=0,stepLabelProps:r={},steps:l,...s})=>{const C=M(),{butterflyBlue:A}=C.palette.app.color;return e(x,{children:e(ho,{activeStep:n,orientation:o,...s,children:l.map(((o,n)=>e(Ao,{children:e(co,{...r,sx:{".Mui-active .css-18pqgpd-MuiSvgIcon-root-MuiStepIcon-root":{color:`${A[900]} !important`},".Mui-completed .MuiStepIcon-root":{color:`${A[900]} !important`},".MuiStepIcon-text":{color:"transparent !important",display:"none"}},children:e(a,{children:t(i,o?.in_time?{children:[e(j,{variant:"caption",children:"In at"}),e(j,{variant:"caption",children:o?.in_time})]}:{children:[e(j,{variant:"caption",children:"Out at"}),e(j,{variant:"caption",children:o?.out_time})]})})})},n)))})})},Eh=()=>e(x,{flex:1,children:e(Ie,{height:"30px",sx:{maxWidth:"200px",transform:"scale(1)"}})}),Ih={small:{minHeight:"36px !important",height:"36px !important",fontSize:"12px !important",padding:"10px 5px !important"},medium:{minHeight:"48px !important",height:"48px !important",fontSize:"13px !important",padding:"12px 16px !important"},large:{minHeight:"52px !important",height:"52px !important",fontSize:"14px !important",padding:"14px 18px !important"}},kh={small:{minHeight:"36px !important",height:"36px !important"},medium:{minHeight:"48px !important",height:"48px !important"},large:{minHeight:"52px !important",height:"52px !important"}},Sh=({tabs:t,value:i,loading:o,tabProps:n,role:r,size:l="medium"})=>o?e(a,{gap:"10px",direction:"row",children:t.map((()=>e(Eh,{},$t())))}):e(mo,{value:i,role:r,sx:{...kh[l],"& .MuiTabs-scroller":{minHeight:"inherit",height:"inherit"},"& .MuiTabs-flexContainer":{minHeight:"inherit",height:"inherit"},"& .MuiTab-root.MuiButtonBase-root":{...Ih[l]}},children:t.filter((({isView:e})=>!1!==e)).map((({iconPosition:t="end",toolTipLabel:i="",icon:r,href:l,target:a,...s},A)=>{const d=l?{component:C,href:l,target:a,prefetch:!1}:{},c=Re(s,["isView"]);return I(uo,{...d,key:c.value??A,icon:i?e(cl,{toolTipLabel:i,placement:"bottom",children:r}):r,disabled:o,iconPosition:t,...c,...n})}))});function wh({label:i,value:o,menu:n,trimLabel:r=!0,activeTab:l,index:s,onArrowClick:A,menuAnchor:d,onAction:c,href:h,target:p,...g}){const u=M(),{butterflyBlue:m}=u.palette.app.color,f=o===l.value,E=i.toLowerCase().replaceAll(/[ _]/g,"-"),I=ko(i,{length:r?15:i.length,omission:r?"...":""}),k={title:"Edit",onClick:()=>c&&c("editTemplate",l)},S={title:"Delete",onClick:()=>c&&c("deleteTemplate",l)},w=h?{component:C,href:h,target:p,prefetch:!1}:{},B={iconPosition:"end","data-cy":E,"data-ptag":E,value:o??s,label:t(a,{direction:"row",gap:"6px",alignItems:"center",children:[e(j,{variant:"body1",sx:{whiteSpace:"nowrap"},children:f?i:I}),f&&s>0&&e(Fl,{items:[k,S]})]})};return i.length>15&&!f&&(B.title=i),o===l.value&&n?.length&&(B.icon=e(te,{onClick:A,id:`tabDropDown-${o}`,"aria-controls":null!==d?`dropDownMenu-${o}`:void 0,"aria-expanded":null!==d?"true":void 0,"aria-haspopup":"true","data-cy":`${E}-arrowicon`,"data-ptag":`${E}-arrowicon`})),e(uo,{sx:{borderBottom:"2px solid",borderBottomColor:f?m[900]:"white",overflow:"visible",[`&.${Io.root}`]:{minHeight:"40px",height:"40px",paddingLeft:f&&s>0?"15px":"10px"},"&:hover":{backgroundColor:m[500]}},...B,...w,...g})}function Bh({tabs:t,activeTab:o,menuAnchor:n,onClose:a,onMenuItemClick:s}){return e(i,{children:t.filter((e=>!!e.menu)).map((t=>e(r,{anchorEl:n,open:t.value===o.value&&!!n,onClose:a,id:`dropDownMenu-${t.value}`,MenuListProps:{"aria-labelledby":`tabDropDown-${t.value}`},children:t.menu?.map((({label:t,disabled:i,onClick:n,href:r,target:a})=>e(l,{onClick:()=>{s(),n(o)},disabled:i,...r?{component:C,href:r,target:a,prefetch:!1}:{},children:t},t)))},t.value)))})}function xh({tabs:i,onChange:o,addButton:n,actionButton:r,ariaLabel:l,activeIndex:s=0,onAction:C}){const A=M(),[d,c]=h(i[s]),[p,u]=h(null);g((()=>{-1===i.findIndex((e=>e.value===d.value))&&(o&&i[0]&&o(i[0]),c(i[0]))}),[i,d,o]),g((()=>{c(i[s])}),[s]);return t(x,{children:[e(Bh,{activeTab:d,tabs:i,onClose:()=>u(null),onMenuItemClick:()=>u(null),menuAnchor:p}),t(a,{direction:"row",justifyContent:"space-between",sx:{borderBlockEnd:"solid 1px",borderColor:A.palette.app.color.iron[700]},children:[t(a,{direction:"row",gap:"5px",alignItems:"center",overflow:"hidden",children:[e(a,{direction:"row",overflow:"hidden",children:e(mo,{value:i.some((e=>e.value===d.value))?d.value:i[0]?.value,onChange:(e,t)=>{const n=i.find((e=>e.value===t));n&&(c(n),o&&n&&o(n))},TabIndicatorProps:{sx:{display:"none"}},sx:{[`&.${fo.root}`]:{minHeight:"40px",height:"40px"}},variant:"scrollable",scrollButtons:"auto",ScrollButtonComponent:Eo,"aria-label":l??"Tabs",children:i.map(((t,i)=>e(wh,{index:i,activeTab:d,onArrowClick:e=>{u(e.target)},onAction:C,menuAnchor:p,...t},t.value)))})}),n]}),e(a,{direction:"row",gap:"10px",alignItems:"center",justifyContent:"space-between",children:r})]})]})}const Qh=({variant:i,leaveColor:o,toolTipLabel:n})=>{const r=Mo(i);return t(a,{sx:{position:"relative",width:"100%",alignItems:"center"},children:[e(x,{sx:{position:"absolute",backgroundColor:"#ffffff",border:`1px solid ${o??r}`,borderRadius:"7px",padding:"0px 5px",zIndex:1,color:`${o??r}`,height:"28px",display:"flex",alignItems:"center",cursor:"pointer"},children:e(cl,{toolTipLabel:n,children:Jo(i)})}),e(hi,{valueLabelDisplay:"off",value:[0,2],max:2,step:1,sx:{"& .MuiSlider-track":{background:`${o??r}`,height:"2px",border:"none"},"& .MuiSlider-thumb":{backgroundColor:`${o??r}`,height:8,width:8},"& .MuiSlider-rail":{backgroundColor:"transparent"}}})]})},Mh=({totalDots:i,intervals:o,startTimeline:n})=>e(x,{sx:{position:"relative",width:"100%",height:4},children:o?.map(((o,r)=>{const l=Zo(o.in_time),s=Zo(o.out_time),C=y.fromISO(o.in_time),A=y.fromISO(o.out_time).diff(C,["hours","minutes"]).toFormat("hh:mm");let d=Jh(l),c=Jh(s);const h=!isNaN(d),p=!isNaN(c);h&&d<n&&(d+=i),p&&(c<n&&(c+=i),h&&c<d&&(c+=i));let g="",u="";h&&(g=`In time : ${l} ${p?"":" / Missing punch"}`),p&&(u=`Out time : ${s} ${h?"":"/ Missing punch"}`);const m=o?.name??`In/Out: ${Zo(o.in_time)} - ${Zo(o.out_time)} (${A})`,f=o?.color??Mo(o.status_type),E=h?(d-n)/i*100:0,I=p?(c-n)/i*100:0,k=h&&p?Math.max(I-E,0):0;return t(a,{direction:"row",children:[h&&e(T,{arrow:!0,title:g,placement:"top",children:e(x,{sx:{height:8,width:8,position:"absolute",left:`${E}%`,boxShadow:"none",backgroundColor:f,borderRadius:"50%",top:"15px",zIndex:3,"&:focus, &:hover, &:active":{boxShadow:"none"}}})}),h&&p&&e(T,{arrow:!0,title:m,placement:"top",children:e(x,{sx:{position:"absolute",left:`${E}%`,width:`${k}%`,height:3.5,top:"17.5px",backgroundColor:f,zIndex:2}})}),p&&e(T,{arrow:!0,title:u,placement:"top",children:e(x,{sx:{height:8,width:8,position:"absolute",left:`${I}%`,boxShadow:"none",backgroundColor:f,borderRadius:"50%",top:"15px",zIndex:3,"&:focus, &:hover, &:active":{boxShadow:"none"}}})})]},r)}))}),Jh=e=>{const t=y.fromFormat(e,"HH:mm");return t.hour+t.minute/60},bh=({totalDots:i,highlightedIntervals:o,shiftStartTime:n,shiftEndTime:r,startTimeline:l="2024-11-17T18:30:04.000Z"})=>{const s=parseFloat(Zo(l)),C=(e,t,o)=>{const n=Zo(e),r=Zo(t);let l=Jh(n),a=Jh(r);return l=l<s?l+i:l,a=a<l?a+i:a,"END"===o?a:l},A=e=>{const t=(e+s)%i;return o.some((e=>t>=parseFloat(Zo(e.in_time))&&t<=parseFloat(Zo(e.out_time))))},d=Array.from({length:i},((e,t)=>({value:(t+s)%i,label:"",highlighted:A((t+s)%i)})));return t(a,{sx:{position:"relative",width:"100%"},children:[e(Mh,{totalDots:i,intervals:o,startTimeline:s}),e(T,{title:`Shift Start: ${Zo(n)}`,arrow:!0,placement:"top",children:e(x,{sx:{cursor:"pointer",position:"absolute",top:"12px",zIndex:2,left:(C(n,r,"START")-s)%i/i*100+"%"},children:e(Fn,{})})}),e(T,{title:`Shift End: ${Zo(r)}`,arrow:!0,placement:"top",children:e(x,{sx:{cursor:"pointer",position:"absolute",top:"12px",zIndex:2,left:(C(n,r,"END")-s)%i/(i-.6)*100+"%"},children:e(Fn,{})})}),e(hi,{disabled:!0,valueLabelDisplay:"off",marks:d,max:i-1,step:1,value:[],sx:{zIndex:1,"& .MuiSlider-track":{background:"transparent",height:1,border:"none"},"& .MuiSlider-mark":{backgroundColor:"gray",height:4,width:4,borderRadius:"50%"},"& .MuiSlider-markActive":{backgroundColor:"transparent",height:5,width:5},"& .MuiSlider-rail":{height:2,backgroundColor:"#929292"},"& .MuiSlider-thumb":{display:"none"}}})]})},vh=J(le,{shouldForwardProp:e=>"isParent"!==e&&"borderColor"!==e&&"backgroundColor"!==e&&"baseColor"!==e})((({theme:e,isParent:t,borderColor:i,backgroundColor:o,baseColor:n})=>({width:"auto",minWidth:0,padding:e.spacing(1),borderRadius:12,border:`1px solid ${i}`,boxShadow:t?`0 6px 18px ${R(n,.2)}`:"none",backgroundColor:o,display:"flex",alignItems:"center",gap:e.spacing(1),minHeight:40,overflow:"hidden",flex:"1 1 auto",[e.breakpoints.down("sm")]:{flex:"1 1 100%"}}))),Rh=({node:i,innerRef:o,isParent:n=!1,themeColor:r})=>{const{id:l,title:a,subtitle:s,value:C}=i,A=M(),{butterflyBlue:d,slate:c}=A.palette.app.color,h=r??d[900],p=n?h:R(h,.7),g=n?R(h,.1):"none",u=c[900];return t(vh,{elevation:n?3:0,ref:o,isParent:n,borderColor:p,backgroundColor:g,baseColor:h,children:[t(x,{children:[e(j,{variant:"subtitle2",noWrap:!0,children:a}),e(j,{variant:"subtitle2",color:u,noWrap:!0,children:s})]}),e(Rl,{padding:{paddingLeft:1},children:e(x,{sx:{ml:"auto",textAlign:"right"},children:e(j,{noWrap:!0,variant:"body2",children:C})})})]},l)},Lh=({node:i,setRef:o,themeColor:n,itemWidth:r})=>{const{id:l,children:s}=i,C=!!s?.length;return t(x,{sx:{display:"flex",gap:3,alignItems:"flex-start",flex:`1 0 ${r}`},children:[e(Rh,{node:i,isParent:C,innerRef:e=>o(l,e),themeColor:n}),C&&e(a,{spacing:1,sx:{mt:.5},children:se(s,(t=>e(Lh,{node:t,setRef:o,themeColor:n,itemWidth:r},t.id)))})]},l)},yh=({node:i,setRef:o,themeColor:n})=>{const{id:r,children:l}=i,s=!!l?.length;return t(a,{gap:1,children:[e(Rh,{node:i,isParent:s,innerRef:e=>o(r,e),themeColor:n}),s&&e(Rl,{padding:{paddingLeft:3,paddingTop:1},children:e(a,{spacing:1,children:se(l,(t=>e(yh,{node:t,setRef:o,themeColor:n},t.id)))})})]},r)},Fh=({nodes:i,direction:o="horizontal",columns:n=3,color:r})=>{const{isMobile:l}=en(),s=p({}),C=p(null),A=p(null),d=p(null),[c,u]=h([]),m=(e,t)=>{if(t)return s.current[e]=t,void(d.current&&d.current.observe(t));s.current=Re(s.current,e)},f=e=>e?e.getBoundingClientRect():null,E=(e,t,i)=>{So(e,(e=>{const{id:n,children:r}=e;if(!r?.length)return;const a=s.current[n];if(!a)return;const C=f(a);C&&So(r,(e=>{const{id:n,children:r}=e,a=s.current[n];if(!a)return;const A=f(a);if(!A)return;const d=l||"vertical"===o?((e,t,i)=>{const{left:o,width:n,bottom:r}=e,{left:l,width:a,top:s}=t,{left:C,top:A}=i,d=o+n/2-C,c=r-A,h=l+a/2-C,p=s-A,g=c+Math.max(12,(p-c)/2);return`M ${d} ${c} C ${d} ${g} ${h} ${g} ${h} ${p}`})(C,A,t):((e,t,i)=>{const{right:o,top:n,height:r}=e,{left:l,top:a,height:s}=t,{left:C,top:A}=i,d=o-C,c=n+r/2-A,h=l-C,p=a+s/2-A,g=h-d,u=Math.abs(g),m=Math.min(120,Math.max(24,u/2)),f=g>=0?1:-1;return`M ${d} ${c} C ${d+m*f} ${c} ${h-m*f} ${p} ${h} ${p}`})(C,A,t);i.push({definition:d}),r?.length&&E([e],t,i)}))}))};g((()=>{const e=()=>requestAnimationFrame((()=>{(()=>{const e=A.current,t=C.current;if(!e||!t)return;const o=t.clientWidth;e.setAttribute("width",String(o)),e.setAttribute("height","auto");const n=t.getBoundingClientRect(),r=[];E(i,n,r),u(r)})()})),t=e(),o=new ResizeObserver(e);d.current=o,C.current&&o.observe(C.current),Ue(s.current).forEach((e=>o.observe(e)));const n=e;return window.addEventListener("resize",n),()=>{cancelAnimationFrame(t),o.disconnect(),d.current=null,window.removeEventListener("resize",n)}}),[i,l,o]);const I=`calc(${100/n}% - 24px)`;return t(x,{ref:C,variant:"outlined",component:le,position:"relative",sx:{overflowX:"hidden",overflowY:"visible"},children:[e(Kr,{ref:A,paths:c,strokeColor:r}),e(Rl,l||"vertical"===o?{padding:{padding:2},children:e(a,{spacing:3,children:se(i,(t=>e(yh,{node:t,setRef:m,themeColor:r},t.id)))})}:{padding:{padding:2},children:e(a,{direction:"row",alignItems:"flex-start",justifyContent:"flex-start",flexWrap:"wrap",gap:3,children:se(i,(t=>e(Lh,{node:t,setRef:m,themeColor:r,itemWidth:I},t.id)))})})]})};J(r)((({theme:e})=>({[`& .${Bo.paper}`]:{boxShadow:e.palette.app.paperBoxShadow,minWidth:"29rem",width:"auto",margin:"0 0.5rem",borderRadius:"8px",overflow:"visible","& .MuiList-root":{padding:"0",overflow:"visible"}}})));const Uh=J(n,{shouldForwardProp:e=>"isOpened"!==e})((({theme:e})=>({paddingInline:"0.3rem",paddingBlock:"0.2rem",borderRadius:"8px",color:e.palette.app.color.black[900]})));function Zh({userDetails:o,menuItems:n,shouldCloseOnClick:r=!0}){const[l,s]=h(null),A=p(null),{layout:d}=en(),c="desktop"===d,g=M(),{iron:u}=g.palette.app.color,m=Boolean(l),f=()=>s(null),{name:E}=o;return t(x,{position:"relative",children:[e(x,{sx:{display:"flex",alignItems:"center"},children:e(Uh,{ref:A,onClick:e=>{s(e.currentTarget)},size:"small","aria-haspopup":"true",children:t(a,{direction:"row",alignItems:"center",gap:1,color:"black",children:[e(ke,{src:o.avatar,sx:{border:`1px solid ${u[700]}`,width:28,height:28}}),c&&t(i,{children:[e(j,{maxWidth:150,noWrap:!0,children:E}),e(m?Je:Me,{})]})]})})}),m&&e(Ae,{open:!0,anchorEl:l,onClose:f,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{elevation:0,sx:{width:220,overflow:"visible",mt:1.5,px:0,py:0,filter:"drop-shadow(0px 2px 8px rgba(0,0,0,0.32))","& .MuiAvatar-root":{width:32,height:32,ml:-.5,mr:1},"&:before":{content:'""',display:"block",position:"absolute",top:0,right:14,width:10,height:10,bgcolor:"background.paper",transform:"translateY(-50%) rotate(45deg)",zIndex:0}}}},children:e(x,{sx:{padding:"4px 0"},children:n.map((({key:i,divider:o,label:n,icon:l,sx:s,onClick:A,href:d,target:c})=>{const h=d?{component:C,href:d,target:c,prefetch:!1}:{};return t(x,{children:[o&&e(X,{}),e(ne,{...h,onClick:()=>{$(A)&&(A(),r&&f())},children:(l||n)&&t(a,{gap:"16px",alignItems:"center",width:"100%",flexDirection:"row",sx:{...s},children:[e(wo,{sx:{minWidth:"20px",alignItems:"center",...s},children:l}),n&&e(j,{sx:{fontSize:"13px"},children:n})]})})]},`${i}_container`)}))})})]})}export{pA as ASPECT_RATIO_LABELS,hA as ASPECT_RATIO_VALUES,Mn as ActionButton,Qn as ActionButtons,Ul as ActionButtonsWrapper,Fl as ActionCell,hl as AddIconAction,jl as AgGrid,sl as AnnouncementBanner,ga as AppBar,Tr as AppLogoMedium,jr as AppLogoSmall,Fn as ArrowUp,yn as ArrowUpRight,Ja as AttendanceCard,Wr as AttendanceManagementDarkSvg,qr as AttendanceReportDarkSvg,Qh as AttendanceStatus,Zs as Autocomplete,ua as Badge,ts as BarChart,al as BookMarkSvg,Gs as BottomDialog,Vs as BottomSheet,ws as BoxStyled,ma as BreadcrumbButtonWrapper,ka as Breadcrumbs,zr as BriefcaseSvg,Or as BulkOperationsDarkSvg,Jn as Button,Ps as ButtonContainer,bn as ButtonGroup,vn as ButtonLayoutProvider,pl as CalendarIconAction,_r as CalendarSvg,Sa as Card,wa as CardItem,Ba as CardItemValue,$a as CellSelectionTable,Nr as ChartIconSvg,oC as CheckBox,Bs as CheckStyled,xo as CheckboxInput,ls as Chip,ss as ChipWithBorder,Xr as ClockSvg,cs as CodeSnippetBox,Vd as ColumnArranger,jd as ColumnArrangerDialog,Td as ColumnArrangerForm,gl as ColumnIconAction,Al as CommentIcon,Tn as CompanyBanner,ul as ConfigureIconAction,Ns as ContentBox,QC as CurrencyField,vl as CurrentLocationAction,ca as CustomEnumFilter,fA as DEFAULT_ASPECT_RATIOS,mA as DEFAULT_ENABLED_VARIANTS,CA as DEFAULT_MAX_SIZE_MB,AA as DEFAULT_MIN_RESOLUTION,dA as DEFAULT_QUALITY_WARN_RESOLUTION,$r as DashboardIconSvg,sC as DatePicker,gC as DateRangePicker,EC as DateRangePickerField,Ac as DateRangePickerPopUp,uC as DateRangeSelector,wC as DateTimePicker,JC as DecimalTextField,$s as DeleteDialog,ml as DeleteIconAction,Ds as Dialog,tC as DialogSelect,ZC as DownloadAction,fl as DownloadIconAction,El as DownloadPrintAction,jn as DownloadSvg,lc as Drawer,Il as EditIconAction,el as EmployeeManagementDarkSvg,tl as EmployeeReportsDarkSvg,cr as ExitIcon,kl as ExportIconAction,Dl as FacebookCircularProgress,HC as FileNames,UC as FilePreview,Os as FilePreviewContainer,TC as FileUpload,Sl as FilterIconAction,Ec as FilterList,mc as FilterListV2,as as FilterPill,Cs as FilterPillV2,pc as FilterPopUpDateRangeWrapper,dc as FilterPopup,hc as FilterPopupWrapper,fc as FilterTypeWrapper,lr as FormAction,Ln as FormActionButton,Ts as FormContainer,js as FormGridLayout,qs as FormRow,zs as FormSection,_s as GridProvider,dl as GroupIcon,Ic as HighlightedText,wl as HistoryIconAction,Pr as HolidayCalendarSvg,il as HomePageBanner,iA as ImageUpload,oA as ImageUploadView,ar as ImportExcelSuccessIcon,Bl as ImportIconAction,hr as InboxIcon,xl as InboxIconAction,kc as Indicator,cA as JPEG_COMPRESS_QUALITY,bl as KeyBoardIconAction,nA as LOGO_ACCEPTED_TYPES,rA as LOGO_ACCEPT_ATTRIBUTE,lA as LOGO_EXTENSION_MIME_MAP,ed as LOGO_SIZE_TOKENS,uA as LOGO_VARIANT_SIZES,sr as LeaveIcon,lC as LeftArrowIcon,Cl as LikeIcon,os as LineChart,pd as ListItemButton,Aa as LoadingCell,Hl as LoadingOverlay,Cr as LoanIcon,pr as LogoIcon,cd as LogoPicker,ad as LogoViewDialog,qc as MAX_LIST_HEIGHT,Wn as MasterIcon,Xs as MasterPageLayout,ol as MiscellaneousManagementDarkSvg,vo as NavigationKeyProvider,yo as NavigationRouterProvider,gr as NoDataFoundSvg,Kl as NoDataOverlay,Rh as Node,jc as OPTION_ROW_HEIGHT,Ar as OvertimeIcon,gA as PRIMARY_SIZE_BY_RATIO,Rl as PadBox,wc as Pagination,Ed as PasswordField,nl as PayrollManagementDarkSvg,rl as PayrollReportDarkSvg,Sd as PhoneInputField,$C as PhotoCaptureDialog,rs as PieChart,Bc as PrintDownloadActions,Ql as ProcessIconAction,xa as ProfileCard,Qa as ProfileCardBody,Ma as ProfileCardHeader,xd as RadioGroupField,Jd as Rating,da as RedirectionCell,aC as RightArrowIcon,zc as SELECT_ALL_VALUE,xc as SMART_FIELD_INPUT_CLASS,RC as SUPPORTED_DOC_FORMATS,LC as SUPPORTED_EXCEL_FORMATS,Vo as SUPPORTED_FILE_TYPES,bC as SUPPORTED_IMAGE_FORMATS,vC as SUPPORTED_PDF_FORMATS,dr as SalaryIcon,eC as SaveDialog,bd as SearchField,yd as Select,qn as SettingIcon,Sc as SeverityIndicator,Cc as SideDrawer,ah as SmartAutoCompleteField,Kc as SmartCurrencyField,Yc as SmartDialogSelect,ch as SmartGridActionCell,qd as SmartLink,Tc as SmartSelectField,Ch as SmartTextField,dh as SmartTextFieldV2,Uc as SmartTooltip,Rn as SplitButton,hh as Stepper,mh as StepperV2,fh as StepperV3,vd as StickySearchField,ur as SvgAccessDenied,zn as SvgAccount,mr as SvgAdd,fr as SvgAddRounded,Un as SvgArrival,On as SvgBankConfig,Kr as SvgBranches,Er as SvgCalendar,Ir as SvgColumn,Pn as SvgConfiguration,kr as SvgConfigure,ll as SvgCurrentLocation,Sr as SvgDelete,Zn as SvgDeparture,or as SvgDevices,wr as SvgDownload,Br as SvgDrop,br as SvgEdit,Gr as SvgEmail,nr as SvgEmployeeOnboarding,Nn as SvgEmployees,ir as SvgEngage,xr as SvgExport,Mr as SvgFilterList,Qr as SvgFilteredList,Jr as SvgHistory,Dn as SvgHoliday,vr as SvgHome,Rr as SvgImport,Yr as SvgIndicator,Lr as SvgKeyBoard,Hn as SvgLeaveCalendar,Xn as SvgLetteremplate,yr as SvgNoLogo,Fr as SvgNoSign,_n as SvgOrganization,Ur as SvgPageNotFound,$n as SvgPayroll,Vr as SvgPhone,Zr as SvgProfile,Dr as SvgReGenerate,er as SvgStock,rr as SvgTeam,tr as SvgTransaction,Kn as SvgUnverifieduser,Gn as SvgUser,Yn as SvgVerifiedUser,Hr as SvgView,Vn as SvgWeekoffCalendar,Ud as SwitchField,wh as Tab,xh as TabBar,Sh as Tabs,Bh as TabsMenus,fd as TextField,kn as Theme,Dd as TimeField,Kd as TimePicker,bh as Timeline,gs as Toaster,cl as Tooltip,Fh as Tree,Zh as UserProfileMenu,Wc as VIRTUALIZE_THRESHOLD,Ml as ViewDetailsIconAction,DC as ViewFilePreviewDialog,Jl as ViewIconAction,An as accessorFnRegex,Bn as appTheme,la as calculateSummaryRow,un as colorPaletteUI,rC as dateFormats,Vl as defaultPageSize,od as detectLogoShape,Ko as downloadFile,Yo as downloadPrintHtml,sn as emailRegex,Oo as errorMessages,VC as error_with_transaltion,ha as extractPrefixedValue,La as extractSortValue,zo as filterByFields,_c as filterOptionsByQuery,ea as flattenColumns,Uo as formatDate,uc as formatFilterData,Ho as formatHours,Jh as getArrowValue,Mo as getColorByVariant,id as getDefaultPreviewLimits,Do as getDifferenceInHHmmss,td as getEditFrameSize,Po as getErrorProps,gc as getFormValue,$c as getInitialHighlightIndex,nd as getLogoFrameSize,aA as getLogoMimeFromFileName,Fa as getNextSortDirection,Oc as getOptionLabelText,Pc as getOptionValueText,Sn as getPaletteByTheme,Lc as getSmartFieldInputStyles,bc as getSmartFieldPlaceholderColor,Rc as getSmartFieldPlaceholderCss,Jc as getSmartFieldSizeConfig,vc as getSmartFieldTextColor,yc as getSmartFieldWrapperStyles,Jo as getStatusLabel,Zo as getTimeInHHmm,EA as getVariantsForAspectRatio,Wo as getZIndex,cn as highlightWordsRegex,qo as hslToRgb,dn as hslaRegex,To as isFileSizeValid,FC as isFileType,jo as isFileTypeValid,sA as isLogoAcceptedType,Nc as isSelectAllOption,Za as isSelectionDisabled,Ua as isSortingEnabled,IA as isSvgFile,ln as isoDateRegex,rd as loadImageNaturalSize,rn as monthYearRegex,an as noSpecialCharacterRegex,Xc as normalizeToStringArray,hn as numericRegex,Tl as pageSizeOptions,Xo as parseCellValue,No as parseNumericValue,MC as predefinedOptions,Qo as serverityOptions,Yl as showNoRowsOverlay,ya as sortTableData,Cn as timeRegex,Is as toasts,xn as urlToNestedObject,ql as useAgGridCheckBoxSelection,zl as useAgGridFilteredData,Nl as useAgGridKeyboardShortcuts,Xl as useAgGridRowSelectionConfig,Ca as useAgGridSelection,aa as useAgGridSummaryRow,sa as useAgGridSummaryRowUpdate,_o as useDialogActions,$o as useFormFieldFocus,en as useGetDeviceType,tn as useGlobalKeyboardShortcut,Ro as useNavigationKeyContext,Fo as useNavigationRouter,nn as useParseHref,Da as useSorting,on as useZoomLevel};
23
+ `,LA=J(x)((({theme:e})=>{const{iron:t,butterflyBlue:i}=e.palette.app.color,{white:o}=e.palette.common;return{display:"inline-flex",alignItems:"center",gap:"2px",padding:"4px",borderRadius:"12px",background:o,border:`1px solid ${R(i[900],.14)}`,boxShadow:`\n 0 12px 32px ${R(t[900],.28)},\n 0 4px 12px ${R(t[900],.18)},\n 0 1px 3px ${R(t[900],.12)}\n `,backdropFilter:"blur(10px)",animation:`${vA} 220ms cubic-bezier(0.22, 1, 0.36, 1)`,position:"relative","&::before":{content:'""',position:"absolute",top:-5,left:"50%",width:10,height:10,background:o,border:`1px solid ${R(i[900],.14)}`,borderBottom:"none",borderRight:"none",transform:"translateX(-50%) rotate(45deg)",zIndex:0}}})),yA=J(n,{shouldForwardProp:e=>"logoSize"!==e&&"delayMs"!==e})((({theme:e,logoSize:t="large",delayMs:i=0})=>{const{butterflyBlue:o,iron:n}=e.palette.app.color,{button:r,icon:l,padding:a}=((e="large")=>"small"===e?{button:26,icon:14,padding:"4px"}:"medium"===e?{button:30,icon:16,padding:"5px"}:{button:34,icon:18,padding:"6px"})(t);return{width:r,height:r,padding:a,color:n[800],zIndex:1,animation:`${RA} 240ms cubic-bezier(0.22, 1, 0.36, 1) both`,animationDelay:`${i}ms`,transition:"background-color 0.18s ease, color 0.18s ease, transform 0.18s ease","& .MuiSvgIcon-root":{fontSize:l},"&:hover":{backgroundColor:R(o[900],.1),color:o[900],transform:"translateY(-1px)"},"&:focus-visible":{outline:`2px solid ${o[900]}`,outlineOffset:1}}})),FA=J(x,{shouldForwardProp:e=>"logoSize"!==e})((({logoSize:e="large"})=>({height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"small"===e?"2px":"6px",padding:"small"===e?"2px":"4px"})));function UA({open:t,anchorEl:i,size:o,actions:n,onClose:r,onMouseEnter:l,onMouseLeave:a}){const s=M(),{slate:C}=s.palette.app.color;return e(Ae,{open:t,anchorEl:i,onClose:r,disableRestoreFocus:!0,disableScrollLock:!0,marginThreshold:8,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},slotProps:{paper:{elevation:0,onMouseEnter:l,onMouseLeave:a,sx:{mt:1,overflow:"visible",background:"transparent",boxShadow:"none"}}},sx:{pointerEvents:"none","& .MuiPaper-root":{pointerEvents:"auto"}},children:e(LA,{role:"toolbar","aria-label":"Logo actions",children:n.map((({key:t,label:i,icon:n,onClick:r},l)=>e(cl,{toolTipLabel:i,placement:"top",children:e(yA,{logoSize:o,delayMs:40*l,"aria-label":i,onClick:e=>{e.stopPropagation(),r(e)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),r(e))},sx:{color:C[900]},children:n})},t)))})})}const ZA=J(x)({display:"flex",flexDirection:"column",gap:"12px"}),DA=J(x)({display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:"10px"}),HA=J(x)((({theme:e})=>{const{mirage:t,butterflyBlue:i,lightBlue:o}=e.palette.app.color;return{position:"relative",width:"100%",height:280,borderRadius:"8px",overflow:"hidden",backgroundColor:t[900],border:`1px solid ${i[700]}`,[e.breakpoints.up("sm")]:{height:360},"& .reactEasyCrop_CropArea":{border:`2px solid ${i[900]} !important`,color:R(t[900],.55)},"& .reactEasyCrop_CropAreaGrid::before, & .reactEasyCrop_CropAreaGrid::after":{borderColor:R(o[50],.35)}}})),KA=J(x)({display:"flex",alignItems:"center",gap:"8px"}),GA=J(n)((({theme:e})=>{const{butterflyBlue:t,iron:i}=e.palette.app.color;return{color:t[900],"&.Mui-disabled":{color:i[700]}}})),YA=J(x)((({theme:e})=>{const{butterflyBlue:t,lightBlue:i}=e.palette.app.color;return{width:40,height:40,borderRadius:"6px",overflow:"hidden",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:i[50],border:`1px solid ${t[700]}`}})),VA=J(x)((({theme:e})=>{const{mirage:t,lightBlue:i}=e.palette.app.color;return{position:"absolute",inset:0,zIndex:5,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"10px",backgroundColor:R(t[900],.7),color:i[50]}}));function TA({imageSrc:t,aspectRatio:i,rotation:o,zoom:n,onZoomChange:r,onCropComplete:l}){const[a,s]=h({x:0,y:0});g((()=>{s({x:0,y:0})}),[i]);const C=u(((e,t)=>{l(t)}),[l]);return e(pi,{image:t,crop:a,zoom:n,rotation:o,aspect:hA[i],onCropChange:s,onZoomChange:r,onCropComplete:C,objectFit:"contain",showGrid:!0,style:{containerStyle:{width:"100%",height:"100%"}}})}function jA({open:i,imageSrc:o,originalFile:n,aspectRatios:r=fA,enabledVariants:l,initialAspectRatio:s="1:1",onClose:C,onApply:A}){const d=M(),{iron:c,butterflyBlue:p}=d.palette.app.color,[m,f]=h(s),[E,I]=h(1),[k,S]=h(0),[w,B]=h(null),[Q,J]=h(!1),[b,v]=h(null),R=u((()=>{I(1),S(0)}),[]);g((()=>{i&&(f(s),R(),B(null),v((e=>(SA(e),null))))}),[i,s,R]),g((()=>{const e=new AbortController;return(async()=>{if(w&&o)try{const t=await QA(o,w,k,void 0,void 0,"image/png");if(e.signal.aborted)return;const i=URL.createObjectURL(t);if(e.signal.aborted)return void SA(i);v((e=>(SA(e),i)))}catch{if(e.signal.aborted)return;v((e=>(SA(e),null)))}})(),()=>{e.abort()}}),[w,o,k]);return e(Ds,{open:i,onClose:C,title:"Crop Logo",maxWidth:"md",actions:t(a,{direction:"row",gap:"10px",justifyContent:"flex-end",children:[e(Ln,{actionType:"cancel",variant:"outlined",onClick:C,disableKeyboardShortcut:Q,disabled:Q}),e(Ln,{onClick:()=>{(async()=>{if(w){J(!0);try{const e=await bA({imageSrc:o,original:n,pixelCrop:w,rotation:k,aspectRatio:m,enabledVariants:l});A({...e,aspectRatio:m}),C()}catch{Is.error({title:"Failed to process cropped image. Please try again."})}finally{J(!1)}}else Is.error({title:"Adjust the crop area before saving."})})()},loading:Q,label:"Apply"})]}),children:t(ZA,{children:[t(DA,{children:[e(bn,{renderButtons:r.map((e=>({icon:null,value:e,label:e,selected:m===e,size:"small",onClick:e=>{const t=r.find((t=>t===e));t&&f(t)}}))),sx:{textTransform:"none",fontWeight:500,boxShadow:"none","&.MuiButton-text":{color:c[800]}}}),t(a,{direction:"row",alignItems:"center",gap:"2px",children:[e(cl,{toolTipLabel:"Drag to reposition. Scroll or use zoom to refine.",children:e(GA,{size:"small","aria-label":"Crop tips",children:e(Gt,{fontSize:"small"})})}),e(cl,{toolTipLabel:"Rotate left",children:e(GA,{size:"small",onClick:()=>S((e=>e-90)),"aria-label":"Rotate left",disabled:Q,children:e(Ci,{fontSize:"small"})})}),e(cl,{toolTipLabel:"Rotate right",children:e(GA,{size:"small",onClick:()=>S((e=>e+90)),"aria-label":"Rotate right",disabled:Q,children:e(Ai,{fontSize:"small"})})}),e(cl,{toolTipLabel:"Reset",children:e(GA,{size:"small",onClick:R,"aria-label":"Reset crop",disabled:Q,children:e(si,{fontSize:"small"})})})]})]}),t(x,{sx:{position:"relative"},children:[e(HA,{children:e(TA,{imageSrc:o,aspectRatio:m,rotation:k,zoom:E,onZoomChange:I,onCropComplete:B})}),Q&&t(VA,{children:[e(N,{size:28,sx:{color:p[900]}}),e(j,{variant:"body2",children:"Processing…"})]})]}),t(KA,{children:[e(cl,{toolTipLabel:"Zoom out",children:e(GA,{size:"small",onClick:()=>{I((e=>Math.max(1,Number((e-.1).toFixed(2)))))},"aria-label":"Zoom out",disabled:E<=1||Q,children:e(ci,{fontSize:"small"})})}),e(hi,{value:E,min:1,max:3,step:.05,"aria-label":"Zoom",onChange:(e,t)=>{"number"==typeof t&&I(t)},size:"small",disabled:Q,sx:{flex:1,color:p[900],"& .MuiSlider-rail":{backgroundColor:c[700]}}}),e(cl,{toolTipLabel:"Zoom in",children:e(GA,{size:"small",onClick:()=>{I((e=>Math.min(3,Number((e+.1).toFixed(2)))))},"aria-label":"Zoom in",disabled:E>=3||Q,children:e(di,{fontSize:"small"})})}),t(j,{variant:"caption",color:c[800],sx:{minWidth:36,textAlign:"right"},children:[Math.round(100*E),"%"]}),b&&e(YA,{children:e(x,{component:"img",src:b,alt:"Crop preview",sx:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}})})]})]})})}const WA="120px",qA="120px",zA=(e,t,i)=>i?"none":t?`1px dashed ${e}`:`1px solid ${e}`,OA=J(x,{shouldForwardProp:e=>"isDragging"!==e&&"hasImage"!==e&&"disabled"!==e&&"frameWidth"!==e&&"frameHeight"!==e&&"frameBorderRadius"!==e&&"isViewMode"!==e&&"hideBorder"!==e})((e=>(({theme:e,isDragging:t,hasImage:i,disabled:o,frameWidth:n,frameHeight:r,frameBorderRadius:l,isViewMode:a,hideBorder:s})=>{const{butterflyBlue:C,iron:A}=e.palette.app.color,d=t||i?C[900]:e.palette.grey[400],c=n??qA,h=a&&i||!a&&!o,p=!o&&!a&&!s;return{width:c,height:r??WA,minWidth:c,maxWidth:c,position:"relative",overflow:"hidden",borderRadius:l??"10px",border:zA(d,t,s),backgroundColor:t?R(C[900],.05):i?e.palette.common.white:A[50],cursor:h?"pointer":"default",opacity:o&&!a?.6:1,transition:"all 0.2s ease-in-out",outline:"none",boxSizing:"border-box","&:focus-visible":{outline:h?`2px solid ${C[900]}`:"none",outlineOffset:2},...p&&{"&:hover":{border:zA(C[900],t)}}}})(e))),PA=J(x)((({theme:e})=>({width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:e.palette.common.white}))),NA=J(x,{shouldForwardProp:e=>"frameBorderRadius"!==e})((({theme:e,frameBorderRadius:t})=>{const{mirage:i}=e.palette.app.color;return{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",gap:"4px",backgroundColor:R(i[600],.2),backdropFilter:"blur(3px)",borderRadius:t??"10px",zIndex:2}})),XA=J(x,{shouldForwardProp:e=>"frameBorderRadius"!==e})((({theme:e,frameBorderRadius:t})=>{const{mirage:i}=e.palette.app.color;return{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:R(i[600],.35),backdropFilter:"blur(2px)",borderRadius:t??"10px",zIndex:3}}));function _A({open:i,size:o,disabled:r,borderRadius:l,onEdit:a,onDelete:s,onHoverChange:C}){const A=M(),{lightBlue:d}=A.palette.app.color,c="small"===o?16:20,h="small"===o?"small":"medium";return e(ri,{in:i,timeout:{enter:300,exit:1e3},children:t(NA,{frameBorderRadius:l,onFocus:()=>C(!0),onBlur:e=>{kA(e.currentTarget,e.relatedTarget)&&C(!1)},children:[e(n,{tabIndex:0,disabled:r,"aria-label":"Replace logo",size:h,onClick:e=>{e.stopPropagation(),a()},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),a())},children:e(oi,{sx:{color:d[50],fontSize:c}})}),e(n,{tabIndex:0,disabled:r,"aria-label":"Remove logo",size:h,onClick:s,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||s(e)},children:e(ii,{sx:{color:d[50],fontSize:c}})})]})})}function $A({size:i,disabled:o=!1,enableCaptureImage:n=!1,onAttach:r,onCapture:l}){const a=M(),{iron:s}=a.palette.app.color,C=e=>t=>{t.stopPropagation(),t.preventDefault(),o||e()};return t(FA,{logoSize:i,children:[n&&e(cl,{toolTipLabel:"Capture photo",placement:"top",children:e(yA,{logoSize:i,delayMs:0,disabled:o,"aria-label":"Capture photo",onClick:C((()=>l?.())),children:e(ti,{sx:{color:s[900]}})})}),e(cl,{toolTipLabel:"Upload logo",placement:"top",children:e(yA,{logoSize:i,delayMs:n?40:0,disabled:o,"aria-label":"Upload logo",onClick:C(r),children:e(ui,{sx:{color:s[900]}})})})]})}const ed={small:{base:60,rectShort:36,rectMaxLong:120,borderRadius:"8px",iconFontSize:20},medium:{base:80,rectShort:48,rectMaxLong:160,borderRadius:"8px",iconFontSize:24},large:{base:120,rectShort:72,rectMaxLong:240,borderRadius:"10px",iconFontSize:28}},td=(e,t="square")=>{const{base:i,borderRadius:o}=ed[e];return{width:i,height:i,borderRadius:"circle"===t?"50%":o}},id=e=>{const{base:t,rectMaxLong:i}=ed[e];return{maxPreviewWidth:i,maxPreviewHeight:t}},od=(e,t)=>{if(!e||!t)return"square";const i=e/t;return Math.abs(i-1)<=.12?"square":i>1?"rectangle":"portrait"},nd=(e,t="large",i,o)=>{const{base:n,rectShort:r,rectMaxLong:l,borderRadius:a}=ed[t];if("circle"===e)return{width:n,height:n,borderRadius:"50%"};if("square"===e)return{width:n,height:n,borderRadius:a};if("rectangle"===e)return{width:l,height:r,borderRadius:a};if(!i||!o)return{width:n,height:n,borderRadius:a};const s=od(i,o);if("square"===s)return{width:n,height:n,borderRadius:a};const C=i/o;if("rectangle"===s){const e=r;return{width:Math.min(l,Math.round(e*C)),height:e,borderRadius:a}}const A=r;return{width:A,height:Math.min(l,Math.round(A/C)),borderRadius:a}},rd=e=>new Promise(((t,i)=>{const o=new Image;o.onload=()=>{const{naturalWidth:e,naturalHeight:i}=o;t({width:e,height:i})},o.onerror=()=>i(new Error("Failed to load image")),o.crossOrigin="anonymous",o.src=e}));function ld({size:t,disabled:i,enableCaptureImage:o,onAttach:n,onCapture:r}){const l=M(),{iron:s}=l.palette.app.color,{iconFontSize:C}=ed[t];return o?e($A,{size:t,disabled:i,enableCaptureImage:o,onAttach:n,onCapture:r}):e(a,{justifyContent:"center",alignItems:"center",sx:{height:"100%"},children:e(gi,{sx:{color:s[700],fontSize:C}})})}function ad({open:i,imageSrc:o,title:r="Logo",onClose:l}){const a=M(),{iron:s}=a.palette.app.color;return e(fi,{open:i,onClose:l,closeAfterTransition:!0,slots:{backdrop:mi},slotProps:{backdrop:{timeout:200,sx:{backgroundColor:R(a.palette.common.white,.45),backdropFilter:"blur(8px) saturate(1.7)",WebkitBackdropFilter:"blur(8px) saturate(9)"}}},"aria-label":r,children:e(ri,{in:i,children:t(x,{sx:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",p:{xs:2,sm:4},outline:"none",overflow:"hidden"},onClick:l,children:[e(n,{"aria-label":"Close",onClick:l,size:"small",sx:{position:"absolute",top:{xs:12,sm:16},right:{xs:12,sm:16},zIndex:2,color:s[400],bgcolor:"transparent",boxShadow:"none","&:hover":{bgcolor:"transparent",opacity:.7}},children:e(st,{fontSize:"small"})}),e(x,{sx:{position:"relative",maxWidth:"min(920px, 100%)",maxHeight:"100%",lineHeight:0},onClick:e=>e.stopPropagation(),children:e(x,{component:"img",src:o,alt:r,sx:{display:"block",maxWidth:"100%",maxHeight:"min(82vh, 680px)",width:"auto",height:"auto",objectFit:"contain",borderRadius:"10px",bgcolor:a.palette.common.white,boxShadow:`0 12px 40px ${R(s[400],.18)}`}})})]})})})}function sd({previewUrl:o,label:r,required:l,hideBorder:s,variant:C,size:A,frame:d,maxPreviewWidth:c,maxPreviewHeight:p,onView:u}){const m=M(),{iron:f,lightBlue:E}=m.palette.app.color,{iconFontSize:I}=ed[A],[k,S]=h(!1),[w,B]=h(!1),[Q,J]=h(!1),b="auto"===C,v=!!o&&!Q,R="small"===A?16:20;g((()=>{J(!1)}),[o]);const L=b?{width:"fit-content",height:"fit-content",minWidth:"unset",maxWidth:"unset"}:void 0,{width:y,height:F,borderRadius:U}=d,Z=b?{display:"block",maxWidth:c,maxHeight:p,width:"auto",height:"auto",borderRadius:U}:{display:"block",width:"100%",height:"100%",objectFit:"cover",objectPosition:"center",borderRadius:U},D=e=>{e?.stopPropagation(),v&&(u?u():B(!0))},H=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),D())},K=e=>{kA(e.currentTarget,e.relatedTarget)&&S(!1)};return v?t(i,{children:[t(a,{direction:"row",alignItems:"center",gap:"15px",children:[t(OA,{hasImage:!0,isViewMode:!0,hideBorder:s,frameWidth:b?"fit-content":y,frameHeight:b?"fit-content":F,frameBorderRadius:U,tabIndex:0,role:"button","aria-label":`View ${r||"logo"}`,onClick:()=>D(),onKeyDown:H,onMouseEnter:()=>S(!0),onFocus:()=>S(!0),onBlur:K,onMouseLeave:()=>S(!1),sx:L,children:[e(ri,{in:k,timeout:{enter:300,exit:1e3},children:e(NA,{frameBorderRadius:U,onFocus:()=>S(!0),onBlur:K,children:e(n,{tabIndex:0,"aria-label":"View logo",size:"small"===A?"small":"medium",onClick:D,onKeyDown:H,children:e(Ot,{sx:{color:E[50],fontSize:R}})})})}),e(PA,{sx:{borderRadius:U,...b?{width:"fit-content",height:"fit-content"}:void 0},children:e(x,{component:"img",src:o,alt:"Logo",onError:()=>J(!0),sx:Z})})]}),r&&e(ze,{required:l,children:r})]}),e(ad,{open:w,imageSrc:o,title:r||"View Logo",onClose:()=>B(!1)})]}):t(a,{direction:"row",alignItems:"center",gap:"15px",children:[e(OA,{hasImage:!1,disabled:!0,isViewMode:!0,frameWidth:y,frameHeight:F,frameBorderRadius:U,role:"img","aria-label":r||"Logo",children:e(x,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",sx:{height:"100%"},children:e(gi,{sx:{color:f[700],fontSize:I}})})}),r&&e(ze,{required:l,children:r})]})}const Cd=({size:i="large"})=>{const{base:o,borderRadius:n}=ed[i],r="small"===i;return t(a,{direction:"row",alignItems:"center",gap:r?"10px":"15px",children:[e(Ie,{variant:"rectangular",sx:{width:o,height:o,minWidth:o,maxWidth:o,borderRadius:n,transform:"scale(1)"}}),t(a,{gap:"5px",children:[e(Ie,{width:r?90:120,height:r?18:24,sx:{transform:"scale(1)"}}),e(Ie,{width:r?100:140,height:r?12:16,sx:{transform:"scale(1)"}})]})]})},Ad=(e,t,i)=>(t&&Is.error({title:e}),{valid:!1,error:e,...i}),dd=async(e,t,i,o)=>{try{const{width:n,height:r}=await(e=>new Promise(((t,i)=>{const o=URL.createObjectURL(e),n=new Image;n.onload=()=>{const{naturalWidth:e,naturalHeight:i}=n;URL.revokeObjectURL(o),t({width:e,height:i})},n.onerror=()=>{URL.revokeObjectURL(o),i(new Error("Failed to load image"))},n.src=o})))(e),l=Math.min(n,r);if(l<t)return Ad(`Image resolution too low. Minimum is ${t}×${t} px.`,o,{width:n,height:r});if(l<i){const e=`Image quality may be low (${n}×${r} px). Consider using a higher-resolution logo.`;return o&&Is.warning({title:e}),{valid:!0,warning:e,width:n,height:r}}return{valid:!0,width:n,height:r}}catch{return Ad("Unable to read image. Please try another file.",o)}};function cd({onChange:o,onDelete:n,onView:r,defaultValue:l="",value:s,label:C="Logo",subTitle:A="PNG, JPEG under 5 MB",mode:d="edit",variant:m="square",size:f="large",maxPreviewWidth:E,maxPreviewHeight:I,hideBorder:k=!1,maxSizeMB:S=5,minResolution:w=256,qualityWarnResolution:B=512,aspectRatios:x=fA,enabledVariants:Q=mA,isUploading:J=!1,loading:b=!1,disabled:v=!1,required:R=!1,enableCaptureImage:L=!1,acceptedTypes:y=nA}){const F=M(),{iron:U,butterflyBlue:Z}=F.palette.app.color,D="view"===d,H=id(f),K=E??H.maxPreviewWidth,G=I??H.maxPreviewHeight,Y="circle"===m?"circle":"square",V=c((()=>td(f,Y)),[f,Y]),T=p(null),W=p(null),q=p(null),z=p(null),[O,P]=h(!1),[X,_]=h(!1),[$,ee]=h(s??l),[te,ie]=h(!1),[oe,ne]=h(null),[re,le]=h(!1),[ae,se]=h(!1),[Ce,Ae]=h(null),[de,ce]=h(null),[he,pe]=h(!1),[ge,ue]=h(!1),[me,fe]=h((()=>nd(m,f))),{inputRef:Ee,setInputRef:Ie,maintainFocusAfterClose:ke}=$o({isOpen:he||ae});g((()=>{void 0!==s&&ee(s)}),[s]),g((()=>{ie(!1)}),[$]),g((()=>{if(!D)return void fe(V);if("auto"!==m)return void fe(nd(m,f));if(!$)return void fe(nd("square",f));let e=!1;return rd($).then((({width:t,height:i})=>{e||fe(nd("auto",f,t,i))})).catch((()=>{e||fe(nd("square",f))})),()=>{e=!0}}),[D,m,$,f,V]);const Se=D?me:V,we=!!$&&!te,Be=u((()=>{SA(W.current),W.current=null}),[]);g((()=>()=>{Be(),SA(q.current),q.current=null,z.current&&clearTimeout(z.current)}),[Be]);const xe=()=>{v||Ee.current?.click()},Qe=()=>{!v&&L&&(ue(!1),pe(!0))},Me=()=>{z.current&&(clearTimeout(z.current),z.current=null)},Je=()=>{!v&&we&&L&&(Me(),ue(!0))},be=()=>{Me(),z.current=setTimeout((()=>{ue(!1)}),160)},ve=e=>{L?e?Je():be():P(e)},Re=async e=>{if(o){ne(null),le(!0),ue(!1);try{const t=await(async(e,{maxSizeMB:t=5,minResolution:i=256,qualityWarnResolution:o=512,acceptedTypes:n=nA,showToasts:r=!0}={})=>sA(e,n)?To(e,t)?IA(e)?{valid:!0}:dd(e,i,o,r):Ad(`File too large. Maximum size is ${t} MB.`,r):Ad("Unsupported file type. Use PNG, JPG, JPEG, SVG, or WEBP.",r))(e,{maxSizeMB:S,minResolution:w,qualityWarnResolution:B,acceptedTypes:y});if(!t.valid)return void ne(t.error??"Invalid file");if(IA(e)){const t=await(async(e,t)=>{const i=URL.createObjectURL(e),o={};for(const i of t)o[i]=e;return{cropped:e,variants:o,previewUrl:i}})(e,Q),{cropped:i,variants:n,previewUrl:r}=t;return Be(),W.current=r,ee(r),void o({original:e,cropped:i,variants:n,aspectRatio:"1:1",previewUrl:r})}const i=URL.createObjectURL(e);ce(e),Ae((e=>(SA(e),q.current=i,i))),se(!0)}finally{le(!1)}}},Le=e=>{const[t]=Array.from(e);t&&Re(t)},ye=e=>{e?.stopPropagation(),e?.preventDefault(),Be(),ee(""),ie(!1),ne(null),ce(null),ue(!1),Ae((e=>(SA(e),q.current=null,null))),n?.()};if(b)return e(Cd,{size:f});if(D)return e(sd,{previewUrl:$,label:C,required:R,hideBorder:k,variant:m,size:f,frame:Se,maxPreviewWidth:K,maxPreviewHeight:G,onView:r});const{width:Fe,height:Ue,borderRadius:Ze}=Se,De="50%"===Ze?"50%":"8px",He=(({enableCaptureImage:t,onEdit:i,onCapture:o,onDelete:n})=>{const r=[{key:"edit",label:"Replace logo",icon:e(oi,{}),onClick:e=>{e.stopPropagation(),i()}}];return t&&r.push({key:"capture",label:"Capture photo",icon:e(ti,{}),onClick:e=>{e.stopPropagation(),o()}}),r.push({key:"delete",label:"Remove logo",icon:e(ii,{}),onClick:e=>{n(e)}}),r})({enableCaptureImage:L,onEdit:xe,onCapture:Qe,onDelete:ye});return t(i,{children:[t(a,{direction:"row",alignItems:"center",gap:"15px",children:[t(OA,{ref:T,isDragging:X,hasImage:we,disabled:v,frameWidth:Fe,frameHeight:Ue,frameBorderRadius:Ze,tabIndex:v?-1:0,role:"button","aria-disabled":v,"aria-label":C||"Logo",onClick:()=>!v&&!we&&!L&&xe(),onKeyDown:e=>{v||we||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),xe())},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),!v&&(e=>e.dataTransfer.types.includes("Files"))(e)&&_(!0)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),v||(e.dataTransfer.dropEffect="copy")},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),kA(e.currentTarget,e.relatedTarget)&&_(!1)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),_(!1),!v&&e.dataTransfer.files.length>0&&Le(e.dataTransfer.files)},onMouseEnter:()=>!v&&ve(!0),onFocus:()=>!v&&ve(!0),onMouseLeave:()=>ve(!1),onBlur:e=>{kA(e.currentTarget,e.relatedTarget)&&ve(!1)},children:[e("input",{ref:Ie,type:"file",accept:rA,onChange:e=>{!v&&e.target.files&&(Le(e.target.files),e.target.value="")},disabled:v,style:{display:"none"},"aria-hidden":!0}),!L&&e(_A,{open:O&&!!$&&!v,size:f,disabled:v,borderRadius:Ze,onEdit:xe,onDelete:ye,onHoverChange:P}),(J||re)&&e(XA,{frameBorderRadius:Ze,children:e(N,{size:"small"===f?16:22,sx:{color:U[600]}})}),X&&e(XA,{frameBorderRadius:Ze,children:e(j,{variant:"caption",color:Z[900],children:"Drop"})}),we?e(PA,{sx:{borderRadius:Ze},children:e("img",{src:$,alt:"Logo",onError:()=>ie(!0),style:{width:"100%",height:"100%",objectFit:"contain",objectPosition:"center",display:"block",borderRadius:De}})}):e(ld,{size:f,disabled:v,enableCaptureImage:L,onAttach:xe,onCapture:Qe})]}),t(a,{gap:"5px",justifyContent:"center",children:[C&&e(ze,{disabled:v,required:R,children:C}),A&&e(j,{noWrap:!0,variant:"caption",color:U[800],children:A}),oe&&e(j,{variant:"caption",color:"error",children:oe})]})]}),L&&we&&!v&&e(UA,{open:ge,anchorEl:T.current,size:f,actions:He,onClose:()=>ue(!1),onMouseEnter:Je,onMouseLeave:be}),ae&&Ce&&de&&o&&e(jA,{open:ae,imageSrc:Ce,originalFile:de,aspectRatios:x,enabledVariants:Q,onClose:()=>{se(!1),ke()},onApply:({cropped:e,variants:t,previewUrl:i,aspectRatio:n})=>{Be(),W.current=i,ee(i),ne(null),se(!1),o({original:de,cropped:e,variants:t,aspectRatio:n,previewUrl:i}),Is.success({title:"Logo cropped successfully"}),ke()}}),L&&he&&e($C,{open:he,isUploading:J||re,onChange:Le,onClose:()=>{pe(!1),ke()}})]})}const hd=J(ne,{shouldForwardProp:e=>"selected"!==e})((({theme:e,selected:t})=>({background:e.palette.app.color.iron[600],color:e.palette.app.color.mirage[900],borderRadius:"4px",border:`1px solid ${e.palette.app.color.butterflyBlue[300]}`,...t?{background:e.palette.app.color.deepAqua[500],color:e.palette.app.color.mirage[900],borderLeft:`6px solid ${e.palette.app.color.butterflyBlue[900]}`}:{}})));function pd({label:i,selected:o,actions:n,companyName:r,href:l,target:s,...A}){const d=M(),{iron:c}=d.palette.app.color,u=p(null),[m,f]=h(!1);g((()=>{const e=u.current;if(!e)return;const t=()=>f(e.scrollWidth>e.clientWidth);return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}),[i,r]);return e(hd,{selected:o,alignItems:"flex-start",...l?{component:C,href:l,target:s,prefetch:!1}:{},...A,children:t(a,{width:"100%",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[t(a,{gap:"5px",direction:"column",flex:1,display:"grid",children:[e(cl,{toolTipLabel:i,checkOverflow:!m,children:e(j,{variant:"body2",fontWeight:500,ref:u,sx:{width:"auto",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:i})}),e(j,{variant:"caption",color:c[800],children:r})]}),n]})})}const gd=new Set(["+","-","e","E","*","/","=","%","^"]),ud=/[+\-eE*/=%^]/,md={string:"Only alphabetic characters are allowed.","string-number":"Only letters and numbers are allowed.","string-number-special":"Special characters are allowed.","string-special":"Only letters, accents, apostrophes, and hyphens are allowed.","string-special-all":"Only letters and Special characters are allowed",custom:"Please enter a valid input"};function fd({control:i,name:o,defaultValue:n,label:r="",rules:l,type:s,required:C,disabled:A,loading:d=!1,placeholder:c="",isCapitalize:h=!1,isTrimStartDisabled:p=!1,rows:g,characterType:u="string-number-special",letterCase:m="mixed",setError:f,containerProps:E,styling:I="custom",infoMessage:k,regexExpression:S={message:null,regex:/^[\s\S]*$/},navigationKey:w,customOnChange:B,size:x,...Q}){const{field:{value:M,onChange:J,onBlur:b,...v},fieldState:{error:R}}=_e({name:o,control:i,defaultValue:n,rules:l}),{navigationKey:L}=Ro(),y=w??L,{inputRef:F,maintainFocus:U,handleKeyDown:Z,handleEnterNavigation:D}=$o({navigationKey:y}),{inputHeight:H,inputFontSize:K}=xs(x),G=Boolean(g??Q.multiline),Y=e=>{let t=e;const i=(e=>{switch(e){case"string":return/^[A-Za-z\s]*$/;case"string-number":return/^[A-Za-z0-9\s]*$/;case"string-number-special":default:return/^[\s\S]*$/;case"string-special":return/^[\p{L}’'\-\s.]+$/u;case"string-special-all":return/^[^\d]+$/;case"custom":return S.regex}})(u);return i.test(t)||(t=t.split("").filter((e=>i.test(e))).join("")),"uppercase"===m?t=t.toUpperCase():"lowercase"===m&&(t=t.toLowerCase()),t},{message:V}=S,T=V||md[u];return d?e(BC,{label:r,multiline:G,styling:I,size:x}):t(a,{...E,gap:"5px",children:[r&&"custom"===I&&t(a,{direction:"row",children:[e(ze,{required:C,disabled:A,children:r}),k&&e(cl,{toolTipLabel:k,children:e(Gt,{sx:{fontSize:13}})})]}),e(Oe,{disabled:A,required:C,fullWidth:!0,inputRef:F,onKeyDown:e=>{"number"===s&&gd.has(e.key)&&e.preventDefault();!Boolean(g??Q.multiline)||"Enter"!==e.key||"enter"!==y||e.shiftKey||e.ctrlKey||e.metaKey||e.altKey?Z(e,void 0,!1):D(e,!0)},onPaste:e=>{"number"===s&&ud.test(e.clipboardData.getData("text"))&&e.preventDefault()},placeholder:"default"===I?c:c||r,type:s,label:"default"===I?r:void 0,sx:{...Js(I),"& .MuiInputBase-root":{...!G&&{height:`${H}px !important`,fontSize:K}}},InputLabelProps:Ms(I,x,G),inputProps:{min:0},error:Boolean(R),helperText:R?.message,onChange:e=>{const t=e.target,{selectionStart:i,selectionEnd:n}=t;let r=e.target.value||null;"string"==typeof r&&""===r.trim()?r=null:p||"string"!=typeof r||(r=r.trimStart());const l=r&&Y(r);if(r!==l&&f)return void f(o,{type:"manual",message:T});let a=l;r&&"number"===s?a=Number(r):h&&l&&(a=l?l.toUpperCase():null),J(a),B&&B(r),requestAnimationFrame((()=>{"text"==s&&t.setSelectionRange(i,n),U()}))},onBlur:()=>{if(!p&&"string"==typeof M){const e=M.trim(),t=""===e?null:e;M!==t&&J(t)}b()},value:"string"==typeof M?M.trimStart():M??"",...v,...Q})]})}function Ed(t){const[i,o]=h(!1);return e(fd,{type:i?"text":"password",InputProps:{startAdornment:e(qe,{position:"start",children:e(Ei,{fontSize:"small"})}),endAdornment:e(qe,{position:"end",children:e(n,{"aria-label":"toggle password visibility",onClick:()=>{o((e=>!e))},edge:"end",children:e(i?Ii:Ot,{fontSize:"small"})})})},...t})}const Id=J(x,{shouldForwardProp:e=>"error"!==e})((({styling:e,theme:t,error:i,size:o})=>{const n={position:"relative"},{red:r,butterflyBlue:l,iron:a,slate:s,black:C}=t.palette.app.color,{fontSize:A}=Qs(o);return"custom"===e?{...n,"&.custom_phone_input":{"& .phone-input-container":{"&:focus-within":{border:`2px solid ${l[900]} !important`}},"& .phone-input-field":{padding:"8.5px 50px 8.5px 30px","&:focus":{"& ~ .flag-dropdown":{borderColor:i?r[900]:l[900]}}},"& .flag-dropdown":{"&.open":{borderColor:i?r[900]:l[900]}}}}:{"&.default_phone_input":{"& .react-tel-input":{"& .form-control":{fontSize:"16px",background:a[600],border:`1px solid ${s[100]}`,borderRadius:"5px",width:"300px",outline:"none",padding:"18.5px 14px 18.5px 58px",transition:"box-shadow ease .25s, border-color ease .25s","&:focus":{borderColor:l[900],boxShadow:`0 0 0 2px ${l[900]}`},"&.invalid-number":{border:`1px solid ${r[900]}`,"&:focus":{boxShadow:`0 0 0 2px ${r[900]}`},"&+div:before":{content:"'Error'",display:"none",color:`${r[900]}`,width:"27px"}}},"& .flag-dropdown":{position:"absolute",top:"0",bottom:"0",padding:"0",backgroundColor:a[600],borderRadius:"3px 0 0 3px","&:hover, &:focus":{cursor:"pointer"}},"& input[disabled]":{"&+.flag-dropdown":{"&:hover":{cursor:"default",borderColor:s[100],"& .selected-flag":{backgroundColor:"transparent"}}}},"& .selected-flag":{outline:"none",position:"relative",height:"100%",padding:"0 0 0 8px",borderRadius:"3px 0 0 3px","&:focus":{"& .arrow":{borderLeftWidth:"4px",borderRightWidth:"4px",borderTop:`5px solid ${l[900]}`}},"& .flag":{position:"absolute",top:"50%",marginTop:"-6px"},"& .arrow":{position:"relative",top:"50%",marginTop:"-1px",width:"0",height:"0",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderTop:"4px solid #555","&.up":{borderTop:"none",borderBottom:"4px solid #555"}}},"& .country-list":{outline:"none",zIndex:1,listStyle:"none",position:"absolute",padding:"0",margin:"10px 0 10px -1px",backgroundColor:"white",width:"300px",maxHeight:"220px",overflowY:"scroll",borderRadius:"7px","& .flag":{display:"inline-block",position:"absolute",left:"13px",top:"8px",marginRight:"7px",marginTop:"2px"},"& .divider":{paddingBottom:"5px",marginBottom:"5px",borderBottom:"1px solid #ccc"},"& .country":{position:"relative",padding:"12px 9px 13px 46px","& .dial-code":{color:"#6b6b6b"},"&:hover":{backgroundColor:"hsl(0, 0.00%, 94.50%)"},"&.highlight":{backgroundColor:s[300]}},"& .country-name":{marginRight:"6px"},"& .search":{zIndex:2,position:"sticky",top:"0",backgroundColor:"#fff",padding:"10px 0 6px 10px"},"& .search-emoji":{display:"none",fontSize:"15px"},"& .search-box":{border:`1px solid ${s[100]}`,borderRadius:"3px",fontSize:"15px",lineHeight:"15px",marginLeft:"6px",padding:"3px 8px 5px",outline:"none","&:hover":{borderColor:s[50]}},"& .no-entries-message":{padding:"7px 10px 11px",opacity:".7"}},"& .invalid-number-message":{position:"absolute",zIndex:1,fontSize:"13px",left:"25px",top:"-7px",background:"#fff",padding:"0 5px",color:r[900]},"& .special-label":{position:"absolute",zIndex:5,top:"small"===o?"-8px":"-9px",left:"0px",display:"block",color:C[900],background:a[600],opacity:"1",fontSize:`${A}px`,whiteSpace:"nowrap",lineHeight:"1.1",scale:"small"===o?.83:.85}},"&.phone-input-required .react-tel-input .special-label::after":{content:"' *'",color:r[900],fontSize:"13px",fontWeight:500}}}})),kd=({rows:i,label:o,styling:n,size:r})=>{const{inputHeight:l}=xs(r),s=void 0===i?l:26.5*i;return t(a,{gap:"5px",children:[o&&"custom"===n&&e(Ie,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(Ie,{height:`${s}px`,sx:{transform:"scale(1)"}})]})};function Sd({control:i,name:o,defaultValue:n,rules:r,label:l,disabled:s=!1,required:C,rows:A,loading:d=!1,placeholder:c="",error:u,helperText:m,navigationKey:f,styling:E="custom",size:I,autoFocus:k=!1,...S}){const w=M(),{iron:B,red:x,slate:Q}=w.palette.app.color,{navigationKey:J}=Ro(),b=f??J,{inputHeight:v,inputFontSize:R}=xs(I),{inputProps:L,...y}=S,F={...L??{},...k&&!s?{autoFocus:!0}:{}},{field:{value:U,onChange:Z,...D}}=_e({name:o,control:i,defaultValue:n,rules:r}),[H,K]=h(!1),{setInputRef:G,maintainFocusAfterClose:Y,handleKeyDown:V}=$o({isOpen:H,navigationKey:b}),T=p(null);return g((()=>{const e=T.current;if(!e||s)return;const t=e.querySelector("input[type='tel']");t&&(G(t),D.ref(t));const i=()=>{const t=e.querySelector(".country-list"),i=e.querySelector(".react-tel-input");if(!t)return;const o=i?.getBoundingClientRect()?.width,n=e.querySelector(".flag-dropdown")?.getBoundingClientRect();n&&(t.style.position="fixed",t.style.top=`${n.bottom}px`,t.style.left=`${n.left}px`,t.style.zIndex="99999",t.style.maxHeight="200px",t.style.overflowY="auto",t.style.width=`${o}px`)},o=()=>{i()};window.addEventListener("resize",o),window.addEventListener("scroll",o,!0);const n=()=>{const t=e.querySelector(".selected-flag");t&&(t.setAttribute("tabindex","-1"),t.addEventListener("focus",(()=>{t.blur()})));const o=!!e.querySelector(".flag-dropdown.open");K(o),o&&(i(),setTimeout((()=>{const t=e.querySelector(".country-list .search-box input");t&&t.focus()}),0))},r=new MutationObserver((e=>{n();e.some((({addedNodes:e})=>!e.length))&&i()}));r.observe(e,{attributes:!0,attributeFilter:["class"],subtree:!0,childList:!0});const l=e=>{const t=e.target;(t.closest(".flag-dropdown")||t.closest(".country-list"))&&setTimeout(n,0)},a=e=>{const t=e.target;t.closest(".flag-dropdown")||t.closest(".country-list")||setTimeout(n,0)};return e.addEventListener("click",l),document.addEventListener("click",a),n(),()=>{window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0),r.disconnect(),e.removeEventListener("click",l),document.removeEventListener("click",a)}}),[G,D,s]),d?e(kd,{label:l,rows:A,styling:E,size:I}):t(a,{gap:"4px",children:[t(a,{gap:"5px",children:[l&&"custom"===E&&e(ze,{required:C,disabled:s,children:l}),e(Id,{ref:T,styling:E,error:u,size:I,className:`${"custom"===E?"custom_phone_input":"default_phone_input"}${C?" phone-input-required":""}`,children:e(ki,{country:"in",enableSearch:!0,disabled:s,specialLabel:l??"",placeholder:c||l,onChange:e=>{Z(e)},value:String(U),onBlur:()=>{D.onBlur(),H||Y()},onKeyDown:e=>{H||V(e,void 0,!1)},containerStyle:{width:"100%",height:`${v}px`,border:u?`1px solid ${x[900]}`:s?`1px solid ${B[700]}`:`1px solid ${B[800]}`,borderRadius:"4px",transition:"all 0.2s ease"},inputStyle:{width:"100%",padding:"8.5px 40px",fontSize:R,height:`${v}px`,border:"none",outline:"none",transition:"all 0.2s ease",color:s?B[100]:Q[900]},containerClass:"phone-input-container",inputClass:"phone-input-field",buttonStyle:{border:"none"},...y,inputProps:F})})]}),u&&e(j,{variant:"caption",sx:{color:"red",whiteSpace:"pre",textWrap:"wrap"},children:m})]})}const wd=e=>"medium"===e?26:20,Bd=({isHorizontal:i,direction:o,optionsLength:n,size:r})=>{const l=wd(r);return t(a,{gap:"10px",direction:i?"row":"column",alignItems:i&&"row"===o?"center":void 0,children:[e(Ie,{height:"18.69px",width:"70px",sx:{transform:"scale(1)"}}),e(a,{direction:o,gap:"column"===o?"5px":"10px",children:Array.from({length:n}).map((()=>t(a,{gap:"10px",direction:"row",alignItems:"center",children:[e(Ie,{variant:"circular",height:l,width:l}),e(Ie,{height:"21px",width:"100px",sx:{transform:"scale(1)"}})]},$t())))})]})};function xd({name:i,rules:o,label:n,control:r,options:l,defaultValue:s,size:C="small",color:A="secondary",loading:d=!1,required:c=!1,direction:h="row",sx:g={},containerProps:u,isHorizontal:m=!1,navigationKey:f,customOnChange:E,...I}){const{field:{value:k,onChange:S,ref:w,...B}}=_e({name:i,control:r,defaultValue:s,rules:o}),{navigationKey:Q}=Ro(),M=f??Q,{inputRef:J,handleKeyDown:b,maintainFocus:v}=$o({navigationKey:M}),R=p(null);return d?e(Bd,{isHorizontal:m,direction:h,optionsLength:l.length,size:C}):t(a,{direction:m?"row":"column",alignItems:m?"center":void 0,gap:m?1:"5px",children:[n&&e(ze,{sx:{whiteSpace:"normal",overflow:"visible",textOverflow:"unset"},required:c,disabled:I.disabled,children:n}),e(Bi,{name:i,value:k,onKeyDown:e=>{b(e,void 0,!1)},onChange:(e,t)=>{let i;if("true"===t?(i=!0,S(!0)):"false"===t?(i=!1,S(!1)):(i=t,S(t)),E){const e=l.find((({values:e})=>e===i));e&&E(e)}const o=e.target;o?J.current=o:!J.current&&R.current&&(J.current=R.current),v()},children:e(a,{gap:"column"===h?"5px":"10px",direction:h,...u,children:l?.map((({label:t,values:i,disabled:o},n)=>e(x,{children:e(Si,{value:i,control:e(wi,{...B,...I,color:A,size:C,inputRef:e=>{if(!e)return;k===i||!J.current&&0===n?(J.current=e,R.current=e):R.current||0!==n||(R.current=e),w&&("function"==typeof w?w(e):w.current=e)},sx:{"& .MuiSvgIcon-root":{fontSize:wd(C)}}}),disabled:o,label:t,sx:g})},n)))})})]})}const Qd={small:17,medium:22,large:28},Md=({label:i,size:o="medium",direction:n="row",max:r=5})=>{const l=Qd[o],s=Array.from({length:r},((e,t)=>`star-${t+1}`));return t(a,{gap:"5px",direction:n,alignItems:"row"===n?"center":"flex-start",children:[i&&e(Ie,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(a,{gap:"2px",direction:"row",children:s.map((t=>e(Ie,{variant:"rectangular",width:l,height:l,sx:{borderRadius:"5px"}},t)))})]})};function Jd({control:o,name:n,defaultValue:r,label:l="",rules:s,disabled:C,loading:A=!1,direction:d="column",required:c=!1,navigationKey:h,size:p,max:g,containerSx:u,...m}){const{field:{value:f,onChange:E,...I},fieldState:{error:k}}=_e({name:n,control:o,defaultValue:r,rules:s}),{navigationKey:S}=Ro(),w=h??S,{maintainFocus:B,handleKeyDown:x}=$o({navigationKey:w});return A?e(Md,{label:l,size:p,direction:d,max:g}):t(i,{children:[t(a,{gap:"5px",direction:d,alignItems:"row"===d?"center":"flex-start",sx:u,children:[l&&e(ze,{required:c,disabled:C,children:l}),e("div",{onKeyDown:e=>{x(e,void 0,!1)},children:e(Qi,{disabled:C,value:f??null,onChange:(e,t)=>{E(t),B()},size:p,max:g,...I,...m})})]}),k&&e(xi,{error:!0,children:k?.message})]})}function bd(t){return e(fd,{placeholder:"Search",InputProps:{startAdornment:e(qe,{position:"start",children:e(Mi,{fontSize:"small"})})},...t,containerProps:{width:{sm:"auto",xs:"100%"},...t.containerProps}})}const vd=({top:t="0px",paperSx:i,boxSx:o,...n})=>e(le,{variant:"outlined",sx:{position:"sticky",top:t,zIndex:100,...i},children:e(Rl,{padding:{padding:"5px"},children:e(x,{sx:{display:"flex",justifyContent:"flex-end",...o},children:e(bd,{...n})})})}),Rd=J(Li)((({theme:e,disabled:t})=>{const{lightBlue:i,iron:o}=e.palette.app.color;return{"& .MuiInputBase-root":{backgroundColor:t?R(i[100],.3):o[600]},"& .MuiSelect-select":{display:"flex",alignItems:"center",gap:"8px",flexWrap:"nowrap",overflow:"hidden"},"& .MuiList-root":{maxHeight:300,overflowY:"auto","&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{backgroundColor:i[100]}}}})),Ld=J(j)((({theme:e})=>{const{butterflyBlue:t}=e.palette.app.color;return{position:"sticky",top:0,padding:"8px 16px",fontSize:"13px",fontWeight:600,color:t[900],backgroundColor:t[500],zIndex:1}}));function yd({control:o,defaultValue:r,name:s,required:C=!1,label:A,multiple:d=!1,disabled:g=!1,options:m=[],rules:f,loading:E=!1,helperText:I,error:k,placeholder:S="",isShowSelectAll:w=!0,isShowAvatar:B=!1,onAction:J,renderOption:b,maxLimit:v,maxDisplayItems:R=2,disableClearable:L=!!C,setOnFinalChange:y=!1,styling:F="custom",navigationKey:U,...Z}){const{field:{onChange:D,value:H,...K}}=_e({name:s,control:o,defaultValue:r,rules:f}),{navigationKey:G}=Ro(),Y=U??G,{t:V}=it(),T=M(),{slate:W,iron:q}=T.palette.app.color,z=g?q[900]:"revert-layer",[O,P]=h(null),N=p(!1),[_,$]=h(!1),{setInputRef:ee,maintainFocusAfterClose:te,handleKeyDown:ie,handleEnterNavigation:oe}=$o({isOpen:_,navigationKey:Y}),ne=c((()=>{if(!d||!w||!Array.isArray(H))return!1;const e=m.filter((e=>!e.disabled));return H.length===e.length}),[d,w,m,H]),re=c((()=>d&&Array.isArray(H)?m.filter((e=>H.includes(e.value))):[]),[d,m,H]),le=c((()=>{const e={};return m.forEach((t=>{const i=t.heading??"";e[i]||(e[i]=[]),e[i].push(t)})),e}),[m]),ae=c((()=>!L&&(!!H&&(Array.isArray(H)?H.length>0:""!==H))),[H,L]),se=u((e=>{e.stopPropagation(),D(d?[]:"")}),[d,D]),Ce=u((e=>{"enter"===Y&&"Enter"===e.key&&(e.stopPropagation(),oe(e))}),[Y,oe]),Ae=u((()=>t(a,{direction:"row",alignItems:"center",gap:"5px",children:[ae&&!_&&e(n,{size:"small",onClick:se,onKeyDown:Ce,children:e(vi,{sx:{fontSize:"14px"}})}),e(n,{size:"small",onClick:e=>{e.stopPropagation(),$((e=>!e))},onKeyDown:e=>{"Enter"===e.key&&(e.stopPropagation(),$((e=>!e)))},children:e(Ri,{fontSize:"small",sx:{transform:_?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease-in-out"}})})]})),[ae,se,Ce,_,$]);if(E)return t(a,{gap:"10px",children:[A&&"custom"===F&&e(Ie,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(Ie,{height:"35.69px",sx:{transform:"scale(1)"}})]});const de=()=>y&&N.current?O:H;return t(a,{gap:"5px",children:[A&&"custom"===F&&e(ze,{required:C,disabled:g,children:A}),t(a,{direction:"row",justifyContent:"space-between",gap:"10px",alignItems:"start",children:[t(Rd,{fullWidth:!0,error:k,disabled:g,required:C,sx:"default"===F?{...bs(F),"& .MuiOutlinedInput-notchedOutline":{"& legend":{maxWidth:0,"& span":{padding:"0 5px"}}},"& .MuiInputLabel-root.MuiInputLabel-shrink + .MuiInputBase-root .MuiOutlinedInput-notchedOutline legend":{maxWidth:"100%"}}:void 0,children:[A&&"default"===F&&e(ze,{id:`${s}-label`,sx:vs(F),children:A}),e(bi,{...K,...Z,multiple:d,value:de()??(d?[]:""),label:"default"===F?A:void 0,labelId:"default"===F&&A?`${s}-label`:void 0,inputProps:{"aria-label":"custom"===F&&A?A:void 0},onChange:e=>{const t=e.target.value;if(y)N.current=!0,d&&Array.isArray(t)&&t.includes("select-all")?P(Array.isArray(O)&&O.length===m.filter((({disabled:e})=>!e)).length?[]:m.filter((({disabled:e})=>!e)).map((({value:e})=>e))):P(t);else{if(d&&Array.isArray(t)){if(t.includes("select-all"))return void(e=>{if(e){const e=m.filter((e=>!e.disabled)).map((e=>e.value));D(e)}else D([])})(!ne);if(v&&t.length>v)return void Is.error({title:V("common.select.limitExceed",{maxLimit:v})})}D(t)}},open:_,onOpen:()=>{$(!0)},onClose:()=>{$(!1),te(),y&&N.current&&(D(O),N.current=!1,P(null))},inputRef:e=>ee(e),onKeyDown:e=>{ie(e,(()=>{$(!1)}),_)},renderValue:Z.renderValue??(i=>{if(!d){const o=m.find((e=>e.value===i)),n=()=>o?o.label:"default"===F&&A?"":S;return t(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[B&&o?.avatar&&e(ke,{src:o.avatar??"",sx:{width:20,height:20}}),e(j,{variant:"body2",color:z,sx:{WebkitTextFillColor:z},noWrap:!0,children:n()})]})}if(!Array.isArray(i)||0===i.length){return e(j,{sx:{WebkitTextFillColor:z},color:z,variant:"body2",noWrap:!0,children:"default"!==F||!A||S?S:""})}const o=re.slice(0,R),n=re.length-R;return t(x,{sx:{display:"flex",alignItems:"center",gap:.5,overflow:"hidden"},children:[o.map((t=>e(j,{variant:"body2",noWrap:!0,color:z,sx:{WebkitTextFillColor:z,backgroundColor:W[800],padding:"2px 5px",borderRadius:"12px",fontSize:"12px",maxWidth:"120px"},children:t.label},t.value))),n>0&&t(j,{variant:"body2",color:z,sx:{WebkitTextFillColor:z,backgroundColor:W[300],padding:"2px 5px",borderRadius:"12px",fontSize:"12px",fontWeight:500},children:["+",n]})]})}),IconComponent:Ae,displayEmpty:!0,MenuProps:{PaperProps:{sx:{width:"inherit",maxHeight:300,"& .MuiList-root":{paddingTop:0,paddingBottom:0}}},MenuListProps:{...Z.MenuProps?.MenuListProps,variant:"menu"}},children:Object.entries(le).length?(()=>{const o=[],n=de();return d&&w&&m.length>0&&(o.push(t(l,{value:"select-all",children:[e(Q,{icon:e(ws,{size:"small"}),checkedIcon:e(Bs,{size:"small"}),indeterminate:Array.isArray(n)&&n.length>0&&n.length<m.filter((({disabled:e})=>!e)).length,checked:Array.isArray(n)&&n.length===m.filter((e=>!e.disabled)).length,sx:{marginRight:1}}),e(Ji,{primary:"Select All"})]},"select-all")),o.push(e(X,{sx:{margin:"0px !important"}},"divider-select-all"))),Object.entries(le).forEach((([r,a])=>{r&&o.push(e(Ld,{children:r},`group-${r}`)),a.forEach((r=>{const a=d?Array.isArray(n)&&n.includes(r.value):n===r.value;o.push(e(l,{value:r.value,disabled:r.disabled,children:b?b(r,a):t(i,{children:[d&&e(Q,{icon:e(ws,{size:"small"}),checkedIcon:e(Bs,{size:"small"}),checked:a,sx:{marginRight:1}}),t(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[B&&r.avatar&&e(ke,{src:r.avatar,alt:r.label,sx:{width:24,height:24}}),e(Ji,{primary:r.label})]})]})},r.value))}))})),o})():e(l,{disabled:!0,children:e(Ji,{primary:"No options"})})}),I&&e(xi,{children:I})]}),J&&e(Il,{disabled:g,onClick:J})]})]})}const Fd=()=>e(Ie,{width:50,height:18,sx:{borderRadius:"10px"},variant:"rectangular"});function Ud({name:t,rules:i,control:o,defaultValue:n,loading:r=!1,navigationKey:l,...a}){const s=M(),{butterflyBlue:C,iron:A}=s.palette.app.color,{field:{value:d=!1,...c}}=_e({name:t,control:o,defaultValue:n,rules:i}),{navigationKey:h}=Ro(),p=l??h,{setInputRef:g,maintainFocus:u,handleKeyDown:m}=$o({navigationKey:p});if(r)return e(Fd,{});return e(yi,{checked:d,...c,...a,inputRef:g,onKeyDown:e=>{m(e,void 0,!1),a.onKeyDown&&a.onKeyDown(e)},onChange:e=>{c.onChange(e),u()},sx:{padding:1,"& .MuiSwitch-track":{borderRadius:11,backgroundColor:A[900],position:"relative","&::before":{content:"unset",position:"absolute",top:"50%",transform:"translateY(-50%)",width:16,height:16,left:12},[Fi.input]:{width:"80px !important"},"&::after":{content:"unset",position:"absolute",top:"50%",transform:"translateY(-50%)",width:16,height:16,right:12}},"& .MuiSwitch-thumb":{boxShadow:"none",width:16,height:16,margin:.15,color:"white"},"& .Mui-checked + .MuiSwitch-track":{backgroundColor:`${C[900]} !important`,opacity:"1 !important"}}})}const Zd=({label:i,styling:o,size:n})=>t(a,{gap:"5px",flex:1,children:[i&&"custom"===o&&e(Ie,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(Ie,{height:`${xs(n).inputHeight}px`,width:"100%",sx:{transform:"scale(1)"}})]});function Dd({control:i,defaultValue:o,disabled:n=!1,label:r,name:l,error:s,helperText:C,loading:A=!1,required:d=!1,rules:c,format:h="HH:mm",isReturnLocalTime:p=!1,isReturnDateWithTime:g=!1,styling:u="custom",navigationKey:m,size:f,...E}){const{field:{value:I,onChange:k,...S}}=_e({name:l,control:i,defaultValue:o,rules:c}),{navigationKey:w}=Ro(),B=m??w,{inputRef:x,maintainFocus:Q,handleKeyDown:J}=$o({navigationKey:B}),{inputHeight:b,inputFontSize:v}=xs(f),R=M(),{butterflyBlue:L}=R.palette.app.color;s&&I&&"object"==typeof I&&(C="Invalid time");const F=I?y.fromISO(I):null;return A?e(Zd,{label:r,styling:u,size:f}):t(a,{gap:"5px",children:[r&&"custom"===u&&e(ze,{required:d,disabled:n,children:r}),e(Ui,{...S,...E,disabled:n,value:F,onChange:e=>{if(e?.isValid){if(p)return k(e.toFormat(h)),void Q();if(g)return k(e.toUTC().toISO()),void Q();k(e.toUTC().toISOTime()),Q()}else k(e),Q()},slotProps:{textField:{disabled:n,helperText:C,error:s,label:"default"===u?r:void 0,required:"default"===u?d:void 0,inputRef:x,InputLabelProps:Ms(u,f),onKeyDown:e=>{J(e,void 0,!1)},sx:{...Js(u),width:"100%","& .MuiInputBase-root":{fontSize:v,height:b},backgroundColor:"white","& .Mui-selected":{backgroundColor:L[900],borderRadius:"5px"}}}},format:h,helperText:C,sx:{backgroundColor:"white","& .Mui-selected":{backgroundColor:L[900],borderRadius:"5px"},"& .MuiOutlinedInput-input":{fontSize:v}}})]})}const Hd=({label:i,styling:o,size:n})=>{const{inputHeight:r}=xs(n);return t(a,{gap:"5px",flex:1,children:[i&&"custom"===o&&e(Ie,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(Ie,{height:`${r}px`,width:"100%",sx:{transform:"scale(1)"}})]})};function Kd({control:i,defaultValue:o,disabled:n=!1,label:r,readOnly:l=!1,name:s,error:C=!1,helperText:A,loading:d=!1,required:c=!1,rules:p,format:g="HH:mm",isReturnLocalTime:u=!1,isReturnDateWithTime:m=!1,timeStepsMinutes:f=1,helperIcon:E,toolTipText:I,containerProps:k,styling:S="custom",navigationKey:w,size:B,...x}){const{field:{value:Q,onChange:J,...b}}=_e({name:s,control:i,defaultValue:o,rules:p}),[v,R]=h(!1),{navigationKey:L}=Ro(),F=w??L,{setInputRef:U,maintainFocus:Z,maintainFocusAfterClose:D,handleKeyDown:H,handleEnterNavigation:K}=$o({isOpen:v,navigationKey:F}),{inputHeight:G,inputFontSize:Y}=xs(B);C&&Q&&"object"==typeof Q&&(A="Invalid time");const V=M(),{butterflyBlue:j}=V.palette.app.color,W=Q?y.fromISO(Q):null;return d?e(Hd,{label:r,styling:S,size:B}):t(a,{gap:"5px",...k,children:[r&&"custom"===S&&t(a,{alignItems:"center",flexDirection:"row",gap:"5px",children:[e(ze,{required:c,disabled:n,children:r}),E&&I&&e(T,{title:I,placement:"bottom",children:E})]}),e(Zi,{...b,...x,disabled:n,readOnly:l,open:v,ampm:!1,value:W,format:g,onOpen:()=>R(!0),onClose:()=>{R(!1),D()},timeSteps:{minutes:f},slotProps:{textField:{disabled:n,helperText:A,error:C,label:"default"===S?r:void 0,required:"default"===S?c:void 0,inputRef:U,InputLabelProps:Ms(S,B),sx:{...Js(S),width:"100%","& .MuiInputBase-root":{fontSize:Y,height:G},backgroundColor:"white","& .Mui-selected":{backgroundColor:j[900],borderRadius:"5px"},"& .MuiOutlinedInput-input":{fontSize:Y}},onKeyDown:e=>{if("enter"===F){if(" "===e.key&&!v&&!n&&!l)return e.preventDefault(),e.stopPropagation(),void R(!0);if("Enter"===e.key&&!v)return e.preventDefault(),e.stopPropagation(),void K(e);if("Enter"===e.key&&v)return e.preventDefault(),e.stopPropagation(),R(!1),D(),void requestAnimationFrame((()=>{K(e)}))}H(e,(()=>R(!1)),v)}},openPickerButton:{..."enter"===F?{onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),K(e))}}:{}},popper:{sx:{"& .MuiMultiSectionDigitalClockSection-root::after":{display:"unset"},"& .MuiList-padding":{padding:"10px"},"& .MuiMultiSectionDigitalClockSection-item":{padding:"4px"},"& .MuiMultiSectionDigitalClockSection-item.Mui-selected":{backgroundColor:j[900],borderRadius:"5px"},"& .MuiMultiSectionDigitalClockSection-item.Mui-selected:hover":{backgroundColor:j[900],borderRadius:"5px"},"& .Mui-selected:hover":{backgroundColor:j[900],borderRadius:"5px"},"& .MuiMultiSectionDigitalClockSection-item.Mui-selected:focus-visible":{backgroundColor:j[900],borderRadius:"5px"},"& .Mui-selected:focus-visible":{backgroundColor:j[900],borderRadius:"5px"}},onKeyDown:e=>{"enter"===F&&"Enter"===e.key&&v&&(e.preventDefault(),e.stopPropagation(),R(!1),D(),requestAnimationFrame((()=>{K(e)})))}}},onChange:e=>{if(e?.isValid){if(u)return J(e.toFormat(g)),void Z();if(m)return J(e.toUTC().toISO()),void Z();J(e.toUTC().toISOTime()),Z()}else J(e),Z()}})]})}function Gd({field:i,control:o,index:n}){const r=M(),{iron:l}=r.palette.app.color;return e(a,{direction:"row",component:"li",children:t(a,{direction:"row",alignItems:"center",border:"1px solid",flexGrow:1,borderColor:l[700],children:[e(Rl,{padding:{paddingLeft:"24px"},children:e(j,{sx:{flexGrow:1},children:i.headerName})}),e(Ud,{control:o,name:`columns.${n}.hide`})]})})}function Yd({column:i}){const o=M(),{lightBlue:n,iron:r}=o.palette.app.color;return e(a,{border:"1px solid",bgcolor:n[100],borderColor:r[700],children:e(Rl,{padding:{padding:"0px 24px"},children:t(a,{direction:"row",alignItems:"center",justifyContent:"space-between",minHeight:"38px",children:[e(j,{children:i.headerName}),e(Di,{htmlColor:r[800]})]})})})}function Vd({lockedColumns:o,fields:n,control:r}){return t(i,{children:[o.map((({field:t="fid",colId:i="cid",headerName:o})=>e(Yd,{column:{field:t,colId:i,headerName:o}},t??i))),e(a,{component:"ul",sx:{m:0,p:0},children:n.map(((t,i)=>e(Gd,{field:t,control:r,index:i},t.id)))})]})}function Td({columns:t,children:i}){const o=c((()=>t.filter((e=>!("hide"in e)))),[t]),n=c((()=>t.filter((e=>"hide"in e)).map((e=>({...e,hide:!e.hide})))),[t]),r=p(n),{control:l,reset:a,getValues:s,setValue:C}=$e({defaultValues:{columns:r.current}}),{fields:A}=et({name:"columns",control:l});return c((()=>{C("columns",n)}),[t]),i({reset:e=>{a({columns:e?Array.isArray(e)?e:[e]:r.current})},getValues:s,columnList:e(Vd,{fields:A,lockedColumns:o,control:l})})}function jd({columns:i,open:o,onClose:n,onSave:r,title:l="Column Chooser"}){const a=(e=>c((()=>e.filter((({field:e,colId:t})=>!!e||!!t)).map((({field:e,hide:t,headerName:i,colId:o})=>{const n={field:e??o,headerName:i};return null!=t&&(n.hide=t),n}))),[e]))(i);return e(Td,{columns:a,children:({columnList:i,reset:a,getValues:s})=>e(Ds,{title:l,open:o,onClose:()=>{n(),a()},maxWidth:"xs",actions:t(Ps,{sx:{justifyContent:"space-between",flex:1},children:[e(Jn,{variant:"outlined",onClick:()=>a(),children:"Reset"}),e(Jn,{onClick:()=>{const e=s(),t=Hi(e.columns.map((({field:e,colId:t,hide:i})=>[e??t,i])));r(t),n()},children:"Apply"})]}),children:i})})}const Wd=()=>e(Gi,{className:"bullet-hover",sx:{fontSize:"6px",borderRadius:"50%"}}),qd=({href:t="/",style:i,scroll:o=!1,...n})=>{const r=Vi(),l=Ti(),a=nn(t),{pathname:s,query:A}=a,d=c((()=>{if("string"!=typeof t)return{pathname:t??"/",query:void 0};if(r!==s)return a;const e=Array.from(l.entries()),i={...e.length?Object.fromEntries(e):void 0,...A};return{pathname:s,query:Object.keys(i).length?i:void 0}}),[r,l,t,s,A]);return e(C,{...n,prefetch:!1,scroll:o,style:{textDecoration:"none",outline:"none",...i},href:d})},zd=({selected:i=!1,icon:o=e(Wd,{}),title:n,endAdornment:r,sx:l,href:s,onClick:C,isShowEndAdornment:A=!1,preventRedirection:d=!1,onPreventRedirection:c,onMenuClick:h,...p})=>{const g=M(),{butterflyBlue:u,iron:m}=g.palette.app.color;return t(Yi,{...p,...A?{}:s?{component:qd,href:s}:{},onClick:e=>{h&&h(),(!s||A||d)&&(c?.(),C(),e.preventDefault())},sx:{padding:"9.5px 16px",...l,margin:"0",cursor:A?"default":"pointer",userSelect:"none",textDecoration:"none",fontSize:"13px",wordBreak:"break-word",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",flex:1,width:"100%",color:i?m[600]:g.palette.primary.light,":hover":{color:m[600],".bullet-hover":{color:i?"":u[900]}}},children:[t(a,{alignItems:"center",direction:"row",flex:1,gap:"10px",justifyContent:"center",children:[o,n&&e(Ji,{primary:n,disableTypography:!0,sx:{...l,padding:"0",textAlign:"left"}})]}),r]})},Od=({icon:t=e(Wd,{}),title:i,isShowEndAdornment:o=!1,selected:n=!1,onMouseEnter:r,href:l,onClick:a,onPreventRedirection:s,preventRedirection:C,onMenuClick:A})=>{const d=M(),{butterflyBlue:c,slate:h}=d.palette.app.color;return e(x,{component:"li",sx:{bgcolor:n&&!o?c[900]:"",padding:i?"0px":"2.5px 0",wordBreak:"break-word"},children:e(zd,{onClick:a,preventRedirection:C,onPreventRedirection:s,sx:{fontSize:"13px",padding:"9.5px 16px",":focus-visible":{border:`1px solid ${c[900]}`,backgroundColor:h[900]},margin:"0"},selected:n,title:i,icon:t,onMenuClick:A,onMouseEnter:r,href:l,isShowEndAdornment:o,endAdornment:o&&e(St,{sx:{fontSize:"16px"}})})})},Pd=({open:t,anchorEl:i,children:o,currentMenuIndex:n})=>{const r=M(),{mirage:l}=r.palette.app.color;return e(ae,{open:t,anchorEl:i,placement:"bottom-end",modifiers:[{name:"offset",options:{offset:[n?79:203,n?43.5*n+37:-40]}}],sx:{background:l[900],width:"203px",zIndex:1300,inset:n?"0px auto auto 0px !important":"1px 0px auto auto !important"},children:o})},Nd=({item:i,parentPath:o,currentPathMenuOpen:n,onCloseMenuPopover:r,level:l=0,onPreventRedirection:a,preventRedirection:s,onMenuClick:C})=>{const[A,d]=h(null),c=Boolean(A),{key:p,title:g,icon:u,menuItems:m,onClick:f,isView:E}=i;if(!1===E)return;const I=()=>{d(null)},k=Boolean(n[p]),S=`${o}/${p}`;return t(x,{onMouseLeave:I,children:[e(Od,{onClick:(e="_self")=>{f&&(f(`${o}/${p}`,e),"_blank"!==e&&(I(),r()))},onPreventRedirection:a,preventRedirection:s,title:g,icon:u,onMenuClick:C,isShowEndAdornment:Boolean(m?.length),selected:k,onMouseEnter:e=>{m?.length&&d(e.currentTarget)},href:S}),m?.length&&c&&e(Pd,{open:!0,anchorEl:A,currentMenuIndex:l,children:e(Ki,{disablePadding:!0,children:m.map((t=>e(Nd,{item:t,parentPath:S,currentPathMenuOpen:n[p]??{},onCloseMenuPopover:r,level:l+1},t.key)))})})]})},Xd=({currentPathMenuOpen:t,currentMenuItem:o,onCloseMenuPopover:n,preventRedirection:r=!1,onPreventRedirection:l,onMenuClick:a})=>o?e(Ki,{disablePadding:!0,children:o.menuItems?.filter((({isView:e})=>!1!==e)).map((i=>e(Nd,{item:i,onMenuClick:a,parentPath:`/${o.key}`,currentPathMenuOpen:t[o.key]??{},onCloseMenuPopover:n,preventRedirection:r,onPreventRedirection:l},i.key)))}):e(i,{children:"Loading..."}),_d=({menuItems:o,currentPathname:n,anchorEl:r,setAnchorEl:l,preventRedirection:a=!1,onPreventRedirection:s,onMenuClick:C})=>{const[A,d]=h(),[p,g]=h(0),[u,m]=h({});c((()=>{const e=xn(n);if(O(e))return m({home:!0});m(e)}),[n]);const f=()=>{l(null)};return t(i,{children:[o.filter((({isView:e})=>!1!==e)).map(((t,i)=>{const{onClick:o,key:n,icon:r,menuItems:A=[]}=t,c=""===n?"/":`/${n}`,h=!!u?.[n];return e(Od,{onClick:e=>{if(o){if(""===n)return void o("/",e);o(`/${n}`,e)}},onMenuClick:C,onMouseEnter:e=>{A?.length?(l(e.currentTarget),d(t),g(i+1)):f()},href:A.length?void 0:c,icon:r,onPreventRedirection:s,preventRedirection:a,selected:h},$t())})),!!r&&e(x,{onMouseLeave:f,children:e(Pd,{open:!0,anchorEl:r,currentMenuIndex:p,children:e(Xd,{currentMenuItem:A,currentPathMenuOpen:u,onCloseMenuPopover:f,preventRedirection:a,onPreventRedirection:s,onMenuClick:C})})})]})};J(x)((({theme:e})=>({width:7,height:7,borderRadius:"50%",background:e.palette.app.color.butterflyBlue[400]})));const $d=J(ji,{shouldForwardProp:e=>"open"!==e})((({theme:e,open:t})=>{const i=e=>({width:300,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden",backgroundColor:e.palette.app.color.mirage[900],[e.breakpoints.down("md")]:{width:"80px"}}),o=e=>({transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:"hidden",width:"0px",[e.breakpoints.up("md")]:{width:"80px"},backgroundColor:e.palette.app.color.mirage[900]});return{width:300,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",...t&&{...i(e),"& .MuiDrawer-paper":i(e)},...!t&&{...o(e),"& .MuiDrawer-paper":o(e)}}})),ec=({children:t,...i})=>e(Wi,{timeout:"auto",unmountOnExit:!0,...i,children:t}),tc=({icon:t=e(Wd,{}),title:i,isShowEndAdornment:o=!1,selected:n=!1,onClick:r,isExpanded:l,sx:a,preventRedirection:s=!1,href:C,onPreventRedirection:A,onMenuClick:d})=>{const c=M(),{butterflyBlue:h}=c.palette.app.color;return e(x,{sx:{bgcolor:n&&!o?h[900]:""},children:e(zd,{sx:a,title:i,icon:t,href:C,onClick:r,onMenuClick:d,selected:n,preventRedirection:s,onPreventRedirection:A,endAdornment:o&&e(l?qi:zi,{})})})},ic=(e,t)=>{if(0===t.length)return!1;if("object"!=typeof e)return!1;const[i,...o]=t;if(!i)return!1;const n=e[i];return 0===o.length?Boolean(n):ic(n,o)},oc=e=>!0===e||"object"==typeof e&&null!==e&&Object.values(e).every(oc),nc=({menuItem:i,level:o=0,parentPath:n="",subMenusOpen:r,setSubMenusOpen:l,currentPathMenuOpen:a,preventRedirection:s=!1,onPreventRedirection:C,onMenuClick:A})=>{const d=M();if(3===o)return;const{butterflyBlue:c,slate:h}=d.palette.app.color,{key:p,icon:g,title:u,isView:m,onClick:f,menuItems:E=[]}=i;if(!1===m)return;const I=n?`${n}/${p}`:p,k=I.split("/"),S=((e,t)=>{const i=ic(e,t);return Boolean(i)})(r,k),w=((e,t)=>{const i=t.reduce(((e,t)=>{if("object"==typeof e&&null!==e&&t in e)return e[t]}),e);return oc(i)})(a,k),B=""===p?"/":`/${I}`;return t(x,{children:[e(tc,{sx:{paddingLeft:3*o+1.5,fontSize:"13px",":focus-visible":{border:`1px solid ${c[900]}`,backgroundColor:h[900]}},onClick:e=>{if(E.length>0){if(w)return;l((e=>{const t={...e};let i=t;for(let e=0;e<k.length-1;e++){const t=k[e];t&&(i[t]="object"==typeof i[t]?i[t]:{},i=i[t])}const o=k[k.length-1];return o&&(i[o]=!S),t}))}else f&&!w&&f(B,e)},onMenuClick:A,href:0===E.length?B:"",icon:0===o?g:void 0,title:u,isShowEndAdornment:E.length>0&&o<2,selected:w,isExpanded:S,preventRedirection:s,onPreventRedirection:C}),E.length>0&&e(ec,{in:S,children:e(Ki,{component:"div",disablePadding:!0,children:E.map((t=>e(nc,{menuItem:t,level:o+1,parentPath:I,onMenuClick:A,subMenusOpen:r,setSubMenusOpen:l,currentPathMenuOpen:a,preventRedirection:s,onPreventRedirection:C},t.key)))})})]},p)},rc=({menuItems:t,currentPathname:i,preventRedirection:o=!1,onPreventRedirection:n,onMenuClick:r})=>{const[l,a]=h({}),[s,C]=h({});return g((()=>{const e=xn(i);if(O(e))return a({home:!0}),void C({home:!0});const t=JSON.parse(JSON.stringify(e)),o=JSON.parse(JSON.stringify(e));a(t),C(o)}),[i]),t.map((t=>e(nc,{menuItem:t,subMenusOpen:l,setSubMenusOpen:a,onMenuClick:r,currentPathMenuOpen:s,preventRedirection:o,onPreventRedirection:n},t.key)))},lc=({menuItems:i=[],open:o,currentPathname:n,preventRedirection:r=!1,onLogoClick:l,onPreventRedirection:a,onMenuClick:s,href:A,preventClick:d=!1,openLogoUrl:c,closedLogoUrl:p})=>{const[g,u]=h(null),m=()=>{u(null)},{layout:f}=en(),E="desktop"===f,I=E&&o,k=I?c:p,S=()=>k?e(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",px:I?2:1,width:"100%",boxSizing:"border-box"},children:e(cd,{mode:"view",variant:"auto",value:k,label:"",hideBorder:!0,size:I?"medium":"small",maxPreviewWidth:I?220:48,maxPreviewHeight:I?48:40})}):e(I?Tr:jr,{});return t($d,{variant:"permanent",open:o,children:[t(x,{textAlign:"center",sx:{cursor:A||l?"pointer":"default"},component:A?C:"div",onClick:()=>{l&&!d&&l()},href:A,children:[E&&e(Rl,{padding:{paddingTop:"1.5rem"},children:S()}),!E&&e(Rl,{padding:{paddingTop:"0.5rem",paddingBottom:"0.5rem"},children:S()})]}),E&&e(Ki,{component:"nav",onMouseLeave:m,children:o?e(rc,{menuItems:i,onMenuClick:s,currentPathname:n,preventRedirection:r,onPreventRedirection:a}):e(_d,{menuItems:i,currentPathname:n,anchorEl:g,onMenuClick:s,setAnchorEl:u,preventRedirection:r,onPreventRedirection:a})}),!E&&e(ie,{onClickAway:m,children:e(Ki,{component:"nav",onMouseLeave:m,children:e(_d,{menuItems:i,onMenuClick:s,currentPathname:n,anchorEl:g,setAnchorEl:u,preventRedirection:r,onPreventRedirection:a})})})]})},ac=e=>e?Array.isArray(e)?e:[e]:[],sc=e=>e.zIndex.drawer+200,Cc=({title:o,children:r,onClose:l,actions:s,headerSlot:C,isHideHeader:A=!1,isHideFooter:d=!1,isHideCloseIcon:c=!1,isHideDividers:h=!1,disableEscapeKeyDown:p=!1,anchor:g="right",sx:u,ModalProps:m,...f})=>{const E=!d&&!!s,I=ac(u),k=ac(m?.sx);return e(ji,{...f,anchor:g,onClose:l,sx:[e=>({zIndex:sc(e),"& .MuiBackdrop-root":{zIndex:sc(e)},"& .MuiDrawer-paper":{display:"flex",flexDirection:"column",zIndex:sc(e)}}),...I],ModalProps:{...m,disableEscapeKeyDown:p,sx:[e=>({zIndex:sc(e)}),...k]},children:t(a,{flex:1,sx:{overflow:"hidden"},children:[!A&&t(i,{children:[e(Rl,{padding:{padding:"10px"},children:t(a,{direction:"row",alignItems:"center",children:[e(x,{flex:1,children:C??e(j,{variant:"h6",fontWeight:500,children:o})}),!c&&e(n,{onClick:e=>l?.(e,"escapeKeyDown"),color:"secondary",size:"small","aria-label":"Close",onMouseDown:e=>e.preventDefault(),children:e(At,{fontSize:"medium"})})]})}),!h&&e(X,{})]}),e(x,{flex:1,sx:{overflowY:"auto",overflowX:"hidden"},children:r}),E&&t(i,{children:[!h&&e(X,{}),e(Rl,{padding:{padding:"10px"},children:s})]})]})})},Ac=({open:i=!1,anchorEl:o,onClose:r,children:l,onApply:s,showDivider:C=!1,title:A,required:d})=>{const c=M(),{slate:h}=c.palette.app.color,p=()=>{$(s)&&s(),$(r)&&r({},"backdropClick")};return t(Ae,{open:i,anchorEl:o,anchorOrigin:{vertical:"bottom",horizontal:"left"},onClose:()=>{p()},onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),p())},sx:{"& .MuiPaper-root":{minWidth:"300px"}},children:[C&&t(a,{alignItems:"flex-end",children:[e(Rl,{padding:{padding:"8px"},children:t(a,{direction:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:[t(a,{direction:"row",alignItems:"center",gap:"5px",children:[t(j,{variant:"h6",children:[A," "]}),d&&e(j,{variant:"h6",color:"error",children:"*"})]}),e(n,{onClick:p,children:e(vi,{})})]})}),e(X,{sx:{width:"100%"}})]}),e(x,{sx:{background:h[600],borderRadius:"5px"},children:l})]})},dc=({open:i,anchorEl:o,onClose:r,children:l,onApply:s,showDivider:C=!1,showFooter:A=!0,title:d,required:c,filterItem:p,reset:u,background:m=!1,currentFilterValue:f})=>{const E=M(),{slate:I}=E.palette.app.color,[k,S]=h(null),[w,B]=h(!0);g((()=>{if(i){if(!k&&f){const e=p?.multiSelect?io(f):f;S(e)}}else S(null);if(f&&k){const e=p?.multiSelect?JSON.stringify(io(f))!==JSON.stringify(k):f!==k;B(!e)}}),[i,f,k,p?.multiSelect]);const Q=()=>{S(null),$(u)&&u(),$(r)&&r({},"backdropClick")};return t(Ae,{open:i,anchorEl:o,anchorOrigin:{vertical:"bottom",horizontal:"left"},onClose:(e,t)=>{$(r)&&(r(e,t),Q())},sx:{"& .MuiPaper-root":{minWidth:"300px"}},children:[C&&t(a,{alignItems:"flex-end",children:[e(Rl,{padding:{padding:"8px"},children:t(a,{direction:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:[t(a,{direction:"row",alignItems:"center",gap:"5px",children:[e(j,{variant:"h6",children:d}),c&&e(j,{variant:"h6",color:"error",children:"*"})]}),e(n,{onClick:Q,children:e(Ye,{})})]})}),e(X,{sx:{width:"100%"}})]}),e(x,{sx:{background:m?I[600]:"transparent",borderRadius:"5px",maxWidth:"300px"},children:l}),A&&e(Rl,{padding:{padding:"10px"},children:e(x,{display:"flex",justifyContent:"flex-end",children:e(Jn,{onClick:()=>{S(null),$(s)&&s()},disabled:w,variant:"text",sx:{maxWidth:"40px"},children:"Apply"})})})]})};function cc({selectedFilter:t,control:i,errors:o,setIsPopupOpen:n,autoFocus:r=!1}){const l=M(),{sapphireBlue:a,black:s}=l.palette.app.color,C=o[t.key],{placeholder:A,label:d}=t,c=A??`Select ${d}`,h=A??d;return{autoComplete:t.options&&e(Zs,{disableClearable:!0,multiple:t.multiSelect??!1,placeholder:c,name:`${t.key}`,disabled:t.isDisabled,loading:t.loading,shouldCloseOnSelect:t.shouldCloseOnSelect,control:i,options:t.options??[],onOpen:()=>n?.(!0),onClose:()=>n?.(!1),autoFocus:r,sx:{maxHeight:"250px",overflowY:"auto",width:"100%","& .MuiAutocomplete-tag":{backgroundColor:a[300],color:s[900]}},...t.employeeAutocomplete&&{isShowEmployeeData:!0,isShowOptionsOnType:!0,getOptionLabel:e=>"string"==typeof e?e:`${e.label} (${e.employee_code}) - ${e.punch_code}`},error:!!C,helperText:C?.message},t.key),text:e(fd,{name:t.key,control:i,disabled:t.isDisabled,placeholder:h,error:!!C,helperText:C?.message,autoFocus:r}),date:e(sC,{name:t.key,control:i,disabled:t.isDisabled,error:!!C,helperText:C?.message,autoFocus:r,minDate:t.minDate?y.fromISO(t.minDate):void 0,maxDate:t.maxDate?y.fromISO(t.maxDate):void 0,...t.monthYearFormat&&{format:"MMM yyyy",views:["year","month"]}}),dateRange:e(gC,{name:t.key,control:i,disabled:t.isDisabled,error:!!C,helperText:C?.message})}}const hc=({open:i,anchorEl:o,filterItem:n,onClose:r,control:l,errors:s,onApply:C,currentFilterValue:A,reset:d})=>e(dc,{title:n.label,required:n.required,filterItem:n,open:i,onClose:r,anchorEl:o,onApply:C,currentFilterValue:A,reset:d,showFooter:!0,showDivider:!0,background:!0,children:t(Rl,{padding:{padding:"10px"},children:[cc({selectedFilter:n,control:l,errors:s})[n.type],"switch"===n.type&&t(a,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{padding:"10px 5px 10px 20px",margin:"auto"},children:[e(j,{variant:"body2",children:n.label}),e(Ud,{control:l,name:n.key})]},n.key)]})}),pc=({open:t,anchorEl:i,filterItem:o,onClose:n,control:r,errors:l,onApply:a})=>e(Ac,{title:o.label,required:o.required,open:t,onClose:n,anchorEl:i,onApply:a,showDivider:!0,background:!0,children:e(Rl,{padding:{padding:"10px"},children:cc({selectedFilter:o,control:r,errors:l})[o.type]})}),gc=(e,t)=>{let i=e;if(t&&"autoComplete"===t.type&&(i=t.multiSelect&&Array.isArray(e)?t.options?.filter((t=>e.includes(t.value))).map((e=>e.label)).join(", "):t.options?.filter((t=>t.value===e)).map((e=>e.label)).join(", ")),"dateRange"===t.type&&Array.isArray(e)&&2===e.length){i=`${e[0]} <= Start Date <= ${e[1]}`}return i};function uc(e,t){return Object.fromEntries(Object.entries(e).flatMap((([e,i])=>{if(i){const o=t.find((t=>t.key===e)),n=o?.monthYearFormat&&"string"==typeof i?y.fromISO(i).toFormat("yyyy-MM"):i;return[[e,n]]}return[]})))}const mc=({filterListItems:o,isDisabled:r=!1,filterListData:l,onApply:s,onClear:C,onChange:A})=>{const d=M(),{iron:u,slate:m}=d.palette.app.color,{layout:f}=en(),E="desktop"===f,I="mobile"===f,[k,S]=h(null),w=p(null),B=p(null),[Q,J]=h(!1),[b,v]=h(!1),[R,L]=h(null),F=p(null),[U,Z]=h(!1),D=c((()=>o.reduce(((e,{key:t,multiSelect:i,options:o,required:n,type:r,value:l,isDefaultCurrentDate:a})=>(e[t]="autoComplete"===r&&n&&1===o?.length?i?[o[0]?.value]:o[0]?.value:i||"dateRange"===r?l||null:"switch"===r?l||!1:a&&"date"===r?l||y.now().toISODate():l||null,e)),{})),[l]),H=to.object((()=>{const e={};return o.forEach((t=>{t.multiSelect||"dateRange"===t.type?e[t.key]=to.array(to.string()).nullable().optional():"switch"===t.type?e[t.key]=to.boolean().nullable().optional():e[t.key]=to.string().nullable().optional()})),e})()).superRefine(((e,t)=>{o.forEach((i=>{i.required&&!e[i.key]?.length&&t.addIssue({path:[i.key],message:`${i.label} is required`,code:to.ZodIssueCode.custom})}))})),{control:K,handleSubmit:G,setValue:Y,reset:V,getValues:T,formState:{errors:W,dirtyFields:q},watch:z}=$e({values:D,resolver:Oi(H),mode:"all"});c((()=>{o&&0!==o.length&&o.forEach((({key:e,multiSelect:t,options:i,required:o})=>{if(o&&1===i?.length){T(e)||Y(e,t?[i[0]?.value]:i[0]?.value)}}))}),[o]);const P=z("company_id"),N=z("business_unit_id"),_=z("department_id"),$=()=>{S(null)},ee=()=>{ae((()=>{const e=new Set;return o.forEach((({type:t,key:i,required:o},n)=>{"switch"!==t&&(n===re||D?.[i]||o)&&e.add(i)})),e}))},te=()=>{V(),C(),ee(),$()},ie=e=>{const t=e instanceof HTMLElement?e:e.currentTarget;S(t)},oe=e=>{J(!1),L(null);const t=eo(uc(e,o),(e=>$i(e)||O(e)));ae((()=>{const e=new Set;return o.forEach((({type:i,key:o,required:n},r)=>{"switch"!==i&&(r===re||t[o]||n)&&e.add(o)})),e})),s(t,Q,R?.key),$()},ne=e=>o.find((t=>t.key===e)),re=o.findIndex((({type:e})=>"switch"!==e&&"dateRange"!==e)),[le,ae]=h((()=>{const e=new Set;return o.forEach((({type:t,key:i,required:o},n)=>{"switch"!==t&&(n===re||l?.[i]||D?.[i]||o)&&e.add(i)})),e})),se=tt({control:K}),Ce=R?.key?"switch"===R.key?z(R.key)?"true":"false":z(R.key):null;g((()=>{A(se,Q)}),[se,A]),g((()=>{V(D)}),[D,V]),g((()=>{ae((e=>{const t=new Set;return o.forEach((({type:i,key:o,required:n},r)=>{"switch"!==i&&(r===re||l?.[o]||D?.[o]||n||e.has(o))&&t.add(o)})),t}))}),[o,l,D,re]),g((()=>{P===l?.company_id||Q||(o.forEach((e=>{e.isDefaultCurrentDate&&"date"===e.type||Y(`${e.key}`,null)})),Y("company_id",P))}),[P]),g((()=>{_i(N,l?.business_unit_id)||Q||Y("business_unit_location_id",null)}),[N]),g((()=>{_i(_,l?.department_id)||Q||Y("sub_department_id",null)}),[_]);const Ae=Boolean(k),de=c((()=>0===Object.keys(q).length&&Object.keys(se).every((e=>$i(se[e])||O(se[e])))),[se,q]);return tn({key:"f",modifierKeys:["ctrl","shift"],onTrigger:()=>{if(r)return;const e=F.current??document.createElement("button");ie(e)}}),t(x,{sx:{flexGrow:1},children:[t(a,{direction:"row",justifyContent:{xs:"end",md:"space-between"},spacing:1,children:[E&&e(a,{direction:"row",alignItems:"center",sx:{maxWidth:{xs:"40vw",md:"45vw",lg:"57vw"}},children:l&&Object.values(l).some((e=>e))&&t(i,{children:[e(j,{variant:"body1",sx:{minWidth:"50px",marginRight:"5px"},children:"Filters:"}),e(a,{direction:"row",gap:"5px",alignItems:"center",sx:{flexWrap:"wrap",maxWidth:"100%"},children:(ce=l,Object.entries(ce).map((([t,i])=>{if("boolean"!=typeof i&&!i)return;const n=ne(t),a=o[(e=>o.findIndex((t=>t.key===e)))(t)],C=n&&gc(i,n),A=function(e){return Array.isArray(e)?e.join(", "):rn.test(e)?y.fromFormat(e,"yyyy-MM").toFormat("MMM yyyy"):ln.test(e)?y.fromFormat(e,"yyyy-MM-dd").toFormat("dd-MM-yyyy"):e}("object"==typeof C?JSON.stringify(C):String(C));return"boolean"==typeof i||A?e(Cs,{label:e(cl,{toolTipLabel:`${A}`,children:e(j,{noWrap:!0,variant:"subtitle2",children:`${n?.label}: ${A}`})}),onDelete:()=>(e=>{const t=ne(e);if(t?.required)return Is.error({title:"This is a required custom filter field and cannot be removed."});Y(`${e}`,null);const i={...l};delete i[e],s(i,!0,e)})(t),onClick:e=>{((e,t)=>{if("company_id"===e&&o?.some((({required:e})=>e)))return;J(!0),w.current=t.currentTarget;const i=ne(e);i&&L(i)})(t,e)},disabled:r,shouldDisableFocus:a?.shouldDisableFocus??!1,shouldDisableRipple:a?.shouldDisableRipple??!1},t):void 0})))})]})}),t(a,{direction:"row",alignItems:"flex-start",children:[l&&Object.values(l).some((e=>e))&&e(Jn,{onClick:()=>te(),variant:"text",sx:{minWidth:{xs:"60px",sm:"100px"}},children:I?"Clear":"Clear Filter"}),!r&&e(Sl,{isFiltered:!O(l),onClick:ie,ref:F})]})]}),e("form",{onSubmit:e=>{e.preventDefault(),de||G((e=>{oe(e)}))()},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),U||de||G((e=>{oe(e)}))())},children:t(ji,{open:Ae,onClose:(e,t)=>{"backdropClick"!==t&&$()},anchor:"right",sx:{zIndex:d.zIndex.drawer+2,"& .MuiPaper-root":{width:"100%",maxWidth:{xs:"270px",sm:"350px"}}},children:[t(a,{sx:{background:u[600]},children:[e(Rl,{padding:{padding:"10px 30px"},children:t(a,{direction:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:[e(j,{variant:"h6",children:"Filter"}),e(n,{onClick:()=>{V(),ee(),$()},children:e(Ye,{})})]})}),e(X,{sx:{width:"100%"}})]}),e(a,{flexGrow:1,sx:{overflowX:"hidden"},children:o.map(((i,o)=>{const{type:n,key:r,label:l,required:s,isDisabled:C,menuInfo:A}=i;return"switch"===n?t(a,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"80%",sx:{padding:"10px 5px 10px 20px ",margin:"auto"},children:[e(j,{variant:"body2",children:l}),e(Ud,{control:K,name:r})]},r):t(Pi,{expanded:le.has(r),onChange:(d=r,(e,t)=>{ae((e=>{const i=new Set(e);return t?i.add(d):i.delete(d),i}))}),disabled:C,sx:{boxShadow:"none","&.MuiAccordion-root.Mui-expanded":{margin:"0 !important"},"&.MuiAccordion-root.Mui-disabled":{backgroundColor:"transparent"}},children:[e(Xi,{expandIcon:e(zi,{}),"aria-controls":"panel1a-content",id:"panel1a-header",sx:{flexDirection:"row-reverse","& MuiAccordionSummary-root.Mui-expanded":{marginRight:"10px",transform:"rotate(-90deg)"},"&.Mui-expanded":{minHeight:"40px",paddingY:"5px"},"& .MuiAccordionSummary-content.Mui-expanded":{margin:"0px"}},children:t(a,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"90%",children:[t(a,{direction:"row",alignItems:"center",gap:"5px",children:[e(j,{variant:"body2",children:l}),s&&e(j,{color:"error",children:"*"})]}),e(j,{variant:"body2",children:A})]})}),e(Ni,{sx:{background:m[600],borderRadius:"5px",padding:"0px"},children:e(Rl,{padding:{paddingLeft:"15px",paddingY:"5px",paddingRight:"15px"},children:"dateRange"===n?t(a,{direction:"row",alignItems:"center",gap:"10px",onClick:e=>{(e=>{L(e),v(!0)})(i),B.current=e.currentTarget},children:[e(x,{sx:{border:"1px solid black",borderRadius:"5px",width:"150px",p:1},children:e(j,{variant:"body2",children:Array.isArray(z(r))&&z(r)[0]?y.fromISO(z(r)[0]).toFormat(rC.dateWithEuropean):"Start Date"})}),e(j,{children:"~"}),e(x,{sx:{border:"1px solid black",borderRadius:"5px",width:"150px",p:1},children:e(j,{variant:"body2",children:Array.isArray(z(r))&&z(r)[1]?y.fromISO(z(r)[1]).toFormat(rC.dateWithEuropean):"End Date"})})]}):e(x,{children:cc({selectedFilter:i,control:K,errors:W,setIsPopupOpen:Z,autoFocus:o===re})[n]})})})]},r);var d}))}),e(X,{}),e(a,{children:e(Rl,{padding:{padding:"10px"},children:t(Ps,{children:[e(Jn,{type:"submit",disabled:de,variant:"contained",onClick:()=>{G(oe)()},children:"Apply"}),e(Jn,{type:"button",onClick:()=>te(),disabled:Object.keys(se).every((e=>!se[e])),variant:"outlined",children:"Reset"})]})})})]})}),R&&e(hc,{open:Q,onClose:()=>{R?.key&&Y(`${R?.key}`,l?.[R.key]),J(!1)},onApply:()=>{G(oe)()},control:K,errors:W,reset:V,anchorEl:w.current,filterItem:R,currentFilterValue:Ce}),R&&e(pc,{open:b,onClose:()=>{R?.key&&Y(`${R?.key}`,l?.[R.key]),v(!1)},onApply:()=>{v(!1)},control:K,errors:W,anchorEl:B.current,filterItem:R})]});var ce},fc=({filter:i,control:o})=>{return e(ne,{children:(n=i.type,t(a,{direction:"row",width:"100%",justifyContent:"space-between",alignItems:"center",children:[e(j,{variant:"body2",children:i.label}),"switch"===n?e(Ud,{control:o,name:i.key}):e(j,{variant:"body2",children:i.menuInfo})]}))});var n},Ec=({filterListItems:i})=>{const[o,r]=h(null),l=p(null),[s,C]=h(!1),[A,d]=h(),[c,g]=h(null),{control:u,handleSubmit:m,setValue:f,reset:E,formState:{errors:I},watch:k}=$e(),S=()=>{r(null)},w=e=>{C(!1),g(null),S();const t=uc(e,i);d(t)},B=e=>{C(!0),r(null),g(e)},Q=e=>i.find((t=>t.key===e)),M=c?.key?k(c.key):null,J=Boolean(o);return t(a,{children:[t(a,{direction:"row",spacing:1,alignItems:"center",children:[A&&(b=A,Object.entries(b).map((([t,i])=>{if(!i)return;const o=Q(t),n=o&&gc(i,o);return e(as,{ref:l,label:e(cl,{toolTipLabel:`${n}`,children:`${o?.label}: ${n}`}),onDelete:()=>(e=>{f(`${e}`,null),d((t=>{const i={...t};return delete i[e],i}))})(t),onClick:e=>{C(!0),l.current=e.currentTarget;const i=Q(t);i&&(g(i),B(i))}},t)}))),e(n,{ref:l,onClick:e=>{r(e.currentTarget)},sx:{height:"40px"},children:e(Mr,{})}),e(Jn,{onClick:()=>(E(),void d(void 0)),variant:"text",children:"Clear Filter"})]}),e(dc,{open:J,anchorEl:o,onClose:S,onApply:()=>{m(w)()},children:i.map((t=>e(x,{onClick:()=>"switch"!==t.type&&B(t),children:e(fc,{filter:t,control:u})},t.key)))}),c&&"switch"!==c.type&&e(hc,{open:s,onClose:()=>{C(!1)},onApply:()=>{m(w)()},control:u,currentFilterValue:M,anchorEl:l.current,filterItem:c,errors:I})]});var b},Ic=({text:t,highlightWords:i})=>{const o=M(),{slate:n}=o.palette.app.color;if(!i?.length)return e(x,{component:"span",children:t});const r=i.map((e=>e.replace(cn,"\\$&"))),l=new RegExp(`(${r.join("|")})`,"gi"),a=t.split(l);return e(x,{component:"span",children:a.map(((t,i)=>l.test(t)?e(x,{component:"span",sx:{padding:"2px 4px",backgroundColor:n[800],border:`1px solid ${n[700]}`,borderRadius:"5px",fontFamily:"monospace",fontSize:"0.9em"},children:t},`highlight-${i}-${t}`):e(x,{component:"span",children:t},`text-${i}-${t}`)))})},kc=({label:i,variant:o,colourCode:n})=>t(a,{gap:"10px",direction:"row",alignItems:"center",children:[e(Yr,{variant:o,colourCode:n}),i]}),Sc=({color:i,label:o,isBackground:n=!1})=>e(x,{sx:{backgroundColor:`${n?R(i,.2):""}`,width:"max-content",borderRadius:"6px"},children:e(Rl,{padding:{padding:n?"5px 8px":"0"},children:t(a,{flexDirection:"row",alignItems:"center",gap:"8px",children:[e(Gi,{sx:{color:i,fontSize:"12px"}}),e(j,{variant:"body2",sx:{fontWeight:500},children:o})]})})}),wc=({count:t,page:i,onPageChange:o,rowsPerPage:n,onRowsPerPageChange:r,sx:l,...a})=>{const s=M(),{grey:C}=s.palette,{layout:A}=en(),d="mobile"===A;return e(oo,{sx:{"& .MuiInputBase-root":{height:"30px"},"& .MuiToolbar-root":{paddingLeft:0},"& .MuiTablePagination-select":{backgroundColor:"transparent !important"},"& .MuiTablePagination-input":{border:`1.5px solid ${C[400]}`,borderRadius:"5px",fontSize:"13px",padding:d?"2px 10px":"4px 8px"},...l},component:"div",count:t,page:i,onPageChange:o,rowsPerPage:n,onRowsPerPageChange:r,rowsPerPageOptions:[20,50,100,200],defaultValue:100,labelRowsPerPage:d?"":"Rows per page",...a})},Bc=({items:i,disabled:o,sx:n})=>{const[r,l]=h(null);return t(x,{sx:{width:"100%",...n},children:[e(El,{onClick:e=>{l(e.currentTarget)},disabled:o}),!!r&&e(yl,{open:!0,anchorEl:r,onClose:()=>{l(null)},children:e(Rl,{padding:{padding:"2px"},children:i.map((t=>e(x,{children:e(ne,{sx:{width:"100%",textAlign:"start"},onClick:()=>{t?.onClick(),l(null)},children:e(j,{variant:"body1",children:t.title})})},t.title)))})})]})},xc="smart-grid-field-input",Qc=e=>({...e,wrapperMinHeight:e.controlMinHeight+2*e.paddingY}),Mc={sm:Qc({controlMinHeight:18,paddingY:2,padding:"2px 6px",autocompletePadding:"2px 2px 2px 6px",fontSize:"12px",borderRadius:"4px",expandIconSize:18,expandMarginLeft:"2px",multipleGap:"2px",chipFontSize:"11px",chipPadding:"1px 6px"}),md:Qc({controlMinHeight:20,paddingY:4,padding:"4px 8px",autocompletePadding:"4px 4px 4px 8px",fontSize:"13px",borderRadius:"4px",expandIconSize:20,expandMarginLeft:"4px",multipleGap:"4px",chipFontSize:"12px",chipPadding:"2px 8px"}),lg:Qc({controlMinHeight:22,paddingY:6,padding:"6px 10px",autocompletePadding:"6px 6px 6px 10px",fontSize:"15px",borderRadius:"6px",expandIconSize:22,expandMarginLeft:"6px",multipleGap:"4px",chipFontSize:"13px",chipPadding:"3px 10px"})},Jc=(e="md")=>Mc[e],bc=e=>e[800],vc=(e,t)=>t?e[800]:e[400],Rc=e=>`\n .${xc}::placeholder {\n color: ${e};\n opacity: 1;\n }\n .${xc}:disabled {\n color: ${e};\n -webkit-text-fill-color: ${e};\n }\n`,Lc=(e,t="md")=>{const{controlMinHeight:i,fontSize:o}=Jc(t);return{width:"100%",border:"none",background:"transparent",padding:0,margin:0,fontSize:o,lineHeight:`${i}px`,minHeight:i,outline:"none",color:e}},yc=(e="md",t="text")=>{const{borderRadius:i,autocompletePadding:o,padding:n,wrapperMinHeight:r}=Jc(e);return{alignItems:"center",borderRadius:i,padding:"autocomplete"===t?o:n,minHeight:r,boxSizing:"border-box"}},Fc=({wrapper:i,title:o,position:n})=>{const r=z(),{iron:l}=r.palette.app.color,a=i.getBoundingClientRect(),s={position:"fixed",zIndex:999999,background:l[200],color:l[600],padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",whiteSpace:"nowrap",transition:"opacity 0.2s ease, transform 0.2s ease",opacity:1},C={position:"absolute",width:0,height:0,borderStyle:"solid"};switch(n){case"top":s.top=a.top-28,s.left=a.left+a.width/2,s.transform="translateX(-50%)",Object.assign(C,{borderWidth:"6px 6px 0 6px",borderColor:`${l[200]} transparent transparent transparent`,bottom:-6,left:"50%",transform:"translateX(-50%)"});break;case"bottom":s.top=a.bottom+4,s.left=a.left+a.width/2,s.transform="translateX(-50%)",Object.assign(C,{borderWidth:"0 6px 6px 6px",borderColor:`transparent transparent ${l[200]} transparent`,top:-6,left:"50%",transform:"translateX(-50%)"});break;case"left":s.top=a.top+a.height/2,s.left=a.left-8,s.transform="translateY(-50%)",Object.assign(C,{borderWidth:"6px 0 6px 6px",borderColor:`transparent transparent transparent ${l[200]}`,right:-6,top:"50%",transform:"translateY(-50%)"});break;case"right":s.top=a.top+a.height/2,s.left=a.right+8,s.transform="translateY(-50%)",Object.assign(C,{borderWidth:"6px 6px 6px 0",borderColor:`transparent ${l[200]} transparent transparent`,left:-6,top:"50%",transform:"translateY(-50%)"})}return t("div",{style:s,children:[o,e("div",{style:C})]})},Uc=({children:o,title:n,position:r="top",delay:l=50})=>{const[a,s]=h(!1),C=p(null),A=p(null);g((()=>()=>{A.current&&clearTimeout(A.current)}),[]);const d=a&&n&&C.current?lo(e(Fc,{wrapper:C.current,title:n,position:r}),document.body):null;return t(i,{children:[e("div",{ref:C,style:{display:"inline-block",width:"100%"},onMouseEnter:()=>{A.current&&clearTimeout(A.current),A.current=setTimeout((()=>s(!0)),l)},onMouseLeave:()=>{A.current&&clearTimeout(A.current),s(!1)},children:o}),d]})},Zc={display:"flex",flexDirection:"column",gap:"4px",width:"100%"},Dc={width:"100%"},Hc=E((({errorMessage:i,size:o="md",currencySymbol:n,decimalCharacter:r,digitGroupSeparator:l,decimalPlaces:a,decimalPlacesShownOnBlur:s,decimalPlacesShownOnFocus:C,minimumValue:A,maximumValue:d,outputFormat:p="number",textAlign:g,allowNegative:m,suffix:f,preDefined:E,navigationKey:I,disabled:k,name:S,value:w,onChange:B,onBlur:x,onFocus:Q,onKeyDown:J,placeholder:b="",style:v,className:R},L)=>{const y=M(),{butterflyBlue:F,iron:U,lipstickRed:Z}=y.palette.app.color,{navigationKey:D}=Ro(),H=I??D,[K,G]=h(!1),[Y,V]=h(""),{handleEnterNavigation:T,setInputRef:j}=$o({navigationKey:H}),W=c((()=>{const e=E??{},{currencySymbol:t,decimalCharacter:i,digitGroupSeparator:o,decimalPlaces:A,decimalPlacesShownOnBlur:d,decimalPlacesShownOnFocus:c,suffix:h,textAlign:p,allowNegative:u}=e;return{currencySymbol:n??t??"",decimalCharacter:r??i??".",digitGroupSeparator:l??o??",",decimalPlaces:a??A??2,decimalPlacesShownOnBlur:s??d,decimalPlacesShownOnFocus:C??c,suffix:f??h,textAlign:g??p??"right",allowNegative:m??u??!1}}),[m,n,r,a,s,C,l,E,f,g]),{currencySymbol:q,decimalCharacter:z,digitGroupSeparator:O,decimalPlaces:P,decimalPlacesShownOnBlur:N,decimalPlacesShownOnFocus:X,suffix:_,textAlign:$,allowNegative:ee}=W,te=c((()=>null!=A?Number(A):ee?void 0:0),[A,ee]),ie=c((()=>null!=d?Number(d):void 0),[d]),oe=K?X:N??P,ne=c((()=>K?Y:null==w||""===w?"":String(w)),[Y,K,w]),re=c((()=>i?Z[900]:K?F[900]:U[800]),[F,i,U,K,Z]),le=bc(U),ae=vc(U,k),{fontSize:se}=Jc(o),Ce=c((()=>Rc(le)),[le]),Ae=c((()=>yc(o,"text")),[o]),de=c((()=>({...Lc(ae,o),textAlign:$,flex:1,minWidth:0,...v})),[ae,$,o,v]),ce=c((()=>({display:"flex",alignItems:"center",border:`2px solid ${re}`,background:U[600],width:"100%",...Ae})),[re,U,Ae]),he=c((()=>({flexShrink:0,fontSize:se,color:k?U[800]:U[400],marginRight:"4px",userSelect:"none"})),[se,k,U]),pe=c((()=>[xc,R].filter(Boolean).join(" ")),[R]),ge=c((()=>!1!==O&&O),[O]),ue=u((e=>{j(e),"function"==typeof L?L(e):L&&(L.current=e)}),[L,j]),me=u((e=>{B?.({target:{name:S,value:e??""}})}),[S,B]),fe=u(((e,t)=>{const i=e.value;V(i),"prop"!==t?.source&&me(""!==i?"string"!==p?No(i):i:null)}),[me,p]),Ee=u((e=>{e.stopPropagation(),G(!0),V(null==w||""===w?"":String(w)),Q?.(e)}),[Q,w]),Ie=u((e=>{e.stopPropagation(),G(!1),x?.(e)}),[x]),ke=u((e=>{"enter"!==H||"Enter"!==e.key||e.ctrlKey||e.metaKey||e.altKey||T(e),J?.(e)}),[T,H,J]),Se=u((e=>{const{floatValue:t,value:i}=e;return!(!ee&&i.includes("-"))&&(null==t||!(!ee&&t<0)&&((null==te||Number.isNaN(te)||t>=te)&&(null==ie||Number.isNaN(ie)||t<=ie)))}),[ee,ie,te]),we=u((e=>{e.stopPropagation()}),[]);return t(Uc,{title:i??"",position:"top",delay:50,children:[e("style",{children:Ce}),e(no.Root,{disabled:k,name:S,style:Dc,children:e("div",{style:Zc,children:t("div",{style:ce,children:[q?e("span",{style:he,children:q}):null,e(Yt,{customInput:ro,value:ne,valueIsNumericString:!0,thousandSeparator:ge,decimalSeparator:z,decimalScale:oe,fixedDecimalScale:!K,allowNegative:ee,suffix:_,isAllowed:Se,disabled:k,name:S,placeholder:b,className:pe,style:de,onValueChange:fe,onFocus:Ee,onBlur:Ie,onKeyDown:ke,onClick:we,inputMode:"decimal",getInputRef:ue})]})})})]})}));Hc.displayName="SmartCurrencyFieldComponent";const Kc=w(Hc,((e,t)=>e.name===t.name&&e.value===t.value&&e.disabled===t.disabled&&e.size===t.size&&e.errorMessage===t.errorMessage&&e.placeholder===t.placeholder&&e.currencySymbol===t.currencySymbol&&e.decimalPlaces===t.decimalPlaces&&e.decimalPlacesShownOnBlur===t.decimalPlacesShownOnBlur&&e.decimalPlacesShownOnFocus===t.decimalPlacesShownOnFocus&&e.allowNegative===t.allowNegative&&e.minimumValue===t.minimumValue&&e.maximumValue===t.maximumValue&&e.digitGroupSeparator===t.digitGroupSeparator&&e.onChange===t.onChange&&e.onBlur===t.onBlur));Kc.displayName="SmartCurrencyField";const Gc=E((function({columns:o,optionsData:n,searchedByColumn:r,labelKey:l,valueKey:a="id",errorMessage:s,loading:C=!1,height:A="400px",dialogSize:d="lg",dialogTitle:g,size:m="md",placeholder:f="",onRowSelect:E,disabled:I,name:k,value:S,onChange:w,onBlur:B,onKeyDown:x,...Q},M){const J=z(),{butterflyBlue:b,iron:v,lipstickRed:R}=J.palette.app.color,{navigationKey:L}=Ro(),[y,F]=h(!1),[U,Z]=h(!1),D=p(null),H=p(null),K=p(null),G=p(null),{handleEnterNavigation:Y}=$o({navigationKey:L}),V=c((()=>null==S||""===S?"":String(S)),[S]),T=c((()=>{if(!V)return"";const e=n.find((e=>String(e[a])===V));return e?String(e[l]):""}),[l,n,V,a]),j=c((()=>n.map((e=>({label:String(e[l]),value:String(e[a])})))),[l,n,a]),W=c((()=>y||U?b[900]:s?R[900]:v[800]),[b,s,v,U,y,R]),q=bc(v),O=vc(v,I),P=c((()=>yc(m,"autocomplete")),[m]),{expandMarginLeft:N,expandIconSize:X}=c((()=>Jc(m)),[m]),_=c((()=>Rc(q)),[q]),$=c((()=>({...Lc(O,m),flex:1,minWidth:0,cursor:I?"default":"pointer"})),[I,O,m]),ee=u((e=>{K.current=e,"function"==typeof M?M(e):M&&(M.current=e)}),[M]),te=u((e=>{const t=K.current;t&&(t.value=e),w?.({target:{name:k,value:e}})}),[k,w]),ie=u((()=>{te(""),E?.(null)}),[te,E]),oe=u((()=>{H.current&&(H.current(),H.current=null),Z(!1),F(!1),G.current?.focus()}),[]),ne=u((()=>{I||(Z(!0),setTimeout((()=>{const e=D.current?.getTable(),t=document.querySelectorAll(".MuiDialog-root table thead input[type='text']"),i=e?.getAllColumns(),o=i?.findIndex((e=>e.id==r));if(void 0!==o&&o>=0&&t[o]){const e=t[o];e.focus();const i=e=>{const t=e;if("ArrowDown"===t.key){t.preventDefault();const e=document.querySelector(".MuiDialog-root table tbody tr");e&&(e.setAttribute("tabindex","0"),e.focus())}};e.addEventListener("keydown",i),H.current=()=>{e.removeEventListener("keydown",i)}}}),100))}),[I,r]),re=u((({id:e})=>{const t=n.find((t=>String(t[a])===String(e)));if(!t)return;const i=String(t[a]);te(i),E?.(t),oe()}),[te,oe,E,n,a]),le=u((e=>"Backspace"===e.key&&V?(e.preventDefault(),void ie()):"enter"!==L||"Enter"!==e.key||U||e.ctrlKey||e.metaKey||e.altKey?"Enter"!==e.key&&" "!==e.key&&"ArrowDown"!==e.key||U||I?void x?.(e):(e.preventDefault(),void ne()):void Y(e)),[ie,I,ne,Y,U,L,x,V]),ae=u((e=>{e.preventDefault(),e.stopPropagation(),I||(U?oe():(F(!0),ne()))}),[I,oe,ne,U]),se=u((e=>{e.stopPropagation(),I||U||ne()}),[I,ne,U]),Ce=u((e=>{e.stopPropagation(),F(!0)}),[]),Ae=u((e=>{e.stopPropagation(),F(!1),B?.(e)}),[B]),de=f||"Click to select";return t(i,{children:[t(Uc,{title:s??"",position:"top",delay:50,children:[e("style",{children:_}),e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%"},children:t("div",{style:{display:"flex",alignItems:"center",border:`2px solid ${W}`,background:v[600],position:"relative",width:"100%",...P},children:[e("input",{ref:G,readOnly:!0,disabled:I,value:T,placeholder:de,className:xc,onClick:se,onFocus:Ce,onBlur:Ae,onKeyDown:le,style:$}),e("button",{type:"button",tabIndex:-1,"aria-label":U?"Close dialog":"Open dialog",disabled:I,onMouseDown:e=>{e.preventDefault()},onClick:ae,style:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"none",background:"transparent",padding:0,marginLeft:N,cursor:I?"not-allowed":"pointer",color:I?v[800]:v[400]},children:e(Me,{sx:{fontSize:X,transform:U?"rotate(180deg)":"none",transition:"transform 0.2s ease"}})}),e("select",{...Q,ref:ee,name:k,value:V,disabled:I,tabIndex:-1,"aria-hidden":!0,style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0,pointerEvents:"none"},children:0===j.length?e("option",{value:"",disabled:!0,children:"No Options"}):t(i,{children:[e("option",{value:"",children:"Select Option"}),j.map((t=>e("option",{value:t.value,children:t.label},t.value)))]})})]})})]}),e(Ds,{open:U,onClose:oe,maxWidth:d,title:g??"Select Option",children:e(ht,{ref:D,columns:o,data:n,height:A,loading:C,totalCount:n.length,onRowActivate:re,focusableRowNavigation:!0})})]})}));Object.assign(Gc,{displayName:"SmartDialogSelectComponent"});const Yc=w(Gc,(({name:e,value:t,disabled:i,optionsData:o,columns:n,errorMessage:r,loading:l,placeholder:a,size:s,labelKey:C,valueKey:A,searchedByColumn:d},{name:c,value:h,disabled:p,optionsData:g,columns:u,errorMessage:m,loading:f,placeholder:E,size:I,labelKey:k,valueKey:S,searchedByColumn:w})=>e===c&&t===h&&i===p&&o===g&&n===u&&r===m&&l===f&&a===E&&s===I&&C===k&&A===S&&d===w));Object.assign(Yc,{displayName:"SmartDialogSelect"});const Vc=E((({errorMessage:o,options:n,onBlur:r,onKeyDown:l,...a},s)=>{const C=z(),{butterflyBlue:A,lipstickRed:d,iron:p}=C.palette.app.color,[g,u]=h(!1),{navigationKey:m}=Ro(),{handleEnterNavigation:f}=$o({navigationKey:m}),E=c((()=>g?A[900]:o?d[900]:g?A[900]:p[800]),[o,g]);return e(Uc,{title:o??"",position:"top",delay:50,children:e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%"},children:e("div",{style:{display:"flex",alignItems:"center",border:`2px solid ${E}`,borderRadius:"4px",padding:"4px 8px",background:"white",minHeight:"20px"},children:e("select",{ref:s,...a,style:{width:"100%",border:"none",background:"transparent",padding:"0",fontSize:"13px",outline:"none",cursor:"pointer"},onClick:e=>e.stopPropagation(),onFocus:e=>{e.stopPropagation(),u(!0)},onBlur:e=>{e.stopPropagation(),u(!1),r&&r(e)},onKeyDown:e=>{"enter"!==m||"Enter"!==e.key||e.ctrlKey||e.metaKey||e.altKey||f(e),l?.(e)},children:0===n.length?e("option",{value:"",disabled:!0,children:"No Options"}):t(i,{children:[e("option",{value:"",children:"Select Option"}),n.map((t=>e("option",{value:String(t.value),children:t.label},t.value)))]})})})})})}));Vc.displayName="SmartSelectFieldComponent";const Tc=w(Vc,((e,t)=>e.name===t.name&&e.value===t.value&&e.disabled===t.disabled&&e.options===t.options&&e.errorMessage===t.errorMessage));Tc.displayName="SmartSelectField";const jc=28,Wc=100,qc=200,zc="select-all",Oc=({label:e})=>e,Pc=({value:e})=>String(e),Nc=e=>Pc(e)===zc,Xc=e=>void 0===e||""===e?[]:Array.isArray(e)?[...new Set(e.map(String))]:[String(e)],_c=(e,t)=>t.trim()?zo({data:e,fieldsToSearch:["label"],term:t.toLowerCase()}):e,$c=(e,t,i)=>{if(!e.length)return null;if(i&&t.length){const i=e.findIndex((e=>!Nc(e)&&t.includes(Pc(e))));if(i>=0)return i}if(!i&&t[0]){const i=e.findIndex((e=>Pc(e)===t[0]));if(i>=0)return i}return 0},eh=w((function({butterflyBlue:t,checked:i,indeterminate:o=!1,iron:n}){const r=i||o;return e("span",{"aria-hidden":!0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"14px",height:"14px",flexShrink:0,borderRadius:"2px",border:`1px solid ${r?t[900]:n[800]}`,background:r?t[900]:n[600],boxSizing:"border-box",pointerEvents:"none"},children:o?e(Co,{sx:{fontSize:12,color:`${n[600]} !important`}}):i?e(Ve,{sx:{fontSize:12,color:`${n[600]} !important`}}):null})})),th=w((function({butterflyBlue:i,highlightedIndex:o,indeterminate:n,isSelected:r,iron:l,itemIndex:a,onHighlightIndex:s,onSelectOption:C,option:A,showCheckbox:d,style:c}){return t(so.Item,{index:a,value:A,disabled:A.disabled,onPointerEnter:()=>{A.disabled||s(a)},onClick:e=>{"preventBaseUIHandler"in e&&e.preventBaseUIHandler(),e.preventDefault(),C(A)},style:e=>{const t=a===o||e.highlighted?l[700]:r&&!d?i[500]:"transparent";return{display:"flex",alignItems:"center",gap:"8px",padding:"0 8px",fontSize:"13px",cursor:A.disabled?"not-allowed":"pointer",boxSizing:"border-box",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",background:t,...c}},children:[d?e(eh,{butterflyBlue:i,checked:r,indeterminate:n,iron:l}):null,Oc(A)]})})),ih=(t,i,o,n)=>{const{butterflyBlue:r,highlightedIndex:l,iron:a,isAllSelected:s,isShowSelectAll:C,isSomeSelected:A,onHighlightIndex:d,onSelectOption:c,selectedValues:h,showCheckbox:p}=o,g=Pc(t),u=Nc(t),m=u?s:h.includes(g);return e(th,{itemIndex:i,butterflyBlue:r,highlightedIndex:l,indeterminate:u&&C&&A&&!s,isSelected:m,iron:a,onHighlightIndex:d,onSelectOption:c,option:t,showCheckbox:p,style:n},`${g}-${i}`)},oh=w((function({butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:n,isShowSelectAll:r,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValues:C,showCheckbox:A}){const d=so.useFilteredItems(),c=p(null),h=be({count:d.length,estimateSize:()=>28,getScrollElement:()=>c.current,overscan:10}),u=h.getVirtualItems();if(g((()=>{null===i||i<0||h.scrollToIndex(i,{align:"auto"})}),[i,h]),!d.length)return null;const m={butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:n,isShowSelectAll:r,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValues:C,showCheckbox:A};return e("div",{ref:c,style:{maxHeight:200,overflowY:"auto",paddingBottom:"4px"},children:e(so.List,{style:{height:h.getTotalSize(),position:"relative",width:"100%"},children:u.map((({index:e,size:t,start:i})=>{const o=d[e];return o?ih(o,e,m,{position:"absolute",top:i,left:0,width:"100%",height:t}):null}))})})})),nh=w((function({butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:n,isShowSelectAll:r,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValues:C,showCheckbox:A,virtualized:d}){if(d)return e(oh,{butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:n,isShowSelectAll:r,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValues:C,showCheckbox:A});const c={butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:n,isShowSelectAll:r,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValues:C,showCheckbox:A};return e(so.List,{style:{maxHeight:200,overflowY:"auto",paddingBottom:"4px"},children:(e,t)=>ih(e,t,c)})})),rh=w((function({iron:i,label:o,onRemove:n,size:r="md"}){const{chipFontSize:l,chipPadding:a}=c((()=>Jc(r)),[r]);return t("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:a,borderRadius:"12px",background:i[700],color:i[900],fontSize:l,fontWeight:500,lineHeight:1.4,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[o,e("button",{type:"button","aria-label":`Remove ${o}`,onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},style:{border:"none",background:"transparent",color:i[900],cursor:"pointer",padding:0,lineHeight:1,fontSize:l},children:"×"})]})})),lh=E((({containerStyle:o,disabled:n,errorMessage:r,freeSolo:l=!1,isShowCheckbox:a=!0,isShowSelectAll:s=!0,multiple:C=!1,name:A,label:d,onBlur:m,onChange:f,onDropdownOptionSelect:E,onKeyDown:I,options:k,placeholder:S="",required:w=!1,disableClearable:B=!!w,size:x="md",value:Q,defaultValue:M,...J},b)=>{const v=z(),{butterflyBlue:R,iron:L,lipstickRed:y}=v.palette.app.color,{navigationKey:F}=Ro(),[U,Z]=h(!1),[D,H]=h(!1),[K,G]=h(""),Y=p(null),V=p(null),T=p(null),[j,W]=h(!1),q=p(void 0),[O,P]=h(null),N=c((()=>Xc(Q)),[Q]),X=C?"":N[0]??"",_=c((()=>C&&s&&k.length?[{label:"Select All",value:zc},...k]:k),[s,C,k]),$=c((()=>_c(_,C||!D||j?K:"")),[K,D,j,_,C]),ee=c((()=>{if(!C||!k.length)return!1;const e=k.filter((e=>!e.disabled));return e.length>0&&e.every((e=>N.includes(Pc(e))))}),[C,k,N]),te=c((()=>C&&k.some((e=>N.includes(Pc(e))))),[C,k,N]),ie=c((()=>{if(C)return"";const e=k.find((e=>Pc(e)===X));return e?Oc(e):l&&X?X:""}),[l,C,k,X]),{handleEnterNavigation:oe,handleKeyDown:ne,inputRef:re,maintainFocusAfterClose:le,setInputRef:ae}=$o({isOpen:D,navigationKey:F}),se=_.length>100,Ce=c((()=>U||D?R[900]:r?y[900]:L[800]),[R,r,L,U,D,y]),Ae=u((e=>{const t=k.find((t=>Pc(t)===e));return t?Oc(t):e}),[k]),de=u((e=>{f?.({target:{name:A,value:e}})}),[A,f]),ce=u((e=>{const t=T.current;t&&(C&&Array.isArray(e)?Array.from(t.options).forEach((t=>{t.selected=e.includes(t.value)})):C||"string"!=typeof e||(t.value=e))}),[C]),he=u(((e,t)=>{ce(e),de(e),t&&E(t)}),[de,E,ce]),pe=u(((e="",t)=>{const i=_c(_,e);P($c(i,t??N,C))}),[_,C,N]),ge=u((e=>{const t=k.filter((e=>e.disabled)).map((e=>Pc(e))),i=e?k.map((e=>Pc(e))):t;he(i),ao((()=>{G("")})),pe("",i)}),[he,pe,k]),ue=u((e=>{const t=Pc(e);if(Nc(e))ge(!ee);else{if(C){const e=N.includes(t)?N.filter((e=>e!==t)):[...N,t];return he(e,t),ao((()=>{G("")})),void pe("",e)}he(t,t),G(Ae(t)),H(!1),le()}}),[he,Ae,ge,ee,le,C,pe,N]),me=u((e=>{const t=e.trim();if(!t)return;const i=k.find((e=>Oc(e).toLowerCase()===t.toLowerCase()||Pc(e)===t));if(i)ue(i);else{if(C){if(N.includes(t))return;const e=[...N,t];return he(e,t),ao((()=>{G("")})),void pe("",e)}he(t,t),G(t),H(!1),le()}}),[he,ue,le,C,pe,k,N]),fe=u((e=>{const t=N.filter((t=>t!==e));he(t)}),[he,N]),Ee=c((()=>!B&&!n&&(C?N.length>0:Boolean(X))),[B,n,C,X,N.length]),Ie=u((e=>{e.preventDefault(),e.stopPropagation();he(C?[]:""),G(""),W(!1),H(!1),P(null),le()}),[he,le,C]),ke=u((()=>{H(!1),W(!1),P(null),G(C?"":ie)}),[C,ie]),Se=u((()=>{H(!0),W(!1),G(C?"":ie),pe()}),[C,pe,ie]),we=u(((e,t)=>{n||!e&&C&&"item-press"===t?.reason||(H(e),e?(W(!1),G(C?"":ie),pe()):(W(!1),G(C?"":ie),P(null),Z(!1)))}),[n,C,pe,ie]),Be=u(((e,t)=>{if(C&&"item-press"===t?.reason){if(G(""),D){const e=_c(_,"");P(e.length?$c(e,N,C):null)}}else if(W(!0),G(e),D){const t=_c(_,e);P(t.length?$c(t,N,C):null)}}),[D,_,C,N]),xe=u((e=>{P(e)}),[]),Qe=u((e=>{$.length?P((t=>null===t?"down"===e?0:$.length-1:"down"===e?Math.min(t+1,$.length-1):Math.max(t-1,0))):P(null)}),[$.length]),Je=e=>{"preventBaseUIHandler"in e&&e.preventBaseUIHandler()},be=u((e=>{e.preventDefault(),Je(e),D?Qe("ArrowDown"===e.key?"down":"up"):(ao((()=>{H(!0),W(!1),G(C?"":ie)})),pe())}),[D,Qe,C,pe,ie]),ve=u((e=>{const t=null!==O?$[O]:void 0;if(t)return e.preventDefault(),Je(e),void ue(t);l&&K.trim()&&(e.preventDefault(),Je(e),me(K))}),[me,$,l,ue,O,K]),Re=u((e=>{if(!("ArrowDown"===e.key||"ArrowUp"===e.key)||n)return"Tab"===e.key&&D?(H(!1),void le()):"enter"!==F||"Enter"!==e.key||D||e.ctrlKey||e.metaKey||e.altKey?void("Enter"===e.key&&D?ve(e):(ne(e,(()=>{H(!1),le()}),D),I?.(e))):(e.preventDefault(),e.stopPropagation(),void oe(e));be(e)}),[n,be,oe,ne,ve,D,le,F,I]),Le=u((e=>{const t=e.relatedTarget;window.setTimeout((()=>{if(t&&(Y.current?.contains(t)||V.current?.contains(t)))return;const e=document.activeElement;Y.current?.contains(e)||V.current?.contains(e)||(D&&(l&&K.trim()&&me(K),ke()),Z(!1))}),0),m?.(e)}),[ke,me,l,K,D,m]),ye=u((e=>{e.preventDefault(),e.stopPropagation(),n||(D?(ke(),Z(!1)):(Se(),Z(!0),re.current?.focus()))}),[ke,n,re,D,Se]);g((()=>{D||(G(C?"":ie),W(!1))}),[D,C,ie]),g((()=>{q.current=null!==O?$[O]:void 0}),[$,O]);const Fe=c((()=>{if(!k.length&&!N.length)return e("option",{value:"",disabled:!0,children:"No Options"});const o=N.filter((e=>!k.some((t=>Pc(t)===e))));return t(i,{children:[C?null:e("option",{value:"",children:"Select Option"}),k.map((t=>e("option",{value:Pc(t),children:Oc(t)},Pc(t)))),o.map((t=>e("option",{value:t,children:t},t)))]})}),[C,k,N]),Ue=u((e=>{T.current=e,"function"==typeof b?b(e):b&&(b.current=e)}),[b]),Ze=u(((e,t)=>!t.trim()||zo({data:[e],fieldsToSearch:["label"],term:t.toLowerCase()}).length>0),[]),De=L,He=R,Ke=C&&a,Ge={width:"var(--anchor-width)",minWidth:"var(--anchor-width)",maxWidth:"var(--anchor-width)"},Ve=bc(L),Te=vc(L,n),je=Jc(x),We=c((()=>Rc(Ve)),[Ve]),qe=c((()=>yc(x,"autocomplete")),[x]),ze=c((()=>({...Lc(Te,x),flex:1,minWidth:C?"80px":0,cursor:n?"default":"text"})),[n,Te,C,x]);return t(Uc,{title:r??"",position:"top",delay:50,children:[e("style",{children:We}),e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%",...o},children:t(so.Root,{items:_,value:K,onValueChange:Be,open:D,onOpenChange:we,disabled:n,name:A,autoHighlight:!1,keepHighlight:!0,virtualized:se,openOnInputClick:!0,filter:Ze,filteredItems:$,itemToStringValue:Oc,onItemHighlighted:(e,t)=>{q.current=e,t.index>=0&&P(t.index)},children:[t("div",{ref:Y,style:{display:"flex",alignItems:"center",flexWrap:C?"wrap":"nowrap",gap:C?je.multipleGap:void 0,border:`2px solid ${Ce}`,background:L[600],position:"relative",width:"100%",...qe},children:[C?N.map((t=>e(rh,{iron:De,size:x,label:Ae(t),onRemove:()=>{fe(t)}},t))):null,e(so.Input,{ref:ae,disabled:n,className:xc,placeholder:C&&X?.length?"":S||`Select ${d??"Option"}`,onClick:e=>{e.stopPropagation()},onFocus:e=>{e.stopPropagation(),Z(!0),n||D||document.activeElement!==e.currentTarget||Se()},onBlur:Le,onKeyDown:Re,style:ze}),Ee?e("button",{type:"button",tabIndex:-1,"aria-label":"Clear selection",onMouseDown:e=>{e.preventDefault()},onClick:Ie,style:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"none",background:"transparent",padding:0,marginLeft:je.expandMarginLeft,cursor:"pointer",color:L[400]},children:e(Ye,{sx:{fontSize:je.expandIconSize-4}})}):null,e("button",{type:"button",tabIndex:-1,"aria-label":D?"Close options":"Open options",disabled:n,onMouseDown:e=>{e.preventDefault()},onClick:ye,style:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"none",background:"transparent",padding:0,marginLeft:je.expandMarginLeft,cursor:n?"not-allowed":"pointer",color:n?L[800]:L[400]},children:e(Me,{sx:{fontSize:je.expandIconSize,transform:D?"rotate(180deg)":"none",transition:"transform 0.2s ease"}})}),e("select",{...J,ref:Ue,name:A,value:C?void 0:X,multiple:C,disabled:n,required:w,tabIndex:-1,"aria-hidden":!0,style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0,pointerEvents:"none"},children:Fe})]}),e(so.Portal,{children:e(so.Positioner,{anchor:Y,sideOffset:2,align:"start",style:{zIndex:999,...Ge},children:t(so.Popup,{ref:V,style:{...Ge,background:L[600],border:`1px solid ${L[300]}`,boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",borderRadius:"4px",overflow:"hidden"},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.stopPropagation()},children:[e(so.Empty,{children:e("div",{style:{padding:je.padding,fontSize:je.fontSize,color:L[800]},children:"No Options"})}),e(nh,{butterflyBlue:He,highlightedIndex:O,iron:De,isAllSelected:ee,isShowSelectAll:s,isSomeSelected:te,onHighlightIndex:xe,onSelectOption:ue,selectedValues:N,showCheckbox:Ke,virtualized:se})]})})})]})})]})}));lh.displayName="SmartAutoCompleteFieldComponent";const ah=w(lh,(({name:e,value:t,disabled:i,options:o,errorMessage:n,freeSolo:r,multiple:l,isShowSelectAll:a,isShowCheckbox:s,placeholder:C,required:A,disableClearable:d,size:c},{name:h,value:p,disabled:g,options:u,errorMessage:m,freeSolo:f,multiple:E,isShowSelectAll:I,isShowCheckbox:k,placeholder:S,required:w,disableClearable:B,size:x})=>e===h&&t===p&&i===g&&o===u&&n===m&&r===f&&l===E&&a===I&&s===k&&C===S&&A===w&&d===B&&c===x));ah.displayName="SmartAutoCompleteField";const sh=E((({errorMessage:t,onKeyDown:i,...o},n)=>{const r=z(),{type:l,disabled:a}=o,{butterflyBlue:s,lipstickRed:C,iron:A}=r.palette.app.color,[d,p]=h(!1),{navigationKey:g}=Ro(),{handleEnterNavigation:u}=$o({navigationKey:g}),m=c((()=>a?A[700]:d?s[900]:t?C[900]:A[800]),[a,t,d]);return e(Uc,{title:t??"",position:"top",delay:50,children:e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%"},children:e("div",{style:{display:"flex",alignItems:"center",border:"checkbox"===l?"none":`2px solid ${m}`,borderRadius:"4px",padding:"4px 8px",background:a?A[50]:"white",minHeight:"20px"},children:e("input",{ref:n,...o,style:{width:"100%",border:"none",background:"transparent",padding:"0",fontSize:"13px",outline:"none"},onClick:e=>e.stopPropagation(),onFocus:e=>{e.stopPropagation(),p(!0)},onBlur:e=>{e.stopPropagation(),p(!1)},onKeyDown:e=>{"enter"!==g||"Enter"!==e.key||"checkbox"===l||e.ctrlKey||e.metaKey||e.altKey||u(e),i?.(e)}})})})})}));sh.displayName="SmartTextFieldComponent";const Ch=w(sh,((e,t)=>e.name===t.name&&e.value===t.value&&e.checked===t.checked&&e.disabled===t.disabled&&e.type===t.type&&e.errorMessage===t.errorMessage));Ch.displayName="SmartTextField";const Ah=E((({errorMessage:i,onKeyDown:o,onFocus:n,onBlur:r,style:l,className:a,size:s="md",...C},A)=>{const d=z(),{type:p,disabled:g,name:m}=C,{butterflyBlue:f,lipstickRed:E,iron:I}=d.palette.app.color,k=bc(I),S=vc(I,g),[w,B]=h(!1),{navigationKey:x}=Ro(),{handleEnterNavigation:Q,setInputRef:M}=$o({navigationKey:x}),J="checkbox"===p,b=c((()=>i?E[900]:w?f[900]:I[800]),[f,i,I,w,E]),v=c((()=>Rc(k)),[k]),R=c((()=>yc(s,"text")),[s]),L=c((()=>({...Lc(S,s),...l})),[s,l,S]),y=[xc,a].filter(Boolean).join(" "),F=u((e=>{J||M(e),"function"==typeof A?A(e):A&&(A.current=e)}),[J,A,M]),U=e=>{"enter"!==x||"Enter"!==e.key||J||e.ctrlKey||e.metaKey||e.altKey||Q(e),o?.(e)},Z=e=>{e.stopPropagation(),B(!0),n?.(e)},D=e=>{e.stopPropagation(),B(!1),r?.(e)},H=e(J?"input":ro,{ref:F,...C,disabled:g,className:y,style:L,onClick:e=>{e.stopPropagation()},onFocus:Z,onBlur:D,onKeyDown:U});return t(Uc,{title:i??"",position:"top",delay:50,children:[J?null:e("style",{children:v}),e(no.Root,{disabled:g,name:m,style:{width:"100%"},children:e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%"},children:e("div",{style:{display:"flex",alignItems:"center",border:J?"none":`2px solid ${b}`,background:I[600],width:"100%",...R},children:H})})})]})}));Ah.displayName="SmartTextFieldV2Component";const dh=w(Ah,(({name:e,value:t,checked:i,disabled:o,type:n,size:r,errorMessage:l,placeholder:a},{name:s,value:C,checked:A,disabled:d,type:c,size:h,errorMessage:p,placeholder:g})=>e===s&&t===C&&i===A&&o===d&&n===c&&r===h&&l===p&&a===g));function ch({items:i,disabled:o=!1,avoidDeleteFocus:r=!1}){const[l,a]=h(null),s=!!l,A=M(),d=A.palette.app.color.red?.[900]??A.palette.error.main,u=p(null),m=p([]),f=c((()=>(i??[]).filter((({isView:e})=>!e))),[i]),E=()=>a(null),I=e=>"delete"===e.toLowerCase();g((()=>{const e=u.current;if(!e)return;const t=t=>{o||"Enter"===t.key&&(t.preventDefault(),a(e))};return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}),[o]);const k=e=>{const t=m.current;if(!t.length)return;const i=document.activeElement,o=t.findIndex((e=>e===i)),n=-1!==o?o:1===e?-1:t.length;for(let i=1;i<=t.length;i++){const o=(n+i*e+t.length)%t.length,l=t[o],a=f[o]?.title??"";if(l&&(!r||!I(a)))return void l.focus()}};return g((()=>{s&&r&&f.length&&requestAnimationFrame((()=>k(1)))}),[r,f.length,s]),f.length?t(x,{sx:{width:"100%"},children:[e(n,{ref:u,component:"div",sx:{width:"100%",cursor:"pointer",alignItems:"center"},onClick:e=>{o||a(e.currentTarget)},disabled:o,"data-clickable":"true",children:e(Ce,{})}),l&&e(Ae,{open:!0,anchorEl:l,onClose:E,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{onKeyDown:e=>{r&&("ArrowDown"===e.key&&(e.preventDefault(),k(1)),"ArrowUp"===e.key&&(e.preventDefault(),k(-1)))}}},children:e(Rl,{padding:{padding:"2px"},children:f.map((({title:t,onClick:i,href:o},n)=>{const l=I(t);return e(x,{children:e(ne,{...o?{component:C,href:o,prefetch:!1}:{},ref:e=>{m.current[n]=e},sx:{borderRadius:"4px",color:l?d:void 0,width:"100%",textAlign:"start",padding:"5px 16px 5px 10px"},tabIndex:l&&r?-1:0,onClick:()=>{i?.(),E()},children:e(j,{variant:"body1",children:t})})},t)}))})})]}):null}dh.displayName="SmartTextFieldV2";const hh=({orientation:t="horizontal",activeStep:i=0,stepLabelProps:o={},steps:n,errorSteps:r=[],onStepClick:l,showActiveStepIcon:a,showTooltips:s=!1,showStepLabels:C=!0,...A})=>{const d=M(),{butterflyBlue:c,red:h}=d.palette.app.color;return e(x,{children:e(ho,{activeStep:i,orientation:t,...A,children:n.map(((t,i)=>{const n=r.includes(i),a=e(co,{...o,error:n,sx:{cursor:l?"pointer":"default",".Mui-active .MuiStepIcon-root":{color:`${c[900]} !important`},".Mui-completed .MuiStepIcon-root":{color:`${c[900]} !important`},...n&&{".MuiStepIcon-root":{color:`${h[900]} !important`},".MuiStepLabel-label":{color:`${h[900]} !important`}},...o.sx},onClick:()=>(e=>{l&&l(e)})(i),children:C&&e(j,{variant:"body2",children:t})});return e(Ao,{children:s?e(T,{title:t,placement:"top",children:a}):a},t)}))})})},ph=J(po)((({theme:e})=>({[`&.${go.alternativeLabel}`]:{top:10,left:"calc(-50% + 16px)",right:"calc(50% + 16px)"},[`&.${go.active}`]:{[`& .${go.line}`]:{borderColor:"#784af4"}},[`&.${go.completed}`]:{[`& .${go.line}`]:{borderColor:"#784af4"}},[`& .${go.line}`]:{borderColor:"#eaeaf0",borderTopWidth:3,borderRadius:1,...e.applyStyles("dark",{borderColor:e.palette.grey[800]})}}))),gh=J("div")((({theme:e})=>({color:"#eaeaf0",display:"flex",height:22,alignItems:"center","& .QontoStepIcon-completedIcon":{color:"#784af4",zIndex:1,fontSize:18},"& .QontoStepIcon-circle":{width:8,height:8,borderRadius:"50%",backgroundColor:"currentColor"},...e.applyStyles("dark",{color:e.palette.grey[700]}),variants:[{props:({ownerState:e})=>e.active,style:{color:"#784af4"}}]})));function uh(t){const{active:i,completed:o,className:n}=t;return e(gh,{ownerState:{active:i},className:n,children:o?e(Ve,{className:"QontoStepIcon-completedIcon"}):e("div",{className:"QontoStepIcon-circle"})})}const mh=({steps:t,alternativeLabel:i=!0,stepLabelProps:o={},...n})=>e(a,{sx:{width:"100%"},spacing:4,children:e(ho,{alternativeLabel:i,activeStep:1,connector:e(ph,{}),...n,children:t.map((t=>e(Ao,{children:e(co,{StepIconComponent:uh,...o,children:t})},t)))})}),fh=({orientation:o="horizontal",activeStep:n=0,stepLabelProps:r={},steps:l,...s})=>{const C=M(),{butterflyBlue:A}=C.palette.app.color;return e(x,{children:e(ho,{activeStep:n,orientation:o,...s,children:l.map(((o,n)=>e(Ao,{children:e(co,{...r,sx:{".Mui-active .css-18pqgpd-MuiSvgIcon-root-MuiStepIcon-root":{color:`${A[900]} !important`},".Mui-completed .MuiStepIcon-root":{color:`${A[900]} !important`},".MuiStepIcon-text":{color:"transparent !important",display:"none"}},children:e(a,{children:t(i,o?.in_time?{children:[e(j,{variant:"caption",children:"In at"}),e(j,{variant:"caption",children:o?.in_time})]}:{children:[e(j,{variant:"caption",children:"Out at"}),e(j,{variant:"caption",children:o?.out_time})]})})})},n)))})})},Eh=()=>e(x,{flex:1,children:e(Ie,{height:"30px",sx:{maxWidth:"200px",transform:"scale(1)"}})}),Ih={small:{minHeight:"36px !important",height:"36px !important",fontSize:"12px !important",padding:"10px 5px !important"},medium:{minHeight:"48px !important",height:"48px !important",fontSize:"13px !important",padding:"12px 16px !important"},large:{minHeight:"52px !important",height:"52px !important",fontSize:"14px !important",padding:"14px 18px !important"}},kh={small:{minHeight:"36px !important",height:"36px !important"},medium:{minHeight:"48px !important",height:"48px !important"},large:{minHeight:"52px !important",height:"52px !important"}},Sh=({tabs:t,value:i,loading:o,tabProps:n,role:r,size:l="medium"})=>o?e(a,{gap:"10px",direction:"row",children:t.map((()=>e(Eh,{},$t())))}):e(mo,{value:i,role:r,sx:{...kh[l],"& .MuiTabs-scroller":{minHeight:"inherit",height:"inherit"},"& .MuiTabs-flexContainer":{minHeight:"inherit",height:"inherit"},"& .MuiTab-root.MuiButtonBase-root":{...Ih[l]}},children:t.filter((({isView:e})=>!1!==e)).map((({iconPosition:t="end",toolTipLabel:i="",icon:r,href:l,target:a,...s},A)=>{const d=l?{component:C,href:l,target:a,prefetch:!1}:{},c=Re(s,["isView"]);return I(uo,{...d,key:c.value??A,icon:i?e(cl,{toolTipLabel:i,placement:"bottom",children:r}):r,disabled:o,iconPosition:t,...c,...n})}))});function wh({label:i,value:o,menu:n,trimLabel:r=!0,activeTab:l,index:s,onArrowClick:A,menuAnchor:d,onAction:c,href:h,target:p,...g}){const u=M(),{butterflyBlue:m}=u.palette.app.color,f=o===l.value,E=i.toLowerCase().replaceAll(/[ _]/g,"-"),I=ko(i,{length:r?15:i.length,omission:r?"...":""}),k={title:"Edit",onClick:()=>c&&c("editTemplate",l)},S={title:"Delete",onClick:()=>c&&c("deleteTemplate",l)},w=h?{component:C,href:h,target:p,prefetch:!1}:{},B={iconPosition:"end","data-cy":E,"data-ptag":E,value:o??s,label:t(a,{direction:"row",gap:"6px",alignItems:"center",children:[e(j,{variant:"body1",sx:{whiteSpace:"nowrap"},children:f?i:I}),f&&s>0&&e(Fl,{items:[k,S]})]})};return i.length>15&&!f&&(B.title=i),o===l.value&&n?.length&&(B.icon=e(te,{onClick:A,id:`tabDropDown-${o}`,"aria-controls":null!==d?`dropDownMenu-${o}`:void 0,"aria-expanded":null!==d?"true":void 0,"aria-haspopup":"true","data-cy":`${E}-arrowicon`,"data-ptag":`${E}-arrowicon`})),e(uo,{sx:{borderBottom:"2px solid",borderBottomColor:f?m[900]:"white",overflow:"visible",[`&.${Io.root}`]:{minHeight:"40px",height:"40px",paddingLeft:f&&s>0?"15px":"10px"},"&:hover":{backgroundColor:m[500]}},...B,...w,...g})}function Bh({tabs:t,activeTab:o,menuAnchor:n,onClose:a,onMenuItemClick:s}){return e(i,{children:t.filter((e=>!!e.menu)).map((t=>e(r,{anchorEl:n,open:t.value===o.value&&!!n,onClose:a,id:`dropDownMenu-${t.value}`,MenuListProps:{"aria-labelledby":`tabDropDown-${t.value}`},children:t.menu?.map((({label:t,disabled:i,onClick:n,href:r,target:a})=>e(l,{onClick:()=>{s(),n(o)},disabled:i,...r?{component:C,href:r,target:a,prefetch:!1}:{},children:t},t)))},t.value)))})}function xh({tabs:i,onChange:o,addButton:n,actionButton:r,ariaLabel:l,activeIndex:s=0,onAction:C}){const A=M(),[d,c]=h(i[s]),[p,u]=h(null);g((()=>{-1===i.findIndex((e=>e.value===d.value))&&(o&&i[0]&&o(i[0]),c(i[0]))}),[i,d,o]),g((()=>{c(i[s])}),[s]);return t(x,{children:[e(Bh,{activeTab:d,tabs:i,onClose:()=>u(null),onMenuItemClick:()=>u(null),menuAnchor:p}),t(a,{direction:"row",justifyContent:"space-between",sx:{borderBlockEnd:"solid 1px",borderColor:A.palette.app.color.iron[700]},children:[t(a,{direction:"row",gap:"5px",alignItems:"center",overflow:"hidden",children:[e(a,{direction:"row",overflow:"hidden",children:e(mo,{value:i.some((e=>e.value===d.value))?d.value:i[0]?.value,onChange:(e,t)=>{const n=i.find((e=>e.value===t));n&&(c(n),o&&n&&o(n))},TabIndicatorProps:{sx:{display:"none"}},sx:{[`&.${fo.root}`]:{minHeight:"40px",height:"40px"}},variant:"scrollable",scrollButtons:"auto",ScrollButtonComponent:Eo,"aria-label":l??"Tabs",children:i.map(((t,i)=>e(wh,{index:i,activeTab:d,onArrowClick:e=>{u(e.target)},onAction:C,menuAnchor:p,...t},t.value)))})}),n]}),e(a,{direction:"row",gap:"10px",alignItems:"center",justifyContent:"space-between",children:r})]})]})}const Qh=({variant:i,leaveColor:o,toolTipLabel:n})=>{const r=Mo(i);return t(a,{sx:{position:"relative",width:"100%",alignItems:"center"},children:[e(x,{sx:{position:"absolute",backgroundColor:"#ffffff",border:`1px solid ${o??r}`,borderRadius:"7px",padding:"0px 5px",zIndex:1,color:`${o??r}`,height:"28px",display:"flex",alignItems:"center",cursor:"pointer"},children:e(cl,{toolTipLabel:n,children:Jo(i)})}),e(hi,{valueLabelDisplay:"off",value:[0,2],max:2,step:1,sx:{"& .MuiSlider-track":{background:`${o??r}`,height:"2px",border:"none"},"& .MuiSlider-thumb":{backgroundColor:`${o??r}`,height:8,width:8},"& .MuiSlider-rail":{backgroundColor:"transparent"}}})]})},Mh=({totalDots:i,intervals:o,startTimeline:n})=>e(x,{sx:{position:"relative",width:"100%",height:4},children:o?.map(((o,r)=>{const l=Zo(o.in_time),s=Zo(o.out_time),C=y.fromISO(o.in_time),A=y.fromISO(o.out_time).diff(C,["hours","minutes"]).toFormat("hh:mm");let d=Jh(l),c=Jh(s);const h=!isNaN(d),p=!isNaN(c);h&&d<n&&(d+=i),p&&(c<n&&(c+=i),h&&c<d&&(c+=i));let g="",u="";h&&(g=`In time : ${l} ${p?"":" / Missing punch"}`),p&&(u=`Out time : ${s} ${h?"":"/ Missing punch"}`);const m=o?.name??`In/Out: ${Zo(o.in_time)} - ${Zo(o.out_time)} (${A})`,f=o?.color??Mo(o.status_type),E=h?(d-n)/i*100:0,I=p?(c-n)/i*100:0,k=h&&p?Math.max(I-E,0):0;return t(a,{direction:"row",children:[h&&e(T,{arrow:!0,title:g,placement:"top",children:e(x,{sx:{height:8,width:8,position:"absolute",left:`${E}%`,boxShadow:"none",backgroundColor:f,borderRadius:"50%",top:"15px",zIndex:3,"&:focus, &:hover, &:active":{boxShadow:"none"}}})}),h&&p&&e(T,{arrow:!0,title:m,placement:"top",children:e(x,{sx:{position:"absolute",left:`${E}%`,width:`${k}%`,height:3.5,top:"17.5px",backgroundColor:f,zIndex:2}})}),p&&e(T,{arrow:!0,title:u,placement:"top",children:e(x,{sx:{height:8,width:8,position:"absolute",left:`${I}%`,boxShadow:"none",backgroundColor:f,borderRadius:"50%",top:"15px",zIndex:3,"&:focus, &:hover, &:active":{boxShadow:"none"}}})})]},r)}))}),Jh=e=>{const t=y.fromFormat(e,"HH:mm");return t.hour+t.minute/60},bh=({totalDots:i,highlightedIntervals:o,shiftStartTime:n,shiftEndTime:r,startTimeline:l="2024-11-17T18:30:04.000Z"})=>{const s=parseFloat(Zo(l)),C=(e,t,o)=>{const n=Zo(e),r=Zo(t);let l=Jh(n),a=Jh(r);return l=l<s?l+i:l,a=a<l?a+i:a,"END"===o?a:l},A=e=>{const t=(e+s)%i;return o.some((e=>t>=parseFloat(Zo(e.in_time))&&t<=parseFloat(Zo(e.out_time))))},d=Array.from({length:i},((e,t)=>({value:(t+s)%i,label:"",highlighted:A((t+s)%i)})));return t(a,{sx:{position:"relative",width:"100%"},children:[e(Mh,{totalDots:i,intervals:o,startTimeline:s}),e(T,{title:`Shift Start: ${Zo(n)}`,arrow:!0,placement:"top",children:e(x,{sx:{cursor:"pointer",position:"absolute",top:"12px",zIndex:2,left:(C(n,r,"START")-s)%i/i*100+"%"},children:e(Fn,{})})}),e(T,{title:`Shift End: ${Zo(r)}`,arrow:!0,placement:"top",children:e(x,{sx:{cursor:"pointer",position:"absolute",top:"12px",zIndex:2,left:(C(n,r,"END")-s)%i/(i-.6)*100+"%"},children:e(Fn,{})})}),e(hi,{disabled:!0,valueLabelDisplay:"off",marks:d,max:i-1,step:1,value:[],sx:{zIndex:1,"& .MuiSlider-track":{background:"transparent",height:1,border:"none"},"& .MuiSlider-mark":{backgroundColor:"gray",height:4,width:4,borderRadius:"50%"},"& .MuiSlider-markActive":{backgroundColor:"transparent",height:5,width:5},"& .MuiSlider-rail":{height:2,backgroundColor:"#929292"},"& .MuiSlider-thumb":{display:"none"}}})]})},vh=J(le,{shouldForwardProp:e=>"isParent"!==e&&"borderColor"!==e&&"backgroundColor"!==e&&"baseColor"!==e})((({theme:e,isParent:t,borderColor:i,backgroundColor:o,baseColor:n})=>({width:"auto",minWidth:0,padding:e.spacing(1),borderRadius:12,border:`1px solid ${i}`,boxShadow:t?`0 6px 18px ${R(n,.2)}`:"none",backgroundColor:o,display:"flex",alignItems:"center",gap:e.spacing(1),minHeight:40,overflow:"hidden",flex:"1 1 auto",[e.breakpoints.down("sm")]:{flex:"1 1 100%"}}))),Rh=({node:i,innerRef:o,isParent:n=!1,themeColor:r})=>{const{id:l,title:a,subtitle:s,value:C}=i,A=M(),{butterflyBlue:d,slate:c}=A.palette.app.color,h=r??d[900],p=n?h:R(h,.7),g=n?R(h,.1):"none",u=c[900];return t(vh,{elevation:n?3:0,ref:o,isParent:n,borderColor:p,backgroundColor:g,baseColor:h,children:[t(x,{children:[e(j,{variant:"subtitle2",noWrap:!0,children:a}),e(j,{variant:"subtitle2",color:u,noWrap:!0,children:s})]}),e(Rl,{padding:{paddingLeft:1},children:e(x,{sx:{ml:"auto",textAlign:"right"},children:e(j,{noWrap:!0,variant:"body2",children:C})})})]},l)},Lh=({node:i,setRef:o,themeColor:n,itemWidth:r})=>{const{id:l,children:s}=i,C=!!s?.length;return t(x,{sx:{display:"flex",gap:3,alignItems:"flex-start",flex:`1 0 ${r}`},children:[e(Rh,{node:i,isParent:C,innerRef:e=>o(l,e),themeColor:n}),C&&e(a,{spacing:1,sx:{mt:.5},children:se(s,(t=>e(Lh,{node:t,setRef:o,themeColor:n,itemWidth:r},t.id)))})]},l)},yh=({node:i,setRef:o,themeColor:n})=>{const{id:r,children:l}=i,s=!!l?.length;return t(a,{gap:1,children:[e(Rh,{node:i,isParent:s,innerRef:e=>o(r,e),themeColor:n}),s&&e(Rl,{padding:{paddingLeft:3,paddingTop:1},children:e(a,{spacing:1,children:se(l,(t=>e(yh,{node:t,setRef:o,themeColor:n},t.id)))})})]},r)},Fh=({nodes:i,direction:o="horizontal",columns:n=3,color:r})=>{const{isMobile:l}=en(),s=p({}),C=p(null),A=p(null),d=p(null),[c,u]=h([]),m=(e,t)=>{if(t)return s.current[e]=t,void(d.current&&d.current.observe(t));s.current=Re(s.current,e)},f=e=>e?e.getBoundingClientRect():null,E=(e,t,i)=>{So(e,(e=>{const{id:n,children:r}=e;if(!r?.length)return;const a=s.current[n];if(!a)return;const C=f(a);C&&So(r,(e=>{const{id:n,children:r}=e,a=s.current[n];if(!a)return;const A=f(a);if(!A)return;const d=l||"vertical"===o?((e,t,i)=>{const{left:o,width:n,bottom:r}=e,{left:l,width:a,top:s}=t,{left:C,top:A}=i,d=o+n/2-C,c=r-A,h=l+a/2-C,p=s-A,g=c+Math.max(12,(p-c)/2);return`M ${d} ${c} C ${d} ${g} ${h} ${g} ${h} ${p}`})(C,A,t):((e,t,i)=>{const{right:o,top:n,height:r}=e,{left:l,top:a,height:s}=t,{left:C,top:A}=i,d=o-C,c=n+r/2-A,h=l-C,p=a+s/2-A,g=h-d,u=Math.abs(g),m=Math.min(120,Math.max(24,u/2)),f=g>=0?1:-1;return`M ${d} ${c} C ${d+m*f} ${c} ${h-m*f} ${p} ${h} ${p}`})(C,A,t);i.push({definition:d}),r?.length&&E([e],t,i)}))}))};g((()=>{const e=()=>requestAnimationFrame((()=>{(()=>{const e=A.current,t=C.current;if(!e||!t)return;const o=t.clientWidth;e.setAttribute("width",String(o)),e.setAttribute("height","auto");const n=t.getBoundingClientRect(),r=[];E(i,n,r),u(r)})()})),t=e(),o=new ResizeObserver(e);d.current=o,C.current&&o.observe(C.current),Ue(s.current).forEach((e=>o.observe(e)));const n=e;return window.addEventListener("resize",n),()=>{cancelAnimationFrame(t),o.disconnect(),d.current=null,window.removeEventListener("resize",n)}}),[i,l,o]);const I=`calc(${100/n}% - 24px)`;return t(x,{ref:C,variant:"outlined",component:le,position:"relative",sx:{overflowX:"hidden",overflowY:"visible"},children:[e(Kr,{ref:A,paths:c,strokeColor:r}),e(Rl,l||"vertical"===o?{padding:{padding:2},children:e(a,{spacing:3,children:se(i,(t=>e(yh,{node:t,setRef:m,themeColor:r},t.id)))})}:{padding:{padding:2},children:e(a,{direction:"row",alignItems:"flex-start",justifyContent:"flex-start",flexWrap:"wrap",gap:3,children:se(i,(t=>e(Lh,{node:t,setRef:m,themeColor:r,itemWidth:I},t.id)))})})]})};J(r)((({theme:e})=>({[`& .${Bo.paper}`]:{boxShadow:e.palette.app.paperBoxShadow,minWidth:"29rem",width:"auto",margin:"0 0.5rem",borderRadius:"8px",overflow:"visible","& .MuiList-root":{padding:"0",overflow:"visible"}}})));const Uh=J(n,{shouldForwardProp:e=>"isOpened"!==e})((({theme:e})=>({paddingInline:"0.3rem",paddingBlock:"0.2rem",borderRadius:"8px",color:e.palette.app.color.black[900]})));function Zh({userDetails:o,menuItems:n,shouldCloseOnClick:r=!0}){const[l,s]=h(null),A=p(null),{layout:d}=en(),c="desktop"===d,g=M(),{iron:u}=g.palette.app.color,m=Boolean(l),f=()=>s(null),{name:E}=o;return t(x,{position:"relative",children:[e(x,{sx:{display:"flex",alignItems:"center"},children:e(Uh,{ref:A,onClick:e=>{s(e.currentTarget)},size:"small","aria-haspopup":"true",children:t(a,{direction:"row",alignItems:"center",gap:1,color:"black",children:[e(ke,{src:o.avatar,sx:{border:`1px solid ${u[700]}`,width:28,height:28}}),c&&t(i,{children:[e(j,{maxWidth:150,noWrap:!0,children:E}),e(m?Je:Me,{})]})]})})}),m&&e(Ae,{open:!0,anchorEl:l,onClose:f,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{elevation:0,sx:{width:220,overflow:"visible",mt:1.5,px:0,py:0,filter:"drop-shadow(0px 2px 8px rgba(0,0,0,0.32))","& .MuiAvatar-root":{width:32,height:32,ml:-.5,mr:1},"&:before":{content:'""',display:"block",position:"absolute",top:0,right:14,width:10,height:10,bgcolor:"background.paper",transform:"translateY(-50%) rotate(45deg)",zIndex:0}}}},children:e(x,{sx:{padding:"4px 0"},children:n.map((({key:i,divider:o,label:n,icon:l,sx:s,onClick:A,href:d,target:c})=>{const h=d?{component:C,href:d,target:c,prefetch:!1}:{};return t(x,{children:[o&&e(X,{}),e(ne,{...h,onClick:()=>{$(A)&&(A(),r&&f())},children:(l||n)&&t(a,{gap:"16px",alignItems:"center",width:"100%",flexDirection:"row",sx:{...s},children:[e(wo,{sx:{minWidth:"20px",alignItems:"center",...s},children:l}),n&&e(j,{sx:{fontSize:"13px"},children:n})]})})]},`${i}_container`)}))})})]})}export{pA as ASPECT_RATIO_LABELS,hA as ASPECT_RATIO_VALUES,Mn as ActionButton,Qn as ActionButtons,Ul as ActionButtonsWrapper,Fl as ActionCell,hl as AddIconAction,jl as AgGrid,sl as AnnouncementBanner,ga as AppBar,Tr as AppLogoMedium,jr as AppLogoSmall,Fn as ArrowUp,yn as ArrowUpRight,Ja as AttendanceCard,Wr as AttendanceManagementDarkSvg,qr as AttendanceReportDarkSvg,Qh as AttendanceStatus,Zs as Autocomplete,ua as Badge,ts as BarChart,al as BookMarkSvg,Gs as BottomDialog,Vs as BottomSheet,ws as BoxStyled,ma as BreadcrumbButtonWrapper,ka as Breadcrumbs,zr as BriefcaseSvg,Or as BulkOperationsDarkSvg,Jn as Button,Ps as ButtonContainer,bn as ButtonGroup,vn as ButtonLayoutProvider,pl as CalendarIconAction,_r as CalendarSvg,Sa as Card,wa as CardItem,Ba as CardItemValue,$a as CellSelectionTable,Nr as ChartIconSvg,oC as CheckBox,Bs as CheckStyled,xo as CheckboxInput,ls as Chip,ss as ChipWithBorder,Xr as ClockSvg,cs as CodeSnippetBox,Vd as ColumnArranger,jd as ColumnArrangerDialog,Td as ColumnArrangerForm,gl as ColumnIconAction,Al as CommentIcon,Tn as CompanyBanner,ul as ConfigureIconAction,Ns as ContentBox,QC as CurrencyField,vl as CurrentLocationAction,ca as CustomEnumFilter,fA as DEFAULT_ASPECT_RATIOS,mA as DEFAULT_ENABLED_VARIANTS,CA as DEFAULT_MAX_SIZE_MB,AA as DEFAULT_MIN_RESOLUTION,dA as DEFAULT_QUALITY_WARN_RESOLUTION,$r as DashboardIconSvg,sC as DatePicker,gC as DateRangePicker,EC as DateRangePickerField,Ac as DateRangePickerPopUp,uC as DateRangeSelector,wC as DateTimePicker,JC as DecimalTextField,$s as DeleteDialog,ml as DeleteIconAction,Ds as Dialog,tC as DialogSelect,ZC as DownloadAction,fl as DownloadIconAction,El as DownloadPrintAction,jn as DownloadSvg,lc as Drawer,Il as EditIconAction,el as EmployeeManagementDarkSvg,tl as EmployeeReportsDarkSvg,cr as ExitIcon,kl as ExportIconAction,Dl as FacebookCircularProgress,HC as FileNames,UC as FilePreview,Os as FilePreviewContainer,TC as FileUpload,Sl as FilterIconAction,Ec as FilterList,mc as FilterListV2,as as FilterPill,Cs as FilterPillV2,pc as FilterPopUpDateRangeWrapper,dc as FilterPopup,hc as FilterPopupWrapper,fc as FilterTypeWrapper,lr as FormAction,Ln as FormActionButton,Ts as FormContainer,js as FormGridLayout,qs as FormRow,zs as FormSection,_s as GridProvider,dl as GroupIcon,Ic as HighlightedText,wl as HistoryIconAction,Pr as HolidayCalendarSvg,il as HomePageBanner,iA as ImageUpload,oA as ImageUploadView,ar as ImportExcelSuccessIcon,Bl as ImportIconAction,hr as InboxIcon,xl as InboxIconAction,kc as Indicator,cA as JPEG_COMPRESS_QUALITY,bl as KeyBoardIconAction,nA as LOGO_ACCEPTED_TYPES,rA as LOGO_ACCEPT_ATTRIBUTE,lA as LOGO_EXTENSION_MIME_MAP,ed as LOGO_SIZE_TOKENS,uA as LOGO_VARIANT_SIZES,sr as LeaveIcon,lC as LeftArrowIcon,Cl as LikeIcon,os as LineChart,pd as ListItemButton,Aa as LoadingCell,Hl as LoadingOverlay,Cr as LoanIcon,pr as LogoIcon,cd as LogoPicker,ad as LogoViewDialog,qc as MAX_LIST_HEIGHT,Wn as MasterIcon,Xs as MasterPageLayout,ol as MiscellaneousManagementDarkSvg,vo as NavigationKeyProvider,yo as NavigationRouterProvider,gr as NoDataFoundSvg,Kl as NoDataOverlay,Rh as Node,jc as OPTION_ROW_HEIGHT,Ar as OvertimeIcon,gA as PRIMARY_SIZE_BY_RATIO,Rl as PadBox,wc as Pagination,Ed as PasswordField,nl as PayrollManagementDarkSvg,rl as PayrollReportDarkSvg,Sd as PhoneInputField,$C as PhotoCaptureDialog,rs as PieChart,Bc as PrintDownloadActions,Ql as ProcessIconAction,xa as ProfileCard,Qa as ProfileCardBody,Ma as ProfileCardHeader,xd as RadioGroupField,Jd as Rating,da as RedirectionCell,aC as RightArrowIcon,zc as SELECT_ALL_VALUE,xc as SMART_FIELD_INPUT_CLASS,RC as SUPPORTED_DOC_FORMATS,LC as SUPPORTED_EXCEL_FORMATS,Vo as SUPPORTED_FILE_TYPES,bC as SUPPORTED_IMAGE_FORMATS,vC as SUPPORTED_PDF_FORMATS,dr as SalaryIcon,eC as SaveDialog,bd as SearchField,yd as Select,qn as SettingIcon,Sc as SeverityIndicator,Cc as SideDrawer,ah as SmartAutoCompleteField,Kc as SmartCurrencyField,Yc as SmartDialogSelect,ch as SmartGridActionCell,qd as SmartLink,Tc as SmartSelectField,Ch as SmartTextField,dh as SmartTextFieldV2,Uc as SmartTooltip,Rn as SplitButton,hh as Stepper,mh as StepperV2,fh as StepperV3,vd as StickySearchField,ur as SvgAccessDenied,zn as SvgAccount,mr as SvgAdd,fr as SvgAddRounded,Un as SvgArrival,On as SvgBankConfig,Kr as SvgBranches,Er as SvgCalendar,Ir as SvgColumn,Pn as SvgConfiguration,kr as SvgConfigure,ll as SvgCurrentLocation,Sr as SvgDelete,Zn as SvgDeparture,or as SvgDevices,wr as SvgDownload,Br as SvgDrop,br as SvgEdit,Gr as SvgEmail,nr as SvgEmployeeOnboarding,Nn as SvgEmployees,ir as SvgEngage,xr as SvgExport,Mr as SvgFilterList,Qr as SvgFilteredList,Jr as SvgHistory,Dn as SvgHoliday,vr as SvgHome,Rr as SvgImport,Yr as SvgIndicator,Lr as SvgKeyBoard,Hn as SvgLeaveCalendar,Xn as SvgLetteremplate,yr as SvgNoLogo,Fr as SvgNoSign,_n as SvgOrganization,Ur as SvgPageNotFound,$n as SvgPayroll,Vr as SvgPhone,Zr as SvgProfile,Dr as SvgReGenerate,er as SvgStock,rr as SvgTeam,tr as SvgTransaction,Kn as SvgUnverifieduser,Gn as SvgUser,Yn as SvgVerifiedUser,Hr as SvgView,Vn as SvgWeekoffCalendar,Ud as SwitchField,wh as Tab,xh as TabBar,Sh as Tabs,Bh as TabsMenus,fd as TextField,kn as Theme,Dd as TimeField,Kd as TimePicker,bh as Timeline,gs as Toaster,cl as Tooltip,Fh as Tree,Zh as UserProfileMenu,Wc as VIRTUALIZE_THRESHOLD,Ml as ViewDetailsIconAction,DC as ViewFilePreviewDialog,Jl as ViewIconAction,An as accessorFnRegex,Bn as appTheme,la as calculateSummaryRow,un as colorPaletteUI,rC as dateFormats,Vl as defaultPageSize,od as detectLogoShape,Ko as downloadFile,Yo as downloadPrintHtml,sn as emailRegex,Oo as errorMessages,VC as error_with_transaltion,ha as extractPrefixedValue,La as extractSortValue,zo as filterByFields,_c as filterOptionsByQuery,ea as flattenColumns,Uo as formatDate,uc as formatFilterData,Ho as formatHours,Jh as getArrowValue,Mo as getColorByVariant,id as getDefaultPreviewLimits,Do as getDifferenceInHHmmss,td as getEditFrameSize,Po as getErrorProps,gc as getFormValue,$c as getInitialHighlightIndex,nd as getLogoFrameSize,aA as getLogoMimeFromFileName,Fa as getNextSortDirection,Oc as getOptionLabelText,Pc as getOptionValueText,Sn as getPaletteByTheme,Lc as getSmartFieldInputStyles,bc as getSmartFieldPlaceholderColor,Rc as getSmartFieldPlaceholderCss,Jc as getSmartFieldSizeConfig,vc as getSmartFieldTextColor,yc as getSmartFieldWrapperStyles,Jo as getStatusLabel,Zo as getTimeInHHmm,EA as getVariantsForAspectRatio,Wo as getZIndex,cn as highlightWordsRegex,qo as hslToRgb,dn as hslaRegex,To as isFileSizeValid,FC as isFileType,jo as isFileTypeValid,sA as isLogoAcceptedType,Nc as isSelectAllOption,Za as isSelectionDisabled,Ua as isSortingEnabled,IA as isSvgFile,ln as isoDateRegex,rd as loadImageNaturalSize,rn as monthYearRegex,an as noSpecialCharacterRegex,Xc as normalizeToStringArray,hn as numericRegex,Tl as pageSizeOptions,Xo as parseCellValue,No as parseNumericValue,MC as predefinedOptions,Qo as serverityOptions,Yl as showNoRowsOverlay,ya as sortTableData,Cn as timeRegex,Is as toasts,xn as urlToNestedObject,ql as useAgGridCheckBoxSelection,zl as useAgGridFilteredData,Nl as useAgGridKeyboardShortcuts,Xl as useAgGridRowSelectionConfig,Ca as useAgGridSelection,aa as useAgGridSummaryRow,sa as useAgGridSummaryRowUpdate,_o as useDialogActions,$o as useFormFieldFocus,en as useGetDeviceType,tn as useGlobalKeyboardShortcut,Ro as useNavigationKeyContext,Fo as useNavigationRouter,nn as useParseHref,Da as useSorting,on as useZoomLevel};
24
24
  //# sourceMappingURL=index.esm.js.map