maz-ui 3.5.0 → 3.6.2

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 (174) hide show
  1. package/components/MazAvatar.d.ts +156 -149
  2. package/components/MazAvatar.mjs +656 -0
  3. package/components/MazAvatar.umd.js +2 -0
  4. package/components/MazBackdrop.d.ts +89 -89
  5. package/components/MazBackdrop.mjs +140 -0
  6. package/components/MazBackdrop.umd.js +2 -0
  7. package/components/MazBadge.d.ts +73 -68
  8. package/components/MazBadge.mjs +61 -0
  9. package/components/MazBadge.umd.js +2 -0
  10. package/components/MazBottomSheet.d.ts +36 -29
  11. package/components/MazBottomSheet.mjs +553 -0
  12. package/components/MazBottomSheet.umd.js +2 -0
  13. package/components/MazBtn.d.ts +178 -171
  14. package/components/MazBtn.mjs +371 -0
  15. package/components/MazBtn.umd.js +2 -0
  16. package/components/MazCard.d.ts +194 -183
  17. package/components/MazCard.mjs +1390 -0
  18. package/components/MazCard.umd.js +2 -0
  19. package/components/MazCarousel.d.ts +24 -16
  20. package/components/MazCarousel.mjs +469 -0
  21. package/components/MazCarousel.umd.js +2 -0
  22. package/components/MazChart/includes.d.ts +11 -11
  23. package/components/MazChart.d.ts +114 -114
  24. package/components/MazChart.mjs +135 -0
  25. package/components/MazChart.umd.js +2 -0
  26. package/components/MazCheckbox.d.ts +54 -49
  27. package/components/MazCheckbox.mjs +86 -0
  28. package/components/MazCheckbox.umd.js +2 -0
  29. package/components/MazDialog.d.ts +40 -29
  30. package/components/MazDialog.mjs +566 -0
  31. package/components/MazDialog.umd.js +2 -0
  32. package/components/MazDialogPromise/use-maz-dialog-promise.d.ts +30 -30
  33. package/components/MazDialogPromise.d.ts +36 -28
  34. package/components/MazDialogPromise.mjs +692 -0
  35. package/components/MazDialogPromise.umd.js +2 -0
  36. package/components/MazDrawer.d.ts +69 -59
  37. package/components/MazDrawer.mjs +572 -0
  38. package/components/MazDrawer.umd.js +2 -0
  39. package/components/MazDropzone.d.ts +128 -128
  40. package/components/MazDropzone.mjs +369 -0
  41. package/components/MazDropzone.umd.js +2 -0
  42. package/components/MazGallery.d.ts +144 -144
  43. package/components/MazGallery.mjs +948 -0
  44. package/components/MazGallery.umd.js +2 -0
  45. package/components/MazIcon.d.ts +64 -66
  46. package/components/MazIcon.mjs +161 -0
  47. package/components/MazIcon.umd.js +2 -0
  48. package/components/MazInput.d.ts +276 -276
  49. package/components/MazInput.mjs +750 -0
  50. package/components/MazInput.umd.js +2 -0
  51. package/components/MazInputNumber.d.ts +65 -67
  52. package/components/MazInputNumber.mjs +857 -0
  53. package/components/MazInputNumber.umd.js +2 -0
  54. package/components/MazInputPrice.d.ts +69 -64
  55. package/components/MazInputPrice.mjs +889 -0
  56. package/components/MazInputPrice.umd.js +2 -0
  57. package/components/MazInputTags.d.ts +94 -96
  58. package/components/MazInputTags.mjs +904 -0
  59. package/components/MazInputTags.umd.js +2 -0
  60. package/components/MazLazyImg.d.ts +85 -80
  61. package/components/MazLazyImg.mjs +376 -0
  62. package/components/MazLazyImg.umd.js +2 -0
  63. package/components/MazPhoneNumberInput/constantes/locales.d.ts +12 -12
  64. package/components/MazPhoneNumberInput/types.d.ts +21 -21
  65. package/components/MazPhoneNumberInput/utils/countries-name-list-by-iso-code.d.ts +2 -2
  66. package/components/MazPhoneNumberInput/utils/index.d.ts +12 -12
  67. package/components/MazPhoneNumberInput.d.ts +253 -255
  68. package/components/MazPhoneNumberInput.mjs +1907 -0
  69. package/components/MazPhoneNumberInput.umd.js +2 -0
  70. package/components/MazPicker/MazPickerCalendar.vue.d.ts +135 -137
  71. package/components/MazPicker/MazPickerCalendarMonth/MazPickerCalendarDays.vue.d.ts +20 -22
  72. package/components/MazPicker/MazPickerCalendarMonth/MazPickerCalendarGrid.vue.d.ts +112 -114
  73. package/components/MazPicker/MazPickerCalendarMonth/MazPickerCalendarMonth.vue.d.ts +122 -124
  74. package/components/MazPicker/MazPickerCalendarSwitcher.vue.d.ts +36 -38
  75. package/components/MazPicker/MazPickerContainer.vue.d.ts +210 -212
  76. package/components/MazPicker/MazPickerFooter.vue.d.ts +16 -0
  77. package/components/MazPicker/MazPickerHeader.vue.d.ts +82 -84
  78. package/components/MazPicker/MazPickerMonthSwitcher.vue.d.ts +41 -43
  79. package/components/MazPicker/MazPickerShortcuts.vue.d.ts +60 -62
  80. package/components/MazPicker/MazPickerTime.vue.d.ts +127 -129
  81. package/components/MazPicker/MazPickerYearSwitcher.vue.d.ts +33 -35
  82. package/components/MazPicker/types.d.ts +15 -15
  83. package/components/MazPicker/utils.d.ts +54 -54
  84. package/components/MazPicker.d.ts +311 -313
  85. package/components/MazPicker.mjs +2942 -0
  86. package/components/MazPicker.umd.js +2 -0
  87. package/components/MazRadioButtons.d.ts +77 -69
  88. package/components/MazRadioButtons.mjs +80 -0
  89. package/components/MazRadioButtons.umd.js +2 -0
  90. package/components/MazSelect.d.ts +185 -176
  91. package/components/MazSelect.mjs +1085 -0
  92. package/components/MazSelect.umd.js +2 -0
  93. package/components/MazSlider/utils.d.ts +15 -15
  94. package/components/MazSlider.d.ts +94 -96
  95. package/components/MazSlider.mjs +377 -0
  96. package/components/MazSlider.umd.js +2 -0
  97. package/components/MazSpinner.d.ts +28 -30
  98. package/components/MazSpinner.mjs +59 -0
  99. package/components/MazSpinner.umd.js +2 -0
  100. package/components/MazStepper.d.ts +71 -73
  101. package/components/MazStepper.mjs +227 -0
  102. package/components/MazStepper.umd.js +2 -0
  103. package/components/MazSwitch.d.ts +54 -56
  104. package/components/MazSwitch.mjs +61 -0
  105. package/components/MazSwitch.umd.js +2 -0
  106. package/components/MazTabsBar.d.ts +47 -49
  107. package/components/MazTabsBar.mjs +470 -0
  108. package/components/MazTabsBar.umd.js +2 -0
  109. package/components/MazTabsContent.d.ts +21 -16
  110. package/components/MazTabsContent.mjs +89 -0
  111. package/components/MazTabsContent.umd.js +2 -0
  112. package/components/MazTabsContentItem.d.ts +19 -14
  113. package/components/MazTabsContentItem.mjs +61 -0
  114. package/components/MazTabsContentItem.umd.js +2 -0
  115. package/components/MazTextarea/textarea-autogrow.d.ts +9 -9
  116. package/components/MazTextarea.d.ts +123 -125
  117. package/components/MazTextarea.mjs +260 -0
  118. package/components/MazTextarea.umd.js +2 -0
  119. package/components/MazTransitionExpand.d.ts +9 -4
  120. package/components/MazTransitionExpand.mjs +62 -0
  121. package/components/MazTransitionExpand.umd.js +2 -0
  122. package/components/index.d.ts +33 -33
  123. package/components/index.mjs +35 -0
  124. package/components/index.umd.js +35 -0
  125. package/components/no_photo-410a8f01.mjs +4 -0
  126. package/components/types.d.ts +17 -17
  127. package/css/main.css +1 -1
  128. package/maz-ui.d.ts +234 -232
  129. package/modules/maz-ui.mjs +1892 -0
  130. package/modules/maz-ui.umd.js +2 -0
  131. package/modules/no_photo-410a8f01.mjs +4 -0
  132. package/package.json +43 -52
  133. package/tailwindcss/tailwind.config.js +6 -7
  134. package/tailwindcss/utils/colors.js +1 -3
  135. package/tailwindcss/variables/breakpoints.js +1 -2
  136. package/tailwindcss/variables/utilities.js +1 -2
  137. package/tailwindcss/variables/z-indexes.js +1 -1
  138. package/components/MazAvatar.js +0 -3
  139. package/components/MazBackdrop.js +0 -3
  140. package/components/MazBadge.js +0 -1
  141. package/components/MazBottomSheet.js +0 -3
  142. package/components/MazBtn.js +0 -3
  143. package/components/MazCard.js +0 -3
  144. package/components/MazCarousel.js +0 -3
  145. package/components/MazChart.js +0 -1
  146. package/components/MazCheckbox.js +0 -1
  147. package/components/MazDialog.js +0 -3
  148. package/components/MazDialogPromise.js +0 -3
  149. package/components/MazDrawer.js +0 -3
  150. package/components/MazDropzone.js +0 -3
  151. package/components/MazGallery.js +0 -3
  152. package/components/MazIcon.js +0 -3
  153. package/components/MazInput.js +0 -3
  154. package/components/MazInputNumber.js +0 -3
  155. package/components/MazInputPrice.js +0 -3
  156. package/components/MazInputTags.js +0 -3
  157. package/components/MazLazyImg.js +0 -3
  158. package/components/MazPhoneNumberInput.js +0 -3
  159. package/components/MazPicker.js +0 -3
  160. package/components/MazRadioButtons.js +0 -1
  161. package/components/MazSelect.js +0 -3
  162. package/components/MazSlider.js +0 -3
  163. package/components/MazSpinner.js +0 -1
  164. package/components/MazStepper.js +0 -1
  165. package/components/MazSwitch.js +0 -1
  166. package/components/MazTabsBar.js +0 -3
  167. package/components/MazTabsContent.js +0 -1
  168. package/components/MazTabsContentItem.js +0 -3
  169. package/components/MazTextarea.js +0 -1
  170. package/components/MazTransitionExpand.js +0 -1
  171. package/components/index.js +0 -35
  172. package/components/no_photo-a72545e4.js +0 -1
  173. package/modules/index.js +0 -3
  174. package/modules/no_photo-a72545e4.js +0 -1
@@ -0,0 +1,1892 @@
1
+ (function(){"use strict";try{if(typeof document!="undefined"){var a=document.createElement("style");a.appendChild(document.createTextNode(".m-toast-container{-webkit-box-sizing:border-box;box-sizing:border-box;position:fixed;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.m-toast-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.m-toast-container{padding:1rem;z-index:1051}.m-toast-container.--top{top:0px;display:-webkit-box;display:-ms-flexbox;display:flex}.m-toast-container.--center{width:100%}@media (min-width: 768px){.m-toast-container.--center{position:fixed;left:50%;width:auto;-webkit-transform:translate(-50%,0);transform:translate(-50%)}}.m-toast-container.--bottom{bottom:0px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse}.m-toast-container.--bottom>:not([hidden])~:not([hidden]){margin-bottom:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-top:calc(.5rem * var(--tw-space-y-reverse))}.m-toast-container.--right{right:0px;width:100%}@media (min-width: 768px){.m-toast-container.--right{width:auto}}.m-toast-container.--left{left:0px;width:100%}@media (min-width: 768px){.m-toast-container.--left{width:auto}}.m-toast[data-v-ba28d9a5],.m-toast *[data-v-ba28d9a5]{-webkit-box-sizing:border-box;box-sizing:border-box}.m-toast[data-v-ba28d9a5]{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;cursor:pointer;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-ms-flex-item-align:center;align-self:center;border-radius:var(--maz-border-radius);padding-left:.5rem;padding-right:.5rem;color:var(--maz-color-white);-webkit-transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,-webkit-box-shadow,-webkit-transform,-webkit-filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,-webkit-box-shadow,-webkit-transform,-webkit-filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-box-shadow,-webkit-transform,-webkit-filter,-webkit-backdrop-filter;-webkit-transition-duration:.3s;transition-duration:.3s;-webkit-transition-timing-function:cubic-bezier(.4,0,.2,1);transition-timing-function:cubic-bezier(.4,0,.2,1)}@media (min-width: 768px){.m-toast.--left[data-v-ba28d9a5],.m-toast.--right[data-v-ba28d9a5]{width:20rem}.m-toast.--center[data-v-ba28d9a5]{width:20rem;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}}.m-toast__message-wrapper[data-v-ba28d9a5]{-webkit-box-flex:1;-ms-flex:1 1 0%;flex:1 1 0%;padding-top:.75rem;padding-bottom:.75rem}.m-toast__message[data-v-ba28d9a5]{margin:0;font-weight:500}.m-toast .--close[data-v-ba28d9a5]{margin-left:.25rem;display:-webkit-box;display:-ms-flexbox;display:flex;height:1.75rem;width:1.75rem;border-radius:var(--maz-border-radius);background-color:transparent;padding:0;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.m-toast .--close[data-v-ba28d9a5]:hover{background-color:#11182733}.m-toast .--close .--icon[data-v-ba28d9a5]{height:1.25rem;width:1.25rem;cursor:pointer}.m-toast.--info[data-v-ba28d9a5]{background-color:var(--maz-color-info);color:var(--maz-color-info-contrast)}.m-toast.--info[data-v-ba28d9a5]:hover{background-color:var(--maz-color-info-600)}.m-toast.--info .--close[data-v-ba28d9a5]{color:var(--maz-color-info-contrast)}.m-toast.--success[data-v-ba28d9a5]{background-color:var(--maz-color-success);color:var(--maz-color-success-contrast)}.m-toast.--success[data-v-ba28d9a5]:hover{background-color:var(--maz-color-success-600)}.m-toast.--success .--close[data-v-ba28d9a5]{color:var(--maz-color-success-contrast)}.m-toast.--warning[data-v-ba28d9a5]{background-color:var(--maz-color-warning);color:var(--maz-color-warning-contrast)}.m-toast.--warning[data-v-ba28d9a5]:hover{background-color:var(--maz-color-warning-600)}.m-toast.--warning .--close[data-v-ba28d9a5]{color:var(--maz-color-warning-contrast)}.m-toast.--danger[data-v-ba28d9a5]{background-color:var(--maz-color-danger);color:var(--maz-color-danger-contrast)}.m-toast.--danger[data-v-ba28d9a5]:hover{background-color:var(--maz-color-danger-600)}.m-toast.--danger .--close[data-v-ba28d9a5]{color:var(--maz-color-danger-contrast)}.m-slide-top-enter-active[data-v-ba28d9a5],.m-slide-top-leave-active[data-v-ba28d9a5]{opacity:1;-webkit-transition:all .3s;transition:all .3s;-webkit-transform:translateY(0);transform:translateY(0)}.m-slide-top-enter-from[data-v-ba28d9a5],.m-slide-top-leave-to[data-v-ba28d9a5]{opacity:0;-webkit-transform:translateY(-100%);transform:translateY(-100%)}.m-slide-bottom-enter-active[data-v-ba28d9a5],.m-slide-bottom-leave-active[data-v-ba28d9a5]{opacity:1;-webkit-transition:all .3s;transition:all .3s;-webkit-transform:translateY(0);transform:translateY(0)}.m-slide-bottom-enter-from[data-v-ba28d9a5],.m-slide-bottom-leave-to[data-v-ba28d9a5]{opacity:0;-webkit-transform:translateY(100%);transform:translateY(100%)}.m-slide-right-enter-active[data-v-ba28d9a5],.m-slide-right-leave-active[data-v-ba28d9a5]{opacity:1;-webkit-transition:all .3s;transition:all .3s;-webkit-transform:translateX(0);transform:translate(0)}.m-slide-right-enter-from[data-v-ba28d9a5],.m-slide-right-leave-to[data-v-ba28d9a5]{opacity:0;-webkit-transform:translateX(100%);transform:translate(100%)}.m-slide-left-enter-active[data-v-ba28d9a5],.m-slide-left-leave-active[data-v-ba28d9a5]{opacity:1;-webkit-transition:all .3s;transition:all .3s;-webkit-transform:translateX(0);transform:translate(0)}.m-slide-left-enter-from[data-v-ba28d9a5],.m-slide-left-leave-to[data-v-ba28d9a5]{opacity:0;-webkit-transform:translateX(-100%);transform:translate(-100%)}")),document.head.appendChild(a)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => {
5
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
+ return value;
7
+ };
8
+ import { inject, createVNode, render, nextTick, defineComponent, ref, computed, onMounted as onMounted$1, watchEffect, openBlock, createElementBlock, mergeProps, createCommentVNode, createBlock, Transition, unref, withCtx, withDirectives, createElementVNode, normalizeClass, toDisplayString, vShow } from "vue";
9
+ function injectStrict(key, fallback) {
10
+ const resolved = inject(key, fallback);
11
+ if (!resolved) {
12
+ throw new Error(`[maz-ui](injectStrict) Could not resolve ${key}`);
13
+ }
14
+ return resolved;
15
+ }
16
+ function debounce(fn, wait = 0, callFirst = false) {
17
+ let timeout;
18
+ let debouncedFn;
19
+ const clear = function() {
20
+ if (timeout) {
21
+ clearTimeout(timeout);
22
+ debouncedFn = void 0;
23
+ timeout = void 0;
24
+ }
25
+ };
26
+ const flush = function() {
27
+ const call = debouncedFn;
28
+ clear();
29
+ if (call) {
30
+ call();
31
+ }
32
+ };
33
+ const debounceWrapper = function(...args) {
34
+ if (!wait) {
35
+ return fn.apply(this, args);
36
+ }
37
+ const context = this;
38
+ const callNow = callFirst && !timeout;
39
+ clear();
40
+ debouncedFn = function() {
41
+ fn.apply(context, args);
42
+ };
43
+ timeout = setTimeout(function() {
44
+ timeout = void 0;
45
+ if (!callNow) {
46
+ const call = debouncedFn;
47
+ debouncedFn = void 0;
48
+ if (call !== void 0)
49
+ return call();
50
+ }
51
+ }, wait);
52
+ if (callNow) {
53
+ return debouncedFn();
54
+ }
55
+ };
56
+ debounceWrapper.cancel = clear;
57
+ debounceWrapper.flush = flush;
58
+ return debounceWrapper;
59
+ }
60
+ function truthyFilter(value) {
61
+ return !!value;
62
+ }
63
+ function mount(component, {
64
+ props,
65
+ children,
66
+ element,
67
+ app
68
+ } = {}) {
69
+ let el = element;
70
+ const vNode = createVNode(component, props, children);
71
+ if (app && app._context)
72
+ vNode.appContext = app._context;
73
+ if (el)
74
+ render(vNode, el);
75
+ else if (typeof document !== "undefined") {
76
+ render(vNode, el = document.createElement("div"));
77
+ }
78
+ const destroy = () => {
79
+ if (el)
80
+ render(null, el);
81
+ };
82
+ return { vNode, destroy, el };
83
+ }
84
+ function isClient() {
85
+ return typeof document !== "undefined";
86
+ }
87
+ class IdleTimeout {
88
+ constructor(callback, options) {
89
+ __publicField(this, "defaultOptions", {
90
+ element: void 0,
91
+ timeout: 60 * 1e3 * 5,
92
+ once: false,
93
+ immediate: true,
94
+ ssr: false
95
+ });
96
+ __publicField(this, "options");
97
+ __publicField(this, "timeoutHandler");
98
+ __publicField(this, "isIdle", false);
99
+ __publicField(this, "isDestroy", false);
100
+ __publicField(this, "startTime", 0);
101
+ __publicField(this, "remainingTime", 0);
102
+ __publicField(this, "lastClientX", -1);
103
+ __publicField(this, "lastClientY", -1);
104
+ __publicField(this, "eventNames", [
105
+ "DOMMouseScroll",
106
+ "mousedown",
107
+ "mousemove",
108
+ "mousewheel",
109
+ "MSPointerDown",
110
+ "MSPointerMove",
111
+ "keydown",
112
+ "touchmove",
113
+ "touchstart",
114
+ "wheel",
115
+ "click"
116
+ ]);
117
+ __publicField(this, "handleEvent", (event) => {
118
+ try {
119
+ if (this.remainingTime > 0) {
120
+ return;
121
+ }
122
+ if (event.type === "mousemove") {
123
+ const { clientX, clientY } = event;
124
+ if (clientX === void 0 && clientY === void 0 || clientX === this.lastClientX && clientY === this.lastClientY) {
125
+ return;
126
+ }
127
+ this.lastClientX = clientX;
128
+ this.lastClientY = clientY;
129
+ }
130
+ this.resetTimeout();
131
+ this.callback({ isIdle: this.isIdle, eventType: event.type });
132
+ } catch (error) {
133
+ throw new Error(`[IdleTimeout](handleEvent) ${error}`);
134
+ }
135
+ });
136
+ this.callback = callback;
137
+ this.options = {
138
+ ...this.defaultOptions,
139
+ ...options
140
+ };
141
+ if (!this.options.ssr && isClient()) {
142
+ this.start();
143
+ } else if (!this.options.ssr && !isClient()) {
144
+ console.warn(
145
+ `[IdleTimeout](constructor) executed on server side - set immediate option to "false"`
146
+ );
147
+ }
148
+ }
149
+ get element() {
150
+ return this.options.element ?? document.body;
151
+ }
152
+ start() {
153
+ if (!isClient()) {
154
+ console.warn(
155
+ `[IdleTimeout](start) you should run this method on client side`
156
+ );
157
+ return;
158
+ }
159
+ for (const eventName of this.eventNames) {
160
+ this.element.addEventListener(eventName, this.handleEvent);
161
+ }
162
+ this.resetTimeout();
163
+ if (this.options.immediate) {
164
+ this.callback({ isIdle: false });
165
+ }
166
+ }
167
+ pause() {
168
+ const remainingTime = this.startTime + this.options.timeout - Date.now();
169
+ if (remainingTime <= 0) {
170
+ return;
171
+ }
172
+ this.remainingTime = remainingTime;
173
+ if (this.timeoutHandler) {
174
+ clearTimeout(this.timeoutHandler);
175
+ this.timeoutHandler = void 0;
176
+ }
177
+ }
178
+ resume() {
179
+ if (this.remainingTime <= 0) {
180
+ return;
181
+ }
182
+ this.resetTimeout();
183
+ this.callback({ isIdle: this.isIdle });
184
+ this.remainingTime = 0;
185
+ }
186
+ reset() {
187
+ this.isDestroy = false;
188
+ this.isIdle = false;
189
+ this.remainingTime = 0;
190
+ this.resetTimeout();
191
+ this.callback({ isIdle: this.isIdle });
192
+ }
193
+ destroy() {
194
+ if (!isClient()) {
195
+ console.warn(
196
+ `[IdleTimeout](destroy) you should run this method on client side`
197
+ );
198
+ return;
199
+ }
200
+ this.isDestroy = true;
201
+ for (const eventName of this.eventNames) {
202
+ this.element.removeEventListener(eventName, this.handleEvent);
203
+ }
204
+ if (this.timeoutHandler) {
205
+ clearTimeout(this.timeoutHandler);
206
+ }
207
+ }
208
+ resetTimeout() {
209
+ this.isIdle = false;
210
+ if (this.timeoutHandler) {
211
+ clearTimeout(this.timeoutHandler);
212
+ this.timeoutHandler = void 0;
213
+ }
214
+ this.timeoutHandler = setTimeout(
215
+ this.handleTimeout.bind(this),
216
+ this.remainingTime || this.options.timeout
217
+ );
218
+ this.startTime = Date.now();
219
+ }
220
+ handleTimeout() {
221
+ this.isIdle = true;
222
+ this.callback({ isIdle: this.isIdle });
223
+ if (this.options.once) {
224
+ this.destroy();
225
+ }
226
+ }
227
+ get destroyed() {
228
+ return this.isDestroy;
229
+ }
230
+ get timeout() {
231
+ return this.options.timeout;
232
+ }
233
+ set timeout(value) {
234
+ this.options.timeout = value;
235
+ }
236
+ get idle() {
237
+ return this.isIdle;
238
+ }
239
+ set idle(value) {
240
+ if (value) {
241
+ this.handleTimeout();
242
+ } else {
243
+ this.reset();
244
+ }
245
+ this.callback({ isIdle: this.isIdle });
246
+ }
247
+ }
248
+ class UserVisibility {
249
+ constructor(callback, options) {
250
+ __publicField(this, "eventHandlerFunction");
251
+ __publicField(this, "event", "visibilitychange");
252
+ __publicField(this, "timeoutHandler");
253
+ __publicField(this, "options");
254
+ __publicField(this, "defaultOptions", {
255
+ timeout: 5e3,
256
+ once: false,
257
+ immediate: true,
258
+ ssr: false
259
+ });
260
+ __publicField(this, "isVisible", false);
261
+ this.callback = callback;
262
+ this.options = {
263
+ ...this.defaultOptions,
264
+ ...options
265
+ };
266
+ this.eventHandlerFunction = this.eventHandler.bind(this);
267
+ if (!this.options.ssr && isClient()) {
268
+ this.start();
269
+ } else if (!this.options.ssr && !isClient()) {
270
+ console.warn(
271
+ `[UserVisibility](constructor) executed on server side - set "ssr" option to "false"`
272
+ );
273
+ }
274
+ }
275
+ start() {
276
+ if (!isClient()) {
277
+ console.warn(
278
+ `[UserVisibility](start) you should run this method on client side`
279
+ );
280
+ return;
281
+ }
282
+ if (this.options.immediate) {
283
+ this.emitCallback();
284
+ }
285
+ this.addEventListener();
286
+ }
287
+ emitCallback() {
288
+ this.isVisible = document.visibilityState === "visible";
289
+ this.callback({ isVisible: this.isVisible });
290
+ if (this.options.once) {
291
+ this.destroy();
292
+ }
293
+ }
294
+ eventHandler() {
295
+ if (document.visibilityState === "visible" && !this.isVisible) {
296
+ this.clearTimeout();
297
+ this.emitCallback();
298
+ } else if (document.visibilityState === "hidden") {
299
+ this.initTimeout();
300
+ }
301
+ }
302
+ clearTimeout() {
303
+ if (this.timeoutHandler) {
304
+ clearTimeout(this.timeoutHandler);
305
+ this.timeoutHandler = void 0;
306
+ }
307
+ }
308
+ initTimeout() {
309
+ this.clearTimeout();
310
+ this.timeoutHandler = setTimeout(
311
+ this.emitCallback.bind(this),
312
+ this.options.timeout
313
+ );
314
+ }
315
+ addEventListener() {
316
+ document.addEventListener(this.event, this.eventHandlerFunction);
317
+ }
318
+ removeEventListener() {
319
+ document.removeEventListener(this.event, this.eventHandlerFunction);
320
+ }
321
+ destroy() {
322
+ this.removeEventListener();
323
+ if (this.timeoutHandler) {
324
+ clearTimeout(this.timeoutHandler);
325
+ }
326
+ }
327
+ }
328
+ const sleep$1 = (duration) => {
329
+ return new Promise((resolve) => {
330
+ setTimeout(resolve, duration);
331
+ });
332
+ };
333
+ const UNIQUE_ID = "__vue_click_away__";
334
+ const getEventType$1 = () => {
335
+ return document.ontouchstart === null ? "touchstart" : "click";
336
+ };
337
+ const onMounted = async (el, binding) => {
338
+ onUnmounted(el);
339
+ const vm = binding.instance;
340
+ const callback = binding.value;
341
+ const isCallbackFunction = typeof callback === "function";
342
+ if (!isCallbackFunction) {
343
+ throw new Error("[maz-ui](vClickOutside) the callback should be a function");
344
+ }
345
+ await nextTick();
346
+ el[UNIQUE_ID] = (event) => {
347
+ if ((!el || !el.contains(event.target)) && callback && isCallbackFunction) {
348
+ return callback.call(vm, event);
349
+ }
350
+ };
351
+ const eventType = getEventType$1();
352
+ document.addEventListener(eventType, el[UNIQUE_ID], false);
353
+ };
354
+ const onUnmounted = (el) => {
355
+ const eventType = getEventType$1();
356
+ document.removeEventListener(eventType, el[UNIQUE_ID], false);
357
+ delete el[UNIQUE_ID];
358
+ };
359
+ const onUpdated = (el, binding) => {
360
+ if (binding.value === binding.oldValue) {
361
+ return;
362
+ }
363
+ onMounted(el, binding);
364
+ };
365
+ const directive$1 = {
366
+ mounted: onMounted,
367
+ updated: onUpdated,
368
+ unmounted: onUnmounted
369
+ };
370
+ const plugin$6 = {
371
+ install: (app) => {
372
+ app.directive("click-outside", directive$1);
373
+ }
374
+ };
375
+ const handleOutsideClick = (event, element, binding, vnode) => {
376
+ event.stopPropagation();
377
+ const { handler: handler2, exclude } = binding.value;
378
+ let clickedOnExcludedElement = false;
379
+ if (exclude && exclude.length > 0) {
380
+ for (const referenceName of exclude) {
381
+ if (!clickedOnExcludedElement) {
382
+ const excludedElement = vnode.context.$refs[referenceName];
383
+ clickedOnExcludedElement = excludedElement.contains(event.target);
384
+ }
385
+ }
386
+ }
387
+ if (!element.contains(event.target) && !clickedOnExcludedElement) {
388
+ vnode.context[handler2]();
389
+ }
390
+ };
391
+ const getEventType = () => {
392
+ return document.ontouchstart === null ? "touchstart" : "click";
393
+ };
394
+ const unbind = (element, binding, vnode) => {
395
+ const eventType = getEventType();
396
+ document.removeEventListener(
397
+ eventType,
398
+ (event) => handleOutsideClick(event, element, binding, vnode)
399
+ );
400
+ };
401
+ const bind = (element, binding, vnode) => {
402
+ const eventType = getEventType();
403
+ document.addEventListener(
404
+ eventType,
405
+ (event) => handleOutsideClick(event, element, binding, vnode)
406
+ );
407
+ };
408
+ const directive = {
409
+ mounted: bind,
410
+ unmounted: unbind
411
+ };
412
+ const plugin$5 = {
413
+ install: (app) => {
414
+ app.directive("closable", directive);
415
+ }
416
+ };
417
+ const style = `
418
+ .maz-zoom-img {
419
+ position: fixed;
420
+ top: 0;
421
+ bottom: 0;
422
+ left: 0;
423
+ right: 0;
424
+ padding: 2.5rem;
425
+ z-index: 1050;
426
+ background-color: hsla(238, 15%, 40%, 0.7);
427
+ display: flex;
428
+ align-items: center;
429
+ justify-content: center;
430
+ flex-direction: column;
431
+ }
432
+
433
+ .maz-zoom-img,
434
+ .maz-zoom-img * {
435
+ box-sizing: border-box;
436
+ }
437
+
438
+ .maz-zoom-img .maz-zoom-img__wrapper {
439
+ position: relative;
440
+ display: flex;
441
+ justify-content: center;
442
+ align-items: center;
443
+ min-width: 0;
444
+ min-height: 0;
445
+ max-width: 100%;
446
+ max-height: 100%;
447
+ transition: all 300ms ease-in-out;
448
+ opacity: 0;
449
+ transform: scale(0.5);
450
+ }
451
+
452
+ .maz-zoom-img.maz-animate .maz-zoom-img__wrapper {
453
+ opacity: 1;
454
+ transform: scale(1);
455
+ }
456
+
457
+ .maz-zoom-img.maz-animate .maz-zoom-img__loader {
458
+ position: absolute;
459
+ top: 0;
460
+ bottom: 0;
461
+ left: 0;
462
+ right: 0;
463
+ display: flex;
464
+ align-items: center;
465
+ justify-content: center;
466
+ background-color: hsla(238, 15%, 40%, 0.7);
467
+ border-radius: 1rem;
468
+ z-index: 2;
469
+ min-width: 60px;
470
+ min-height: 60px;
471
+ }
472
+ .maz-zoom-img.maz-animate .maz-zoom-img__loader[hidden] {
473
+ display: none;
474
+ }
475
+
476
+ @-webkit-keyframes spin {
477
+ 0% { transform: rotate(0deg); }
478
+ 100% { transform: rotate(360deg); }
479
+ }
480
+
481
+ @keyframes spin {
482
+ 0% { transform: rotate(0deg); }
483
+ 100% { transform: rotate(360deg); }
484
+ }
485
+
486
+ .maz-zoom-img.maz-animate .maz-zoom-img__loader__svg {
487
+ animation: spin .6s linear infinite;
488
+ }
489
+
490
+ .maz-zoom-img img {
491
+ max-width: 100%;
492
+ max-height: 100%;
493
+ min-width: 0;
494
+ border-radius: 1rem;
495
+ }
496
+
497
+ .maz-zoom-img .maz-zoom-btn {
498
+ margin: 0 auto;
499
+ border: none;
500
+ background-color: hsla(0, 0%, 7%, 0.5);
501
+ box-shadow: 0 0 0.5rem 0 hsla(0, 0%, 0%, 0.2);
502
+ height: 2.2rem;
503
+ min-height: 2.2rem;
504
+ width: 2.2rem;
505
+ min-width: 2.2rem;
506
+ display: flex;
507
+ align-items: center;
508
+ justify-content: center;
509
+ border-radius: 2.2rem;
510
+ cursor: pointer;
511
+ flex: 0 0 auto;
512
+ outline: none;
513
+ }
514
+
515
+ .maz-zoom-img .maz-zoom-btn svg {
516
+ fill: white;
517
+ }
518
+
519
+ .maz-zoom-img .maz-zoom-btn.maz-zoom-btn--close {
520
+ position: absolute;
521
+ top: 0.5rem;
522
+ right: 0.5rem;
523
+ z-index: 1;
524
+ }
525
+
526
+ .maz-zoom-img .maz-zoom-btn.maz-zoom-btn--previous {
527
+ position: absolute;
528
+ left: 0.5rem;
529
+ z-index: 1;
530
+ }
531
+
532
+ .maz-zoom-img .maz-zoom-btn.maz-zoom-btn--next {
533
+ position: absolute;
534
+ right: 0.5rem;
535
+ z-index: 1;
536
+ }
537
+
538
+ .maz-zoom-img .maz-zoom-btn:hover {
539
+ background-color: hsl(0, 0%, 0%);
540
+ }`;
541
+ const svgs = {
542
+ 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>',
543
+ 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>',
544
+ 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>',
545
+ 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>'
546
+ };
547
+ class VueZoomImg {
548
+ constructor(binding) {
549
+ __publicField(this, "options");
550
+ __publicField(this, "loader");
551
+ __publicField(this, "wrapper");
552
+ __publicField(this, "img");
553
+ __publicField(this, "keydownHandler");
554
+ __publicField(this, "onImgLoadedCallback");
555
+ __publicField(this, "buttonsAdded");
556
+ __publicField(this, "defaultOptions", {
557
+ scale: true,
558
+ blur: true,
559
+ disabled: false
560
+ });
561
+ __publicField(this, "mouseEnterListener");
562
+ __publicField(this, "mouseLeaveListener");
563
+ __publicField(this, "renderPreviewListener");
564
+ if (!binding.value) {
565
+ throw new Error(
566
+ '[MazUI](zoom-img) Image path must be defined. Ex: `v-zoom-img="<PATH_TO_IMAGE>"`'
567
+ );
568
+ }
569
+ if (typeof binding.value === "object" && !binding.value.src) {
570
+ throw new Error("[maz-ui](zoom-img) src of image must be provided");
571
+ }
572
+ this.buttonsAdded = false;
573
+ this.options = this.buildOptions(binding);
574
+ this.keydownHandler = this.keydownLister.bind(this);
575
+ this.loader = this.getLoader();
576
+ this.wrapper = document.createElement("div");
577
+ this.wrapper.classList.add("maz-zoom-img__wrapper");
578
+ this.wrapper.prepend(this.loader);
579
+ this.img = document.createElement("img");
580
+ this.onImgLoadedCallback = this.onImgLoaded.bind(this);
581
+ this.imgEventHandler(true);
582
+ }
583
+ buildOptions(binding) {
584
+ return {
585
+ ...this.defaultOptions,
586
+ ...typeof binding.value === "object" ? binding.value : { src: binding.value }
587
+ };
588
+ }
589
+ get allInstances() {
590
+ return [
591
+ ...document.querySelectorAll(".maz-zoom-img-instance")
592
+ ];
593
+ }
594
+ create(el) {
595
+ if (this.options.disabled)
596
+ return;
597
+ el.style.cursor = "pointer";
598
+ setTimeout(() => el.classList.add("maz-zoom-img-instance"));
599
+ el.setAttribute("data-src", this.options.src);
600
+ if (this.options.alt)
601
+ el.setAttribute("data-alt", this.options.alt);
602
+ el.style.transition = "all 300ms ease-in-out";
603
+ this.mouseEnterListener = () => this.mouseEnter(el);
604
+ this.mouseLeaveListener = () => this.mouseLeave(el);
605
+ this.renderPreviewListener = () => this.renderPreview(el, this.options);
606
+ el.addEventListener("mouseenter", this.mouseEnterListener);
607
+ el.addEventListener("mouseleave", this.mouseLeaveListener);
608
+ el.addEventListener("click", this.renderPreviewListener);
609
+ }
610
+ update(binding) {
611
+ this.options = this.buildOptions(binding);
612
+ }
613
+ remove(el) {
614
+ this.imgEventHandler(false);
615
+ el.removeEventListener("mouseenter", this.mouseEnterListener);
616
+ el.removeEventListener("mouseleave", this.mouseLeaveListener);
617
+ el.removeEventListener("click", this.renderPreviewListener);
618
+ el.classList.remove("maz-zoom-img-instance");
619
+ el.removeAttribute("data-src");
620
+ el.removeAttribute("data-alt");
621
+ el.style.cursor = "";
622
+ }
623
+ renderPreview(el, options) {
624
+ el.classList.add("maz-is-open");
625
+ this.addStyle(style);
626
+ const container = document.createElement("div");
627
+ container.classList.add("maz-zoom-img");
628
+ container.setAttribute("id", "MazImgPreviewFullsize");
629
+ container.addEventListener("click", (e) => {
630
+ if (container.isEqualNode(e.target)) {
631
+ this.closePreview();
632
+ }
633
+ });
634
+ if (typeof options === "object") {
635
+ this.img.setAttribute("src", options.src);
636
+ if (options.alt)
637
+ this.img.setAttribute("alt", options.alt);
638
+ this.img.id = "MazImgElement";
639
+ }
640
+ this.wrapper.append(this.img);
641
+ container.append(this.wrapper);
642
+ document.body.append(container);
643
+ this.keyboardEventHandler(true);
644
+ setTimeout(() => {
645
+ if (container)
646
+ container.classList.add("maz-animate");
647
+ }, 100);
648
+ }
649
+ onImgLoaded() {
650
+ this.wrapper.style.width = `${this.img.width}px`;
651
+ this.wrapper.style.minWidth = `200px`;
652
+ this.loader.hidden = true;
653
+ const closeButton = this.getButton();
654
+ const buttons = [];
655
+ const hasMultipleInstance = this.allInstances.length > 1;
656
+ if (!this.buttonsAdded) {
657
+ this.buttonsAdded = true;
658
+ if (hasMultipleInstance) {
659
+ const previousButton = this.getButton("previous");
660
+ const nextButton = this.getButton("next");
661
+ buttons.push(previousButton, nextButton);
662
+ }
663
+ this.wrapper.append(closeButton);
664
+ if (hasMultipleInstance) {
665
+ this.wrapper.prepend(buttons[0]);
666
+ this.wrapper.append(buttons[1]);
667
+ }
668
+ }
669
+ }
670
+ getLoader() {
671
+ const loader = document.createElement("div");
672
+ loader.classList.add("maz-zoom-img__loader");
673
+ loader.innerHTML = svgs.spinner;
674
+ return loader;
675
+ }
676
+ mouseLeave(el) {
677
+ if (this.options.scale)
678
+ el.style.transform = "";
679
+ if (this.options.blur)
680
+ el.style.filter = "";
681
+ el.style.zIndex = "";
682
+ }
683
+ mouseEnter(el) {
684
+ el.style.zIndex = "1";
685
+ if (this.options.scale)
686
+ el.style.transform = "scale(1.1)";
687
+ if (this.options.blur)
688
+ el.style.filter = "blur(2px)";
689
+ }
690
+ keydownLister(e) {
691
+ e.preventDefault();
692
+ if (e.key === "Escape" || e.key === " ") {
693
+ this.closePreview();
694
+ }
695
+ if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
696
+ this.nextPreviousImage(e.key === "ArrowRight");
697
+ }
698
+ }
699
+ getButton(iconName = "close") {
700
+ const button = document.createElement("button");
701
+ button.innerHTML = svgs[iconName];
702
+ button.addEventListener("click", () => {
703
+ iconName === "close" ? this.closePreview() : this.allInstances ? this.nextPreviousImage(iconName === "next") : null;
704
+ });
705
+ button.classList.add("maz-zoom-btn");
706
+ button.classList.add(`maz-zoom-btn--${iconName}`);
707
+ return button;
708
+ }
709
+ closePreview() {
710
+ const container = document.querySelector(
711
+ "#MazImgPreviewFullsize"
712
+ );
713
+ const style2 = document.querySelector("#MazPreviewStyle");
714
+ const instance2 = document.querySelector(
715
+ ".maz-zoom-img-instance.maz-is-open"
716
+ );
717
+ if (instance2)
718
+ instance2.classList.remove("maz-is-open");
719
+ if (container)
720
+ container.classList.remove("maz-animate");
721
+ this.keyboardEventHandler(false);
722
+ setTimeout(() => {
723
+ if (container)
724
+ container.remove();
725
+ if (style2)
726
+ style2.remove();
727
+ }, 300);
728
+ }
729
+ getNewInstanceIndex(newInstanceIndex) {
730
+ return newInstanceIndex < 0 ? this.allInstances.length - 1 : newInstanceIndex >= this.allInstances.length ? 0 : newInstanceIndex;
731
+ }
732
+ nextPreviousImage(isNext) {
733
+ const selectNextInstance = isNext;
734
+ const currentInstance = document.querySelector(
735
+ ".maz-zoom-img-instance.maz-is-open"
736
+ );
737
+ if (currentInstance) {
738
+ const currentInstanceIndex = this.allInstances.indexOf(currentInstance);
739
+ const newInstanceIndex = selectNextInstance ? currentInstanceIndex + 1 : currentInstanceIndex - 1;
740
+ const nextInstance = this.allInstances[this.getNewInstanceIndex(newInstanceIndex)];
741
+ if (nextInstance) {
742
+ this.useNextInstance(currentInstance, nextInstance);
743
+ }
744
+ }
745
+ }
746
+ useNextInstance(currentInstance, nextInstance) {
747
+ currentInstance.classList.remove("maz-is-open");
748
+ nextInstance.classList.add("maz-is-open");
749
+ const src = nextInstance.getAttribute("data-src");
750
+ const alt = nextInstance.getAttribute("data-alt");
751
+ this.wrapper.style.width = "";
752
+ this.loader.hidden = false;
753
+ if (src)
754
+ this.img.setAttribute("src", src);
755
+ if (alt)
756
+ this.img.setAttribute("alt", alt);
757
+ }
758
+ addStyle(styleString) {
759
+ const style2 = document.createElement("style");
760
+ style2.id = "MazPreviewStyle";
761
+ style2.textContent = styleString;
762
+ document.head.append(style2);
763
+ }
764
+ keyboardEventHandler(add) {
765
+ if (add)
766
+ return document.addEventListener("keydown", this.keydownHandler);
767
+ document.removeEventListener("keydown", this.keydownHandler);
768
+ }
769
+ imgEventHandler(add) {
770
+ if (add)
771
+ return this.img.addEventListener("load", this.onImgLoadedCallback);
772
+ this.img.removeEventListener("load", this.onImgLoadedCallback);
773
+ }
774
+ }
775
+ let instance$4;
776
+ const vZoomImg = {
777
+ created(el, binding) {
778
+ instance$4 = new VueZoomImg(binding);
779
+ instance$4.create(el);
780
+ },
781
+ updated(_el, binding) {
782
+ instance$4.update(binding);
783
+ },
784
+ unmounted(el) {
785
+ instance$4.remove(el);
786
+ }
787
+ };
788
+ const plugin$4 = {
789
+ install(app) {
790
+ app.directive("zoom-img", vZoomImg);
791
+ }
792
+ };
793
+ const EMPTY_PHOTO = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
794
+ const DEFAULT_OPTIONS$5 = {
795
+ baseClass: "m-lazy-img",
796
+ loadedClass: "m-lazy-loaded",
797
+ loadingClass: "m-lazy-loading",
798
+ errorClass: "m-lazy-error",
799
+ noPhotoClass: "m-lazy-no-photo",
800
+ noPhoto: false,
801
+ observerOnce: true,
802
+ loadOnce: false,
803
+ noUseErrorPhoto: false,
804
+ observerOptions: {
805
+ threshold: 0.1
806
+ }
807
+ };
808
+ class LazyImg {
809
+ constructor(opts = {}) {
810
+ __publicField(this, "observers", []);
811
+ __publicField(this, "defaultOptions", DEFAULT_OPTIONS$5);
812
+ __publicField(this, "options");
813
+ __publicField(this, "onImgLoadedCallback");
814
+ __publicField(this, "onImgErrorCallback");
815
+ __publicField(this, "hasImgLoaded", false);
816
+ this.options = this.buildOptions(opts);
817
+ this.onImgLoadedCallback = this.imageIsLoaded.bind(this);
818
+ this.onImgErrorCallback = this.imageHasError.bind(this);
819
+ }
820
+ async loadErrorPhoto() {
821
+ const { default: photo } = await import("./no_photo-410a8f01.mjs");
822
+ return photo;
823
+ }
824
+ buildOptions(opts) {
825
+ return {
826
+ ...this.defaultOptions,
827
+ ...opts,
828
+ observerOptions: {
829
+ ...this.defaultOptions.observerOptions,
830
+ ...opts.observerOptions
831
+ }
832
+ };
833
+ }
834
+ removeClass(el, className) {
835
+ el.classList.remove(className);
836
+ }
837
+ addClass(el, className) {
838
+ el.classList.add(className);
839
+ }
840
+ removeAllStateClasses(el) {
841
+ this.removeClass(el, this.options.loadedClass);
842
+ this.removeClass(el, this.options.loadingClass);
843
+ this.removeClass(el, this.options.errorClass);
844
+ this.removeClass(el, this.options.noPhotoClass);
845
+ }
846
+ setBaseClass(el) {
847
+ this.addClass(el, this.options.baseClass);
848
+ }
849
+ imageIsLoading(el) {
850
+ var _a, _b;
851
+ this.addClass(el, this.options.loadingClass);
852
+ (_b = (_a = this.options).onLoading) == null ? void 0 : _b.call(_a, el);
853
+ }
854
+ imageHasNoPhoto(el) {
855
+ this.removeClass(el, this.options.loadingClass);
856
+ this.addClass(el, this.options.noPhotoClass);
857
+ this.setDefaultPhoto(el);
858
+ }
859
+ imageIsLoaded(el) {
860
+ var _a, _b;
861
+ this.hasImgLoaded = true;
862
+ this.removeClass(el, this.options.loadingClass);
863
+ this.addClass(el, this.options.loadedClass);
864
+ (_b = (_a = this.options).onLoaded) == null ? void 0 : _b.call(_a, el);
865
+ }
866
+ imageHasError(el, event) {
867
+ var _a, _b;
868
+ console.warn(`[maz-ui][MazLazyImg] Error while loading image`, event);
869
+ this.removeClass(el, this.options.loadingClass);
870
+ this.addClass(el, this.options.errorClass);
871
+ (_b = (_a = this.options).onError) == null ? void 0 : _b.call(_a, el);
872
+ this.setDefaultPhoto(el);
873
+ }
874
+ getImageUrl(el, binding) {
875
+ const dataSrc = this.getImgElement(el).getAttribute("data-src");
876
+ if (dataSrc)
877
+ return dataSrc;
878
+ const bindingSrc = typeof binding.value === "object" ? binding.value.src : binding.value;
879
+ if (!bindingSrc)
880
+ console.warn(`[maz-ui][MazLazyImg] src url is not defined`);
881
+ return bindingSrc;
882
+ }
883
+ async setPictureSourceUrls(el) {
884
+ const sourceElements = el.querySelectorAll("source");
885
+ if (sourceElements.length > 0) {
886
+ for await (const source of sourceElements) {
887
+ const srcSet = source.getAttribute("data-srcset");
888
+ if (srcSet) {
889
+ source.srcset = srcSet;
890
+ } else {
891
+ console.warn(
892
+ '[maz-ui][MazLazyImg] the "[data-srcset]" attribute is not provided on "<source />"'
893
+ );
894
+ }
895
+ }
896
+ } else {
897
+ console.warn(
898
+ '[maz-ui][MazLazyImg] No "<source />" elements provided into the "<picture />" element'
899
+ );
900
+ this.imageHasError(el);
901
+ }
902
+ }
903
+ hasBgImgMode(binding) {
904
+ return binding.arg === "bg-image";
905
+ }
906
+ isPictureElement(el) {
907
+ return el instanceof HTMLPictureElement;
908
+ }
909
+ getImgElement(el) {
910
+ const isPictureElement = this.isPictureElement(el);
911
+ return isPictureElement ? el.querySelector("img") : el;
912
+ }
913
+ async setDefaultPhoto(el) {
914
+ if (this.options.noUseErrorPhoto)
915
+ return;
916
+ const errorPhoto = this.options.errorPhoto ?? await this.loadErrorPhoto();
917
+ const sourceElements = el.querySelectorAll("source");
918
+ if (sourceElements.length > 0) {
919
+ for await (const source of sourceElements) {
920
+ source.srcset = errorPhoto;
921
+ }
922
+ } else {
923
+ this.setImgSrc(el, errorPhoto);
924
+ }
925
+ }
926
+ addEventListenerToImg(el) {
927
+ const imgElement = this.getImgElement(el);
928
+ imgElement.addEventListener("load", () => this.onImgLoadedCallback(el), {
929
+ once: true
930
+ });
931
+ imgElement.addEventListener(
932
+ "error",
933
+ (err) => this.onImgErrorCallback(el, err),
934
+ { once: true }
935
+ );
936
+ }
937
+ async loadImage(el, binding) {
938
+ this.imageIsLoading(el);
939
+ if (this.isPictureElement(el)) {
940
+ this.addEventListenerToImg(el);
941
+ await this.setPictureSourceUrls(el);
942
+ } else {
943
+ const imageUrl = this.getImageUrl(el, binding);
944
+ if (!imageUrl)
945
+ return this.imageHasError(el);
946
+ if (this.hasBgImgMode(binding)) {
947
+ el.style.backgroundImage = `url('${imageUrl}')`;
948
+ this.imageIsLoaded(el);
949
+ } else {
950
+ this.addEventListenerToImg(el);
951
+ this.setImgSrc(el, imageUrl);
952
+ }
953
+ }
954
+ }
955
+ setImgSrc(el, src) {
956
+ const imgElement = this.getImgElement(el);
957
+ imgElement.src = src;
958
+ }
959
+ handleIntersectionObserver(el, binding, entries, observer) {
960
+ var _a, _b;
961
+ this.observers.push(observer);
962
+ for (const entry of entries) {
963
+ if (entry.isIntersecting) {
964
+ (_b = (_a = this.options).onIntersecting) == null ? void 0 : _b.call(_a, entry.target);
965
+ if (this.options.observerOnce) {
966
+ observer.unobserve(el);
967
+ }
968
+ if (this.options.loadOnce && this.hasImgLoaded)
969
+ return;
970
+ this.loadImage(el, binding);
971
+ }
972
+ }
973
+ }
974
+ createObserver(el, binding) {
975
+ const observerCallback = (entries, intersectionObserver) => {
976
+ this.handleIntersectionObserver(
977
+ el,
978
+ binding,
979
+ entries,
980
+ intersectionObserver
981
+ );
982
+ };
983
+ const observerOptions = this.options.observerOptions;
984
+ const observer = new IntersectionObserver(observerCallback, observerOptions);
985
+ observer.observe(el);
986
+ }
987
+ async imageHandler(el, binding, type) {
988
+ if (type === "update") {
989
+ for await (const observer of this.observers)
990
+ observer.unobserve(el);
991
+ }
992
+ if (window.IntersectionObserver) {
993
+ this.createObserver(el, binding);
994
+ } else {
995
+ this.loadImage(el, binding);
996
+ }
997
+ }
998
+ async bindUpdateHandler(el, binding, type) {
999
+ if (this.options.noPhoto)
1000
+ return this.imageHasNoPhoto(el);
1001
+ await this.imageHandler(el, binding, type);
1002
+ }
1003
+ async add(el, binding) {
1004
+ if (this.hasBgImgMode(binding) && this.isPictureElement(el)) {
1005
+ throw new Error(
1006
+ `[MazLazyImg] You can't use the "bg-image" mode with "<picture />" element`
1007
+ );
1008
+ }
1009
+ setTimeout(() => this.setBaseClass(el), 0);
1010
+ if (!el.getAttribute("src"))
1011
+ this.setImgSrc(el, EMPTY_PHOTO);
1012
+ await this.bindUpdateHandler(el, binding, "bind");
1013
+ }
1014
+ async update(el, binding) {
1015
+ if (binding.value !== binding.oldValue) {
1016
+ this.hasImgLoaded = false;
1017
+ this.removeAllStateClasses(el);
1018
+ await this.bindUpdateHandler(el, binding, "update");
1019
+ }
1020
+ }
1021
+ remove(el, binding) {
1022
+ this.hasImgLoaded = false;
1023
+ if (this.hasBgImgMode(binding))
1024
+ el.style.backgroundImage = "";
1025
+ this.removeAllStateClasses(el);
1026
+ for (const observer of this.observers)
1027
+ observer.unobserve(el);
1028
+ this.observers = [];
1029
+ }
1030
+ }
1031
+ let instance$3;
1032
+ const vLazyImg = {
1033
+ created(el, binding) {
1034
+ const options = typeof binding.value === "object" ? binding.value : {};
1035
+ instance$3 = new LazyImg(options);
1036
+ instance$3.add(el, binding);
1037
+ },
1038
+ updated(el, binding) {
1039
+ instance$3.update(el, binding);
1040
+ },
1041
+ unmounted(el, binding) {
1042
+ instance$3.remove(el, binding);
1043
+ }
1044
+ };
1045
+ const DIRECTIVE_NAME = "lazy-img";
1046
+ const plugin$3 = {
1047
+ install(app, opts = {}) {
1048
+ const options = {
1049
+ ...DEFAULT_OPTIONS$5,
1050
+ ...opts,
1051
+ observerOptions: {
1052
+ ...DEFAULT_OPTIONS$5.observerOptions,
1053
+ ...opts.observerOptions
1054
+ }
1055
+ };
1056
+ const instance2 = new LazyImg(options);
1057
+ app.directive(DIRECTIVE_NAME, {
1058
+ created: instance2.add.bind(instance2),
1059
+ updated: instance2.update.bind(instance2),
1060
+ unmounted: instance2.remove.bind(instance2)
1061
+ });
1062
+ }
1063
+ };
1064
+ const directives = [
1065
+ {
1066
+ name: "click-outside",
1067
+ directive: directive$1
1068
+ },
1069
+ {
1070
+ name: "closable",
1071
+ directive
1072
+ },
1073
+ {
1074
+ name: "zoom-img",
1075
+ directive: vZoomImg
1076
+ },
1077
+ {
1078
+ name: "lazy-img",
1079
+ directive: vLazyImg
1080
+ }
1081
+ ];
1082
+ const installDirectives = {
1083
+ install(app) {
1084
+ for (const { name, directive: directive2 } of directives) {
1085
+ app.directive(name, directive2);
1086
+ }
1087
+ }
1088
+ };
1089
+ const capitalize = (value) => {
1090
+ if (!value)
1091
+ return "";
1092
+ value = value.toString();
1093
+ return value.charAt(0).toUpperCase() + value.slice(1);
1094
+ };
1095
+ const DEFAULT_OPTIONS$4 = {
1096
+ style: "currency",
1097
+ minimumFractionDigits: 2,
1098
+ round: false
1099
+ };
1100
+ const getFormattedCurrency = (number2, locale, options) => {
1101
+ let numberToFormat = Number(number2);
1102
+ if (options.round) {
1103
+ numberToFormat = Math.floor(numberToFormat);
1104
+ options.minimumFractionDigits = 0;
1105
+ }
1106
+ return new Intl.NumberFormat(locale, options).format(numberToFormat);
1107
+ };
1108
+ const validRequiredAttributes = (number2, locale, options) => {
1109
+ if (number2 === void 0)
1110
+ throw new TypeError(
1111
+ "[maz-ui](FilterCurrency) The `number` attribute is required."
1112
+ );
1113
+ if (locale === void 0)
1114
+ throw new TypeError(
1115
+ "[maz-ui](FilterCurrency) The `locale` attribute is required."
1116
+ );
1117
+ if (typeof locale !== "string")
1118
+ throw new TypeError(
1119
+ "[maz-ui](FilterCurrency) The `locale` attribute must be a string."
1120
+ );
1121
+ if (options.currency === void 0)
1122
+ throw new TypeError(
1123
+ "[maz-ui](FilterCurrency) The `options.currency` attribute is required."
1124
+ );
1125
+ };
1126
+ const currency = (number2, locale, options) => {
1127
+ const options_ = {
1128
+ ...DEFAULT_OPTIONS$4,
1129
+ ...options
1130
+ };
1131
+ validRequiredAttributes(number2, locale, options_);
1132
+ try {
1133
+ return getFormattedCurrency(number2, locale, options_);
1134
+ } catch (error) {
1135
+ throw new Error(`[maz-ui](FilterCurrency) ${error}`);
1136
+ }
1137
+ };
1138
+ const DEFAULT_OPTIONS$3 = {
1139
+ month: "short",
1140
+ day: "numeric",
1141
+ year: "numeric"
1142
+ };
1143
+ const date = (date2, locale, options) => {
1144
+ if (locale === void 0) {
1145
+ throw new TypeError(
1146
+ "[maz-ui](FilterDate) The `locale` attribute is required."
1147
+ );
1148
+ }
1149
+ if (typeof locale !== "string") {
1150
+ throw new TypeError(
1151
+ "[maz-ui](FilterDate) The `locale` attribute must be a string."
1152
+ );
1153
+ }
1154
+ const opts = options ?? DEFAULT_OPTIONS$3;
1155
+ try {
1156
+ const usedDate = date2 instanceof Date ? date2 : new Date(date2);
1157
+ return new Intl.DateTimeFormat(locale, opts).format(usedDate);
1158
+ } catch (error) {
1159
+ throw new Error(`[maz-ui](FilterDate) ${error}`);
1160
+ }
1161
+ };
1162
+ const DEFAULT_OPTIONS$2 = {
1163
+ minimumFractionDigits: 2
1164
+ };
1165
+ const number = (number2, locale, options) => {
1166
+ options = {
1167
+ ...DEFAULT_OPTIONS$2,
1168
+ ...options
1169
+ };
1170
+ if (number2 === void 0)
1171
+ throw new TypeError(
1172
+ "[maz-ui](FilterNumber) The `number` attribute is required."
1173
+ );
1174
+ if (locale === void 0)
1175
+ throw new TypeError(
1176
+ "[maz-ui](FilterNumber) The `locale` attribute is required."
1177
+ );
1178
+ if (typeof locale !== "string")
1179
+ throw new TypeError(
1180
+ "[maz-ui](FilterNumber) The `locale` attribute must be a string."
1181
+ );
1182
+ try {
1183
+ return new Intl.NumberFormat(locale, options).format(Number(number2));
1184
+ } catch (error) {
1185
+ throw new Error(`[maz-ui](FilterNumber) ${error}`);
1186
+ }
1187
+ };
1188
+ const filters = {
1189
+ capitalize,
1190
+ currency,
1191
+ date,
1192
+ number
1193
+ };
1194
+ const installFilters = {
1195
+ install(app) {
1196
+ app.provide("filters", filters);
1197
+ }
1198
+ };
1199
+ class ToasterTimer {
1200
+ constructor(callback, delay) {
1201
+ __publicField(this, "callback");
1202
+ __publicField(this, "delay");
1203
+ __publicField(this, "timer");
1204
+ __publicField(this, "startedAt");
1205
+ this.startedAt = Date.now();
1206
+ this.callback = callback;
1207
+ this.delay = delay;
1208
+ this.start();
1209
+ }
1210
+ pause() {
1211
+ this.stop();
1212
+ this.delay -= Date.now() - this.startedAt;
1213
+ }
1214
+ resume() {
1215
+ this.startedAt = Date.now();
1216
+ this.start();
1217
+ }
1218
+ start() {
1219
+ this.timer = setTimeout(this.callback, this.delay);
1220
+ }
1221
+ stop() {
1222
+ clearTimeout(this.timer);
1223
+ }
1224
+ }
1225
+ const _hoisted_1$1 = ["innerHTML"];
1226
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1227
+ __name: "MazIcon",
1228
+ props: {
1229
+ src: { type: String, default: void 0 },
1230
+ path: { type: String, default: void 0 },
1231
+ name: { type: String, default: void 0 },
1232
+ size: { type: String, default: "1.5rem" },
1233
+ title: { type: String, default: void 0 },
1234
+ transformSource: {
1235
+ type: Function,
1236
+ default: (svg) => svg
1237
+ }
1238
+ },
1239
+ emits: ["loaded", "unloaded", "error"],
1240
+ setup(__props, { emit: emits }) {
1241
+ const props = __props;
1242
+ const cache = {};
1243
+ const svgElSource = ref();
1244
+ const svgElem = ref();
1245
+ const getMazIconPath = () => {
1246
+ try {
1247
+ return injectStrict("mazIconPath");
1248
+ } catch {
1249
+ return void 0;
1250
+ }
1251
+ };
1252
+ const iconPath = computed(() => props.path ?? getMazIconPath());
1253
+ const fullSrc = computed(() => {
1254
+ if (props.src) {
1255
+ return props.src;
1256
+ } else if (iconPath.value) {
1257
+ return `${iconPath.value}/${props.name}.svg`;
1258
+ } else {
1259
+ return `/${props.name}.svg`;
1260
+ }
1261
+ });
1262
+ onMounted$1(() => {
1263
+ if (!props.name && !props.src) {
1264
+ console.error(
1265
+ '[maz-ui](MazIcon) you should provide "name" or "src" as prop'
1266
+ );
1267
+ }
1268
+ });
1269
+ const setTitle = (svg, title) => {
1270
+ const titleTags = svg.querySelectorAll("title");
1271
+ if (titleTags.length > 0) {
1272
+ titleTags[0].textContent = title;
1273
+ } else {
1274
+ const titleEl = document.createElementNS(
1275
+ "http://www.w3.org/2000/svg",
1276
+ "title"
1277
+ );
1278
+ titleEl.textContent = title;
1279
+ svg.append(titleEl);
1280
+ }
1281
+ };
1282
+ const filterAttrs = (attrs) => {
1283
+ return Object.keys(attrs).reduce((result, key) => {
1284
+ if (attrs[key] !== false && attrs[key] !== null && attrs[key] !== void 0) {
1285
+ result[key] = attrs[key];
1286
+ }
1287
+ return result;
1288
+ }, {});
1289
+ };
1290
+ const getSvgAttrs = (svgEl) => {
1291
+ const svgAttrs = {};
1292
+ const attrs = svgEl.attributes;
1293
+ if (!attrs) {
1294
+ return svgAttrs;
1295
+ }
1296
+ for (let i = attrs.length - 1; i >= 0; i--) {
1297
+ svgAttrs[attrs[i].name] = attrs[i].value;
1298
+ }
1299
+ return svgAttrs;
1300
+ };
1301
+ const getSvgContent = (svgEl) => {
1302
+ let svgElNode = svgEl.cloneNode(true);
1303
+ svgElNode = props.transformSource(svgEl);
1304
+ if (props.title) {
1305
+ setTitle(svgElNode, props.title);
1306
+ }
1307
+ return svgEl.innerHTML;
1308
+ };
1309
+ const getSource = async (src) => {
1310
+ if (!cache[src]) {
1311
+ cache[src] = download(src);
1312
+ }
1313
+ try {
1314
+ svgElSource.value = await cache[src];
1315
+ await nextTick();
1316
+ emits("loaded", svgElem.value);
1317
+ } catch (error) {
1318
+ if (svgElSource.value) {
1319
+ svgElSource.value = void 0;
1320
+ emits("unloaded");
1321
+ }
1322
+ delete cache[src];
1323
+ emits("error", error);
1324
+ }
1325
+ };
1326
+ const download = (url) => {
1327
+ return new Promise((resolve, reject) => {
1328
+ const request = new XMLHttpRequest();
1329
+ request.open("GET", url, true);
1330
+ request.addEventListener("load", () => {
1331
+ if (request.status >= 200 && request.status < 400) {
1332
+ try {
1333
+ const parser = new DOMParser();
1334
+ const result = parser.parseFromString(
1335
+ request.responseText,
1336
+ "text/xml"
1337
+ );
1338
+ let svgEl = result.querySelectorAll("svg")[0];
1339
+ if (svgEl) {
1340
+ svgEl = props.transformSource(svgEl);
1341
+ resolve(svgEl);
1342
+ } else {
1343
+ reject(new Error('Loaded file is not valid SVG"'));
1344
+ }
1345
+ } catch (error) {
1346
+ reject(error);
1347
+ }
1348
+ } else {
1349
+ reject(new Error("Error loading SVG"));
1350
+ }
1351
+ });
1352
+ request.addEventListener("error", () => reject());
1353
+ request.send();
1354
+ });
1355
+ };
1356
+ watchEffect(() => getSource(fullSrc.value));
1357
+ return (_ctx, _cache) => {
1358
+ return svgElSource.value ? (openBlock(), createElementBlock("svg", mergeProps({
1359
+ key: 0,
1360
+ ref_key: "svgElem",
1361
+ ref: svgElem,
1362
+ width: "1em",
1363
+ height: "1em"
1364
+ }, {
1365
+ ...getSvgAttrs(svgElSource.value),
1366
+ ...filterAttrs(_ctx.$attrs)
1367
+ }, {
1368
+ style: `font-size: ${__props.size}`,
1369
+ innerHTML: getSvgContent(svgElSource.value)
1370
+ }), null, 16, _hoisted_1$1)) : createCommentVNode("", true);
1371
+ };
1372
+ }
1373
+ });
1374
+ const XIcon = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIGFyaWEtaGlkZGVuPSJ0cnVlIj4KICA8cGF0aCBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMiIgZD0iTTYgMThMMTggNk02IDZsMTIgMTIiLz4KPC9zdmc+Cg==";
1375
+ const _hoisted_1 = { class: "m-toast__message-wrapper" };
1376
+ const _hoisted_2 = { class: "m-toast__message" };
1377
+ const _hoisted_3 = {
1378
+ key: 0,
1379
+ class: "--close"
1380
+ };
1381
+ const _sfc_main = /* @__PURE__ */ defineComponent({
1382
+ __name: "MazToast",
1383
+ props: {
1384
+ position: {
1385
+ type: String,
1386
+ default: "bottom-right"
1387
+ },
1388
+ maxToasts: { type: [Number, Boolean], default: false },
1389
+ timeout: { type: Number, default: 1e4 },
1390
+ queue: { type: Boolean, default: false },
1391
+ noPauseOnHover: { type: Boolean, default: false },
1392
+ type: {
1393
+ type: String,
1394
+ default: "info",
1395
+ validator: (value) => {
1396
+ return ["info", "success", "warning", "danger"].includes(value);
1397
+ }
1398
+ },
1399
+ message: { type: String, required: true },
1400
+ persistent: { type: Boolean, default: false }
1401
+ },
1402
+ emits: ["close", "click"],
1403
+ setup(__props, { emit: emits }) {
1404
+ const props = __props;
1405
+ const Toaster = ref();
1406
+ const positionY = computed(
1407
+ () => props.position.includes("top") ? "top" : "bottom"
1408
+ );
1409
+ const positionX = computed(() => {
1410
+ if (props.position.includes("left"))
1411
+ return "left";
1412
+ if (props.position.includes("right"))
1413
+ return "right";
1414
+ return "center";
1415
+ });
1416
+ const transitionName = computed(() => {
1417
+ if (positionX.value !== "center") {
1418
+ return positionX.value === "right" ? "m-slide-right" : "m-slide-left";
1419
+ }
1420
+ return positionY.value === "top" ? "m-slide-top" : "m-slide-bottom";
1421
+ });
1422
+ const isActive = ref(false);
1423
+ const timer = ref();
1424
+ const queueTimer = ref();
1425
+ const containerClassName = `m-toast-container --${positionY.value} --${positionX.value}`;
1426
+ const selectorContainerClass = `.${containerClassName.replaceAll(" ", ".")}`;
1427
+ const createParents = () => {
1428
+ const container = document.querySelector(selectorContainerClass);
1429
+ if (container)
1430
+ return;
1431
+ if (!container) {
1432
+ const body = document.body;
1433
+ const toCreate = document.createElement("div");
1434
+ toCreate.className = containerClassName;
1435
+ body.append(toCreate);
1436
+ }
1437
+ };
1438
+ const shouldQueue = () => {
1439
+ const container = document.querySelector(selectorContainerClass);
1440
+ if (!props.queue && props.maxToasts === false) {
1441
+ return false;
1442
+ }
1443
+ if (props.maxToasts !== false && container) {
1444
+ return props.maxToasts <= container.childElementCount;
1445
+ }
1446
+ return container && container.childElementCount > 0;
1447
+ };
1448
+ const showNotice = () => {
1449
+ if (shouldQueue()) {
1450
+ queueTimer.value = setTimeout(showNotice, 250);
1451
+ return;
1452
+ }
1453
+ const container = document.querySelector(selectorContainerClass);
1454
+ if (Toaster.value && container) {
1455
+ container.prepend(Toaster.value);
1456
+ }
1457
+ isActive.value = true;
1458
+ timer.value = props.timeout ? new ToasterTimer(close, props.timeout) : void 0;
1459
+ };
1460
+ function click(event) {
1461
+ emits("click", event);
1462
+ if (!props.persistent) {
1463
+ close();
1464
+ }
1465
+ }
1466
+ const toggleTimer = (newVal) => {
1467
+ if (timer.value && !props.noPauseOnHover) {
1468
+ newVal ? timer.value.pause() : timer.value.resume();
1469
+ }
1470
+ };
1471
+ const stopTimer = () => {
1472
+ timer.value && timer.value.stop();
1473
+ if (queueTimer.value) {
1474
+ clearTimeout(queueTimer.value);
1475
+ }
1476
+ };
1477
+ const close = () => {
1478
+ stopTimer();
1479
+ isActive.value = false;
1480
+ setTimeout(() => {
1481
+ var _a;
1482
+ emits("close");
1483
+ (_a = Toaster.value) == null ? void 0 : _a.remove();
1484
+ const container = document.querySelector(selectorContainerClass);
1485
+ if (container && !(container == null ? void 0 : container.hasChildNodes())) {
1486
+ container.remove();
1487
+ }
1488
+ }, 300);
1489
+ };
1490
+ onMounted$1(() => {
1491
+ createParents();
1492
+ showNotice();
1493
+ });
1494
+ return (_ctx, _cache) => {
1495
+ return openBlock(), createBlock(Transition, { name: unref(transitionName) }, {
1496
+ default: withCtx(() => [
1497
+ withDirectives(createElementVNode("div", {
1498
+ ref_key: "Toaster",
1499
+ ref: Toaster,
1500
+ class: normalizeClass(["m-toast", [`--${__props.type}`, `--${unref(positionY)}`, `--${unref(positionX)}`]]),
1501
+ role: "alert",
1502
+ onMouseover: _cache[0] || (_cache[0] = ($event) => toggleTimer(true)),
1503
+ onMouseleave: _cache[1] || (_cache[1] = ($event) => toggleTimer(false)),
1504
+ onClick: _cache[2] || (_cache[2] = ($event) => click($event))
1505
+ }, [
1506
+ createElementVNode("div", _hoisted_1, [
1507
+ createElementVNode("p", _hoisted_2, toDisplayString(__props.message), 1)
1508
+ ]),
1509
+ !__props.persistent ? (openBlock(), createElementBlock("button", _hoisted_3, [
1510
+ createVNode(_sfc_main$1, {
1511
+ src: unref(XIcon),
1512
+ class: "--icon"
1513
+ }, null, 8, ["src"])
1514
+ ])) : createCommentVNode("", true)
1515
+ ], 34), [
1516
+ [vShow, isActive.value]
1517
+ ])
1518
+ ]),
1519
+ _: 1
1520
+ }, 8, ["name"]);
1521
+ };
1522
+ }
1523
+ });
1524
+ const MazToast_vue_vue_type_style_index_0_lang = "";
1525
+ const MazToast_vue_vue_type_style_index_1_scoped_ba28d9a5_lang = "";
1526
+ const _export_sfc = (sfc, props) => {
1527
+ const target = sfc.__vccOpts || sfc;
1528
+ for (const [key, val] of props) {
1529
+ target[key] = val;
1530
+ }
1531
+ return target;
1532
+ };
1533
+ const MazToast = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ba28d9a5"]]);
1534
+ class ToasterHandler {
1535
+ constructor(app, globalOptions) {
1536
+ this.app = app;
1537
+ this.globalOptions = globalOptions;
1538
+ }
1539
+ show(message, options) {
1540
+ const localOptions = { message, ...options };
1541
+ const propsData = {
1542
+ ...localOptions,
1543
+ ...this.globalOptions,
1544
+ ...options
1545
+ };
1546
+ mount(MazToast, {
1547
+ props: propsData,
1548
+ app: this.app
1549
+ });
1550
+ }
1551
+ getLocalOptions(type, options) {
1552
+ return {
1553
+ type,
1554
+ ...options
1555
+ };
1556
+ }
1557
+ success(message, options) {
1558
+ return this.show(message, this.getLocalOptions("success", options));
1559
+ }
1560
+ error(message, options) {
1561
+ return this.show(message, this.getLocalOptions("danger", options));
1562
+ }
1563
+ info(message, options) {
1564
+ return this.show(message, this.getLocalOptions("info", options));
1565
+ }
1566
+ warning(message, options) {
1567
+ return this.show(message, this.getLocalOptions("warning", options));
1568
+ }
1569
+ }
1570
+ const defaultOptions = {
1571
+ position: "bottom-right",
1572
+ timeout: 1e4,
1573
+ persistent: true
1574
+ };
1575
+ let instance$2;
1576
+ const plugin$2 = {
1577
+ install(app, options) {
1578
+ instance$2 = new ToasterHandler(app, {
1579
+ ...defaultOptions,
1580
+ ...options
1581
+ });
1582
+ app.provide("toast", instance$2);
1583
+ }
1584
+ };
1585
+ const DEFAULT_LOADER = "";
1586
+ const uniq = (array) => {
1587
+ return array.filter((el, index, arr) => index === arr.indexOf(el));
1588
+ };
1589
+ const contains = (array) => (predicate = DEFAULT_LOADER) => {
1590
+ return typeof predicate === "function" ? array.findIndex((...args) => predicate(...args)) > -1 : array.includes(predicate);
1591
+ };
1592
+ const hasItems = (array) => array.length > 0;
1593
+ const push = (array) => (item = DEFAULT_LOADER) => uniq([...array, item]);
1594
+ const pop = (array) => (item = DEFAULT_LOADER) => array.filter((_item) => _item !== item);
1595
+ class WaitHandler {
1596
+ constructor() {
1597
+ __publicField(this, "_loaders", ref([]));
1598
+ }
1599
+ get loaders() {
1600
+ return computed(() => this._loaders.value);
1601
+ }
1602
+ stop(loaderId = DEFAULT_LOADER) {
1603
+ this._loaders.value = pop(this._loaders.value)(loaderId);
1604
+ }
1605
+ start(loaderId = DEFAULT_LOADER) {
1606
+ this._loaders.value = push(this._loaders.value)(loaderId);
1607
+ return () => this.stop(loaderId);
1608
+ }
1609
+ get anyLoading() {
1610
+ return computed(() => hasItems(this._loaders.value));
1611
+ }
1612
+ isLoading(loaderId = DEFAULT_LOADER) {
1613
+ const isLoading = computed(() => contains(this._loaders.value)(loaderId));
1614
+ return isLoading.value;
1615
+ }
1616
+ }
1617
+ const instance$1 = new WaitHandler();
1618
+ const plugin$1 = {
1619
+ install: (app) => {
1620
+ app.provide("wait", instance$1);
1621
+ }
1622
+ };
1623
+ const sleep = (ms) => {
1624
+ return new Promise((resolve) => setTimeout(resolve, ms));
1625
+ };
1626
+ const DEFAULT_OPTIONS$1 = {
1627
+ delay: 100,
1628
+ observer: {
1629
+ root: void 0,
1630
+ rootMargin: "0px",
1631
+ threshold: 0.2
1632
+ },
1633
+ animation: {
1634
+ once: true,
1635
+ duration: 300
1636
+ }
1637
+ };
1638
+ class AosHandler {
1639
+ constructor(options) {
1640
+ __publicField(this, "options");
1641
+ this.options = {
1642
+ delay: (options == null ? void 0 : options.delay) ?? DEFAULT_OPTIONS$1.delay,
1643
+ observer: {
1644
+ ...DEFAULT_OPTIONS$1.observer,
1645
+ ...options == null ? void 0 : options.observer
1646
+ },
1647
+ animation: {
1648
+ ...DEFAULT_OPTIONS$1.animation,
1649
+ ...options == null ? void 0 : options.animation
1650
+ }
1651
+ };
1652
+ }
1653
+ runAnimations() {
1654
+ if (isClient()) {
1655
+ return this.handleObserver();
1656
+ } else {
1657
+ console.warn("[MazAos](runAnimations) should be executed on client side");
1658
+ }
1659
+ }
1660
+ async handleObserver() {
1661
+ await sleep(this.options.delay);
1662
+ const observer = new IntersectionObserver(this.handleIntersect.bind(this), {
1663
+ ...this.options.observer
1664
+ });
1665
+ for (const element of document.querySelectorAll("[data-maz-aos]")) {
1666
+ const anchorAttr = element.getAttribute("data-maz-aos-anchor");
1667
+ if (anchorAttr) {
1668
+ const anchorElement = document.querySelector(anchorAttr);
1669
+ if (anchorElement) {
1670
+ anchorElement.setAttribute("data-maz-aos-children", "true");
1671
+ observer.observe(anchorElement);
1672
+ } else {
1673
+ console.warn(
1674
+ `[maz-ui](aos) no element found with selector "${anchorAttr}"`
1675
+ );
1676
+ }
1677
+ } else {
1678
+ observer.observe(element);
1679
+ }
1680
+ }
1681
+ }
1682
+ handleIntersect(entries, observer) {
1683
+ for (const entry of entries) {
1684
+ const target = entry.target;
1685
+ const hasChildren = target.getAttribute("data-maz-aos-children") === "true";
1686
+ const animateElements = entry.target.getAttribute(
1687
+ "data-maz-aos"
1688
+ ) ? [entry.target] : [];
1689
+ if (hasChildren) {
1690
+ const children = [
1691
+ ...document.querySelectorAll("[data-maz-aos-anchor]")
1692
+ ].map(
1693
+ (child) => child.getAttribute("data-maz-aos-anchor") === `#${entry.target.id}` ? child : void 0
1694
+ );
1695
+ for (const child of children) {
1696
+ if (child) {
1697
+ animateElements.push(child);
1698
+ }
1699
+ }
1700
+ }
1701
+ for (const element of animateElements) {
1702
+ const once = element.getAttribute("data-maz-aos-once");
1703
+ const useOnce = typeof once === "string" ? once === "true" : this.options.animation.once;
1704
+ if (entry.intersectionRatio > this.options.observer.threshold) {
1705
+ const duration = element.getAttribute("data-maz-aos-duration");
1706
+ if (!duration) {
1707
+ element.style.transitionDuration = `${this.options.animation.duration}ms`;
1708
+ setTimeout(() => {
1709
+ element.style.transitionDuration = "0";
1710
+ }, 1e3);
1711
+ }
1712
+ element.classList.add("maz-aos-animate");
1713
+ if (useOnce) {
1714
+ observer.unobserve(element);
1715
+ }
1716
+ } else {
1717
+ element.classList.remove("maz-aos-animate");
1718
+ }
1719
+ }
1720
+ }
1721
+ }
1722
+ }
1723
+ let instance;
1724
+ const plugin = {
1725
+ install: (app, options) => {
1726
+ instance = new AosHandler(options);
1727
+ app.provide("aos", instance);
1728
+ if (!isClient()) {
1729
+ return;
1730
+ }
1731
+ if (options == null ? void 0 : options.router) {
1732
+ options.router.afterEach(async () => {
1733
+ instance.runAnimations();
1734
+ });
1735
+ } else {
1736
+ instance.runAnimations();
1737
+ }
1738
+ }
1739
+ };
1740
+ const DEFAULT_OPTIONS = {
1741
+ darkClass: "dark",
1742
+ storageThemeKey: "theme",
1743
+ storageThemeValueDark: "dark",
1744
+ storageThemeValueLight: "light"
1745
+ };
1746
+ const theme = ref();
1747
+ const autoSetTheme = ({
1748
+ storageThemeKey,
1749
+ storageThemeValueDark,
1750
+ darkClass,
1751
+ storageThemeValueLight
1752
+ }) => {
1753
+ if (localStorage[storageThemeKey] === storageThemeValueDark || !(storageThemeKey in localStorage) && window.matchMedia("(prefers-color-scheme: dark)").matches) {
1754
+ document.documentElement.classList.add(darkClass);
1755
+ localStorage[storageThemeKey] = storageThemeValueDark;
1756
+ theme.value = storageThemeValueDark;
1757
+ } else {
1758
+ document.documentElement.classList.remove(darkClass);
1759
+ localStorage[storageThemeKey] = storageThemeValueLight;
1760
+ theme.value = storageThemeValueLight;
1761
+ }
1762
+ };
1763
+ const toggleTheme = ({
1764
+ storageThemeKey,
1765
+ storageThemeValueDark,
1766
+ darkClass,
1767
+ storageThemeValueLight
1768
+ }) => {
1769
+ if (localStorage[storageThemeKey] === storageThemeValueDark) {
1770
+ document.documentElement.classList.remove(darkClass);
1771
+ localStorage[storageThemeKey] = storageThemeValueLight;
1772
+ theme.value = storageThemeValueLight;
1773
+ } else {
1774
+ document.documentElement.classList.add(darkClass);
1775
+ localStorage[storageThemeKey] = storageThemeValueDark;
1776
+ theme.value = storageThemeValueDark;
1777
+ }
1778
+ };
1779
+ const useThemeHandler = (opts = DEFAULT_OPTIONS) => {
1780
+ const options = {
1781
+ ...DEFAULT_OPTIONS,
1782
+ ...opts
1783
+ };
1784
+ const hasDarkTheme = computed(
1785
+ () => theme.value === options.storageThemeValueDark
1786
+ );
1787
+ const hasLightTheme = computed(
1788
+ () => theme.value === options.storageThemeValueLight
1789
+ );
1790
+ return {
1791
+ autoSetTheme: () => autoSetTheme(options),
1792
+ toggleTheme: () => toggleTheme(options),
1793
+ hasDarkTheme,
1794
+ hasLightTheme,
1795
+ theme
1796
+ };
1797
+ };
1798
+ const useInstanceUniqId = ({
1799
+ componentName,
1800
+ instance: instance2,
1801
+ providedId
1802
+ }) => {
1803
+ const instanceId = computed(
1804
+ () => providedId ?? `${componentName}-${instance2 == null ? void 0 : instance2.uid}`
1805
+ );
1806
+ return {
1807
+ instanceId
1808
+ };
1809
+ };
1810
+ const useAos = () => {
1811
+ const aos = injectStrict("aos");
1812
+ return {
1813
+ aos
1814
+ };
1815
+ };
1816
+ const useWait = () => {
1817
+ const wait = injectStrict("wait");
1818
+ return {
1819
+ wait
1820
+ };
1821
+ };
1822
+ const useToast = () => {
1823
+ const toast = injectStrict("toast");
1824
+ return {
1825
+ toast
1826
+ };
1827
+ };
1828
+ const handler$1 = ref();
1829
+ const useIdleTimeout = ({
1830
+ callback,
1831
+ options
1832
+ }) => {
1833
+ const instance2 = new IdleTimeout(callback, options);
1834
+ handler$1.value = instance2;
1835
+ const idle = handler$1;
1836
+ return {
1837
+ idle
1838
+ };
1839
+ };
1840
+ const handler = ref();
1841
+ const useUserVisibility = ({
1842
+ callback,
1843
+ options
1844
+ }) => {
1845
+ const instance2 = new UserVisibility(callback, options);
1846
+ handler.value = instance2;
1847
+ const visibility = handler;
1848
+ return {
1849
+ visibility
1850
+ };
1851
+ };
1852
+ export {
1853
+ AosHandler,
1854
+ IdleTimeout,
1855
+ ToasterHandler,
1856
+ UserVisibility,
1857
+ WaitHandler,
1858
+ instance as aosInstance,
1859
+ capitalize,
1860
+ currency,
1861
+ date,
1862
+ debounce,
1863
+ injectStrict,
1864
+ plugin as installAos,
1865
+ installDirectives,
1866
+ installFilters,
1867
+ plugin$2 as installToaster,
1868
+ plugin$1 as installWait,
1869
+ isClient,
1870
+ mount,
1871
+ number,
1872
+ sleep$1 as sleep,
1873
+ theme,
1874
+ instance$2 as toastInstance,
1875
+ truthyFilter,
1876
+ useAos,
1877
+ useIdleTimeout,
1878
+ useInstanceUniqId,
1879
+ useThemeHandler,
1880
+ useToast,
1881
+ useUserVisibility,
1882
+ useWait,
1883
+ directive$1 as vClickOutside,
1884
+ plugin$6 as vClickOutsideInstall,
1885
+ directive as vClosable,
1886
+ plugin$5 as vClosableInstall,
1887
+ vLazyImg,
1888
+ plugin$3 as vLazyImgInstall,
1889
+ vZoomImg,
1890
+ plugin$4 as vZoomImgInstall,
1891
+ instance$1 as waitInstance
1892
+ };