maz-ui 3.47.2-beta.3 → 3.47.2-beta.4

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 (48) hide show
  1. package/components/MazChecklist.d.ts +1 -4
  2. package/components/MazChecklist.mjs +1 -1
  3. package/components/MazPhoneNumberInput.mjs +1 -1
  4. package/components/MazSelect.mjs +1 -1
  5. package/components/MazTable.mjs +1 -1
  6. package/components/assets/MazPhoneNumberInput.css +1 -1
  7. package/components/assets/MazSelect.css +1 -1
  8. package/components/chunks/{MazBtn-BMYXMZuX.mjs → MazBtn-C_BULYqZ.mjs} +2 -2
  9. package/components/chunks/{MazBtn-2VKM1wZu.mjs → MazBtn-Sj-Pq0YV.mjs} +2 -2
  10. package/components/chunks/{MazBtn-DfqRZvbB.mjs → MazBtn-cUQ1Tykp.mjs} +2 -2
  11. package/components/chunks/{MazBtn-BijEMn4r.mjs → MazBtn-psosbsi3.mjs} +2 -2
  12. package/components/chunks/{MazCheckbox-DMogZVHl.mjs → MazCheckbox-BBL0vgqe.mjs} +1 -1
  13. package/components/chunks/{MazCheckbox-Db6sPUbV.mjs → MazCheckbox-BTl370Qq.mjs} +1 -1
  14. package/components/chunks/{MazCheckbox-B22OcHt8.mjs → MazCheckbox-DTU2jEkC.mjs} +1 -1
  15. package/components/chunks/{MazChecklist-C95Y4Hb-.mjs → MazChecklist-CQv-sXP1.mjs} +79 -79
  16. package/components/chunks/{MazIcon-BF5TFzse.mjs → MazIcon-BdQtfzuy.mjs} +1 -1
  17. package/components/chunks/{MazInput-DC3S-CVu.mjs → MazInput-eOtg1L9F.mjs} +2 -2
  18. package/components/chunks/{MazInput-NE6H-10w.mjs → MazInput-geBqeT4i.mjs} +2 -2
  19. package/components/chunks/{MazLoadingBar-DdjHRC7g.mjs → MazLoadingBar-DHcYPXlE.mjs} +1 -1
  20. package/components/chunks/{MazPhoneNumberInput-BbssOUzo.mjs → MazPhoneNumberInput-BTm8A0bL.mjs} +33 -32
  21. package/components/chunks/{MazSelect-CDV9Fx6m.mjs → MazSelect-Cnz3p3n2.mjs} +41 -40
  22. package/components/chunks/{MazSelect-BJ07NVXQ.mjs → MazSelect-DOiqBTNY.mjs} +57 -56
  23. package/components/chunks/{MazSpinner-CykRbNHD.mjs → MazSpinner-B1PXhYRx.mjs} +1 -1
  24. package/components/chunks/{MazSpinner-CEFbkZkM.mjs → MazSpinner-B7tPZpHw.mjs} +1 -1
  25. package/components/chunks/{MazSpinner-Dmkr_r9u.mjs → MazSpinner-DOSj2BnX.mjs} +1 -1
  26. package/components/chunks/{MazSpinner-CfiIXW8y.mjs → MazSpinner-Dhg-s-9s.mjs} +1 -1
  27. package/components/chunks/{MazTable-BJDPdIJB.mjs → MazTable-BKdEx63E.mjs} +1 -1
  28. package/components/chunks/{MazTableCell-DILuUCTe.mjs → MazTableCell-CozcugiL.mjs} +1 -1
  29. package/components/chunks/{MazTableRow-D6H6-c8J.mjs → MazTableRow-bLFpjzu1.mjs} +1 -1
  30. package/components/chunks/{MazTableTitle-Ch-nyY1E.mjs → MazTableTitle-Qk239mu9.mjs} +1 -1
  31. package/modules/chunks/{MazBtn-R7z-Hxp-.cjs → MazBtn-D7el03Rl.cjs} +1 -1
  32. package/modules/chunks/{MazBtn-QVmZ90t5.mjs → MazBtn-D8uOirkn.mjs} +2 -2
  33. package/modules/chunks/{MazIcon-CKCoY05P.cjs → MazIcon-B8BoiF7R.cjs} +1 -1
  34. package/modules/chunks/{MazIcon-DJfEPmBG.mjs → MazIcon-C6zDSPgJ.mjs} +1 -1
  35. package/modules/chunks/{MazSpinner-DYT43E6e.cjs → MazSpinner-B-4tL9pK.cjs} +1 -1
  36. package/modules/chunks/{MazSpinner-C95OqwKl.mjs → MazSpinner-BvJydaeF.mjs} +1 -1
  37. package/modules/chunks/{index-CjsYU5rv.mjs → index-Bf4X7amE.mjs} +29 -23
  38. package/modules/chunks/index-F0B533E8.cjs +124 -0
  39. package/modules/index.cjs +1 -1
  40. package/modules/index.mjs +1 -1
  41. package/nuxt/index.json +1 -1
  42. package/package.json +1 -1
  43. package/types/components/MazChecklist.vue.d.ts +1 -4
  44. package/types/modules/composables/useFormValidator/types.d.ts +6 -6
  45. package/types/modules/composables/useFormValidator/useFormField.d.ts +2 -2
  46. package/types/modules/composables/useFormValidator/useFormValidator.d.ts +3 -3
  47. package/types/modules/composables/useFormValidator/utils.d.ts +5 -5
  48. package/modules/chunks/index-oVi9-l4o.cjs +0 -124
@@ -9,14 +9,14 @@ export type Validation = ValidationAsync;
9
9
  export type ValidationIssues = InferIssue<Validation>[];
10
10
  export type ExtractModelKey<T> = Extract<keyof T, string>;
11
11
  export type FormSchema<Model> = {
12
- [K in ExtractModelKey<Model> as Model[K] extends Required<Model>[K] ? K : never]: Validation;
12
+ [K in Extract<keyof Model, string> as Model[K] extends Required<Model>[K] ? K : never]: Validation;
13
13
  } & {
14
- [K in ExtractModelKey<Model> as Model[K] extends Required<Model>[K] ? never : K]?: Validation;
14
+ [K in Extract<keyof Model, string> as Model[K] extends Required<Model>[K] ? never : K]?: Validation;
15
15
  };
16
16
  export type CustomInstance<Model extends BaseFormPayload> = ComponentInternalInstance & {
17
17
  formContexts?: Map<string | symbol | InjectionKey<FormContext<Model>>, FormContext<Model>>;
18
18
  };
19
- export interface FormValidatorOptions<Model extends BaseFormPayload = BaseFormPayload, ModelKey extends ExtractModelKey<Model> = ExtractModelKey<Model>> {
19
+ export interface FormValidatorOptions<Model extends BaseFormPayload = BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>> {
20
20
  /**
21
21
  * Validation mode
22
22
  * - lazy: validate on input value change
@@ -53,7 +53,7 @@ export interface FormValidatorOptions<Model extends BaseFormPayload = BaseFormPa
53
53
  identifier?: string | symbol;
54
54
  }
55
55
  export type StrictOptions<Model extends BaseFormPayload = BaseFormPayload> = Required<FormValidatorOptions<Model>>;
56
- export interface FormContext<Model extends BaseFormPayload = BaseFormPayload, ModelKey extends ExtractModelKey<Model> = ExtractModelKey<Model>> {
56
+ export interface FormContext<Model extends BaseFormPayload = BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>> {
57
57
  fieldsStates: Ref<FieldsStates<Model>>;
58
58
  options: StrictOptions;
59
59
  internalSchema: Ref<FormSchema<Model>>;
@@ -61,7 +61,7 @@ export interface FormContext<Model extends BaseFormPayload = BaseFormPayload, Mo
61
61
  errorMessages: Ref<Record<ModelKey, string | undefined>>;
62
62
  isSubmitted: Ref<boolean>;
63
63
  }
64
- export interface FieldState<Model extends BaseFormPayload, FieldType = Model[ExtractModelKey<Model>]> {
64
+ export interface FieldState<Model extends BaseFormPayload, FieldType = Model[ExtractModelKey<FormSchema<Model>>]> {
65
65
  blurred: boolean;
66
66
  dirty: boolean;
67
67
  error: boolean;
@@ -105,5 +105,5 @@ export interface UseFormValidatorParams<Model extends BaseFormPayload> {
105
105
  model?: Ref<Partial<Model>>;
106
106
  options?: FormValidatorOptions<Model>;
107
107
  }
108
- export type UseFormField<FieldType extends Model[ExtractModelKey<Model>], Model extends BaseFormPayload = BaseFormPayload> = typeof useFormField<FieldType, Model>;
108
+ export type UseFormField<FieldType extends Model[ExtractModelKey<FormSchema<Model>>], Model extends BaseFormPayload = BaseFormPayload> = typeof useFormField<FieldType, Model>;
109
109
  export type InferFormValidatorSchema<T extends ObjectEntries | ObjectEntriesAsync | Ref<ObjectEntries> | Ref<ObjectEntriesAsync>> = InferOutput<ReturnType<typeof objectAsync<InferMaybeRef<T>>>>;
@@ -1,8 +1,8 @@
1
1
  import type { BaseFormPayload, ExtractModelKey, FormFieldOptions, FormSchema } from './types';
2
- export declare function useFormField<FieldType extends Model[ExtractModelKey<Model>], Model extends BaseFormPayload = BaseFormPayload>(name: ExtractModelKey<FormSchema<Model>>, options?: FormFieldOptions<FieldType>): {
2
+ export declare function useFormField<FieldType extends Model[ExtractModelKey<FormSchema<Model>>], Model extends BaseFormPayload = BaseFormPayload>(name: ExtractModelKey<FormSchema<Model>>, options?: FormFieldOptions<FieldType>): {
3
3
  hasError: import("vue").ComputedRef<boolean>;
4
4
  errors: import("vue").ComputedRef<import("./types").ValidationIssues>;
5
- errorMessage: import("vue").ComputedRef<Record<Extract<keyof Model, string>, string | undefined>[ExtractModelKey<FormSchema<Model>>]>;
5
+ errorMessage: import("vue").ComputedRef<Record<Extract<keyof { [K in Extract<keyof Model, string> as Model[K] extends Required<Model>[K] ? K : never]: import("./types").ValidationAsync; }, string> | Extract<keyof { [K_1 in Extract<keyof Model, string> as Model[K_1] extends Required<Model>[K_1] ? never : K_1]?: import("./types").ValidationAsync | undefined; }, string>, string | undefined>[ExtractModelKey<FormSchema<Model>>]>;
6
6
  isValid: import("vue").ComputedRef<boolean>;
7
7
  isDirty: import("vue").ComputedRef<boolean>;
8
8
  isBlurred: import("vue").ComputedRef<boolean>;
@@ -1,5 +1,5 @@
1
1
  import type { Ref } from 'vue';
2
- import type { BaseFormPayload, FieldsStates, FormValidatorOptions, UseFormValidatorParams } from './types';
2
+ import type { BaseFormPayload, ExtractModelKey, FieldsStates, FormSchema, FormValidatorOptions, UseFormValidatorParams } from './types';
3
3
  import { scrollToError } from './utils';
4
4
  export declare function useFormValidator<Model extends BaseFormPayload>({ schema, defaultValues, model, options }: UseFormValidatorParams<Model>): {
5
5
  identifier: string | symbol;
@@ -7,11 +7,11 @@ export declare function useFormValidator<Model extends BaseFormPayload>({ schema
7
7
  isSubmitting: Ref<boolean, boolean>;
8
8
  isSubmitted: Ref<boolean, boolean>;
9
9
  isValid: import("vue").ComputedRef<boolean>;
10
- errors: import("vue").ComputedRef<Record<Extract<keyof Model, string>, import("./types").ValidationIssues>>;
10
+ errors: import("vue").ComputedRef<Record<ExtractModelKey<FormSchema<Model>>, import("./types").ValidationIssues>>;
11
11
  model: Ref<Model, Model>;
12
12
  fieldsStates: Ref<FieldsStates<Model>, FieldsStates<Model>>;
13
13
  validateForm: (showErrors?: boolean) => Promise<void[]>;
14
14
  scrollToError: typeof scrollToError;
15
15
  handleSubmit: <Func extends (model: Model) => Promise<Awaited<ReturnType<Func>>> | ReturnType<Func>>(successCallback: Func, enableScrollOrSelector?: FormValidatorOptions["scrollToError"]) => (event?: Event) => Promise<ReturnType<Func> | undefined>;
16
- errorMessages: import("vue").ComputedRef<Record<Extract<keyof Model, string>, string | undefined>>;
16
+ errorMessages: import("vue").ComputedRef<Record<ExtractModelKey<FormSchema<Model>>, string | undefined>>;
17
17
  };
@@ -2,16 +2,16 @@ import type { InjectionKey } from 'vue';
2
2
  import type { BaseFormPayload, CustomInstance, ExtractModelKey, FieldsStates, FieldState, FormContext, FormFieldOptions, FormSchema, StrictOptions, ValidationIssues } from './index';
3
3
  export declare function fieldHasValidation<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>>>(field: ModelKey, schema: FormSchema<Model>): boolean;
4
4
  export declare function scrollToError(selector?: string): void;
5
- export declare function getErrorMessages<Model extends BaseFormPayload = BaseFormPayload, ModelKey extends ExtractModelKey<Model> = ExtractModelKey<Model>>(errors: Record<ModelKey, ValidationIssues>, fieldsStates: FieldsStates<Model>): Record<ModelKey, string | undefined>;
5
+ export declare function getErrorMessages<Model extends BaseFormPayload = BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>(errors: Record<ModelKey, ValidationIssues>, fieldsStates: FieldsStates<Model>): Record<ModelKey, string | undefined>;
6
6
  export declare function isEmptyValue(value: unknown): value is "" | null | undefined;
7
- export declare function getValidateFunction<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<Model> = ExtractModelKey<Model>>({ name, hasValidation, debouncedFields, throttledFields, }: {
7
+ export declare function getValidateFunction<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ name, hasValidation, debouncedFields, throttledFields, }: {
8
8
  name: ModelKey;
9
9
  hasValidation: boolean;
10
10
  debouncedFields?: StrictOptions<Model>['debouncedFields'];
11
11
  throttledFields?: StrictOptions<Model>['throttledFields'];
12
12
  }): ((args_0: {
13
13
  name: ExtractModelKey<FormSchema<Model>>;
14
- fieldState: FieldState<Model, Model[Extract<keyof Model, string>]>;
14
+ fieldState: FieldState<Model, Model[Extract<keyof { [K in Extract<keyof Model, string> as Model[K] extends Required<Model>[K] ? K : never]: import("./types").ValidationAsync; }, string> | Extract<keyof { [K_1 in Extract<keyof Model, string> as Model[K_1] extends Required<Model>[K_1] ? never : K_1]?: import("./types").ValidationAsync | undefined; }, string>]>;
15
15
  schema: FormSchema<Model>;
16
16
  payload: Model;
17
17
  setError?: boolean;
@@ -44,7 +44,7 @@ export declare function updateFieldState<Model extends BaseFormPayload, ModelKey
44
44
  options: FormFieldOptions<Model[ModelKey]> & StrictOptions<Model>;
45
45
  updateMode?: boolean;
46
46
  }): FieldState<Model>;
47
- export declare function getFieldsErrors<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<Model> = ExtractModelKey<Model>>(fieldsStates: FieldsStates<Model>): Record<ModelKey, ValidationIssues>;
47
+ export declare function getFieldsErrors<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>(fieldsStates: FieldsStates<Model>): Record<ModelKey, ValidationIssues>;
48
48
  export declare function findInteractiveElements(el: HTMLElement): (HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement)[];
49
49
  export declare function addEventToInteractiveElements({ interactiveElements, onBlurHandler, mode, }: {
50
50
  interactiveElements: HTMLElement[];
@@ -101,7 +101,7 @@ export declare function handleFieldInput<Model extends BaseFormPayload, ModelKey
101
101
  forceValidation?: boolean;
102
102
  }): Promise<void> | undefined;
103
103
  export declare function getInstance<Model extends BaseFormPayload>(composableName: string): CustomInstance<Model>;
104
- export declare function getContext<Model extends BaseFormPayload>(identifier: string | symbol | InjectionKey<FormContext<Model>>, composableName: string): FormContext<Model, Extract<keyof Model, string>>;
104
+ export declare function getContext<Model extends BaseFormPayload>(identifier: string | symbol | InjectionKey<FormContext<Model>>, composableName: string): FormContext<Model, Extract<keyof { [K in Extract<keyof Model, string> as Model[K] extends Required<Model>[K] ? K : never]: import("./types").ValidationAsync; }, string> | Extract<keyof { [K_1 in Extract<keyof Model, string> as Model[K_1] extends Required<Model>[K_1] ? never : K_1]?: import("./types").ValidationAsync | undefined; }, string>>;
105
105
  export declare function getValidationEvents<Model extends BaseFormPayload>({ ref, fieldState, onBlurHandler, }: {
106
106
  ref?: string;
107
107
  fieldState: FieldState<Model>;
@@ -1,124 +0,0 @@
1
- "use strict";require('../assets/index.css');var Ot=Object.defineProperty;var Dt=(o,e,t)=>e in o?Ot(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var m=(o,e,t)=>Dt(o,typeof e!="symbol"?e+"":e,t);const s=require("vue");function Q(o,e){const t=s.inject(o,e);if(!t)throw new TypeError(`[maz-ui](injectStrict) Could not resolve ${o}`);return t}function Vt(){return Q("aos")}function Bt(o){const e={};for(const[t,n]of Object.entries(o))e[t]=Number.parseInt(n,10);return e}function V(){return typeof document<"u"}function Ne(o={}){const{internalWindow:e=V()?window:void 0,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:n=Number.POSITIVE_INFINITY,includeScrollbar:r=!0}=o,i=s.ref(t),a=s.ref(n);function l(){e&&(r?(i.value=e.innerWidth,a.value=e.innerHeight):(i.value=e.document.documentElement.clientWidth,a.value=e.document.documentElement.clientHeight))}return l(),s.onMounted(()=>{e&&window.addEventListener("resize",l,{passive:!0})}),s.onUnmounted(()=>{e&&window.removeEventListener("resize",l)}),{width:i,height:a}}function Pt({initialWidth:o=0,initialHeight:e,includeScrollbar:t,internalWindow:n,listenOrientation:r,breakpoints:i,mediumBreakPoint:a="md",largeBreakPoint:l="lg"}){const{width:c}=Ne({initialWidth:o,initialHeight:e,includeScrollbar:t,internalWindow:n,listenOrientation:r}),u=Bt(i),h=s.computed(()=>c.value>=u[l]),g=s.computed(()=>c.value>=u[a]&&c.value<u[l]),w=s.computed(()=>c.value>=0&&c.value<u[a]);return{width:c,numericBreakpoints:u,isSmallScreen:w,isLargeScreen:h,isMediumScreen:g,breakpoints:i}}function Nt(){return Q("dialog")}function ke(o,e,t){const n={maxAttempts:20,interval:100,...t};let r=0;function i(){const a=o();a!=null?n.expectedValue!==void 0&&a!==n.expectedValue?r<n.maxAttempts?(r++,setTimeout(i,n.interval)):console.warn(n.errorMessage||`[maz-ui](checkAvailability) Nothing found after ${n.maxAttempts} attempts for ref ${a}`):e(a):r<n.maxAttempts?(r++,setTimeout(i,n.interval)):console.warn(n.errorMessage||`[maz-ui](checkAvailability) Nothing found or expected value after ${n.maxAttempts} attempts for ref ${a}`)}i()}function Me(o){const e=s.toValue(o);return Array.isArray(e)?Object.freeze([...e]):typeof e=="object"&&e!==null?Object.freeze({...e}):e}function Ae(o){return o==null||typeof o=="string"||typeof o=="number"||typeof o=="boolean"||typeof o=="symbol"||typeof o=="bigint"}function Mt(o,e){if(o.length!==e.length)return!1;for(const[t,n]of o.entries())if(!J(n,e[t]))return!1;return!0}function $t(o,e){const t=Object.keys(o),n=Object.keys(e);if(t.length!==n.length)return!1;for(const r of t)if(!n.includes(r)||!J(o[r],e[r]))return!1;return!0}function J(o,e){return Ae(o)||Ae(e)?o===e:o instanceof Date&&e instanceof Date?o.getTime()===e.getTime():typeof o!=typeof e||Array.isArray(o)!==Array.isArray(e)?!1:Array.isArray(o)&&Array.isArray(e)?Mt(o,e):typeof o=="object"&&typeof e=="object"?$t(o,e):!1}function Ht(o,e,t){const n={};return async function(...r){n[o]||(n[o]={timer:null,promise:null});const i=n[o];return i.timer&&clearTimeout(i.timer),i.promise=new Promise((a,l)=>{i.timer=setTimeout(async()=>{try{a(await e(...r))}catch(c){l(c)}finally{delete n[o]}},t)}),i.promise}}function Ft(o,e,t){const n={};return async(...r)=>{const i=Date.now();return n[o]||(n[o]={promise:null,lastCall:0,lastArgs:[]}),i-n[o].lastCall>=t?(n[o].lastCall=i,e(...r)):(n[o].lastArgs=r,n[o].promise||(n[o].promise=new Promise(a=>{setTimeout(async()=>{n[o].lastCall=Date.now();const l=await e(...n[o].lastArgs);n[o].promise=null,a(l)},t-(i-n[o].lastCall))})),n[o].promise)}}const H={mode:"lazy",scrollToErrorSelector:".has-field-error",debounceTime:300,throttleTime:1e3};function $e(o,e){return Object.keys(e).includes(o)}function Se(o=H.scrollToErrorSelector){const e=document.querySelector(o);e&&e.scrollIntoView({behavior:"smooth",block:"center"})}function qt(o,e){const t={};for(const[n,r]of Object.entries(o)){const i=r;t[n]=e[n].error&&i[0]?i[0].message:void 0}return t}function ze(o){return o==null||o===""}function jt({name:o,hasValidation:e,debouncedFields:t,throttledFields:n}){if(e){if(t!=null&&t[o]&&(n!=null&&n[o]))throw new Error(`The field "${o}" cannot be both debounced and throttled`);return t!=null&&t[o]?Ht(o,G,typeof t[o]=="number"?t[o]:H.debounceTime):n!=null&&n[o]?Ft(o,G,typeof n[o]=="number"?n[o]:H.throttleTime):G}}function He({name:o,schema:e,initialValue:t,fieldState:n,options:r}){const i=e?$e(o,e):!1,a=jt({name:o,hasValidation:i,debouncedFields:r==null?void 0:r.debouncedFields,throttledFields:r==null?void 0:r.throttledFields});return{blurred:!1,dirty:!1,errors:[],error:!1,valid:!i,validating:!1,validated:!1,initialValue:Me(t),validateFunction:a,mode:i?(r==null?void 0:r.mode)??(n==null?void 0:n.mode)??H.mode:void 0}}function Ut({schema:o,payload:e,options:t}){const n={};for(const r in o){const i=r;n[i]=He({name:i,schema:o,options:t,fieldState:n[i],initialValue:e==null?void 0:e[i]})}return n}function _t({fieldsStates:o,payload:e,schema:t,options:n,updateMode:r=!1}){for(const i in t){const a=i;o[a]=Fe({name:a,fieldState:o[a],payload:e,schema:t,options:n,updateMode:r})}}function Fe({name:o,fieldState:e,payload:t,schema:n,options:r,updateMode:i=!0}){const{initialValue:a,mode:l,...c}=He({name:o,schema:n,initialValue:r.defaultValue??t[o],fieldState:e,options:r}),u=i?l??e.mode??H.mode:e.mode;return{...e,initialValue:a,mode:u,...e!=null&&e.mode&&u!==e.mode?c:{}}}function Wt(o){const e={};for(const[t,{errors:n}]of Object.entries(o))e[t]=n;return e}function Rt(o){return o instanceof HTMLInputElement||o instanceof HTMLSelectElement||o instanceof HTMLTextAreaElement?[o]:o.querySelectorAll("input, select, textarea")}function Kt({interactiveElements:o,onBlurHandler:e,mode:t}){o.forEach(n=>{ee(["eager","blur","progressive"],t)&&n.addEventListener("blur",e)})}function Yt({interactiveElements:o,onBlurHandler:e}){o.forEach(t=>{t.removeEventListener("blur",e)})}async function Zt(o,e,t){const n=await to(e),i=await(await Ue("safeParseAsync"))(n.entries[o],t??"");return{result:i,isValid:i.success}}async function G({name:o,fieldState:e,schema:t,payload:n,setError:r=!0,setErrorIfInvalidAndNotEmpty:i=!1}){if(await s.nextTick(),e.validating=!0,!t[o]){e.valid=!0,e.validating=!1,e.validated=!0,e.errors=[],e.error=!1;return}const{result:a,isValid:l}=await Zt(o,t,n[o]);e.valid=l,(r||i&&!l&&!ze(n[o]))&&(e.error=!l),e.errors=a.issues??[],e.validating=!1,e.validated=!0}function qe({name:o,fieldState:e,payload:t,schema:n}){var i;const r={name:o,fieldState:e,payload:t,schema:n,setError:e.mode==="progressive"?e.valid||e.blurred:!0};return(i=e.validateFunction)==null?void 0:i.call(e,r)}function Xt({fieldsStates:o,payload:e,showErrors:t=!0,schema:n}){return Promise.all(Object.keys(o).map(r=>G({name:r,setError:t,fieldState:o[r],payload:e,schema:n,setErrorIfInvalidAndNotEmpty:o[r].mode==="lazy"})))}function je({eventName:o,fieldState:e,isSubmitted:t}){const{dirty:n,blurred:r,mode:i,valid:a}=e;return o==="blur"&&(ee(["lazy","aggressive"],i)||a)||o==="input"&&i==="blur"||!i?!1:t||i==="eager"&&r||i==="blur"&&r||i==="aggressive"&&n||i==="lazy"&&n||i==="progressive"}function Gt({name:o,force:e=!1,payload:t,fieldState:n,schema:r,isSubmitted:i}){const a=t[o],l=!ze(a)&&!J(a,n.initialValue);if(n.dirty=l,n.blurred=n.blurred||(n.mode==="eager"?l:!0),!!(e||je({eventName:"blur",fieldState:n,isSubmitted:i})))return qe({name:o,fieldState:n,schema:r,payload:t})}function Qt({name:o,payload:e,fieldState:t,schema:n,isSubmitted:r,forceValidation:i=!1}){const a=e[o];t.validated=!1;const l=!ze(a)&&!J(a,t.initialValue);if(t.dirty=l,!!(i||je({eventName:"input",fieldState:t,isSubmitted:r})))return qe({name:o,fieldState:t,schema:n,payload:e})}function Le(o){const e=s.getCurrentInstance();if(!e)throw new Error(`${o} must be called within setup()`);return e}function Jt(o,e){var r;const n=((r=Le(e).formContexts)==null?void 0:r.get(o))??s.inject(o);if(!n)throw new Error("useFormField must be used within a form (useFormValidator)");return n}function eo({ref:o,fieldState:e,onBlurHandler:t}){if(!(o||ee(["aggressive","lazy"],e.mode)))return{onBlur:t}}const ge={};async function Ue(o){if(ge[o])return ge[o];const e=await Promise.resolve().then(()=>require("./index-CXVZhyjw.cjs"));return ge[o]=e[o],e[o]}async function to(o){return(await Ue("objectAsync"))(o)}function ee(o,e){return e?o.includes(e):!1}function oo(o,e){const t={formIdentifier:"main-form-validator",...e},{fieldsStates:n,payload:r,options:i,internalSchema:a,errorMessages:l,isSubmitted:c}=Jt(t.formIdentifier,"useFormField"),u=$e(o,a.value)?(e==null?void 0:e.mode)??i.mode:void 0;t.mode=u;const h=s.computed(()=>n.value[o]);if(n.value[o]=Fe({name:o,fieldState:h.value,payload:r.value,schema:a.value,options:{...i,...t}}),t.defaultValue!==void 0&&!J(r.value[o],t.defaultValue)){const E=t.defaultValue;r.value[o]=E,n.value[o].initialValue=Me(E)}u&&G({name:o,fieldState:h.value,payload:r.value,schema:a.value,setError:u==="aggressive",setErrorIfInvalidAndNotEmpty:u==="lazy"});function g(){Gt({name:o,fieldState:h.value,payload:r.value,schema:a.value,isSubmitted:c.value})}const w=s.computed(()=>eo({ref:t.ref,onBlurHandler:g,fieldState:h.value}));if(t.ref&&ee(["eager","blur","progressive"],u)){let E=[];const O=k=>{E=Rt(k),Kt({interactiveElements:E,onBlurHandler:g,mode:u})};s.onMounted(()=>{const k=Le(`useFormField of ${o}`);ke(()=>k.refs[t.ref],d=>{const y=d instanceof HTMLElement?d:d==null?void 0:d.$el;y&&O(y)},{errorMessage:`[maz-ui](useFormField) No element found for ref ${t.ref} for field ${o}`})}),s.onUnmounted(()=>{Yt({interactiveElements:E,onBlurHandler:g})})}return{hasError:s.computed(()=>h.value.error),errors:s.computed(()=>h.value.errors),errorMessage:s.computed(()=>l.value[o]),isValid:s.computed(()=>h.value.valid),isDirty:s.computed(()=>h.value.dirty),isBlurred:s.computed(()=>h.value.blurred),isValidated:s.computed(()=>h.value.validated),isValidating:s.computed(()=>h.value.validating),mode:s.computed(()=>h.value.mode),value:s.computed({get:()=>r.value[o],set:E=>r.value[o]=E}),validationEvents:w}}function no({schema:o,defaultValues:e,model:t,options:n}){const r=Le("useFormValidator"),i={mode:H.mode,scrollToError:H.scrollToErrorSelector,debouncedFields:null,throttledFields:null,identifier:"main-form-validator",...n},a=s.ref(e),l=s.ref({...a.value,...t==null?void 0:t.value}),c=s.ref(o),u=s.ref(Ut({schema:c.value,payload:l.value,options:i})),h=s.ref(!1),g=s.ref(!1),w=s.computed(()=>Object.values(u.value).every(({valid:C})=>C)),E=s.computed(()=>Object.values(u.value).some(({dirty:C})=>C)),O=s.computed(()=>Wt(u.value)),k=s.computed(()=>qt(O.value,u.value));t&&s.watch(l,C=>{t.value={...a.value,...C}},{deep:!0}),s.watch(a,C=>{l.value={...C,...l.value}},{deep:!0}),s.watch(c,C=>{_t({schema:C,fieldsStates:u.value,payload:l.value,options:i}),d()},{deep:!0}),d();function d(C=i.mode==="aggressive"){return Xt({fieldsStates:u.value,payload:l.value,schema:c.value,showErrors:C})}const y=[];async function A(C){await s.nextTick();const S=s.watch(()=>l.value[C],()=>{const B=u.value[C];Qt({name:C,fieldState:B,payload:l.value,schema:c.value,isSubmitted:g.value,forceValidation:ee(["aggressive","lazy","progressive"],B.mode)})},{deep:typeof c.value[C]=="object"});y.push(S)}function v(){for(const C of y)C();for(const C of Object.keys(c.value))A(C)}function L(C,S){return async B=>{if(B==null||B.preventDefault(),h.value)return;g.value=!0,h.value=!0,await d(!0);const F=typeof S=="string"?S:i.scrollToError;let $;return w.value?$=await C(l.value):typeof F!="boolean"&&Se(F),h.value=!1,$}}const D={fieldsStates:u,payload:l,options:i,internalSchema:c,errorMessages:k,isSubmitted:g};return r.formContexts??(r.formContexts=new Map),r.formContexts.set(i.identifier,D),s.provide(i.identifier,D),v(),{identifier:i.identifier,isDirty:E,isSubmitting:h,isSubmitted:g,isValid:w,errors:O,model:l,fieldsStates:u,validateForm:d,scrollToError:Se,handleSubmit:L,errorMessages:k}}class _e{constructor(e,t){m(this,"defaultOptions",{element:void 0,timeout:60*1e3*5,once:!1,immediate:!0});m(this,"options");m(this,"timeoutHandler");m(this,"isIdle",!1);m(this,"isDestroy",!1);m(this,"startTime",0);m(this,"remainingTime",0);m(this,"lastClientX",-1);m(this,"lastClientY",-1);m(this,"eventNames",["DOMMouseScroll","mousedown","mousemove","mousewheel","MSPointerDown","MSPointerMove","keydown","touchmove","touchstart","wheel","click"]);m(this,"handleEvent",e=>{try{if(this.remainingTime>0)return;if(e.type==="mousemove"){const{clientX:t,clientY:n}=e;if(t===void 0&&n===void 0||t===this.lastClientX&&n===this.lastClientY)return;this.lastClientX=t,this.lastClientY=n}this.resetTimeout(),this.callback({isIdle:this.isIdle,eventType:e.type,instance:this})}catch(t){throw new Error(`[IdleTimeout](handleEvent) ${t}`)}});this.callback=e,this.options={...this.defaultOptions,...t},V()&&this.start()}get element(){return this.options.element??document.body}start(){if(!V()){console.warn("[IdleTimeout](start) you should run this method on client side");return}for(const e of this.eventNames)this.element.addEventListener(e,this.handleEvent);this.resetTimeout(),this.options.immediate&&this.callback({isIdle:!1,instance:this})}pause(){const e=this.startTime+this.options.timeout-Date.now();e<=0||(this.remainingTime=e,this.timeoutHandler&&(clearTimeout(this.timeoutHandler),this.timeoutHandler=void 0))}resume(){this.remainingTime<=0||(this.resetTimeout(),this.callback({isIdle:this.isIdle,instance:this}),this.remainingTime=0)}reset(){this.isDestroy=!1,this.isIdle=!1,this.remainingTime=0,this.resetTimeout(),this.callback({isIdle:this.isIdle,instance:this})}destroy(){if(!V()){console.warn("[IdleTimeout](destroy) you should run this method on client side");return}this.isDestroy=!0;for(const e of this.eventNames)this.element.removeEventListener(e,this.handleEvent);this.timeoutHandler&&clearTimeout(this.timeoutHandler)}resetTimeout(){this.isIdle=!1,this.timeoutHandler&&(clearTimeout(this.timeoutHandler),this.timeoutHandler=void 0),this.timeoutHandler=setTimeout(this.handleTimeout.bind(this),this.remainingTime||this.options.timeout),this.startTime=Date.now()}handleTimeout(){this.isIdle=!0,this.callback({isIdle:this.isIdle,instance:this}),this.options.once&&this.destroy()}get destroyed(){return this.isDestroy}get timeout(){return this.options.timeout}set timeout(e){this.options.timeout=e}get idle(){return this.isIdle}set idle(e){e?this.handleTimeout():this.reset(),this.callback({isIdle:this.isIdle,instance:this})}}function so({callback:o,options:e}){return new _e(o,e)}function ro({componentName:o,providedId:e}){const t=s.useId();return s.computed(()=>e??`${o}-${t}`)}const We=["af-ZA","sq-AL","ar-DZ","ar-BH","ar-EG","ar-IQ","ar-JO","ar-KW","ar-LB","ar-LY","ar-MA","ar-OM","ar-QA","ar-SA","ar-SY","ar-TN","ar-AE","ar-YE","hy-AM","Cy-az-AZ","Lt-az-AZ","eu-ES","be-BY","bg-BG","ca-ES","zh-CN","zh-HK","zh-MO","zh-SG","zh-TW","zh-CHS","zh-CHT","hr-HR","cs-CZ","da-DK","div-MV","nl-BE","nl-NL","en-AU","en-BZ","en-CA","en-CB","en-IE","en-JM","en-NZ","en-PH","en-ZA","en-TT","en-GB","en-US","en-ZW","et-EE","fo-FO","fa-IR","fi-FI","fr-BE","fr-CA","fr-FR","fr-LU","fr-MC","fr-CH","gl-ES","ka-GE","de-AT","de-DE","de-LI","de-LU","de-CH","el-GR","gu-IN","he-IL","hi-IN","hu-HU","is-IS","id-ID","it-IT","it-CH","ja-JP","kn-IN","kk-KZ","kok-IN","ko-KR","ky-KZ","lv-LV","lt-LT","mk-MK","ms-BN","ms-MY","mr-IN","mn-MN","nb-NO","nn-NO","pl-PL","pt-BR","pt-PT","pa-IN","ro-RO","ru-RU","sa-IN","Cy-sr-SP","Lt-sr-SP","sk-SK","sl-SI","es-AR","es-BO","es-CL","es-CO","es-CR","es-DO","es-EC","es-SV","es-GT","es-HN","es-MX","es-NI","es-PA","es-PY","es-PE","es-PR","es-ES","es-UY","es-VE","sw-KE","sv-FI","sv-SE","syr-SY","ta-IN","tt-RU","te-IN","th-TH","tr-TR","uk-UA","ur-PK","Cy-uz-UZ","Lt-uz-UZ","vi-VN"];function io(o,e){return s.computed(()=>{const t=s.toValue(e),n=s.toValue(o);try{return!t||!n?n:new Intl.DisplayNames([t],{type:"language"}).of(n)||n}catch{return n}})}function ao(o){return s.computed(()=>{const e=s.toValue(o);if(!e)return[];const t=65,n=90,r=new Intl.DisplayNames([e],{type:"language"}),i=[];for(let a=t;a<=n;++a)for(let l=t;l<=n;++l){const c=String.fromCodePoint(a)+String.fromCodePoint(l),u=r.of(c);u&&c.toLocaleLowerCase()!==u.toLocaleLowerCase()&&i.push({language:u,code:c})}return i})}function lo(o){return s.computed(()=>{const e=s.toValue(o);if(!e)return[];const t=new Intl.DisplayNames([e],{type:"language"});return We.map(n=>{try{const r=t.of(n);return!r||n.toLocaleLowerCase()===r.toLocaleLowerCase()?void 0:{language:r,code:n}}catch{return}}).filter(Boolean)})}function uo(o){return{getLanguageDisplayName:({isoCode:e,locale:t})=>io(e,t||o),getAllPossibleLanguages:e=>ao(e||o),getLanguageDisplayNamesForIsoCodes:e=>lo(e||o)}}function Re(o){const e=o.join(", ").match(/\b\w+\b/g);return e?e.length:0}function co(o,e=150){const t=Re([o]);return Math.ceil(t/e)}function mo(o){const e=s.computed(()=>{var a;return typeof o.velocity=="number"?o.velocity:((a=o.velocity)==null?void 0:a.value)??150}),t=s.computed(()=>{var a;return typeof o.contentSelector=="string"?o.contentSelector:(a=o.contentSelector)==null?void 0:a.value}),n=s.computed(()=>{var a,l,c;if(typeof((a=o.contentRef)==null?void 0:a.value)=="object")return(l=o.contentRef.value)==null?void 0:l.textContent;if(t.value&&typeof document<"u"){const u=document.querySelector(t.value);if(u)return u.textContent}return typeof o.content=="string"?o.content:(c=o.content)==null?void 0:c.value}),r=s.computed(()=>co(n.value,e.value)),i=s.computed(()=>Re([n.value]));return{content:n,wordCount:i,velocity:e,duration:r}}const fo={removeAccents:!0,caseSensitive:!1,replaceSpaces:!0,removeSpecialCharacters:!1,trim:!0,normalizeSpaces:!0,removeNumbers:!1,customNormalizationForms:["NFC","NFKD"]};function we(o,e){const t={...fo,...e},n={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Î:"I",Ï:"I",í:"I",î:"i",ï:"i",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ç:"C",ç:"c",ÿ:"y",Ñ:"N",ñ:"n",ó:"o"};let r=o.toString();if(t.trim&&(r=r.trim()),t.normalizeSpaces&&(r=r.replaceAll(/\s+/g," ")),t.replaceSpaces&&(r=r.replaceAll(" ","-")),t.removeNumbers&&(r=r.replaceAll(/\d/g,"")),t.removeAccents&&(r=r.replaceAll(/[ÀÁÂÃÄÅÇÈÉÊËÎÏÑÔÕÖØÙÚÛÜàáâãäåçèéêëíîïñóôõöøùúûüÿ]/g,i=>n[i]||i),r=r.replaceAll(/[\u0300-\u036F]/g,"")),t.caseSensitive===!1&&(r=r.toLowerCase()),t.removeSpecialCharacters&&(r=r.replaceAll(/[^\dA-Z-]/gi,"")),t.trim&&(r=r.trim()),t.customNormalizationForms)for(const i of t.customNormalizationForms)r=r.normalize(i);return r}function ho(o,e){const t=o.length,n=e.length,r=[];for(let i=0;i<=t;i++)r[i]=[i];for(let i=0;i<=n;i++)r[0][i]=i;for(let i=1;i<=t;i++)for(let a=1;a<=n;a++){const l=o[i-1]===e[a-1]?0:1;r[i][a]=Math.min(r[i-1][a]+1,r[i][a-1]+1,r[i-1][a-1]+l)}return r[t][n]}function Ke(o,e){const t=ho(o,e),n=Math.max(o.length,e.length);return 1-t/n}function vo(o,e,t=.75){return Ke(o,e)>=t}function po(o,e,t=.75){const n=s.computed(()=>we(typeof o=="string"?o:o.value)),r=s.computed(()=>we(typeof e=="string"?e:e.value)),i=s.computed(()=>typeof t=="number"?t:t.value),a=s.computed(()=>Ke(n.value,r.value));return{isMatching:s.computed(()=>vo(n.value,r.value,i.value)),score:a}}const go={preventDefaultOnTouchMove:!1,preventDefaultOnMouseWheel:!1,threshold:50,immediate:!1,triggerOnEnd:!1};class Ye{constructor(e){m(this,"element");m(this,"xStart");m(this,"yStart");m(this,"xEnd");m(this,"yEnd");m(this,"xDiff");m(this,"yDiff");m(this,"onToucheStartCallback");m(this,"onToucheMoveCallback");m(this,"onToucheEndCallback");m(this,"onMouseWheelCallback");m(this,"start");m(this,"stop");m(this,"options");this.inputOption=e,this.options={...go,...e},this.onToucheStartCallback=this.toucheStartHandler.bind(this),this.onToucheMoveCallback=this.handleTouchMove.bind(this),this.onToucheEndCallback=this.handleTouchEnd.bind(this),this.onMouseWheelCallback=this.handleMouseWheel.bind(this),this.start=this.startListening.bind(this),this.stop=this.stopListening.bind(this),this.options.element&&this.setElement(this.options.element),this.options.immediate&&this.start()}startListening(){this.setElement(this.options.element),this.element.addEventListener("touchstart",this.onToucheStartCallback,{passive:!0}),this.element.addEventListener("touchmove",this.onToucheMoveCallback,{passive:!0}),this.options.triggerOnEnd&&this.element.addEventListener("touchend",this.onToucheEndCallback,{passive:!0}),this.options.preventDefaultOnMouseWheel&&this.element.addEventListener("mousewheel",this.onMouseWheelCallback,{passive:!1})}stopListening(){this.element.removeEventListener("touchstart",this.onToucheStartCallback),this.element.removeEventListener("touchmove",this.onToucheMoveCallback),this.element.removeEventListener("touchend",this.onToucheEndCallback),this.options.preventDefaultOnMouseWheel&&this.element.removeEventListener("mousewheel",this.onMouseWheelCallback)}setElement(e){if(!e){console.error("[maz-ui][SwipeHandler](setElement) Element should be provided. Its can be a string selector or an HTMLElement");return}if(typeof e=="string"){const t=document.querySelector(e);if(!(t instanceof HTMLElement)){console.error("[maz-ui][SwipeHandler](setElement) String selector for element is not found");return}this.element=t}else this.element=e}handleMouseWheel(e){e.preventDefault()}toucheStartHandler(e){this.xStart=e.touches[0].clientX,this.yStart=e.touches[0].clientY,this.emitValuesChanged()}emitValuesChanged(){var e,t;(t=(e=this.options).onValuesChanged)==null||t.call(e,{xStart:this.xStart,yStart:this.yStart,xEnd:this.xEnd,yEnd:this.yEnd,xDiff:this.xDiff,yDiff:this.yDiff})}handleTouchMove(e){this.options.preventDefaultOnTouchMove&&e.cancelable&&e.preventDefault(),this.xEnd=e.touches[0].clientX,this.yEnd=e.touches[0].clientY,!(!this.xStart||!this.yStart)&&(this.xDiff=this.xStart-this.xEnd,this.yDiff=this.yStart-this.yEnd,this.emitValuesChanged(),this.options.triggerOnEnd||this.runCallbacks(e))}handleTouchEnd(e){this.runCallbacks(e),this.emitValuesChanged()}runCallbacks(e){var t,n,r,i,a,l,c,u;typeof this.xDiff!="number"||typeof this.yDiff!="number"||Math.abs(this.xDiff)<this.options.threshold&&Math.abs(this.yDiff)<this.options.threshold||(Math.abs(this.xDiff)>Math.abs(this.yDiff)?this.xDiff>0?(n=(t=this.options).onLeft)==null||n.call(t,e):(i=(r=this.options).onRight)==null||i.call(r,e):this.yDiff>0?(l=(a=this.options).onUp)==null||l.call(a,e):(u=(c=this.options).onDown)==null||u.call(c,e),this.resetValues())}resetValues(){this.xStart=void 0,this.yStart=void 0,this.xEnd=void 0,this.yEnd=void 0,this.xDiff=void 0,this.yDiff=void 0,this.emitValuesChanged()}}function yo(o){const e=s.ref(),t=s.ref(),n=s.ref(),r=s.ref(),i=s.ref(),a=s.ref(),l=s.computed(()=>s.toValue(o.element)),c=new Ye({...o,element:l.value,onValuesChanged(u){e.value=u.xDiff,t.value=u.yDiff,n.value=u.xStart,r.value=u.xEnd,i.value=u.yStart,a.value=u.yEnd}});return{xDiff:e,yDiff:t,xStart:n,xEnd:r,yStart:i,yEnd:a,start:()=>{l.value&&(c.options.element=l.value),c.start()},stop:c.stop}}const bo={darkClass:"dark",lightClass:"light",storageThemeKey:"theme",storageThemeValueDark:"dark",storageThemeValueLight:"light",storageThemeValueSystem:"system",watchChanges:!0},te=s.ref("system"),M=s.ref("system");function xe(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function oe({darkClass:o,lightClass:e,storageThemeKey:t,storageThemeValueDark:n,setLocalStorageValue:r=!0,setSelectedTheme:i=!0}){V()&&(document.documentElement.classList.remove(e),document.documentElement.classList.add(o),te.value=n,i&&(M.value=n),r&&(localStorage[t]=n))}function ne({darkClass:o,lightClass:e,storageThemeKey:t,storageThemeValueLight:n,setLocalStorageValue:r=!0,setSelectedTheme:i=!0}){V()&&(document.documentElement.classList.remove(o),document.documentElement.classList.add(e),te.value=n,i&&(M.value=n),r&&(localStorage[t]=n))}function Ze({setLocalStorageValue:o=!0,...e}){if(V())return document.documentElement.classList.remove(e.darkClass),document.documentElement.classList.remove(e.lightClass),te.value=e.storageThemeValueSystem,M.value=e.storageThemeValueSystem,o&&(localStorage[e.storageThemeKey]=e.storageThemeValueSystem),Ee(e)}function Xe(o){if(!o.defaultTheme)return console.error("[maz-ui](useThemeHandler) No default theme set");if(!["light","dark"].includes(o.defaultTheme))return console.error('[maz-ui](useThemeHandler) Default theme must be "light" or "dark"');switch(o.defaultTheme){case"dark":return oe({...o,setLocalStorageValue:!1,setSelectedTheme:!0});case"light":return ne({...o,setLocalStorageValue:!1,setSelectedTheme:!0})}}function Ee(o){return V()?!localStorage[o.storageThemeKey]&&o.defaultTheme?Xe(o):localStorage[o.storageThemeKey]===o.storageThemeValueDark||!localStorage[o.storageThemeKey]&&xe()||localStorage[o.storageThemeKey]===o.storageThemeValueSystem&&xe()?oe({...o,setLocalStorageValue:!1,setSelectedTheme:!1}):ne({...o,setLocalStorageValue:!1,setSelectedTheme:!1}):void 0}function ye({theme:o,...e}){return o==="system"?Ze(e):o==="dark"?oe(e):ne(e)}function wo(o){return te.value===o.storageThemeValueDark?ne(o):oe(o)}function Eo(o){const e={...bo,...o};function t(){Ee(e)}return s.onMounted(()=>{localStorage[e.storageThemeKey]&&(M.value=localStorage[e.storageThemeKey]),e.watchChanges&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",t)}),s.onBeforeUnmount(()=>{e.watchChanges&&window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",t)}),s.watch(M,n=>{switch(localStorage[e.storageThemeKey]=n,n){case e.storageThemeValueDark:{oe(e);break}case e.storageThemeValueLight:{ne(e);break}case e.storageThemeValueSystem:{Ze(e);break}}}),{autoSetTheme:()=>Ee(e),toggleTheme:()=>wo(e),setSystemTheme:()=>ye({...e,theme:"system"}),setDarkTheme:()=>ye({...e,theme:"dark"}),setLightTheme:()=>ye({...e,theme:"light"}),setDefaultTheme:()=>Xe(e),hasDarkTheme:s.computed(()=>M.value===e.storageThemeValueDark),hasLightTheme:s.computed(()=>M.value===e.storageThemeValueLight),hasSystemTheme:s.computed(()=>M.value===e.storageThemeValueSystem),theme:te,selectedTheme:M}}function Ge({timeout:o=1e3,callback:e,remainingTimeUpdate:t=200,callbackOffsetTime:n=0}){const r=s.ref(o),i=s.ref(o);let a;function l(w){typeof w=="number"&&(i.value=w),typeof w=="number"&&(r.value=w),c()}function c(){a||(a=setInterval(()=>{i.value-=t,i.value<=0&&(g(),setTimeout(()=>e==null?void 0:e(),n))},t))}function u(){a&&(clearInterval(a),a=void 0)}function h(){!a&&i.value>0&&c()}function g(){setTimeout(()=>i.value=r.value,n*2),u()}return{remainingTime:i,start:l,pause:u,resume:h,stop:g}}function Co(){return Q("toast")}class Qe{constructor(e,t){m(this,"eventHandlerFunction");m(this,"event","visibilitychange");m(this,"timeoutHandler");m(this,"options");m(this,"defaultOptions",{timeout:5e3,once:!1,immediate:!0});m(this,"isVisible",!1);this.callback=e,this.options={...this.defaultOptions,...t},this.eventHandlerFunction=this.eventHandler.bind(this),V()&&this.start()}start(){if(!V()){console.warn("[UserVisibility](start) you should run this method on client side");return}this.options.immediate&&this.emitCallback(),this.addEventListener()}emitCallback(){this.isVisible=document.visibilityState==="visible",this.callback({isVisible:this.isVisible}),this.options.once&&this.destroy()}eventHandler(){document.visibilityState==="visible"&&!this.isVisible?(this.clearTimeout(),this.emitCallback()):document.visibilityState==="hidden"&&this.initTimeout()}clearTimeout(){this.timeoutHandler&&(clearTimeout(this.timeoutHandler),this.timeoutHandler=void 0)}initTimeout(){this.clearTimeout(),this.timeoutHandler=setTimeout(this.emitCallback.bind(this),this.options.timeout)}addEventListener(){document.addEventListener(this.event,this.eventHandlerFunction)}removeEventListener(){document.removeEventListener(this.event,this.eventHandlerFunction)}destroy(){this.removeEventListener(),this.timeoutHandler&&clearTimeout(this.timeoutHandler)}}function To({callback:o,options:e}){return new Qe(o,e)}function ko(){return Q("wait")}const ce="__maz-click-outside__";function Je(){return document.ontouchstart===null?"touchstart":"click"}async function et(o,e){try{tt(o);const t=e.instance,n=e.value,r=typeof n=="function";if(!r)throw new Error("[maz-ui](vClickOutside) the callback should be a function");await s.nextTick(),o[ce]=a=>{if((!o||a.target&&!o.contains(a.target))&&n&&r)return n.call(t,a)};const i=Je();document.addEventListener(i,o[ce],{passive:!0})}catch(t){console.error("[maz-ui](vClickOutside)",t)}}function tt(o){try{const e=Je();document.removeEventListener(e,o[ce],!1),delete o[ce]}catch(e){console.error("[maz-ui](vClickOutside)",e)}}function zo(o,e){try{if(e.value===e.oldValue)return;et(o,e)}catch(t){console.error("[maz-ui](vClickOutside)",t)}}const ot={mounted:et,updated:zo,unmounted:tt},nt={install:o=>{o.directive("click-outside",ot)}};function st(o,e,t){var a;o.stopPropagation();const n=typeof t.value=="function"?t.value:t.value.handler,r=typeof t.value=="object"?t.value.exclude:void 0;let i=!1;if(r&&r.length>0){for(const l of r)if(!i&&o.target instanceof HTMLElement){const c=(a=document.querySelector(l))==null?void 0:a.getAttribute("id");i=o.target.getAttribute("id")===c}}!e.contains(o.target)&&!i&&(n==null||n())}function rt(){return document.ontouchstart===null?"touchstart":"click"}function Lo(o,e){const t=rt();document.removeEventListener(t,n=>st(n,o,e))}function Io(o,e){if(typeof e.value!="function"&&typeof e.value=="object"&&typeof e.value.handler!="function"){console.error("[maz-ui](vClosable) v-closable directive requires a handler function");return}const t=rt();document.addEventListener(t,n=>st(n,o,e))}const it={mounted:Io,unmounted:Lo},at={install:o=>{o.directive("closable",it)}},Ce={position:"top"};class lt{constructor(e={}){m(this,"options");this.options={...Ce,...e}}getPosition({modifiers:e,value:t}){return e.top?"top":e.bottom?"bottom":e.left?"left":e.right?"right":typeof t=="string"?"top":t.position??this.options.position}getText({value:e}){return typeof e=="string"?e:e.text}getOpen({value:e}){return typeof e=="string"?!1:e.open??!1}getColor({value:e}){return typeof e=="string"?"default":e.color??"default"}create(e,t){e.setAttribute("data-tooltip",this.getText(t)),e.classList.add("m-tooltip");const n=this.getPosition(t);e.classList.add(`m-tooltip--${n}`),e.classList.add(`m-tooltip--${this.getColor(t)}`),this.getOpen(t)&&e.classList.add("m-tooltip--open")}update(e,t){this.remove(e,t),this.create(e,t)}remove(e,t){e.removeAttribute("data-tooltip"),e.classList.remove("m-tooltip"),e.classList.remove("m-tooltip--top"),e.classList.remove("m-tooltip--bottom"),e.classList.remove("m-tooltip--left"),e.classList.remove("m-tooltip--right"),e.classList.remove("m-tooltip--open"),e.classList.remove(`m-tooltip--${this.getColor(t)}`)}}let ie;const Ao={beforeMount(o,e){const t=typeof e.value=="object"?e.value:{};return ie=new lt(t),ie.create(o,e)},updated(o,e){return ie.update(o,e)},unmounted(o,e){return ie.remove(o,e)}},ut={install:(o,e=Ce)=>{const t={...Ce,...e},n=new lt(t);o.directive("tooltip",{beforeMount:n.create.bind(n),updated:n.update.bind(n),unmounted:n.remove.bind(n)})}};function de(o,e){let t=e==null?void 0:e.element;function n(){t&&s.render(null,t)}const r={...e==null?void 0:e.props,...e!=null&&e.addDestroyInProps?{destroy:n}:{}},i=s.createVNode(o,r,e==null?void 0:e.children);return e!=null&&e.app?(i.appContext=e.app._context,t?s.render(i,t):typeof document<"u"&&(t=document.createElement("div"),s.render(i,t))):(t=t??document.body,s.render(i,t)),{vNode:i,destroy:n,el:t}}function ct(o){return!!o}function So(o){return[...o].map(e=>{const t=e.codePointAt(0);return t?t%32+127461:void 0}).filter(ct).map(e=>String.fromCodePoint(e)).join("")}function xo(o,e){let t;return function(...n){clearTimeout(t),t=setTimeout(()=>{o.apply(this,n)},e)}}class Oo{constructor({src:e,identifier:t,once:n=!0,async:r=!0,defer:i=!0}){m(this,"src");m(this,"script");m(this,"once");m(this,"async");m(this,"defer");m(this,"identifier");if(typeof window>"u")throw new TypeError("[ScriptLoader]: Is supported only on browser side");if(!e)throw new Error('[ScriptLoader]: You should provide the attribut "src"');if(!t)throw new Error('[ScriptLoader]: You should provide the attribut "identifier"');this.src=e,this.identifier=t,this.once=n,this.async=r,this.defer=i}removeTag(e){var t;typeof e=="string"?(t=document.head.querySelector(`[data-identifier="${e}"]`))==null||t.remove():e.remove()}load(){const e=window,t=document.head.querySelectorAll(`[data-identifier="${this.identifier}"]`);if(this.once&&e[this.identifier]&&t.length>0)return this.script=e[this.identifier],Promise.resolve(this.script);if(!this.once&&t.length>0)for(const n of t)this.removeTag(n);return this.injectScript()}injectScript(){const e=window;return new Promise((t,n)=>{try{const r=document.createElement("script");r.src=this.src,r.async=this.async,r.defer=this.defer,r.dataset.identifier=this.identifier,r.addEventListener("error",i=>n(new Error(`[ScriptLoader](injectScript) ${i.message}`))),r.addEventListener("load",i=>(this.script=i,e[this.identifier]=i,t(i))),document.head.append(r)}catch(r){throw new Error(`[ScriptLoader](init) ${r}`)}})}}function dt(o){return new Promise(e=>setTimeout(e,o))}function Do(o,e){let t=!1,n,r;return function(...i){t?(clearTimeout(n),n=setTimeout(()=>{Date.now()-r>=e&&(o.apply(this,i),r=Date.now())},Math.max(e-(Date.now()-r),0))):(o.apply(this,i),r=Date.now(),t=!0)}}const Vo=["onKeypress"],Bo={class:"m-fullscreen-img-scroller"},Po=["src","alt"],No=s.defineComponent({__name:"MazFullscreenImg",props:{src:{},clickedElementBounds:{default:void 0},offset:{default:void 0},animation:{default:()=>({duration:300,easing:"ease-in-out"})},openInstanceClass:{default:"m-fullscreen-img-instance"},clickedElement:{},destroy:{type:Function,default:void 0},alt:{default:void 0},zoom:{type:Boolean,default:!0}},emits:["close","previous","next","before-close"],setup(o,{emit:e}){const t=o,n=e,r=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./MazSpinner-DYT43E6e.cjs"))),i=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./x-mark-DW2WXkoF.cjs"))),a=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./chevron-left-Byr9GkwI.cjs"))),l=s.ref(!1),c=s.ref(!1),u=s.ref(!1),h=s.ref(!1),g=s.ref(!1),w=s.reactive({running:!1,ended:!1}),E=s.ref(t.clickedElement),O=s.computed(()=>t.clickedElement.getBoundingClientRect()),k=s.ref(),d=s.ref(t.src),y=s.ref(t.alt),A=s.ref(),v=s.ref(),L=s.ref(!0),D=s.computed(()=>({"--is-zoomed":g.value,"--invisible":L.value,"--absolute":!g.value}));function C(){var p,b;v.value&&(k.value=((p=v.value)==null?void 0:p.naturalWidth)>((b=v.value)==null?void 0:b.naturalHeight)),l.value=!0,c.value=!1,u.value=!0}s.watch(u,async p=>{p&&z()},{immediate:!0});function S(){n("before-close"),I()}function B(p){p.key==="Escape"&&(p.preventDefault(),S()),(p.key==="ArrowLeft"||p.key==="ArrowRight")&&(p.preventDefault(),K(p.key==="ArrowRight"?"next":"previous"))}function F(){document.documentElement.classList.add("--m-fullscreen-open")}function $(){document.documentElement.classList.remove("--m-fullscreen-open")}function W(){return[...document.querySelectorAll(".m-fullscreen-img-instance")]}function fe(p,b){return b<0?p.length-1:b>=p.length?0:b}async function R(p,b){p.classList.remove(t.openInstanceClass),b.classList.add(t.openInstanceClass);const T=b.getAttribute("data-src"),x=b.getAttribute("data-alt");y.value=x,d.value=T??d.value}function K(p){L.value=!0;const b=document.querySelector(`.m-fullscreen-img-instance.${t.openInstanceClass}`);if(b){const T=W(),x=T.indexOf(b),P=p==="next"?x+1:x-1,N=T[fe(T,P)];E.value=N,N&&R(b,N),n(p),l.value=!1,c.value=!0,ke(()=>l.value===!0,()=>{L.value=!1,g.value?Y():f()},{expectedValue:!0,interval:100,maxAttempts:50})}}function Y(){const p=v.value;if(!p){console.error("[maz-ui](vFullscreenImg) ImgElement is not defined");return}p.style.removeProperty("max-width"),p.style.removeProperty("max-height"),p==null||p.style.removeProperty("top"),p==null||p.style.removeProperty("left"),k.value?(p.style.height="100vh",p.style.removeProperty("width")):(p.style.width="100vw",p.style.removeProperty("height"))}async function he(){g.value?(g.value=!g.value,f()):(g.value=!g.value,Y())}function q(p){var T;w.running=!0,L.value=!1;const b=(T=v.value)==null?void 0:T.animate(p,{duration:t.animation.duration,easing:t.animation.easing});if(!b){console.error("[maz-ui](vFullscreenImg) animation is not defined"),w.running=!1,w.ended=!0;return}return b}function se(p=t.offset??0){const b=E.value.clientWidth||1,T=E.value.clientHeight||1,x=window.innerWidth,P=window.innerHeight,N=Math.min((x-2*p)/b,(P-2*p)/T),ve=(x-b*N)/2,pe=(P-T*N)/2;return{centerX:ve,centerY:pe,width:b,height:T,scale:N}}function re({trigger:p}){const{width:b,height:T,scale:x,centerX:P,centerY:N}=se(),{top:ve,left:pe,width:St,height:xt}=O.value,Ie=[{top:`${ve}px`,left:`${pe}px`,width:`${St}px`,height:`${xt}px`,opacity:0},{top:`${N}px`,left:`${P}px`,width:`${b*x}px`,height:`${T*x}px`,opacity:1}];return{frames:p==="open"?Ie:Ie.reverse()}}function f(){const{height:p,width:b,scale:T}=se(),x=k.value?{width:`${b*T}px`,maxHeight:`${p*T}px`}:{height:`${p*T}px`,maxWidth:`${b*T}px`};if(!v.value){console.error("[maz-ui](vFullscreenImg) ImgElement is not defined");return}k.value?(v.value.style.removeProperty("height"),v.value.style.removeProperty("maxHeight")):(v.value.style.removeProperty("width"),v.value.style.removeProperty("maxWidth")),Object.assign(v.value.style,x)}function z(){const{frames:p}=re({trigger:"open"}),b=q(p);if(!b){console.error("[maz-ui](vFullscreenImg) open animation is not defined"),f();return}b.onfinish=()=>{f(),w.running=!1,w.ended=!0}}function I(){const{frames:p}=re({trigger:"close"}),b=q(p);function T(){var x,P;n("close"),(x=A.value)==null||x.remove(),(P=t.destroy)==null||P.call(t),w.running=!1,w.ended=!0}if(!b){console.error("[maz-ui](vFullscreenImg) close animation is not defined"),T();return}b.onfinish=T}function Z(){g.value||f()}return s.onMounted(()=>{c.value=!0,document.addEventListener("keydown",B),window.addEventListener("resize",Z),F(),h.value=W().length>1}),s.onBeforeUnmount(()=>{document.removeEventListener("keydown",B),window.removeEventListener("resize",Z),$()}),(p,b)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"FullscreenImgElement",ref:A,role:"button",class:"m-fullscreen-img",tabindex:"0",onClick:s.withModifiers(S,["stop"]),onKeypress:s.withKeys(s.withModifiers(S,["prevent"]),["esc"])},[u.value&&h.value?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:"m-fullscreen-btn --next",onClick:b[0]||(b[0]=s.withModifiers(T=>K("next"),["stop"]))},[s.createVNode(s.unref(a),{class:"maz-rotate-180"})])):s.createCommentVNode("v-if",!0),u.value&&h.value?(s.openBlock(),s.createElementBlock("button",{key:1,type:"button",class:"m-fullscreen-btn --previous",onClick:b[1]||(b[1]=s.withModifiers(T=>K("previous"),["stop"]))},[s.createVNode(s.unref(a))])):s.createCommentVNode("v-if",!0),s.createElementVNode("button",{type:"button",class:"m-fullscreen-btn --close",onClick:S},[s.createVNode(s.unref(i))]),s.createElementVNode("div",Bo,[s.createElementVNode("img",{ref_key:"ImgElement",ref:v,src:d.value,alt:y.value??void 0,tabindex:"0",class:s.normalizeClass([D.value]),onLoad:C,onClick:b[2]||(b[2]=s.withModifiers(T=>p.zoom&&he(),["stop"]))},null,42,Po),s.withDirectives(s.createVNode(s.unref(r),{class:"m-fullscreen-img-loader"},null,512),[[s.vShow,c.value]])])],40,Vo))}}),me=(o,e)=>{const t=o.__vccOpts||o;for(const[n,r]of e)t[n]=r;return t},Mo=me(No,[["__scopeId","data-v-b6e5fc28"]]),Oe="m-fullscreen-is-open";class $o{constructor(){m(this,"options");m(this,"defaultOptions",{scaleOnHover:!1,blurOnHover:!1,disabled:!1,zoom:!0,offset:80,animation:{duration:300,easing:"ease-in-out"}});m(this,"mouseEnterListener");m(this,"mouseLeaveListener");m(this,"renderPreviewListener")}buildOptions(e,t){const n=typeof t.value=="object"?t.value:{src:t.value,alt:void 0},r=(n==null?void 0:n.src)??this.getImgSrc(e),i=(n==null?void 0:n.alt)??this.getImgAlt(e);return{...this.defaultOptions,...n,src:r,alt:i}}get allInstances(){return[...document.querySelectorAll(".m-fullscreen-img-instance")]}getImgSrc(e){var n;const t=((n=this.options)==null?void 0:n.src)||e.getAttribute("src")||e.getAttribute("data-src");if(!t)throw new Error('[maz-ui](fullscreen-img) src of image must be provided by `v-fullscreen=""`, `v-fullscreen="{ src: "" }"`, `src=""` or `data-src=""` atributes');return t}getImgAlt(e){var t;return((t=this.options)==null?void 0:t.alt)||e.getAttribute("alt")||e.getAttribute("data-alt")}create(e,t){if(this.options=this.buildOptions(e,t),this.options.disabled)return;e.style.cursor="move",(this.options.scaleOnHover||this.options.blurOnHover)&&(e.style.transition="all 200ms ease-in-out"),e.classList.add("m-fullscreen-img-instance"),e.setAttribute("data-src",this.getImgSrc(e));const n=this.getImgAlt(e);n&&e.setAttribute("data-alt",n),this.mouseEnterListener=()=>this.mouseEnter(e),this.mouseLeaveListener=()=>this.mouseLeave(e),this.renderPreviewListener=()=>this.renderPreview(e),e.addEventListener("mouseenter",this.mouseEnterListener),e.addEventListener("mouseleave",this.mouseLeaveListener),e.addEventListener("click",this.renderPreviewListener)}update(e,t){this.options=this.buildOptions(e,t)}remove(e){e.removeEventListener("mouseenter",this.mouseEnterListener),e.removeEventListener("mouseleave",this.mouseLeaveListener),e.removeEventListener("click",this.renderPreviewListener),e.classList.remove("m-fullscreen-img-instance"),e.style.cursor=""}renderPreview(e){return e.classList.add(Oe),de(Mo,{props:{...this.options,openInstanceClass:Oe,clickedElement:e,clickedElementBounds:e.getBoundingClientRect()},addDestroyInProps:!0})}mouseLeave(e){this.options.scaleOnHover&&(e.style.transform=""),this.options.blurOnHover&&(e.style.filter=""),e.style.zIndex=""}mouseEnter(e){e.style.zIndex="1",this.options.scaleOnHover&&(e.style.transform="scale(1.04)"),this.options.blurOnHover&&(e.style.filter="blur(3px)")}}let ae;const mt={mounted(o,e){return ae=new $o,ae.create(o,e)},updated(o,e){return ae.update(o,e)},unmounted(o){return ae.remove(o)}},ft={install(o){o.directive("fullscreen-img",mt)}},Ho="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Te={baseClass:"m-lazy-img",loadedClass:"m-lazy-loaded",loadingClass:"m-lazy-loading",errorClass:"m-lazy-error",noPhotoClass:"m-lazy-no-photo",noPhoto:!1,observerOnce:!0,loadOnce:!1,noUseErrorPhoto:!1,observerOptions:{threshold:.1}};class ht{constructor(e={}){m(this,"observers",[]);m(this,"defaultOptions",Te);m(this,"options");m(this,"onImgLoadedCallback");m(this,"onImgErrorCallback");m(this,"hasImgLoaded",!1);this.options=this.buildOptions(e),this.onImgLoadedCallback=this.imageIsLoaded.bind(this),this.onImgErrorCallback=this.imageHasError.bind(this)}async loadErrorPhoto(){const{default:e}=await Promise.resolve().then(()=>require("./no-photography-CLNgmzDi.cjs"));return e}buildOptions(e){return{...this.defaultOptions,...e,observerOptions:{...this.defaultOptions.observerOptions,...e.observerOptions}}}removeClass(e,t){e.classList.remove(t)}addClass(e,t){e.classList.add(t)}removeAllStateClasses(e){this.removeClass(e,this.options.loadedClass),this.removeClass(e,this.options.loadingClass),this.removeClass(e,this.options.errorClass),this.removeClass(e,this.options.noPhotoClass)}setBaseClass(e){this.addClass(e,this.options.baseClass)}imageIsLoading(e){var t,n;this.addClass(e,this.options.loadingClass),(n=(t=this.options).onLoading)==null||n.call(t,e)}imageHasNoPhoto(e){this.removeClass(e,this.options.loadingClass),this.addClass(e,this.options.noPhotoClass),this.setDefaultPhoto(e)}imageIsLoaded(e){var t,n;this.hasImgLoaded=!0,this.removeClass(e,this.options.loadingClass),this.addClass(e,this.options.loadedClass),(n=(t=this.options).onLoaded)==null||n.call(t,e)}imageHasError(e){var t,n;this.removeClass(e,this.options.loadingClass),this.addClass(e,this.options.errorClass),(n=(t=this.options).onError)==null||n.call(t,e),this.setDefaultPhoto(e)}getSrc(e){return typeof e.value=="object"?e.value.src:e.value}getImageUrl(e,t){const n=this.getImgElement(e).getAttribute("data-lazy-src");return n||this.getSrc(t)}async setPictureSourceUrls(e){const t=e.querySelectorAll("source");if(t.length>0)for await(const n of t){const r=n.getAttribute("data-lazy-srcset");if(r)n.srcset=r;else return this.imageHasError(e)}else this.imageHasError(e)}hasBgImgMode(e){return e.arg==="bg-image"}isPictureElement(e){return e instanceof HTMLPictureElement}getImgElement(e){return this.isPictureElement(e)?e.querySelector("img"):e}async setDefaultPhoto(e){if(this.options.noUseErrorPhoto)return;const t=this.options.fallbackSrc??this.options.errorPhoto;typeof t=="string"&&this.addClass(e,this.options.noPhotoClass);const n=t??await this.loadErrorPhoto(),r=e.querySelectorAll("source");if(r.length>0)for await(const i of r)i.srcset=n;else this.setImgSrc(e,n)}addEventListenerToImg(e){const t=this.getImgElement(e);t.addEventListener("load",()=>this.onImgLoadedCallback(e),{once:!0}),t.addEventListener("error",n=>this.onImgErrorCallback(e,n),{once:!0})}async loadImage(e,t){if(this.imageIsLoading(e),this.isPictureElement(e))this.addEventListenerToImg(e),await this.setPictureSourceUrls(e);else{const n=this.getImageUrl(e,t);if(!n)return this.imageHasError(e);this.hasBgImgMode(t)?(e.style.backgroundImage=`url('${n}')`,this.imageIsLoaded(e)):(this.addEventListenerToImg(e),this.setImgSrc(e,n))}}setImgSrc(e,t){const n=this.getImgElement(e);n.src=t}handleIntersectionObserver(e,t,n,r){var i,a;this.observers.push(r);for(const l of n)if(l.isIntersecting){if((a=(i=this.options).onIntersecting)==null||a.call(i,l.target),this.options.observerOnce&&r.unobserve(e),this.options.loadOnce&&this.hasImgLoaded)return;this.loadImage(e,t)}}createObserver(e,t){const n=(a,l)=>{this.handleIntersectionObserver(e,t,a,l)},r=this.options.observerOptions;new IntersectionObserver(n,r).observe(e)}async imageHandler(e,t,n){if(n==="update")for await(const r of this.observers)r.unobserve(e);window.IntersectionObserver?this.createObserver(e,t):this.loadImage(e,t)}async bindUpdateHandler(e,t,n){if(this.options.noPhoto)return this.imageHasNoPhoto(e);await this.imageHandler(e,t,n)}async add(e,t){if(this.hasBgImgMode(t)&&this.isPictureElement(e))throw new Error(`[MazLazyImg] You can't use the "bg-image" mode with "<picture />" element`);setTimeout(()=>this.setBaseClass(e),0),e.getAttribute("src")||this.setImgSrc(e,Ho),await this.bindUpdateHandler(e,t,"bind")}async update(e,t){t.value!==t.oldValue&&(this.hasImgLoaded=!1,this.removeAllStateClasses(e),await this.bindUpdateHandler(e,t,"update"))}remove(e,t){this.hasImgLoaded=!1,this.hasBgImgMode(t)&&(e.style.backgroundImage=""),this.removeAllStateClasses(e);for(const n of this.observers)n.unobserve(e);this.observers=[]}}let le;const Fo={created(o,e){const t=typeof e.value=="object"?e.value:{};le=new ht(t),le.add(o,e)},updated(o,e){le.update(o,e)},unmounted(o,e){le.remove(o,e)}},vt={install(o,e={}){const t={...Te,...e,observerOptions:{...Te.observerOptions,...e.observerOptions}},n=new ht(t);o.directive("lazy-img",{created:n.add.bind(n),updated:n.update.bind(n),unmounted:n.remove.bind(n)})}},qo=`
2
- .maz-zoom-img {
3
- position: fixed;
4
- top: 0;
5
- bottom: 0;
6
- left: 0;
7
- right: 0;
8
- padding: 1rem;
9
- z-index: 1050;
10
- background-color: hsla(238, 15%, 40%, 0.7);
11
- display: flex;
12
- align-items: center;
13
- justify-content: center;
14
- flex-direction: column;
15
- }
16
-
17
- .maz-zoom-img,
18
- .maz-zoom-img * {
19
- box-sizing: border-box;
20
- }
21
-
22
- .maz-zoom-img .maz-zoom-img__wrapper {
23
- position: relative;
24
- display: flex;
25
- justify-content: center;
26
- align-items: center;
27
- min-width: 0;
28
- min-height: 0;
29
- max-width: 100%;
30
- max-height: 100%;
31
- transition: all 300ms ease-in-out;
32
- opacity: 0;
33
- transform: scale(0.5);
34
- }
35
-
36
- .maz-zoom-img.maz-animate .maz-zoom-img__wrapper {
37
- opacity: 1;
38
- transform: scale(1);
39
- }
40
-
41
- .maz-zoom-img.maz-animate .maz-zoom-img__loader {
42
- position: absolute;
43
- top: 0;
44
- bottom: 0;
45
- left: 0;
46
- right: 0;
47
- display: flex;
48
- align-items: center;
49
- justify-content: center;
50
- background-color: hsla(238, 15%, 40%, 0.7);
51
- border-radius: 1rem;
52
- z-index: 2;
53
- min-width: 60px;
54
- min-height: 60px;
55
- }
56
- .maz-zoom-img.maz-animate .maz-zoom-img__loader[hidden] {
57
- display: none;
58
- }
59
-
60
- @-webkit-keyframes spin {
61
- 0% { transform: rotate(0deg); }
62
- 100% { transform: rotate(360deg); }
63
- }
64
-
65
- @keyframes spin {
66
- 0% { transform: rotate(0deg); }
67
- 100% { transform: rotate(360deg); }
68
- }
69
-
70
- .maz-zoom-img.maz-animate .maz-zoom-img__loader__svg {
71
- animation: spin .6s linear infinite;
72
- }
73
-
74
- .maz-zoom-img img {
75
- max-width: 100%;
76
- max-height: 100%;
77
- min-width: 0;
78
- border-radius: 1rem;
79
- }
80
-
81
- .maz-zoom-img .maz-zoom-btn {
82
- margin: 0 auto;
83
- border: none;
84
- background-color: hsla(0, 0%, 7%, 0.5);
85
- box-shadow: 0 0 0.5rem 0 hsla(0, 0%, 0%, 0.2);
86
- height: 2.2rem;
87
- min-height: 2.2rem;
88
- width: 2.2rem;
89
- min-width: 2.2rem;
90
- display: flex;
91
- align-items: center;
92
- justify-content: center;
93
- border-radius: 2.2rem;
94
- cursor: pointer;
95
- flex: 0 0 auto;
96
- outline: none;
97
- }
98
-
99
- .maz-zoom-img .maz-zoom-btn svg {
100
- fill: white;
101
- }
102
-
103
- .maz-zoom-img .maz-zoom-btn.maz-zoom-btn--close {
104
- position: absolute;
105
- top: 0.5rem;
106
- right: 0.5rem;
107
- z-index: 1;
108
- }
109
-
110
- .maz-zoom-img .maz-zoom-btn.maz-zoom-btn--previous {
111
- position: absolute;
112
- left: 0.5rem;
113
- z-index: 1;
114
- }
115
-
116
- .maz-zoom-img .maz-zoom-btn.maz-zoom-btn--next {
117
- position: absolute;
118
- right: 0.5rem;
119
- z-index: 1;
120
- }
121
-
122
- .maz-zoom-img .maz-zoom-btn:hover {
123
- background-color: hsl(0, 0%, 0%);
124
- }`,De={close:'<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>',next:'<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>',previous:'<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>',spinner:'<svg width="40px" height="40px" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor" x="0px" y="0px" viewBox="0 0 50 50" xml:space="preserve" class="maz-zoom-img__loader__svg" data-v-6d1cb50c=""><path d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z"></path></svg>'};class jo{constructor(e){m(this,"options");m(this,"loader");m(this,"wrapper");m(this,"img");m(this,"keydownHandler");m(this,"onImgLoadedCallback");m(this,"buttonsAdded");m(this,"defaultOptions",{scale:!0,blur:!0,disabled:!1});m(this,"mouseEnterListener");m(this,"mouseLeaveListener");m(this,"renderPreviewListener");if(!e.value)throw new Error('[MazUI](zoom-img) Image path must be defined. Ex: `v-zoom-img="<PATH_TO_IMAGE>"`');if(typeof e.value=="object"&&!e.value.src)throw new Error("[maz-ui](zoom-img) src of image must be provided");this.buttonsAdded=!1,this.options=this.buildOptions(e),this.keydownHandler=this.keydownLister.bind(this),this.loader=this.getLoader(),this.wrapper=document.createElement("div"),this.wrapper.classList.add("maz-zoom-img__wrapper"),this.wrapper.prepend(this.loader),this.img=document.createElement("img"),this.onImgLoadedCallback=this.onImgLoaded.bind(this),this.imgEventHandler(!0)}buildOptions(e){return{...this.defaultOptions,...typeof e.value=="object"?e.value:{src:e.value}}}get allInstances(){return[...document.querySelectorAll(".maz-zoom-img-instance")]}create(e){this.options.disabled||(e.style.cursor="pointer",setTimeout(()=>e.classList.add("maz-zoom-img-instance")),e.setAttribute("data-zoom-src",this.options.src),this.options.alt&&e.setAttribute("data-zoom-alt",this.options.alt),e.style.transition="all 300ms ease-in-out",this.mouseEnterListener=()=>this.mouseEnter(e),this.mouseLeaveListener=()=>this.mouseLeave(e),this.renderPreviewListener=()=>this.renderPreview(e,this.options),e.addEventListener("mouseenter",this.mouseEnterListener),e.addEventListener("mouseleave",this.mouseLeaveListener),e.addEventListener("click",this.renderPreviewListener))}update(e){this.options=this.buildOptions(e)}remove(e){this.imgEventHandler(!1),e.removeEventListener("mouseenter",this.mouseEnterListener),e.removeEventListener("mouseleave",this.mouseLeaveListener),e.removeEventListener("click",this.renderPreviewListener),e.classList.remove("maz-zoom-img-instance"),e.removeAttribute("data-zoom-src"),e.removeAttribute("data-zoom-alt"),e.style.cursor=""}renderPreview(e,t){e.classList.add("maz-is-open"),this.addStyle(qo);const n=document.createElement("div");n.classList.add("maz-zoom-img"),n.setAttribute("id","MazImgPreviewFullsize"),n.addEventListener("click",r=>{n.isEqualNode(r.target)&&this.closePreview()}),typeof t=="object"&&(this.img.setAttribute("src",t.src),t.alt&&this.img.setAttribute("alt",t.alt),this.img.id="MazImgElement"),this.wrapper.append(this.img),n.append(this.wrapper),document.body.append(n),this.keyboardEventHandler(!0),setTimeout(()=>{n&&n.classList.add("maz-animate")},100)}onImgLoaded(){this.wrapper.style.width=`${this.img.width}px`,this.wrapper.style.minWidth="200px",this.loader.hidden=!0;const e=this.getButton(),t=[],n=this.allInstances.length>1;if(!this.buttonsAdded){if(this.buttonsAdded=!0,n){const r=this.getButton("previous"),i=this.getButton("next");t.push(r,i)}this.wrapper.append(e),n&&(this.wrapper.prepend(t[0]),this.wrapper.append(t[1]))}}getLoader(){const e=document.createElement("div");return e.classList.add("maz-zoom-img__loader"),e.innerHTML=De.spinner,e}mouseLeave(e){this.options.scale&&(e.style.transform=""),this.options.blur&&(e.style.filter=""),e.style.zIndex=""}mouseEnter(e){e.style.zIndex="1",this.options.scale&&(e.style.transform="scale(1.1)"),this.options.blur&&(e.style.filter="blur(2px)")}keydownLister(e){e.preventDefault(),(e.key==="Escape"||e.key===" ")&&this.closePreview(),(e.key==="ArrowLeft"||e.key==="ArrowRight")&&this.nextPreviousImage(e.key==="ArrowRight")}getButton(e="close"){const t=document.createElement("button");t.innerHTML=De[e];const n=e==="close"?this.closePreview():this.allInstances?this.nextPreviousImage(e==="next"):null;return t.addEventListener("click",()=>n),t.classList.add("maz-zoom-btn"),t.classList.add(`maz-zoom-btn--${e}`),t}closePreview(){const e=document.querySelector("#MazImgPreviewFullsize"),t=document.querySelector("#MazPreviewStyle"),n=document.querySelector(".maz-zoom-img-instance.maz-is-open");n&&n.classList.remove("maz-is-open"),e&&e.classList.remove("maz-animate"),this.keyboardEventHandler(!1),setTimeout(()=>{e&&e.remove(),t&&t.remove()},300)}getNewInstanceIndex(e){return e<0?this.allInstances.length-1:e>=this.allInstances.length?0:e}nextPreviousImage(e){const t=e,n=document.querySelector(".maz-zoom-img-instance.maz-is-open");if(n){const r=this.allInstances.indexOf(n),i=t?r+1:r-1,a=this.allInstances[this.getNewInstanceIndex(i)];a&&this.useNextInstance(n,a)}}useNextInstance(e,t){e.classList.remove("maz-is-open"),t.classList.add("maz-is-open");const n=t.getAttribute("data-zoom-src"),r=t.getAttribute("data-zoom-alt");this.wrapper.style.width="",this.loader.hidden=!1,n&&this.img.setAttribute("src",n),r&&this.img.setAttribute("alt",r)}addStyle(e){const t=document.createElement("style");t.id="MazPreviewStyle",t.textContent=e,document.head.append(t)}keyboardEventHandler(e){if(e)return document.addEventListener("keydown",this.keydownHandler);document.removeEventListener("keydown",this.keydownHandler)}imgEventHandler(e){if(e)return this.img.addEventListener("load",this.onImgLoadedCallback);this.img.removeEventListener("load",this.onImgLoadedCallback)}}let ue;const pt={created(o,e){ue=new jo(e),ue.create(o)},updated(o,e){ue.update(e)},unmounted(o){ue.remove(o)}},gt={install(o){o.directive("zoom-img",pt)}},Uo=[at,gt,vt,nt,ft,ut],_o={install(o){for(const e of Uo)e.install(o,{})}};function yt(o){return o?(o=o.toString(),o.charAt(0).toUpperCase()+o.slice(1)):""}const Wo={style:"currency",minimumFractionDigits:2,round:!1};function Ro(o,e,t){let n=Number(o);return t.round&&(n=Math.floor(n),t.minimumFractionDigits=0),new Intl.NumberFormat(e,t).format(n)}function Ko(o,e,t){if(o===void 0)throw new TypeError("[maz-ui](FilterCurrency) The `number` attribute is required.");if(e===void 0)throw new TypeError("[maz-ui](FilterCurrency) The `locale` attribute is required.");if(typeof e!="string")throw new TypeError("[maz-ui](FilterCurrency) The `locale` attribute must be a string.");if(t.currency===void 0)throw new TypeError("[maz-ui](FilterCurrency) The `options.currency` attribute is required.")}function bt(o,e,t){const n={...Wo,...t};Ko(o,e,n);try{return Ro(o,e,n)}catch(r){throw new Error(`[maz-ui](FilterCurrency) ${r}`)}}const Yo={month:"short",day:"numeric",year:"numeric"};function wt(o,e,t){if(e===void 0)throw new TypeError("[maz-ui](FilterDate) The `locale` attribute is required.");if(typeof e!="string")throw new TypeError("[maz-ui](FilterDate) The `locale` attribute must be a string.");const n=t??Yo;try{const r=o instanceof Date?o:new Date(o);return new Intl.DateTimeFormat(e,n).format(r)}catch(r){throw new Error(`[maz-ui](FilterDate) ${r}`)}}const Zo={minimumFractionDigits:2};function Et(o,e,t){const n={...Zo,...t};if(o===void 0)throw new TypeError("[maz-ui](FilterNumber) The `number` attribute is required.");if(e===void 0)throw new TypeError("[maz-ui](FilterNumber) The `locale` attribute is required.");if(typeof e!="string")throw new TypeError("[maz-ui](FilterNumber) The `locale` attribute must be a string.");try{return new Intl.NumberFormat(e,n).format(Number(o))}catch(r){throw new Error(`[maz-ui](FilterNumber) ${r}`)}}const Xo={capitalize:yt,currency:bt,date:wt,number:Et},Go={install(o){o.provide("filters",Xo)}},be={delay:100,observer:{root:void 0,rootMargin:"0px",threshold:.2},animation:{once:!0,duration:300,delay:0}};class Ct{constructor(e){m(this,"options");this.options={delay:(e==null?void 0:e.delay)??be.delay,observer:{...be.observer,...e==null?void 0:e.observer},animation:{...be.animation,...e==null?void 0:e.animation}}}handleIntersect(e,t){for(const n of e){const i=n.target.getAttribute("data-maz-aos-children")==="true",a=n.target.getAttribute("data-maz-aos")?[n.target]:[];if(i){const l=[...document.querySelectorAll("[data-maz-aos-anchor]")].map(c=>c.getAttribute("data-maz-aos-anchor")===`#${n.target.id}`?c:void 0);for(const c of l)c&&a.push(c)}for(const l of a){const c=l.getAttribute("data-maz-aos-once"),u=typeof c=="string"?c==="true":this.options.animation.once;if(typeof this.options.observer.threshold=="number"&&n.intersectionRatio>this.options.observer.threshold){const h=l.getAttribute("data-maz-aos-duration"),g=l.getAttribute("data-maz-aos-delay");if(h||(l.style.transitionDuration=`${this.options.animation.duration}ms`,setTimeout(()=>{l.style.transitionDuration="0"},1e3)),g||(l.style.transitionDelay=`${this.options.animation.delay}ms`,setTimeout(()=>{l.style.transitionDelay="0"},1e3)),l.classList.add("maz-aos-animate"),u){const w=l.getAttribute("data-maz-aos-anchor");if(w){const E=document.querySelector(w);E&&t.unobserve(E)}t.unobserve(l)}}else l.classList.remove("maz-aos-animate")}}}async handleObserver(){await dt(this.options.delay);const e=new IntersectionObserver(this.handleIntersect.bind(this),this.options.observer);for(const t of document.querySelectorAll("[data-maz-aos]")){const n=t.getAttribute("data-maz-aos-anchor");if(n){const r=document.querySelector(n);r?(r.setAttribute("data-maz-aos-children","true"),e.observe(r)):console.warn(`[maz-ui](aos) no element found with selector "${n}"`)}else e.observe(t)}}runAnimations(){if(V())return this.handleObserver();console.warn("[MazAos](runAnimations) should be executed on client side")}}let X;const Qo={install:(o,e)=>{X=new Ct(e),o.provide("aos",X),V()&&(e!=null&&e.router?e.router.afterEach(async()=>{X.runAnimations()}):X.runAnimations())}};function Jo(){return X}const Ve="--backdrop-present",en=s.defineComponent({inheritAttrs:!1,__name:"MazBackdrop",props:{modelValue:{type:Boolean,default:!1},teleportSelector:{default:"body"},beforeClose:{type:Function,default:void 0},persistent:{type:Boolean,default:!1},noCloseOnEscKey:{type:Boolean,default:!1},transitionName:{default:"backdrop-anim"},backdropClass:{default:void 0},backdropContentClass:{default:void 0}},emits:["open","close","update:model-value","before-close"],setup(o,{expose:e,emit:t}){const n=o,r=t;function i(){document.documentElement.classList.add(Ve)}async function a(){document.querySelector(".m-backdrop.--present")||document.documentElement.classList.remove(Ve)}const l=s.ref(n.modelValue);function c(){u(!1)}async function u(d){var y;d||(r("before-close"),await((y=n.beforeClose)==null?void 0:y.call(n))),l.value=d}function h(){r("open")}function g(){r("update:model-value",!1),r("close"),k()}function w(){n.persistent||c()}function E(d){!n.noCloseOnEscKey&&d.key==="Escape"&&!n.persistent&&c()}function O(){i(),document.addEventListener("keyup",E,!1)}function k(){document.removeEventListener("keyup",E),a()}return s.onMounted(()=>{n.modelValue?O():k()}),s.watch(()=>n.modelValue,d=>{l.value=d,d?O():k()}),e({onBackdropAnimationEnter:h,onBackdropAnimationLeave:g,onBackdropClicked:w,close:c,present:l,toggleModal:u,onKeyPress:E}),(d,y)=>(s.openBlock(),s.createBlock(s.Teleport,{to:d.teleportSelector},[s.createVNode(s.Transition,{appear:"",name:d.transitionName,onAfterEnter:h,onAfterLeave:g},{default:s.withCtx(()=>[l.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:s.normalizeClass(["m-backdrop --present",[d.backdropClass]]),tabindex:"-1",role:"dialog"},[s.createElementVNode("button",{class:s.normalizeClass(["m-backdrop-overlay",{"--disabled":d.persistent}]),tabindex:"-1",onClick:s.withModifiers(w,["self"])},null,2),s.createElementVNode("div",s.mergeProps({class:["m-backdrop-content",d.backdropContentClass]},d.$attrs,{role:"document",tabindex:"0"}),[s.renderSlot(d.$slots,"default",{close:c})],16)],2)):s.createCommentVNode("v-if",!0)]),_:3},8,["name"])],8,["to"]))}}),tn={key:0,id:"dialogTitle",class:"maz-my-0 maz-text-xl maz-font-semibold"},on={id:"dialogDesc",class:"m-dialog-content"},nn={key:0,class:"m-dialog-footer"},sn=s.defineComponent({__name:"MazDialog",props:{modelValue:{type:Boolean},title:{default:void 0},noClose:{type:Boolean,default:!1},width:{default:"500px"},maxWidth:{default:"95vw"},maxHeight:{default:"95vh"},scrollable:{type:Boolean,default:!1},persistent:{type:Boolean,default:!1},teleportSelector:{},beforeClose:{},noCloseOnEscKey:{type:Boolean},transitionName:{},backdropClass:{},backdropContentClass:{}},emits:["open","close","update:model-value"],setup(o,{expose:e}){const t=o,n=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./MazBtn-R7z-Hxp-.cjs"))),r=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./x-mark-DW2WXkoF.cjs"))),i=s.useAttrs(),a=s.ref();e({close:()=>{var u,h;return(h=(u=a.value)==null?void 0:u.close)==null?void 0:h.call(u)}});const l=s.computed(()=>({...i,class:void 0,style:void 0})),c=s.computed(()=>({class:i.class,style:i.style}));return(u,h)=>(s.openBlock(),s.createBlock(en,s.mergeProps({...l.value,...t},{ref_key:"backdrop",ref:a,persistent:u.persistent,"model-value":u.modelValue,"transition-name":"modal-anim","aria-labelledby":"dialogTitle","aria-describedby":"dialogDesc",onClose:h[0]||(h[0]=g=>u.$emit("close",g)),onOpen:h[1]||(h[1]=g=>u.$emit("open",g)),"onUpdate:modelValue":h[2]||(h[2]=g=>u.$emit("update:model-value",g))}),{default:s.withCtx(({close:g})=>[s.createElementVNode("div",s.mergeProps({class:["m-dialog",{"--scrollable":u.scrollable}],role:"dialog","aria-modal":"true",style:[{width:u.width,maxWidth:u.maxWidth,maxHeight:u.maxHeight}]},c.value),[s.renderSlot(u.$slots,"header",{close:g},()=>[s.createElementVNode("div",{class:s.normalizeClass(["m-dialog-header",{"--has-title":u.$slots.title||u.title}])},[u.$slots.title||u.title?(s.openBlock(),s.createElementBlock("h2",tn,[s.renderSlot(u.$slots,"title",{},()=>[s.createTextVNode(s.toDisplayString(u.title),1)],!0)])):s.createCommentVNode("v-if",!0),!u.noClose&&!u.persistent?(s.openBlock(),s.createBlock(s.unref(n),{key:1,class:"m-dialog-closebtn",color:"transparent",size:"sm",icon:s.unref(r),onClick:g},null,8,["icon","onClick"])):s.createCommentVNode("v-if",!0)],2)],!0),s.createElementVNode("div",on,[s.renderSlot(u.$slots,"default",{close:g},void 0,!0)]),u.$slots.footer?(s.openBlock(),s.createElementBlock("div",nn,[s.renderSlot(u.$slots,"footer",{close:g},void 0,!0)])):s.createCommentVNode("v-if",!0)],16)]),_:3},16,["persistent","model-value"]))}}),rn=me(sn,[["__scopeId","data-v-50775b17"]]),j={cancelText:"Cancel",confirmText:"Confirm",cancelButton:{text:"Cancel",color:"danger"},confirmButton:{text:"Confirm",color:"success"}},an=s.ref(j),U=s.ref([]);function ln(o,e){return new Promise((t,n)=>{U.value=[...U.value,{id:o,isActive:!0,resolve:async r=>{t(r),await(e==null?void 0:e())},reject:async r=>{n(r),await(e==null?void 0:e())}}]})}function Tt(o){return U.value=U.value.filter(({id:e})=>e!==o),U.value}function Be(o,e,t){var n;e&&((n=e[o])==null||n.call(e,t),e.isActive=!1,setTimeout(()=>{Tt(e.id)},500))}function kt(){return{data:an,dialogState:U,showDialogAndWaitChoice:ln,removeDialogFromState:Tt,rejectDialog:async(o,e=new Error("cancel"),t)=>(await(t==null?void 0:t()),Be("reject",o,e)),resolveDialog:async(o,e="accept",t)=>(await(t==null?void 0:t()),Be("resolve",o,e))}}const un={class:"maz-flex maz-items-center maz-gap-2"},cn=s.defineComponent({__name:"MazDialogPromise",props:{data:{default:void 0},message:{default:void 0},identifier:{default:void 0},buttons:{default:void 0},modelValue:{type:Boolean},title:{},noClose:{type:Boolean},width:{},maxWidth:{},maxHeight:{},scrollable:{type:Boolean},persistent:{type:Boolean},teleportSelector:{},beforeClose:{},noCloseOnEscKey:{type:Boolean},transitionName:{},backdropClass:{},backdropContentClass:{},cancelText:{},cancelButton:{type:[Boolean,Object]},confirmText:{},confirmButton:{type:[Boolean,Object]}},emits:["open","close"],setup(o,{expose:e}){const t=o,n=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./MazBtn-R7z-Hxp-.cjs"))),{dialogState:r,rejectDialog:i,resolveDialog:a,data:l}=kt(),c=s.computed(()=>{var d;return t.buttons??((d=t.data)==null?void 0:d.buttons)??l.value.buttons}),u=s.computed(()=>({...j,...l.value,...t.data})),h=s.computed(()=>{var A,v,L,D;if(!(((A=l.value)==null?void 0:A.cancelButton)??((v=t.data)==null?void 0:v.cancelButton)??j.cancelButton))return;const y={...j.cancelButton,...(L=l.value)==null?void 0:L.cancelButton,...(D=t.data)==null?void 0:D.cancelButton};return{...y,text:t.cancelText||u.value.cancelText||y.text}}),g=s.computed(()=>{var A,v,L,D;if(!(((A=l.value)==null?void 0:A.confirmButton)??((v=t.data)==null?void 0:v.confirmButton)??j.confirmButton))return;const y={...j.confirmButton,...(L=l.value)==null?void 0:L.confirmButton,...(D=t.data)==null?void 0:D.confirmButton};return{...y,text:t.confirmText||u.value.confirmText||y.text}}),w=s.computed(()=>r.value.find(({id:d})=>d===t.identifier)),E=s.ref();e({close:()=>{var d,y;return(y=(d=E.value)==null?void 0:d.close)==null?void 0:y.call(d)}});function O(d){return"type"in d&&(d.type==="resolve"||d.type==="reject")}function k(d,y){return O(y)?y.type==="resolve"?a(d,y.response):i(d,y.response):a(d,void 0,y.action)}return(d,y)=>{var A;return s.openBlock(),s.createBlock(rn,s.mergeProps({ref_key:"dialog",ref:E},{...d.$attrs,...t},{"model-value":((A=w.value)==null?void 0:A.isActive)??d.modelValue??!1,onClose:y[2]||(y[2]=v=>d.$emit("close",v)),onOpen:y[3]||(y[3]=v=>d.$emit("open",v)),"onUpdate:modelValue":y[4]||(y[4]=v=>s.unref(i)(w.value))}),{title:s.withCtx(()=>[s.renderSlot(d.$slots,"title",{},()=>{var v;return[s.createTextVNode(s.toDisplayString(d.title||((v=u.value)==null?void 0:v.title)),1)]})]),default:s.withCtx(()=>[s.renderSlot(d.$slots,"default",{resolve:v=>s.unref(a)(w.value,v),reject:v=>s.unref(i)(w.value,v)},()=>{var v;return[s.createTextVNode(s.toDisplayString(d.message||((v=u.value)==null?void 0:v.message)),1)]})]),footer:s.withCtx(()=>[s.renderSlot(d.$slots,"footer-button",{resolve:v=>s.unref(a)(w.value,v),reject:v=>s.unref(i)(w.value,v)},()=>[s.createElementVNode("div",un,[c.value?(s.openBlock(!0),s.createElementBlock(s.Fragment,{key:0},s.renderList(c.value,(v,L)=>(s.openBlock(),s.createBlock(s.unref(n),s.mergeProps({key:L,ref_for:!0},{...v,type:"button"},{onClick:D=>k(w.value,v)}),{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(v.text),1)]),_:2},1040,["onClick"]))),128)):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[h.value?(s.openBlock(),s.createBlock(s.unref(n),s.mergeProps({key:0},h.value,{onClick:y[0]||(y[0]=v=>s.unref(i)(w.value))}),{default:s.withCtx(()=>[s.renderSlot(d.$slots,"cancel-text",{},()=>[s.createTextVNode(s.toDisplayString(h.value.text),1)])]),_:3},16)):s.createCommentVNode("v-if",!0),g.value?(s.openBlock(),s.createBlock(s.unref(n),s.mergeProps({key:1},g.value,{onClick:y[1]||(y[1]=v=>s.unref(a)(w.value))}),{default:s.withCtx(()=>[s.renderSlot(d.$slots,"confirm-text",{},()=>[s.createTextVNode(s.toDisplayString(g.value.text),1)])]),_:3},16)):s.createCommentVNode("v-if",!0)],64))])])]),_:3},16,["model-value"])}}}),Pe={identifier:"main-dialog"};class zt{constructor(e,t=Pe){this.app=e,this.globalOptions=t}open(e){const t={...Pe,...this.globalOptions,...e},{destroy:n,vNode:r}=de(cn,{props:t,app:this.app}),{showDialogAndWaitChoice:i}=kt();function a(){var c,u,h;(u=(c=r.component)==null?void 0:c.exposed)==null||u.close(),(h=t.promiseCallback)==null||h.call(t),setTimeout(()=>{n()},700)}return{promise:i(t.identifier,()=>{a()}),destroy:n,close:a}}}const dn={install(o,e){o.provide("dialog",new zt(o,e))}},mn={class:"m-toast__message-wrapper"},fn={class:"m-toast__message"},hn={class:"maz-flex maz-items-center maz-gap-2"},vn={key:0},pn={key:4,class:"progress-bar maz-absolute maz-inset-x-0 maz-bottom-0 maz-h-1"},gn=s.defineComponent({__name:"MazToast",props:{message:{default:void 0},position:{default:"bottom-right"},maxToasts:{type:[Number,Boolean],default:!1},timeout:{type:[Number,Boolean],default:1e4},queue:{type:Boolean},noPauseOnHover:{type:Boolean},type:{default:"info"},link:{default:void 0},action:{default:void 0},persistent:{type:Boolean},icon:{type:Boolean,default:!0}},emits:["close","click","open"],setup(o,{expose:e,emit:t}){const n=o,r=t,i=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./MazBtn-R7z-Hxp-.cjs"))),a=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./x-mark-DW2WXkoF.cjs"))),l=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./arrow-top-right-on-square-PZtr8Zs0.cjs"))),c=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./exclamation-triangle-BtW3be9S.cjs"))),u=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./exclamation-circle-BXs0Yj0f.cjs"))),h=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./information-circle-89FseEuJ.cjs"))),g=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./check-circle-D3i-p-t3.cjs"))),w=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./link-CUxj8BQ5.cjs"))),E=s.ref(),O=s.computed(()=>{if(n.icon)switch(n.type){case"danger":return c;case"info":return h;case"success":return g;case"warning":return u;default:return}}),k=s.computed(()=>n.position.includes("top")?"top":"bottom"),d=s.computed(()=>n.position.includes("left")?"left":n.position.includes("right")?"right":"center"),y=s.computed(()=>d.value!=="center"?d.value==="right"?"m-slide-right":"m-slide-left":k.value==="top"?"m-slide-top":"m-slide-bottom"),A=s.ref(!1),v=s.ref(!1),L=s.ref(),D=`m-toast-container --${k.value} --${d.value}`,C=`.${D.replaceAll(" ",".")}`,S=Ge({callback:q,timeout:typeof n.timeout=="number"?n.timeout:0,callbackOffsetTime:200});function B(){const f=document.querySelector(C);if(!f&&!f){const z=document.body,I=document.createElement("div");I.className=D,z.append(I)}}function F(){const f=document.querySelector(C);return!n.queue&&n.maxToasts===!1?!1:typeof n.maxToasts=="number"&&f?n.maxToasts<=f.childElementCount:f&&f.childElementCount>0}function $(){if(F()){L.value=setTimeout($,250);return}const f=document.querySelector(C);E.value&&f&&f.prepend(E.value),v.value=!0,typeof n.timeout=="number"&&n.timeout>0&&S.start()}const W=s.ref("100%");function fe(){switch(n.type){case"danger":return"maz-bg-danger-700";case"info":return"maz-bg-info-700";case"success":return"maz-bg-success-700";case"warning":return"maz-bg-warning-700";default:return"maz-bg-primary"}}s.watch(S.remainingTime,f=>{if(typeof n.timeout=="number"){const z=100*f/n.timeout;W.value=`${z}%`}});function R(f){r("click",f),n.persistent||q()}async function K(f,z){var I;A.value=!0,await f(),A.value=!1,(I=n.action)!=null&&I.closeToast&&R(z)}function Y(f){n.noPauseOnHover||(f?S.pause():S.resume())}function he(){S.stop(),L.value&&clearTimeout(L.value)}function q(){he(),v.value=!1}e({closeToast:q});function se(){r("open")}function re(){var z;r("close"),(z=E.value)==null||z.remove();const f=document.querySelector(C);f&&!(f!=null&&f.hasChildNodes())&&f.remove()}return s.onMounted(()=>{B(),$()}),(f,z)=>(s.openBlock(),s.createBlock(s.Transition,{name:y.value,onAfterLeave:re,onAfterEnter:se,persisted:""},{default:s.withCtx(()=>[s.withDirectives(s.createElementVNode("button",{ref_key:"Toaster",ref:E,class:s.normalizeClass(["m-toast",[`--${f.type}`,`--${k.value}`,`--${d.value}`,{"maz-pb-1":typeof f.timeout=="number"&&f.timeout>0,"--persistent":f.persistent}]]),role:"alert",onMouseover:z[2]||(z[2]=I=>Y(!0)),onMouseleave:z[3]||(z[3]=I=>Y(!1)),onClick:z[4]||(z[4]=s.withModifiers(I=>{var Z;return f.link&&!((Z=f.link)!=null&&Z.closeToast)?void 0:R(I)},["stop"]))},[O.value?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(O.value),{key:0,class:"maz-text-2xl"})):s.createCommentVNode("v-if",!0),s.createElementVNode("div",mn,[s.createElementVNode("p",fn,s.toDisplayString(f.message),1)]),f.action?(s.openBlock(),s.createBlock(s.unref(i),{key:1,"data-test":"action-btn",color:f.type,pastel:"",loading:A.value,size:"sm",onClick:z[0]||(z[0]=s.withModifiers(I=>f.action?K(f.action.func,I):void 0,["stop"]))},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(f.action.text),1)]),_:1},8,["color","loading"])):s.createCommentVNode("v-if",!0),f.link?(s.openBlock(),s.createBlock(s.unref(i),{key:2,"data-test":"link-btn",color:f.type,pastel:"",size:"xs",href:f.link.href,target:f.link.target??"_self"},{default:s.withCtx(()=>{var I;return[s.createElementVNode("div",hn,[f.link.text?(s.openBlock(),s.createElementBlock("span",vn,s.toDisplayString(f.link.text),1)):s.createCommentVNode("v-if",!0),((I=f.link)==null?void 0:I.target)==="_blank"?(s.openBlock(),s.createBlock(s.unref(l),{key:1,class:"maz-text-xl"})):(s.openBlock(),s.createBlock(s.unref(w),{key:2,class:"maz-text-xl"}))])]}),_:1},8,["color","href","target"])):s.createCommentVNode("v-if",!0),f.persistent?s.createCommentVNode("v-if",!0):(s.openBlock(),s.createElementBlock("button",{key:3,class:"--close",onClick:z[1]||(z[1]=s.withModifiers(I=>R(I),["stop"]))},[s.createVNode(s.unref(a),{class:"--icon maz-text-xl"})])),typeof f.timeout=="number"&&f.timeout>0?(s.openBlock(),s.createElementBlock("div",pn,[s.createElementVNode("div",{style:s.normalizeStyle({width:W.value}),class:s.normalizeClass(["maz-h-full !maz-transition-all !maz-duration-200 !maz-ease-linear",fe()])},null,6)])):s.createCommentVNode("v-if",!0)],34),[[s.vShow,v.value]])]),_:1},8,["name"]))}}),yn=me(gn,[["__scopeId","data-v-c8684398"]]),bn={position:"bottom-right",timeout:1e4,persistent:!1,icon:!0};class Lt{constructor(e,t){this.app=e,this.globalOptions=t}show(e,t){const n={...bn,...this.globalOptions,...t,message:e},{destroy:r,vNode:i}=de(yn,{props:n,app:this.app});return{destroy:r,close:()=>{var a,l;return(l=(a=i.component)==null?void 0:a.exposed)==null?void 0:l.closeToast()}}}getLocalOptions(e,t){return{type:e,...t}}message(e,t){return this.show(e,this.getLocalOptions("theme",t))}success(e,t){return this.show(e,this.getLocalOptions("success",t))}error(e,t){return this.show(e,this.getLocalOptions("danger",t))}info(e,t){return this.show(e,this.getLocalOptions("info",t))}warning(e,t){return this.show(e,this.getLocalOptions("warning",t))}}function wn(o,e){return new Lt(o,e)}const En={install(o,e){o.provide("toast",wn(o,e))}},_="";function Cn(o){return o.filter((e,t,n)=>t===n.indexOf(e))}function Tn(o){return(e=_)=>typeof e=="function"?o.findIndex((...t)=>e(...t))>-1:o.includes(e)}const kn=o=>o.length>0;function zn(o){return(e=_)=>Cn([...o,e])}function Ln(o){return(e=_)=>o.filter(t=>t!==e)}class It{constructor(){m(this,"_loaders",s.ref([]))}get loaders(){return s.computed(()=>this._loaders.value)}stop(e=_){this._loaders.value=Ln(this._loaders.value)(e)}start(e=_){return this._loaders.value=zn(this._loaders.value)(e),()=>this.stop(e)}get anyLoading(){return s.computed(()=>kn(this._loaders.value))}isLoading(e=_){return s.computed(()=>Tn(this._loaders.value)(e)).value}}const At=new It,In={install:o=>{o.provide("wait",At)}};exports.AosHandler=Ct;exports.DialogHandler=zt;exports.IdleTimeout=_e;exports.ScriptLoader=Oo;exports.Swipe=Ye;exports.ToasterHandler=Lt;exports.UserVisibility=Qe;exports.WaitHandler=It;exports._export_sfc=me;exports.capitalize=yt;exports.checkAvailability=ke;exports.countryCodeToUnicodeFlag=So;exports.currency=bt;exports.date=wt;exports.debounce=xo;exports.directive=ot;exports.directive$1=it;exports.directive$2=Ao;exports.directive$3=mt;exports.directive$4=Fo;exports.getInstance=Jo;exports.injectStrict=Q;exports.installDialog=dn;exports.installFilters=Go;exports.installToaster=En;exports.instance=At;exports.isClient=V;exports.isoCodes=We;exports.mount=de;exports.normalizeString=we;exports.number=Et;exports.plugin=_o;exports.plugin$1=nt;exports.plugin$2=at;exports.plugin$3=ut;exports.plugin$4=ft;exports.plugin$5=vt;exports.plugin$6=gt;exports.plugin$7=Qo;exports.plugin$8=In;exports.sleep=dt;exports.throttle=Do;exports.truthyFilter=ct;exports.useAos=Vt;exports.useBreakpoints=Pt;exports.useDialog=Nt;exports.useFormField=oo;exports.useFormValidator=no;exports.useIdleTimeout=so;exports.useInstanceUniqId=ro;exports.useLanguageDisplayNames=uo;exports.useReadingTime=mo;exports.useStringMatching=po;exports.useSwipe=yo;exports.useThemeHandler=Eo;exports.useTimer=Ge;exports.useToast=Co;exports.useUserVisibility=To;exports.useWait=ko;exports.useWindowSize=Ne;exports.vZoomImg=pt;