{"version":3,"file":"useModalContext-3b7570bc.mjs","sources":["../src/components/overlay/mt-modal/composables/useModalContext.ts"],"sourcesContent":["import { inject, type InjectionKey, type Ref } from \"vue\";\n\ninterface StateDefinition {\n  isOpen: Ref<boolean>;\n  setIsOpen: (value: boolean) => void;\n  closable: Ref<boolean>;\n}\n\nexport const DialogContext = Symbol(\"DialogContext\") as InjectionKey<StateDefinition>;\n\nexport function useModalContext(component: string) {\n  const context = inject(DialogContext, null);\n\n  if (context === null) {\n    const error = new Error(`<${component} /> is missing a parent <mt-modal-root /> component.`);\n    if (Error.captureStackTrace) Error.captureStackTrace(error, useModalContext);\n\n    throw error;\n  }\n\n  return context;\n}\n"],"names":[],"mappings":";AAQa,MAAA,gBAAgB,OAAO,eAAe;AAE5C,SAAS,gBAAgB,WAAmB;AAC3C,QAAA,UAAU,OAAO,eAAe,IAAI;AAE1C,MAAI,YAAY,MAAM;AACpB,UAAM,QAAQ,IAAI,MAAM,IAAI,SAAS,sDAAsD;AAC3F,QAAI,MAAM;AAAyB,YAAA,kBAAkB,OAAO,eAAe;AAErE,UAAA;AAAA,EACR;AAEO,SAAA;AACT;"}