@aerogel/core 0.0.0-next.f16bd1d894543c5303039c49f6f33488a1ffe931 → 0.0.0-next.f8cdd39997c56dcd46e07c26af8a84d04d610fce
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.
- package/dist/aerogel-core.cjs.js +1 -1
- package/dist/aerogel-core.cjs.js.map +1 -1
- package/dist/aerogel-core.d.ts +53 -29
- package/dist/aerogel-core.esm.js +1 -1
- package/dist/aerogel-core.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/basic/AGErrorMessage.vue +16 -0
- package/src/components/basic/AGLink.vue +9 -0
- package/src/components/basic/AGMarkdown.vue +6 -10
- package/src/components/basic/index.ts +3 -1
- package/src/components/headless/forms/AGHeadlessButton.vue +4 -3
- package/src/components/modals/AGAlertModal.vue +0 -1
- package/src/components/modals/AGErrorReportModalButtons.vue +3 -0
- package/src/components/modals/AGErrorReportModalTitle.vue +1 -1
- package/src/components/snackbars/AGSnackbar.vue +1 -1
- package/src/errors/Errors.ts +27 -5
- package/src/lang/Lang.ts +1 -1
- package/src/services/App.state.ts +2 -2
- package/src/services/App.ts +0 -2
- package/src/services/Service.ts +7 -2
- package/src/services/index.ts +6 -3
- package/src/ui/UI.ts +0 -2
- package/src/utils/markdown.ts +11 -2
package/dist/aerogel-core.d.ts
CHANGED
|
@@ -139,6 +139,24 @@ required: true;
|
|
|
139
139
|
title: string | null;
|
|
140
140
|
}, {}>;
|
|
141
141
|
|
|
142
|
+
export declare const AGErrorMessage: DefineComponent< {
|
|
143
|
+
error: {
|
|
144
|
+
type: PropType<unknown>;
|
|
145
|
+
validator?(value: unknown): boolean;
|
|
146
|
+
} & {
|
|
147
|
+
required: true;
|
|
148
|
+
};
|
|
149
|
+
}, (_ctx: any, _cache: any) => VNode<RendererNode, RendererElement, {
|
|
150
|
+
[key: string]: any;
|
|
151
|
+
}>, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes< {
|
|
152
|
+
error: {
|
|
153
|
+
type: PropType<unknown>;
|
|
154
|
+
validator?(value: unknown): boolean;
|
|
155
|
+
} & {
|
|
156
|
+
required: true;
|
|
157
|
+
};
|
|
158
|
+
}>>, {}, {}>;
|
|
159
|
+
|
|
142
160
|
export declare const AGErrorReportModalButtons: DefineComponent< {
|
|
143
161
|
report: {
|
|
144
162
|
type: PropType<ErrorReport>;
|
|
@@ -225,6 +243,12 @@ form: Form<FormFieldDefinitions> | null;
|
|
|
225
243
|
}, {}>;
|
|
226
244
|
|
|
227
245
|
export declare const AGHeadlessButton: DefineComponent< {
|
|
246
|
+
href: {
|
|
247
|
+
type: PropType<string | null>;
|
|
248
|
+
validator?(value: unknown): boolean;
|
|
249
|
+
} & {
|
|
250
|
+
default: string | (() => string | null) | null;
|
|
251
|
+
};
|
|
228
252
|
url: {
|
|
229
253
|
type: PropType<string | null>;
|
|
230
254
|
validator?(value: unknown): boolean;
|
|
@@ -258,6 +282,12 @@ default: boolean | (() => boolean) | null;
|
|
|
258
282
|
}, (_ctx: any, _cache: any) => VNode<RendererNode, RendererElement, {
|
|
259
283
|
[key: string]: any;
|
|
260
284
|
}>, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes< {
|
|
285
|
+
href: {
|
|
286
|
+
type: PropType<string | null>;
|
|
287
|
+
validator?(value: unknown): boolean;
|
|
288
|
+
} & {
|
|
289
|
+
default: string | (() => string | null) | null;
|
|
290
|
+
};
|
|
261
291
|
url: {
|
|
262
292
|
type: PropType<string | null>;
|
|
263
293
|
validator?(value: unknown): boolean;
|
|
@@ -289,6 +319,7 @@ validator?(value: unknown): boolean;
|
|
|
289
319
|
default: boolean | (() => boolean) | null;
|
|
290
320
|
};
|
|
291
321
|
}>>, {
|
|
322
|
+
href: string | null;
|
|
292
323
|
url: string | null;
|
|
293
324
|
route: string | null;
|
|
294
325
|
routeParams: {};
|
|
@@ -440,6 +471,10 @@ default: string | (() => string | null) | null;
|
|
|
440
471
|
name: string | null;
|
|
441
472
|
}, {}>;
|
|
442
473
|
|
|
474
|
+
export declare const AGLink: DefineComponent< {}, (_ctx: any, _cache: any) => VNode<RendererNode, RendererElement, {
|
|
475
|
+
[key: string]: any;
|
|
476
|
+
}>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes< {}>>, {}, {}>;
|
|
477
|
+
|
|
443
478
|
export declare const AGLoadingModal: DefineComponent< {
|
|
444
479
|
message: {
|
|
445
480
|
type: PropType<string | null>;
|
|
@@ -462,16 +497,10 @@ message: string | null;
|
|
|
462
497
|
|
|
463
498
|
export declare const AGMarkdown: DefineComponent< {
|
|
464
499
|
as: {
|
|
465
|
-
type: PropType<string>;
|
|
466
|
-
validator?(value: unknown): boolean;
|
|
467
|
-
} & {
|
|
468
|
-
default: string | (() => string) | null;
|
|
469
|
-
};
|
|
470
|
-
heading: {
|
|
471
|
-
type: PropType<boolean>;
|
|
500
|
+
type: PropType<string | null>;
|
|
472
501
|
validator?(value: unknown): boolean;
|
|
473
502
|
} & {
|
|
474
|
-
default:
|
|
503
|
+
default: string | (() => string | null) | null;
|
|
475
504
|
};
|
|
476
505
|
inline: {
|
|
477
506
|
type: PropType<boolean>;
|
|
@@ -485,11 +514,11 @@ validator?(value: unknown): boolean;
|
|
|
485
514
|
} & {
|
|
486
515
|
default: string | (() => string | null) | null;
|
|
487
516
|
};
|
|
488
|
-
|
|
489
|
-
type: PropType<
|
|
517
|
+
langParams: {
|
|
518
|
+
type: PropType<Record<string, unknown> | null>;
|
|
490
519
|
validator?(value: unknown): boolean;
|
|
491
520
|
} & {
|
|
492
|
-
default:
|
|
521
|
+
default: Record<string, unknown> | (() => Record<string, unknown> | null) | null;
|
|
493
522
|
};
|
|
494
523
|
text: {
|
|
495
524
|
type: PropType<string | null>;
|
|
@@ -501,16 +530,10 @@ default: string | (() => string | null) | null;
|
|
|
501
530
|
[key: string]: any;
|
|
502
531
|
}>, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes< {
|
|
503
532
|
as: {
|
|
504
|
-
type: PropType<string>;
|
|
505
|
-
validator?(value: unknown): boolean;
|
|
506
|
-
} & {
|
|
507
|
-
default: string | (() => string) | null;
|
|
508
|
-
};
|
|
509
|
-
heading: {
|
|
510
|
-
type: PropType<boolean>;
|
|
533
|
+
type: PropType<string | null>;
|
|
511
534
|
validator?(value: unknown): boolean;
|
|
512
535
|
} & {
|
|
513
|
-
default:
|
|
536
|
+
default: string | (() => string | null) | null;
|
|
514
537
|
};
|
|
515
538
|
inline: {
|
|
516
539
|
type: PropType<boolean>;
|
|
@@ -524,11 +547,11 @@ validator?(value: unknown): boolean;
|
|
|
524
547
|
} & {
|
|
525
548
|
default: string | (() => string | null) | null;
|
|
526
549
|
};
|
|
527
|
-
|
|
528
|
-
type: PropType<
|
|
550
|
+
langParams: {
|
|
551
|
+
type: PropType<Record<string, unknown> | null>;
|
|
529
552
|
validator?(value: unknown): boolean;
|
|
530
553
|
} & {
|
|
531
|
-
default:
|
|
554
|
+
default: Record<string, unknown> | (() => Record<string, unknown> | null) | null;
|
|
532
555
|
};
|
|
533
556
|
text: {
|
|
534
557
|
type: PropType<string | null>;
|
|
@@ -537,11 +560,10 @@ validator?(value: unknown): boolean;
|
|
|
537
560
|
default: string | (() => string | null) | null;
|
|
538
561
|
};
|
|
539
562
|
}>>, {
|
|
540
|
-
as: string;
|
|
541
|
-
heading: boolean;
|
|
563
|
+
as: string | null;
|
|
542
564
|
inline: boolean;
|
|
543
565
|
langKey: string | null;
|
|
544
|
-
|
|
566
|
+
langParams: Record<string, unknown> | null;
|
|
545
567
|
text: string | null;
|
|
546
568
|
}, {}>;
|
|
547
569
|
|
|
@@ -716,15 +738,15 @@ environment: "production" | "development" | "testing";
|
|
|
716
738
|
sourceUrl: string | undefined;
|
|
717
739
|
isMounted: boolean;
|
|
718
740
|
}> & Constructor< {
|
|
719
|
-
|
|
720
|
-
|
|
741
|
+
development: boolean;
|
|
742
|
+
testing: boolean;
|
|
721
743
|
}> & Constructor<Service< {
|
|
722
744
|
environment: "production" | "development" | "testing";
|
|
723
745
|
sourceUrl: string | undefined;
|
|
724
746
|
isMounted: boolean;
|
|
725
747
|
}, {
|
|
726
|
-
|
|
727
|
-
|
|
748
|
+
development: boolean;
|
|
749
|
+
testing: boolean;
|
|
728
750
|
}, Partial<{
|
|
729
751
|
environment: "production" | "development" | "testing";
|
|
730
752
|
sourceUrl: string | undefined;
|
|
@@ -802,6 +824,7 @@ declare class ErrorsService extends _default {
|
|
|
802
824
|
report(error: ErrorSource, message?: string): Promise<void>;
|
|
803
825
|
see(report: ErrorReport): void;
|
|
804
826
|
seeAll(): void;
|
|
827
|
+
getErrorMessage(error: ErrorSource): string;
|
|
805
828
|
private logError;
|
|
806
829
|
private createErrorReport;
|
|
807
830
|
private createStartupErrorReport;
|
|
@@ -1028,6 +1051,7 @@ export declare class Service<State extends ServiceState = DefaultServiceState, C
|
|
|
1028
1051
|
protected getInitialState(): State;
|
|
1029
1052
|
protected getComputedStateDefinition(): ComputedStateDefinition<State, ComputedState>;
|
|
1030
1053
|
protected serializePersistedState(state: Partial<State>): Partial<State>;
|
|
1054
|
+
protected frameworkBoot(): Promise<void>;
|
|
1031
1055
|
protected boot(): Promise<void>;
|
|
1032
1056
|
protected restorePersistedState(): void;
|
|
1033
1057
|
}
|
package/dist/aerogel-core.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"core-js/modules/esnext.async-iterator.map.js";import"core-js/modules/esnext.iterator.map.js";import{ref as e,inject as t,reactive as r,markRaw as s,nextTick as o,onUnmounted as n,useAttrs as a,computed as l,onMounted as i,defineComponent as u,toRef as c,openBlock as d,createBlock as p,unref as m,withCtx as f,renderSlot as h,provide as v,resolveDynamicComponent as g,normalizeProps as _,guardReactiveProps as b,createElementBlock as y,Fragment as x,createVNode as w,createCommentVNode as A,createElementVNode as k,h as j,normalizeClass as S,createTextVNode as G,toDisplayString as M,renderList as C,mergeProps as $,readonly as E,createApp as H,withModifiers as I}from"vue";import{fail as R,JSError as L,MagicObject as P,PromisedValue as B,objectOnly as O,isEmpty as D,Storage as q,objectDeepClone as T,facade as z,arr as V,tap as F,uuid as N,toString as U,isObject as K,objectWithoutEmpty as Q,objectWithout as W,noop as Z,stringExcerpt as Y}from"@noeldemartin/utils";import J from"@babel/runtime/helpers/esm/defineProperty";import"core-js/modules/esnext.set.add-all.js";import"core-js/modules/esnext.set.delete-all.js";import"core-js/modules/esnext.set.difference.js";import"core-js/modules/esnext.set.every.js";import"core-js/modules/esnext.set.filter.js";import"core-js/modules/esnext.set.find.js";import"core-js/modules/esnext.set.intersection.js";import"core-js/modules/esnext.set.is-disjoint-from.js";import"core-js/modules/esnext.set.is-subset-of.js";import"core-js/modules/esnext.set.is-superset-of.js";import"core-js/modules/esnext.set.join.js";import"core-js/modules/esnext.set.map.js";import"core-js/modules/esnext.set.reduce.js";import"core-js/modules/esnext.set.some.js";import"core-js/modules/esnext.set.symmetric-difference.js";import"core-js/modules/esnext.set.union.js";import{defineStore as X,createPinia as ee,setActivePinia as te}from"pinia";import re from"virtual:aerogel";import"core-js/modules/esnext.async-iterator.filter.js";import"core-js/modules/esnext.iterator.constructor.js";import"core-js/modules/esnext.iterator.filter.js";import"core-js/modules/esnext.string.at.js";import"core-js/modules/esnext.async-iterator.reduce.js";import"core-js/modules/esnext.iterator.reduce.js";import"core-js/modules/esnext.async-iterator.some.js";import"core-js/modules/esnext.iterator.some.js";import"core-js/modules/esnext.async-iterator.for-each.js";import"core-js/modules/esnext.iterator.for-each.js";import{Dialog as se,DialogPanel as oe,DialogTitle as ne}from"@headlessui/vue";import ae from"dompurify";import{marked as le}from"marked";function ie(e){return e}function ue(e){return{type:Array,default:e??(()=>[])}}function ce(){return{type:Boolean,default:arguments.length>0&&void 0!==arguments[0]&&arguments[0]}}function de(){return e()}function pe(e){return e}function me(e,t){const r=Object.values(e);return{type:String,default:t??r[0]??null,validator:e=>r.includes(e)}}function fe(e){const s=t(e);return s?r(s):void 0}function he(e,t){return fe(e)??R(t??`Could not resolve '${e}' injection key`)}function ve(e,r){return t(e)??R(r??`Could not resolve '${e}' injection key`)}function ge(e){return{type:e,default:null}}function _e(){return{type:Number,default:arguments.length>0&&void 0!==arguments[0]?arguments[0]:null}}function be(){return{type:Object,default:arguments.length>0&&void 0!==arguments[0]?arguments[0]:null}}function ye(){return{type:Array,required:!0}}function xe(e){const t=Object.values(e);return{type:String,required:!0,validator:e=>t.includes(e)}}function we(e){return{type:e,required:!0}}function Ae(){return{type:Number,required:!0}}function ke(){return{type:Object,required:!0}}function je(){return{type:String,required:!0}}function Se(){return{type:String,default:arguments.length>0&&void 0!==arguments[0]?arguments[0]:null}}const Ge={"initial-focus":{mounted(e,t){let{value:r}=t;!1!==r&&e.focus()}}};var Me={install(e,t){const r={...Ge,...t.directives};for(const[t,s]of Object.entries(r))e.directive(t,s)}};class ServiceBootError extends L{constructor(e,t){super(`Service '${e}' failed booting`,{cause:t})}}let Ce=null;function $e(){return Ce||(Ce=ee(),te(Ce)),Ce}function Ee(e){var t;return J(t=class extends He{usesStore(){return!0}getName(){return e.name??null}getInitialState(){return e.initialState}getComputedStateDefinition(){return e.computed??{}}serializePersistedState(t){return e.serialize?.(t)??t}},"persist",e.persist??[]),t}class He extends P{constructor(){super(),J(this,"_name",void 0),J(this,"_booted",void 0),J(this,"_computedStateKeys",void 0),J(this,"_store",void 0);const e=this.getComputedStateDefinition();var t,r;this._name=this.getName()??new.target.name,this._booted=new B,this._computedStateKeys=new Set(Object.keys(e)),this._store=this.usesStore()&&(t=this._name,r={state:()=>this.getInitialState(),getters:e},$e(),X(t,r)())}get booted(){return this._booted}launch(){const handleError=e=>this._booted.reject(new ServiceBootError(this._name,e));try{this.boot().then((()=>this._booted.resolve())).catch(handleError)}catch(e){handleError(e)}return this._booted}hasState(e){return!!this._store&&(e in this._store.$state||this._computedStateKeys.has(e))}getState(e){const t=this._store;return e?t?t[e]:void 0:t||{}}setState(e,t){if(!this._store)return;const r="string"==typeof e?{[e]:t}:e;Object.assign(this._store.$state,r),this.onStateUpdated(r)}__get(e){return this.hasState(e)?this.getState(e):super.__get(e)}__set(e,t){this.setState({[e]:t})}onStateUpdated(e){const t=this.constructor.persist,r=O(e,t);if(D(r))return;const s=q.require(this._name);q.set(this._name,{...s,...this.serializePersistedState(T(r))})}usesStore(){return!1}getName(){return null}getInitialState(){return{}}getComputedStateDefinition(){return{}}serializePersistedState(e){return e}async boot(){this.restorePersistedState()}restorePersistedState(){const e=this.constructor.persist;if(this.usesStore()&&!D(e))if(q.has(this._name)){const e=q.require(this._name);this.setState(e)}else q.set(this._name,O(this.getState(),e))}}J(He,"persist",[]);class Ie extends He{constructor(){super(...arguments),J(this,"listeners",{})}async emit(e,t){const r=[...this.listeners[e]??[]];await Promise.all(r.map((e=>e(t)))??[])}on(e,t){return(this.listeners[e]??=V([])).push(t),()=>this.off(e,t)}once(e,t){let r=null;return F((()=>r&&this.off(e,r)),(s=>{(this.listeners[e]??=V([])).push(r=function(){return s(),t(...arguments)})}))}off(e,t){const r=this.listeners[e];r&&(r.remove(t),r.isEmpty()&&delete this.listeners[e])}}var Re=z(new Ie),Le=Ee({name:"app",initialState:{environment:re.environment,sourceUrl:re.sourceUrl,isMounted:!1},computed:{isDevelopment:e=>"development"===e.environment,isTesting:e=>"testing"===e.environment}});class Pe extends Le{async boot(){await super.boot(),Re.once("application-mounted",(()=>this.setState({isMounted:!0})))}}var Be=z(new Pe);const Oe={$app:Be,$events:Re};async function De(e,t){await Promise.all(Object.entries(t).map((async e=>{let[t,r]=e;await r.launch().catch((e=>console.error(e)))}))),Object.assign(e.config.globalProperties,t)}var qe={async install(e,t){const r={...Oe,...t.services};e.use(Ce??$e()),await De(e,r)}},Te=Ee({name:"ui",initialState:{modals:[],snackbars:[]}});const ze={AlertModal:"alert-modal",ConfirmModal:"confirm-modal",ErrorReportModal:"error-report-modal",LoadingModal:"loading-modal",Snackbar:"snackbar"};var Ve=z(new class extends Te{constructor(){super(...arguments),J(this,"modalCallbacks",{}),J(this,"components",{})}requireComponent(e){return this.components[e]??R(`UI Component '${e}' is not defined!`)}alert(e,t){const r="string"==typeof t?{title:e,message:t}:{message:e};this.openModal(this.requireComponent(ze.AlertModal),r)}async confirm(e,t){const r="string"==typeof t?{title:e,message:t}:{message:e},s=await this.openModal(this.requireComponent(ze.ConfirmModal),r);return await s.beforeClose??!1}async loading(e,t){t="string"==typeof e?t:e;const r="string"==typeof e?e:void 0,s=await this.openModal(this.requireComponent(ze.LoadingModal),{message:r}),o=await t;return await this.closeModal(s.id),o}showSnackbar(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r={id:N(),properties:{message:e,...t},component:t.component??s(this.requireComponent(ze.Snackbar))};this.setState("snackbars",this.snackbars.concat(r)),setTimeout((()=>this.hideSnackbar(r.id)),5e3)}hideSnackbar(e){this.setState("snackbars",this.snackbars.filter((t=>t.id!==e)))}registerComponent(e,t){this.components[e]=t}async openModal(e,t){const r=N(),n={},a={id:r,properties:t??{},component:s(e),beforeClose:new Promise((e=>n.willClose=e)),afterClose:new Promise((e=>n.closed=e))},l=this.modals.at(-1),i=this.modals.concat(a);return this.modalCallbacks[a.id]=n,this.setState({modals:i}),await o(),await(l&&Re.emit("hide-modal",{id:l.id})),await Promise.all([l||Re.emit("show-overlays-backdrop"),Re.emit("show-modal",{id:a.id})]),a}async closeModal(e,t){await Re.emit("close-modal",{id:e,result:t})}async boot(){await super.boot(),this.watchModalEvents()}watchModalEvents(){Re.on("modal-will-close",(e=>{let{modal:t,result:r}=e;this.modalCallbacks[t.id]?.willClose?.(r),1===this.modals.length&&Re.emit("hide-overlays-backdrop")})),Re.on("modal-closed",(async e=>{let{modal:t,result:r}=e;this.setState("modals",this.modals.filter((e=>e.id!==t.id))),this.modalCallbacks[t.id]?.closed?.(r),delete this.modalCallbacks[t.id];const s=this.modals.at(-1);await(s&&Re.emit("show-modal",{id:s.id}))}))}});var Fe=z(new class extends He{constructor(){super(),J(this,"provider",void 0),this.provider={translate:e=>(Be.isDevelopment&&console.warn("Lang provider is missing"),e)}}setProvider(e){this.provider=e}translate(e,t){return this.provider.translate(e,t)??e}translateWithDefault(e,t,r){r??=t;const s="string"==typeof t?{}:t??{},o=this.provider.translate(e,s)??e;return o===e?Object.entries(s).reduce(((e,t)=>{let[r,s]=t;return e.replace(new RegExp(`\\{\\s*${r}\\s*\\}`,"g"),U(s))}),r):o}});const Ne=Fe.translate.bind(Fe),Ue=Fe.translateWithDefault.bind(Fe);var Ke=Ee({name:"errors",initialState:{logs:[],startupErrors:[]},computed:{hasErrors:e=>{let{logs:t}=e;return t.length>0},hasNewErrors:e=>{let{logs:t}=e;return t.some((e=>!e.seen))},hasStartupErrors:e=>{let{startupErrors:t}=e;return t.length>0}}});const Qe={Primary:"primary",Secondary:"secondary",Danger:"danger",Clear:"clear"};var We=z(new class extends Ke{constructor(){super(...arguments),J(this,"forceReporting",!1),J(this,"enabled",!0)}enable(){this.enabled=!0}disable(){this.enabled=!1}async inspect(e){const t=Array.isArray(e)?e:[await this.createErrorReport(e)];0!==t.length?Ve.openModal(Ve.requireComponent(ze.ErrorReportModal),{reports:t}):Ve.alert(Ue("errors.inspectEmpty","Nothing to inspect!"))}async report(e,t){if((Be.isDevelopment||Be.isTesting)&&this.logError(e),!this.enabled)throw e;if(!Be.isMounted){const t=await this.createStartupErrorReport(e);return void(t&&this.setState({startupErrors:this.startupErrors.concat(t)}))}const r=await this.createErrorReport(e),s={report:r,seen:!1,date:new Date};Ve.showSnackbar(t??Ue("errors.notice","Something went wrong, but it's not your fault. Try again!"),{color:Qe.Danger,actions:[{text:Ue("errors.viewDetails","View details"),dismiss:!0,handler:()=>Ve.openModal(Ve.requireComponent(ze.ErrorReportModal),{reports:[r]})}]}),this.setState({logs:[s].concat(this.logs)})}see(e){this.setState({logs:this.logs.map((t=>t.report!==e?t:{...t,seen:!0}))})}seeAll(){this.setState({logs:this.logs.map((e=>({...e,seen:!0})))})}logError(e){console.error(e),K(e)&&e.cause&&this.logError(e.cause)}async createErrorReport(e){return"string"==typeof e?{title:e}:e instanceof Error||e instanceof L?this.createErrorReportFromError(e):K(e)?Q({title:U(e.name??e.title??Ne("errors.unknown")),description:U(e.message??e.description??""),error:e}):{title:Ne("errors.unknown"),error:e}}async createStartupErrorReport(e){return e instanceof ServiceBootError?e.cause instanceof ServiceBootError?null:this.createErrorReport(e.cause):this.createErrorReport(e)}createErrorReportFromError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{title:e.name,description:e.message,details:e.stack,error:e,...t}}});const Ze={$errors:We};function Ye(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>!1;return F((t=>e(t)||(e=>We.instance?(We.report(e),!0):(console.warn("Errors service hasn't been initialized properly!"),console.error(e),!0))(t)),(e=>{globalThis.onerror=(t,r,s,o,n)=>e(n??t),globalThis.onunhandledrejection=t=>e(t.reason)}))}var Je={async install(e,t){const r=Ye(t.handleError);e.config.errorHandler=r,await De(e,Ze)}};const Xe={$lang:Fe};var et={async install(e){e.config.globalProperties.$t??=Ne,e.config.globalProperties.$td=Ue,await De(e,Xe)}};function tt(e,t){const r=Re.on(e,t);n((()=>r()))}function rt(){const e=a(),t=l((()=>e.class));return[l((()=>W(e,"class"))),t]}function st(e){let t=Z;i((()=>t=e())),n((()=>t()))}var ot=u({__name:"AGHeadlessModal",props:{cancellable:ce(!0)},setup(t,{expose:r}){const s=t,o=e(null),n=e(!0),a=e(!1),{modal:l}=he("modal","could not obtain modal reference from <AGHeadlessModal>, did you render this component manually? Show it using $ui.openModal() instead");async function i(){o.value?.$el&&(n.value=!0)}async function u(e){a.value||(Re.emit("modal-will-close",{modal:l,result:e}),await i(),a.value=!0,Re.emit("modal-closed",{modal:l,result:e}))}return tt("close-modal",(async({id:e,result:t})=>{e===l.id&&await u(t)})),tt("hide-modal",(async({id:e})=>{e===l.id&&await i()})),tt("show-modal",(async({id:e})=>{e===l.id&&await async function(){o.value?.$el&&(n.value=!1)}()})),r({close:u,cancellable:c(s,"cancellable")}),(e,r)=>(d(),p(m(se),{ref_key:"$root",ref:o,open:!0,onClose:r[0]||(r[0]=e=>t.cancellable&&u())},{default:f((()=>[h(e.$slots,"default",{close:u})])),_:3},512))}});ot.__file="src/components/headless/modals/AGHeadlessModal.vue";var nt=u({__name:"AGModalContext",props:{modal:ke(),childIndex:Ae()},setup(e){const t=e;return v("modal",{modal:c(t,"modal"),childIndex:c(t,"childIndex")}),(t,r)=>(d(),p(g(e.modal.component),_(b(e.modal.properties)),null,16))}});nt.__file="src/components/modals/AGModalContext.vue";const at=k("div",{class:"pointer-events-none fixed inset-0 z-50 bg-black/30"},null,-1);var lt=u({__name:"AGHeadlessModalPanel",setup(e){const t=he("modal","could not obtain modal reference from <AGHeadlessModalPanel>, did you render this component manually? Show it using $ui.openModal() instead"),r=l((()=>Ve.modals[t.childIndex]??null));return(e,s)=>(d(),p(m(oe),null,{default:f((()=>[h(e.$slots,"default"),r.value?(d(),y(x,{key:0},[at,w(nt,{"child-index":m(t).childIndex+1,modal:r.value},null,8,["child-index","modal"])],64)):A("v-if",!0)])),_:3}))}});lt.__file="src/components/headless/modals/AGHeadlessModalPanel.vue";const it={class:"fixed inset-0 flex items-center justify-center p-8"},ut={class:"flex max-h-full flex-col overflow-auto p-4"};var ct=u({__name:"AGModal",props:{cancellable:ce(!0)},setup(t,{expose:r}){const s=e();return r({close:async()=>s.value?.close(),cancellable:l((()=>!!s.value?.cancellable))}),(e,r)=>(d(),p(ot,{ref_key:"$headlessModal",ref:s,cancellable:t.cancellable,class:"relative z-50"},{default:f((({close:t})=>[k("div",it,[w(lt,{class:"flex max-h-full max-w-full flex-col overflow-hidden bg-white"},{default:f((()=>[k("div",ut,[h(e.$slots,"default",{close:t})])])),_:2},1024)])])),_:3},8,["cancellable"]))}});function dt(e){return t=le(e,{mangle:!1,headerIds:!1}),ae.sanitize(t,{ADD_ATTR:["target"]});var t}ct.__file="src/components/modals/AGModal.vue";var pt=u({__name:"AGMarkdown",props:{as:Se("div"),heading:ce(),inline:ce(),langKey:Se(),raw:ce(),text:Se()},setup(e){const t=e,r=l((()=>t.text??(t.langKey&&Ne(t.langKey)))),s=l((()=>{if(!r.value)return null;let e=dt(r.value);return t.heading&&(e=e.replace("<p>","<span>").replace("</p>","</span>")),t.inline&&(e=e.replace("<p>","<span>").replace("</p>","</span>")),e})),o=()=>j(t.as,{class:t.raw?"":"prose",innerHTML:s.value});return(e,t)=>(d(),p(o))}});pt.__file="src/components/basic/AGMarkdown.vue";var mt=u({__name:"AGAlertModal",props:{title:Se(),message:je()},setup:e=>(t,r)=>(d(),p(ct,null,{default:f((()=>[e.title?(d(),p(pt,{key:0,text:e.title,as:"h2",class:"font-semibold",raw:"",inline:""},null,8,["text"])):A("v-if",!0),w(pt,{text:e.message},null,8,["text"])])),_:1}))});mt.__file="src/components/modals/AGAlertModal.vue";var ft=u({__name:"AGHeadlessButton",props:{url:Se(),route:Se(),routeParams:be((()=>({}))),routeQuery:be((()=>({}))),submit:ce()},setup(e){const{url:t,route:r,routeParams:s,routeQuery:o,submit:n}=e,a=l((()=>r?{tag:"router-link",props:{to:Q({name:r,params:s,query:o})}}:t?{tag:"a",props:{target:"_blank",href:t}}:{tag:"button",props:{type:n?"submit":"button"}}));return(e,t)=>(d(),p(g(a.value.tag),_(b(a.value.props)),{default:f((()=>[h(e.$slots,"default")])),_:3},16))}});ft.__file="src/components/headless/forms/AGHeadlessButton.vue";var ht=u({__name:"AGButton",props:{color:me(Qe,Qe.Primary)},setup(e){const t=e,r=l((()=>{switch(t.color){case Qe.Secondary:return["text-white bg-gray-600","hover:bg-gray-500","focus-visible:outline-offset-2 focus-visible:outline-gray-600"].join(" ");case Qe.Clear:return"hover:bg-gray-500/20 focus-visible:outline-gray-500/60";case Qe.Danger:return["text-white bg-red-600","hover:bg-red-500","focus-visible:outline-offset-2 focus-visible:outline-red-600"].join(" ");default:return["text-white bg-indigo-600","hover:bg-indigo-500","focus-visible:outline-offset-2 focus-visible:outline-indigo-600"].join(" ")}}));return(e,t)=>(d(),p(ft,{class:S(["px-2.5 py-1.5 focus-visible:outline focus-visible:outline-2",r.value])},{default:f((()=>[h(e.$slots,"default")])),_:3},8,["class"]))}});ht.__file="src/components/forms/AGButton.vue";const vt={class:"mt-2 flex flex-row-reverse gap-2"};var gt=u({__name:"AGConfirmModal",props:{title:Se(),message:je()},setup:e=>(t,r)=>(d(),p(ct,{cancellable:!1},{default:f((({close:r})=>[e.title?(d(),p(pt,{key:0,text:e.title,as:"h1"},null,8,["text"])):A("v-if",!0),w(pt,{text:e.message},null,8,["text"]),k("div",vt,[w(ht,{onClick:e=>r(!0)},{default:f((()=>[G(M(t.$td("ui.ok","OK")),1)])),_:2},1032,["onClick"]),w(ht,{color:"secondary",onClick:e=>r()},{default:f((()=>[G(M(t.$td("ui.cancel","Cancel")),1)])),_:2},1032,["onClick"])])])),_:1}))});gt.__file="src/components/modals/AGConfirmModal.vue";const _t={viewBox:"0 0 20 20",width:"1.2em",height:"1.2em"},bt=[k("path",{fill:"currentColor",d:"m12.95 10.707l.707-.707L8 4.343L6.586 5.757L10.828 10l-4.242 4.243L8 15.657l4.95-4.95z"},null,-1)];var yt={name:"zondicons-cheveron-right",render:function(e,t){return d(),y("svg",_t,bt)}};const xt={viewBox:"0 0 20 20",width:"1.2em",height:"1.2em"},wt=[k("path",{fill:"currentColor",d:"M7.05 9.293L6.343 10L12 15.657l1.414-1.414L9.172 10l4.242-4.243L12 4.343z"},null,-1)];var At={name:"zondicons-cheveron-left",render:function(e,t){return d(),y("svg",xt,wt)}};const kt={reports:ye()};function jt(){return kt}const St={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"},Gt=[k("path",{fill:"currentColor",d:"M20 19V7H4v12h16m0-16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16m-7 14v-2h5v2h-5m-3.42-4L5.57 9H8.4l3.3 3.3c.39.39.39 1.03 0 1.42L8.42 17H5.59l3.99-4Z"},null,-1)];var Mt={name:"mdi-console",render:function(e,t){return d(),y("svg",St,Gt)}};const Ct={viewBox:"0 0 20 20",width:"1.2em",height:"1.2em"},$t=[k("path",{fill:"currentColor",d:"M6 6V2c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-4v4a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8c0-1.1.9-2 2-2h4zm2 0h4a2 2 0 0 1 2 2v4h4V2H8v4zM2 8v10h10V8H2z"},null,-1)];var Et={name:"zondicons-copy",render:function(e,t){return d(),y("svg",Ct,$t)}};const Ht={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"},It=[k("path",{fill:"currentColor",d:"M12 2A10 10 0 0 0 2 12c0 4.42 2.87 8.17 6.84 9.5c.5.08.66-.23.66-.5v-1.69c-2.77.6-3.36-1.34-3.36-1.34c-.46-1.16-1.11-1.47-1.11-1.47c-.91-.62.07-.6.07-.6c1 .07 1.53 1.03 1.53 1.03c.87 1.52 2.34 1.07 2.91.83c.09-.65.35-1.09.63-1.34c-2.22-.25-4.55-1.11-4.55-4.92c0-1.11.38-2 1.03-2.71c-.1-.25-.45-1.29.1-2.64c0 0 .84-.27 2.75 1.02c.79-.22 1.65-.33 2.5-.33c.85 0 1.71.11 2.5.33c1.91-1.29 2.75-1.02 2.75-1.02c.55 1.35.2 2.39.1 2.64c.65.71 1.03 1.6 1.03 2.71c0 3.82-2.34 4.66-4.57 4.91c.36.31.69.92.69 1.85V21c0 .27.16.59.67.5C19.14 20.16 22 16.42 22 12A10 10 0 0 0 12 2Z"},null,-1)];var Rt={name:"mdi-github",render:function(e,t){return d(),y("svg",Ht,It)}};const Lt={class:"flex"};var Pt=u({__name:"AGErrorReportModalButtons",props:{report:ke()},setup(e){const t=e,r=l((()=>t.report.description?`${t.report.title}: ${t.report.description}`:t.report.title)),s=l((()=>{if(!Be.sourceUrl)return!1;const e=encodeURIComponent(r.value),s=encodeURIComponent(["[Please, explain here what you were trying to do when this error appeared]","","Error details:","```",Y(t.report.details??"Details missing from report",1800-e.length-Be.sourceUrl.length).trim(),"```"].join("\n"));return`${Be.sourceUrl}/issues/new?title=${e}&body=${s}`})),o=l((()=>F([{id:"clipboard",description:"Copy to clipboard",iconComponent:Et,async handler(){await navigator.clipboard.writeText(`${r.value}\n\n${t.report.details}`),Ve.showSnackbar(Ue("errors.copiedToClipboard","Debug information copied to clipboard"))}},{id:"console",description:"Log to console",iconComponent:Mt,handler(){window.error=t.report.error,Ve.showSnackbar(Ue("errors.addedToConsole","You can now use the **error** variable in the console"))}}],(e=>{s.value&&e.push({id:"github",description:"Report in GitHub",iconComponent:Rt,url:s.value})}))));return(e,t)=>(d(),y("div",Lt,[(d(!0),y(x,null,C(o.value,((t,r)=>h(e.$slots,"default",$(t,{key:r}),(()=>[w(ht,{color:"clear",url:t.url,title:e.$td(`errors.report_${t.id}`,t.description),"aria-label":e.$td(`errors.report_${t.id}`,t.description),onClick:t.handler},{default:f((()=>[(d(),p(g(t.iconComponent),{class:"h-4 w-4","aria-hidden":"true"}))])),_:2},1032,["url","title","aria-label","onClick"])])))),128))]))}});Pt.__file="src/components/modals/AGErrorReportModalButtons.vue";var Bt=u({__name:"AGErrorReportModalTitle",props:{report:ke(),currentReport:_e(),totalReports:_e()},setup(e){const t=e,r=l((()=>!t.totalReports||t.totalReports<=1?t.report.title:`${t.report.title} (${t.currentReport}/${t.totalReports})`));return(e,t)=>(d(),p(pt,{text:r.value,heading:""},null,8,["text"]))}});Bt.__file="src/components/modals/AGErrorReportModalTitle.vue";const Ot={class:"flex items-center justify-between text-lg font-medium"},Dt={class:"flex items-center"},qt=["textContent"];var Tt=u({__name:"AGErrorReportModal",props:jt(),setup(t){const r=t,s=e(0),o=l((()=>r.reports[s.value]));return(e,t)=>(d(),p(ct,null,{default:f((()=>[k("div",null,[k("h2",Ot,[k("div",Dt,[w(Bt,{report:o.value,"current-report":s.value+1,"total-reports":e.reports.length},null,8,["report","current-report","total-reports"]),e.reports.length>1?(d(),y(x,{key:0},[w(ht,{color:"clear",disabled:0===s.value,title:e.$td("errors.previousReport","Show previous report"),"aria-label":e.$td("errors.previousReport","Show previous report"),onClick:t[0]||(t[0]=e=>s.value--)},{default:f((()=>[w(m(At),{"aria-hidden":"true",class:"h-4 w-4"})])),_:1},8,["disabled","title","aria-label"]),w(ht,{color:"clear",disabled:s.value===e.reports.length-1,title:e.$td("errors.nextReport","Show next report"),"aria-label":e.$td("errors.nextReport","Show next report"),onClick:t[1]||(t[1]=e=>s.value++)},{default:f((()=>[w(m(yt),{"aria-hidden":"true",class:"h-4 w-4"})])),_:1},8,["disabled","title","aria-label"])],64)):A("v-if",!0)]),w(Pt,{report:o.value},null,8,["report"])]),o.value.description?(d(),p(pt,{key:0,text:o.value.description,class:"mt-2"},null,8,["text"])):A("v-if",!0)]),k("pre",{class:"h-full overflow-auto bg-gray-200 p-4 text-xs text-red-900",textContent:M(o.value.details??e.$td("errors.detailsEmpty","This error is missing a stacktrace."))},null,8,qt)])),_:1}))}});Tt.__file="src/components/modals/AGErrorReportModal.vue";var zt=u({__name:"AGLoadingModal",props:{message:Se()},setup(e){const t=e,r=l((()=>t.message??Ue("ui.loading","Loading...")));return(e,t)=>(d(),p(ct,{cancellable:!1},{default:f((()=>[w(pt,{text:r.value},null,8,["text"])])),_:1}))}});zt.__file="src/components/modals/AGLoadingModal.vue";var Vt=u({__name:"AGHeadlessInput",props:{as:Se("div"),name:Se(),modelValue:ge([String,Number,Boolean])},emits:["update:modelValue"],setup(e,{expose:r,emit:s}){const o=e,n=l((()=>a&&o.name?a.errors[o.name]??null:null)),a=t("form",null),i={id:`input-${N()}`,value:l((()=>a&&o.name?a.getFieldValue(o.name):o.modelValue)),errors:E(n),update(e){a&&o.name?a.setFieldValue(o.name,e):s("update:modelValue",e)}};return v("input",i),r(i),(t,r)=>e.as?(d(),p(g(e.as),{key:0},{default:f((()=>[h(t.$slots,"default")])),_:3})):h(t.$slots,"default",{key:1})}});Vt.__file="src/components/headless/forms/AGHeadlessInput.vue";const Ft=["id"];var Nt=u({__name:"AGHeadlessInputError",setup(e){const t=he("input","<AGHeadlessInputError> must be a child of a <AGHeadlessInput>"),r=l((()=>t.errors?Ue(`errors.${t.errors[0]}`,`Error: ${t.errors[0]}`):null));return(e,s)=>r.value?(d(),y("p",{key:0,id:`${m(t).id}-error`},M(r.value),9,Ft)):A("v-if",!0)}});Nt.__file="src/components/headless/forms/AGHeadlessInputError.vue";const Ut=["id","type","value","aria-invalid","aria-describedby","checked"];var Kt=u({__name:"AGHeadlessInputInput",props:{type:Se("text")},setup(t){const r=t,s=e(),o=he("input","<AGHeadlessInputInput> must be a child of a <AGHeadlessInput>"),n=l((()=>o.value)),a=l((()=>{if("checkbox"===r.type)return!!n.value}));function i(){s.value&&o.update("checkbox"===r.type?s.value.checked:s.value.value)}return(e,r)=>(d(),y("input",{id:m(o).id,ref_key:"$input",ref:s,type:t.type,value:n.value,"aria-invalid":m(o).errors?"true":"false","aria-describedby":m(o).errors?`${m(o).id}-error`:void 0,checked:a.value,onInput:i},null,40,Ut))}});Kt.__file="src/components/headless/forms/AGHeadlessInputInput.vue";const Qt=["for"];var Wt=u({__name:"AGHeadlessInputLabel",setup(e){const t=he("input","<AGHeadlessInputLabel> must be a child of a <AGHeadlessInput>");return(e,r)=>(d(),y("label",{for:m(t).id},[h(e.$slots,"default")],8,Qt))}});Wt.__file="src/components/headless/forms/AGHeadlessInputLabel.vue";var Zt=u({__name:"AGHeadlessModalTitle",props:{as:Se("h2")},setup:e=>(t,r)=>(d(),p(m(ne),{as:e.as},{default:f((()=>[h(t.$slots,"default")])),_:3},8,["as"]))});Zt.__file="src/components/headless/modals/AGHeadlessModalTitle.vue";const Yt={class:"pointer-events-auto"};var Jt=u({__name:"AGHeadlessSnackbar",setup:e=>(e,t)=>(d(),y("div",Yt,[h(e.$slots,"default")]))});Jt.__file="src/components/headless/snackbars/AGHeadlessSnackbar.vue";const Xt=W(Qe,["Primary","Clear"]),er={id:je(),message:je(),actions:ue((()=>[])),color:me(Xt,Qe.Secondary)};function tr(){return er}var rr=u({__name:"AGSnackbar",props:tr(),setup(e){const t=e,r=l((()=>t.color===Qe.Danger?"bg-red-200 text-red-900":"bg-gray-900 text-white"));return(e,s)=>(d(),p(Jt,{class:S(["flex flex-row items-center justify-center gap-3 p-4",r.value])},{default:f((()=>[w(pt,{text:e.message,raw:""},null,8,["text"]),(d(!0),y(x,null,C(e.actions,((r,s)=>(d(),p(ht,{key:s,color:e.color,onClick:e=>function(e){e.handler?.(),e.dismiss&&Ve.hideSnackbar(t.id)}(r)},{default:f((()=>[G(M(r.text),1)])),_:2},1032,["color","onClick"])))),128))])),_:1},8,["class"]))}});rr.__file="src/components/snackbars/AGSnackbar.vue";const sr={$ui:Ve};var or={async install(e,t){const r={[ze.AlertModal]:mt,[ze.ConfirmModal]:gt,[ze.ErrorReportModal]:Tt,[ze.LoadingModal]:zt,[ze.Snackbar]:rr};Object.entries({...r,...t.components}).forEach((e=>{let[t,r]=e;return Ve.registerComponent(t,r)})),await De(e,sr)}};async function nr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=[Me,Je,et,qe,or,...t.plugins??[]],s=H(e);await Promise.all(r.map((e=>e.install(s,t)))??[]),s.mount("#app"),Re.emit("application-mounted")}const ar={key:0};var lr=u({__name:"AGAppModals",setup(e){const t=l((()=>Ve.modals[0]??null));return(e,r)=>t.value?(d(),y("aside",ar,[w(nt,{"child-index":1,modal:t.value},null,8,["modal"])])):A("v-if",!0)}});lr.__file="src/components/AGAppModals.vue";const ir={"aria-live":"assertive",class:"z-60 pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:p-6"},ur={class:"flex w-full flex-col items-center space-y-4 sm:items-end"};const cr={render:function(e,t){return d(),y("div",ir,[k("div",ur,[(d(!0),y(x,null,C(e.$ui.snackbars,(e=>(d(),p(g(e.component),$({id:e.id,key:e.id},e.properties),null,16,["id"])))),128))])])},__file:"src/components/AGAppSnackbars.vue"};var dr=cr,pr=u({__name:"AGAppOverlays",setup(t){const r=e(null),s=e(!0);return tt("show-overlays-backdrop",(async()=>{r.value&&s.value&&(s.value=!1,r.value.classList.remove("opacity-0"))})),tt("hide-overlays-backdrop",(async()=>{r.value&&!s.value&&(s.value=!0,r.value.classList.add("opacity-0"))})),(e,t)=>(d(),y(x,null,[k("div",{ref_key:"$backdrop",ref:r,class:"pointer-events-none fixed inset-0 z-50 bg-black/30 opacity-0"},null,512),w(lr),w(dr)],64))}});pr.__file="src/components/AGAppOverlays.vue";const mr={class:"flex h-full flex-col text-base font-normal leading-tight text-gray-900 antialiased"};var fr=u({__name:"AGAppLayout",setup:e=>(e,t)=>(d(),y("div",mr,[h(e.$slots,"default"),w(pr)]))});fr.__file="src/components/AGAppLayout.vue";const hr={class:"ml-2"};var vr=u({inheritAttrs:!1,__name:"AGCheckbox",props:{name:Se()},setup(e){const t=de();return(r,s)=>(d(),p(Vt,{ref_key:"$input",ref:t,name:e.name,class:"flex"},{default:f((()=>[w(Kt,$(r.$attrs,{type:"checkbox",class:{"text-indigo-600 focus:ring-indigo-600":!m(t)?.errors,"border-red-200 text-red-600 focus:ring-red-600":m(t)?.errors}}),null,16,["class"]),k("div",hr,[r.$slots.default?(d(),p(Wt,{key:0},{default:f((()=>[h(r.$slots,"default")])),_:3})):A("v-if",!0),w(Nt,{class:"text-sm text-red-600"})])])),_:3},8,["name"]))}});vr.__file="src/components/forms/AGCheckbox.vue";const gr=["onSubmit"];var _r=u({__name:"AGForm",props:{form:be()},emits:["submit"],setup(e,{emit:t}){const r=e;function s(){r.form&&!r.form.submit()||t("submit")}return v("form",r.form),(e,t)=>(d(),y("form",{onSubmit:I(s,["prevent"])},[h(e.$slots,"default")],40,gr))}});_r.__file="src/components/forms/AGForm.vue";const br={class:"absolute bottom-0 left-0 translate-y-full"};var yr=u({inheritAttrs:!1,__name:"AGInput",props:{name:Se()},setup(e){const t=de(),[r,s]=rt();return(o,n)=>(d(),p(Vt,{ref_key:"$input",ref:t,class:S(["relative flex flex-col items-center",m(s)]),name:e.name},{default:f((()=>[w(Kt,$(m(r),{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",{"ring-1 ring-red-500":m(t)?.errors}]}),null,16,["class"]),k("div",br,[w(Nt,{class:"mt-1 text-sm text-red-500"})])])),_:1},8,["class","name"]))}});yr.__file="src/components/forms/AGInput.vue";const xr={String:"string",Number:"number",Boolean:"boolean"};class wr extends P{constructor(t){super(),J(this,"errors",void 0),J(this,"_fields",void 0),J(this,"_data",void 0),J(this,"_valid",void 0),J(this,"_submitted",void 0),J(this,"_errors",void 0),this._fields=t,this._submitted=e(!1),this._data=this.getInitialData(t),this._errors=this.getInitialErrors(t),this._valid=l((()=>!Object.values(this._errors).some((e=>null!==e)))),this.errors=E(this._errors)}get valid(){return this._valid.value}get submitted(){return this._submitted.value}setFieldValue(e,t){this._data[e]=t,this._submitted.value&&this.validate()}getFieldValue(e){return this._data[e]}validate(){const e=Object.entries(this._fields).reduce(((e,t)=>{let[r,s]=t;return e[r]=this.getFieldErrors(r,s),e}),{});return this.resetErrors(e),this.valid}reset(){this._submitted.value=!1,this.resetData(),this.resetErrors()}submit(){return this._submitted.value=!0,this.validate()}__get(e){return e in this._fields?this._data[e]:super.__get(e)}__set(e,t){e in this._fields?Object.assign(this._data,{[e]:t}):super.__set(e,t)}getFieldErrors(e,t){const r=[];return t.rules?.includes("required")&&!this._data[e]&&r.push("required"),r.length>0?r:null}getInitialData(e){if(this.static().isConjuring())return{};const t=Object.entries(e).reduce(((e,t)=>{let[r,s]=t;return e[r]=s.default??null,e}),{});return r(t)}getInitialErrors(e){if(this.static().isConjuring())return{};const t=Object.keys(e).reduce(((e,t)=>(e[t]=null,e)),{});return r(t)}resetData(){for(const[e,t]of Object.entries(this._fields))this._data[e]=t.default??null}resetErrors(e){Object.keys(this._errors).forEach((e=>delete this._errors[e])),e&&Object.assign(this._errors,e)}}function Ar(e){return new wr(e)}function kr(e){return{default:e,type:xr.Boolean}}function jr(e){return{default:e,type:xr.Boolean,rules:"required"}}function Sr(e){return{default:e,type:xr.Number,rules:"required"}}function Gr(e){return{default:e,type:xr.String,rules:"required"}}function Mr(e){return{default:e,type:xr.Number}}function Cr(e){return{default:e,type:xr.String}}export{mt as AGAlertModal,fr as AGAppLayout,pr as AGAppOverlays,ht as AGButton,vr as AGCheckbox,gt as AGConfirmModal,Pt as AGErrorReportModalButtons,Bt as AGErrorReportModalTitle,_r as AGForm,ft as AGHeadlessButton,Vt as AGHeadlessInput,Nt as AGHeadlessInputError,Kt as AGHeadlessInputInput,Wt as AGHeadlessInputLabel,ot as AGHeadlessModal,lt as AGHeadlessModalPanel,Zt as AGHeadlessModalTitle,Jt as AGHeadlessSnackbar,yr as AGInput,zt as AGLoadingModal,pt as AGMarkdown,ct as AGModal,nt as AGModalContext,rr as AGSnackbar,Be as App,Pe as AppService,Qe as Colors,We as Errors,Re as Events,Ie as EventsService,xr as FormFieldTypes,Fe as Lang,He as Service,Xt as SnackbarColors,Ve as UI,ze as UIComponents,ue as arrayProp,kr as booleanInput,ce as booleanProp,De as bootServices,nr as bootstrapApplication,de as componentRef,pe as defineDirective,ie as definePlugin,Ee as defineServiceState,me as enumProp,kt as errorReportModalProps,ve as injectOrFail,fe as injectReactive,he as injectReactiveOrFail,ge as mixedProp,Mr as numberInput,_e as numberProp,be as objectProp,st as onCleanMounted,ye as requiredArrayProp,jr as requiredBooleanInput,xe as requiredEnumProp,we as requiredMixedProp,Sr as requiredNumberInput,Ae as requiredNumberProp,ke as requiredObjectProp,Gr as requiredStringInput,je as requiredStringProp,er as snackbarProps,Cr as stringInput,Se as stringProp,Ne as translate,Ue as translateWithDefault,jt as useErrorReportModalProps,tt as useEvent,Ar as useForm,rt as useInputAttrs,tr as useSnackbarProps};
|
|
1
|
+
import"core-js/modules/esnext.async-iterator.map.js";import"core-js/modules/esnext.iterator.map.js";import{ref as e,inject as t,reactive as r,markRaw as s,nextTick as o,onUnmounted as n,useAttrs as a,computed as l,onMounted as i,defineComponent as u,toRef as c,openBlock as d,createBlock as p,unref as m,withCtx as f,renderSlot as h,provide as v,resolveDynamicComponent as g,normalizeProps as _,guardReactiveProps as b,createElementBlock as y,Fragment as x,createVNode as w,createCommentVNode as A,createElementVNode as k,h as j,normalizeClass as G,createTextVNode as S,toDisplayString as M,renderList as C,mergeProps as E,readonly as $,createApp as H,withModifiers as I}from"vue";import{fail as R,JSError as L,MagicObject as P,PromisedValue as B,objectOnly as O,isEmpty as q,Storage as D,objectDeepClone as z,facade as T,arr as V,tap as U,uuid as F,toString as N,isObject as K,objectWithoutEmpty as Q,objectWithout as W,noop as Z,stringExcerpt as Y}from"@noeldemartin/utils";import J from"@babel/runtime/helpers/esm/defineProperty";import"core-js/modules/esnext.set.add-all.js";import"core-js/modules/esnext.set.delete-all.js";import"core-js/modules/esnext.set.difference.js";import"core-js/modules/esnext.set.every.js";import"core-js/modules/esnext.set.filter.js";import"core-js/modules/esnext.set.find.js";import"core-js/modules/esnext.set.intersection.js";import"core-js/modules/esnext.set.is-disjoint-from.js";import"core-js/modules/esnext.set.is-subset-of.js";import"core-js/modules/esnext.set.is-superset-of.js";import"core-js/modules/esnext.set.join.js";import"core-js/modules/esnext.set.map.js";import"core-js/modules/esnext.set.reduce.js";import"core-js/modules/esnext.set.some.js";import"core-js/modules/esnext.set.symmetric-difference.js";import"core-js/modules/esnext.set.union.js";import{defineStore as X,createPinia as ee,setActivePinia as te}from"pinia";import re from"virtual:aerogel";import"core-js/modules/esnext.async-iterator.filter.js";import"core-js/modules/esnext.iterator.constructor.js";import"core-js/modules/esnext.iterator.filter.js";import"core-js/modules/esnext.string.at.js";import"core-js/modules/esnext.async-iterator.reduce.js";import"core-js/modules/esnext.iterator.reduce.js";import"core-js/modules/esnext.async-iterator.some.js";import"core-js/modules/esnext.iterator.some.js";import"core-js/modules/esnext.async-iterator.for-each.js";import"core-js/modules/esnext.iterator.for-each.js";import{Dialog as se,DialogPanel as oe,DialogTitle as ne}from"@headlessui/vue";import ae from"dompurify";import{marked as le,Renderer as ie}from"marked";function ue(e){return e}function ce(e){return{type:Array,default:e??(()=>[])}}function de(){return{type:Boolean,default:arguments.length>0&&void 0!==arguments[0]&&arguments[0]}}function pe(){return e()}function me(e){return e}function fe(e,t){const r=Object.values(e);return{type:String,default:t??r[0]??null,validator:e=>r.includes(e)}}function he(e){const s=t(e);return s?r(s):void 0}function ve(e,t){return he(e)??R(t??`Could not resolve '${e}' injection key`)}function ge(e,r){return t(e)??R(r??`Could not resolve '${e}' injection key`)}function _e(e){return{type:e,default:null}}function be(){return{type:Number,default:arguments.length>0&&void 0!==arguments[0]?arguments[0]:null}}function ye(){return{type:Object,default:arguments.length>0&&void 0!==arguments[0]?arguments[0]:null}}function xe(){return{type:Array,required:!0}}function we(e){const t=Object.values(e);return{type:String,required:!0,validator:e=>t.includes(e)}}function Ae(e){return{type:e,required:!0}}function ke(){return{type:Number,required:!0}}function je(){return{type:Object,required:!0}}function Ge(){return{type:String,required:!0}}function Se(){return{type:String,default:arguments.length>0&&void 0!==arguments[0]?arguments[0]:null}}const Me={"initial-focus":{mounted(e,t){let{value:r}=t;!1!==r&&e.focus()}}};var Ce={install(e,t){const r={...Me,...t.directives};for(const[t,s]of Object.entries(r))e.directive(t,s)}};class ServiceBootError extends L{constructor(e,t){super(`Service '${e}' failed booting`,{cause:t})}}let Ee=null;function $e(){return Ee||(Ee=ee(),te(Ee)),Ee}function He(e){var t;return J(t=class extends Ie{usesStore(){return!0}getName(){return e.name??null}getInitialState(){return e.initialState}getComputedStateDefinition(){return e.computed??{}}serializePersistedState(t){return e.serialize?.(t)??t}},"persist",e.persist??[]),t}class Ie extends P{constructor(){super(),J(this,"_name",void 0),J(this,"_booted",void 0),J(this,"_computedStateKeys",void 0),J(this,"_store",void 0);const e=this.getComputedStateDefinition();var t,r;this._name=this.getName()??new.target.name,this._booted=new B,this._computedStateKeys=new Set(Object.keys(e)),this._store=this.usesStore()&&(t=this._name,r={state:()=>this.getInitialState(),getters:e},$e(),X(t,r)())}get booted(){return this._booted}launch(){const handleError=e=>this._booted.reject(new ServiceBootError(this._name,e));try{this.frameworkBoot().then((()=>this.boot())).then((()=>this._booted.resolve())).catch(handleError)}catch(e){handleError(e)}return this._booted}hasState(e){return!!this._store&&(e in this._store.$state||this._computedStateKeys.has(e))}getState(e){const t=this._store;return e?t?t[e]:void 0:t||{}}setState(e,t){if(!this._store)return;const r="string"==typeof e?{[e]:t}:e;Object.assign(this._store.$state,r),this.onStateUpdated(r)}__get(e){return this.hasState(e)?this.getState(e):super.__get(e)}__set(e,t){this.setState({[e]:t})}onStateUpdated(e){const t=this.constructor.persist,r=O(e,t);if(q(r))return;const s=D.require(this._name);D.set(this._name,{...s,...this.serializePersistedState(z(r))})}usesStore(){return!1}getName(){return null}getInitialState(){return{}}getComputedStateDefinition(){return{}}serializePersistedState(e){return e}async frameworkBoot(){this.restorePersistedState()}async boot(){}restorePersistedState(){const e=this.constructor.persist;if(this.usesStore()&&!q(e))if(D.has(this._name)){const e=D.require(this._name);this.setState(e)}else D.set(this._name,O(this.getState(),e))}}J(Ie,"persist",[]);class Re extends Ie{constructor(){super(...arguments),J(this,"listeners",{})}async emit(e,t){const r=[...this.listeners[e]??[]];await Promise.all(r.map((e=>e(t)))??[])}on(e,t){return(this.listeners[e]??=V([])).push(t),()=>this.off(e,t)}once(e,t){let r=null;return U((()=>r&&this.off(e,r)),(s=>{(this.listeners[e]??=V([])).push(r=function(){return s(),t(...arguments)})}))}off(e,t){const r=this.listeners[e];r&&(r.remove(t),r.isEmpty()&&delete this.listeners[e])}}var Le=T(new Re),Pe=He({name:"app",initialState:{environment:re.environment,sourceUrl:re.sourceUrl,isMounted:!1},computed:{development:e=>"development"===e.environment,testing:e=>"testing"===e.environment}});class Be extends Pe{async boot(){Le.once("application-mounted",(()=>this.setState({isMounted:!0})))}}var Oe=T(new Be);const qe={$app:Oe,$events:Le};async function De(e,t){await Promise.all(Object.entries(t).map((async t=>{let[r,s]=t;await s.launch().catch((t=>e.config.errorHandler?.(t,null,`Failed launching ${r}.`)))}))),Object.assign(e.config.globalProperties,t),Oe.development&&Object.assign(window,t)}var ze={async install(e,t){const r={...qe,...t.services};e.use(Ee??$e()),await De(e,r)}},Te=He({name:"ui",initialState:{modals:[],snackbars:[]}});const Ve={AlertModal:"alert-modal",ConfirmModal:"confirm-modal",ErrorReportModal:"error-report-modal",LoadingModal:"loading-modal",Snackbar:"snackbar"};var Ue=T(new class extends Te{constructor(){super(...arguments),J(this,"modalCallbacks",{}),J(this,"components",{})}requireComponent(e){return this.components[e]??R(`UI Component '${e}' is not defined!`)}alert(e,t){const r="string"==typeof t?{title:e,message:t}:{message:e};this.openModal(this.requireComponent(Ve.AlertModal),r)}async confirm(e,t){const r="string"==typeof t?{title:e,message:t}:{message:e},s=await this.openModal(this.requireComponent(Ve.ConfirmModal),r);return await s.beforeClose??!1}async loading(e,t){t="string"==typeof e?t:e;const r="string"==typeof e?e:void 0,s=await this.openModal(this.requireComponent(Ve.LoadingModal),{message:r}),o=await t;return await this.closeModal(s.id),o}showSnackbar(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r={id:F(),properties:{message:e,...t},component:t.component??s(this.requireComponent(Ve.Snackbar))};this.setState("snackbars",this.snackbars.concat(r)),setTimeout((()=>this.hideSnackbar(r.id)),5e3)}hideSnackbar(e){this.setState("snackbars",this.snackbars.filter((t=>t.id!==e)))}registerComponent(e,t){this.components[e]=t}async openModal(e,t){const r=F(),n={},a={id:r,properties:t??{},component:s(e),beforeClose:new Promise((e=>n.willClose=e)),afterClose:new Promise((e=>n.closed=e))},l=this.modals.at(-1),i=this.modals.concat(a);return this.modalCallbacks[a.id]=n,this.setState({modals:i}),await o(),await(l&&Le.emit("hide-modal",{id:l.id})),await Promise.all([l||Le.emit("show-overlays-backdrop"),Le.emit("show-modal",{id:a.id})]),a}async closeModal(e,t){await Le.emit("close-modal",{id:e,result:t})}async boot(){this.watchModalEvents()}watchModalEvents(){Le.on("modal-will-close",(e=>{let{modal:t,result:r}=e;this.modalCallbacks[t.id]?.willClose?.(r),1===this.modals.length&&Le.emit("hide-overlays-backdrop")})),Le.on("modal-closed",(async e=>{let{modal:t,result:r}=e;this.setState("modals",this.modals.filter((e=>e.id!==t.id))),this.modalCallbacks[t.id]?.closed?.(r),delete this.modalCallbacks[t.id];const s=this.modals.at(-1);await(s&&Le.emit("show-modal",{id:s.id}))}))}});var Fe=T(new class extends Ie{constructor(){super(),J(this,"provider",void 0),this.provider={translate:e=>(Oe.development&&console.warn("Lang provider is missing"),e)}}setProvider(e){this.provider=e}translate(e,t){return this.provider.translate(e,t)??e}translateWithDefault(e,t,r){r??=t;const s="string"==typeof t?{}:t??{},o=this.provider.translate(e,s)??e;return o===e?Object.entries(s).reduce(((e,t)=>{let[r,s]=t;return e.replace(new RegExp(`\\{\\s*${r}\\s*\\}`,"g"),N(s))}),r):o}});const Ne=Fe.translate.bind(Fe),Ke=Fe.translateWithDefault.bind(Fe);var Qe=He({name:"errors",initialState:{logs:[],startupErrors:[]},computed:{hasErrors:e=>{let{logs:t}=e;return t.length>0},hasNewErrors:e=>{let{logs:t}=e;return t.some((e=>!e.seen))},hasStartupErrors:e=>{let{startupErrors:t}=e;return t.length>0}}});const We={Primary:"primary",Secondary:"secondary",Danger:"danger",Clear:"clear"};var Ze=T(new class extends Qe{constructor(){super(...arguments),J(this,"forceReporting",!1),J(this,"enabled",!0)}enable(){this.enabled=!0}disable(){this.enabled=!1}async inspect(e){const t=Array.isArray(e)?e:[await this.createErrorReport(e)];0!==t.length?Ue.openModal(Ue.requireComponent(Ve.ErrorReportModal),{reports:t}):Ue.alert(Ke("errors.inspectEmpty","Nothing to inspect!"))}async report(e,t){if((Oe.development||Oe.testing)&&this.logError(e),!this.enabled)throw e;if(!Oe.isMounted){const t=await this.createStartupErrorReport(e);return void(t&&this.setState({startupErrors:this.startupErrors.concat(t)}))}const r=await this.createErrorReport(e),s={report:r,seen:!1,date:new Date};Ue.showSnackbar(t??Ke("errors.notice","Something went wrong, but it's not your fault. Try again!"),{color:We.Danger,actions:[{text:Ke("errors.viewDetails","View details"),dismiss:!0,handler:()=>Ue.openModal(Ue.requireComponent(Ve.ErrorReportModal),{reports:[r]})}]}),this.setState({logs:[s].concat(this.logs)})}see(e){this.setState({logs:this.logs.map((t=>t.report!==e?t:{...t,seen:!0}))})}seeAll(){this.setState({logs:this.logs.map((e=>({...e,seen:!0})))})}getErrorMessage(e){return"string"==typeof e?e:e instanceof Error||e instanceof L?e.message:K(e)?N(e.message??e.description??"Unknown error object"):Ke("errors.unknown","Unknown Error")}logError(e){console.error(e),K(e)&&e.cause&&this.logError(e.cause)}async createErrorReport(e){return"string"==typeof e?{title:e}:e instanceof Error||e instanceof L?this.createErrorReportFromError(e):K(e)?Q({title:N(e.name??e.title??Ke("errors.unknown","Unknown Error")),description:N(e.message??e.description??Ke("errors.unknownDescription","Unknown error object")),error:e}):{title:Ke("errors.unknown","Unknown Error"),error:e}}async createStartupErrorReport(e){return e instanceof ServiceBootError?e.cause instanceof ServiceBootError?null:this.createErrorReport(e.cause):this.createErrorReport(e)}createErrorReportFromError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{title:e.name,description:e.message,details:e.stack,error:e,...t}}});const Ye={$errors:Ze};function Je(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>!1;return U((t=>e(t)||(e=>Ze.instance?(Ze.report(e),!0):(console.warn("Errors service hasn't been initialized properly!"),console.error(e),!0))(t)),(e=>{globalThis.onerror=(t,r,s,o,n)=>e(n??t),globalThis.onunhandledrejection=t=>e(t.reason)}))}var Xe={async install(e,t){const r=Je(t.handleError);e.config.errorHandler=r,await De(e,Ye)}};const et={$lang:Fe};var tt={async install(e){e.config.globalProperties.$t??=Ne,e.config.globalProperties.$td=Ke,await De(e,et)}};function rt(e,t){const r=Le.on(e,t);n((()=>r()))}function st(){const e=a(),t=l((()=>e.class));return[l((()=>W(e,"class"))),t]}function ot(e){let t=Z;i((()=>t=e())),n((()=>t()))}var nt=u({__name:"AGHeadlessModal",props:{cancellable:de(!0)},setup(t,{expose:r}){const s=t,o=e(null),n=e(!0),a=e(!1),{modal:l}=ve("modal","could not obtain modal reference from <AGHeadlessModal>, did you render this component manually? Show it using $ui.openModal() instead");async function i(){o.value?.$el&&(n.value=!0)}async function u(e){a.value||(Le.emit("modal-will-close",{modal:l,result:e}),await i(),a.value=!0,Le.emit("modal-closed",{modal:l,result:e}))}return rt("close-modal",(async({id:e,result:t})=>{e===l.id&&await u(t)})),rt("hide-modal",(async({id:e})=>{e===l.id&&await i()})),rt("show-modal",(async({id:e})=>{e===l.id&&await async function(){o.value?.$el&&(n.value=!1)}()})),r({close:u,cancellable:c(s,"cancellable")}),(e,r)=>(d(),p(m(se),{ref_key:"$root",ref:o,open:!0,onClose:r[0]||(r[0]=e=>t.cancellable&&u())},{default:f((()=>[h(e.$slots,"default",{close:u})])),_:3},512))}});nt.__file="src/components/headless/modals/AGHeadlessModal.vue";var at=u({__name:"AGModalContext",props:{modal:je(),childIndex:ke()},setup(e){const t=e;return v("modal",{modal:c(t,"modal"),childIndex:c(t,"childIndex")}),(t,r)=>(d(),p(g(e.modal.component),_(b(e.modal.properties)),null,16))}});at.__file="src/components/modals/AGModalContext.vue";const lt=k("div",{class:"pointer-events-none fixed inset-0 z-50 bg-black/30"},null,-1);var it=u({__name:"AGHeadlessModalPanel",setup(e){const t=ve("modal","could not obtain modal reference from <AGHeadlessModalPanel>, did you render this component manually? Show it using $ui.openModal() instead"),r=l((()=>Ue.modals[t.childIndex]??null));return(e,s)=>(d(),p(m(oe),null,{default:f((()=>[h(e.$slots,"default"),r.value?(d(),y(x,{key:0},[lt,w(at,{"child-index":m(t).childIndex+1,modal:r.value},null,8,["child-index","modal"])],64)):A("v-if",!0)])),_:3}))}});it.__file="src/components/headless/modals/AGHeadlessModalPanel.vue";const ut={class:"fixed inset-0 flex items-center justify-center p-8"},ct={class:"flex max-h-full flex-col overflow-auto p-4"};var dt=u({__name:"AGModal",props:{cancellable:de(!0)},setup(t,{expose:r}){const s=e();return r({close:async()=>s.value?.close(),cancellable:l((()=>!!s.value?.cancellable))}),(e,r)=>(d(),p(nt,{ref_key:"$headlessModal",ref:s,cancellable:t.cancellable,class:"relative z-50"},{default:f((({close:t})=>[k("div",ut,[w(it,{class:"flex max-h-full max-w-full flex-col overflow-hidden bg-white"},{default:f((()=>[k("div",ct,[h(e.$slots,"default",{close:t})])])),_:2},1024)])])),_:3},8,["cancellable"]))}});function pt(e){return t=le(e,{mangle:!1,headerIds:!1,renderer:U(new ie,(e=>{e.link=function(e,t,r){return ie.prototype.link.apply(this,[e,t,r]).replace("<a",'<a target="_blank"')}}))}),ae.sanitize(t,{ADD_ATTR:["target"]});var t}dt.__file="src/components/modals/AGModal.vue";var mt=u({__name:"AGMarkdown",props:{as:Se(),inline:de(),langKey:Se(),langParams:ye(),text:Se()},setup(e){const t=e,r=l((()=>t.text??(t.langKey&&Ne(t.langKey,t.langParams??{})))),s=l((()=>{if(!r.value)return null;let e=pt(r.value);return t.inline&&(e=e.replace("<p>","<span>").replace("</p>","</span>")),e})),o=()=>j(t.as??(t.inline?"span":"div"),{class:t.inline?"":"prose",innerHTML:s.value});return(e,t)=>(d(),p(o))}});mt.__file="src/components/basic/AGMarkdown.vue";var ft=u({__name:"AGAlertModal",props:{title:Se(),message:Ge()},setup:e=>(t,r)=>(d(),p(dt,null,{default:f((()=>[e.title?(d(),p(mt,{key:0,text:e.title,as:"h2",class:"font-semibold",inline:""},null,8,["text"])):A("v-if",!0),w(mt,{text:e.message},null,8,["text"])])),_:1}))});ft.__file="src/components/modals/AGAlertModal.vue";var ht=u({__name:"AGHeadlessButton",props:{href:Se(),url:Se(),route:Se(),routeParams:ye((()=>({}))),routeQuery:ye((()=>({}))),submit:de()},setup(e){const{href:t,url:r,route:s,routeParams:o,routeQuery:n,submit:a}=e,i=l((()=>s?{tag:"router-link",props:{to:Q({name:s,params:o,query:n})}}:t||r?{tag:"a",props:{target:"_blank",href:t||r}}:{tag:"button",props:{type:a?"submit":"button"}}));return(e,t)=>(d(),p(g(i.value.tag),_(b(i.value.props)),{default:f((()=>[h(e.$slots,"default")])),_:3},16))}});ht.__file="src/components/headless/forms/AGHeadlessButton.vue";var vt=u({__name:"AGButton",props:{color:fe(We,We.Primary)},setup(e){const t=e,r=l((()=>{switch(t.color){case We.Secondary:return["text-white bg-gray-600","hover:bg-gray-500","focus-visible:outline-offset-2 focus-visible:outline-gray-600"].join(" ");case We.Clear:return"hover:bg-gray-500/20 focus-visible:outline-gray-500/60";case We.Danger:return["text-white bg-red-600","hover:bg-red-500","focus-visible:outline-offset-2 focus-visible:outline-red-600"].join(" ");default:return["text-white bg-indigo-600","hover:bg-indigo-500","focus-visible:outline-offset-2 focus-visible:outline-indigo-600"].join(" ")}}));return(e,t)=>(d(),p(ht,{class:G(["px-2.5 py-1.5 focus-visible:outline focus-visible:outline-2",r.value])},{default:f((()=>[h(e.$slots,"default")])),_:3},8,["class"]))}});vt.__file="src/components/forms/AGButton.vue";const gt={class:"mt-2 flex flex-row-reverse gap-2"};var _t=u({__name:"AGConfirmModal",props:{title:Se(),message:Ge()},setup:e=>(t,r)=>(d(),p(dt,{cancellable:!1},{default:f((({close:r})=>[e.title?(d(),p(mt,{key:0,text:e.title,as:"h1"},null,8,["text"])):A("v-if",!0),w(mt,{text:e.message},null,8,["text"]),k("div",gt,[w(vt,{onClick:e=>r(!0)},{default:f((()=>[S(M(t.$td("ui.ok","OK")),1)])),_:2},1032,["onClick"]),w(vt,{color:"secondary",onClick:e=>r()},{default:f((()=>[S(M(t.$td("ui.cancel","Cancel")),1)])),_:2},1032,["onClick"])])])),_:1}))});_t.__file="src/components/modals/AGConfirmModal.vue";const bt={viewBox:"0 0 20 20",width:"1.2em",height:"1.2em"},yt=[k("path",{fill:"currentColor",d:"m12.95 10.707l.707-.707L8 4.343L6.586 5.757L10.828 10l-4.242 4.243L8 15.657l4.95-4.95z"},null,-1)];var xt={name:"zondicons-cheveron-right",render:function(e,t){return d(),y("svg",bt,yt)}};const wt={viewBox:"0 0 20 20",width:"1.2em",height:"1.2em"},At=[k("path",{fill:"currentColor",d:"M7.05 9.293L6.343 10L12 15.657l1.414-1.414L9.172 10l4.242-4.243L12 4.343z"},null,-1)];var kt={name:"zondicons-cheveron-left",render:function(e,t){return d(),y("svg",wt,At)}};const jt={reports:xe()};function Gt(){return jt}const St={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"},Mt=[k("path",{fill:"currentColor",d:"M20 19V7H4v12h16m0-16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16m-7 14v-2h5v2h-5m-3.42-4L5.57 9H8.4l3.3 3.3c.39.39.39 1.03 0 1.42L8.42 17H5.59l3.99-4Z"},null,-1)];var Ct={name:"mdi-console",render:function(e,t){return d(),y("svg",St,Mt)}};const Et={viewBox:"0 0 20 20",width:"1.2em",height:"1.2em"},$t=[k("path",{fill:"currentColor",d:"M6 6V2c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-4v4a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8c0-1.1.9-2 2-2h4zm2 0h4a2 2 0 0 1 2 2v4h4V2H8v4zM2 8v10h10V8H2z"},null,-1)];var Ht={name:"zondicons-copy",render:function(e,t){return d(),y("svg",Et,$t)}};const It={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"},Rt=[k("path",{fill:"currentColor",d:"M12 2A10 10 0 0 0 2 12c0 4.42 2.87 8.17 6.84 9.5c.5.08.66-.23.66-.5v-1.69c-2.77.6-3.36-1.34-3.36-1.34c-.46-1.16-1.11-1.47-1.11-1.47c-.91-.62.07-.6.07-.6c1 .07 1.53 1.03 1.53 1.03c.87 1.52 2.34 1.07 2.91.83c.09-.65.35-1.09.63-1.34c-2.22-.25-4.55-1.11-4.55-4.92c0-1.11.38-2 1.03-2.71c-.1-.25-.45-1.29.1-2.64c0 0 .84-.27 2.75 1.02c.79-.22 1.65-.33 2.5-.33c.85 0 1.71.11 2.5.33c1.91-1.29 2.75-1.02 2.75-1.02c.55 1.35.2 2.39.1 2.64c.65.71 1.03 1.6 1.03 2.71c0 3.82-2.34 4.66-4.57 4.91c.36.31.69.92.69 1.85V21c0 .27.16.59.67.5C19.14 20.16 22 16.42 22 12A10 10 0 0 0 12 2Z"},null,-1)];var Lt={name:"mdi-github",render:function(e,t){return d(),y("svg",It,Rt)}};const Pt={class:"flex"};var Bt=u({__name:"AGErrorReportModalButtons",props:{report:je()},setup(e){const t=e,r=l((()=>t.report.description?`${t.report.title}: ${t.report.description}`:t.report.title)),s=l((()=>{if(!Oe.sourceUrl)return!1;const e=encodeURIComponent(r.value),s=encodeURIComponent(["[Please, explain here what you were trying to do when this error appeared]","","Error details:","```",Y(t.report.details??"Details missing from report",1800-e.length-Oe.sourceUrl.length).trim(),"```"].join("\n"));return`${Oe.sourceUrl}/issues/new?title=${e}&body=${s}`})),o=l((()=>U([{id:"clipboard",description:"Copy to clipboard",iconComponent:Ht,async handler(){await navigator.clipboard.writeText(`${r.value}\n\n${t.report.details}`),Ue.showSnackbar(Ke("errors.copiedToClipboard","Debug information copied to clipboard"))}},{id:"console",description:"Log to console",iconComponent:Ct,handler(){window.error=t.report.error,console.error(t.report.error),Ue.showSnackbar(Ke("errors.addedToConsole","You can now use the **error** variable in the console"))}}],(e=>{s.value&&e.push({id:"github",description:"Report in GitHub",iconComponent:Lt,url:s.value})}))));return(e,t)=>(d(),y("div",Pt,[(d(!0),y(x,null,C(o.value,((t,r)=>h(e.$slots,"default",E(t,{key:r}),(()=>[w(vt,{color:"clear",url:t.url,title:e.$td(`errors.report_${t.id}`,t.description),"aria-label":e.$td(`errors.report_${t.id}`,t.description),onClick:t.handler},{default:f((()=>[(d(),p(g(t.iconComponent),{class:"h-4 w-4","aria-hidden":"true"}))])),_:2},1032,["url","title","aria-label","onClick"])])))),128))]))}});Bt.__file="src/components/modals/AGErrorReportModalButtons.vue";var Ot=u({__name:"AGErrorReportModalTitle",props:{report:je(),currentReport:be(),totalReports:be()},setup(e){const t=e,r=l((()=>!t.totalReports||t.totalReports<=1?t.report.title:`${t.report.title} (${t.currentReport}/${t.totalReports})`));return(e,t)=>(d(),p(mt,{text:r.value,inline:""},null,8,["text"]))}});Ot.__file="src/components/modals/AGErrorReportModalTitle.vue";const qt={class:"flex items-center justify-between text-lg font-medium"},Dt={class:"flex items-center"},zt=["textContent"];var Tt=u({__name:"AGErrorReportModal",props:Gt(),setup(t){const r=t,s=e(0),o=l((()=>r.reports[s.value]));return(e,t)=>(d(),p(dt,null,{default:f((()=>[k("div",null,[k("h2",qt,[k("div",Dt,[w(Ot,{report:o.value,"current-report":s.value+1,"total-reports":e.reports.length},null,8,["report","current-report","total-reports"]),e.reports.length>1?(d(),y(x,{key:0},[w(vt,{color:"clear",disabled:0===s.value,title:e.$td("errors.previousReport","Show previous report"),"aria-label":e.$td("errors.previousReport","Show previous report"),onClick:t[0]||(t[0]=e=>s.value--)},{default:f((()=>[w(m(kt),{"aria-hidden":"true",class:"h-4 w-4"})])),_:1},8,["disabled","title","aria-label"]),w(vt,{color:"clear",disabled:s.value===e.reports.length-1,title:e.$td("errors.nextReport","Show next report"),"aria-label":e.$td("errors.nextReport","Show next report"),onClick:t[1]||(t[1]=e=>s.value++)},{default:f((()=>[w(m(xt),{"aria-hidden":"true",class:"h-4 w-4"})])),_:1},8,["disabled","title","aria-label"])],64)):A("v-if",!0)]),w(Bt,{report:o.value},null,8,["report"])]),o.value.description?(d(),p(mt,{key:0,text:o.value.description,class:"mt-2"},null,8,["text"])):A("v-if",!0)]),k("pre",{class:"h-full overflow-auto bg-gray-200 p-4 text-xs text-red-900",textContent:M(o.value.details??e.$td("errors.detailsEmpty","This error is missing a stacktrace."))},null,8,zt)])),_:1}))}});Tt.__file="src/components/modals/AGErrorReportModal.vue";var Vt=u({__name:"AGLoadingModal",props:{message:Se()},setup(e){const t=e,r=l((()=>t.message??Ke("ui.loading","Loading...")));return(e,t)=>(d(),p(dt,{cancellable:!1},{default:f((()=>[w(mt,{text:r.value},null,8,["text"])])),_:1}))}});Vt.__file="src/components/modals/AGLoadingModal.vue";var Ut=u({__name:"AGHeadlessInput",props:{as:Se("div"),name:Se(),modelValue:_e([String,Number,Boolean])},emits:["update:modelValue"],setup(e,{expose:r,emit:s}){const o=e,n=l((()=>a&&o.name?a.errors[o.name]??null:null)),a=t("form",null),i={id:`input-${F()}`,value:l((()=>a&&o.name?a.getFieldValue(o.name):o.modelValue)),errors:$(n),update(e){a&&o.name?a.setFieldValue(o.name,e):s("update:modelValue",e)}};return v("input",i),r(i),(t,r)=>e.as?(d(),p(g(e.as),{key:0},{default:f((()=>[h(t.$slots,"default")])),_:3})):h(t.$slots,"default",{key:1})}});Ut.__file="src/components/headless/forms/AGHeadlessInput.vue";const Ft=["id"];var Nt=u({__name:"AGHeadlessInputError",setup(e){const t=ve("input","<AGHeadlessInputError> must be a child of a <AGHeadlessInput>"),r=l((()=>t.errors?Ke(`errors.${t.errors[0]}`,`Error: ${t.errors[0]}`):null));return(e,s)=>r.value?(d(),y("p",{key:0,id:`${m(t).id}-error`},M(r.value),9,Ft)):A("v-if",!0)}});Nt.__file="src/components/headless/forms/AGHeadlessInputError.vue";const Kt=["id","type","value","aria-invalid","aria-describedby","checked"];var Qt=u({__name:"AGHeadlessInputInput",props:{type:Se("text")},setup(t){const r=t,s=e(),o=ve("input","<AGHeadlessInputInput> must be a child of a <AGHeadlessInput>"),n=l((()=>o.value)),a=l((()=>{if("checkbox"===r.type)return!!n.value}));function i(){s.value&&o.update("checkbox"===r.type?s.value.checked:s.value.value)}return(e,r)=>(d(),y("input",{id:m(o).id,ref_key:"$input",ref:s,type:t.type,value:n.value,"aria-invalid":m(o).errors?"true":"false","aria-describedby":m(o).errors?`${m(o).id}-error`:void 0,checked:a.value,onInput:i},null,40,Kt))}});Qt.__file="src/components/headless/forms/AGHeadlessInputInput.vue";const Wt=["for"];var Zt=u({__name:"AGHeadlessInputLabel",setup(e){const t=ve("input","<AGHeadlessInputLabel> must be a child of a <AGHeadlessInput>");return(e,r)=>(d(),y("label",{for:m(t).id},[h(e.$slots,"default")],8,Wt))}});Zt.__file="src/components/headless/forms/AGHeadlessInputLabel.vue";var Yt=u({__name:"AGHeadlessModalTitle",props:{as:Se("h2")},setup:e=>(t,r)=>(d(),p(m(ne),{as:e.as},{default:f((()=>[h(t.$slots,"default")])),_:3},8,["as"]))});Yt.__file="src/components/headless/modals/AGHeadlessModalTitle.vue";const Jt={class:"pointer-events-auto"};var Xt=u({__name:"AGHeadlessSnackbar",setup:e=>(e,t)=>(d(),y("div",Jt,[h(e.$slots,"default")]))});Xt.__file="src/components/headless/snackbars/AGHeadlessSnackbar.vue";const er=W(We,["Primary","Clear"]),tr={id:Ge(),message:Ge(),actions:ce((()=>[])),color:fe(er,We.Secondary)};function rr(){return tr}var sr=u({__name:"AGSnackbar",props:rr(),setup(e){const t=e,r=l((()=>t.color===We.Danger?"bg-red-200 text-red-900":"bg-gray-900 text-white"));return(e,s)=>(d(),p(Xt,{class:G(["flex flex-row items-center justify-center gap-3 p-4",r.value])},{default:f((()=>[w(mt,{text:e.message,inline:""},null,8,["text"]),(d(!0),y(x,null,C(e.actions,((r,s)=>(d(),p(vt,{key:s,color:e.color,onClick:e=>function(e){e.handler?.(),e.dismiss&&Ue.hideSnackbar(t.id)}(r)},{default:f((()=>[S(M(r.text),1)])),_:2},1032,["color","onClick"])))),128))])),_:1},8,["class"]))}});sr.__file="src/components/snackbars/AGSnackbar.vue";const or={$ui:Ue};var nr={async install(e,t){const r={[Ve.AlertModal]:ft,[Ve.ConfirmModal]:_t,[Ve.ErrorReportModal]:Tt,[Ve.LoadingModal]:Vt,[Ve.Snackbar]:sr};Object.entries({...r,...t.components}).forEach((e=>{let[t,r]=e;return Ue.registerComponent(t,r)})),await De(e,or)}};async function ar(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=[Ce,Xe,tt,ze,nr,...t.plugins??[]],s=H(e);await Promise.all(r.map((e=>e.install(s,t)))??[]),s.mount("#app"),Le.emit("application-mounted")}const lr={key:0};var ir=u({__name:"AGAppModals",setup(e){const t=l((()=>Ue.modals[0]??null));return(e,r)=>t.value?(d(),y("aside",lr,[w(at,{"child-index":1,modal:t.value},null,8,["modal"])])):A("v-if",!0)}});ir.__file="src/components/AGAppModals.vue";const ur={"aria-live":"assertive",class:"z-60 pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:p-6"},cr={class:"flex w-full flex-col items-center space-y-4 sm:items-end"};const dr={render:function(e,t){return d(),y("div",ur,[k("div",cr,[(d(!0),y(x,null,C(e.$ui.snackbars,(e=>(d(),p(g(e.component),E({id:e.id,key:e.id},e.properties),null,16,["id"])))),128))])])},__file:"src/components/AGAppSnackbars.vue"};var pr=dr,mr=u({__name:"AGAppOverlays",setup(t){const r=e(null),s=e(!0);return rt("show-overlays-backdrop",(async()=>{r.value&&s.value&&(s.value=!1,r.value.classList.remove("opacity-0"))})),rt("hide-overlays-backdrop",(async()=>{r.value&&!s.value&&(s.value=!0,r.value.classList.add("opacity-0"))})),(e,t)=>(d(),y(x,null,[k("div",{ref_key:"$backdrop",ref:r,class:"pointer-events-none fixed inset-0 z-50 bg-black/30 opacity-0"},null,512),w(ir),w(pr)],64))}});mr.__file="src/components/AGAppOverlays.vue";const fr={class:"flex h-full flex-col text-base font-normal leading-tight text-gray-900 antialiased"};var hr=u({__name:"AGAppLayout",setup:e=>(e,t)=>(d(),y("div",fr,[h(e.$slots,"default"),w(mr)]))});hr.__file="src/components/AGAppLayout.vue";var vr=u({__name:"AGErrorMessage",props:{error:je()},setup(e){const t=e,r=l((()=>Ze.getErrorMessage(t.error)));return(e,t)=>(d(),p(mt,{text:r.value,inline:""},null,8,["text"]))}});vr.__file="src/components/basic/AGErrorMessage.vue";var gr=u({__name:"AGLink",setup:e=>(e,t)=>(d(),p(ht,{class:"font-medium hover:underline"},{default:f((()=>[h(e.$slots,"default")])),_:3}))});gr.__file="src/components/basic/AGLink.vue";const _r={class:"ml-2"};var br=u({inheritAttrs:!1,__name:"AGCheckbox",props:{name:Se()},setup(e){const t=pe();return(r,s)=>(d(),p(Ut,{ref_key:"$input",ref:t,name:e.name,class:"flex"},{default:f((()=>[w(Qt,E(r.$attrs,{type:"checkbox",class:{"text-indigo-600 focus:ring-indigo-600":!m(t)?.errors,"border-red-200 text-red-600 focus:ring-red-600":m(t)?.errors}}),null,16,["class"]),k("div",_r,[r.$slots.default?(d(),p(Zt,{key:0},{default:f((()=>[h(r.$slots,"default")])),_:3})):A("v-if",!0),w(Nt,{class:"text-sm text-red-600"})])])),_:3},8,["name"]))}});br.__file="src/components/forms/AGCheckbox.vue";const yr=["onSubmit"];var xr=u({__name:"AGForm",props:{form:ye()},emits:["submit"],setup(e,{emit:t}){const r=e;function s(){r.form&&!r.form.submit()||t("submit")}return v("form",r.form),(e,t)=>(d(),y("form",{onSubmit:I(s,["prevent"])},[h(e.$slots,"default")],40,yr))}});xr.__file="src/components/forms/AGForm.vue";const wr={class:"absolute bottom-0 left-0 translate-y-full"};var Ar=u({inheritAttrs:!1,__name:"AGInput",props:{name:Se()},setup(e){const t=pe(),[r,s]=st();return(o,n)=>(d(),p(Ut,{ref_key:"$input",ref:t,class:G(["relative flex flex-col items-center",m(s)]),name:e.name},{default:f((()=>[w(Qt,E(m(r),{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",{"ring-1 ring-red-500":m(t)?.errors}]}),null,16,["class"]),k("div",wr,[w(Nt,{class:"mt-1 text-sm text-red-500"})])])),_:1},8,["class","name"]))}});Ar.__file="src/components/forms/AGInput.vue";const kr={String:"string",Number:"number",Boolean:"boolean"};class jr extends P{constructor(t){super(),J(this,"errors",void 0),J(this,"_fields",void 0),J(this,"_data",void 0),J(this,"_valid",void 0),J(this,"_submitted",void 0),J(this,"_errors",void 0),this._fields=t,this._submitted=e(!1),this._data=this.getInitialData(t),this._errors=this.getInitialErrors(t),this._valid=l((()=>!Object.values(this._errors).some((e=>null!==e)))),this.errors=$(this._errors)}get valid(){return this._valid.value}get submitted(){return this._submitted.value}setFieldValue(e,t){this._data[e]=t,this._submitted.value&&this.validate()}getFieldValue(e){return this._data[e]}validate(){const e=Object.entries(this._fields).reduce(((e,t)=>{let[r,s]=t;return e[r]=this.getFieldErrors(r,s),e}),{});return this.resetErrors(e),this.valid}reset(){this._submitted.value=!1,this.resetData(),this.resetErrors()}submit(){return this._submitted.value=!0,this.validate()}__get(e){return e in this._fields?this._data[e]:super.__get(e)}__set(e,t){e in this._fields?Object.assign(this._data,{[e]:t}):super.__set(e,t)}getFieldErrors(e,t){const r=[];return t.rules?.includes("required")&&!this._data[e]&&r.push("required"),r.length>0?r:null}getInitialData(e){if(this.static().isConjuring())return{};const t=Object.entries(e).reduce(((e,t)=>{let[r,s]=t;return e[r]=s.default??null,e}),{});return r(t)}getInitialErrors(e){if(this.static().isConjuring())return{};const t=Object.keys(e).reduce(((e,t)=>(e[t]=null,e)),{});return r(t)}resetData(){for(const[e,t]of Object.entries(this._fields))this._data[e]=t.default??null}resetErrors(e){Object.keys(this._errors).forEach((e=>delete this._errors[e])),e&&Object.assign(this._errors,e)}}function Gr(e){return new jr(e)}function Sr(e){return{default:e,type:kr.Boolean}}function Mr(e){return{default:e,type:kr.Boolean,rules:"required"}}function Cr(e){return{default:e,type:kr.Number,rules:"required"}}function Er(e){return{default:e,type:kr.String,rules:"required"}}function $r(e){return{default:e,type:kr.Number}}function Hr(e){return{default:e,type:kr.String}}export{ft as AGAlertModal,hr as AGAppLayout,mr as AGAppOverlays,vt as AGButton,br as AGCheckbox,_t as AGConfirmModal,vr as AGErrorMessage,Bt as AGErrorReportModalButtons,Ot as AGErrorReportModalTitle,xr as AGForm,ht as AGHeadlessButton,Ut as AGHeadlessInput,Nt as AGHeadlessInputError,Qt as AGHeadlessInputInput,Zt as AGHeadlessInputLabel,nt as AGHeadlessModal,it as AGHeadlessModalPanel,Yt as AGHeadlessModalTitle,Xt as AGHeadlessSnackbar,Ar as AGInput,gr as AGLink,Vt as AGLoadingModal,mt as AGMarkdown,dt as AGModal,at as AGModalContext,sr as AGSnackbar,Oe as App,Be as AppService,We as Colors,Ze as Errors,Le as Events,Re as EventsService,kr as FormFieldTypes,Fe as Lang,Ie as Service,er as SnackbarColors,Ue as UI,Ve as UIComponents,ce as arrayProp,Sr as booleanInput,de as booleanProp,De as bootServices,ar as bootstrapApplication,pe as componentRef,me as defineDirective,ue as definePlugin,He as defineServiceState,fe as enumProp,jt as errorReportModalProps,ge as injectOrFail,he as injectReactive,ve as injectReactiveOrFail,_e as mixedProp,$r as numberInput,be as numberProp,ye as objectProp,ot as onCleanMounted,xe as requiredArrayProp,Mr as requiredBooleanInput,we as requiredEnumProp,Ae as requiredMixedProp,Cr as requiredNumberInput,ke as requiredNumberProp,je as requiredObjectProp,Er as requiredStringInput,Ge as requiredStringProp,tr as snackbarProps,Hr as stringInput,Se as stringProp,Ne as translate,Ke as translateWithDefault,Gt as useErrorReportModalProps,rt as useEvent,Gr as useForm,st as useInputAttrs,rr as useSnackbarProps};
|
|
2
2
|
//# sourceMappingURL=aerogel-core.esm.js.map
|