import{r as i,c6 as q,c7 as M,c8 as S,j as k,c9 as Q,aU as b,ca as j,aQ as A,aP as D,aR as y,cb as V,cc as J,aV as B,aW as P,aX as Z,aY as F,aT as R,a1 as ee,cd as ne,ce as te}from"./index-Csef3-wA.js";function z(e){return e.substring(2).toLowerCase()}function oe(e,n){return n.documentElement.clientWidth<e.clientX||n.documentElement.clientHeight<e.clientY}function re(e){const{children:n,disableReactTree:s=!1,mouseEvent:o="onClick",onClickAway:l,touchEvent:u="onTouchEnd"}=e,g=i.useRef(!1),d=i.useRef(null),m=i.useRef(!1),v=i.useRef(!1);i.useEffect(()=>(setTimeout(()=>{m.current=!0},0),()=>{m.current=!1}),[]);const h=q(n.ref,d),f=M(a=>{const c=v.current;v.current=!1;const C=S(d.current);if(!m.current||!d.current||"clientX"in a&&oe(a,C))return;if(g.current){g.current=!1;return}let t;a.composedPath?t=a.composedPath().indexOf(d.current)>-1:t=!C.documentElement.contains(a.target)||d.current.contains(a.target),!t&&(s||!c)&&l(a)}),x=a=>c=>{v.current=!0;const C=n.props[a];C&&C(c)},E={ref:h};return u!==!1&&(E[u]=x(u)),i.useEffect(()=>{if(u!==!1){const a=z(u),c=S(d.current),C=()=>{g.current=!0};return c.addEventListener(a,f),c.addEventListener("touchmove",C),()=>{c.removeEventListener(a,f),c.removeEventListener("touchmove",C)}}},[f,u]),o!==!1&&(E[o]=x(o)),i.useEffect(()=>{if(o!==!1){const a=z(o),c=S(d.current);return c.addEventListener(a,f),()=>{c.removeEventListener(a,f)}}},[f,o]),k.jsx(i.Fragment,{children:i.cloneElement(n,E)})}function se(e={}){const{autoHideDuration:n=null,disableWindowBlurListener:s=!1,onClose:o,open:l,resumeHideDuration:u}=e,g=Q();i.useEffect(()=>{if(!l)return;function t(r){r.defaultPrevented||(r.key==="Escape"||r.key==="Esc")&&(o==null||o(r,"escapeKeyDown"))}return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}},[l,o]);const d=M((t,r)=>{o==null||o(t,r)}),m=M(t=>{!o||t==null||g.start(t,()=>{d(null,"timeout")})});i.useEffect(()=>(l&&m(n),g.clear),[l,n,m,g]);const v=t=>{o==null||o(t,"clickaway")},h=g.clear,f=i.useCallback(()=>{n!=null&&m(u??n*.5)},[n,u,m]),x=t=>r=>{const p=t.onBlur;p==null||p(r),f()},E=t=>r=>{const p=t.onFocus;p==null||p(r),h()},a=t=>r=>{const p=t.onMouseEnter;p==null||p(r),h()},c=t=>r=>{const p=t.onMouseLeave;p==null||p(r),f()};return i.useEffect(()=>{if(!s&&l)return window.addEventListener("focus",f),window.addEventListener("blur",h),()=>{window.removeEventListener("focus",f),window.removeEventListener("blur",h)}},[s,l,f,h]),{getRootProps:(t={})=>{const r=b({},j(e),j(t));return b({role:"presentation"},t,r,{onBlur:x(r),onFocus:E(r),onMouseEnter:a(r),onMouseLeave:c(r)})},onClickAway:v}}function ae(e){return A("MuiSnackbarContent",e)}D("MuiSnackbarContent",["root","message","action"]);const ie=["action","className","message","role"],ce=e=>{const{classes:n}=e;return F({root:["root"],action:["action"],message:["message"]},ae,n)},le=y(V,{name:"MuiSnackbarContent",slot:"Root",overridesResolver:(e,n)=>n.root})(({theme:e})=>{const n=e.palette.mode==="light"?.8:.98,s=J(e.palette.background.default,n);return b({},e.typography.body2,{color:e.vars?e.vars.palette.SnackbarContent.color:e.palette.getContrastText(s),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:s,display:"flex",alignItems:"center",flexWrap:"wrap",padding:"6px 16px",borderRadius:(e.vars||e).shape.borderRadius,flexGrow:1,[e.breakpoints.up("sm")]:{flexGrow:"initial",minWidth:288}})}),ue=y("div",{name:"MuiSnackbarContent",slot:"Message",overridesResolver:(e,n)=>n.message})({padding:"8px 0"}),de=y("div",{name:"MuiSnackbarContent",slot:"Action",overridesResolver:(e,n)=>n.action})({display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}),fe=i.forwardRef(function(n,s){const o=B({props:n,name:"MuiSnackbarContent"}),{action:l,className:u,message:g,role:d="alert"}=o,m=P(o,ie),v=o,h=ce(v);return k.jsxs(le,b({role:d,square:!0,elevation:6,className:Z(h.root,u),ownerState:v,ref:s},m,{children:[k.jsx(ue,{className:h.message,ownerState:v,children:g}),l?k.jsx(de,{className:h.action,ownerState:v,children:l}):null]}))});function pe(e){return A("MuiSnackbar",e)}D("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);const he=["onEnter","onExited"],ge=["action","anchorOrigin","autoHideDuration","children","className","ClickAwayListenerProps","ContentProps","disableWindowBlurListener","message","onBlur","onClose","onFocus","onMouseEnter","onMouseLeave","open","resumeHideDuration","TransitionComponent","transitionDuration","TransitionProps"],me=e=>{const{classes:n,anchorOrigin:s}=e,o={root:["root",`anchorOrigin${R(s.vertical)}${R(s.horizontal)}`]};return F(o,pe,n)},H=y("div",{name:"MuiSnackbar",slot:"Root",overridesResolver:(e,n)=>{const{ownerState:s}=e;return[n.root,n[`anchorOrigin${R(s.anchorOrigin.vertical)}${R(s.anchorOrigin.horizontal)}`]]}})(({theme:e,ownerState:n})=>{const s={left:"50%",right:"auto",transform:"translateX(-50%)"};return b({zIndex:(e.vars||e).zIndex.snackbar,position:"fixed",display:"flex",left:8,right:8,justifyContent:"center",alignItems:"center"},n.anchorOrigin.vertical==="top"?{top:8}:{bottom:8},n.anchorOrigin.horizontal==="left"&&{justifyContent:"flex-start"},n.anchorOrigin.horizontal==="right"&&{justifyContent:"flex-end"},{[e.breakpoints.up("sm")]:b({},n.anchorOrigin.vertical==="top"?{top:24}:{bottom:24},n.anchorOrigin.horizontal==="center"&&s,n.anchorOrigin.horizontal==="left"&&{left:24,right:"auto"},n.anchorOrigin.horizontal==="right"&&{right:24,left:"auto"})})}),Ce=i.forwardRef(function(n,s){const o=B({props:n,name:"MuiSnackbar"}),l=ee(),u={enter:l.transitions.duration.enteringScreen,exit:l.transitions.duration.leavingScreen},{action:g,anchorOrigin:{vertical:d,horizontal:m}={vertical:"bottom",horizontal:"left"},autoHideDuration:v=null,children:h,className:f,ClickAwayListenerProps:x,ContentProps:E,disableWindowBlurListener:a=!1,message:c,open:C,TransitionComponent:t=te,transitionDuration:r=u,TransitionProps:{onEnter:p,onExited:O}={}}=o,N=P(o.TransitionProps,he),W=P(o,ge),w=b({},o,{anchorOrigin:{vertical:d,horizontal:m},autoHideDuration:v,disableWindowBlurListener:a,TransitionComponent:t,transitionDuration:r}),U=me(w),{getRootProps:_,onClickAway:$}=se(b({},w)),[I,T]=i.useState(!0),X=ne({elementType:H,getSlotProps:_,externalForwardedProps:W,ownerState:w,additionalProps:{ref:s},className:[U.root,f]}),G=L=>{T(!0),O&&O(L)},K=(L,Y)=>{T(!1),p&&p(L,Y)};return!C&&I?null:k.jsx(re,b({onClickAway:$},x,{children:k.jsx(H,b({},X,{children:k.jsx(t,b({appear:!0,in:C,timeout:r,direction:d==="top"?"down":"up",onEnter:K,onExited:G},N,{children:h||k.jsx(fe,b({message:c,action:g},E))}))}))}))});export{re as C,Ce as S};