{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAsBM,MAAM,0DAAiB,CAAA,GAAA,oBAAY,EAAE;AAErC,SAAS,0CAAQ,KAA0B;IAChD,IAAI,YAAC,QAAQ,SAAE,KAAK,EAAC,GAAG;IAExB,IAAI,MAAM,CAAA,GAAA,aAAK,EAAE;IACjB,IAAI,eAAC,WAAW,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE,OAAO,OAAO;IACjD,IAAI,cAAC,UAAU,kBAAE,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW;IAC9C,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,8BAAsB;IAE3C,IAAI,CAAC,UAAU,UAAU,GAAG,CAAA,GAAA,cAAM,EAAE;QAClC,IAAI,CAAC,MAAM,QAAQ,EAAE,QAAQ,QAAQ,CAAC,GAAG,MAAM,SAAS,EAAE,MAAM,QAAQ,EAAE;QAC1E,OAAO;YAAC;YAAK;SAAM;IACrB,GAAG;QAAC,MAAM,SAAS;KAAC;IAEpB,IAAI,yBACF,gCAAC,CAAA,GAAA,yCAAO;QAAE,cAAc;YAAC,YAAY;QAAa;qBAChD,gCAAC,CAAA,GAAA,iBAAS,uBACR,gCAAC,0CAAe,QAAQ;QAAC,OAAO;qBAC9B,gCAAC;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,aAAa,WAAW;QACvC,KAAK;QACL,iBAAe;QACf,kBAAgB;QAChB,WAAW,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,sDAAmB,GAAG,iCAAiC;YAC3E,cAAc;QAChB;OACC;IAOX,qBAAO,CAAA,GAAA,eAAO,EAAE,YAAY,CAAC,UAAU,oBAAoB,SAAS,IAAI;AAC1E","sources":["packages/@adobe/react-spectrum/src/toast/Toaster.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaToastRegionProps, useToastRegion} from 'react-aria/useToast';\n\nimport {classNames} from '../utils/classNames';\nimport {FocusScope} from 'react-aria/FocusScope';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {Provider} from '../provider/Provider';\nimport React, {createContext, ReactElement, ReactNode, useMemo, useRef} from 'react';\nimport ReactDOM from 'react-dom';\nimport toastContainerStyles from './toastContainer.css';\nimport type {ToastPlacement} from './ToastContainer';\nimport {ToastState} from 'react-stately/useToastState';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useUNSAFE_PortalContext} from 'react-aria/PortalProvider';\n\ninterface ToastContainerProps extends AriaToastRegionProps {\n  children: ReactNode;\n  state: ToastState<unknown>;\n  placement?: ToastPlacement;\n}\n\nexport const ToasterContext = createContext(false);\n\nexport function Toaster(props: ToastContainerProps): ReactElement {\n  let {children, state} = props;\n\n  let ref = useRef(null);\n  let {regionProps} = useToastRegion(props, state, ref);\n  let {focusProps, isFocusVisible} = useFocusRing();\n  let {getContainer} = useUNSAFE_PortalContext();\n\n  let [position, placement] = useMemo(() => {\n    let [pos = 'bottom', place = 'center'] = props.placement?.split(' ') || [];\n    return [pos, place];\n  }, [props.placement]);\n\n  let contents = (\n    <Provider UNSAFE_style={{background: 'transparent'}}>\n      <FocusScope>\n        <ToasterContext.Provider value={isFocusVisible}>\n          <div\n            {...mergeProps(regionProps, focusProps)}\n            ref={ref}\n            data-position={position}\n            data-placement={placement}\n            className={classNames(toastContainerStyles, 'react-spectrum-ToastContainer', {\n              'focus-ring': isFocusVisible\n            })}>\n            {children}\n          </div>\n        </ToasterContext.Provider>\n      </FocusScope>\n    </Provider>\n  );\n\n  return ReactDOM.createPortal(contents, getContainer?.() ?? document.body);\n}\n"],"names":[],"version":3,"file":"Toaster.mjs.map"}