{"version":3,"file":"app-53940ac3.f584a1446b2fc034d810.bundle.js","mappings":"AAGA","sources":["webpack://lernplattform-admin-frontend/./src/resources/elements/router-link/router-link.html","webpack://lernplattform-admin-frontend/./src/resources/elements/scroll-link/scroll-link.html","webpack://lernplattform-admin-frontend/./src/resources/elements/search-and-select/search-and-select.html","webpack://lernplattform-admin-frontend/./src/resources/elements/search-input/search-input.html","webpack://lernplattform-admin-frontend/./src/resources/elements/selected-questions-overview/selected-questions-overview.html","webpack://lernplattform-admin-frontend/./src/resources/elements/separator/separator.html","webpack://lernplattform-admin-frontend/./src/resources/elements/router-link/router-link.ts","webpack://lernplattform-admin-frontend/./src/resources/elements/scroll-link/index.ts","webpack://lernplattform-admin-frontend/./src/resources/elements/scroll-link/scroll-link.ts","webpack://lernplattform-admin-frontend/./src/resources/elements/search-and-select/index.ts","webpack://lernplattform-admin-frontend/./src/resources/elements/search-and-select/search-and-select.ts","webpack://lernplattform-admin-frontend/./src/resources/elements/search-input/search-input.ts","webpack://lernplattform-admin-frontend/./src/resources/elements/selected-questions-overview/selected-questions-overview.ts","webpack://lernplattform-admin-frontend/./src/resources/elements/separator/separator.ts"],"sourcesContent":["// Module\nvar code = \"<template href.to-view=\\\"href\\\" class=\\\"${ isActive ? 'active' : ''}\\\" click.delegate=\\\"navigate()\\\"> <slot></slot> </template> \";\n// Exports\nexport default code;","// Module\nvar code = \"<template class=\\\"d-flex\\\"> <a class=\\\"pointer\\\" click.trigger=\\\"scrollIntoView()\\\">${title}</a> </template>\";\n// Exports\nexport default code;","// Module\nvar code = \"<template class=\\\"search-and-select\\\"> <div class=\\\"search-and-select__input-selected-field ${ isInvalid ? 'search-and-select__input-selected-field--is-invalid' : '' } ${ inputInFocus ? 'search-and-select__input-selected-field--in-focus' : '' } ${ selectedItem.iconName ? 'search-and-select__input-selected-field--with-icon' : '' }\\\"> <input ref=\\\"searchSelectValueElement\\\" class=\\\"search-and-select__input-selected\\\" disabled.to-view=\\\"disabled\\\" value.two-way=\\\"searchText\\\" placeholder=\\\"${ label }\\\" mousedown.delegate=\\\"openList()\\\"/> <safe-icon if.to-view=\\\"selectedItem.iconName\\\" class=\\\"search-and-select__selected-icon\\\" icon-name.to-view=\\\"selectedItem.iconName\\\"></safe-icon> <div class=\\\"search-and-select__button-wrapper\\\" click.trigger=\\\"toggleList()\\\"> <safe-icon class=\\\"search-and-select__icon text-muted\\\" icon-name=\\\"System/Tabler/Chevron-Down\\\"> </safe-icon> </div> </div> <div if.to-view=\\\"listOpen\\\" ref=\\\"resultScrollContainer\\\" class=\\\"search-and-select__list\\\"> <template repeat.for=\\\"group of searchResults\\\"> <span if.to-view=\\\"group.displaySettings.displayMode === SearchSelectGroupDisplayMode.TextTk\\\" class=\\\"search-and-select__list-group\\\" t=\\\"${ group.displaySettings.textTk }\\\"></span> <div if.to-view=\\\"group.displaySettings.displayMode === SearchSelectGroupDisplayMode.Name\\\" class=\\\"search-and-select__list-group\\\"> ${ group.displaySettings.name } </div> <div repeat.for=\\\"item of getVisibleItems(group.items, resultScrollContainer.scrollTop)\\\" class=\\\"search-and-select__list-item\\\" click.trigger=\\\"handleSelected(item)\\\"> <safe-icon if.to-view=\\\"item.iconName\\\" class=\\\"search-and-select__list-item-icon\\\" icon-name.to-view=\\\"item.iconName\\\"></safe-icon> <div>${ item.text }</div> </div> </template> <span if.to-view=\\\"searchResults.length === 0\\\" class=\\\"search-and-select__list-group\\\" t=\\\"${ data.noResultsTextTk }\\\"></span> </div> </template>\";\n// Exports\nexport default code;","// Module\nvar code = \"<template class=\\\"search-input ${ searchInputInFocus ? 'search-input--in-focus' : '' }\\\"> <safe-icon if.to-view=\\\"!searchActive\\\" icon-name=\\\"System/Tabler/Search\\\" class=\\\"search-input__icon search-input__icon-search\\\"></safe-icon> <input class=\\\"search-input__input ${ searchActive ? 'search-input__input--active' : ''}\\\" ref=\\\"searchInputElement\\\" value.two-way=\\\"searchString\\\" click.trigger=\\\"searchActive = true\\\" focus.trigger=\\\"setSearchInputFocus(true)\\\" blur.trigger=\\\"setSearchInputFocus(false)\\\" placeholder.to-view=\\\"placeholder\\\"/> <safe-icon if.to-view=\\\"searchActive\\\" icon-name=\\\"System/Tabler/X\\\" class=\\\"search-input__icon search-input__icon-cancel\\\" click.trigger=\\\"quitSearch()\\\"></safe-icon> </template>\";\n// Exports\nexport default code;","// Module\nvar code = \"<template class=\\\"selected-questions-overview card\\\"> <h4 class=\\\"selected-questions-overview__title\\\" t=\\\"elements.selected-questions-overview.selectedQuestions\\\"></h4> <div class=\\\"selected-questions-overview__scroll-wrapper\\\"> <p if.to-view=\\\"!selectedQuestions.length\\\" class=\\\"selected-questions-overview__no-content-placeholder\\\" t=\\\"elements.selected-questions-overview.noContentPlaceholder\\\"></p> <div repeat.for=\\\"selectedQuestion of selectedQuestions\\\" class=\\\"selected-questions-overview__single-element\\\"> <draggable payload.to-view=\\\"{ existingPayloadId: selectedQuestion.id }\\\" class=\\\"selected-questions-overview__draggable\\\" dnd-active.to-view=\\\"dndActive\\\" context.to-view=\\\"dndContext\\\"> <div class=\\\"selected-questions-overview__question ${ disabled ? 'selected-questions-overview__question--disabled' : '' } ${ selectedQuestion.id === dndPayload.existingPayloadId ? 'selected-questions-overview__question--ghost' : '' }\\\"> <safe-icon class=\\\"selected-questions-overview__control-icon\\\" icon-name=\\\"System/DragAlt\\\"></safe-icon> <safe-icon click.delegate=\\\"removeQuestion(selectedQuestion.id)\\\" class=\\\"selected-questions-overview__control-icon\\\" icon-name=\\\"System/Tabler/Trash\\\"></safe-icon> <p class=\\\"selected-questions-overview__question-text\\\">${selectedQuestion.text}</p> <p class=\\\"selected-questions-overview__question-external-id\\\">${selectedQuestion.externalId}</p> </div> </draggable> <drop-zone class=\\\"selected-questions-overview__drop-zone selected-questions-overview__drop-zone--before selected-questions-overview__drop-zone--${ dndTargetDisplaySettings[$index].before } ${ dndActive && dndTargetDisplaySettings[$index].before !== DndTargetDisplay.Hidden ? 'selected-questions-overview__drop-zone--front' : '' } ${ $index === 0 ? 'selected-questions-overview__drop-zone--first' : '' }\\\" dnd-active.to-view=\\\"dndActive\\\" context.to-view=\\\"dndContext\\\" config.to-view=\\\"getDropzoneConfig($index, DndInsertModeSequential.Before)\\\" provide-dropzone-identifiers.to-view=\\\"false\\\"></drop-zone> <drop-zone class=\\\"selected-questions-overview__drop-zone selected-questions-overview__drop-zone--after selected-questions-overview__drop-zone--${ dndTargetDisplaySettings[$index].after } ${ dndActive && dndTargetDisplaySettings[$index].after !== DndTargetDisplay.Hidden ? 'selected-questions-overview__drop-zone--front' : '' } ${ $last ? 'selected-questions-overview__drop-zone--last' : '' }\\\" dnd-active.to-view=\\\"dndActive\\\" context.to-view=\\\"dndContext\\\" config.to-view=\\\"getDropzoneConfig($index, DndInsertModeSequential.After)\\\" provide-dropzone-identifiers.to-view=\\\"false\\\"></drop-zone> </div> </div> </template>\";\n// Exports\nexport default code;","// Module\nvar code = \"<template class=\\\"d-flex text-muted separator\\\"> <div class=\\\"separator__line\\\"></div> <div if.to-view=\\\"textTk\\\" class=\\\"separator__text\\\" t.to-view=\\\"textTk\\\"></div> <div class=\\\"separator__line\\\"></div> </template>\";\n// Exports\nexport default code;","import { Router } from 'aurelia-router';\nimport { bindable, computedFrom, autoinject } from 'aurelia-framework';\n\n@autoinject\nexport class RouterLink {\n  @bindable\n  public to: { name: string } = { name: '' };\n\n  public active = false;\n\n  private router: Router;\n\n  private tagName: string;\n\n  private href: string | null = null;\n\n  constructor(router: Router, element: Element) {\n    this.router = router;\n    this.tagName = element.tagName;\n  }\n\n  public attached(): void {\n    this.href = this.tagName === 'A' ? this.router.generate(this.to.name) : null;\n  }\n  \n  @computedFrom('router.currentInstruction.config.name')\n  public get isActive(): boolean {\n    return this.router.currentInstruction.config.name?.startsWith(this.to.name) || false;\n  }\n\n  public navigate(): void {\n    this.router.navigateToRoute(this.to.name);\n  }\n}\n","import { PLATFORM } from 'aurelia-pal';\nimport { FrameworkConfiguration } from 'aurelia-framework';\n\nexport function configure(config: FrameworkConfiguration): void {\n  config.globalResources(PLATFORM.moduleName('resources/elements/scroll-link/scroll-link'));\n}\n","import { bindable } from 'aurelia-framework';\nimport { assertNotNullOrUndefined } from 'common/utils/assert';\n\nexport class ScrollLink {\n  @bindable() public scrollElement: HTMLElement | null = null;\n  @bindable() public title: string = '';\n\n  private scrollIntoView(): void {\n    assertNotNullOrUndefined(this.scrollElement, 'forgot to ref scrollElement');\n    this.scrollElement.scrollIntoView();\n  }\n}","import { PLATFORM } from 'aurelia-pal';\nimport { FrameworkConfiguration } from 'aurelia-framework';\n\nexport function configure(config: FrameworkConfiguration): void {\n  config.globalResources(PLATFORM.moduleName('resources/elements/search-and-select/search-and-select'));\n}\n","import { autoinject, bindable } from 'aurelia-framework';\nimport { SubscriptionManager, SubscriptionManagerService } from 'common/aurelia-services/SubscriptionManagerService';\nimport { DomUtils } from 'common/utils/DomUtils';\nimport { assertNotNullOrUndefined } from 'common/utils/assert';\nimport { KeyboardKey } from 'common/enum/keyboard.key.enum';\n\nexport interface ISearchSelectItem {\n  text: string;\n  id: number | string;\n  group?: string;\n  additionalSearchFields?: IAdditionalSearchField[];\n  iconName?: string;\n}\n\nexport interface IAdditionalSearchField {\n  value: string;\n}\n\nexport type SearchSelectItems = Array<ISearchSelectItem>;\n\nexport enum SearchSelectGroupDisplayMode {\n  None = 'none',\n  Name = 'name',\n  TextTk = 'text-tk',\n}\n\nexport interface ISearchSelectGroupDisplaySettings {\n  name?: string;\n  textTk?: string;\n  displayMode: SearchSelectGroupDisplayMode;\n}\n\nexport interface ISearchSelectGroup {\n  displaySettings: ISearchSelectGroupDisplaySettings;\n  items: SearchSelectItems;\n}\n\nexport type SearchSelectGroups = Array<ISearchSelectGroup>;\n\nexport interface ISearchSelectData {\n  noResultsTextTk?: string;\n  defaultItemId?: number | string;\n  searchIndex: SearchSelectGroups;\n}\n\n@autoinject()\nexport class SearchAndSelect {\n  @bindable() public label = '';\n  @bindable() public data: ISearchSelectData | null = null;\n  @bindable() public groupSearchEnabled = false;\n  @bindable() public isInvalid: boolean = false;\n  @bindable() public disabled: boolean = false;\n  @bindable() public maxItems: number = Infinity;\n  /**\n   * when set through binding only changes the appearance of the element\n   */\n  @bindable() public searchText: string = '';\n  private selectedItem: ISearchSelectItem | null = null;\n  private selectedItemBackup: ISearchSelectItem | null = null;\n  private searchResults: SearchSelectGroups = [];\n  private inputInFocus = false;\n  private listOpen = false;\n  private totalItems: number = Infinity;\n  private subscriptionManager: SubscriptionManager;\n  private domElement: HTMLElement;\n  private searchSelectValueElement: HTMLElement | null = null;\n  private resultScrollContainer: HTMLElement | null = null;\n  private SearchSelectGroupDisplayMode = SearchSelectGroupDisplayMode;\n\n  constructor(\n    element: Element,\n    subscriptionManagerService: SubscriptionManagerService,\n  ) {\n    this.domElement = element as HTMLElement;\n    this.subscriptionManager = subscriptionManagerService.createSubscriptionManager();\n  }\n\n  protected attached(): void {\n    assertNotNullOrUndefined(this.searchSelectValueElement, 'Forgot to ref searchSelectValueElement');\n    this.subscriptionManager.subscribeToMouseDownOutside(this.domElement, () => {\n      this.stopEditing(this.selectedItemBackup);\n    });\n    this.subscriptionManager.subscribeToKeyboardEvent(this.searchSelectValueElement, KeyboardKey.Escape, () => {\n      this.stopEditing(this.selectedItemBackup);\n    });\n    this.dataChanged();\n  }\n\n  protected detached(): void {\n    this.subscriptionManager.disposeSubscriptions();\n    this.inputInFocus = false;\n    this.listOpen = false;\n    this.totalItems = this.maxItems;\n  }\n\n  private dataChanged(): void {\n    if(this.data?.defaultItemId !== undefined && this.data?.defaultItemId !== -1) {\n      let foundItem: ISearchSelectItem | undefined;\n      this.data?.searchIndex.forEach(group => {\n        foundItem = group.items.find(item => item.id === this.data?.defaultItemId);\n        if(foundItem !== undefined) {\n          this.selectedItem = foundItem;\n          this.searchText = this.selectedItem?.text ?? '';\n        }\n      });\n      this.selectedItemBackup = this.selectedItem;\n    }\n    this.searchResults = this.data?.searchIndex || [];\n    this.totalItems = this.maxItems;\n  }\n\n  private searchTextChanged(): void {\n    // filter search event triggered by selecting result which will be copied to selectedItem\n    if(!this.listOpen) return;\n    this.totalItems = this.maxItems;\n\n    const cleanSearchString: string = this.searchText.trim().toLocaleLowerCase();\n    if(cleanSearchString.length === 0) {\n      // in case only one empty group is provided, show empty results.\n      if(this.data && !(this.data.searchIndex.length === 1 && this.data.searchIndex[0].items.length === 0)) {\n        this.searchResults = this.data.searchIndex;\n      } else {\n        this.searchResults = [];\n      }\n    } else {\n      let resultGroupHelperItems: SearchSelectItems = [];\n      this.searchResults = [];\n      this.data?.searchIndex.forEach(group => {\n        resultGroupHelperItems = group.items.filter(item => {\n          return item.text.toLocaleLowerCase().includes(cleanSearchString)\n            || (this.groupSearchEnabled && item.group?.toLocaleLowerCase().includes(cleanSearchString))\n            || item.additionalSearchFields?.some(field => field.value.toLocaleLowerCase().includes(cleanSearchString));\n        });\n        if(resultGroupHelperItems.length > 0) {\n          this.searchResults.push({ displaySettings: group.displaySettings, items: resultGroupHelperItems });\n          resultGroupHelperItems = [];\n        }\n      });\n    }\n  }\n\n  private toggleList(): void {\n    window.setTimeout(() => {\n      if(!this.listOpen) {\n        this.openList();\n      } else {\n        this.stopEditing(this.selectedItemBackup);\n      }\n    });\n  }\n\n  private openList(): boolean {\n    if(this.listOpen) return true;\n\n    this.listOpen = true;\n    this.selectedItemBackup = this.selectedItem;\n    this.selectedItem = null;\n    this.searchText = '';\n    this.searchTextChanged();\n\n    assertNotNullOrUndefined(this.searchSelectValueElement, 'Forgot to ref searchSelectValueElement');\n    this.inputInFocus = true;\n    this.searchSelectValueElement.focus();\n\n    return true;\n  }\n\n  private stopEditing(item?: ISearchSelectItem | null): void {\n    assertNotNullOrUndefined(this.searchSelectValueElement, 'Forgot to ref searchSelectValueElement');\n    if(!this.inputInFocus) return;\n    this.searchSelectValueElement.blur();\n    this.inputInFocus = false;\n    this.selectedItem = item ?? this.selectedItem;\n    this.selectedItemBackup = this.selectedItem;\n    this.searchText = this.selectedItem?.text ?? '';\n    this.listOpen = false;\n    this.totalItems = this.maxItems;\n  }\n\n  private handleSelected(item: ISearchSelectItem): void {\n    window.setTimeout(() => {\n      this.stopEditing(item);\n      DomUtils.fireEvent(this.domElement, {\n        name: 'sas-item-changed',\n        bubbles: true,\n        detail: { id: item.id },\n      });\n    });\n  }\n\n  private getVisibleItems(items: SearchSelectItems, scrollTop: number): SearchSelectItems {\n    const displayedItems: SearchSelectItems = items.slice(0, this.totalItems);\n    if(!this.resultScrollContainer) return displayedItems;\n\n    const { clientHeight, scrollHeight } = this.resultScrollContainer;\n    if(scrollTop > scrollHeight - clientHeight * 1.25) {\n      this.totalItems = this.totalItems + this.maxItems;\n    }\n    return displayedItems;\n  }\n}\n\nexport type SasSelectedItemChangedEvent<T> = Event & { detail: { id: T } };\n","import { autoinject, bindable } from 'aurelia-framework';\nimport { SubscriptionManager, SubscriptionManagerService } from 'common/aurelia-services/SubscriptionManagerService';\nimport { KeyboardKey } from 'common/enum/keyboard.key.enum';\nimport { assertNotNullOrUndefined } from 'common/utils/assert';\n\n@autoinject\nexport class SearchInput {\n  @bindable public searchString = '';\n  @bindable public searchActive = false;\n  @bindable public placeholder: string | null = null;\n  private searchInputInFocus = false;\n  private searchInputElement: HTMLElement | null = null;\n  private subscriptionManager: SubscriptionManager;\n  private keyboardEventsSubscribed = false;\n\n  constructor(\n    subscriptionManagerService: SubscriptionManagerService,\n  ) {\n    this.subscriptionManager = subscriptionManagerService.createSubscriptionManager();\n  }\n\n  protected attached(): void {\n    this.manageSearch(true);\n  }\n\n  protected detached(): void {\n    this.manageSearch(false);\n  }\n\n  private manageSearch(active: boolean): void {\n    // ensure if.to-view updated view and html element is available and referenced before attaching listener\n    setTimeout(() => {\n      if(active) {\n        if(!this.keyboardEventsSubscribed) {\n          assertNotNullOrUndefined(this.searchInputElement, 'Forgot to ref searchInputElement');\n          this.subscriptionManager.subscribeToKeyboardEvent(this.searchInputElement, KeyboardKey.Escape, () => {\n            this.searchInputElement?.blur();\n            this.setSearchInputFocus(false);\n          });\n          this.keyboardEventsSubscribed = true;\n        }\n      } else {\n        if(this.keyboardEventsSubscribed) {\n          this.subscriptionManager.disposeSubscriptions();\n          this.keyboardEventsSubscribed = false;\n        }\n        this.checkAndQuitSearch();\n      }\n    }, 0);\n  }\n\n  private setSearchInputFocus(inFocus: boolean): void {\n    this.searchInputInFocus = inFocus;\n\n    if(!this.searchInputInFocus && this.searchString.length === 0) {\n      this.quitSearch();\n    }\n  }\n\n  private checkAndQuitSearch(): void {\n    if(this.searchActive) this.quitSearch();\n  }\n\n  private quitSearch(): void {\n    this.searchString = '';\n    this.searchActive = false;\n  }\n}","import { bindable, autoinject, observable } from 'aurelia-framework';\nimport { ContentEditingInsertModeSelector } from 'common/constants/content.editing.constants';\nimport { IQuestionDto } from 'common/dto/course/content/question.interface';\nimport { DomUtils } from 'common/utils/DomUtils';\nimport {\n  DndActivityEventData,\n  DndContext,\n  DndDropEventData,\n  DndInsertModeSequential,\n  DndManager,\n  DndManagerService,\n  DndPayloadUniversal,\n  DndSimpleTargetDisplaySetting,\n  DndTargetDisplay,\n  IDndDropzoneConfig\n} from '../../../services/DndManagerService';\n\n/**\n * @event {QuizTemplateRemoveQuestionEvent} quiz-template-remove-question\n * @event {QuizTemplateMoveQuestionEvent} quiz-template-move-question\n */\n@autoinject()\nexport class SelectedQuestionsOverview {\n  @bindable() public selectedQuestions: IQuestionDto[] = [];\n  @bindable() public disabled = false;\n  private domElement: HTMLElement;\n\n  @observable() private dndActive = false;\n  private dndContext: DndContext = DndContext.SelectedQuestions;\n  private dndManager: DndManager<IQuestionDto> | null = null;\n  private dndPayload: DndPayloadUniversal<IQuestionDto> = null;\n  private dndLastEnteredInfo: IDndDropzoneConfig | null = null;\n  private dndTargetDisplaySettings: Array<DndSimpleTargetDisplaySetting> = [];\n  private dndTargetDisplaySettingsBuffer: Array<DndSimpleTargetDisplaySetting> = [];\n  private DndInsertModeSequential = DndInsertModeSequential;\n  private DndTargetDisplay = DndTargetDisplay;\n\n  constructor(\n    element: Element,\n    private dndManagerService: DndManagerService,\n  ) {\n    this.domElement = element as HTMLElement;\n  }\n\n  public dndPayloadChangedHandler(payload: DndPayloadUniversal<IQuestionDto>): void {\n    this.dndPayload = payload;\n    this.dndActive = payload != null;\n\n    // perform initial target display setting calculation with dummy data\n    if(this.dndPayload != null && this.dndPayload.existingPayloadId != null) {\n      const dropTargetInfo: IDndDropzoneConfig = {\n        identifier: {\n          superId: this.dndPayload.existingPayloadId ?? 0,\n          subId: 0,\n        },\n        insertModeSelector: ContentEditingInsertModeSelector.Sequential,\n        insertModeSequential: DndInsertModeSequential.Before,\n      };\n      this.calcDndTargetDisplaySettings(dropTargetInfo, true);\n    } else this.resetTargetDisplaySettings();\n  }\n\n  public dndDragActivityHandler(dndInfo: DndActivityEventData<IDndDropzoneConfig>): void {\n    if(this.dndPayload == null || this.disabled) return;\n    const config = dndInfo.dropTarget;\n    if(dndInfo && this.dndLastEnteredInfo === null) this.dndLastEnteredInfo = dndInfo.dropTarget;\n    if(dndInfo.enterEvent && this.dndLastEnteredInfo) {\n      this.dndLastEnteredInfo = this.dndLastEnteredInfo !== dndInfo.dropTarget ? dndInfo.dropTarget : this.dndLastEnteredInfo;\n      this.calcDndTargetDisplaySettings(config, false);\n    } else {\n      // calculate display settings when all drop-zone area is left and thus the latest targets need to be reset\n      if(this.dndLastEnteredInfo && this.dndLastEnteredInfo === dndInfo.dropTarget) {\n        this.calcDndTargetDisplaySettings(config, true);\n      }\n    }\n  }\n\n  protected attached(): void {\n    this.dndManager = this.dndManagerService.getDndManager<IQuestionDto>(this.dndContext);\n    this.dndManager.subscribePayloadChanged(this, this.dndPayloadChangedHandler.bind(this));\n    this.dndManager.subscribeToDragActivity(this, this.dndDragActivityHandler.bind(this));\n    this.dndManager.subscribeDrop(this, this.onDrop.bind(this));\n  }\n\n  protected detached(): void {\n    this.dndManager?.disposeSubscriptions(this);\n    this.dndLastEnteredInfo = null;\n  }\n\n  private async onDrop(dropInfo: DndDropEventData<IQuestionDto>): Promise<void> {\n    this.dndActive = false;\n    if(dropInfo.dndPayload == null\n      || dropInfo.dndPayload.existingPayloadId == null\n      || dropInfo.dndPayload.existingPayloadId === dropInfo.dropTarget.identifier.superId\n      || dropInfo.dropTarget.sequentialOrder == null) return;\n\n    this.moveQuestion(dropInfo.dndPayload.existingPayloadId, dropInfo.dropTarget.sequentialOrder);\n  }\n\n  private resetTargetDisplaySettings(): void {\n    // reset target displays to be hidden\n    this.dndTargetDisplaySettingsBuffer = [];\n    this.selectedQuestions.forEach(() => {\n      this.dndTargetDisplaySettingsBuffer.push({\n        before: DndTargetDisplay.Hidden,\n        after: DndTargetDisplay.Hidden,\n      });\n    });\n    this.dndTargetDisplaySettings = this.dndTargetDisplaySettingsBuffer;\n  }\n\n  /**\n   * Dropzone config - sequentialOrder for drop information should be\n   * in case of insert before: the same order as the item to insert before\n   * in case of insert after: the order + 1 of the item to insert after\n   */\n  private getDropzoneConfig(\n    index: number,\n    insertMode: DndInsertModeSequential\n  ): IDndDropzoneConfig {\n    const config: IDndDropzoneConfig = {\n      identifier: {\n        superId: this.selectedQuestions[index].id,\n        subId: 0,\n      },\n      insertModeSelector: ContentEditingInsertModeSelector.Sequential,\n      insertModeSequential: insertMode,\n      sequentialOrder: insertMode === DndInsertModeSequential.Before ? index + 1 : index + 2,\n    };\n    return config;\n  }\n\n  private calcDndTargetDisplaySettings(dndInfo: IDndDropzoneConfig, resetTargets: boolean): void {\n    const selectedQuestionIds = this.selectedQuestions.map(q => q.id);\n    let targetDisplaySettingBefore = DndTargetDisplay.Hidden;\n    let targetDisplaySettingAfter = DndTargetDisplay.Hidden;\n    this.dndTargetDisplaySettingsBuffer = [];\n\n    selectedQuestionIds.forEach((questionId, index) => {\n      targetDisplaySettingBefore = this.dndPayload == null\n        || questionId === this.dndPayload.existingPayloadId\n        || (index > 0 && selectedQuestionIds[index - 1] === this.dndPayload.existingPayloadId)\n        ? DndTargetDisplay.Hidden\n        : DndTargetDisplay.Allowed;\n\n      if(targetDisplaySettingBefore === DndTargetDisplay.Allowed) {\n        targetDisplaySettingBefore = !resetTargets\n          && ((index > 0\n            && dndInfo.identifier.superId === selectedQuestionIds[index - 1]\n            && dndInfo.insertModeSequential === DndInsertModeSequential.After)\n            || (dndInfo.identifier.superId === selectedQuestionIds[index]\n              && dndInfo.insertModeSequential === DndInsertModeSequential.Before))\n          ? DndTargetDisplay.Target\n          : targetDisplaySettingBefore;\n      }\n\n      targetDisplaySettingAfter = this.dndPayload == null\n        || questionId === this.dndPayload.existingPayloadId\n        || (index < selectedQuestionIds.length - 1 && selectedQuestionIds[index + 1] === this.dndPayload.existingPayloadId)\n        ? DndTargetDisplay.Hidden\n        : DndTargetDisplay.Allowed;\n\n      if(targetDisplaySettingAfter === DndTargetDisplay.Allowed) {\n        targetDisplaySettingAfter = !resetTargets\n          && ((index < selectedQuestionIds.length - 1\n            && dndInfo.identifier.superId === selectedQuestionIds[index + 1]\n            && dndInfo.insertModeSequential === DndInsertModeSequential.Before)\n            || (dndInfo.identifier.superId === selectedQuestionIds[index]\n              && dndInfo.insertModeSequential === DndInsertModeSequential.After))\n          ? DndTargetDisplay.Target\n          : targetDisplaySettingAfter;\n      }\n\n      this.dndTargetDisplaySettingsBuffer.push({\n        before: targetDisplaySettingBefore,\n        after: targetDisplaySettingAfter,\n      });\n    });\n    this.dndTargetDisplaySettings = this.dndTargetDisplaySettingsBuffer;\n  }\n\n  private removeQuestion(questionId: number): void {\n    if(this.disabled) return;\n    DomUtils.fireEvent(this.domElement, {\n      detail: {\n        questionId,\n      },\n      name: 'quiz-template-remove-question',\n    });\n  }\n\n  private moveQuestion(questionId: number, targetOrder: number): void {\n    DomUtils.fireEvent(this.domElement, {\n      detail: {\n        questionId,\n        targetOrder\n      },\n      name: 'quiz-template-move-question',\n    });\n  }\n}\n\nexport type QuizTemplateRemoveQuestionEvent = CustomEvent<{ questionId: number }>;\nexport type QuizTemplateMoveQuestionEvent = CustomEvent<{ questionId: number; targetOrder: number }>;","import { bindable } from 'aurelia-framework';\n\nexport class Separator {\n  @bindable public textTk: string | null = null;\n}\n"],"names":[],"sourceRoot":""}