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E,EAAAlE,UAAA,QACtGC,EAAAA,UAAOF,EAAAA,EAAAA,GAAAmE,EAAAlE,UAAA,UAKPE,EAAAA,UAAO,kBAAU,CAAK,KAHvBH,EAAAA,EAAAA,GAAAmE,EAAAlE,UAAA,WAQCE,EAAAA,UAAO,kBAAW,CAAK,KAHxBH,EAAAA,EAAAA,GAAAmE,EAAAlE,UAAA,QAQCE,EAAAA,WAiCDC,EAAAA,EAAAA,GAAA+D,EAAAlE,UAAA,gBAtBCI,EAAAA,EAAAA,UAAS,8BA6BVD,EAAAA,EAAAA,GAAA+D,EAAAlE,UAAA,gBAJCK,EAAAA,UAUAF,EAAAA,EAAAA,GAAA+D,EAAAlE,UAAA,kBAHAK,EAAAA,SAAM6D,GAIV,EAhEA5D,EAAAA,EAAAA,GAAS,CAAEC,OAAQ,qBAAsBC,KAAM,wBACJC,EAAAA,EAAAA,sBAAA1I,EAAvBgM,E","sources":["src/components/drag-drop-file-upload.hbs","src/components/drag-drop-file-upload.ts","src/components/date-time-picker.hbs","src/components/date-time-picker.ts","src/components/select-date-time.hbs","src/components/select-date-time.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"
\\n {{#if this.hasFile}}\\n
\\n \\n
    \\n
  • {{this.fileName}}
  • \\n
  • {{this.fileSizeString}}
  • \\n
\\n \\n
\\n {{else}}\\n \\n
\\n {{#if this.isLoading}}\\n \\n {{else if this.isHovering}}\\n {{tc this \\\"dropFile\\\"}}\\n {{else}}\\n
    \\n
  • \\n {{#if (media \\\"isMobile\\\")}}\\n
  • \\n \\n
  • \\n {{else}}\\n
  • {{tc this \\\"uploadInstructions\\\" guid=(guid-for this) htmlSafe=true}}
  • \\n {{/if}}\\n
  • \\n
      \\n
    • {{tc this \\\"supportedFileTypes\\\" accept=@accept}}
    • \\n
    • {{tc this \\\"maxFileSize\\\" maxFileSize=this.maxFileSizeString}}
    • \\n
    \\n
  • \\n
\\n {{/if}}\\n
\\n
\\n {{/if}}\\n\")","import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action, computed } from '@ember/object';\nimport { inject as service } from '@ember/service';\nimport { intlPath } from '@adc/i18n/path';\n\nimport type ADCIntlService from '@adc/i18n/services/adc-intl';\nimport type NotificationManager from '../services/notification-manager.ts';\n\nexport interface DragDropFileUploadSignature {\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 File as read from the data URL. */\n file?: File;\n /** Flag to disable file uploading and deleting. */\n disabled?: boolean;\n /** Triggered when the file has been selected. */\n fileChanged?: (file: File | null, dataUrl: string) => void;\n };\n}\n\n/**\n * Default max file size in bytes.\n */\nconst DEFAULT_MAX_FILE_SIZE_BYTES = 3 * 1024 * 1024;\n\n/**\n * Convert number of bytes to a readable string with units.\n */\nfunction toByteString(bytes: number): string {\n const units = ['B', 'KB', 'MB', 'GB'];\n const k = 1024;\n\n if (bytes <= 0) {\n return '0 B';\n }\n\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + units[i];\n}\n\n/**\n * Validate the given file by checking some data in the file.\n */\nfunction isFileDataValid(file: File): Promise {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onloadend = (e) => {\n const buffer = e.target?.result as ArrayBuffer;\n\n if (buffer.byteLength < 4) {\n resolve(false);\n }\n\n const view = new DataView(buffer);\n const magicNumbers = {\n jpeg: [0xff, 0xd8],\n png: [0x89, 0x50, 0x4e, 0x47],\n pdf: [0x25, 0x50, 0x44, 0x46],\n svg1: [0x3c, 0x3f, 0x78, 0x6d],\n svg2: [0x3c, 0x73, 0x76, 0x67]\n };\n\n switch (file.type) {\n case 'image/jpeg': {\n const isJPEG =\n view.getUint8(0) === magicNumbers.jpeg[0] && view.getUint8(1) === magicNumbers.jpeg[1];\n resolve(isJPEG);\n break;\n }\n case 'image/png': {\n const isPNG =\n view.getUint8(0) === magicNumbers.png[0] &&\n view.getUint8(1) === magicNumbers.png[1] &&\n view.getUint8(2) === magicNumbers.png[2] &&\n view.getUint8(3) === magicNumbers.png[3];\n resolve(isPNG);\n break;\n }\n case 'image/svg+xml': {\n const isSVG =\n (view.getUint8(0) === magicNumbers.svg1[0] &&\n view.getUint8(1) === magicNumbers.svg1[1] &&\n view.getUint8(2) === magicNumbers.svg1[2] &&\n view.getUint8(3) === magicNumbers.svg1[3]) ||\n (view.getUint8(0) === magicNumbers.svg2[0] &&\n view.getUint8(1) === magicNumbers.svg2[1] &&\n view.getUint8(2) === magicNumbers.svg2[2] &&\n view.getUint8(3) === magicNumbers.svg2[3]);\n resolve(isSVG);\n break;\n }\n case 'application/pdf': {\n const isPDF =\n view.getUint8(0) === magicNumbers.pdf[0] &&\n view.getUint8(1) === magicNumbers.pdf[1] &&\n view.getUint8(2) === magicNumbers.pdf[2] &&\n view.getUint8(3) === magicNumbers.pdf[3];\n resolve(isPDF);\n break;\n }\n default:\n resolve(false);\n }\n };\n\n reader.onerror = (e) => {\n reject(e);\n };\n\n reader.readAsArrayBuffer(file);\n });\n}\n\n@intlPath({ module: '@adc/ui-components', path: 'drag-drop-file-upload' })\nexport default class DragDropFileUploadComponent extends Component {\n @service declare intl: ADCIntlService;\n @service declare notificationManager: NotificationManager;\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 * Readable file size string with units.\n */\n get maxFileSizeString(): string {\n return toByteString(this.maxFileSize);\n }\n\n /**\n * Name of the currently selected file.\n */\n @tracked fileName = '';\n\n @tracked fileSizeString = '';\n\n /**\n * Is the file being loaded?\n */\n @tracked isLoading = false;\n\n /**\n * Is a file being hovered over the drop zone?\n */\n @tracked isHovering = false;\n\n /**\n * Has a file been chosen/loaded?\n */\n @computed('args.file', 'fileName')\n get hasFile(): boolean {\n // Consider the initial file argument as having a file to have a smoother initial render for the addon.\n return this.args.file != null || this.fileName != '';\n }\n\n /**\n * Source of the image, if applicable.\n */\n @tracked imageSrc = '';\n\n @action\n async setupInitialFile(): Promise {\n if (this.args.file) {\n await this.processFile(this.args.file);\n }\n }\n\n /**\n * Upload a file when a user selects one to be uploaded.\n */\n @action\n async fileSelected(evt: Event & { target: HTMLInputElement }): Promise {\n const fileInput = evt.target,\n [file] = fileInput.files ?? [];\n\n if (!file) {\n return;\n }\n\n await this.processFile(file);\n\n fileInput.files = null;\n fileInput.value = '';\n }\n\n @action\n selectFile(ev: KeyboardEvent): void {\n if (!this.args?.disabled && (ev.key === ' ' || ev.key === 'Enter')) {\n ev.preventDefault();\n (ev.target as HTMLElement).closest('.drag-drop-file-upload')?.querySelector('input')?.click();\n }\n }\n\n @action\n async dropHandler(ev: DragEvent): Promise {\n if (!this.args?.disabled && !this.hasFile) {\n ev.preventDefault();\n this.isHovering = false;\n\n const [item] = ev.dataTransfer?.items ?? [];\n\n if (item && item.kind === 'file') {\n const file = item.getAsFile();\n\n if (file != null) {\n await this.processFile(file);\n return;\n }\n }\n }\n }\n\n private async processFile(file: File): Promise {\n const extensions = this.args.accept?.split(', ') ?? [];\n\n // Check if the file extension is one of the accepted file extensions and the file data is valid\n if (\n !(\n extensions &&\n extensions.some((ext) => file.name.toLowerCase().match(ext + '$')) &&\n (await isFileDataValid(file))\n )\n ) {\n this.notificationManager.addError(\n this.intl.tc(this, 'invalidFileType', {\n accept: this.args.accept\n })\n );\n return;\n }\n\n // Check if the file is too large\n if (file.size > this.maxFileSize) {\n this.notificationManager.addError(\n this.intl.tc(this, 'invalidFileSize', {\n maxFileSizeString: this.maxFileSizeString\n })\n );\n return;\n }\n\n const reader = new FileReader();\n this.isLoading = true;\n\n return new Promise((resolve, reject) => {\n reader.onload = (e) => {\n const dataUrl = e.target?.result as string;\n\n if (file.type.match('^image')) {\n this.imageSrc = dataUrl;\n }\n\n this.fileName = file.name;\n this.fileSizeString = toByteString(file.size);\n this.isLoading = false;\n\n this.args.fileChanged?.(file, dataUrl);\n resolve();\n };\n\n reader.onerror = (e) => {\n reject(e);\n };\n\n reader.readAsDataURL(file);\n });\n }\n\n @action\n dragOverHandler(ev: Event): void {\n if (!this.args?.disabled && !this.hasFile) {\n ev.preventDefault();\n this.isHovering = true;\n }\n }\n\n @action\n dragLeaveHandler(ev: Event): void {\n if (!this.args?.disabled && !this.hasFile) {\n ev.preventDefault();\n this.isHovering = false;\n }\n }\n\n @action\n deleteFile(): void {\n if (!this.args?.disabled) {\n this.fileName = '';\n this.fileSizeString = '';\n this.imageSrc = '';\n this.args.fileChanged?.(null, '');\n }\n }\n}\n","import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"\\n \\n \\n\")","import { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { service } from '@ember/service';\nimport getDate from 'date-fns/getDate';\nimport getHours from 'date-fns/getHours';\nimport getMinutes from 'date-fns/getMinutes';\nimport getMonth from 'date-fns/getMonth';\nimport getSeconds from 'date-fns/getSeconds';\nimport getYear from 'date-fns/getYear';\nimport set from 'date-fns/set';\nimport BaseTimezoneControl from './base-timezone-control.ts';\n\nimport type { Registry as ServiceRegistry } from '@ember/service';\nimport type { BaseTimezoneControlSignature } from './base-timezone-control';\n\nexport interface DateTimePickerComponentSignature {\n Element: HTMLFormElement;\n Args: BaseTimezoneControlSignature['Args'] & {\n /** The current selected date. */\n date: Date;\n /** Triggered when the user changes the date or time. */\n onchange: (date: Date) => void;\n /** Optional minimum date value. */\n minDate?: Date;\n /** Optional maximum date value. */\n maxDate?: Date;\n /** Indicates we should show seconds in the time picker. */\n showSeconds?: boolean;\n /** Called when the time/date controls are validated. */\n onValidation?: (isValid: boolean) => void;\n };\n}\n\n/**\n * @classdesc\n * A component with a smart date and smart time component, allowing users to select a single date/time.\n */\nexport default class DateTimePickerComponent extends BaseTimezoneControl {\n @service declare intl: ServiceRegistry['adc-intl'];\n\n /**\n * The currently selected date.\n */\n @tracked date: Date;\n\n constructor(owner: unknown, args: DateTimePickerComponentSignature['Args']) {\n super(owner, args);\n\n this.date = args.date;\n }\n\n private getDateString(date?: Date): string {\n return date\n ? this.intl.formatDateTz(date, {\n year: 'numeric',\n month: 'numeric',\n day: 'numeric'\n })\n : '';\n }\n\n get minTime(): Date | undefined {\n const { minDate } = this.args;\n return this.getDateString(this.date) === this.getDateString(minDate) ? minDate : undefined;\n }\n\n get maxTime(): Date | undefined {\n const { maxDate } = this.args;\n return this.getDateString(this.date) === this.getDateString(maxDate) ? maxDate : undefined;\n }\n\n private fieldValidity = {\n date: true,\n time: true\n };\n\n /**\n * Validates date/time then notifies consumer of newly selected date/time.\n */\n private selectDateTime(values: Parameters[1], evt: InputEvent): void {\n const date = (this.date = set(this.date, values)),\n form = evt.target as HTMLFormElement;\n\n // Are form inputs valid?\n if (form.reportValidity()) {\n this.notifyValidity();\n this.args.onchange(date);\n }\n }\n\n /**\n * Notifies consumers (via the `onValidation` callback) of the current validity of the date/time controls.\n */\n private notifyValidity(): void {\n const { fieldValidity } = this;\n this.args.onValidation?.(fieldValidity.date && fieldValidity.time);\n }\n\n /**\n * Update the date value.\n */\n @action changeDate(newDate: Date, evt: InputEvent): void {\n this.fieldValidity.date = true;\n this.selectDateTime(\n {\n year: getYear(newDate),\n month: getMonth(newDate),\n date: getDate(newDate)\n },\n evt\n );\n }\n\n /**\n * Update the time value.\n */\n @action changeTime(newTime: Date, evt: InputEvent): void {\n this.fieldValidity.time = true;\n this.selectDateTime(\n {\n hours: getHours(newTime),\n minutes: getMinutes(newTime),\n seconds: getSeconds(newTime)\n },\n evt\n );\n }\n\n /**\n * Called when one of the date/time inputs is invalid.\n */\n @action handleInvalid(evt: Event): void {\n this.fieldValidity[(evt.target as HTMLInputElement).getAttribute('type') === 'time' ? 'time' : 'date'] = false;\n this.notifyValidity();\n }\n}\n","import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"
\\n \\n\\n \\n {{yield}}\\n\\n \\n\\n
\\n \\n \\n
\\n \\n
\")","import { tracked } from '@glimmer/tracking';\nimport { action, computed } from '@ember/object';\nimport { inject as service } from '@ember/service';\nimport { intlPath } from '@adc/i18n/path';\nimport BaseTimezoneControl from './base-timezone-control.ts';\n\nimport type { Registry as ServiceRegistry } from '@ember/service';\nimport type { BaseTimezoneControlSignature } from './base-timezone-control';\nimport type { ButtonIconSignature } from './button/icon';\nimport type { DateTimePickerComponentSignature } from './date-time-picker.ts';\n\nexport interface SelectDateTimeComponentSignature extends BaseTimezoneControlSignature {\n Element: ButtonIconSignature['Element'];\n Args: Pick<\n DateTimePickerComponentSignature['Args'],\n 'minDate' | 'maxDate' | 'showSeconds' | 'timeZone' | 'onchange'\n > & {\n /** The current selected date. */\n date?: Date;\n };\n Blocks: {\n default: [];\n };\n}\n\n/**\n * @classdesc\n * A button, that when clicked, opens a popup with options for choosing a single date and time.\n */\n@intlPath({ module: '@adc/ui-components', path: 'select-date-time' })\nexport default class SelectDateTimeComponent extends BaseTimezoneControl {\n @service declare intl: ServiceRegistry['adc-intl'];\n\n /**\n * Indicates the date range picker popup is open.\n */\n @tracked isOpen = false;\n\n /**\n * Indicates the date/time selection controls are currently invalid.\n */\n @tracked isValid = false;\n\n /**\n * The currently selected date.\n */\n @tracked date: Date;\n\n constructor(owner: unknown, args: SelectDateTimeComponentSignature['Args']) {\n super(owner, args);\n\n this.date = args.date ?? new Date();\n }\n\n /**\n * The computed date range string.\n */\n @computed('args.{date,showSeconds}')\n get displayText(): string {\n const dateFmt: Intl.DateTimeFormatOptions = {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n hour: 'numeric',\n minute: '2-digit'\n };\n\n if (this.args.showSeconds) {\n dateFmt.second = '2-digit';\n }\n\n const { zone } = this;\n if (zone) {\n dateFmt.timeZone = zone;\n }\n\n return this.intl.formatDateTz(this.args.date, dateFmt);\n }\n\n /**\n * Toggles the date range picker popup opened or closed.\n */\n @action togglePicker(): void {\n this.isOpen = !this.isOpen;\n }\n\n /**\n * Notifies consumer of newly selected date.\n */\n @action selectDateTime(): void {\n this.togglePicker();\n this.args.onchange(this.date);\n }\n}\n"],"names":["TEMPLATE","createTemplateFactory","scope","didInsert_","tc_","on","svgSymbol_","spinnerSvg_","tc_0","media_","guidFor_","toByteString","bytes","i","Math","floor","log","pow","toPrecision","DragDropFileUploadComponent","c","_intl","WeakMap","_notificationManager","_fileName","_fileSizeString","_isLoading","_isHovering","_imageSrc","_DragDropFileUploadComponent","Component","constructor","arguments","_classPrivateFieldInitSpec","maxFileSize","_this$args$maxFileSiz","this","args","maxFileSizeString","hasFile","file","fileName","setupInitialFile","processFile","fileSelected","evt","_fileInput$files","fileInput","target","files","value","selectFile","ev","_this$args","_ev$target$closest","disabled","key","preventDefault","closest","querySelector","click","dropHandler","_this$args2","_ev$dataTransfer$item","_ev$dataTransfer","isHovering","item","dataTransfer","items","kind","getAsFile","_this$args$accept$spl","_this$args$accept","extensions","accept","split","some","ext","name","toLowerCase","match","Promise","resolve","reject","reader","FileReader","onloadend","e","_e$target","buffer","result","byteLength","view","DataView","magicNumbers","type","isJPEG","getUint8","isPNG","isSVG","isPDF","onerror","readAsArrayBuffer","isFileDataValid","notificationManager","addError","intl","tc","size","isLoading","onload","_e$target2","_this$args$fileChange","_this$args3","dataUrl","imageSrc","fileSizeString","fileChanged","call","readAsDataURL","dragOverHandler","_this$args4","dragLeaveHandler","_this$args5","deleteFile","_this$args6","_this$args$fileChange2","_this$args7","g","prototype","inject","tracked","n","computed","action","intlPath","module","path","setComponentTemplate","smartDate_","smartTime_","_date","DateTimePickerComponent","BaseTimezoneControl","owner","super","_defineProperty","date","time","getDateString","formatDateTz","year","month","day","minTime","minDate","undefined","maxTime","maxDate","selectDateTime","values","set","reportValidity","notifyValidity","onchange","_this$args$onValidati","fieldValidity","onValidation","changeDate","newDate","getYear","getMonth","getDate","changeTime","newTime","hours","getHours","minutes","getMinutes","seconds","getSeconds","handleInvalid","getAttribute","_DateTimePickerComponent","service","buttonIcon_","popoverMenu_","guidFor_0","dateTimePicker_","fn","buttonSimple_","t_","SelectDateTimeComponent","_isOpen","_isValid","_SelectDateTimeComponent","_args$date","Date","displayText","dateFmt","hour","minute","showSeconds","second","zone","timeZone","togglePicker","isOpen"],"sourceRoot":""}