{"version":3,"file":"ModalContext.mjs","names":[],"sources":["../../../src/context/ModalContext.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\nimport React, { useContext } from 'react';\n\nexport type ModalContextValue = {\n  close: () => void;\n  dialogId?: string;\n};\n\nexport const ModalContext = React.createContext<ModalContextValue | undefined>(undefined);\n\nexport const ModalContextProvider = ({\n  children,\n  value,\n}: PropsWithChildren<{\n  value: ModalContextValue;\n}>) => <ModalContext.Provider value={value}>{children}</ModalContext.Provider>;\n\n// Module-level so its identity is stable across renders.\nconst NO_MODAL_FALLBACK: ModalContextValue = { close: () => undefined };\n\n/**\n * Works outside a modal: `Alert`, `Prompt` and `Viewer` are usable standalone, reading only\n * `dialogId` for aria wiring, and get a no-op `close`.\n */\nexport const useModalContext = () => useContext(ModalContext) ?? NO_MODAL_FALLBACK;\n"],"mappings":";;;AAQA,IAAa,eAAe,MAAM,cAA6C,KAAA,CAAS;AAExF,IAAa,wBAAwB,EACnC,UACA,YAGK,oBAAC,aAAa,UAAd;CAA8B;CAAQ;AAAgC,CAAA;AAG7E,IAAM,oBAAuC,EAAE,aAAa,KAAA,EAAU;;;;;AAMtE,IAAa,wBAAwB,WAAW,YAAY,KAAK"}