"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[3861],{53861:(e,t,o)=>{o.r(t),o.d(t,{default:()=>b});var i=o(58878),s=o(8151),r=o(59900),a=o(58144),n=o(34914),l=o(3257),d=o(75577),c=o(94426),p=o(89653);const g=(0,p.A)("button",{target:"elibz2u3"})((e=>{let{theme:t}=e;return{fontSize:t.fontSizes.sm,lineHeight:t.lineHeights.base,color:t.colors.fadedText60,backgroundColor:t.colors.transparent,border:"none",boxShadow:"none",padding:"0px","&:hover, &:active, &:focus":{border:"none",outline:"none",boxShadow:"none"},"&:hover":{color:t.colors.primary}}}),""),u=(0,p.A)("div",{target:"elibz2u2"})((e=>{let{theme:t}=e;return{display:"flex",flexDirection:"row",gap:t.spacing.lg,"> span":{marginTop:t.spacing.twoXS}}}),""),f=(0,p.A)("div",{target:"elibz2u0"})((e=>{let{theme:t}=e;return{display:"flex",flexDirection:"column",gap:t.spacing.sm,alignItems:"start",justifyContent:"center",overflow:"hidden",minHeight:"100%",fontSize:t.fontSizes.sm,lineHeight:t.lineHeights.base}}),"");var h=o(90782);const b=(0,s.b)((function(e){let{theme:t,body:o,icon:s,width:p}=e;const b=function(e){if(e.length>104){let t=e.replace(/^(.{104}[^\s]*).*/,"$1");return t.length>104&&(t=t.substring(0,104).split(" ").slice(0,-1).join(" ")),t.trim()}return e}(o),m=o!==b,[x,w]=(0,i.useState)(!m),[y,S]=(0,i.useState)(0),v=(0,i.useCallback)((()=>{w(!x)}),[x]),T=(0,i.useMemo)((()=>function(e){const t=(0,a.iq)(e);return{Body:{props:{"data-testid":"stToast",className:"stToast"},style:{display:"flex",flexDirection:"row",gap:e.spacing.md,width:e.sizes.toastWidth,marginTop:e.spacing.sm,borderTopLeftRadius:e.radii.default,borderTopRightRadius:e.radii.default,borderBottomLeftRadius:e.radii.default,borderBottomRightRadius:e.radii.default,paddingTop:e.spacing.lg,paddingBottom:e.spacing.lg,paddingLeft:e.spacing.twoXL,paddingRight:e.spacing.twoXL,backgroundColor:t?e.colors.gray10:e.colors.gray90,color:e.colors.bodyText,boxShadow:t?"0px 4px 16px rgba(0, 0, 0, 0.16)":"0px 4px 16px rgba(0, 0, 0, 0.7)"}},CloseIcon:{style:{color:e.colors.fadedText40,width:e.fontSizes.lg,height:e.fontSizes.lg,marginRight:`calc(-1 * ${e.spacing.lg} / 2)`,":hover":{color:e.colors.bodyText}}}}}(t)),[t]),z=(0,i.useMemo)((()=>(0,h.jsxs)(u,{expanded:x,children:[s&&(0,h.jsx)(c.$,{iconValue:s,size:"xl",testid:"stToastDynamicIcon"}),(0,h.jsxs)(f,{children:[(0,h.jsx)(n.Ay,{source:x?o:b,allowHTML:!1,isToast:!0}),m&&(0,h.jsx)(g,{"data-testid":"stToastViewButton",onClick:v,children:x?"view less":"view more"})]})]})),[m,x,o,s,b,v]);(0,i.useEffect)((()=>{if(t.inSidebar)return;const e=r.A.info(z,{overrides:{...T}});return S(e),()=>{r.A.update(e,{overrides:{Body:{style:{transitionDuration:0}}}}),r.A.clear(e)}}),[]),(0,i.useEffect)((()=>{r.A.update(y,{children:z,overrides:{...T}})}),[y,z,T]);const A=(0,h.jsx)(d.A,{kind:l.b.ERROR,body:"Streamlit API Error: `st.toast` cannot be called directly on the sidebar with `st.sidebar.toast`. See our `st.toast` API [docs](https://docs.streamlit.io/develop/api-reference/status/st.toast) for more information.",width:p});return(0,h.jsx)(h.Fragment,{children:t.inSidebar&&A})}))}}]);