{"version":3,"file":"ChannelInstanceContext.mjs","names":[],"sources":["../../../src/context/ChannelInstanceContext.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\nimport React, { useContext } from 'react';\nimport type { Channel } from 'stream-chat';\n\nexport type ChannelInstanceContextValue = {\n  channel: Channel;\n};\n\nexport const ChannelInstanceContext = React.createContext<\n  ChannelInstanceContextValue | undefined\n>(undefined);\n\nexport const ChannelInstanceProvider = ({\n  children,\n  value,\n}: PropsWithChildren<{\n  value: ChannelInstanceContextValue;\n}>) => (\n  <ChannelInstanceContext.Provider value={value}>\n    {children}\n  </ChannelInstanceContext.Provider>\n);\n\n/**\n * Returns the channel provided by the nearest `Channel`, or an empty object outside one. Unlike\n * {@link useChannel}, it does not throw and does not read the thread's channel.\n */\nexport const useChannelInstanceContext = (): Partial<ChannelInstanceContextValue> =>\n  useContext(ChannelInstanceContext) ?? {};\n"],"mappings":";;;AAQA,IAAa,yBAAyB,MAAM,cAE1C,KAAA,CAAS;AAEX,IAAa,2BAA2B,EACtC,UACA,YAIA,oBAAC,uBAAuB,UAAxB;CAAwC;CACrC;AAC8B,CAAA;;;;;AAOnC,IAAa,kCACX,WAAW,sBAAsB,KAAK,CAAC"}