{"version":3,"file":"NotificationService.mjs","names":["ref","NotificationSize","NotificationService","_classCallCheck","_defineProperty","_createClass","key","value","open","modal","_this","notification","Promise","resolve","getNotification","close","result","NotificationGod","service","notificationService","component","props","options","reject"],"sources":["../../src/services/NotificationService.ts"],"sourcesContent":["import { Ref, ref } from \"vue\";\n\nexport enum NotificationSize {\n  sm = \"sm\",\n  md = \"md\",\n  lg = \"lg\",\n}\n\nexport type NotificationOptions = {\n  size?: NotificationSize | string;\n};\n\nexport type NotificationProps = {\n  [param: string]: any;\n};\n\nexport interface INotification {\n  component: any;\n  options?: NotificationOptions;\n  props?: NotificationProps;\n}\n\nexport class NotificationService {\n  private notification: Ref<INotification | null> = ref(null);\n  private resolve!: (value: any | PromiseLike<any>) => void;\n\n  public open<T = any>(modal: INotification): Promise<T> {\n    this.notification = ref(modal);\n    return new Promise((resolve) => {\n      this.resolve = resolve;\n    });\n  }\n\n  public getNotification(): INotification {\n    return this.notification as unknown as INotification;\n  }\n\n  public close(result: any): void {\n    if (this.resolve) {\n      this.resolve(result);\n    }\n\n    this.notification = ref(null);\n  }\n}\n\nexport class NotificationGod {\n  constructor(private service: NotificationService) {}\n\n  public open<T = any>(\n    notificationService: NotificationService | undefined | null,\n    component: any,\n    props?: NotificationProps,\n    options?: NotificationOptions\n  ): Promise<T> {\n    if (!this.service) {\n      return Promise.reject();\n    }\n    return this.service.open<T>({\n      component,\n      props,\n      options,\n    });\n  }\n}\n"],"mappings":";;;;;;;AAAA,SAAcA,GAAG,QAAQ,KAAK;AAE9B,WAAYC,gBAAgB,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAoB5B,WAAaC,mBAAmB;EAAA,SAAAA,oBAAA;IAAAC,eAAA,OAAAD,mBAAA;IAAAE,eAAA,uBACoBJ,GAAG,CAAC,IAAI,CAAC;EAAA;EAAAK,YAAA,CAAAH,mBAAA;IAAAI,GAAA;IAA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