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,0QA/CxGA,iCAAuC,sBAAvCA,CAAuC,cAGkDA,SACpEA,UAEnBA,6BAEEA,uBACFA,QACAA,kCAqBAA,kCAqBFA,8BAnDmBA,wCAEPA,qFAA6EA,8CAGtEA,qEAAsE,kHAIxEA,sEAqBAA,wECpBX,MAAOiI,EAIX9H,YAAmBqF,EAAuBkB,GAAvBlG,cAAuBA,yBAHdA,iBAAa,CAGwC,CAACyE,kDAJvEgD,GAA8BC,8DAA9BD,EAA8B9C,qVDX3CnF,+CAAwBA,wSEUtBiI,IACAxB,IACAlB,IACAtF,IAOI,MAAOkI,EAAoBlD,kDAApBkD,EAAoB,sCAApBA,IAAoBlD,wCAJrBmD","names":["collaboratorType","i0","AddCollaboratorsDialogComponent","BaseModal","constructor","apiService","toastMessagesService","dialogData","super","this","Subject","project","ngOnInit","loadCollaboratorsAndInvitations","isOwner","auth","user","searchSub$","pipe","debounceTime","subscribe","searchKey","filterCollaborators","onSearch","next","onDelete","collaborator","projects","deleteRel","id","relation","relationId","_","collaborators","splice","findIndex","c","show","title","message","fullName","type","EToastMessageType","collaboratorsSelectionChanged","collaboratorsEmails","searchCollaboratorsComponent","clearSelectedCollaboratorsList","sendInvitation","onRemovePendingInvitation","invitation","deletedIndex","item","Invitation","getInvitationStatusLabel","status","postRel","body","map","collaboratorEmail","email","apiResponse","content","filter","length","concat","filteredCollaborators","Object","assign","Collaborator","COLLABORATOR","INVITATION","toLowerCase","includes","forkJoin","getRels","size","invitations","response","closeModal","close","emit","EDialogCloseEventStatus","static","_angular_core__WEBPACK_IMPORTED_MODULE_6__","selectors","SearchCollaboratorsComponent","ctx","EAddActionType","AddNewButtonComponent","router","dialogsService","roboRxnEnabled","onAddNew","REACTION","navigate","name","REACTION_COMPLETION","RETROSYNTHESIS","dialog","open","CreateRetrosynthesisWizardDialogComponent","afterClosed","SYNTHESIS","GetRoborxnKeyDialogComponent","CreateSynthesisWizardDialogComponent","_angular_core__WEBPACK_IMPORTED_MODULE_5__","ProjectHeaderActionsMenuComponent","appSessionService","loaderService","onManageCollaborators","closeEvent","onDeleteProject","OkCancelDialogComponent","okText","cancelText","okButtonType","delete","projectsFavoritesChanges","onRenameProject","RenameDialogComponent","label","tap","switchMap","patch","data","isBodyRaw","finalize","hide","setCurrentProject","_angular_core__WEBPACK_IMPORTED_MODULE_8__","ProjectHeaderMainMenuComponent","_angular_core__WEBPACK_IMPORTED_MODULE_2__","ProjectsSharedModule","SharedModule"],"sourceRoot":"webpack:///","sources":["./src/app/modules/projects/projects-shared/add-collaborators-dialog/add-collaborators-dialog.component.ts","./src/app/modules/projects/projects-shared/add-collaborators-dialog/add-collaborators-dialog.component.html","./src/app/modules/projects/projects-shared/add-new-button/add-new-button.component.html","./src/app/modules/projects/projects-shared/add-new-button/add-new-button.component.ts","./src/app/modules/projects/projects-shared/project-header-actions-menu/project-header-actions-menu.component.html","./src/app/modules/projects/projects-shared/project-header-actions-menu/project-header-actions-menu.component.ts","./src/app/modules/projects/projects-shared/project-header-main-menu/project-header-main-menu.component.html","./src/app/modules/projects/projects-shared/project-header-main-menu/project-header-main-menu.component.ts","./src/app/modules/projects/projects-shared/projects-shared.module.ts"],"sourcesContent":["import { Component, Inject, OnInit, ViewChild } from '@angular/core';\nimport { Collaborator, Invitation, Project } from '@app/core/models';\nimport { ApiService, ToastMessagesService } from '@app/core/services';\nimport { EDialogCloseEventStatus } from '@app/core/services/dialog/dialog.enum';\nimport { IDialogCloseEvent } from '@app/core/services/dialog/dialog.interface';\nimport { EToastMessageType } from '@app/core/services/toast-messages/toast-message.enum';\nimport { IApiResponse } from '@app/libs/bitforce/api';\nimport { SearchCollaboratorsComponent } from '@app/shared/components/search-collaborators/search-collaborators.component';\nimport { BaseModal } from 'carbon-components-angular';\nimport { forkJoin, Subject } from 'rxjs';\nimport { debounceTime } from 'rxjs/operators';\n\nenum collaboratorType {\n  COLLABORATOR = 'collaborator',\n  INVITATION = 'invitation',\n}\n\n@Component({\n  selector: 'ibm-add-collaborators-dialog',\n  templateUrl: './add-collaborators-dialog.component.html',\n  styleUrls: ['./add-collaborators-dialog.component.scss'],\n})\nexport class AddCollaboratorsDialogComponent extends BaseModal implements OnInit {\n  @ViewChild(SearchCollaboratorsComponent) searchCollaboratorsComponent: SearchCollaboratorsComponent;\n  project: Project;\n\n  private collaborators: (Collaborator | Invitation)[] = [];\n  private searchSub$ = new Subject<string>();\n\n  filteredCollaborators: ((Collaborator | Invitation) & { type: collaboratorType })[];\n  isOwner = false;\n  collaboratorsToInvite: Invitation[] = [];\n\n  constructor(\n    private apiService: ApiService,\n    private toastMessagesService: ToastMessagesService,\n    @Inject('dialogData') public dialogData: { project: Project }\n  ) {\n    super();\n    this.project = this.dialogData.project;\n  }\n\n  ngOnInit() {\n    this.loadCollaboratorsAndInvitations();\n    this.isOwner = this.project.isOwner(this.apiService.auth.user);\n    this.searchSub$.pipe(debounceTime(300)).subscribe(searchKey => this.filterCollaborators(searchKey));\n  }\n\n  onSearch(searchKey: string) {\n    this.searchSub$.next(searchKey);\n  }\n\n  onDelete(collaborator: Collaborator) {\n    this.apiService.projects\n      .deleteRel({\n        id: this.project.id,\n        relation: 'collaborators',\n        relationId: collaborator.id,\n      })\n      .subscribe(\n        _ => {\n          this.collaborators.splice(\n            this.collaborators.findIndex(c => c.id === collaborator.id),\n            1\n          );\n          this.loadCollaboratorsAndInvitations();\n        },\n        _ => {\n          this.toastMessagesService.show({\n            title: 'Error',\n            // eslint-disable-next-line max-len\n            message: `An error occurred during removing collaborator ${collaborator.user.fullName} from project`,\n            type: EToastMessageType.ERROR,\n          });\n        }\n      );\n  }\n\n  collaboratorsSelectionChanged(collaboratorsEmails: string[]) {\n    this.searchCollaboratorsComponent.clearSelectedCollaboratorsList();\n    this.sendInvitation(collaboratorsEmails);\n  }\n\n  onRemovePendingInvitation(invitation: Invitation) {\n    const deletedIndex = this.collaborators.findIndex(\n      item => item instanceof Invitation && item.id === invitation.id\n    );\n    if (deletedIndex >= 0) {\n      this.collaborators.splice(deletedIndex, 1);\n    }\n    this.apiService.projects\n      .deleteRel({\n        id: this.project.id,\n        relation: 'invitations',\n        relationId: invitation.id,\n      })\n      .subscribe(() => {\n        this.loadCollaboratorsAndInvitations();\n      });\n  }\n\n  getInvitationStatusLabel(invitation: Invitation) {\n    switch (invitation.status) {\n      case 'ERROR':\n        return 'Error';\n      case 'ACCEPTED':\n        return 'Accepted';\n      case 'WAITING':\n      case 'PENDING':\n      default:\n        return 'Pending';\n    }\n  }\n\n  sendInvitation(collaboratorsEmails) {\n    this.apiService.projects\n      .postRel<Invitation[]>({\n        id: this.project.id,\n        relation: 'invitations',\n        body: collaboratorsEmails.map(\n          (collaboratorEmail: string) => new Invitation({ email: collaboratorEmail })\n        ),\n      })\n      .subscribe(\n        (apiResponse: IApiResponse<Invitation[]>) => {\n          const invitations = apiResponse.content.filter(item => !!item.id);\n\n          if (invitations.length > 0) {\n            this.toastMessagesService.show({\n              title: 'Success',\n              message: `Collaborators has been invited`,\n              type: EToastMessageType.SUCCESS,\n            });\n            this.searchCollaboratorsComponent.clearSelectedCollaboratorsList();\n            this.collaborators = this.collaborators.concat(apiResponse.content);\n            this.filterCollaborators();\n          }\n        },\n        _ => {\n          this.toastMessagesService.show({\n            title: 'Error',\n            message: `An error occurred during sending invitations`,\n            type: EToastMessageType.ERROR,\n          });\n        }\n      );\n  }\n\n  private filterCollaborators(searchKey?: string) {\n    this.filteredCollaborators = this.collaborators\n      .map(collaborator =>\n        Object.assign({}, collaborator, {\n          type:\n            collaborator instanceof Collaborator\n              ? collaboratorType.COLLABORATOR\n              : collaboratorType.INVITATION,\n        })\n      )\n      .filter(collaborator => {\n        if (collaborator.type === collaboratorType.COLLABORATOR) {\n          return (\n            (searchKey &&\n              ((collaborator as Collaborator).user.fullName.toLowerCase().includes(searchKey.toLowerCase()) ||\n                (collaborator as Collaborator).user.email.toLowerCase().includes(searchKey.toLowerCase()))) ||\n            !searchKey\n          );\n        } else if (collaborator.type === collaboratorType.INVITATION) {\n          return (\n            (searchKey &&\n              (collaborator as Invitation).email.toLowerCase().includes(searchKey.toLowerCase())) ||\n            !searchKey\n          );\n        }\n      });\n  }\n\n  private loadCollaboratorsAndInvitations() {\n    forkJoin({\n      collaborators: this.apiService.projects.getRels<Collaborator>({\n        relation: 'collaborators',\n        id: this.project?.id,\n        size: 1000,\n      }),\n      invitations: this.apiService.projects.getRels<Invitation>({\n        relation: 'invitations',\n        id: this.project?.id,\n        size: 1000,\n      }),\n    }).subscribe(\n      response => {\n        this.collaborators = []\n          .concat(response.collaborators.content)\n          .concat(response.invitations.content.filter(item => item.status !== 'ACCEPTED'));\n        this.filterCollaborators();\n      },\n      _ => {\n        this.toastMessagesService.show({\n          title: 'Error',\n          message: 'An error occurred while retrieving collaborators.',\n          type: EToastMessageType.ERROR,\n        });\n      }\n    );\n  }\n\n  closeModal() {\n    this.close.emit({\n      status: EDialogCloseEventStatus.CANCEL,\n    } as IDialogCloseEvent<void>);\n  }\n}\n","<ibm-modal [open]=\"open\">\n  <ibm-modal-header (closeSelect)=\"closeModal()\">\n    <h3 ibmModalHeaderHeading>Manage collaborators</h3>\n  </ibm-modal-header>\n  <div ibmModalContent>\n    <div class=\"mb-7\"\n      *ngIf=\"isOwner\">\n      <div class=\"mb-5 small--xs\">\n        Add collaborators typing their name or invite them via email\n      </div>\n      <ibm-search-collaborators (collaboratorsSelectionChange)=\"collaboratorsSelectionChanged($event)\">\n      </ibm-search-collaborators>\n    </div>\n    <div class=\"bx--toolbar justify-content-between pb-5 collaborators-list-title mb-0\">\n      <div class=\"table-title\">People collaborating on this project</div>\n      <div class=\"overflow-hidden\">\n        <ibm-search placeholder=\"search\"\n          size=\"sm\"\n          (valueChange)=\"onSearch($event)\"\n          toolbar=\"true\"></ibm-search>\n      </div>\n    </div>\n    <ibm-structured-list *ngIf=\"filteredCollaborators\"\n      [condensed]=\"true\">\n      <ibm-list-row *ngFor=\"let collaborator of filteredCollaborators\"\n        class=\"collaborator-row\">\n        <ng-template [ngIf]=\"collaborator.type === 'collaborator'\">\n          <ibm-list-column class=\"v-align-middle avatar-column pr-5\">\n            <div class=\"d-flex align-items-center\">\n              <div class=\"avatar-container d-flex align-items-center mr-5\">\n                <div class=\"avatar\"\n                  [ibmBackgroundAvatar]=\"collaborator.user.picture\"\n                  [title]=\"collaborator.user.fullName\"></div>\n              </div>\n              {{ collaborator.user.fullName }}\n            </div>\n          </ibm-list-column>\n          <ibm-list-column class=\"v-align-middle small--xs\">\n            <span *ngIf=\"collaborator.owner\">Owner</span>\n            <span *ngIf=\"!collaborator.owner\">Collaborator</span>\n          </ibm-list-column>\n          <ibm-list-column class=\"v-align-middle actions-column\">\n            <button class=\"bx--btn bx--btn--ghost\"\n              type=\"button\"\n              title=\"Remove\"\n              (click)=\"onDelete(collaborator)\"\n              *ngIf=\"!collaborator.owner && isOwner\">\n              <svg icon\n                ibmIconDelete\n                class=\"icon-fill-danger\"\n                size=\"16\"></svg>\n            </button>\n          </ibm-list-column>\n        </ng-template>\n\n        <ng-template [ngIf]=\"collaborator.type === 'invitation'\">\n          <ibm-list-column class=\"v-align-middle\">\n            <div class=\"d-flex align-items-center\">\n              <div class=\"avatar-container d-flex align-items-center mr-5\">\n                <svg icon\n                  ibmIconEmail\n                  size=\"16\"></svg>\n              </div>\n              {{ collaborator.email }}\n            </div>\n          </ibm-list-column>\n          <ibm-list-column class=\"v-align-middle small--xs\"\n            [class.text-danger]=\"collaborator.status === 'ERROR'\">\n            {{ getInvitationStatusLabel(collaborator) }}\n          </ibm-list-column>\n          <ibm-list-column class=\"v-align-middle actions-column\">\n            <button class=\"bx--btn bx--btn--ghost py-0 px-5\"\n              type=\"button\"\n              title=\"Remove\"\n              (click)=\"onRemovePendingInvitation(collaborator)\"\n              *ngIf=\"collaborator.isDeletable && isOwner\">\n              <svg icon\n                ibmIconDelete\n                class=\"icon-fill-danger\"\n                size=\"16\"></svg>\n            </button>\n          </ibm-list-column>\n        </ng-template>\n      </ibm-list-row>\n    </ibm-structured-list>\n    <div *ngIf=\"filteredCollaborators && filteredCollaborators.length === 0\"\n      class=\"text-center\">\n      No collaborators or invitations found.\n    </div>\n    <ibm-skeleton-text *ngIf=\"!filteredCollaborators\"\n      [lines]=\"3\"></ibm-skeleton-text>\n  </div>\n</ibm-modal>","<button [ibmButton]=\"'primary'\"\n  [ibmOverflowMenu]=\"templateRef\"\n  [customPane]=\"true\"\n  [flip]=\"true\"\n  [offset]=\"{x: 47, y: 0}\"\n  wrapperClass=\"add-new-button__menu-container\"\n  placement=\"bottom\">\n  Add new<svg class=\"bx--btn__icon\"\n    ibmIconAdd\n    size=\"16\"></svg>\n</button>\n\n<ng-template #templateRef>\n  <ibm-overflow-menu-option [divider]=\"true\"\n    (click)=\"onAddNew(eAddActionType.REACTION)\">\n    Product prediction\n  </ibm-overflow-menu-option>\n  <ibm-overflow-menu-option [divider]=\"true\"\n    (click)=\"onAddNew(eAddActionType.RETROSYNTHESIS)\">\n    Retrosynthetic route\n  </ibm-overflow-menu-option>\n  <ibm-overflow-menu-option [divider]=\"true\"\n    (click)=\"onAddNew(eAddActionType.SYNTHESIS)\">\n    Synthesis procedures\n  </ibm-overflow-menu-option>\n  <ibm-overflow-menu-option [divider]=\"true\"\n    (click)=\"onAddNew(eAddActionType.REACTION_COMPLETION)\">\n    Reagents prediction\n  </ibm-overflow-menu-option>\n</ng-template>","import { Component, Input, OnInit } from '@angular/core';\nimport { Router } from '@angular/router';\n\nimport { ApiService, DialogsService } from '@services';\nimport { Project } from '@models';\n\nimport { CreateRetrosynthesisWizardDialogComponent } from '@app/shared/components/create-retrosynthesis-wizard-dialog/create-retrosynthesis-wizard-dialog.component';\nimport { CreateSynthesisWizardDialogComponent } from '@app/shared/components/create-synthesis-wizard-dialog/create-synthesis-wizard-dialog.component';\nimport { GetRoborxnKeyDialogComponent } from '@app/shared/components/get-roborxn-key/get-roborxn-key-dialog.component';\n\nenum EAddActionType {\n  REACTION = 'reaction',\n  RETROSYNTHESIS = 'retrosynthesis',\n  SYNTHESIS = 'synthesis',\n  REACTION_COMPLETION = 'reaction-completion',\n}\n@Component({\n  selector: 'ibm-add-new-button',\n  templateUrl: './add-new-button.component.html',\n  styleUrls: ['./add-new-button.component.scss'],\n})\nexport class AddNewButtonComponent implements OnInit {\n  @Input() project: Project;\n  eAddActionType = EAddActionType;\n  roboRxnEnabled: boolean;\n\n  constructor(\n    private router: Router,\n    private dialogsService: DialogsService,\n    private apiService: ApiService\n  ) {}\n\n  ngOnInit(): void {\n    this.roboRxnEnabled = this.apiService.auth.user.roboRxnEnabled;\n  }\n\n  onAddNew(type: EAddActionType) {\n    switch (type) {\n      case EAddActionType.REACTION:\n        this.router.navigate([\n          'projects',\n          this.project.id,\n          this.project.name,\n          'workspace',\n          'forward-reaction-prediction',\n        ]);\n        break;\n      case EAddActionType.REACTION_COMPLETION:\n        this.router.navigate([\n          'projects',\n          this.project.id,\n          this.project.name,\n          'reaction-completions',\n          'create',\n        ]);\n        break;\n      case EAddActionType.RETROSYNTHESIS:\n        this.dialogsService.dialog\n          .open(CreateRetrosynthesisWizardDialogComponent, { project: this.project })\n          .afterClosed()\n          .subscribe();\n        break;\n      case EAddActionType.SYNTHESIS:\n        if (!this.roboRxnEnabled) {\n          this.dialogsService.dialog\n            .open(GetRoborxnKeyDialogComponent, {})\n            .afterClosed()\n            .subscribe();\n          return;\n        }\n        this.dialogsService.dialog\n          .open(CreateSynthesisWizardDialogComponent, { project: this.project })\n          .afterClosed()\n          .subscribe();\n        break;\n    }\n  }\n}\n","<ibm-overflow-menu [flip]=\"true\"\n  wrapperClass=\"project-header-actions-menu\"\n  *ngIf=\"project && isOwner\">\n  <ibm-overflow-menu-option (selected)=\"onManageCollaborators()\">\n    Manage collaborators\n  </ibm-overflow-menu-option>\n  <ibm-overflow-menu-option (selected)=\"onRenameProject()\">\n    Rename project\n  </ibm-overflow-menu-option>\n  <ibm-overflow-menu-option type=\"danger\"\n    [divider]=\"true\"\n    (selected)=\"onDeleteProject()\">\n    Delete Project\n  </ibm-overflow-menu-option>\n</ibm-overflow-menu>","import { Component, Input, OnInit } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { filter, finalize, switchMap, tap } from 'rxjs/operators';\n\nimport { LoaderService } from '@app/libs/bitforce/components';\nimport { IApiResponse } from '@app/libs/bitforce/api';\n\nimport { Project } from '@app/core/models';\nimport { ApiService, AppSessionService, DialogsService, ToastMessagesService } from '@services';\nimport { IDialogCloseEvent, IOkCancelDialogData } from '@services/dialog/dialog.interface';\nimport { EDialogCloseEventStatus } from '@services/dialog/dialog.enum';\nimport { EToastMessageType } from '@services/toast-messages/toast-message.enum';\nimport { OkCancelDialogComponent } from '@app/shared/components/ok-cancel-dialog/ok-cancel-dialog.component';\nimport { AddCollaboratorsDialogComponent } from '../add-collaborators-dialog/add-collaborators-dialog.component';\nimport { RenameDialogComponent } from '@app/shared/components/rename-dialog/rename-dialog.component';\n\n@Component({\n  selector: 'ibm-project-header-actions-menu',\n  templateUrl: './project-header-actions-menu.component.html',\n  styleUrls: ['./project-header-actions-menu.component.scss'],\n})\nexport class ProjectHeaderActionsMenuComponent implements OnInit {\n  @Input() project: Project;\n  isOwner = false;\n\n  constructor(\n    private dialogsService: DialogsService,\n    private toastMessagesService: ToastMessagesService,\n    private apiService: ApiService,\n    private router: Router,\n    private appSessionService: AppSessionService,\n    private loaderService: LoaderService\n  ) {}\n\n  ngOnInit(): void {\n    this.isOwner = this.project.isOwner(this.apiService.auth.user);\n  }\n\n  onManageCollaborators() {\n    this.dialogsService.dialog\n      .open(AddCollaboratorsDialogComponent, { project: this.project })\n      .afterClosed()\n      .subscribe((closeEvent: IDialogCloseEvent<void>) => {\n        if (closeEvent.status !== EDialogCloseEventStatus.OK) {\n          return;\n        }\n      });\n  }\n\n  onDeleteProject() {\n    this.dialogsService.dialog\n      .open(OkCancelDialogComponent, {\n        title: 'Are you sure you want to delete the project?',\n        // eslint-disable-next-line max-len\n        message: `You'll delete all the attempts and reaction collections, all collaborators will loose the access to the project`,\n        okText: 'Delete',\n        cancelText: 'Cancel',\n        okButtonType: 'danger--primary',\n      } as IOkCancelDialogData)\n      .afterClosed()\n      .subscribe((closeEvent: IDialogCloseEvent<void>) => {\n        if (closeEvent.status === EDialogCloseEventStatus.OK) {\n          this.apiService.projects.delete(this.project).subscribe(\n            _ => {\n              this.toastMessagesService.show({\n                title: 'Project delete',\n                message: 'Project has been deleted',\n                type: EToastMessageType.SUCCESS,\n              });\n              // reload favorite projects\n              this.appSessionService.projectsFavoritesChanges.next();\n              this.router.navigate(['projects', 'list']);\n            },\n            () => {\n              this.toastMessagesService.show({\n                title: 'Project delete',\n                message: 'Error on project delete',\n                type: EToastMessageType.ERROR,\n              });\n            }\n          );\n        }\n      });\n  }\n\n  onRenameProject() {\n    this.dialogsService.dialog\n      .open(RenameDialogComponent, {\n        title: 'Rename Project',\n        label: 'Change the project name',\n        name: this.project.name,\n      })\n      .afterClosed()\n      .pipe(\n        filter((closeEvent: IDialogCloseEvent<string>) => closeEvent.status === EDialogCloseEventStatus.OK),\n        tap(_ => this.loaderService.show()),\n        switchMap((closeEvent: IDialogCloseEvent<string>) =>\n          this.apiService.projects.patch<Project>({\n            body: {\n              id: this.project.id,\n              name: closeEvent.data,\n            },\n            isBodyRaw: true,\n          })\n        ),\n        finalize(() => this.loaderService.hide())\n      )\n      .subscribe(\n        (response: IApiResponse<Project>) => {\n          this.toastMessagesService.show({\n            title: 'Rename project',\n            message: 'Project has been renamed',\n            type: EToastMessageType.SUCCESS,\n          });\n\n          // reload favorite projects\n          this.appSessionService.projectsFavoritesChanges.next();\n\n          this.project.name = response.content.name;\n          this.appSessionService.setCurrentProject(this.project);\n\n          this.router.navigate(['projects', this.project.id, this.project.name, 'dashboard']);\n        },\n        () => {\n          this.toastMessagesService.show({\n            title: 'Rename project - failed',\n            message: 'Project has not been renamed',\n            type: EToastMessageType.ERROR,\n          });\n        }\n      );\n  }\n}\n","<ibm-header-navigation *ngIf=\"project\">\n  <ibm-header-item [routerLink]=\"[]\"\n    class=\"no-link\">\n    <strong [ngClass]=\"{'name-ellipsis': !appSessionService.activeBreakpoints.isXLarge}\">Project: {{\n      project.name }}</strong>\n  </ibm-header-item>\n  <ibm-header-item [routerLink]=\"['/','projects', project.id, project.name, 'dashboard']\"\n    [isCurrentPage]=\"router.isActive(router.createUrlTree(['/','projects', project.id, project.name, 'dashboard']).toString(), true)\">\n    Dashboard\n  </ibm-header-item>\n  <ng-container *ngIf=\"appSessionService.activeBreakpoints.isXLarge\">\n    <ibm-header-item [routerLink]=\"['/','projects', project.id, project.name, 'forward-reaction-predictions']\"\n      [isCurrentPage]=\"router.isActive(router.createUrlTree(['/','projects', project.id, project.name, 'forward-reaction-predictions']).toString(), true)\">\n      Product predictions\n    </ibm-header-item>\n    <ibm-header-menu title=\"Synthesis planning\">\n      <ibm-header-item [routerLink]=\"['/','projects', project.id, project.name, 'retrosynthesis']\"\n        [isCurrentPage]=\"router.isActive(router.createUrlTree(['/','projects', project.id, project.name, 'retrosynthesis']).toString(), true)\">\n        Retrosynthetic routes</ibm-header-item>\n      <ibm-header-item [routerLink]=\"['/','projects', project.id, project.name, 'synthesis', 'procedures']\"\n        [isCurrentPage]=\"router.isActive(router.createUrlTree(['/','projects', project.id, project.name, 'synthesis', 'procedures']).toString(), true)\">\n        Synthesis procedures</ibm-header-item>\n      <ibm-header-item [routerLink]=\"['/','projects', project.id, project.name, 'synthesis', 'executions']\"\n        [isCurrentPage]=\"router.isActive(router.createUrlTree(['/','projects', project.id, project.name, 'synthesis', 'executions']).toString(), true)\">\n        Synthesis executions</ibm-header-item>\n    </ibm-header-menu>\n    <ibm-header-item [routerLink]=\"['/','projects', project.id, project.name, 'reaction-completions']\"\n      [isCurrentPage]=\"router.isActive(router.createUrlTree(['/','projects', project.id, project.name, 'reaction-completions']).toString(), true)\">\n      Reagents predictions\n    </ibm-header-item>\n  </ng-container>\n  <ng-container *ngIf=\"!appSessionService.activeBreakpoints.isXLarge\">\n    <ibm-header-menu title=\"AI Predictions\">\n      <ibm-header-item\n        [routerLink]=\"['/','projects', project.id, project.name, 'forward-reaction-predictions']\"\n        [isCurrentPage]=\"router.isActive(router.createUrlTree(['/','projects', project.id, project.name, 'forward-reaction-predictions']).toString(), true)\">\n        Product predictions\n      </ibm-header-item>\n      <ibm-header-item [routerLink]=\"['/','projects', project.id, project.name, 'retrosynthesis']\"\n        [isCurrentPage]=\"router.isActive(router.createUrlTree(['/','projects', project.id, project.name, 'retrosynthesis']).toString(), true)\">\n        Retrosynthetic routes</ibm-header-item>\n      <ibm-header-item [routerLink]=\"['/','projects', project.id, project.name, 'synthesis', 'procedures']\"\n        [isCurrentPage]=\"router.isActive(router.createUrlTree(['/','projects', project.id, project.name, 'synthesis', 'procedures']).toString(), true)\">\n        Synthesis procedures</ibm-header-item>\n      <ibm-header-item [routerLink]=\"['/','projects', project.id, project.name, 'synthesis', 'executions']\"\n        [isCurrentPage]=\"router.isActive(router.createUrlTree(['/','projects', project.id, project.name, 'synthesis', 'executions']).toString(), true)\">\n        Synthesis executions</ibm-header-item>\n      <ibm-header-item [routerLink]=\"['/','projects', project.id, project.name, 'reaction-completions']\"\n        [isCurrentPage]=\"router.isActive(router.createUrlTree(['/','projects', project.id, project.name, 'reaction-completions']).toString(), true)\">\n        Reagents predictions</ibm-header-item>\n    </ibm-header-menu>\n  </ng-container>\n</ibm-header-navigation>","import { Component, HostBinding, Input } from '@angular/core';\nimport { Router } from '@angular/router';\n\nimport { Project } from '@app/core/models';\nimport { AppSessionService } from '@app/core/services';\n\n@Component({\n  selector: 'ibm-project-header-main-menu',\n  templateUrl: './project-header-main-menu.component.html',\n  styleUrls: ['./project-header-main-menu.component.scss'],\n})\nexport class ProjectHeaderMainMenuComponent {\n  @HostBinding('class.h-100') fullHeight = true;\n  @Input() project: Project;\n\n  constructor(public router: Router, public appSessionService: AppSessionService) {}\n}\n","import { NgModule } from '@angular/core';\n\nimport { SharedModule } from '@shared/shared.module';\n\nimport { ProjectHeaderMainMenuComponent } from './project-header-main-menu/project-header-main-menu.component';\nimport { ProjectHeaderActionsMenuComponent } from './project-header-actions-menu/project-header-actions-menu.component';\nimport { AddNewButtonComponent } from './add-new-button/add-new-button.component';\nimport { AddCollaboratorsDialogComponent } from './add-collaborators-dialog/add-collaborators-dialog.component';\n\nconst NG_EXPORT_COMPONENTS = [\n  ProjectHeaderMainMenuComponent,\n  ProjectHeaderActionsMenuComponent,\n  AddNewButtonComponent,\n  AddCollaboratorsDialogComponent,\n];\n@NgModule({\n  imports: [SharedModule],\n  declarations: [...NG_EXPORT_COMPONENTS],\n  exports: [...NG_EXPORT_COMPONENTS],\n})\nexport class ProjectsSharedModule {}\n"],"x_google_ignoreList":[]}