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AAAA,GAAAW,EAAAd,UAHA,qBAAAe,EAAAA,EAAAA,UAAS,oBAAqB,uBAIlCxG,EAAAA,EAAAA,sBAAAX,EARoB6G,E","sources":["src/components/chip.hbs","src/components/chip.ts","src/components/file-upload.hbs","src/components/file-upload.ts","src/components/schedule-view.hbs","src/components/schedule-view.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{#if @onClick}}\\n \\n {{#if @icon}}\\n \\n {{/if}}\\n {{@text}}\\n \\n{{else}}\\n
\\n {{#if @icon}}\\n \\n {{/if}}\\n {{@text}}\\n
\\n{{/if}}\")","import Component from '@glimmer/component';\n\nimport type { ColorName } from '../utils/type-utils.ts';\n\ninterface BaseChipArgs {\n /** The text to display. */\n text: string;\n /** Optional icon to display. */\n icon?: string;\n /** An optional status color (defaults to transparent). */\n bgColor?: ColorName;\n /** Indicates the text should be on the left, followed by the icon. */\n reversed?: boolean;\n}\n\nexport type ChipSignature =\n | {\n Element: HTMLDivElement;\n Args: BaseChipArgs & {\n onClick?: undefined;\n };\n }\n | {\n Element: HTMLButtonElement;\n Args: BaseChipArgs & {\n onClick: (evt: Event) => unknown;\n };\n };\n\nexport default class Chip extends Component {\n /**\n * A computed CSS class based on the optional background color.\n */\n get bgColor(): string {\n const { bgColor } = this.args;\n return bgColor ? `adc-${bgColor}-bg` : '';\n }\n}\n","import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"
\\n {{#if (has-block)}}\\n \\n {{else}}\\n \\n {{tc this \\\"browse\\\"}}\\n \\n {{/if}}\\n\\n \\n {{#if this.isUploading}}\\n \\n {{else}}\\n {{#unless (has-block)}}\\n {{coalesce this.fileName (tc this \\\"noFileSelected\\\")}}\\n {{/unless}}\\n {{/if}}\\n \\n\\n \\n
\")","import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { isEnterOrSpaceCode } from '@adc/ember-utils/utils/a11y';\nimport { action } from '@ember/object';\nimport { inject as service } from '@ember/service';\nimport { intlPath } from '@adc/i18n/path';\n\nimport type AjaxService from '@adc/ajax/services/adc-ajax';\n\nexport interface FileUploadSignature {\n Element: HTMLDivElement;\n Args: {\n /** The maximum allowed file size, in bytes. */\n maxFileSize?: number;\n /** A CSV string indicating the accepted file types. */\n accept?: string;\n /** The URI endpoint to upload the file to. */\n endpoint?: string;\n /** Triggered after the file has uploaded tp the `@endpoint`. */\n fileUploaded?: (result: Record) => void;\n /** Triggered when the user has selected a file. */\n fileChanged?: () => void;\n /** Triggered when the file upload has failed. */\n uploadFailed?: (error: any) => void;\n /** Triggered when the selected file size is greater than the indicates `@maxFileSize`. */\n fileTooLarge?: () => void;\n };\n Blocks: {\n default: [];\n };\n}\n\n/**\n * Default max file size in bytes.\n *\n * @private\n */\nconst DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;\n\n/**\n * Upload the specified file.\n *\n * @private\n */\nasync function uploadFile(this: FileUploadComponent, file: File): Promise {\n const formData = new FormData();\n formData.append('file', file);\n\n Object.assign(this, {\n isUploading: true,\n fileName: file.name\n });\n\n try {\n const result = await postFormData.call(this, this.args.endpoint, formData);\n this.args.fileUploaded?.(result);\n } catch (error) {\n this.fileName = '';\n this.args.uploadFailed?.(error);\n }\n}\n\n/**\n * Send the specified formData to the endpoint.\n *\n * @param endpoint - The api endpoint that should be POSTed to.\n * @param formData - A FormData object that contains the file to upload.\n *\n * @private\n */\nfunction postFormData(\n this: FileUploadComponent,\n endpoint: string,\n formData: FormData\n): Promise> {\n const { defaultHeaders, apiBaseUrl } = this.ajax;\n\n return new Promise((resolve, reject) => {\n const xhr = new XMLHttpRequest();\n xhr.open('POST', `${apiBaseUrl}/${endpoint}`);\n xhr.setRequestHeader('AjaxRequestUniqueKey', defaultHeaders.ajaxrequestuniquekey ?? '');\n\n xhr.onload = function () {\n if (this.status >= 200 && this.status < 300) {\n resolve(JSON.parse(xhr.responseText));\n return;\n }\n\n reject({\n status: this.status,\n statusText: xhr.statusText\n });\n };\n\n xhr.onerror = function () {\n reject({\n status: this.status,\n statusText: xhr.statusText\n });\n };\n\n xhr.send(formData);\n });\n}\n\n/**\n * Reset the upload field.\n *\n * @private\n */\nfunction resetUploadField(this: FileUploadComponent, fileInput: HTMLInputElement): void {\n fileInput.files = null;\n fileInput.value = '';\n this.isUploading = false;\n}\n\n/**\n * @classdesc\n * Upload a file using a POST request to an endpoint.\n */\n@intlPath({ module: '@adc/ui-components', path: 'file-upload' })\nexport default class FileUploadComponent extends Component {\n @service declare ajax: AjaxService;\n\n /**\n * Max file size that this field will support.\n */\n get maxFileSize(): number {\n return this.args.maxFileSize ?? DEFAULT_MAX_FILE_SIZE_BYTES;\n }\n\n /**\n * Name of the currently selected file.\n *\n * @ignore\n */\n @tracked fileName = '';\n\n /**\n * Is a file currently being uploaded?\n *\n * @ignore\n */\n @tracked isUploading = false;\n\n /**\n * Upload a file when a user selects one to be uploaded.\n */\n @action\n async fileSelected(evt: Event): Promise {\n const fileInput = evt.target as HTMLInputElement;\n if (!fileInput?.files?.length) {\n return;\n }\n\n // Call the fileChanged action if there is one.\n this.args.fileChanged?.();\n\n const [file] = fileInput.files;\n\n // The file is too large, call the fileTooLarge action if there is one.\n if (file.size > this.maxFileSize) {\n this.args.fileTooLarge?.();\n } else {\n await uploadFile.call(this, file);\n }\n\n resetUploadField.call(this, fileInput);\n }\n\n @action\n selectFile(e: MouseEvent & { target: HTMLButtonElement }): void {\n e.preventDefault();\n e.target.closest('.file-upload')?.querySelector('input[type=\"file\"]')?.click();\n }\n\n /**\n * For a11y, handles a space or enter while focusing on the file upload button.\n */\n @action onKeyUp(evt: KeyboardEvent & { target: HTMLInputElement }): void {\n if (isEnterOrSpaceCode(evt.code)) {\n evt.preventDefault();\n evt.target.closest('.file-upload')?.querySelector('input[type=\"file\"]')?.click();\n }\n }\n}\n","import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"
\\n
\\n \\n\\n {{#if this.isScheduleAllTimes}}\\n
\\n {{coalesce @allTimesText \\\"\\\"}}\\n
\\n
\\n
\\n {{/if}}\\n\\n {{! Schedule blocks }}\\n {{#each this.scheduleElements as |scheduleElement|}}\\n
\\n
\\n {{scheduleElement.dayOfWeek}}\\n
\\n {{#each scheduleElement.schedules as |accessPlan|}}\\n {{#if accessPlan.timeBlocks.length}}\\n
\\n {{#each accessPlan.timeBlocks as |scheduleDay|}}\\n
\\n {{scheduleDay.label}}\\n
\\n
\\n
\\n {{/each}}\\n
\\n {{/if}}\\n {{/each}}\\n
\\n {{/each}}\\n
\\n
\")","import { computed } from '@ember/object';\nimport BaseSchedule from './views/base-schedule.ts';\n\nimport type { BaseScheduleSignature } from './views/base-schedule';\nimport type { ScheduleElement } from './views/types';\n\nexport interface ScheduleViewSignature extends BaseScheduleSignature {\n Args: BaseScheduleSignature['Args'] & {\n /** The text to display when the timetable is 24/7. */\n allTimesText?: string;\n /** Optional CSS class used to set color for all times text and bar (will use light gray if not present). */\n allTimesColor?: 'red' | 'orange' | 'yellow' | 'green' | 'blue' | 'purple' | 'greenblue';\n };\n}\n\n/**\n * Displays the weekly schedule for a timetable\n */\nexport default class ScheduleView extends BaseSchedule {\n /**\n * Schedule to be rendered into the grid\n */\n @computed('args.allTimesText', 'planSchedules.[]')\n get scheduleElements(): ScheduleElement[] {\n return this.getScheduleElements(false, this.args.allTimesText);\n }\n}\n"],"names":["TEMPLATE","createTemplateFactory","scope","on","svgSymbol_","Chip","Component","bgColor","this","args","concat","setComponentTemplate","guidFor_","tc_","tc_0","spinnerSvg_","coalesce_","async","uploadFile","file","formData","FormData","append","Object","assign","isUploading","fileName","name","_this$args$fileUpload","_this$args","result","postFormData","call","endpoint","fileUploaded","error","_this$args$uploadFail","_this$args2","uploadFailed","defaultHeaders","apiBaseUrl","ajax","Promise","resolve","reject","_defaultHeaders$ajaxr","xhr","XMLHttpRequest","open","setRequestHeader","ajaxrequestuniquekey","onload","status","JSON","parse","responseText","statusText","onerror","send","resetUploadField","fileInput","files","value","FileUploadComponent","c","_ajax","WeakMap","_fileName","_isUploading","_FileUploadComponent","constructor","arguments","_classPrivateFieldInitSpec","i","maxFileSize","_this$args$maxFileSiz","fileSelected","evt","_fileInput$files","_this$args$fileChange","_this$args3","target","length","fileChanged","_this$args$fileTooLar","_this$args4","size","fileTooLarge","selectFile","e","_e$target$closest","preventDefault","closest","querySelector","click","onKeyUp","_evt$target$closest","isEnterOrSpaceCode","code","g","prototype","inject","tracked","n","action","intlPath","module","path","scheduleHourLabels_","ScheduleView","BaseSchedule","scheduleElements","getScheduleElements","allTimesText","_ScheduleView","computed"],"sourceRoot":""}