@aerogel/core 0.0.0-next.c29ffcd25bffdbed37ecce3aac1ba14cde3e9d39 → 0.0.0-next.c2e6acc000e97a1020c2e232678563c53884dd0e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/dist/aerogel-core.d.ts +1223 -1792
  2. package/dist/aerogel-core.js +2968 -0
  3. package/dist/aerogel-core.js.map +1 -0
  4. package/package.json +27 -37
  5. package/src/bootstrap/bootstrap.test.ts +4 -7
  6. package/src/bootstrap/index.ts +14 -15
  7. package/src/bootstrap/options.ts +1 -1
  8. package/src/components/{AGAppLayout.vue → AppLayout.vue} +4 -4
  9. package/src/components/{AGAppModals.vue → AppModals.vue} +3 -4
  10. package/src/components/{AGAppOverlays.vue → AppOverlays.vue} +5 -5
  11. package/src/components/composition.ts +1 -1
  12. package/src/components/contracts/AlertModal.ts +4 -0
  13. package/src/components/contracts/Button.ts +15 -0
  14. package/src/components/contracts/ConfirmModal.ts +41 -0
  15. package/src/components/contracts/ErrorReportModal.ts +29 -0
  16. package/src/components/contracts/Input.ts +26 -0
  17. package/src/components/contracts/LoadingModal.ts +18 -0
  18. package/src/components/contracts/Modal.ts +9 -0
  19. package/src/components/contracts/PromptModal.ts +28 -0
  20. package/src/components/contracts/index.ts +7 -0
  21. package/src/components/contracts/shared.ts +9 -0
  22. package/src/components/forms/AGSelect.vue +11 -17
  23. package/src/components/forms/index.ts +0 -4
  24. package/src/components/headless/HeadlessButton.vue +45 -0
  25. package/src/components/headless/HeadlessInput.vue +59 -0
  26. package/src/components/headless/{forms/AGHeadlessInputDescription.vue → HeadlessInputDescription.vue} +6 -7
  27. package/src/components/headless/{forms/AGHeadlessInputError.vue → HeadlessInputError.vue} +4 -8
  28. package/src/components/headless/{forms/AGHeadlessInputInput.vue → HeadlessInputInput.vue} +10 -19
  29. package/src/components/headless/{forms/AGHeadlessInputLabel.vue → HeadlessInputLabel.vue} +3 -7
  30. package/src/components/headless/{forms/AGHeadlessInputTextArea.vue → HeadlessInputTextArea.vue} +6 -9
  31. package/src/components/headless/{modals/AGHeadlessModal.vue → HeadlessModal.vue} +16 -24
  32. package/src/components/headless/HeadlessModalContent.vue +24 -0
  33. package/src/components/headless/HeadlessModalOverlay.vue +12 -0
  34. package/src/components/headless/HeadlessModalTitle.vue +12 -0
  35. package/src/components/headless/forms/AGHeadlessSelect.ts +3 -3
  36. package/src/components/headless/forms/AGHeadlessSelect.vue +16 -16
  37. package/src/components/headless/forms/AGHeadlessSelectError.vue +2 -2
  38. package/src/components/headless/forms/AGHeadlessSelectOption.vue +10 -18
  39. package/src/components/headless/forms/AGHeadlessSelectOptions.vue +19 -0
  40. package/src/components/headless/forms/AGHeadlessSelectTrigger.vue +25 -0
  41. package/src/components/headless/forms/composition.ts +2 -2
  42. package/src/components/headless/forms/index.ts +2 -12
  43. package/src/components/headless/index.ts +12 -1
  44. package/src/components/headless/snackbars/index.ts +3 -3
  45. package/src/components/index.ts +5 -5
  46. package/src/components/lib/AGErrorMessage.vue +5 -5
  47. package/src/components/lib/AGMeasured.vue +2 -2
  48. package/src/components/lib/AGStartupCrash.vue +8 -8
  49. package/src/components/lib/index.ts +0 -3
  50. package/src/components/snackbars/AGSnackbar.vue +10 -8
  51. package/src/components/ui/AlertModal.vue +13 -0
  52. package/src/components/ui/Button.vue +58 -0
  53. package/src/components/ui/Checkbox.vue +49 -0
  54. package/src/components/ui/ConfirmModal.vue +42 -0
  55. package/src/components/ui/ErrorReportModal.vue +62 -0
  56. package/src/components/{modals/AGErrorReportModalButtons.vue → ui/ErrorReportModalButtons.vue} +29 -20
  57. package/src/components/ui/ErrorReportModalTitle.vue +24 -0
  58. package/src/components/{forms/AGForm.vue → ui/Form.vue} +4 -5
  59. package/src/components/ui/Input.vue +52 -0
  60. package/src/components/ui/Link.vue +12 -0
  61. package/src/components/ui/LoadingModal.vue +32 -0
  62. package/src/components/ui/Markdown.vue +62 -0
  63. package/src/components/ui/Modal.vue +55 -0
  64. package/src/components/{modals/AGModalContext.vue → ui/ModalContext.vue} +7 -9
  65. package/src/components/ui/ProgressBar.vue +50 -0
  66. package/src/components/ui/PromptModal.vue +35 -0
  67. package/src/components/ui/index.ts +16 -0
  68. package/src/components/utils.ts +106 -9
  69. package/src/directives/index.ts +9 -5
  70. package/src/directives/measure.ts +1 -1
  71. package/src/errors/Errors.state.ts +1 -1
  72. package/src/errors/Errors.ts +14 -14
  73. package/src/errors/index.ts +9 -6
  74. package/src/errors/utils.ts +1 -1
  75. package/src/forms/{Form.test.ts → FormController.test.ts} +5 -4
  76. package/src/forms/{Form.ts → FormController.ts} +22 -19
  77. package/src/forms/composition.ts +4 -4
  78. package/src/forms/index.ts +2 -2
  79. package/src/forms/utils.ts +2 -2
  80. package/src/index.css +8 -0
  81. package/src/jobs/Job.ts +2 -2
  82. package/src/lang/DefaultLangProvider.ts +7 -4
  83. package/src/lang/Lang.state.ts +1 -1
  84. package/src/lang/Lang.ts +1 -1
  85. package/src/lang/index.ts +8 -6
  86. package/src/plugins/Plugin.ts +1 -1
  87. package/src/plugins/index.ts +10 -7
  88. package/src/services/App.state.ts +4 -3
  89. package/src/services/App.ts +4 -4
  90. package/src/services/Cache.ts +1 -1
  91. package/src/services/Events.ts +2 -2
  92. package/src/services/Service.ts +21 -21
  93. package/src/services/Storage.ts +3 -3
  94. package/src/services/index.ts +5 -4
  95. package/src/services/utils.ts +2 -2
  96. package/src/testing/index.ts +4 -3
  97. package/src/testing/setup.ts +3 -19
  98. package/src/ui/UI.state.ts +10 -5
  99. package/src/ui/UI.ts +53 -40
  100. package/src/ui/index.ts +16 -16
  101. package/src/utils/composition/events.ts +2 -2
  102. package/src/utils/composition/forms.ts +4 -3
  103. package/src/utils/markdown.ts +3 -5
  104. package/src/utils/vdom.ts +31 -0
  105. package/src/utils/vue.ts +7 -12
  106. package/dist/aerogel-core.cjs.js +0 -2
  107. package/dist/aerogel-core.cjs.js.map +0 -1
  108. package/dist/aerogel-core.esm.js +0 -2
  109. package/dist/aerogel-core.esm.js.map +0 -1
  110. package/histoire.config.ts +0 -7
  111. package/noeldemartin.config.js +0 -5
  112. package/postcss.config.js +0 -6
  113. package/src/assets/histoire.css +0 -3
  114. package/src/components/forms/AGButton.vue +0 -44
  115. package/src/components/forms/AGCheckbox.vue +0 -41
  116. package/src/components/forms/AGInput.vue +0 -40
  117. package/src/components/headless/forms/AGHeadlessButton.ts +0 -3
  118. package/src/components/headless/forms/AGHeadlessButton.vue +0 -62
  119. package/src/components/headless/forms/AGHeadlessInput.ts +0 -34
  120. package/src/components/headless/forms/AGHeadlessInput.vue +0 -70
  121. package/src/components/headless/forms/AGHeadlessSelectButton.vue +0 -24
  122. package/src/components/headless/forms/AGHeadlessSelectLabel.vue +0 -24
  123. package/src/components/headless/forms/AGHeadlessSelectOptions.ts +0 -3
  124. package/src/components/headless/modals/AGHeadlessModal.ts +0 -36
  125. package/src/components/headless/modals/AGHeadlessModalPanel.vue +0 -32
  126. package/src/components/headless/modals/AGHeadlessModalTitle.vue +0 -23
  127. package/src/components/headless/modals/index.ts +0 -4
  128. package/src/components/interfaces.ts +0 -24
  129. package/src/components/lib/AGLink.vue +0 -9
  130. package/src/components/lib/AGMarkdown.vue +0 -54
  131. package/src/components/lib/AGProgressBar.vue +0 -45
  132. package/src/components/modals/AGAlertModal.ts +0 -18
  133. package/src/components/modals/AGAlertModal.vue +0 -14
  134. package/src/components/modals/AGConfirmModal.ts +0 -42
  135. package/src/components/modals/AGConfirmModal.vue +0 -26
  136. package/src/components/modals/AGErrorReportModal.ts +0 -49
  137. package/src/components/modals/AGErrorReportModal.vue +0 -54
  138. package/src/components/modals/AGErrorReportModalTitle.vue +0 -25
  139. package/src/components/modals/AGLoadingModal.ts +0 -29
  140. package/src/components/modals/AGLoadingModal.vue +0 -15
  141. package/src/components/modals/AGModal.ts +0 -11
  142. package/src/components/modals/AGModal.vue +0 -39
  143. package/src/components/modals/AGModalContext.ts +0 -8
  144. package/src/components/modals/AGModalTitle.vue +0 -9
  145. package/src/components/modals/AGPromptModal.ts +0 -41
  146. package/src/components/modals/AGPromptModal.vue +0 -34
  147. package/src/components/modals/index.ts +0 -17
  148. package/src/directives/initial-focus.ts +0 -11
  149. package/src/main.histoire.ts +0 -1
  150. package/tailwind.config.js +0 -4
  151. package/tsconfig.json +0 -11
  152. package/vite.config.ts +0 -17
  153. /package/src/components/{AGAppSnackbars.vue → AppSnackbars.vue} +0 -0
  154. /package/src/{main.ts → index.ts} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"aerogel-core.cjs.js","sources":["../src/errors/ServiceBootError.ts","../src/services/store.ts","../src/services/Service.ts","../src/services/Events.ts","../src/services/App.state.ts","../src/services/App.ts","../src/plugins/index.ts","../src/utils/vue.ts","../src/directives/initial-focus.ts","../src/directives/measure.ts","../src/directives/index.ts","../src/services/Cache.ts","../src/services/Storage.ts","../src/services/index.ts","../src/ui/utils.ts","../src/ui/UI.state.ts","../src/ui/UI.ts","../src/lang/DefaultLangProvider.ts","../src/lang/Lang.state.ts","../src/lang/Lang.ts","../src/lang/utils.ts","../src/errors/Errors.state.ts","../src/components/constants.ts","../src/errors/Errors.ts","../src/errors/utils.ts","../src/errors/index.ts","../src/lang/index.ts","../src/testing/index.ts","../src/utils/composition/events.ts","../src/utils/composition/forms.ts","../src/utils/markdown.ts","../src/components/utils.ts","../src/components/headless/modals/AGHeadlessModal.ts","../src/components/headless/modals/AGHeadlessModal.vue","../src/components/modals/AGModalContext.vue","../src/components/headless/modals/AGHeadlessModalPanel.vue","../src/components/headless/modals/AGHeadlessModalTitle.vue","../src/components/lib/AGMarkdown.vue","../src/components/modals/AGModal.vue","../src/components/modals/AGAlertModal.ts","../src/components/modals/AGConfirmModal.ts","../src/components/interfaces.ts","../src/components/composition.ts","../src/components/headless/forms/AGHeadlessButton.vue","../src/components/forms/AGButton.vue","../src/components/modals/AGConfirmModal.vue","../src/components/modals/AGErrorReportModal.ts","../src/components/modals/AGErrorReportModalButtons.vue","../src/components/modals/AGErrorReportModalTitle.vue","../src/components/modals/AGErrorReportModal.vue","../src/components/modals/AGLoadingModal.ts","../src/components/modals/AGLoadingModal.vue","../src/components/modals/AGPromptModal.ts","../src/components/forms/AGForm.vue","../src/components/headless/forms/AGHeadlessInput.ts","../src/components/headless/forms/AGHeadlessInput.vue","../src/components/headless/forms/AGHeadlessInputDescription.vue","../src/components/headless/forms/AGHeadlessInputError.vue","../src/components/headless/forms/composition.ts","../src/components/headless/forms/AGHeadlessInputInput.vue","../src/components/headless/forms/AGHeadlessInputLabel.vue","../src/components/forms/AGInput.vue","../src/forms/validation.ts","../src/forms/Form.ts","../src/forms/composition.ts","../src/forms/utils.ts","../src/components/modals/AGPromptModal.vue","../src/components/headless/snackbars/index.ts","../src/components/snackbars/AGSnackbar.vue","../src/ui/index.ts","../src/bootstrap/index.ts","../src/components/AGAppModals.vue","../src/components/AGAppSnackbars.vue?vue&type=template&id=7942f27a&lang.js","../src/components/AGAppOverlays.vue","../src/components/forms/AGCheckbox.vue","../src/components/headless/forms/AGHeadlessSelect.ts","../src/components/headless/forms/AGHeadlessSelect.vue","../src/components/headless/forms/AGHeadlessSelectButton.vue","../src/components/headless/forms/AGHeadlessSelectError.vue","../src/components/headless/forms/AGHeadlessSelectLabel.vue","../src/components/headless/forms/AGHeadlessSelectOption.vue","../src/components/forms/AGSelect.vue","../src/components/headless/forms/AGHeadlessInputTextArea.vue","../src/components/lib/AGErrorMessage.vue","../src/components/lib/AGMeasured.vue","../src/components/lib/AGProgressBar.vue","../src/errors/JobCancelledError.ts","../src/jobs/Job.ts","../src/jobs/index.ts","../src/utils/composition/hooks.ts","../src/utils/composition/persistent.ts","../src/utils/tailwindcss.ts","../src/services/utils.ts"],"sourcesContent":["import { JSError } from '@noeldemartin/utils';\n\nexport default class ServiceBootError extends JSError {\n\n constructor(serviceNamespace: string, cause: unknown) {\n super(`Service '${serviceNamespace}' failed booting`, { cause });\n }\n\n}\n","import { tap } from '@noeldemartin/utils';\nimport { createPinia, defineStore, setActivePinia } from 'pinia';\nimport type { DefineStoreOptions, Pinia, StateTree, Store, _GettersTree } from 'pinia';\n\nlet _store: Pinia | null = null;\n\nfunction initializePiniaStore(): Pinia {\n return _store ?? resetPiniaStore();\n}\n\nexport function resetPiniaStore(): Pinia {\n return tap(createPinia(), (store) => {\n _store = store;\n\n setActivePinia(store);\n });\n}\n\nexport function getPiniaStore(): Pinia {\n return _store ?? initializePiniaStore();\n}\n\nexport function defineServiceStore<Id extends string, S extends StateTree = {}, G extends _GettersTree<S> = {}, A = {}>(\n name: Id,\n options: Omit<DefineStoreOptions<Id, S, G, A>, 'id'>,\n): Store<Id, S, G, A> {\n initializePiniaStore();\n\n return defineStore(name, options)();\n}\n","import {\n MagicObject,\n PromisedValue,\n Storage,\n arrayFrom,\n fail,\n isEmpty,\n objectDeepClone,\n objectOnly,\n} from '@noeldemartin/utils';\nimport type { Constructor, Nullable } from '@noeldemartin/utils';\nimport type { Store } from 'pinia';\n\nimport ServiceBootError from '@/errors/ServiceBootError';\nimport { defineServiceStore } from '@/services/store';\nimport type { Unref } from '@/utils/vue';\n\nexport type ServiceState = Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any\nexport type DefaultServiceState = any; // eslint-disable-line @typescript-eslint/no-explicit-any\nexport type ServiceConstructor<T extends Service = Service> = Constructor<T> & typeof Service;\n\nexport type ComputedStateDefinition<TState extends ServiceState, TComputedState extends ServiceState> = {\n [K in keyof TComputedState]: (state: Unref<TState>) => TComputedState[K];\n} & ThisType<{\n readonly [K in keyof TComputedState]: TComputedState[K];\n}>;\n\nexport type StateWatchers<TService extends Service, TState extends ServiceState> = {\n [K in keyof TState]?: (this: TService, value: TState[K], oldValue: TState[K]) => unknown;\n};\n\nexport type ServiceWithState<\n State extends ServiceState = ServiceState,\n ComputedState extends ServiceState = {},\n ServiceStorage = Partial<State>\n> = Constructor<Unref<State>> &\n Constructor<ComputedState> &\n Constructor<Service<Unref<State>, ComputedState, Unref<ServiceStorage>>>;\n\nexport function defineServiceState<\n State extends ServiceState = ServiceState,\n ComputedState extends ServiceState = {},\n ServiceStorage = Partial<State>\n>(options: {\n name: string;\n initialState: State | (() => State);\n persist?: (keyof State)[];\n watch?: StateWatchers<Service, State>;\n computed?: ComputedStateDefinition<State, ComputedState>;\n serialize?: (state: Partial<State>) => ServiceStorage;\n restore?: (state: ServiceStorage) => Partial<State>;\n}): ServiceWithState<State, ComputedState, ServiceStorage> {\n return class extends Service<Unref<State>, ComputedState, ServiceStorage> {\n\n public static persist = (options.persist as string[]) ?? [];\n\n protected usesStore(): boolean {\n return true;\n }\n\n protected getName(): string | null {\n return options.name ?? null;\n }\n\n protected getInitialState(): Unref<State> {\n if (typeof options.initialState === 'function') {\n return options.initialState();\n }\n\n return Object.entries(options.initialState).reduce((state, [key, value]) => {\n try {\n value = structuredClone(value);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn(\n `Could not clone '${key}' state from ${this.getName()} service, ` +\n 'this may cause problems if you\\'re using multiple instances of the service ' +\n '(for example, in unit tests).\\n' +\n 'To fix this problem, declare your initialState as a function instead.',\n );\n }\n\n state[key as keyof State] = value;\n\n return state;\n }, {} as Unref<State>);\n }\n\n protected getComputedStateDefinition(): ComputedStateDefinition<Unref<State>, ComputedState> {\n return (options.computed ?? {}) as ComputedStateDefinition<Unref<State>, ComputedState>;\n }\n\n protected getStateWatchers(): StateWatchers<Service, Unref<State>> {\n return (options.watch ?? {}) as StateWatchers<Service, Unref<State>>;\n }\n\n protected serializePersistedState(state: Partial<State>): ServiceStorage {\n return options.serialize?.(state) ?? (state as ServiceStorage);\n }\n\n protected deserializePersistedState(state: ServiceStorage): Partial<State> {\n return options.restore?.(state) ?? (state as Partial<State>);\n }\n \n } as unknown as ServiceWithState<State, ComputedState, ServiceStorage>;\n}\n\nexport default class Service<\n State extends ServiceState = DefaultServiceState,\n ComputedState extends ServiceState = {},\n ServiceStorage = Partial<State>\n> extends MagicObject {\n\n public static persist: string[] = [];\n\n protected _name: string;\n private _booted: PromisedValue<void>;\n private _computedStateKeys: Set<keyof State>;\n private _watchers: StateWatchers<Service, State>;\n private _store: Store<string, State, ComputedState, {}> | false;\n\n constructor() {\n super();\n\n const getters = this.getComputedStateDefinition();\n\n this._name = this.getName() ?? new.target.name;\n this._booted = new PromisedValue();\n this._computedStateKeys = new Set(Object.keys(getters));\n this._watchers = this.getStateWatchers();\n this._store =\n this.usesStore() &&\n defineServiceStore(this._name, {\n state: () => this.getInitialState(),\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getters: getters as any,\n });\n }\n\n public get booted(): PromisedValue<void> {\n return this._booted;\n }\n\n public static<T extends typeof Service>(): T;\n public static<T extends typeof Service, K extends keyof T>(property: K): T[K];\n public static<T extends typeof Service, K extends keyof T>(property?: K): T | T[K] {\n return super.static<T, K>(property as K);\n }\n\n public launch(): Promise<void> {\n const handleError = (error: unknown) => this._booted.reject(new ServiceBootError(this._name, error));\n\n try {\n this.frameworkBoot()\n .then(() => this.boot())\n .then(() => this._booted.resolve())\n .catch(handleError);\n } catch (error) {\n handleError(error);\n }\n\n return this._booted;\n }\n\n public hasPersistedState(): boolean {\n return Storage.has(this._name);\n }\n\n public hasState<P extends keyof State>(property: P): boolean {\n if (!this._store) {\n return false;\n }\n\n return property in this._store.$state || this._computedStateKeys.has(property);\n }\n\n public getState(): State;\n public getState<P extends keyof State>(property: P): State[P];\n public getState<P extends keyof State>(property?: P): State | State[P] {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const store = this._store as any;\n\n if (property) {\n return store ? store[property] : undefined;\n }\n\n return store ? store : {};\n }\n\n public setState<P extends keyof State>(property: P, value: State[P]): void;\n public setState(state: Partial<State>): void;\n public setState<P extends keyof State>(stateOrProperty: P | Partial<State>, value?: State[P]): void {\n if (!this._store) {\n return;\n }\n\n const update = typeof stateOrProperty === 'string' ? { [stateOrProperty]: value } : stateOrProperty;\n const old = objectOnly(this._store.$state as State, Object.keys(update));\n\n Object.assign(this._store.$state, update);\n this.onStateUpdated(update as Partial<State>, old as Partial<State>);\n }\n\n public updatePersistedState<T extends keyof State>(key: T): void;\n public updatePersistedState<T extends keyof State>(keys: T[]): void;\n public updatePersistedState<T extends keyof State>(keyOrKeys: T | T[]): void {\n if (!this._store) {\n return;\n }\n\n const keys = arrayFrom(keyOrKeys) as Array<keyof State>;\n const state = objectOnly(this._store.$state as State, keys);\n\n if (isEmpty(state)) {\n return;\n }\n\n this.onPersistentStateUpdated(state);\n }\n\n protected __get(property: string): unknown {\n if (this.hasState(property)) {\n return this.getState(property);\n }\n\n return super.__get(property);\n }\n\n protected __set(property: string, value: unknown): void {\n this.setState({ [property]: value } as Partial<State>);\n }\n\n protected onStateUpdated(update: Partial<State>, old: Partial<State>): void {\n const persisted = objectOnly(update, this.static('persist'));\n\n if (!isEmpty(persisted)) {\n this.onPersistentStateUpdated(persisted as Partial<State>);\n }\n\n for (const property in update) {\n const watcher = this._watchers[property] as Nullable<(value: unknown, oldValue: unknown) => unknown>;\n\n if (!watcher || update[property] === old[property]) {\n continue;\n }\n\n watcher.call(this, update[property], old[property]);\n }\n }\n\n protected onPersistentStateUpdated(persisted: Partial<State>): void {\n const storage = Storage.get<ServiceStorage>(this._name);\n\n if (!storage) {\n return;\n }\n\n Storage.set(this._name, {\n ...storage,\n ...this.serializePersistedState(objectDeepClone(persisted) as Partial<State>),\n });\n }\n\n protected usesStore(): boolean {\n return false;\n }\n\n protected getName(): string | null {\n return null;\n }\n\n protected getInitialState(): State {\n return {} as State;\n }\n\n protected getComputedStateDefinition(): ComputedStateDefinition<State, ComputedState> {\n return {} as ComputedStateDefinition<State, ComputedState>;\n }\n\n protected getStateWatchers(): StateWatchers<Service, State> {\n return {};\n }\n\n protected serializePersistedState(state: Partial<State>): ServiceStorage {\n return state as ServiceStorage;\n }\n\n protected deserializePersistedState(state: ServiceStorage): Partial<State> {\n return state as Partial<State>;\n }\n\n protected async frameworkBoot(): Promise<void> {\n this.restorePersistedState();\n }\n\n protected async boot(): Promise<void> {\n // Placeholder for overrides, don't place any functionality here.\n }\n\n protected restorePersistedState(): void {\n if (!this.usesStore() || isEmpty(this.static('persist'))) {\n return;\n }\n\n if (Storage.has(this._name)) {\n const persisted = Storage.require<ServiceStorage>(this._name);\n this.setState(this.deserializePersistedState(persisted));\n\n return;\n }\n\n Storage.set(this._name, objectOnly(this.getState(), this.static('persist')));\n }\n\n protected requireStore(): Store<string, State, ComputedState, {}> {\n if (!this._store) {\n return fail(`Failed getting '${this._name}' store`);\n }\n\n return this._store;\n }\n\n}\n","import { arrayRemove, facade, fail, tap } from '@noeldemartin/utils';\n\nimport Service from '@/services/Service';\n\nexport interface EventsPayload {}\nexport interface EventListenerOptions {\n priority: EventListenerPriority;\n}\nexport type AerogelGlobalEvents = Partial<{ [Event in EventWithoutPayload]: () => unknown }> &\n Partial<{ [Event in EventWithPayload]: EventListener<EventsPayload[Event]> }>;\n\nexport type EventListener<T = unknown> = (payload: T) => unknown;\nexport type UnknownEvent<T> = T extends keyof EventsPayload ? never : T;\n\nexport type EventWithoutPayload = {\n [K in keyof EventsPayload]: EventsPayload[K] extends void ? K : never;\n}[keyof EventsPayload];\n\nexport type EventWithPayload = {\n [K in keyof EventsPayload]: EventsPayload[K] extends void ? never : K;\n}[keyof EventsPayload];\n\nexport const EventListenerPriorities = {\n Low: -256,\n Default: 0,\n High: 256,\n} as const;\n\nexport type EventListenerPriority = (typeof EventListenerPriorities)[keyof typeof EventListenerPriorities];\n\nexport class EventsService extends Service {\n\n private listeners: Record<string, { priorities: number[]; handlers: Record<number, EventListener[]> }> = {};\n\n protected async boot(): Promise<void> {\n Object.entries(globalThis.__aerogelEvents__ ?? {}).forEach(([event, listener]) =>\n this.on(event as string, listener as EventListener));\n }\n\n public emit<Event extends EventWithoutPayload>(event: Event): Promise<void>;\n public emit<Event extends EventWithPayload>(event: Event, payload: EventsPayload[Event]): Promise<void>;\n public emit<Event extends string>(event: UnknownEvent<Event>, payload?: unknown): Promise<void>;\n public async emit(event: string, payload?: unknown): Promise<void> {\n const listeners = this.listeners[event] ?? { priorities: [], handlers: {} };\n\n for (const priority of listeners.priorities) {\n await Promise.all(listeners.handlers[priority]?.map((listener) => listener(payload)) ?? []);\n }\n }\n\n /* eslint-disable max-len */\n public on<Event extends EventWithoutPayload>(event: Event, listener: () => unknown): () => void;\n public on<Event extends EventWithoutPayload>(event: Event, priority: EventListenerPriority, listener: () => unknown): () => void; // prettier-ignore\n public on<Event extends EventWithoutPayload>(event: Event, options: Partial<EventListenerOptions>, listener: () => unknown): () => void; // prettier-ignore\n public on<Event extends EventWithPayload>(event: Event, listener: EventListener<EventsPayload[Event]>): () => void | void; // prettier-ignore\n public on<Event extends EventWithPayload>(event: Event, priority: EventListenerPriority, listener: EventListener<EventsPayload[Event]>): () => void | void; // prettier-ignore\n public on<Event extends EventWithPayload>(event: Event, options: Partial<EventListenerOptions>, listener: EventListener<EventsPayload[Event]>): () => void | void; // prettier-ignore\n public on<Event extends string>(event: UnknownEvent<Event>, listener: EventListener): () => void;\n public on<Event extends string>(event: UnknownEvent<Event>, priority: EventListenerPriority, listener: EventListener): () => void; // prettier-ignore\n public on<Event extends string>(event: UnknownEvent<Event>, options: Partial<EventListenerOptions>, listener: EventListener): () => void; // prettier-ignore\n /* eslint-enable max-len */\n\n public on(\n event: string,\n optionsOrListener: Partial<EventListenerOptions> | EventListenerPriority | EventListener,\n listener?: EventListener,\n ): () => void {\n const options =\n typeof optionsOrListener === 'function'\n ? {}\n : typeof optionsOrListener === 'number'\n ? { priority: optionsOrListener }\n : optionsOrListener;\n const handler = typeof optionsOrListener === 'function' ? optionsOrListener : (listener as EventListener);\n\n this.registerListener(event, options, handler);\n\n return () => this.off(event, handler);\n }\n\n /* eslint-disable max-len */\n public once<Event extends EventWithoutPayload>(event: Event, listener: () => unknown): () => void;\n public once<Event extends EventWithoutPayload>(event: Event, options: Partial<EventListenerOptions>, listener: () => unknown): () => void; // prettier-ignore\n public once<Event extends EventWithPayload>(event: Event, listener: EventListener<EventsPayload[Event]>): () => void | void; // prettier-ignore\n public once<Event extends EventWithPayload>(event: Event, options: Partial<EventListenerOptions>, listener: EventListener<EventsPayload[Event]>): () => void | void; // prettier-ignore\n public once<Event extends string>(event: UnknownEvent<Event>, listener: EventListener): () => void;\n public once<Event extends string>(event: UnknownEvent<Event>, options: Partial<EventListenerOptions>, listener: EventListener): () => void; // prettier-ignore\n /* eslint-enable max-len */\n\n public once(\n event: string,\n optionsOrListener: Partial<EventListenerOptions> | EventListener,\n listener?: EventListener,\n ): () => void {\n let onceListener: EventListener | null = null;\n const options = typeof optionsOrListener === 'function' ? {} : optionsOrListener;\n const handler = typeof optionsOrListener === 'function' ? optionsOrListener : (listener as EventListener);\n\n return tap(\n () => onceListener && this.off(event, onceListener),\n (off) => {\n onceListener = (...args) => {\n off();\n\n return handler(...args);\n };\n\n this.registerListener(event, options, handler);\n },\n );\n }\n\n public off(event: string, listener: EventListener): void {\n const listeners = this.listeners[event];\n\n if (!listeners) {\n return;\n }\n\n const priorities = [...listeners.priorities];\n\n for (const priority of priorities) {\n arrayRemove(listeners.handlers[priority] ?? [], listener);\n\n if (listeners.handlers[priority]?.length === 0) {\n delete listeners.handlers[priority];\n arrayRemove(listeners.priorities, priority);\n }\n }\n\n if (listeners.priorities.length === 0) {\n delete this.listeners[event];\n }\n }\n\n protected registerListener(event: string, options: Partial<EventListenerOptions>, handler: EventListener): void {\n const priority = options.priority ?? 0;\n\n if (!(event in this.listeners)) {\n this.listeners[event] = { priorities: [], handlers: {} };\n }\n\n const priorities =\n this.listeners[event]?.priorities ?? fail<number[]>(`priorities missing for event '${event}'`);\n const handlers =\n this.listeners[event]?.handlers ??\n fail<Record<number, EventListener[]>>(`handlers missing for event '${event}'`);\n\n if (!priorities.includes(priority)) {\n priorities.push(priority);\n priorities.sort((a, b) => b - a);\n handlers[priority] = [];\n }\n\n handlers[priority]?.push(handler);\n }\n\n}\n\nexport default facade(EventsService);\n\ndeclare global {\n // eslint-disable-next-line no-var\n var __aerogelEvents__: AerogelGlobalEvents | undefined;\n}\n","import Aerogel from 'virtual:aerogel';\n\nimport type { App } from 'vue';\n\nimport { defineServiceState } from '@/services/Service';\nimport type { Plugin } from '@/plugins/Plugin';\n\nexport default defineServiceState({\n name: 'app',\n initialState: {\n plugins: {} as Record<string, Plugin>,\n instance: null as App | null,\n environment: Aerogel.environment,\n version: Aerogel.version,\n sourceUrl: Aerogel.sourceUrl,\n },\n computed: {\n development: (state) => state.environment === 'development',\n staging: (state) => state.environment === 'staging',\n testing: (state) => state.environment === 'test' || state.environment === 'testing',\n versionName(state): string {\n if (this.development) {\n return 'dev.' + Aerogel.sourceHash.toString().substring(0, 7);\n }\n\n if (this.staging) {\n return 'staging.' + Aerogel.sourceHash.toString().substring(0, 7);\n }\n\n return `v${state.version}`;\n },\n versionUrl(state): string {\n return (\n state.sourceUrl +\n (this.development || this.staging ? `/tree/${Aerogel.sourceHash}` : `/releases/tag/${this.versionName}`)\n );\n },\n },\n});\n","import Aerogel from 'virtual:aerogel';\n\nimport { PromisedValue, facade, forever, updateLocationQueryParameters } from '@noeldemartin/utils';\n\nimport Events from '@/services/Events';\nimport type { Plugin } from '@/plugins';\nimport type { Services } from '@/services';\n\nimport Service from './App.state';\n\nexport class AppService extends Service {\n\n public readonly name = Aerogel.name;\n public readonly ready = new PromisedValue<void>();\n public readonly mounted = new PromisedValue<void>();\n\n public isReady(): boolean {\n return this.ready.isResolved();\n }\n\n public isMounted(): boolean {\n return this.mounted.isResolved();\n }\n\n public async whenReady<T>(callback: () => T): Promise<T> {\n const result = await this.ready.then(callback);\n\n return result;\n }\n\n public async reload(queryParameters?: Record<string, string | undefined>): Promise<void> {\n queryParameters && updateLocationQueryParameters(queryParameters);\n\n location.reload();\n\n // Stall until the reload happens\n await forever();\n }\n\n public plugin<T extends Plugin = Plugin>(name: string): T | null {\n return (this.plugins[name] as T) ?? null;\n }\n\n public service<T extends keyof Services>(name: T): Services[T] | null {\n return this.instance?.config.globalProperties[name] ?? null;\n }\n\n protected async boot(): Promise<void> {\n Events.once('application-ready', () => this.ready.resolve());\n Events.once('application-mounted', () => this.mounted.resolve());\n }\n\n}\n\nexport default facade(AppService);\n","import type { GetClosureArgs } from '@noeldemartin/utils';\n\nimport App from '@/services/App';\n\nimport type { Plugin } from './Plugin';\n\nexport * from './Plugin';\n\nexport function definePlugin<T extends Plugin>(plugin: T): T {\n return plugin;\n}\n\nexport async function installPlugins(plugins: Plugin[], ...args: GetClosureArgs<Plugin['install']>): Promise<void> {\n App.setState(\n 'plugins',\n plugins.reduce((pluginsMap, plugin) => {\n if (plugin.name) {\n pluginsMap[plugin.name] = plugin;\n }\n\n return pluginsMap;\n }, {} as Record<string, Plugin>),\n );\n\n await Promise.all(plugins.map((plugin) => plugin.install(...args)) ?? []);\n}\n","import { fail } from '@noeldemartin/utils';\nimport { computed, inject, reactive, ref, watch } from 'vue';\nimport type { Directive, InjectionKey, MaybeRef, PropType, Ref, UnwrapNestedRefs } from 'vue';\n\ntype BaseProp<T> = {\n type?: PropType<T>;\n validator?(value: unknown): boolean;\n};\n\ntype RequiredProp<T> = BaseProp<T> & { required: true };\ntype OptionalProp<T> = BaseProp<T> & { default: T | (() => T) | null };\n\nexport type AcceptRefs<T> = { [K in keyof T]: T[K] | RefUnion<T[K]> };\nexport type ComponentProps = Record<string, unknown>;\nexport type RefUnion<T> = T extends infer R ? Ref<R> : never;\nexport type Unref<T> = { [K in keyof T]: T[K] extends MaybeRef<infer Value> ? Value : T[K] };\n\nexport function arrayProp<T>(defaultValue?: () => T[]): OptionalProp<T[]> {\n return {\n type: Array as PropType<T[]>,\n default: defaultValue ?? (() => []),\n };\n}\n\nexport function booleanProp(defaultValue: boolean = false): OptionalProp<boolean> {\n return {\n type: Boolean,\n default: defaultValue,\n };\n}\n\nexport function componentRef<T>(): Ref<UnwrapNestedRefs<T> | undefined> {\n return ref<UnwrapNestedRefs<T>>();\n}\n\nexport function computedAsync<T>(getter: () => Promise<T>): Ref<T | undefined> {\n const result = ref<T>();\n const asyncValue = computed(getter);\n\n watch(asyncValue, async () => (result.value = await asyncValue.value), { immediate: true });\n\n return result;\n}\n\nexport function defineDirective(directive: Directive): Directive {\n return directive;\n}\n\nexport function enumProp<Enum extends Record<string, unknown>>(\n enumeration: Enum,\n defaultValue?: Enum[keyof Enum],\n): OptionalProp<Enum[keyof Enum]> {\n const values = Object.values(enumeration) as Enum[keyof Enum][];\n\n return {\n type: String as unknown as PropType<Enum[keyof Enum]>,\n default: defaultValue ?? values[0] ?? null,\n validator: (value) => values.includes(value as Enum[keyof Enum]),\n };\n}\n\nexport function injectReactive<T extends object>(key: InjectionKey<T> | string): UnwrapNestedRefs<T> | undefined {\n const value = inject(key);\n\n return value ? reactive<T>(value) : undefined;\n}\n\nexport function injectReactiveOrFail<T extends object>(\n key: InjectionKey<T> | string,\n errorMessage?: string,\n): UnwrapNestedRefs<T> {\n return injectReactive(key) ?? fail(errorMessage ?? `Could not resolve '${key}' injection key`);\n}\n\nexport function injectOrFail<T>(key: InjectionKey<T> | string, errorMessage?: string): T {\n return inject(key) ?? fail(errorMessage ?? `Could not resolve '${key}' injection key`);\n}\n\nexport function listenerProp<T extends Function = Function>(): OptionalProp<T | null> {\n return {\n type: Function as PropType<T>,\n default: null,\n };\n}\n\nexport function mixedProp<T>(type?: PropType<T>): OptionalProp<T | null>;\nexport function mixedProp<T>(type: PropType<T>, defaultValue: T): OptionalProp<T>;\nexport function mixedProp<T>(type?: PropType<T>, defaultValue?: T): OptionalProp<T | null> {\n return {\n type,\n default: defaultValue ?? null,\n };\n}\n\nexport function numberProp(): OptionalProp<number | null>;\nexport function numberProp(defaultValue: number): OptionalProp<number>;\nexport function numberProp(defaultValue: number | null = null): OptionalProp<number | null> {\n return {\n type: Number,\n default: defaultValue,\n };\n}\n\nexport function objectProp<T = Object>(): OptionalProp<T | null>;\nexport function objectProp<T>(defaultValue: () => T): OptionalProp<T>;\nexport function objectProp<T = Object>(defaultValue: (() => T) | null = null): OptionalProp<T | null> {\n return {\n type: Object,\n default: defaultValue,\n };\n}\n\nexport function requiredArrayProp<T>(): RequiredProp<T[]> {\n return {\n type: Array as PropType<T[]>,\n required: true,\n };\n}\n\nexport function requiredEnumProp<Enum extends Record<string, unknown>>(\n enumeration: Enum,\n): RequiredProp<Enum[keyof Enum]> {\n const values = Object.values(enumeration);\n\n return {\n type: String as unknown as PropType<Enum[keyof Enum]>,\n required: true,\n validator: (value) => values.includes(value),\n };\n}\n\nexport function requiredMixedProp<T>(type?: PropType<T>): RequiredProp<T> {\n return {\n type,\n required: true,\n };\n}\n\nexport function requiredNumberProp(): RequiredProp<number> {\n return {\n type: Number,\n required: true,\n };\n}\n\nexport function requiredObjectProp<T = Object>(): RequiredProp<T> {\n return {\n type: Object,\n required: true,\n };\n}\n\nexport function requiredStringProp(): RequiredProp<string> {\n return {\n type: String,\n required: true,\n };\n}\n\nexport function stringProp(): OptionalProp<string | null>;\nexport function stringProp(defaultValue: string): OptionalProp<string>;\nexport function stringProp(defaultValue: string | null = null): OptionalProp<string | null> {\n return {\n type: String,\n default: defaultValue,\n };\n}\n","import { defineDirective } from '@/utils/vue';\n\nexport default defineDirective({\n mounted(element: HTMLElement, { value }) {\n if (value === false) {\n return;\n }\n\n element.focus();\n },\n});\n","import { defineDirective } from '@/utils/vue';\nimport { tap } from '@noeldemartin/utils';\n\nconst resizeObservers: WeakMap<HTMLElement, ResizeObserver> = new WeakMap();\n\nexport interface ElementSize {\n width: number;\n height: number;\n}\n\nexport type MeasureDirectiveListener = (size: ElementSize) => unknown;\n\nexport default defineDirective({\n mounted(element: HTMLElement, { value }) {\n // TODO replace with argument when typed properly\n const modifiers = { css: true, watch: true };\n\n const listener = typeof value === 'function' ? (value as MeasureDirectiveListener) : null;\n const update = () => {\n const sizes = element.getBoundingClientRect();\n\n if (modifiers.css) {\n element.style.setProperty('--width', `${sizes.width}px`);\n element.style.setProperty('--height', `${sizes.height}px`);\n }\n\n listener?.({ width: sizes.width, height: sizes.height });\n };\n\n if (modifiers.watch) {\n resizeObservers.set(element, tap(new ResizeObserver(update)).observe(element));\n }\n\n update();\n },\n unmounted(element) {\n resizeObservers.get(element)?.unobserve(element);\n resizeObservers.delete(element);\n },\n});\n","import type { Directive } from 'vue';\n\nimport { definePlugin } from '@/plugins';\n\nimport initialFocus from './initial-focus';\nimport measure from './measure';\n\nconst builtInDirectives: Record<string, Directive> = {\n 'initial-focus': initialFocus,\n 'measure': measure,\n};\n\nexport * from './measure';\n\nexport default definePlugin({\n install(app, options) {\n const directives = {\n ...builtInDirectives,\n ...options.directives,\n };\n\n for (const [name, directive] of Object.entries(directives)) {\n app.directive(name, directive);\n }\n },\n});\n\ndeclare module '@/bootstrap/options' {\n export interface AerogelOptions {\n directives?: Record<string, Directive>;\n }\n}\n","import { PromisedValue, facade, tap } from '@noeldemartin/utils';\n\nimport Service from '@/services/Service';\n\nexport class CacheService extends Service {\n\n private cache?: PromisedValue<Cache> = undefined;\n\n public async get(url: string): Promise<Response | null> {\n const cache = await this.open();\n const response = await cache.match(url);\n\n return response ?? null;\n }\n\n public async store(url: string, response: Response): Promise<void> {\n const cache = await this.open();\n\n await cache.put(url, response);\n }\n\n public async replace(url: string, response: Response): Promise<void> {\n const cache = await this.open();\n const keys = await cache.keys(url);\n\n if (keys.length === 0) {\n return;\n }\n\n await cache.put(url, response);\n }\n\n protected async open(): Promise<Cache> {\n return (this.cache =\n this.cache ??\n tap(new PromisedValue<Cache>(), (cache) => {\n caches.open('app').then((instance) => cache.resolve(instance));\n }));\n }\n\n}\n\nexport default facade(CacheService);\n","import { facade } from '@noeldemartin/utils';\n\nimport Events from '@/services/Events';\nimport Service from '@/services/Service';\n\nexport class StorageService extends Service {\n\n public async purge(): Promise<void> {\n await Events.emit('purge-storage');\n }\n\n}\n\nexport default facade(StorageService);\n\ndeclare module '@/services/Events' {\n export interface EventsPayload {\n 'purge-storage': void;\n }\n}\n","import type { App as VueApp } from 'vue';\n\nimport { definePlugin } from '@/plugins';\n\nimport App from './App';\nimport Cache from './Cache';\nimport Events from './Events';\nimport Service from './Service';\nimport Storage from './Storage';\nimport { getPiniaStore } from './store';\n\nexport * from './App';\nexport * from './Cache';\nexport * from './Events';\nexport * from './Service';\nexport * from './store';\nexport * from './utils';\n\nexport { App, Cache, Events, Storage, Service };\n\nconst defaultServices = {\n $app: App,\n $events: Events,\n $storage: Storage,\n};\n\nexport type DefaultServices = typeof defaultServices;\n\nexport interface Services extends DefaultServices {}\n\nexport async function bootServices(app: VueApp, services: Record<string, Service>): Promise<void> {\n await Promise.all(\n Object.entries(services).map(async ([name, service]) => {\n await service\n .launch()\n .catch((error) => app.config.errorHandler?.(error, null, `Failed launching ${name}.`));\n }),\n );\n\n Object.assign(app.config.globalProperties, services);\n\n if (App.development || App.testing) {\n Object.assign(globalThis, services);\n }\n}\n\nexport default definePlugin({\n async install(app, options) {\n const services = {\n ...defaultServices,\n ...options.services,\n };\n\n app.use(getPiniaStore());\n\n await bootServices(app, services);\n },\n});\n\ndeclare module '@/bootstrap/options' {\n export interface AerogelOptions {\n services?: Record<string, Service>;\n }\n}\n\ndeclare module '@vue/runtime-core' {\n interface ComponentCustomProperties extends Services {}\n}\n","export const MOBILE_BREAKPOINT = 768;\n\nexport const Layouts = {\n Mobile: 'mobile',\n Desktop: 'desktop',\n} as const;\n\nexport type Layout = (typeof Layouts)[keyof typeof Layouts];\n\nexport function getCurrentLayout(): Layout {\n if (globalThis.innerWidth > MOBILE_BREAKPOINT) {\n return Layouts.Desktop;\n }\n\n return Layouts.Mobile;\n}\n","import type { Component } from 'vue';\n\nimport { defineServiceState } from '@/services/Service';\n\nimport { Layouts, getCurrentLayout } from './utils';\n\nexport interface Modal<T = unknown> {\n id: string;\n properties: Record<string, unknown>;\n component: Component;\n beforeClose: Promise<T | undefined>;\n afterClose: Promise<T | undefined>;\n}\n\nexport interface ModalComponent<\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n Properties extends Record<string, unknown> = Record<string, unknown>,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n Result = unknown\n> {}\n\nexport interface Snackbar {\n id: string;\n component: Component;\n properties: Record<string, unknown>;\n}\n\nexport default defineServiceState({\n name: 'ui',\n initialState: {\n modals: [] as Modal[],\n snackbars: [] as Snackbar[],\n layout: getCurrentLayout(),\n },\n computed: {\n mobile: ({ layout }) => layout === Layouts.Mobile,\n desktop: ({ layout }) => layout === Layouts.Desktop,\n },\n});\n","import { after, facade, fail, required, uuid } from '@noeldemartin/utils';\nimport { markRaw, nextTick } from 'vue';\nimport type { Component } from 'vue';\nimport type { ObjectValues } from '@noeldemartin/utils';\n\nimport App from '@/services/App';\nimport Events from '@/services/Events';\nimport type { AcceptRefs } from '@/utils';\nimport type { Color } from '@/components/constants';\nimport type { SnackbarAction, SnackbarColor } from '@/components/headless/snackbars';\nimport type { AGAlertModalProps, AGConfirmModalProps, AGLoadingModalProps, AGPromptModalProps } from '@/components';\n\nimport Service from './UI.state';\nimport { MOBILE_BREAKPOINT, getCurrentLayout } from './utils';\nimport type { Modal, ModalComponent, Snackbar } from './UI.state';\n\ninterface ModalCallbacks<T = unknown> {\n willClose(result: T | undefined): void;\n closed(result: T | undefined): void;\n}\n\ntype ModalProperties<TComponent> = TComponent extends ModalComponent<infer TProperties, unknown> ? TProperties : never;\ntype ModalResult<TComponent> = TComponent extends ModalComponent<Record<string, unknown>, infer TResult>\n ? TResult\n : never;\n\nexport const UIComponents = {\n AlertModal: 'alert-modal',\n ConfirmModal: 'confirm-modal',\n ErrorReportModal: 'error-report-modal',\n LoadingModal: 'loading-modal',\n PromptModal: 'prompt-modal',\n Snackbar: 'snackbar',\n StartupCrash: 'startup-crash',\n} as const;\n\nexport type UIComponent = ObjectValues<typeof UIComponents>;\n\nexport type ConfirmCheckboxes = Record<string, { label: string; default?: boolean; required?: boolean }>;\n\nexport type ConfirmOptions = AcceptRefs<{\n acceptText?: string;\n acceptColor?: Color;\n cancelText?: string;\n cancelColor?: Color;\n actions?: Record<string, () => unknown>;\n required?: boolean;\n}>;\n\nexport type LoadingOptions = AcceptRefs<{\n title?: string;\n message?: string;\n progress?: number;\n}>;\n\nexport interface ConfirmOptionsWithCheckboxes<T extends ConfirmCheckboxes = ConfirmCheckboxes> extends ConfirmOptions {\n checkboxes?: T;\n}\n\nexport type PromptOptions = AcceptRefs<{\n label?: string;\n defaultValue?: string;\n placeholder?: string;\n acceptText?: string;\n acceptColor?: Color;\n cancelText?: string;\n cancelColor?: Color;\n trim?: boolean;\n}>;\n\nexport interface ShowSnackbarOptions {\n component?: Component;\n color?: SnackbarColor;\n actions?: SnackbarAction[];\n}\n\nexport class UIService extends Service {\n\n private modalCallbacks: Record<string, Partial<ModalCallbacks>> = {};\n private components: Partial<Record<UIComponent, Component>> = {};\n\n public requireComponent(name: UIComponent): Component {\n return this.components[name] ?? fail(`UI Component '${name}' is not defined!`);\n }\n\n public alert(message: string): void;\n public alert(title: string, message: string): void;\n public alert(messageOrTitle: string, message?: string): void {\n const getProperties = (): AGAlertModalProps => {\n if (typeof message !== 'string') {\n return { message: messageOrTitle };\n }\n\n return {\n title: messageOrTitle,\n message,\n };\n };\n\n this.openModal(this.requireComponent(UIComponents.AlertModal), getProperties());\n }\n\n /* eslint-disable max-len */\n public async confirm(message: string, options?: ConfirmOptions): Promise<boolean>;\n public async confirm(title: string, message: string, options?: ConfirmOptions): Promise<boolean>;\n public async confirm<T extends ConfirmCheckboxes>(message: string, options?: ConfirmOptionsWithCheckboxes<T>): Promise<[boolean, Record<keyof T, boolean>]>; // prettier-ignore\n public async confirm<T extends ConfirmCheckboxes>(title: string, message: string, options?: ConfirmOptionsWithCheckboxes<T>): Promise<[boolean, Record<keyof T, boolean>]>; // prettier-ignore\n /* eslint-enable max-len */\n\n public async confirm(\n messageOrTitle: string,\n messageOrOptions?: string | ConfirmOptions | ConfirmOptionsWithCheckboxes,\n options?: ConfirmOptions | ConfirmOptionsWithCheckboxes,\n ): Promise<boolean | [boolean, Record<string, boolean>]> {\n const getProperties = (): AGConfirmModalProps => {\n if (typeof messageOrOptions !== 'string') {\n return {\n ...(messageOrOptions ?? {}),\n message: messageOrTitle,\n required: !!messageOrOptions?.required,\n };\n }\n\n return {\n ...(options ?? {}),\n title: messageOrTitle,\n message: messageOrOptions,\n required: !!options?.required,\n };\n };\n const properties = getProperties();\n const modal = await this.openModal<\n ModalComponent<AGConfirmModalProps, boolean | [boolean, Record<string, boolean>]>\n >(this.requireComponent(UIComponents.ConfirmModal), properties);\n const result = await modal.beforeClose;\n\n const confirmed = typeof result === 'object' ? result[0] : result ?? false;\n const checkboxes =\n typeof result === 'object'\n ? result[1]\n : Object.entries(properties.checkboxes ?? {}).reduce(\n (values, [checkbox, { default: defaultValue }]) => ({\n [checkbox]: defaultValue ?? false,\n ...values,\n }),\n {} as Record<string, boolean>,\n );\n\n for (const [name, checkbox] of Object.entries(properties.checkboxes ?? {})) {\n if (!checkbox.required || checkboxes[name]) {\n continue;\n }\n\n if (confirmed && App.development) {\n // eslint-disable-next-line no-console\n console.warn(`Confirmed confirm modal was suppressed because required '${name}' checkbox was missing`);\n }\n\n return [false, checkboxes];\n }\n\n return 'checkboxes' in properties ? [confirmed, checkboxes] : confirmed;\n }\n\n public async prompt(message: string, options?: PromptOptions): Promise<string | null>;\n public async prompt(title: string, message: string, options?: PromptOptions): Promise<string | null>;\n public async prompt(\n messageOrTitle: string,\n messageOrOptions?: string | PromptOptions,\n options?: PromptOptions,\n ): Promise<string | null> {\n const trim = options?.trim ?? true;\n const getProperties = (): AGPromptModalProps => {\n if (typeof messageOrOptions !== 'string') {\n return {\n message: messageOrTitle,\n ...(messageOrOptions ?? {}),\n } as AGPromptModalProps;\n }\n\n return {\n title: messageOrTitle,\n message: messageOrOptions,\n ...(options ?? {}),\n } as AGPromptModalProps;\n };\n\n const modal = await this.openModal<ModalComponent<AGPromptModalProps, string | null>>(\n this.requireComponent(UIComponents.PromptModal),\n getProperties(),\n );\n const rawResult = await modal.beforeClose;\n const result = trim && typeof rawResult === 'string' ? rawResult?.trim() : rawResult;\n\n return result ?? null;\n }\n\n public async loading<T>(operation: Promise<T> | (() => T)): Promise<T>;\n public async loading<T>(message: string, operation: Promise<T> | (() => T)): Promise<T>;\n public async loading<T>(options: LoadingOptions, operation: Promise<T> | (() => T)): Promise<T>;\n public async loading<T>(\n operationOrMessageOrOptions: string | LoadingOptions | Promise<T> | (() => T),\n operation?: Promise<T> | (() => T),\n ): Promise<T> {\n const processOperation = (o: Promise<T> | (() => T)) => (typeof o === 'function' ? Promise.resolve(o()) : o);\n const processArgs = (): { operationPromise: Promise<T>; props?: AGLoadingModalProps } => {\n if (typeof operationOrMessageOrOptions === 'string') {\n return {\n props: { message: operationOrMessageOrOptions },\n operationPromise: processOperation(operation as Promise<T> | (() => T)),\n };\n }\n\n if (typeof operationOrMessageOrOptions === 'function' || operationOrMessageOrOptions instanceof Promise) {\n return { operationPromise: processOperation(operationOrMessageOrOptions) };\n }\n\n return {\n props: operationOrMessageOrOptions,\n operationPromise: processOperation(operation as Promise<T> | (() => T)),\n };\n };\n\n const { operationPromise, props } = processArgs();\n const modal = await this.openModal(this.requireComponent(UIComponents.LoadingModal), props);\n\n try {\n const [result] = await Promise.all([operationPromise, after({ seconds: 1 })]);\n\n return result;\n } finally {\n await this.closeModal(modal.id);\n }\n }\n\n public showSnackbar(message: string, options: ShowSnackbarOptions = {}): void {\n const snackbar: Snackbar = {\n id: uuid(),\n properties: { message, ...options },\n component: markRaw(options.component ?? this.requireComponent(UIComponents.Snackbar)),\n };\n\n this.setState('snackbars', this.snackbars.concat(snackbar));\n\n setTimeout(() => this.hideSnackbar(snackbar.id), 5000);\n }\n\n public hideSnackbar(id: string): void {\n this.setState(\n 'snackbars',\n this.snackbars.filter((snackbar) => snackbar.id !== id),\n );\n }\n\n public registerComponent(name: UIComponent, component: Component): void {\n this.components[name] = component;\n }\n\n public async openModal<TModalComponent extends ModalComponent>(\n component: TModalComponent,\n properties?: ModalProperties<TModalComponent>,\n ): Promise<Modal<ModalResult<TModalComponent>>> {\n const id = uuid();\n const callbacks: Partial<ModalCallbacks<ModalResult<TModalComponent>>> = {};\n const modal: Modal<ModalResult<TModalComponent>> = {\n id,\n properties: properties ?? {},\n component: markRaw(component),\n beforeClose: new Promise((resolve) => (callbacks.willClose = resolve)),\n afterClose: new Promise((resolve) => (callbacks.closed = resolve)),\n };\n const activeModal = this.modals.at(-1);\n const modals = this.modals.concat(modal);\n\n this.modalCallbacks[modal.id] = callbacks;\n\n this.setState({ modals });\n\n await nextTick();\n await (activeModal && Events.emit('hide-modal', { id: activeModal.id }));\n await Promise.all([\n activeModal || Events.emit('show-overlays-backdrop'),\n Events.emit('show-modal', { id: modal.id }),\n ]);\n\n return modal;\n }\n\n public async closeModal(id: string, result?: unknown): Promise<void> {\n if (!App.isMounted()) {\n await this.removeModal(id, result);\n\n return;\n }\n\n await Events.emit('close-modal', { id, result });\n }\n\n public async closeAllModals(): Promise<void> {\n while (this.modals.length > 0) {\n await this.closeModal(required(this.modals[this.modals.length - 1]).id);\n }\n }\n\n protected async boot(): Promise<void> {\n this.watchModalEvents();\n this.watchMountedEvent();\n this.watchViewportBreakpoints();\n }\n\n private async removeModal(id: string, result?: unknown): Promise<void> {\n this.setState(\n 'modals',\n this.modals.filter((m) => m.id !== id),\n );\n\n this.modalCallbacks[id]?.closed?.(result);\n\n delete this.modalCallbacks[id];\n\n const activeModal = this.modals.at(-1);\n\n await (activeModal && Events.emit('show-modal', { id: activeModal.id }));\n }\n\n private watchModalEvents(): void {\n Events.on('modal-will-close', ({ modal, result }) => {\n this.modalCallbacks[modal.id]?.willClose?.(result);\n\n if (this.modals.length === 1) {\n Events.emit('hide-overlays-backdrop');\n }\n });\n\n Events.on('modal-closed', async ({ modal: { id }, result }) => {\n await this.removeModal(id, result);\n });\n }\n\n private watchMountedEvent(): void {\n Events.once('application-mounted', async () => {\n if (!globalThis.document || !globalThis.getComputedStyle) {\n return;\n }\n\n const splash = globalThis.document.getElementById('splash');\n\n if (!splash) {\n return;\n }\n\n if (globalThis.getComputedStyle(splash).opacity !== '0') {\n splash.style.opacity = '0';\n\n await after({ ms: 600 });\n }\n\n splash.remove();\n });\n }\n\n private watchViewportBreakpoints(): void {\n if (!globalThis.matchMedia) {\n return;\n }\n\n const media = globalThis.matchMedia(`(min-width: ${MOBILE_BREAKPOINT}px)`);\n\n media.addEventListener('change', () => this.setState({ layout: getCurrentLayout() }));\n }\n\n}\n\nexport default facade(UIService);\n\ndeclare module '@/services/Events' {\n export interface EventsPayload {\n 'close-modal': { id: string; result?: unknown };\n 'hide-modal': { id: string };\n 'hide-overlays-backdrop': void;\n 'modal-closed': { modal: Modal; result?: unknown };\n 'modal-will-close': { modal: Modal; result?: unknown };\n 'show-modal': { id: string };\n 'show-overlays-backdrop': void;\n }\n}\n","import App from '@/services/App';\n\nimport type { LangProvider } from './Lang';\n\nexport default class DefaultLangProvider implements LangProvider {\n\n constructor(private locale: string, private fallbackLocale: string) {}\n\n public getLocale(): string {\n return this.locale;\n }\n\n public async setLocale(locale: string): Promise<void> {\n this.locale = locale;\n }\n\n public getFallbackLocale(): string {\n return this.fallbackLocale;\n }\n\n public async setFallbackLocale(fallbackLocale: string): Promise<void> {\n this.fallbackLocale = fallbackLocale;\n }\n\n public getLocales(): string[] {\n return ['en'];\n }\n\n public translate(key: string): string {\n // eslint-disable-next-line no-console\n App.development && console.warn('Lang provider is missing');\n\n return key;\n }\n\n public translateWithDefault(_: string, defaultMessage: string): string {\n // eslint-disable-next-line no-console\n App.development && console.warn('Lang provider is missing');\n\n return defaultMessage;\n }\n\n}\n","import { defineServiceState } from '@/services/Service';\n\nexport default defineServiceState({\n name: 'lang',\n persist: ['locale', 'fallbackLocale'],\n initialState: {\n locale: null as string | null,\n locales: ['en'],\n fallbackLocale: 'en',\n },\n});\n","import { facade } from '@noeldemartin/utils';\n\nimport DefaultLangProvider from './DefaultLangProvider';\nimport Service from './Lang.state';\n\nexport interface LangProvider {\n getLocale(): string;\n setLocale(locale: string): Promise<void>;\n getFallbackLocale(): string;\n setFallbackLocale(fallbackLocale: string): Promise<void>;\n getLocales(): string[];\n translate(key: string, parameters?: Record<string, unknown> | number): string;\n translateWithDefault(key: string, defaultMessage: string, parameters?: Record<string, unknown> | number): string;\n}\n\nexport class LangService extends Service {\n\n private provider: LangProvider;\n\n constructor() {\n super();\n\n this.provider = new DefaultLangProvider(\n this.getState('locale') ?? this.getBrowserLocale(),\n this.getState('fallbackLocale'),\n );\n }\n\n public async setProvider(provider: LangProvider): Promise<void> {\n this.provider = provider;\n this.locales = provider.getLocales();\n\n await provider.setLocale(this.locale ?? this.getBrowserLocale());\n await provider.setFallbackLocale(this.fallbackLocale);\n }\n\n public translate(key: string, parameters?: Record<string, unknown> | number): string {\n return this.provider.translate(key, parameters) ?? key;\n }\n\n public translateWithDefault(\n key: string,\n defaultMessage: string,\n parameters: Record<string, unknown> | number = {},\n ): string {\n return this.provider.translateWithDefault(key, defaultMessage, parameters);\n }\n\n public getBrowserLocale(): string {\n const locales = this.getState('locales');\n\n return navigator.languages.find((locale) => locales.includes(locale)) ?? 'en';\n }\n\n protected async boot(): Promise<void> {\n if (!globalThis.document) {\n return;\n }\n\n this.requireStore().$subscribe(\n async () => {\n await this.provider.setLocale(this.locale ?? this.getBrowserLocale());\n await this.provider.setFallbackLocale(this.fallbackLocale);\n\n this.locale\n ? document.querySelector('html')?.setAttribute('lang', this.locale)\n : document.querySelector('html')?.removeAttribute('lang');\n },\n { immediate: true },\n );\n }\n\n}\n\nexport default facade(LangService);\n","import Lang from './Lang';\n\nexport const translate = Lang.translate.bind(Lang);\nexport const translateWithDefault = Lang.translateWithDefault.bind(Lang);\n","import type { JSError } from '@noeldemartin/utils';\n\nimport { defineServiceState } from '@/services';\n\nexport type ErrorSource = string | Error | JSError | unknown;\n\nexport interface ErrorReport {\n title: string;\n description?: string;\n details?: string;\n error?: Error | JSError | unknown;\n}\n\nexport interface ErrorReportLog {\n report: ErrorReport;\n seen: boolean;\n date: Date;\n}\n\nexport default defineServiceState({\n name: 'errors',\n initialState: {\n logs: [] as ErrorReportLog[],\n startupErrors: [] as ErrorReport[],\n },\n computed: {\n hasErrors: ({ logs }) => logs.length > 0,\n hasNewErrors: ({ logs }) => logs.some((error) => !error.seen),\n hasStartupErrors: ({ startupErrors }) => startupErrors.length > 0,\n },\n});\n","export const Colors = {\n Primary: 'primary',\n Secondary: 'secondary',\n Danger: 'danger',\n Clear: 'clear',\n} as const;\n\nexport type Color = (typeof Colors)[keyof typeof Colors];\n","import { JSError, facade, isObject, objectWithoutEmpty, toString } from '@noeldemartin/utils';\n\nimport App from '@/services/App';\nimport ServiceBootError from '@/errors/ServiceBootError';\nimport UI, { UIComponents } from '@/ui/UI';\nimport { translateWithDefault } from '@/lang/utils';\n\nimport Service from './Errors.state';\nimport { Colors } from '@/components/constants';\nimport { Events } from '@/services';\nimport type { AGErrorReportModalProps } from '@/components/modals/AGErrorReportModal';\nimport type { ErrorReport, ErrorReportLog, ErrorSource } from './Errors.state';\nimport type { ModalComponent } from '@/ui/UI.state';\n\nexport class ErrorsService extends Service {\n\n public forceReporting: boolean = false;\n private enabled: boolean = true;\n\n public enable(): void {\n this.enabled = true;\n }\n\n public disable(): void {\n this.enabled = false;\n }\n\n public async inspect(error: ErrorSource | ErrorReport[]): Promise<void> {\n const reports = Array.isArray(error) ? (error as ErrorReport[]) : [await this.createErrorReport(error)];\n\n if (reports.length === 0) {\n UI.alert(translateWithDefault('errors.inspectEmpty', 'Nothing to inspect!'));\n\n return;\n }\n\n UI.openModal<ModalComponent<AGErrorReportModalProps>>(UI.requireComponent(UIComponents.ErrorReportModal), {\n reports,\n });\n }\n\n public async report(error: ErrorSource, message?: string): Promise<void> {\n await Events.emit('error', { error, message });\n\n if (App.testing) {\n throw error;\n }\n\n if (App.development) {\n this.logError(error);\n }\n\n if (!this.enabled) {\n throw error;\n }\n\n if (!App.isMounted()) {\n const startupError = await this.createStartupErrorReport(error);\n\n if (startupError) {\n this.setState({ startupErrors: this.startupErrors.concat(startupError) });\n }\n\n return;\n }\n\n const report = await this.createErrorReport(error);\n const log: ErrorReportLog = {\n report,\n seen: false,\n date: new Date(),\n };\n\n UI.showSnackbar(\n message ??\n translateWithDefault('errors.notice', 'Something went wrong, but it\\'s not your fault. Try again!'),\n {\n color: Colors.Danger,\n actions: [\n {\n text: translateWithDefault('errors.viewDetails', 'View details'),\n dismiss: true,\n handler: () =>\n UI.openModal<ModalComponent<AGErrorReportModalProps>>(\n UI.requireComponent(UIComponents.ErrorReportModal),\n { reports: [report] },\n ),\n },\n ],\n },\n );\n\n this.setState({ logs: [log].concat(this.logs) });\n }\n\n public see(report: ErrorReport): void {\n this.setState({\n logs: this.logs.map((log) => {\n if (log.report !== report) {\n return log;\n }\n\n return {\n ...log,\n seen: true,\n };\n }),\n });\n }\n\n public seeAll(): void {\n this.setState({\n logs: this.logs.map((log) => ({\n ...log,\n seen: true,\n })),\n });\n }\n\n private logError(error: unknown): void {\n // eslint-disable-next-line no-console\n console.error(error);\n\n if (isObject(error) && error.cause) {\n this.logError(error.cause);\n }\n }\n\n private async createErrorReport(error: ErrorSource): Promise<ErrorReport> {\n if (typeof error === 'string') {\n return { title: error };\n }\n\n if (error instanceof Error || error instanceof JSError) {\n return this.createErrorReportFromError(error);\n }\n\n if (isObject(error)) {\n return objectWithoutEmpty({\n title: toString(\n error['name'] ?? error['title'] ?? translateWithDefault('errors.unknown', 'Unknown Error'),\n ),\n description: toString(\n error['message'] ??\n error['description'] ??\n translateWithDefault('errors.unknownDescription', 'Unknown error object'),\n ),\n error,\n });\n }\n\n return {\n title: translateWithDefault('errors.unknown', 'Unknown Error'),\n error,\n };\n }\n\n private async createStartupErrorReport(error: ErrorSource): Promise<ErrorReport | null> {\n if (error instanceof ServiceBootError) {\n // Ignore second-order boot errors in order to have a cleaner startup crash screen.\n return error.cause instanceof ServiceBootError ? null : this.createErrorReport(error.cause);\n }\n\n return this.createErrorReport(error);\n }\n\n private createErrorReportFromError(error: Error | JSError, defaults: Partial<ErrorReport> = {}): ErrorReport {\n return {\n title: error.name,\n description: error.message,\n details: error.stack,\n error,\n ...defaults,\n };\n }\n\n}\n\nexport default facade(ErrorsService);\n\ndeclare module '@/services/Events' {\n export interface EventsPayload {\n error: { error: ErrorSource; message?: string };\n }\n}\n","import { JSError, isObject, toString } from '@noeldemartin/utils';\nimport { translateWithDefault } from '@/lang/utils';\nimport type { ErrorSource } from './Errors.state';\n\nconst handlers: ErrorHandler[] = [];\n\nexport type ErrorHandler = (error: ErrorSource) => string | undefined;\n\nexport function registerErrorHandler(handler: ErrorHandler): void {\n handlers.push(handler);\n}\n\nexport function getErrorMessage(error: ErrorSource): string {\n for (const handler of handlers) {\n const result = handler(error);\n\n if (result) {\n return result;\n }\n }\n\n if (typeof error === 'string') {\n return error;\n }\n\n if (error instanceof Error || error instanceof JSError) {\n return error.message;\n }\n\n if (isObject(error)) {\n return toString(error['message'] ?? error['description'] ?? 'Unknown error object');\n }\n\n return translateWithDefault('errors.unknown', 'Unknown Error');\n}\n","import type { App } from 'vue';\n\nimport { bootServices } from '@/services';\nimport { definePlugin } from '@/plugins';\n\nimport Errors from './Errors';\nimport { ErrorReport, ErrorReportLog, ErrorSource } from './Errors.state';\n\nexport * from './utils';\nexport { Errors, ErrorSource, ErrorReport, ErrorReportLog };\n\nconst services = { $errors: Errors };\nconst frameworkHandler: ErrorHandler = (error) => {\n Errors.report(error);\n\n return true;\n};\n\nfunction setUpErrorHandler(app: App, baseHandler: ErrorHandler = () => false): void {\n const errorHandler: ErrorHandler = (error) => baseHandler(error) || frameworkHandler(error);\n\n app.config.errorHandler = errorHandler;\n globalThis.onerror = (event, _, __, ___, error) => errorHandler(error ?? event);\n globalThis.onunhandledrejection = (event) => errorHandler(event.reason);\n}\n\nexport type ErrorHandler = (error: ErrorSource) => boolean;\nexport type ErrorsServices = typeof services;\n\nexport default definePlugin({\n async install(app, options) {\n setUpErrorHandler(app, options.handleError);\n\n await bootServices(app, services);\n },\n});\n\ndeclare module '@/bootstrap/options' {\n export interface AerogelOptions {\n handleError?(error: ErrorSource): boolean;\n }\n}\n\ndeclare module '@/services' {\n export interface Services extends ErrorsServices {}\n}\n","import { bootServices } from '@/services';\nimport { definePlugin } from '@/plugins';\n\nimport Lang, { LangProvider } from './Lang';\nimport { translate, translateWithDefault } from './utils';\n\nexport { Lang, LangProvider, translate, translateWithDefault };\n\nconst services = { $lang: Lang };\n\nexport type LangServices = typeof services;\n\nexport default definePlugin({\n async install(app) {\n app.config.globalProperties.$t ??= translate;\n app.config.globalProperties.$td = translateWithDefault;\n\n await bootServices(app, services);\n },\n});\n\ndeclare module '@/services' {\n export interface Services extends LangServices {}\n}\n\ndeclare module '@vue/runtime-core' {\n interface ComponentCustomProperties {\n $td: typeof translateWithDefault;\n }\n}\n","import type { GetClosureArgs } from '@noeldemartin/utils';\n\nimport Events from '@/services/Events';\nimport { definePlugin } from '@/plugins';\n\nexport interface AerogelTestingRuntime {\n on: (typeof Events)['on'];\n}\n\nexport default definePlugin({\n async install() {\n if (import.meta.env.MODE !== 'testing') {\n return;\n }\n\n globalThis.testingRuntime = {\n on: ((...args: GetClosureArgs<(typeof Events)['on']>) => Events.on(...args)) as (typeof Events)['on'],\n };\n },\n});\n\ndeclare global {\n // eslint-disable-next-line no-var\n var testingRuntime: AerogelTestingRuntime | undefined;\n}\n","import { onUnmounted } from 'vue';\n\nimport Events from '@/services/Events';\nimport type {\n EventListener,\n EventWithPayload,\n EventWithoutPayload,\n EventsPayload,\n UnknownEvent,\n} from '@/services/Events';\n\nexport function useEvent<Event extends EventWithoutPayload>(event: Event, listener: () => unknown): void;\nexport function useEvent<Event extends EventWithPayload>(\n event: Event,\n listener: EventListener<EventsPayload[Event]>\n): void;\nexport function useEvent<Payload>(event: string, listener: (payload: Payload) => unknown): void;\nexport function useEvent<Event extends string>(event: UnknownEvent<Event>, listener: EventListener): void;\n\nexport function useEvent(event: string, listener: EventListener): void {\n const unsubscribe = Events.on(event, listener);\n\n onUnmounted(() => unsubscribe());\n}\n","import { objectWithout } from '@noeldemartin/utils';\nimport { computed, useAttrs } from 'vue';\nimport type { ComputedRef } from 'vue';\n\nexport function useInputAttrs(): [ComputedRef<{}>, ComputedRef<unknown>] {\n const attrs = useAttrs();\n const className = computed(() => attrs.class);\n const inputAttrs = computed(() => objectWithout(attrs, 'class'));\n\n return [inputAttrs, className];\n}\n","import DOMPurify from 'dompurify';\nimport { stringMatchAll, tap } from '@noeldemartin/utils';\nimport { Renderer, marked } from 'marked';\n\nfunction makeRenderer(): Renderer {\n return tap(new Renderer(), (renderer) => {\n renderer.link = function(href, title, text) {\n return Renderer.prototype.link.apply(this, [href, title, text]).replace('<a', '<a target=\"_blank\"');\n };\n });\n}\n\nfunction renderActionLinks(html: string): string {\n const matches = stringMatchAll<3>(html, /<a[^>]*href=\"#action:([^\"]+)\"[^>]*>([^<]+)<\\/a>/g);\n\n for (const [link, action, text] of matches) {\n html = html.replace(link, `<button type=\"button\" data-markdown-action=\"${action}\">${text}</button>`);\n }\n\n return html;\n}\n\nexport function renderMarkdown(markdown: string): string {\n let html = marked(markdown, { mangle: false, headerIds: false, renderer: makeRenderer() });\n\n html = safeHtml(html);\n html = renderActionLinks(html);\n\n return html;\n}\n\nexport function safeHtml(html: string): string {\n // TODO improve target=\"_blank\" exception\n // See https://github.com/cure53/DOMPurify/issues/317\n return DOMPurify.sanitize(html, { ADD_ATTR: ['target'] });\n}\n","export function extractComponentProps<T extends Record<string, unknown>>(\n values: Record<string, unknown>,\n definitions: Record<string, unknown>,\n): T {\n return Object.keys(definitions).reduce((extracted, prop) => {\n extracted[prop] = values[prop];\n\n return extracted;\n }, {} as Record<string, unknown>) as T;\n}\n","import { computed } from 'vue';\nimport type { ExtractPropTypes, Ref } from 'vue';\n\nimport { booleanProp, stringProp } from '@/utils';\nimport { extractComponentProps } from '@/components/utils';\nimport type { IAGModal } from '@/components/modals/AGModal';\n\nexport interface IAGHeadlessModal extends IAGModal {}\n\nexport interface IAGHeadlessModalDefaultSlotProps {\n close(result?: unknown): Promise<void>;\n}\n\nexport const modalProps = {\n cancellable: booleanProp(true),\n inline: booleanProp(),\n title: stringProp(),\n};\n\nexport function useModalProps(): typeof modalProps {\n return modalProps;\n}\n\nexport function extractModalProps<T extends ExtractPropTypes<typeof modalProps>>(\n props: T,\n): Pick<T, keyof typeof modalProps> {\n return extractComponentProps(props, modalProps);\n}\n\nexport function useModalExpose($modal: Ref<IAGHeadlessModal | undefined>): IAGModal {\n return {\n inline: computed(() => !!$modal.value?.inline),\n cancellable: computed(() => !!$modal.value?.cancellable),\n close: async () => $modal.value?.close(),\n };\n}\n","<template>\n <component\n :is=\"rootComponent\"\n ref=\"$root\"\n :open=\"true\"\n @close=\"cancellable && close()\"\n >\n <slot :close=\"close\" />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref, toRef } from 'vue';\nimport { Dialog } from '@headlessui/vue';\nimport type { VNode } from 'vue';\n\nimport Events from '@/services/Events';\nimport { useEvent } from '@/utils/composition/events';\nimport { injectReactiveOrFail } from '@/utils/vue';\nimport type { IAGModalContext } from '@/components/modals/AGModalContext';\n\nimport { useModalProps } from './AGHeadlessModal';\nimport type { IAGHeadlessModal, IAGHeadlessModalDefaultSlotProps } from './AGHeadlessModal';\n\nconst props = defineProps(useModalProps());\nconst $root = ref<{ $el?: HTMLElement } | null>(null);\nconst hidden = ref(true);\nconst closed = ref(false);\nconst { modal } = injectReactiveOrFail<IAGModalContext>(\n 'modal',\n 'could not obtain modal reference from <AGHeadlessModal>, ' +\n 'did you render this component manually? Show it using $ui.openModal() instead',\n);\nconst rootComponent = computed(() => (modal.properties.inline ? 'div' : Dialog));\n\nasync function hide(): Promise<void> {\n if (!$root.value?.$el) {\n return;\n }\n\n hidden.value = true;\n}\n\nasync function show(): Promise<void> {\n if (!$root.value?.$el) {\n return;\n }\n\n hidden.value = false;\n}\n\nasync function close(result?: unknown) {\n if (closed.value) {\n return;\n }\n\n Events.emit('modal-will-close', { modal, result });\n\n await hide();\n\n closed.value = true;\n\n Events.emit('modal-closed', { modal, result });\n}\n\nuseEvent('close-modal', async ({ id, result }) => {\n if (id !== modal.id) {\n return;\n }\n\n await close(result);\n});\n\nuseEvent('hide-modal', async ({ id }) => {\n if (id !== modal.id) {\n return;\n }\n\n await hide();\n});\n\nuseEvent('show-modal', async ({ id }) => {\n if (id !== modal.id) {\n return;\n }\n\n await show();\n});\n\ndefineSlots<{ default(props: IAGHeadlessModalDefaultSlotProps): VNode[] }>();\ndefineExpose<IAGHeadlessModal>({ close, cancellable: toRef(props, 'cancellable'), inline: toRef(props, 'inline') });\n</script>\n","<template>\n <component :is=\"modal.component\" v-bind=\"modalProperties\" />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, provide, toRef, unref } from 'vue';\n\nimport { numberProp, requiredObjectProp } from '@/utils/vue';\nimport type { Modal } from '@/ui/UI.state';\n\nimport type { IAGModalContext } from './AGModalContext';\n\nconst props = defineProps({\n modal: requiredObjectProp<Modal>(),\n childIndex: numberProp(0),\n});\n\nconst modalProperties = computed(() => {\n const properties = {} as typeof props.modal.properties;\n\n for (const property in props.modal.properties) {\n properties[property] = unref(props.modal.properties[property]);\n }\n\n return properties;\n});\n\nprovide<IAGModalContext>('modal', {\n modal: toRef(props, 'modal'),\n childIndex: toRef(props, 'childIndex'),\n});\n</script>\n","<template>\n <component :is=\"rootComponent\">\n <slot />\n\n <template v-if=\"childModal\">\n <div\n class=\"pointer-events-none inset-0 z-50 bg-black/30\"\n :class=\"childModal.properties.inline ? 'absolute' : 'fixed'\"\n />\n <AGModalContext :child-index=\"childIndex + 1\" :modal=\"childModal\" />\n </template>\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { DialogPanel } from '@headlessui/vue';\n\nimport UI from '@/ui/UI';\nimport { injectReactiveOrFail } from '@/utils/vue';\nimport type { IAGModalContext } from '@/components/modals/AGModalContext';\n\nimport AGModalContext from '../../modals/AGModalContext.vue';\n\nconst { modal, childIndex } = injectReactiveOrFail<IAGModalContext>(\n 'modal',\n 'could not obtain modal reference from <AGHeadlessModalPanel>, ' +\n 'did you render this component manually? Show it using $ui.openModal() instead',\n);\nconst rootComponent = computed(() => (modal.properties.inline ? 'div' : DialogPanel));\nconst childModal = computed(() => UI.modals[childIndex] ?? null);\n</script>\n","<template>\n <component :is=\"rootComponent\" v-bind=\"rootProps\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { DialogTitle } from '@headlessui/vue';\n\nimport { injectReactiveOrFail, stringProp } from '@/utils/vue';\nimport type { IAGModalContext } from '@/components/modals/AGModalContext';\n\nconst props = defineProps({ as: stringProp('h2') });\n\nconst { modal } = injectReactiveOrFail<IAGModalContext>(\n 'modal',\n 'could not obtain modal reference from <AGHeadlessModalPanel>, ' +\n 'did you render this component manually? Show it using $ui.openModal() instead',\n);\nconst rootComponent = computed(() => (modal.properties.inline ? 'div' : DialogTitle));\nconst rootProps = computed(() => (modal.properties.inline ? {} : { as: props.as }));\n</script>\n","<template>\n <root />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, h, useAttrs } from 'vue';\nimport { isInstanceOf } from '@noeldemartin/utils';\n\nimport { renderMarkdown } from '@/utils/markdown';\nimport { booleanProp, mixedProp, objectProp, stringProp } from '@/utils/vue';\nimport { translate } from '@/lang';\n\nconst props = defineProps({\n as: stringProp(),\n inline: booleanProp(),\n langKey: stringProp(),\n langParams: mixedProp<number | Record<string, unknown>>(),\n text: stringProp(),\n actions: objectProp<Record<string, () => unknown>>(),\n});\n\nconst attrs = useAttrs();\nconst markdown = computed(() => props.text ?? (props.langKey && translate(props.langKey, props.langParams ?? {})));\nconst html = computed(() => {\n if (!markdown.value) {\n return null;\n }\n\n let renderedHtml = renderMarkdown(markdown.value);\n\n if (props.inline) {\n renderedHtml = renderedHtml.replace('<p>', '<span>').replace('</p>', '</span>');\n }\n\n return renderedHtml;\n});\nconst root = () =>\n h(props.as ?? (props.inline ? 'span' : 'div'), {\n innerHTML: html.value,\n onClick,\n ...attrs,\n class: `${attrs.class ?? ''} ${props.inline ? '' : 'prose'}`,\n });\n\nasync function onClick(event: Event) {\n const { target } = event;\n\n if (isInstanceOf(target, HTMLElement) && target.dataset.markdownAction) {\n props.actions?.[target.dataset.markdownAction]?.();\n\n return;\n }\n}\n</script>\n","<template>\n <AGHeadlessModal\n ref=\"$modal\"\n v-slot=\"{ close }: IAGHeadlessModalDefaultSlotProps\"\n v-bind=\"props\"\n class=\"relative z-50\"\n >\n <div class=\"fixed inset-0 flex items-center justify-center p-8\">\n <AGHeadlessModalPanel class=\"flex max-h-full max-w-full flex-col overflow-hidden bg-white p-4\">\n <AGHeadlessModalTitle v-if=\"title\" class=\"mb-2 text-lg font-semibold\">\n <AGMarkdown :text=\"title\" inline />\n </AGHeadlessModalTitle>\n <div class=\"flex max-h-full flex-col overflow-auto\" v-bind=\"$attrs\">\n <slot :close=\"close\" />\n </div>\n </AGHeadlessModalPanel>\n </div>\n </AGHeadlessModal>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref } from 'vue';\n\nimport { useModalExpose, useModalProps } from '@/components/headless/modals/AGHeadlessModal';\nimport type { IAGHeadlessModal, IAGHeadlessModalDefaultSlotProps } from '@/components/headless/modals/AGHeadlessModal';\n\nimport type { IAGModal } from './AGModal';\n\nimport AGHeadlessModal from '../headless/modals/AGHeadlessModal.vue';\nimport AGHeadlessModalPanel from '../headless/modals/AGHeadlessModalPanel.vue';\nimport AGHeadlessModalTitle from '../headless/modals/AGHeadlessModalTitle.vue';\nimport AGMarkdown from '../lib/AGMarkdown.vue';\n\nconst props = defineProps(useModalProps());\nconst $modal = ref<IAGHeadlessModal>();\n\ndefineOptions({ inheritAttrs: false });\ndefineExpose<IAGModal>(useModalExpose($modal));\n</script>\n","import type { ExtractPropTypes } from 'vue';\nimport type { ObjectWithout, Pretty } from '@noeldemartin/utils';\n\nimport { requiredStringProp, stringProp } from '@/utils';\nimport type { AcceptRefs } from '@/utils';\n\nexport const alertModalProps = {\n title: stringProp(),\n message: requiredStringProp(),\n};\n\nexport type AGAlertModalProps = Pretty<\n AcceptRefs<ObjectWithout<ExtractPropTypes<typeof alertModalProps>, null | undefined>>\n>;\n\nexport function useAlertModalProps(): typeof alertModalProps {\n return alertModalProps;\n}\n","import { computed } from 'vue';\nimport type { ExtractPropTypes } from 'vue';\nimport type { ObjectWithout, Pretty, SubPartial } from '@noeldemartin/utils';\n\nimport { Colors } from '@/components/constants';\nimport { booleanProp, enumProp, objectProp, requiredStringProp, stringProp } from '@/utils';\nimport { translateWithDefault } from '@/lang';\nimport type { AcceptRefs } from '@/utils';\nimport type { ConfirmCheckboxes } from '@/ui';\n\nexport const confirmModalProps = {\n title: stringProp(),\n message: requiredStringProp(),\n acceptText: stringProp(),\n acceptColor: enumProp(Colors, Colors.Primary),\n cancelText: stringProp(),\n cancelColor: enumProp(Colors, Colors.Clear),\n checkboxes: objectProp<ConfirmCheckboxes>(),\n actions: objectProp<Record<string, () => unknown>>(),\n required: booleanProp(false),\n};\n\nexport type AGConfirmModalProps = Pretty<\n AcceptRefs<\n SubPartial<\n ObjectWithout<ExtractPropTypes<typeof confirmModalProps>, null | undefined>,\n 'acceptColor' | 'cancelColor'\n >\n >\n>;\n\nexport function useConfirmModalProps(): typeof confirmModalProps {\n return confirmModalProps;\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function useConfirmModal(props: ExtractPropTypes<typeof confirmModalProps>) {\n const renderedAcceptText = computed(() => props.acceptText ?? translateWithDefault('ui.accept', 'Ok'));\n const renderedCancelText = computed(() => props.cancelText ?? translateWithDefault('ui.cancel', 'Cancel'));\n\n return { renderedAcceptText, renderedCancelText };\n}\n","import { isObject } from '@noeldemartin/utils';\nimport type { Ref, UnwrapNestedRefs } from 'vue';\n\nexport function getElement(value: unknown): HTMLElement | undefined {\n if (value instanceof HTMLElement) {\n return value;\n }\n\n if (hasElement(value)) {\n return value.$el;\n }\n}\n\nexport function hasElement(value: unknown): value is UnwrapNestedRefs<HasElement> {\n return isObject(value) && '$el' in value;\n}\n\nexport interface __SetsElement {\n __setElement(element?: HTMLElement): void;\n}\n\nexport interface HasElement {\n $el: Readonly<Ref<HTMLElement | undefined>>;\n}\n","import { customRef } from 'vue';\nimport type { Ref } from 'vue';\n\nimport { getElement } from '@/components/interfaces';\n\nexport function elementRef(): Ref<HTMLElement | undefined> {\n return customRef((track, trigger) => {\n let value: HTMLElement | undefined = undefined;\n\n return {\n get() {\n track();\n\n return value;\n },\n set(newValue) {\n value = getElement(newValue);\n\n trigger();\n },\n };\n });\n}\n","<template>\n <component :is=\"component.as\" ref=\"$root\" v-bind=\"component.props\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { objectWithoutEmpty } from '@noeldemartin/utils';\n\nimport { booleanProp, objectProp, stringProp } from '@/utils/vue';\nimport { elementRef } from '@/components/composition';\n\nimport type { IAGHeadlessButton } from './AGHeadlessButton';\n\nconst props = defineProps({\n as: objectProp(),\n href: stringProp(),\n url: stringProp(),\n route: stringProp(),\n routeParams: objectProp(() => ({})),\n routeQuery: objectProp(() => ({})),\n submit: booleanProp(),\n});\n\nconst $root = elementRef();\nconst component = computed(() => {\n if (props.as) {\n return { as: props.as, props: {} };\n }\n\n if (props.route) {\n return {\n as: 'router-link',\n props: {\n to: objectWithoutEmpty({\n name: props.route,\n params: props.routeParams,\n query: props.routeQuery,\n }),\n },\n };\n }\n\n if (props.href || props.url) {\n return {\n as: 'a',\n props: {\n target: '_blank',\n href: props.href || props.url,\n },\n };\n }\n\n return {\n as: 'button',\n props: { type: props.submit ? 'submit' : 'button' },\n };\n});\n\ndefineExpose<IAGHeadlessButton>({ $el: $root });\n</script>\n","<template>\n <AGHeadlessButton class=\"px-2.5 py-1.5 focus-visible:outline focus-visible:outline-2\" :class=\"colorClasses\">\n <slot />\n </AGHeadlessButton>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\n\nimport { enumProp } from '@/utils/vue';\nimport { Colors } from '@/components/constants';\n\nimport AGHeadlessButton from '../headless/forms/AGHeadlessButton.vue';\n\nconst props = defineProps({\n color: enumProp(Colors, Colors.Primary),\n});\n\nconst colorClasses = computed(() => {\n switch (props.color) {\n case Colors.Secondary:\n return [\n 'text-white bg-gray-600',\n 'hover:bg-gray-500',\n 'focus-visible:outline-offset-2 focus-visible:outline-gray-600',\n ].join(' ');\n case Colors.Clear:\n return 'hover:bg-gray-500/20 focus-visible:outline-gray-500/60';\n case Colors.Danger:\n return [\n 'text-white bg-red-600',\n 'hover:bg-red-500',\n 'focus-visible:outline-offset-2 focus-visible:outline-red-600',\n ].join(' ');\n case Colors.Primary:\n default:\n return [\n 'text-white bg-indigo-600',\n 'hover:bg-indigo-500',\n 'focus-visible:outline-offset-2 focus-visible:outline-indigo-600',\n ].join(' ');\n }\n});\n</script>\n","<template>\n <AGModal v-slot=\"{ close }: IAGModalDefaultSlotProps\" :cancellable=\"false\" :title=\"title\">\n <AGMarkdown :text=\"message\" :actions=\"actions\" />\n\n <div class=\"mt-2 flex flex-row-reverse gap-2\">\n <AGButton :color=\"acceptColor\" @click=\"close(true)\">\n {{ renderedAcceptText }}\n </AGButton>\n <AGButton v-if=\"!required\" :color=\"cancelColor\" @click=\"close()\">\n {{ renderedCancelText }}\n </AGButton>\n </div>\n </AGModal>\n</template>\n\n<script setup lang=\"ts\">\nimport AGModal from './AGModal.vue';\nimport { useConfirmModal, useConfirmModalProps } from './AGConfirmModal';\nimport type { IAGModalDefaultSlotProps } from './AGModal';\n\nimport AGButton from '../forms/AGButton.vue';\nimport AGMarkdown from '../lib/AGMarkdown.vue';\n\nconst props = defineProps(useConfirmModalProps());\nconst { renderedAcceptText, renderedCancelText } = useConfirmModal(props);\n</script>\n","import { computed, ref } from 'vue';\nimport type { Component, ExtractPropTypes } from 'vue';\nimport type { ObjectWithout, Pretty } from '@noeldemartin/utils';\n\nimport { requiredArrayProp } from '@/utils/vue';\nimport { translateWithDefault } from '@/lang';\nimport type { AcceptRefs } from '@/utils/vue';\nimport type { ErrorReport } from '@/errors';\n\nexport interface IAGErrorReportModalButtonsDefaultSlotProps {\n id: string;\n description: string;\n iconComponent: Component;\n url?: string;\n handler?(): void;\n}\n\nexport const errorReportModalProps = {\n reports: requiredArrayProp<ErrorReport>(),\n};\n\nexport type AGErrorReportModalProps = Pretty<\n AcceptRefs<ObjectWithout<ExtractPropTypes<typeof errorReportModalProps>, null | undefined>>\n>;\n\nexport function useErrorReportModalProps(): typeof errorReportModalProps {\n return errorReportModalProps;\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function useErrorReportModal(props: ExtractPropTypes<typeof errorReportModalProps>) {\n const activeReportIndex = ref(0);\n const report = computed(() => props.reports[activeReportIndex.value] as ErrorReport);\n const details = computed(\n () =>\n report.value.details?.trim() ||\n translateWithDefault('errors.detailsEmpty', 'This error is missing a stacktrace.'),\n );\n const previousReportText = translateWithDefault('errors.previousReport', 'Show previous report');\n const nextReportText = translateWithDefault('errors.nextReport', 'Show next report');\n\n return {\n activeReportIndex,\n details,\n nextReportText,\n previousReportText,\n report,\n };\n}\n","<template>\n <div class=\"flex\">\n <slot v-for=\"(button, i) of buttons\" v-bind=\"(button as unknown as ComponentProps)\" :key=\"i\">\n <AGButton\n color=\"clear\"\n :url=\"button.url\"\n :title=\"$td(`errors.report_${button.id}`, button.description)\"\n :aria-label=\"$td(`errors.report_${button.id}`, button.description)\"\n @click=\"button.handler\"\n >\n <component :is=\"button.iconComponent\" class=\"h-4 w-4\" aria-hidden=\"true\" />\n </AGButton>\n </slot>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport IconConsole from '~icons/mdi/console';\nimport IconCopy from '~icons/zondicons/copy';\nimport IconGitHub from '~icons/mdi/github';\n\nimport { computed } from 'vue';\nimport { stringExcerpt, tap } from '@noeldemartin/utils';\n\nimport App from '@/services/App';\nimport UI from '@/ui/UI';\nimport { requiredObjectProp } from '@/utils/vue';\nimport { translateWithDefault } from '@/lang/utils';\nimport type { ComponentProps } from '@/utils/vue';\nimport type { ErrorReport } from '@/errors';\n\nimport AGButton from '../forms/AGButton.vue';\nimport type { IAGErrorReportModalButtonsDefaultSlotProps } from './AGErrorReportModal';\n\nconst props = defineProps({\n report: requiredObjectProp<ErrorReport>(),\n});\nconst summary = computed(() =>\n props.report.description ? `${props.report.title}: ${props.report.description}` : props.report.title);\nconst githubReportUrl = computed(() => {\n if (!App.sourceUrl) {\n return false;\n }\n\n const issueTitle = encodeURIComponent(summary.value);\n const issueBody = encodeURIComponent(\n [\n '[Please, explain here what you were trying to do when this error appeared]',\n '',\n 'Error details:',\n '```',\n stringExcerpt(\n props.report.details ?? 'Details missing from report',\n 1800 - issueTitle.length - App.sourceUrl.length,\n ).trim(),\n '```',\n ].join('\\n'),\n );\n\n return `${App.sourceUrl}/issues/new?title=${issueTitle}&body=${issueBody}`;\n});\nconst buttons = computed(() =>\n tap(\n [\n {\n id: 'clipboard',\n description: 'Copy to clipboard',\n iconComponent: IconCopy,\n async handler() {\n await navigator.clipboard.writeText(`${summary.value}\\n\\n${props.report.details}`);\n\n UI.showSnackbar(\n translateWithDefault('errors.copiedToClipboard', 'Debug information copied to clipboard'),\n );\n },\n },\n {\n id: 'console',\n description: 'Log to console',\n iconComponent: IconConsole,\n handler() {\n const error = props.report.error ?? props.report;\n\n (window as { error?: unknown }).error = error;\n\n // eslint-disable-next-line no-console\n console.error(error);\n\n UI.showSnackbar(\n translateWithDefault(\n 'errors.addedToConsole',\n 'You can now use the **error** variable in the console',\n ),\n );\n },\n },\n ],\n (reportButtons: IAGErrorReportModalButtonsDefaultSlotProps[]) => {\n if (!githubReportUrl.value) {\n return;\n }\n\n reportButtons.push({\n id: 'github',\n description: 'Report in GitHub',\n iconComponent: IconGitHub,\n url: githubReportUrl.value,\n });\n },\n ));\n</script>\n","<template>\n <AGMarkdown :text=\"text\" inline />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\n\nimport { numberProp, requiredObjectProp } from '@/utils/vue';\nimport type { ErrorReport } from '@/errors';\n\nimport AGMarkdown from '../lib/AGMarkdown.vue';\n\nconst props = defineProps({\n report: requiredObjectProp<ErrorReport>(),\n currentReport: numberProp(),\n totalReports: numberProp(),\n});\nconst text = computed(() => {\n if (!props.totalReports || props.totalReports <= 1) {\n return props.report.title;\n }\n\n return `${props.report.title} (${props.currentReport}/${props.totalReports})`;\n});\n</script>\n","<template>\n <AGModal>\n <div>\n <h2 class=\"flex items-center justify-between text-lg font-medium\">\n <div class=\"flex items-center\">\n <AGErrorReportModalTitle\n :report=\"report\"\n :current-report=\"activeReportIndex + 1\"\n :total-reports=\"reports.length\"\n />\n <template v-if=\"reports.length > 1\">\n <AGButton\n color=\"clear\"\n :disabled=\"activeReportIndex === 0\"\n :title=\"previousReportText\"\n :aria-label=\"previousReportText\"\n @click=\"activeReportIndex--\"\n >\n <IconCheveronLeft aria-hidden=\"true\" class=\"h-4 w-4\" />\n </AGButton>\n <AGButton\n color=\"clear\"\n :disabled=\"activeReportIndex === reports.length - 1\"\n :title=\"nextReportText\"\n :aria-label=\"nextReportText\"\n @click=\"activeReportIndex++\"\n >\n <IconCheveronRight aria-hidden=\"true\" class=\"h-4 w-4\" />\n </AGButton>\n </template>\n </div>\n <AGErrorReportModalButtons :report=\"report\" />\n </h2>\n <AGMarkdown v-if=\"report.description\" :text=\"report.description\" class=\"mt-2\" />\n </div>\n <pre class=\"h-full overflow-auto bg-gray-200 p-4 text-xs text-red-900\" v-text=\"details\" />\n </AGModal>\n</template>\n\n<script setup lang=\"ts\">\nimport IconCheveronRight from '~icons/zondicons/cheveron-right';\nimport IconCheveronLeft from '~icons/zondicons/cheveron-left';\n\nimport { useErrorReportModal, useErrorReportModalProps } from './AGErrorReportModal';\n\nimport AGButton from '../forms/AGButton.vue';\nimport AGErrorReportModalButtons from './AGErrorReportModalButtons.vue';\nimport AGErrorReportModalTitle from './AGErrorReportModalTitle.vue';\nimport AGMarkdown from '../lib/AGMarkdown.vue';\nimport AGModal from './AGModal.vue';\n\nconst props = defineProps(useErrorReportModalProps());\nconst { activeReportIndex, details, nextReportText, previousReportText, report } = useErrorReportModal(props);\n</script>\n","import { computed } from 'vue';\nimport type { ExtractPropTypes } from 'vue';\nimport type { ObjectWithout } from '@noeldemartin/utils';\n\nimport { numberProp, stringProp } from '@/utils';\nimport { translateWithDefault } from '@/lang';\nimport type { AcceptRefs } from '@/utils';\n\nexport const loadingModalProps = {\n title: stringProp(),\n message: stringProp(),\n progress: numberProp(),\n};\n\nexport type AGLoadingModalProps = AcceptRefs<\n ObjectWithout<ExtractPropTypes<typeof loadingModalProps>, null | undefined>\n>;\n\nexport function useLoadingModalProps(): typeof loadingModalProps {\n return loadingModalProps;\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function useLoadingModal(props: ExtractPropTypes<typeof loadingModalProps>) {\n const renderedMessage = computed(() => props.message ?? translateWithDefault('ui.loading', 'Loading...'));\n const showProgress = computed(() => typeof props.progress === 'number');\n\n return { renderedMessage, showProgress };\n}\n","<template>\n <AGModal :cancellable=\"false\">\n <AGMarkdown :text=\"renderedMessage\" />\n </AGModal>\n</template>\n\n<script setup lang=\"ts\">\nimport AGModal from './AGModal.vue';\nimport { useLoadingModal, useLoadingModalProps } from './AGLoadingModal';\n\nimport AGMarkdown from '../lib/AGMarkdown.vue';\n\nconst props = defineProps(useLoadingModalProps());\nconst { renderedMessage } = useLoadingModal(props);\n</script>\n","import { computed } from 'vue';\nimport type { ExtractPropTypes } from 'vue';\nimport type { ObjectWithout, Pretty, SubPartial } from '@noeldemartin/utils';\n\nimport { Colors } from '@/components/constants';\nimport { enumProp, requiredStringProp, stringProp } from '@/utils';\nimport { translateWithDefault } from '@/lang';\nimport type { AcceptRefs } from '@/utils';\n\nexport const promptModalProps = {\n title: stringProp(),\n message: requiredStringProp(),\n label: stringProp(),\n defaultValue: stringProp(),\n placeholder: stringProp(),\n acceptText: stringProp(),\n acceptColor: enumProp(Colors, Colors.Primary),\n cancelText: stringProp(),\n cancelColor: enumProp(Colors, Colors.Clear),\n};\n\nexport type AGPromptModalProps = Pretty<\n AcceptRefs<\n SubPartial<\n ObjectWithout<ExtractPropTypes<typeof promptModalProps>, null | undefined>,\n 'acceptColor' | 'cancelColor'\n >\n >\n>;\n\nexport function usePromptModalProps(): typeof promptModalProps {\n return promptModalProps;\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function usePromptModal(props: ExtractPropTypes<typeof promptModalProps>) {\n const renderedAcceptText = computed(() => props.acceptText ?? translateWithDefault('ui.accept', 'Ok'));\n const renderedCancelText = computed(() => props.cancelText ?? translateWithDefault('ui.cancel', 'Cancel'));\n\n return { renderedAcceptText, renderedCancelText };\n}\n","<template>\n <form @submit.prevent=\"form?.submit()\">\n <slot />\n </form>\n</template>\n\n<script setup lang=\"ts\">\nimport { provide, watchEffect } from 'vue';\n\nimport { objectProp } from '@/utils/vue';\nimport type Form from '@/forms/Form';\n\nlet offSubmit: (() => void) | undefined;\nconst props = defineProps({ form: objectProp<Form>() });\nconst emit = defineEmits<{ submit: [] }>();\n\nwatchEffect((onCleanup) => {\n offSubmit?.();\n offSubmit = props.form?.on('submit', () => emit('submit'));\n\n onCleanup(() => offSubmit?.());\n});\n\nprovide('form', props.form);\n</script>\n","import type { ComputedRef, DeepReadonly, ExtractPropTypes, Ref } from 'vue';\n\nimport { mixedProp, stringProp } from '@/utils';\nimport { extractComponentProps } from '@/components/utils';\nimport type { FormFieldValue } from '@/forms/Form';\nimport type { HasElement } from '@/components/interfaces';\n\nexport interface IAGHeadlessInput extends HasElement {\n id: string;\n name: ComputedRef<string | null>;\n label: ComputedRef<string | null>;\n description: ComputedRef<string | boolean | null>;\n value: ComputedRef<FormFieldValue | null>;\n required: ComputedRef<boolean | null>;\n errors: DeepReadonly<Ref<string[] | null>>;\n update(value: FormFieldValue | null): void;\n}\n\nexport const inputProps = {\n name: stringProp(),\n label: stringProp(),\n description: stringProp(),\n modelValue: mixedProp<FormFieldValue>([String, Number, Boolean]),\n};\n\nexport function useInputProps(): typeof inputProps {\n return inputProps;\n}\n\nexport function extractInputProps<T extends ExtractPropTypes<typeof inputProps>>(\n props: T,\n): Pick<T, keyof typeof inputProps> {\n return extractComponentProps(props, inputProps);\n}\n","<template>\n <component :is=\"as\" v-if=\"as\">\n <slot />\n </component>\n <slot v-else />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, inject, provide, readonly, ref } from 'vue';\nimport { uuid } from '@noeldemartin/utils';\n\nimport { stringProp } from '@/utils/vue';\nimport type Form from '@/forms/Form';\nimport type { __SetsElement } from '@/components/interfaces';\n\nimport { useInputProps } from './AGHeadlessInput';\nimport type { IAGHeadlessInput } from './AGHeadlessInput';\n\nconst emit = defineEmits(['update:modelValue']);\nconst props = defineProps({\n as: stringProp('div'),\n ...useInputProps(),\n});\nconst $el = ref<HTMLElement>();\nconst errors = computed(() => {\n if (!form || !props.name) {\n return null;\n }\n\n return form.errors[props.name] ?? null;\n});\nconst form = inject<Form | null>('form', null);\nconst api: IAGHeadlessInput & __SetsElement = {\n $el,\n id: `input-${uuid()}`,\n name: computed(() => props.name),\n label: computed(() => props.label),\n description: computed(() => props.description),\n value: computed(() => {\n if (form && props.name) {\n return form.getFieldValue(props.name);\n }\n\n return props.modelValue;\n }),\n errors: readonly(errors),\n required: computed(() => {\n if (!props.name || !form) {\n return null;\n }\n\n return form.getFieldRules(props.name).includes('required');\n }),\n update(value) {\n if (form && props.name) {\n form.setFieldValue(props.name, value);\n\n return;\n }\n\n emit('update:modelValue', value);\n },\n __setElement(element) {\n $el.value = element;\n },\n};\n\nprovide<IAGHeadlessInput>('input', api);\ndefineExpose<IAGHeadlessInput>(api);\n</script>\n","<template>\n <slot :id=\"`${input.id}-description`\">\n <AGMarkdown\n v-if=\"show\"\n v-bind=\"$attrs\"\n :id=\"`${input.id}-description`\"\n :text=\"text\"\n />\n </slot>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\n\nimport { injectReactiveOrFail } from '@/utils/vue';\n\nimport AGMarkdown from '../../lib/AGMarkdown.vue';\nimport type { IAGHeadlessInput } from './AGHeadlessInput';\n\ndefineOptions({ inheritAttrs: false });\n\nconst input = injectReactiveOrFail<IAGHeadlessInput>(\n 'input',\n '<AGHeadlessInputDescription> must be a child of a <AGHeadlessInput>',\n);\nconst text = computed(() => (typeof input.description === 'string' ? input.description : ''));\nconst show = computed(() => !!input.description);\n</script>\n","<template>\n <p v-if=\"errorMessage\" :id=\"`${input.id}-error`\">\n {{ errorMessage }}\n </p>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\n\nimport { injectReactiveOrFail } from '@/utils/vue';\nimport { translateWithDefault } from '@/lang/utils';\n\nimport type { IAGHeadlessInput } from './AGHeadlessInput';\n\nconst input = injectReactiveOrFail<IAGHeadlessInput>(\n 'input',\n '<AGHeadlessInputError> must be a child of a <AGHeadlessInput>',\n);\nconst errorMessage = computed(() => {\n if (!input.errors) {\n return null;\n }\n\n return translateWithDefault(`errors.${input.errors[0]}`, `Error: ${input.errors[0]}`);\n});\n</script>\n","import { inject, onUnmounted } from 'vue';\n\nimport type Form from '@/forms/Form';\n\nexport function onFormFocus(input: { name: string | null }, listener: () => unknown): void {\n const form = inject<Form | null>('form', null);\n const stop = form?.on('focus', (name) => input.name === name && listener());\n\n onUnmounted(() => stop?.());\n}\n","<template>\n <input\n :id=\"input.id\"\n ref=\"$input\"\n :name=\"name\"\n :type=\"type\"\n :required=\"input.required ?? undefined\"\n :aria-invalid=\"input.errors ? 'true' : 'false'\"\n :aria-describedby=\"\n input.errors ? `${input.id}-error` : input.description ? `${input.id}-description` : undefined\n \"\n :checked=\"checked\"\n @input=\"update\"\n >\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref, watchEffect } from 'vue';\n\nimport { injectReactiveOrFail, stringProp } from '@/utils/vue';\nimport type { __SetsElement } from '@/components/interfaces';\nimport type { FormFieldValue } from '@/forms/Form';\nimport type { IAGHeadlessInput } from '@/components/headless/forms/AGHeadlessInput';\n\nimport { onFormFocus } from './composition';\n\nconst props = defineProps({\n type: stringProp('text'),\n});\n\nconst $input = ref<HTMLInputElement>();\nconst input = injectReactiveOrFail<IAGHeadlessInput>(\n 'input',\n '<AGHeadlessInputInput> must be a child of a <AGHeadlessInput>',\n);\nconst name = computed(() => input.name ?? undefined);\nconst value = computed(() => input.value);\nconst checked = computed(() => {\n if (props.type !== 'checkbox') {\n return;\n }\n\n return !!value.value;\n});\n\nfunction update() {\n if (!$input.value) {\n return;\n }\n\n input.update(getValue());\n}\n\nfunction getValue(): FormFieldValue | null {\n if (!$input.value) {\n return null;\n }\n\n switch (props.type) {\n case 'checkbox':\n return $input.value.checked;\n case 'date':\n return $input.value.valueAsDate;\n default:\n return $input.value.value;\n }\n}\n\nonFormFocus(input, () => $input.value?.focus());\nwatchEffect(() => (input as unknown as __SetsElement).__setElement($input.value));\nwatchEffect(() => {\n if (!$input.value) {\n return;\n }\n\n if (props.type === 'date') {\n $input.value.valueAsDate = value.value as Date;\n\n return;\n }\n\n $input.value.value = value.value as string;\n});\n</script>\n","<template>\n <label v-if=\"show\" :for=\"input.id\">\n <slot>\n {{ input.label }}\n </slot>\n </label>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, useSlots } from 'vue';\n\nimport { injectReactiveOrFail } from '@/utils/vue';\n\nimport type { IAGHeadlessInput } from './AGHeadlessInput';\n\nconst input = injectReactiveOrFail<IAGHeadlessInput>(\n 'input',\n '<AGHeadlessInputLabel> must be a child of a <AGHeadlessInput>',\n);\nconst slots = useSlots();\nconst show = computed(() => !!(input.label || slots.default));\n</script>\n","<template>\n <AGHeadlessInput\n ref=\"$input\"\n class=\"relative flex flex-col items-center\"\n :class=\"className\"\n v-bind=\"props\"\n >\n <AGHeadlessInputLabel class=\"sr-only\" />\n <AGHeadlessInputInput\n v-bind=\"attrs\"\n class=\"block w-full border-0 py-1.5 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600\"\n :class=\"{\n 'ring-1 ring-red-500': $input?.errors,\n }\"\n />\n <AGHeadlessInputDescription />\n <div class=\"absolute bottom-0 left-0 translate-y-full\">\n <AGHeadlessInputError class=\"mt-1 text-sm text-red-500\" />\n </div>\n </AGHeadlessInput>\n</template>\n\n<script setup lang=\"ts\">\nimport { componentRef } from '@/utils/vue';\nimport { useInputAttrs } from '@/utils/composition/forms';\nimport { useInputProps } from '@/components/headless/forms/AGHeadlessInput';\nimport type { IAGHeadlessInput } from '@/components/headless/forms/AGHeadlessInput';\n\nimport AGHeadlessInput from '../headless/forms/AGHeadlessInput.vue';\nimport AGHeadlessInputDescription from '../headless/forms/AGHeadlessInputDescription.vue';\nimport AGHeadlessInputError from '../headless/forms/AGHeadlessInputError.vue';\nimport AGHeadlessInputInput from '../headless/forms/AGHeadlessInputInput.vue';\nimport AGHeadlessInputLabel from '../headless/forms/AGHeadlessInputLabel.vue';\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = defineProps(useInputProps());\nconst $input = componentRef<IAGHeadlessInput>();\nconst [attrs, className] = useInputAttrs();\n</script>\n","import { arrayFrom } from '@noeldemartin/utils';\n\nconst builtInRules: Record<string, FormFieldValidator> = {\n required: (value) => (value ? undefined : 'required'),\n};\n\nexport type FormFieldValidator<T = unknown> = (value: T) => string | string[] | undefined;\n\nexport const validators: Record<string, FormFieldValidator> = { ...builtInRules };\n\nexport function defineFormValidationRule<T>(rule: string, validator: FormFieldValidator<T>): void {\n validators[rule] = validator as FormFieldValidator;\n}\n\nexport function validate(value: unknown, rule: string): string[] {\n const errors = validators[rule]?.(value);\n\n return errors ? arrayFrom(errors) : [];\n}\n","import { computed, nextTick, reactive, readonly, ref } from 'vue';\nimport { MagicObject, arrayRemove, fail, toString } from '@noeldemartin/utils';\nimport { validate } from './validation';\nimport type { ObjectValues } from '@noeldemartin/utils';\nimport type { ComputedRef, DeepReadonly, Ref, UnwrapNestedRefs } from 'vue';\n\nexport const FormFieldTypes = {\n String: 'string',\n Number: 'number',\n Boolean: 'boolean',\n Object: 'object',\n Date: 'date',\n} as const;\n\nexport interface FormFieldDefinition<TType extends FormFieldType = FormFieldType, TRules extends string = string> {\n type: TType;\n trim?: boolean;\n default?: GetFormFieldValue<TType>;\n rules?: TRules;\n}\n\nexport type FormFieldDefinitions = Record<string, FormFieldDefinition>;\nexport type FormFieldType = ObjectValues<typeof FormFieldTypes>;\nexport type FormFieldValue = GetFormFieldValue<FormFieldType>;\n\nexport type FormData<T> = {\n -readonly [k in keyof T]: T[k] extends FormFieldDefinition<infer TType, infer TRules>\n ? TRules extends 'required'\n ? GetFormFieldValue<TType>\n : GetFormFieldValue<TType> | null\n : never;\n};\n\nexport type FormErrors<T> = {\n [k in keyof T]: string[] | null;\n};\n\nexport type GetFormFieldValue<TType> = TType extends typeof FormFieldTypes.String\n ? string\n : TType extends typeof FormFieldTypes.Number\n ? number\n : TType extends typeof FormFieldTypes.Boolean\n ? boolean\n : TType extends typeof FormFieldTypes.Object\n ? object\n : TType extends typeof FormFieldTypes.Date\n ? Date\n : never;\n\nconst validForms: WeakMap<Form, ComputedRef<boolean>> = new WeakMap();\n\nexport type SubmitFormListener = () => unknown;\nexport type FocusFormListener = (input: string) => unknown;\n\nexport default class Form<Fields extends FormFieldDefinitions = FormFieldDefinitions> extends MagicObject {\n\n public errors: DeepReadonly<UnwrapNestedRefs<FormErrors<Fields>>>;\n\n private _fields: Fields;\n private _data: FormData<Fields>;\n private _submitted: Ref<boolean>;\n private _errors: FormErrors<Fields>;\n private _listeners: { focus?: FocusFormListener[]; submit?: SubmitFormListener[] } = {};\n\n constructor(fields: Fields) {\n super();\n\n this._fields = fields;\n this._submitted = ref(false);\n this._data = this.getInitialData(fields);\n this._errors = this.getInitialErrors(fields);\n\n validForms.set(\n this,\n computed(() => !Object.values(this._errors).some((error) => error !== null)),\n );\n\n this.errors = readonly(this._errors);\n }\n\n public get valid(): boolean {\n return !!validForms.get(this)?.value;\n }\n\n public get submitted(): boolean {\n return this._submitted.value;\n }\n\n public setFieldValue<T extends keyof Fields>(field: T, value: FormData<Fields>[T]): void {\n const definition =\n this._fields[field] ?? fail<FormFieldDefinition>(`Trying to set undefined '${toString(field)}' field`);\n\n this._data[field] =\n definition.type === FormFieldTypes.String && (definition.trim ?? true)\n ? (toString(value).trim() as FormData<Fields>[T])\n : value;\n\n if (this._submitted.value) {\n this.validate();\n }\n }\n\n public getFieldValue<T extends keyof Fields>(field: T): GetFormFieldValue<Fields[T]['type']> {\n return this._data[field] as unknown as GetFormFieldValue<Fields[T]['type']>;\n }\n\n public getFieldRules<T extends keyof Fields>(field: T): string[] {\n return this._fields[field]?.rules?.split('|') ?? [];\n }\n\n public data(): FormData<Fields> {\n return { ...this._data };\n }\n\n public validate(): boolean {\n const errors = Object.entries(this._fields).reduce((formErrors, [name, definition]) => {\n formErrors[name] = this.getFieldErrors(name, definition);\n\n return formErrors;\n }, {} as Record<string, string[] | null>);\n\n this.resetErrors(errors);\n\n return this.valid;\n }\n\n public reset(options: { keepData?: boolean; keepErrors?: boolean } = {}): void {\n this._submitted.value = false;\n\n options.keepData || this.resetData();\n options.keepErrors || this.resetErrors();\n }\n\n public submit(): boolean {\n this._submitted.value = true;\n\n const valid = this.validate();\n\n valid && this._listeners['submit']?.forEach((listener) => listener());\n\n return valid;\n }\n\n public on(event: 'focus', listener: FocusFormListener): () => void;\n public on(event: 'submit', listener: SubmitFormListener): () => void;\n public on(event: 'focus' | 'submit', listener: FocusFormListener | SubmitFormListener): () => void {\n this._listeners[event] ??= [];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this._listeners[event]?.push(listener as any);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return () => this.off(event as any, listener);\n }\n\n public off(event: 'focus', listener: FocusFormListener): void;\n public off(event: 'submit', listener: SubmitFormListener): void;\n public off(event: 'focus' | 'submit', listener: FocusFormListener | SubmitFormListener): void {\n arrayRemove(this._listeners[event] ?? [], listener);\n }\n\n public async focus(input: string): Promise<void> {\n await nextTick();\n\n this._listeners['focus']?.forEach((listener) => listener(input));\n }\n\n protected __get(property: string): unknown {\n if (!(property in this._fields)) {\n return super.__get(property);\n }\n\n return this.getFieldValue(property);\n }\n\n protected __set(property: string, value: unknown): void {\n if (!(property in this._fields)) {\n super.__set(property, value);\n\n return;\n }\n\n this.setFieldValue(property, value as FormData<Fields>[string]);\n }\n\n private getFieldErrors(name: keyof Fields, definition: FormFieldDefinition): string[] | null {\n const errors = [];\n const value = this._data[name];\n const rules = definition.rules?.split('|') ?? [];\n\n for (const rule of rules) {\n if (rule !== 'required' && (value === null || value === undefined)) {\n continue;\n }\n\n errors.push(...validate(value, rule));\n }\n\n return errors.length > 0 ? errors : null;\n }\n\n private getInitialData(fields: Fields): FormData<Fields> {\n if (this.static().isConjuring()) {\n return {} as FormData<Fields>;\n }\n\n const data = Object.entries(fields).reduce((formData, [name, definition]) => {\n formData[name as keyof Fields] = (definition.default ?? null) as FormData<Fields>[keyof Fields];\n\n return formData;\n }, {} as FormData<Fields>);\n\n return reactive(data) as FormData<Fields>;\n }\n\n private getInitialErrors(fields: Fields): FormErrors<Fields> {\n if (this.static().isConjuring()) {\n return {} as FormErrors<Fields>;\n }\n\n const errors = Object.keys(fields).reduce((formErrors, name) => {\n formErrors[name as keyof Fields] = null;\n\n return formErrors;\n }, {} as FormErrors<Fields>);\n\n return reactive(errors) as FormErrors<Fields>;\n }\n\n private resetData(): void {\n for (const [name, field] of Object.entries(this._fields)) {\n this._data[name as keyof Fields] = (field.default ?? null) as FormData<Fields>[keyof Fields];\n }\n }\n\n private resetErrors(errors?: Record<string, string[] | null>): void {\n Object.keys(this._errors).forEach((key) => delete this._errors[key as keyof Fields]);\n\n errors && Object.assign(this._errors, errors);\n }\n\n}\n","import Form from '@/forms/Form';\nimport type { FormData, FormFieldDefinitions } from '@/forms/Form';\n\nexport function useForm<const T extends FormFieldDefinitions>(fields: T): Form<T> & FormData<T> {\n return new Form(fields) as Form<T> & FormData<T>;\n}\n","import { FormFieldTypes } from './Form';\nimport type { FormFieldDefinition } from './Form';\n\nexport function booleanInput(\n defaultValue?: boolean,\n options: { rules?: string } = {},\n): FormFieldDefinition<typeof FormFieldTypes.Boolean> {\n return {\n default: defaultValue,\n type: FormFieldTypes.Boolean,\n rules: options.rules,\n };\n}\n\nexport function dateInput(\n defaultValue?: Date,\n options: { rules?: string } = {},\n): FormFieldDefinition<typeof FormFieldTypes.Date> {\n return {\n default: defaultValue,\n type: FormFieldTypes.Date,\n rules: options.rules,\n };\n}\n\nexport function requiredBooleanInput(\n defaultValue?: boolean,\n): FormFieldDefinition<typeof FormFieldTypes.Boolean, 'required'> {\n return {\n default: defaultValue,\n type: FormFieldTypes.Boolean,\n rules: 'required',\n };\n}\n\nexport function requiredDateInput(defaultValue?: Date): FormFieldDefinition<typeof FormFieldTypes.Date> {\n return {\n default: defaultValue,\n type: FormFieldTypes.Date,\n rules: 'required',\n };\n}\n\nexport function requiredNumberInput(\n defaultValue?: number,\n): FormFieldDefinition<typeof FormFieldTypes.Number, 'required'> {\n return {\n default: defaultValue,\n type: FormFieldTypes.Number,\n rules: 'required',\n };\n}\n\nexport function requiredStringInput(\n defaultValue?: string,\n): FormFieldDefinition<typeof FormFieldTypes.String, 'required'> {\n return {\n default: defaultValue,\n type: FormFieldTypes.String,\n rules: 'required',\n };\n}\n\nexport function numberInput(\n defaultValue?: number,\n options: { rules?: string } = {},\n): FormFieldDefinition<typeof FormFieldTypes.Number> {\n return {\n default: defaultValue,\n type: FormFieldTypes.Number,\n rules: options.rules,\n };\n}\n\nexport function stringInput(\n defaultValue?: string,\n options: { rules?: string } = {},\n): FormFieldDefinition<typeof FormFieldTypes.String> {\n return {\n default: defaultValue,\n type: FormFieldTypes.String,\n rules: options.rules,\n };\n}\n","<template>\n <AGModal v-slot=\"{ close }: IAGModalDefaultSlotProps\" :cancellable=\"false\" :title=\"title\">\n <AGMarkdown :text=\"message\" />\n\n <AGForm :form=\"form\" @submit=\"close(form.draft)\">\n <AGInput name=\"draft\" :placeholder=\"placeholder\" :label=\"label\" />\n\n <div class=\"mt-2 flex flex-row-reverse gap-2\">\n <AGButton :color=\"acceptColor\" submit>\n {{ renderedAcceptText }}\n </AGButton>\n <AGButton :color=\"cancelColor\" @click=\"close()\">\n {{ renderedCancelText }}\n </AGButton>\n </div>\n </AGForm>\n </AGModal>\n</template>\n\n<script setup lang=\"ts\">\nimport AGModal from './AGModal.vue';\nimport { usePromptModal, usePromptModalProps } from './AGPromptModal';\nimport type { IAGModalDefaultSlotProps } from './AGModal';\n\nimport AGButton from '../forms/AGButton.vue';\nimport AGForm from '../forms/AGForm.vue';\nimport AGInput from '../forms/AGInput.vue';\nimport AGMarkdown from '../lib/AGMarkdown.vue';\nimport { requiredStringInput, useForm } from '../../forms';\n\nconst props = defineProps(usePromptModalProps());\nconst form = useForm({ draft: requiredStringInput(props.defaultValue ?? '') });\nconst { renderedAcceptText, renderedCancelText } = usePromptModal(props);\n</script>\n","import type { ExtractPropTypes } from 'vue';\nimport type { ObjectWithoutEmpty } from '@noeldemartin/utils';\n\nimport UI from '@/ui/UI';\nimport { arrayProp, enumProp, requiredStringProp } from '@/utils/vue';\nimport { Colors } from '@/components/constants';\nimport { objectWithout } from '@noeldemartin/utils';\n\nexport { default as AGHeadlessSnackbar } from './AGHeadlessSnackbar.vue';\n\nexport const SnackbarColors = objectWithout(Colors, ['Primary', 'Clear']);\nexport const snackbarProps = {\n id: requiredStringProp(),\n message: requiredStringProp(),\n actions: arrayProp<SnackbarAction>(() => []),\n color: enumProp(SnackbarColors, Colors.Secondary),\n};\n\nexport interface SnackbarAction {\n text: string;\n dismiss?: boolean;\n handler?(): unknown;\n}\n\nexport type SnackbarColor = (typeof SnackbarColors)[keyof typeof SnackbarColors];\nexport type AGSnackbarProps = ObjectWithoutEmpty<ExtractPropTypes<typeof snackbarProps>>;\n\nexport function useSnackbarProps(): typeof snackbarProps {\n return snackbarProps;\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function useSnackbar(props: ExtractPropTypes<typeof snackbarProps>) {\n function activate(action: SnackbarAction): void {\n action.handler?.();\n action.dismiss && UI.hideSnackbar(props.id);\n }\n\n return { activate };\n}\n","<template>\n <AGHeadlessSnackbar class=\"flex flex-row items-center justify-center gap-3 p-4\" :class=\"styleClasses\">\n <AGMarkdown :text=\"message\" inline />\n <AGButton\n v-for=\"(action, i) of actions\"\n :key=\"i\"\n :color=\"color\"\n @click=\"activate(action)\"\n >\n {{ action.text }}\n </AGButton>\n </AGHeadlessSnackbar>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\n\nimport { Colors } from '@/components/constants';\nimport { useSnackbar, useSnackbarProps } from '@/components/headless/snackbars';\n\nimport AGButton from '../forms/AGButton.vue';\nimport AGHeadlessSnackbar from '../headless/snackbars/AGHeadlessSnackbar.vue';\nimport AGMarkdown from '../lib/AGMarkdown.vue';\n\nconst props = defineProps(useSnackbarProps());\nconst { activate } = useSnackbar(props);\nconst styleClasses = computed(() => {\n switch (props.color) {\n case Colors.Danger:\n return 'bg-red-200 text-red-900';\n default:\n case Colors.Secondary:\n return 'bg-gray-900 text-white';\n }\n});\n</script>\n","import type { Component } from 'vue';\n\nimport { bootServices } from '@/services';\nimport { definePlugin } from '@/plugins';\n\nimport UI, { UIComponents } from './UI';\nimport AGAlertModal from '../components/modals/AGAlertModal.vue';\nimport AGConfirmModal from '../components/modals/AGConfirmModal.vue';\nimport AGErrorReportModal from '../components/modals/AGErrorReportModal.vue';\nimport AGLoadingModal from '../components/modals/AGLoadingModal.vue';\nimport AGPromptModal from '../components/modals/AGPromptModal.vue';\nimport AGSnackbar from '../components/snackbars/AGSnackbar.vue';\nimport AGStartupCrash from '../components/lib/AGStartupCrash.vue';\nimport type { UIComponent } from './UI';\n\nconst services = { $ui: UI };\n\nexport * from './UI';\nexport * from './utils';\nexport { default as UI } from './UI';\n\nexport type UIServices = typeof services;\n\nexport default definePlugin({\n async install(app, options) {\n const defaultComponents = {\n [UIComponents.AlertModal]: AGAlertModal,\n [UIComponents.ConfirmModal]: AGConfirmModal,\n [UIComponents.ErrorReportModal]: AGErrorReportModal,\n [UIComponents.LoadingModal]: AGLoadingModal,\n [UIComponents.PromptModal]: AGPromptModal,\n [UIComponents.Snackbar]: AGSnackbar,\n [UIComponents.StartupCrash]: AGStartupCrash,\n };\n\n Object.entries({\n ...defaultComponents,\n ...options.components,\n }).forEach(([name, component]) => UI.registerComponent(name as UIComponent, component));\n\n await bootServices(app, services);\n },\n});\n\ndeclare module '@/bootstrap/options' {\n export interface AerogelOptions {\n components?: Partial<Record<UIComponent, Component>>;\n }\n}\n\ndeclare module '@/services' {\n export interface Services extends UIServices {}\n}\n","import Aerogel from 'virtual:aerogel';\n\nimport { createApp } from 'vue';\nimport type { App as AppInstance, Component } from 'vue';\n\nimport App from '@/services/App';\nimport directives from '@/directives';\nimport errors from '@/errors';\nimport Events from '@/services/Events';\nimport lang from '@/lang';\nimport services from '@/services';\nimport testing from '@/testing';\nimport ui from '@/ui';\nimport { installPlugins } from '@/plugins';\nimport type { AerogelOptions } from '@/bootstrap/options';\n\nexport { AerogelOptions };\n\nexport async function bootstrapApplication(app: AppInstance, options: AerogelOptions = {}): Promise<void> {\n const plugins = [testing, directives, errors, lang, services, ui, ...(options.plugins ?? [])];\n\n App.instance = app;\n\n await installPlugins(plugins, app, options);\n await options.install?.(app);\n await Events.emit('application-ready');\n}\n\nexport async function bootstrap(rootComponent: Component, options: AerogelOptions = {}): Promise<void> {\n const app = createApp(rootComponent);\n\n if (Aerogel.environment === 'development') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (window as any).$aerogel = app;\n }\n\n await bootstrapApplication(app, options);\n\n app.mount('#app');\n app._container?.classList.remove('loading');\n\n await Events.emit('application-mounted');\n}\n\ndeclare module '@/services/Events' {\n export interface EventsPayload {\n 'application-ready': void;\n 'application-mounted': void;\n }\n}\n","<template>\n <aside v-if=\"modal\">\n <AGModalContext :child-index=\"1\" :modal=\"modal\" />\n </aside>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\n\nimport UI from '@/ui/UI';\n\nimport AGModalContext from './modals/AGModalContext.vue';\n\nconst modal = computed(() => UI.modals[0] ?? null);\n</script>\n","<template>\n <div aria-live=\"assertive\" class=\"pointer-events-none fixed inset-0 z-50 flex items-end px-4 py-6 sm:p-6\">\n <div class=\"flex w-full flex-col items-end space-y-4\">\n <component\n :is=\"snackbar.component\"\n v-for=\"snackbar of $ui.snackbars\"\n :id=\"snackbar.id\"\n :key=\"snackbar.id\"\n v-bind=\"snackbar.properties\"\n />\n </div>\n </div>\n</template>\n","<template>\n <div\n id=\"aerogel-overlays-backdrop\"\n ref=\"$backdrop\"\n class=\"pointer-events-none fixed inset-0 z-50 bg-black/30 opacity-0\"\n />\n <AGAppModals />\n <AGAppSnackbars />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref } from 'vue';\n\nimport { useEvent } from '@/utils/composition/events';\n\nimport AGAppModals from './AGAppModals.vue';\nimport AGAppSnackbars from './AGAppSnackbars.vue';\n\nconst $backdrop = ref<HTMLElement | null>(null);\nconst backdropHidden = ref(true);\n\nuseEvent('show-overlays-backdrop', async () => {\n if (!$backdrop.value || !backdropHidden.value) {\n return;\n }\n\n backdropHidden.value = false;\n\n $backdrop.value.classList.remove('opacity-0');\n});\n\nuseEvent('hide-overlays-backdrop', async () => {\n if (!$backdrop.value || backdropHidden.value) {\n return;\n }\n\n backdropHidden.value = true;\n\n $backdrop.value.classList.add('opacity-0');\n});\n</script>\n","<template>\n <AGHeadlessInput\n ref=\"$input\"\n :name=\"name\"\n class=\"flex\"\n @update:model-value=\"$emit('update:modelValue', $event)\"\n >\n <AGHeadlessInputInput\n v-bind=\"$attrs\"\n type=\"checkbox\"\n :class=\"{\n 'text-indigo-600 focus:ring-indigo-600': !$input?.errors,\n 'border-red-200 text-red-600 focus:ring-red-600': $input?.errors,\n }\"\n />\n\n <div class=\"ml-2\">\n <AGHeadlessInputLabel v-if=\"$slots.default\">\n <slot />\n </AGHeadlessInputLabel>\n <AGHeadlessInputError class=\"text-sm text-red-600\" />\n </div>\n </AGHeadlessInput>\n</template>\n\n<script setup lang=\"ts\">\nimport { componentRef, stringProp } from '@/utils/vue';\n\nimport type { IAGHeadlessInput } from '@/components/headless/forms/AGHeadlessInput';\n\nimport AGHeadlessInput from '../headless/forms/AGHeadlessInput.vue';\nimport AGHeadlessInputError from '../headless/forms/AGHeadlessInputError.vue';\nimport AGHeadlessInputInput from '../headless/forms/AGHeadlessInputInput.vue';\nimport AGHeadlessInputLabel from '../headless/forms/AGHeadlessInputLabel.vue';\n\ndefineProps({ name: stringProp() });\ndefineOptions({ inheritAttrs: false });\ndefineEmits(['update:modelValue']);\n\nconst $input = componentRef<IAGHeadlessInput>();\n</script>\n","import type { ComputedRef, DeepReadonly, ExtractPropTypes, Ref } from 'vue';\nimport type { Writable } from '@noeldemartin/utils';\n\nimport { mixedProp, requiredArrayProp, stringProp } from '@/utils/vue';\nimport { extractComponentProps } from '@/components/utils';\nimport type { FormFieldValue } from '@/forms/Form';\n\nexport interface IAGHeadlessSelect {\n id: string;\n label: ComputedRef<string | null>;\n noSelectionText: ComputedRef<string>;\n buttonText: ComputedRef<string>;\n renderText: ComputedRef<(value: FormFieldValue) => string>;\n selectedOption: ComputedRef<FormFieldValue | null>;\n options: ComputedRef<FormFieldValue[]>;\n errors: DeepReadonly<Ref<string[] | null>>;\n update(value: FormFieldValue): void;\n}\n\nexport const selectProps = {\n name: stringProp(),\n label: stringProp(),\n options: requiredArrayProp<FormFieldValue>(),\n noSelectionText: stringProp(),\n optionsText: mixedProp<string | ((option: FormFieldValue) => string)>(),\n};\n\nexport const selectEmits = ['update:modelValue'] as const;\n\nexport function useSelectProps(): typeof selectProps {\n return selectProps;\n}\n\nexport function useSelectEmits(): Writable<typeof selectEmits> {\n return [...selectEmits];\n}\n\nexport function extractSelectProps<T extends ExtractPropTypes<typeof selectProps>>(\n props: T,\n): Pick<T, keyof typeof selectProps> {\n return extractComponentProps(props, selectProps);\n}\n","<template>\n <Listbox\n v-slot=\"{ value, open, disabled }: ComponentProps\"\n :model-value=\"selectedOption\"\n @update:model-value=\"update($event)\"\n >\n <slot :value=\"value\" :open=\"open\" :disabled=\"disabled\" />\n </Listbox>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, inject, provide } from 'vue';\nimport { toString, uuid } from '@noeldemartin/utils';\nimport { Listbox } from '@headlessui/vue';\n\nimport { mixedProp } from '@/utils/vue';\nimport { translateWithDefault } from '@/lang/utils';\nimport type Form from '@/forms/Form';\nimport type { FormFieldValue } from '@/forms/Form';\nimport type { ComponentProps } from '@/utils/vue';\n\nimport { useSelectEmits, useSelectProps } from './AGHeadlessSelect';\nimport type { IAGHeadlessSelect } from './AGHeadlessSelect';\n\nconst emit = defineEmits(useSelectEmits());\nconst props = defineProps({\n modelValue: mixedProp<FormFieldValue>(),\n ...useSelectProps(),\n});\nconst renderText = computed(() => {\n if (typeof props.optionsText === 'function') {\n return props.optionsText;\n }\n\n if (typeof props.optionsText === 'string') {\n return (option: FormFieldValue): string => toString(option[props.optionsText as keyof FormFieldValue]);\n }\n\n return (option: FormFieldValue) => toString(option);\n});\nconst form = inject<Form | null>('form', null);\nconst noSelectionText = computed(() => props.noSelectionText ?? translateWithDefault('select.noSelection', '-'));\nconst selectedOption = computed(() => (form && props.name ? form.getFieldValue(props.name) : props.modelValue));\nconst errors = computed(() => {\n if (!form || !props.name) {\n return null;\n }\n\n return form.errors[props.name] ?? null;\n});\n\nfunction update(value: FormFieldValue) {\n if (form && props.name) {\n form.setFieldValue(props.name, value);\n\n return;\n }\n\n emit('update:modelValue', value);\n}\n\nconst api: IAGHeadlessSelect = {\n id: `select-${uuid()}`,\n noSelectionText,\n selectedOption,\n errors,\n options: computed(() => props.options),\n label: computed(() => props.label),\n buttonText: computed(() =>\n selectedOption.value === null ? noSelectionText.value : renderText.value(selectedOption.value)),\n renderText,\n update,\n};\n\nprovide<IAGHeadlessSelect>('select', api);\ndefineExpose<IAGHeadlessSelect>(api);\n</script>\n","<template>\n <ListboxButton v-slot=\"{ value, open, disabled }: ComponentProps\">\n <slot :value=\"value\" :open=\"open\" :disabled=\"disabled\">\n <span :class=\"textClass\">{{ select?.buttonText }}</span>\n </slot>\n <slot name=\"icon\" />\n </ListboxButton>\n</template>\n\n<script setup lang=\"ts\">\nimport { ListboxButton } from '@headlessui/vue';\n\nimport { injectReactiveOrFail, stringProp } from '@/utils/vue';\nimport type { ComponentProps } from '@/utils/vue';\n\nimport type { IAGHeadlessSelect } from './AGHeadlessSelect';\n\ndefineProps({ textClass: stringProp() });\n\nconst select = injectReactiveOrFail<IAGHeadlessSelect>(\n 'select',\n '<AGHeadlessSelectButton> must be a child of a <AGHeadlessSelect>',\n);\n</script>\n","<template>\n <p v-if=\"errorMessage\" :id=\"`${select.id}-error`\">\n {{ errorMessage }}\n </p>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\n\nimport { injectReactiveOrFail } from '@/utils/vue';\nimport { translateWithDefault } from '@/lang/utils';\n\nimport type { IAGHeadlessSelect } from './AGHeadlessSelect';\n\nconst select = injectReactiveOrFail<IAGHeadlessSelect>(\n 'select',\n '<AGHeadlessSelectError> must be a child of a <AGHeadlessSelect>',\n);\nconst errorMessage = computed(() => {\n if (!select.errors) {\n return null;\n }\n\n return translateWithDefault(`errors.${select.errors[0]}`, `Error: ${select.errors[0]}`);\n});\n</script>\n","<template>\n <ListboxLabel v-if=\"show\" v-slot=\"{ open, disabled }: ComponentProps\">\n <slot :open=\"open\" :disabled=\"disabled\">\n {{ select.label }}\n </slot>\n </ListboxLabel>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, useSlots } from 'vue';\nimport { ListboxLabel } from '@headlessui/vue';\n\nimport { injectReactiveOrFail } from '@/utils/vue';\nimport type { ComponentProps } from '@/utils/vue';\n\nimport type { IAGHeadlessSelect } from './AGHeadlessSelect';\n\nconst select = injectReactiveOrFail<IAGHeadlessSelect>(\n 'select',\n '<AGHeadlessSelectLabel> must be a child of a <AGHeadlessSelect>',\n);\nconst slots = useSlots();\nconst show = computed(() => !!(select.label || slots.default));\n</script>\n","<template>\n <ListboxOption v-slot=\"{ active, selected, disabled }: ComponentProps\" :value=\"value\" as=\"template\">\n <slot :active=\"active\" :selected=\"selected\" :disabled=\"disabled\">\n <li\n :class=\"{\n [activeClass ?? 'active']: active,\n [inactiveClass ?? 'inactive']: !active,\n [selectedClass ?? 'selected']: selected,\n [unselectedClass ?? 'unselected']: !selected,\n }\"\n >\n {{ select.renderText(value) }}\n </li>\n </slot>\n </ListboxOption>\n</template>\n\n<script setup lang=\"ts\">\nimport { ListboxOption } from '@headlessui/vue';\n\nimport { injectReactiveOrFail, requiredMixedProp, stringProp } from '@/utils/vue';\nimport type { ComponentProps } from '@/utils/vue';\nimport type { FormFieldValue } from '@/forms/Form';\n\nimport type { IAGHeadlessSelect } from './AGHeadlessSelect';\n\ndefineProps({\n value: requiredMixedProp<FormFieldValue>(),\n selectedClass: stringProp(),\n unselectedClass: stringProp(),\n activeClass: stringProp(),\n inactiveClass: stringProp(),\n});\n\nconst select = injectReactiveOrFail<IAGHeadlessSelect>(\n 'select',\n '<AGHeadlessSelectOption> must be a child of a <AGHeadlessSelect>',\n);\n</script>\n","<template>\n <AGHeadlessSelect\n v-bind=\"props\"\n ref=\"$select\"\n as=\"div\"\n @update:model-value=\"$emit('update:modelValue', $event)\"\n >\n <AGHeadlessSelectLabel class=\"block text-sm font-medium leading-6 text-gray-900\" />\n <div class=\"relative\" :class=\"{ 'mt-2': $select?.label }\">\n <AGHeadlessSelectButton\n class=\"relative w-full cursor-default bg-white py-1.5 pl-3 pr-10 text-left text-gray-900 ring-1 ring-inset ring-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-600\"\n text-class=\"block truncate\"\n :class=\"{\n 'ring-1 ring-red-500': $select?.errors,\n }\"\n >\n <template #icon>\n <span class=\"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2\">\n <IconCheveronDown class=\"h-5 w-5 text-gray-400\" />\n </span>\n </template>\n </AGHeadlessSelectButton>\n <AGHeadlessSelectOptions\n class=\"absolute z-10 mt-1 max-h-60 w-full overflow-auto border bg-white py-1 text-base ring-1 ring-black ring-opacity-5 focus:outline-none\"\n >\n <AGHeadlessSelectOption\n v-for=\"(option, index) in $select?.options ?? []\"\n :key=\"index\"\n :value=\"option\"\n class=\"relative block cursor-default select-none truncate py-2 pl-3 pr-9\"\n selected-class=\"font-semibold\"\n unselected-class=\"font-normal\"\n active-class=\"bg-indigo-600 text-white\"\n inactive-class=\"text-gray-900\"\n />\n </AGHeadlessSelectOptions>\n </div>\n <AGHeadlessSelectError class=\"mt-2 text-sm text-red-600\" />\n </AGHeadlessSelect>\n</template>\n\n<script setup lang=\"ts\">\nimport IconCheveronDown from '~icons/zondicons/cheveron-down';\n\nimport { componentRef } from '@/utils/vue';\nimport { useSelectEmits, useSelectProps } from '@/components/headless/forms/AGHeadlessSelect';\nimport type { IAGHeadlessSelect } from '@/components/headless/forms/AGHeadlessSelect';\n\nimport AGHeadlessSelect from '../headless/forms/AGHeadlessSelect.vue';\nimport AGHeadlessSelectButton from '../headless/forms/AGHeadlessSelectButton.vue';\nimport AGHeadlessSelectError from '../headless/forms/AGHeadlessSelectError.vue';\nimport AGHeadlessSelectLabel from '../headless/forms/AGHeadlessSelectLabel.vue';\nimport AGHeadlessSelectOption from '../headless/forms/AGHeadlessSelectOption.vue';\nimport AGHeadlessSelectOptions from '../headless/forms/AGHeadlessSelectOptions';\n\ndefineEmits(useSelectEmits());\n\nconst props = defineProps(useSelectProps());\nconst $select = componentRef<IAGHeadlessSelect>();\n</script>\n","<template>\n <textarea\n :id=\"input.id\"\n ref=\"$textArea\"\n :name=\"name\"\n :required=\"input.required ?? undefined\"\n :value=\"value\"\n :aria-invalid=\"input.errors ? 'true' : 'false'\"\n :aria-describedby=\"\n input.errors ? `${input.id}-error` : input.description ? `${input.id}-description` : undefined\n \"\n @input=\"update\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref, watchEffect } from 'vue';\n\nimport { injectReactiveOrFail } from '@/utils/vue';\nimport type { IAGHeadlessInput } from '@/components/headless/forms/AGHeadlessInput';\nimport type { __SetsElement } from '@/components/interfaces';\n\nimport { onFormFocus } from './composition';\n\nconst $textArea = ref<HTMLTextAreaElement>();\nconst input = injectReactiveOrFail<IAGHeadlessInput>(\n 'input',\n '<AGHeadlessInputTextArea> must be a child of a <AGHeadlessInput>',\n);\nconst name = computed(() => input.name ?? undefined);\nconst value = computed(() => input.value as string);\n\nfunction update() {\n if (!$textArea.value) {\n return;\n }\n\n input.update($textArea.value.value);\n}\n\nwatchEffect(() => (input as unknown as __SetsElement).__setElement($textArea.value));\nonFormFocus(input, () => $textArea.value?.focus());\n</script>\n","<template>\n <AGMarkdown :text=\"message\" inline />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\n\nimport { requiredObjectProp } from '@/utils/vue';\nimport { getErrorMessage } from '@/errors/utils';\nimport type { ErrorSource } from '@/errors/Errors.state';\n\nimport AGMarkdown from './AGMarkdown.vue';\n\nconst props = defineProps({ error: requiredObjectProp<ErrorSource>() });\nconst message = computed(() => getErrorMessage(props.error));\n</script>\n","<template>\n <component :is=\"as\" v-measure=\"() => (measured = true)\" :class=\"{ '!invisible !absolute !w-auto': !measured }\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref } from 'vue';\n\nimport { stringProp } from '@/utils/vue';\n\ndefineProps({ as: stringProp('span') });\n\n// TODO use v-measure.css\nconst measured = ref(false);\n</script>\n","<template>\n <div class=\"mt-1 h-2 w-full min-w-[min(400px,80vw)] overflow-hidden rounded-full bg-gray-200\">\n <div :class=\"barClasses\" :style=\"`transform:translateX(-${(1 - renderedProgress) * 100}%)`\" />\n <span class=\"sr-only\">\n {{\n $td('ui.progress', '{progress}% complete', {\n progress: renderedProgress * 100,\n })\n }}\n </span>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, onMounted, onUnmounted, ref } from 'vue';\n\nimport { numberProp, objectProp, stringProp } from '@/utils/vue';\nimport type { Job } from '@/jobs';\n\nconst props = defineProps({\n progress: numberProp(),\n barClass: stringProp(''),\n job: objectProp<Job>(),\n});\n\nlet cleanup: Function | undefined;\nconst jobProgress = ref(0);\nconst barClasses = computed(() => {\n const classes = props.barClass ?? '';\n\n return `h-full w-full transition-transform duration-500 ease-linear ${\n classes.includes('bg-') ? classes : `${classes} bg-gray-700`\n }`;\n});\nconst renderedProgress = computed(() => {\n if (typeof props.progress === 'number') {\n return props.progress;\n }\n\n return jobProgress.value;\n});\n\nonMounted(() => (cleanup = props.job?.listeners.add({ onUpdated: (progress) => (jobProgress.value = progress) })));\nonUnmounted(() => cleanup?.());\n</script>\n","import { JSError } from '@noeldemartin/utils';\n\nexport default class JobCancelledError extends JSError {}\n","import { ListenersManager, PromisedValue, round, tap, toError } from '@noeldemartin/utils';\nimport type { Listeners } from '@noeldemartin/utils';\n\nimport JobCancelledError from '@/errors/JobCancelledError';\n\nimport type { JobListener } from './listeners';\nimport type { JobStatus } from './status';\n\nexport default abstract class Job<\n Listener extends JobListener = JobListener,\n Status extends JobStatus = JobStatus,\n SerializedStatus extends JobStatus = JobStatus\n> {\n\n protected status: Status;\n protected _listeners: ListenersManager<JobListener>;\n protected _progress?: number;\n protected _cancelled?: PromisedValue<void>;\n protected _started: PromisedValue<void>;\n protected _completed: PromisedValue<void>;\n\n constructor() {\n this.status = this.getInitialStatus();\n this._listeners = new ListenersManager();\n this._started = new PromisedValue();\n this._completed = new PromisedValue();\n }\n\n public async start(): Promise<void> {\n this.beforeStart();\n this._started.resolve();\n\n try {\n await this.updateProgress();\n await this.run();\n await this.updateProgress();\n\n this._completed.resolve();\n } catch (error) {\n if (error instanceof JobCancelledError) {\n return;\n }\n\n throw tap(toError(error), (realError) => {\n this._completed.reject(realError);\n });\n }\n }\n\n public async cancel(): Promise<void> {\n this._cancelled = new PromisedValue();\n\n await this._cancelled;\n }\n\n public serialize(): SerializedStatus {\n return this.serializeStatus(this.status);\n }\n\n public get listeners(): Listeners<Listener> {\n return this._listeners;\n }\n\n public get progress(): number {\n return this._progress ?? 0;\n }\n\n public get cancelled(): boolean {\n return !!this._cancelled?.isResolved();\n }\n\n public get started(): Promise<void> {\n return this._started;\n }\n\n public get completed(): Promise<void> {\n return this._completed;\n }\n\n protected abstract run(): Promise<void>;\n\n protected getInitialStatus(): Status {\n return { completed: false } as Status;\n }\n\n protected beforeStart(): void {\n if (!this._started.isResolved()) {\n return;\n }\n\n if (this._cancelled) {\n delete this._progress;\n delete this._cancelled;\n\n return;\n }\n\n throw new Error('Job already started!');\n }\n\n protected assertNotCancelled(): void {\n if (!this._cancelled) {\n return;\n }\n\n this._cancelled.resolve();\n\n throw new JobCancelledError();\n }\n\n protected calculateCurrentProgress(status?: JobStatus): number {\n status ??= this.status;\n\n if (status.completed) {\n return 1;\n }\n\n if (!status.children) {\n return 0;\n }\n\n return round(\n status.children.reduce((total, child) => total + this.calculateCurrentProgress(child), 0) /\n status.children.length,\n 2,\n );\n }\n\n protected async updateProgress(update?: (status: Status) => unknown): Promise<void> {\n await update?.(this.status);\n\n const progress = this.calculateCurrentProgress();\n\n if (progress === this._progress) {\n return;\n }\n\n this._progress = progress;\n\n await this._listeners.emit('onUpdated', progress);\n }\n\n protected serializeStatus(status: Status): SerializedStatus {\n return { ...status } as unknown as SerializedStatus;\n }\n\n}\n","import Job from './Job';\n\nexport { Job };\nexport * from './Job';\nexport * from './listeners';\nexport * from './status';\n\nexport async function dispatch(job: Job): Promise<void> {\n await job.start();\n}\n","import { noop } from '@noeldemartin/utils';\nimport { onMounted, onUnmounted } from 'vue';\n\nexport function onCleanMounted(operation: () => Function): void {\n let cleanUp: Function = noop;\n\n onMounted(() => (cleanUp = operation()));\n onUnmounted(() => cleanUp());\n}\n","import { reactive, toRaw, watch } from 'vue';\nimport { Storage } from '@noeldemartin/utils';\nimport type { UnwrapNestedRefs } from 'vue';\n\nexport function persistent<T extends object>(name: string, defaults: T): UnwrapNestedRefs<T> {\n const store = reactive<T>(Storage.get<T>(name) ?? defaults);\n\n watch(store, () => Storage.set(name, toRaw(store)));\n\n return store;\n}\n","export function removeInteractiveClasses(classes: string): string {\n return classes\n .split(/\\s+/)\n .filter((className) => !/^(hover|focus|focus-visible):/.test(className))\n .join(' ')\n .trim();\n}\n","import { objectOnly } from '@noeldemartin/utils';\n\nexport type Replace<\n TOriginal extends Record<string, unknown>,\n TReplacements extends Partial<Record<keyof TOriginal, unknown>>\n> = {\n [K in keyof TOriginal]: TReplacements extends Record<K, infer Replacement> ? Replacement : TOriginal[K];\n};\n\nexport function replaceExisting<\n TOriginal extends Record<string, unknown>,\n TReplacements extends Partial<Record<keyof TOriginal, unknown>>\n>(original: TOriginal, replacements: TReplacements): Replace<TOriginal, TReplacements> {\n return {\n ...original,\n ...objectOnly(replacements, Object.keys(original)),\n } as Replace<TOriginal, TReplacements>;\n}\n"],"names":["ServiceBootError","JSError","constructor","serviceNamespace","cause","super","_store","initializePiniaStore","resetPiniaStore","tap","createPinia","store","setActivePinia","getPiniaStore","defineServiceStore","name","options","defineStore","defineServiceState","_class","Service","usesStore","getName","getInitialState","initialState","Object","entries","reduce","state","_ref","key","value","structuredClone","error","console","warn","this","getComputedStateDefinition","computed","getStateWatchers","watch","serializePersistedState","serialize","deserializePersistedState","restore","_defineProperty","persist","MagicObject","getters","_name","_booted","PromisedValue","_computedStateKeys","Set","keys","_watchers","booted","static","property","launch","handleError","reject","frameworkBoot","then","boot","resolve","catch","hasPersistedState","Storage","has","hasState","$state","getState","undefined","setState","stateOrProperty","update","old","objectOnly","assign","onStateUpdated","updatePersistedState","keyOrKeys","arrayFrom","isEmpty","onPersistentStateUpdated","__get","__set","persisted","watcher","call","storage","get","set","objectDeepClone","restorePersistedState","require","requireStore","fail","EventsService","arguments","globalThis","__aerogelEvents__","forEach","event","listener","on","emit","payload","listeners","priorities","handlers","priority","Promise","all","map","optionsOrListener","handler","registerListener","off","once","onceListener","arrayRemove","length","includes","push","sort","a","b","facade","Service$3","plugins","instance","environment","Aerogel","version","sourceUrl","development","staging","testing","versionName","sourceHash","toString","substring","versionUrl","AppService","isReady","ready","isResolved","isMounted","mounted","whenReady","callback","reload","queryParameters","updateLocationQueryParameters","location","forever","plugin","service","config","globalProperties","Events","definePlugin","async","installPlugins","_len","args","Array","_key","App","pluginsMap","install","arrayProp","defaultValue","type","default","booleanProp","Boolean","componentRef","ref","defineDirective","directive","enumProp","enumeration","values","String","validator","injectReactive","inject","reactive","injectReactiveOrFail","errorMessage","mixedProp","numberProp","Number","objectProp","requiredArrayProp","required","requiredMixedProp","requiredObjectProp","requiredStringProp","stringProp","initialFocus","element","focus","resizeObservers","WeakMap","builtInDirectives","measure","sizes","getBoundingClientRect","style","setProperty","width","height","ResizeObserver","observe","unmounted","unobserve","delete","directives","app","CacheService","url","cache","open","match","response","put","replace","caches","purge","defaultServices","$app","$events","$storage","bootServices","services","errorHandler","services$3","use","Layouts","Mobile","Desktop","getCurrentLayout","innerWidth","Service$2","modals","snackbars","layout","mobile","desktop","_ref2","UIComponents","AlertModal","ConfirmModal","ErrorReportModal","LoadingModal","PromptModal","Snackbar","StartupCrash","UIService","requireComponent","components","alert","messageOrTitle","message","openModal","title","confirm","messageOrOptions","properties","modal","result","beforeClose","confirmed","checkboxes","checkbox","prompt","trim","rawResult","loading","operationOrMessageOrOptions","operation","processOperation","o","operationPromise","props","after","seconds","closeModal","id","showSnackbar","snackbar","uuid","component","markRaw","concat","setTimeout","hideSnackbar","filter","registerComponent","callbacks","willClose","afterClose","closed","activeModal","at","modalCallbacks","nextTick","removeModal","closeAllModals","watchModalEvents","watchMountedEvent","watchViewportBreakpoints","m","_ref3","document","getComputedStyle","splash","getElementById","opacity","ms","remove","matchMedia","addEventListener","DefaultLangProvider","locale","fallbackLocale","getLocale","setLocale","getFallbackLocale","setFallbackLocale","getLocales","translate","translateWithDefault","_","defaultMessage","Service$1","locales","provider","getBrowserLocale","setProvider","parameters","navigator","languages","find","$subscribe","querySelector","setAttribute","removeAttribute","immediate","Lang","bind","logs","startupErrors","hasErrors","hasNewErrors","some","seen","hasStartupErrors","Colors","Primary","Secondary","Danger","Clear","enable","enabled","disable","inspect","reports","isArray","createErrorReport","UI","report","logError","startupError","createStartupErrorReport","log","date","Date","color","actions","text","dismiss","see","seeAll","isObject","Error","createErrorReportFromError","objectWithoutEmpty","description","defaults","details","stack","getErrorMessage","$errors","Errors","setUpErrorHandler","baseHandler","frameworkHandler","onerror","__","___","onunhandledrejection","reason","errors","$lang","lang","$t","$td","import","MODE","testingRuntime","useEvent","unsubscribe","onUnmounted","useInputAttrs","attrs","useAttrs","className","class","objectWithout","renderMarkdown","markdown","html","marked","mangle","headerIds","renderer","Renderer","link","href","prototype","apply","safeHtml","matches","stringMatchAll","action","renderActionLinks","DOMPurify","sanitize","ADD_ATTR","extractComponentProps","definitions","extracted","prop","modalProps","cancellable","inline","useModalProps","useModalExpose","$modal","close","__props","$root","hidden","rootComponent","Dialog","hide","$el","show","__expose","toRef","modalProperties","unref","provide","childIndex","DialogPanel","childModal","DialogTitle","rootProps","as","langKey","langParams","renderedHtml","root","h","innerHTML","onClick","target","isInstanceOf","HTMLElement","dataset","markdownAction","alertModalProps","useAlertModalProps","confirmModalProps","acceptText","acceptColor","cancelText","cancelColor","useConfirmModalProps","useConfirmModal","renderedAcceptText","renderedCancelText","getElement","hasElement","elementRef","customRef","track","trigger","newValue","route","to","params","routeParams","query","routeQuery","submit","colorClasses","join","errorReportModalProps","useErrorReportModalProps","useErrorReportModal","activeReportIndex","previousReportText","nextReportText","summary","githubReportUrl","issueTitle","encodeURIComponent","issueBody","stringExcerpt","buttons","iconComponent","IconCopy","clipboard","writeText","IconConsole","window","reportButtons","IconGitHub","totalReports","currentReport","loadingModalProps","progress","useLoadingModalProps","useLoadingModal","renderedMessage","showProgress","promptModalProps","label","placeholder","usePromptModalProps","usePromptModal","offSubmit","__emit","watchEffect","onCleanup","form","inputProps","modelValue","useInputProps","api","getFieldValue","readonly","getFieldRules","setFieldValue","__setElement","input","onFormFocus","stop","$input","checked","valueAsDate","getValue","slots","useSlots","validators","validate","rule","FormFieldTypes","validForms","Form","fields","_fields","_submitted","_data","getInitialData","_errors","getInitialErrors","valid","submitted","field","definition","rules","split","data","formErrors","getFieldErrors","resetErrors","reset","keepData","resetData","keepErrors","_listeners","isConjuring","formData","useForm","requiredStringInput","draft","SnackbarColors","snackbarProps","useSnackbarProps","useSnackbar","activate","styleClasses","$ui","ui","defaultComponents","AGAlertModal","AGConfirmModal","AGErrorReportModal","AGLoadingModal","AGPromptModal","AGSnackbar","AGStartupCrash","bootstrapApplication","_hoisted_2","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","createElementVNode","createElementBlock","_Fragment","_renderList","renderList","_ctx","_createBlock","_resolveDynamicComponent","_mergeProps","$backdrop","backdropHidden","classList","add","selectProps","noSelectionText","optionsText","selectEmits","useSelectProps","useSelectEmits","renderText","option","selectedOption","buttonText","select","$select","$textArea","measured","cleanup","jobProgress","barClasses","classes","barClass","renderedProgress","onMounted","job","onUpdated","JobCancelledError","Low","Default","High","status","getInitialStatus","ListenersManager","_started","_completed","start","beforeStart","updateProgress","run","toError","realError","cancel","_cancelled","serializeStatus","_progress","cancelled","started","completed","assertNotCancelled","calculateCurrentProgress","children","round","total","child","createApp","$aerogel","mount","_container","getter","asyncValue","Function","cleanUp","noop","toRaw","test","original","replacements"],"mappings":"siEAEqB,MAAAA,yBAAyBC,EAAAA,QAE1CC,WAAAA,CAAYC,EAA0BC,GAClCC,kBAAkBF,oBAAoC,CAAEC,SAC5D,ECFJ,IAAIE,EAAuB,KAE3B,SAASC,IACL,OAAOD,GAAUE,GACrB,UAEgBA,IACZ,OAAOC,EAAGA,IAACC,iBAAgBC,IACvBL,EAASK,EAETC,EAAcA,eAACD,EAAM,GAE7B,UAEgBE,IACZ,OAAOP,GAAUC,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