@ozdao/prometheus-framework 0.1.30 → 0.1.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. package/dist/BackofficeGallery-02c9721b.mjs +304 -0
  2. package/dist/BackofficeGallery-1d117a40.js +1 -0
  3. package/dist/BackofficeReports-cb4b180d.mjs +44 -0
  4. package/dist/BackofficeReports-d021871f.js +1 -0
  5. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-505c3ca5.js +1 -0
  6. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-b1873cb7.mjs +1945 -0
  7. package/dist/Button-2ca405bd.js +1 -0
  8. package/dist/Button-c59d387c.mjs +283 -0
  9. package/dist/Button.vue_vue_type_style_index_0_lang-0ea8fbf8.js +1 -0
  10. package/dist/Button.vue_vue_type_style_index_0_lang-4ed993c7.mjs +1 -0
  11. package/dist/ButtonFollow.vue_vue_type_style_index_0_scoped_0634d4a1_lang-0ea8fbf8.js +1 -0
  12. package/dist/ButtonFollow.vue_vue_type_style_index_0_scoped_0634d4a1_lang-4ed993c7.mjs +1 -0
  13. package/dist/CardOrganization-18c1e3fa.mjs +297 -0
  14. package/dist/CardOrganization-26714a5e.mjs +297 -0
  15. package/dist/CardOrganization-7d679e75.js +1 -0
  16. package/dist/CardOrganization-88c6d479.js +1 -0
  17. package/dist/Chips-0e5bdd54.js +1 -0
  18. package/dist/Chips-2ada5eda.mjs +200 -0
  19. package/dist/Chips-5e32c8cb.mjs +200 -0
  20. package/dist/Chips-8d0a1d2c.js +1 -0
  21. package/dist/Dashboard-239fb7a6.mjs +52 -0
  22. package/dist/Dashboard-94267906.js +1 -0
  23. package/dist/EULA-8265b0cf.mjs +4218 -0
  24. package/dist/EULA-cbb27503.js +1 -0
  25. package/dist/Feed-275a14d8.mjs +371 -0
  26. package/dist/Feed-505b3fa8.mjs +383 -0
  27. package/dist/Feed-66095e66.js +1 -0
  28. package/dist/Feed-76fc4475.mjs +383 -0
  29. package/dist/Feed-d0da2943.js +1 -0
  30. package/dist/Feed-e55bc6fa.js +1 -0
  31. package/dist/Feed-ee36f80b.js +1 -0
  32. package/dist/Feed-ef6c6ca3.mjs +371 -0
  33. package/dist/IconEdit-1b7b5874.js +1 -0
  34. package/dist/IconEdit-680dc269.mjs +339 -0
  35. package/dist/IconEdit-c98d3d06.mjs +339 -0
  36. package/dist/IconEdit-e4d0cc6e.js +1 -0
  37. package/dist/Image-052a3cc2.mjs +480 -0
  38. package/dist/Image-2d2e606a.js +9 -0
  39. package/dist/Image-95c0fb07.mjs +480 -0
  40. package/dist/Image-c90ee624.js +9 -0
  41. package/dist/MenuItem-0b249b94.mjs +93 -0
  42. package/dist/MenuItem-8b70d2cf.js +1 -0
  43. package/dist/Product-4b58701f.js +7 -0
  44. package/dist/Product-6aa1c9ee.mjs +844 -0
  45. package/dist/Product-6ca8d04d.js +7 -0
  46. package/dist/Product-a6251018.mjs +844 -0
  47. package/dist/ProductEdit-2e309add.js +1 -0
  48. package/dist/ProductEdit-3ff2af92.js +1 -0
  49. package/dist/ProductEdit-6abcc97b.mjs +306 -0
  50. package/dist/ProductEdit-f901314c.mjs +306 -0
  51. package/dist/ProfileBlogposts-57931834.mjs +70 -0
  52. package/dist/ProfileBlogposts-62d5e809.mjs +70 -0
  53. package/dist/ProfileBlogposts-af88ce98.js +1 -0
  54. package/dist/ProfileBlogposts-c31917ec.js +1 -0
  55. package/dist/ProfileEvents-588eadf9.js +1 -0
  56. package/dist/ProfileEvents-89471c05.js +1 -0
  57. package/dist/ProfileEvents-e070d9d4.mjs +62 -0
  58. package/dist/ProfileEvents-ed7f9603.mjs +62 -0
  59. package/dist/ProfileOrganizations-7911deec.mjs +219 -0
  60. package/dist/ProfileOrganizations-ae258581.js +1 -0
  61. package/dist/ProfileOrganizations-bee6a3ae.js +1 -0
  62. package/dist/ProfileOrganizations-db313b5e.mjs +219 -0
  63. package/dist/Publics-24f055eb.js +1 -0
  64. package/dist/Publics-50c0ff6c.js +1 -0
  65. package/dist/Publics-b1cbfd97.mjs +45 -0
  66. package/dist/Publics-f34131bf.mjs +45 -0
  67. package/dist/Select-11ddabf5.mjs +79 -0
  68. package/dist/Select-3ca5ab39.js +1 -0
  69. package/dist/Socials-3fe01af1.mjs +275 -0
  70. package/dist/Socials-9b2d27a6.js +1 -0
  71. package/dist/Socials-b19d0cb1.js +1 -0
  72. package/dist/Socials-becde7dc.mjs +275 -0
  73. package/dist/addMembersQuantity-ea216f92.mjs +85 -0
  74. package/dist/addMembersQuantity-f922d82b.js +84 -0
  75. package/dist/auth-98fe3efb.mjs +612 -0
  76. package/dist/auth-acbe3ae1.js +7 -0
  77. package/dist/auth.client.cjs +7 -8
  78. package/dist/auth.client.js +378 -379
  79. package/dist/auth.validation-495e9d6d.js +1 -0
  80. package/dist/auth.validation-e265b496.mjs +23 -0
  81. package/dist/backoffice.client.cjs +1 -1
  82. package/dist/backoffice.client.js +55 -28
  83. package/dist/click-outside-0b0727d1.js +2 -0
  84. package/dist/click-outside-6101836c.mjs +19 -0
  85. package/dist/community.client.cjs +1 -1
  86. package/dist/community.client.js +121 -121
  87. package/dist/community.server.js +35 -5
  88. package/dist/community.server.mjs +35 -5
  89. package/dist/components/Button/Button.vue.d.ts +3 -0
  90. package/dist/components/Button/Button.vue.d.ts.map +1 -1
  91. package/dist/components/CardHeader/CardHeader.vue.d.ts +3 -0
  92. package/dist/components/Dropdown/Dropdown.vue.d.ts +3 -0
  93. package/dist/components/Dropdown/Dropdown.vue.d.ts.map +1 -1
  94. package/dist/components/Field/Field.vue.d.ts +1 -1
  95. package/dist/components/FieldPhone/FieldPhone(script-setup).vue.d.ts +3 -3
  96. package/dist/components/Popup/Popup.vue.d.ts +2 -1
  97. package/dist/components/Popup/Popup.vue.d.ts.map +1 -1
  98. package/dist/components/Select/Select.vue.d.ts +1 -1
  99. package/dist/components/Select/Select.vue.d.ts.map +1 -1
  100. package/dist/components/Upload/Upload.vue.d.ts +1 -1
  101. package/dist/events.client.cjs +2 -2
  102. package/dist/events.client.js +219 -217
  103. package/dist/events.server.js +1 -0
  104. package/dist/events.server.mjs +1 -0
  105. package/dist/legal.client.cjs +1 -1
  106. package/dist/legal.client.js +2565 -2545
  107. package/dist/main.css +1 -1
  108. package/dist/main.d.ts +1 -1
  109. package/dist/modules/backoffice/components/pages/Dashboard.vue.d.ts +6 -0
  110. package/dist/modules/icons/navigation/IconCross.vue.d.ts +4 -0
  111. package/dist/modules/legal/components/pages/legal/EULA.vue.d.ts +2 -0
  112. package/dist/modules/organizations/components/elements/ButtonFollow.vue.d.ts +1 -1
  113. package/dist/modules/organizations/components/elements/ButtonToggleMembership.vue.d.ts +12 -0
  114. package/dist/modules/organizations/components/sections/DetailsTab.vue.d.ts +2 -58
  115. package/dist/modules/organizations/components/sections/Feed.vue.d.ts +1 -1
  116. package/dist/modules/reports/components/pages/BackofficeReports.vue.d.ts +2 -0
  117. package/dist/modules/reports/components/sections/FormReport.vue.d.ts +75 -0
  118. package/dist/modules/reports/store/reports.d.ts +41 -0
  119. package/dist/organizations-a241b21d.js +1 -0
  120. package/dist/organizations-ea9de495.mjs +122 -0
  121. package/dist/organizations.client-292e8444.js +3 -0
  122. package/dist/organizations.client-6a69b54a.js +3 -0
  123. package/dist/organizations.client-6fc91683.mjs +3072 -0
  124. package/dist/organizations.client-c288ff44.mjs +3072 -0
  125. package/dist/organizations.client.cjs +1 -1
  126. package/dist/organizations.client.js +51 -49
  127. package/dist/organizations.server.js +20 -28
  128. package/dist/organizations.server.mjs +20 -28
  129. package/dist/prometheus-framework.cjs.js +19 -19
  130. package/dist/prometheus-framework.es.js +1635 -1608
  131. package/dist/reports-270f69df.js +1 -0
  132. package/dist/reports-79cd9459.mjs +91 -0
  133. package/dist/reports.client.cjs +1 -0
  134. package/dist/reports.client.js +8 -0
  135. package/dist/reports.server.js +159 -0
  136. package/dist/reports.server.mjs +160 -0
  137. package/dist/states.validation-02ba0aee.js +1 -0
  138. package/dist/states.validation-e5f4fa3a.mjs +13 -0
  139. package/dist/style.css +1 -1
  140. package/dist/users.client.cjs +1 -1
  141. package/dist/users.client.js +286 -242
  142. package/dist/users.server.js +6 -18
  143. package/dist/users.server.mjs +6 -18
  144. package/package.json +9 -1
  145. package/src/components/Button/Button.vue +66 -60
  146. package/src/components/CardHeader/CardHeader.vue +51 -50
  147. package/src/components/Dropdown/Dropdown.vue +28 -12
  148. package/src/components/FieldPhone/click-outside.js +0 -48
  149. package/src/components/Popup/Popup.vue +74 -23
  150. package/src/components/Select/Select.vue +10 -6
  151. package/src/main.ts +1 -1
  152. package/src/modules/auth/components/pages/EnterPassword.vue +6 -0
  153. package/src/modules/auth/store/auth.js +1 -1
  154. package/src/modules/backoffice/components/layouts/Backoffice.vue +3 -3
  155. package/src/modules/backoffice/components/pages/Dashboard.vue +62 -0
  156. package/src/modules/backoffice/router/backoffice.js +26 -0
  157. package/src/modules/community/components/blocks/CardBlogpost.vue +3 -0
  158. package/src/modules/community/components/layouts/Community.vue +4 -4
  159. package/src/modules/community/components/pages/CreateBlogPost.vue +27 -28
  160. package/src/modules/community/components/sections/Comments.vue +4 -2
  161. package/src/modules/community/components/sections/Feed.vue +1 -1
  162. package/src/modules/community/controllers/blog.controller.js +22 -3
  163. package/src/modules/community/controllers/comments.controller.js +23 -5
  164. package/src/modules/events/components/blocks/CardEvent.vue +4 -0
  165. package/src/modules/events/components/pages/EditEvent.vue +27 -28
  166. package/src/modules/events/components/sections/Feed.vue +1 -1
  167. package/src/modules/events/controllers/events.controller.js +3 -0
  168. package/src/modules/gallery/components/sections/BackofficeGallery.vue +7 -23
  169. package/src/modules/icons/navigation/IconCross.vue +22 -0
  170. package/src/modules/legal/components/pages/Legal.vue +3 -0
  171. package/src/modules/legal/components/pages/legal/EULA.vue +2148 -0
  172. package/src/modules/legal/router/legal.js +11 -4
  173. package/src/modules/middlewares/client/auth.validation.js +14 -0
  174. package/src/modules/mobile/components/Menu/Menu.vue +1 -1
  175. package/src/modules/organizations/components/blocks/CardOrganization.vue +1 -1
  176. package/src/modules/organizations/components/elements/ButtonFollow.vue +9 -7
  177. package/src/modules/organizations/components/elements/ButtonToggleMembership.vue +101 -0
  178. package/src/modules/organizations/components/pages/Organization.vue +1 -34
  179. package/src/modules/organizations/components/sections/DetailsTab.vue +86 -8
  180. package/src/modules/organizations/controllers/memberships.controller.js +10 -7
  181. package/src/modules/organizations/controllers/organizations.controller.js +9 -20
  182. package/src/modules/organizations/controllers/utils/addMembersQuantity.js +21 -0
  183. package/src/modules/organizations/controllers/utils/addUserStatusFields.js +65 -0
  184. package/src/modules/organizations/controllers/utils/excludeBlockedMembers.js +18 -0
  185. package/src/modules/organizations/models/membership.model.js +5 -5
  186. package/src/modules/organizations/store/memberships.js +6 -6
  187. package/src/modules/organizations/store/organizations.js +0 -1
  188. package/src/modules/products/products.server.js +5 -0
  189. package/src/modules/reports/components/pages/BackofficeReports.vue +67 -0
  190. package/src/modules/reports/components/sections/FormReport.vue +116 -0
  191. package/src/modules/reports/controllers/reports.controller.js +67 -0
  192. package/src/modules/reports/models/report.model.js +58 -0
  193. package/src/modules/reports/reports.client.js +17 -0
  194. package/src/modules/reports/reports.server.js +13 -0
  195. package/src/modules/reports/routes/reports.routes.js +43 -0
  196. package/src/modules/reports/store/reports.js +118 -0
  197. package/src/modules/users/components/pages/Profile.vue +57 -10
  198. package/src/modules/users/controllers/users.controller.js +6 -19
  199. package/src/styles/base/all.scss +2 -0
  200. package/src/styles/layout.scss +39 -63
  201. package/src/styles/theme.scss +0 -1
  202. package/src/styles/components/popup.scss +0 -55
@@ -0,0 +1,304 @@
1
+ import { reactive as q, ref as p, watchEffect as X, openBlock as r, createElementBlock as c, createVNode as _, unref as R, withCtx as b, Fragment as G, renderList as M, createElementVNode as e, computed as H, onMounted as J, createCommentVNode as S, Transition as z, toDisplayString as U, withDirectives as K, vShow as Q, createTextVNode as W, pushScopeId as Y, popScopeId as Z } from "vue";
2
+ import { F as ee, _ as te } from "./Button-c59d387c.mjs";
3
+ import { S as ae } from "./Select-11ddabf5.mjs";
4
+ import { a as L } from "./index-a661083c.mjs";
5
+ import { V as se } from "./vue-draggable-next.esm-bundler-ff6e3f52.mjs";
6
+ import { _ as le } from "./UploadImageMultiple-cb6c7188.mjs";
7
+ import { _ as oe } from "./_plugin-vue_export-helper-dad06003.mjs";
8
+ import "./Button.vue_vue_type_style_index_0_lang-4ed993c7.mjs";
9
+ const ie = process.env.API_URL, V = L.create({ baseURL: ie, withCredentials: !0 }), g = q({
10
+ gallery: []
11
+ }), y = {
12
+ async fetchGallery(s, t) {
13
+ const n = [];
14
+ s && n.push(`page=${s}`), t && n.push(`limit=${t}`);
15
+ const l = `/api/gallery${n.length ? `?${n.join("&")}` : ""}`;
16
+ try {
17
+ const o = await V.get(l);
18
+ if (console.log(o), o && o.data)
19
+ return g.gallery = [...g.gallery, ...o.data], o.data;
20
+ } catch (o) {
21
+ throw console.error("Error fetching gallery:", o), o;
22
+ }
23
+ },
24
+ async createPhoto(s) {
25
+ try {
26
+ const t = await V.post("/api/gallery/create", s);
27
+ console.log(t.data), g.gallery = [...t.data, ...g.gallery];
28
+ } catch (t) {
29
+ console.error(t);
30
+ }
31
+ },
32
+ async updatePhoto(s) {
33
+ try {
34
+ const t = {
35
+ ...s,
36
+ categories: typeof s.categories == "string" ? s.categories.split(",").map((o) => o.trim()) : s.categories
37
+ }, n = await L.post("/api/gallery/update", t), l = g.gallery.findIndex((o) => o._id === s._id);
38
+ l !== -1 && (g.gallery[l] = n.data);
39
+ } catch (t) {
40
+ console.error(t);
41
+ }
42
+ },
43
+ async deletePhoto(s) {
44
+ try {
45
+ const t = await V.post(`/api/gallery/delete/${s}`), n = g.gallery.findIndex((l) => l._id === s);
46
+ n !== -1 && g.gallery.splice(n, 1);
47
+ } catch (t) {
48
+ console.error(t);
49
+ }
50
+ }
51
+ };
52
+ const ne = { class: "pos-relative" }, re = ["src"], ce = ["onClick"], de = {
53
+ __name: "EditImages",
54
+ props: {
55
+ images: Array
56
+ },
57
+ emits: ["update"],
58
+ setup(s, { emit: t }) {
59
+ const n = s, l = p([...n.images]);
60
+ X(() => {
61
+ l.value = [...n.images];
62
+ });
63
+ const o = () => {
64
+ t("update:images", l.value);
65
+ }, k = (u) => {
66
+ l.value = [...l.value, ...u], o();
67
+ }, x = (u) => {
68
+ l.value.splice(u, 1), o();
69
+ };
70
+ return (u, C) => (r(), c("div", null, [
71
+ _(le, {
72
+ "onUpdate:images": k,
73
+ uploadPath: "photos",
74
+ class: "mn-semi pd-small w-100 button bg-black t-white"
75
+ }),
76
+ _(R(se), {
77
+ class: "gap-small flex dragArea list-group w-full",
78
+ modelValue: l.value,
79
+ "onUpdate:modelValue": C[0] || (C[0] = (v) => l.value = v),
80
+ onChange: o
81
+ }, {
82
+ default: b(() => [
83
+ (r(!0), c(G, null, M(l.value, (v, E) => (r(), c("div", ne, [
84
+ e("img", {
85
+ class: "i-extra radius-small o-hidden mn-thin",
86
+ src: (u.FILE_SERVER_URL || "") + v
87
+ }, null, 8, re),
88
+ e("a", {
89
+ onClick: (h) => x(E),
90
+ class: "pos-absolute t-center radius-extra i-medium bg-red pos-t-0 pos-r-0"
91
+ }, "X", 8, ce)
92
+ ]))), 256))
93
+ ]),
94
+ _: 1
95
+ }, 8, ["modelValue"])
96
+ ]));
97
+ }
98
+ };
99
+ const w = (s) => (Y("data-v-d6a1c805"), s = s(), Z(), s), ue = { class: "pos-relative w-100" }, me = { class: "mn-semi flex-v-center flex-nowrap flex" }, pe = /* @__PURE__ */ w(() => /* @__PURE__ */ e("h1", { class: "mn-r-small" }, "Manage Gallery", -1)), ge = ["data-id"], _e = ["src", "onClick"], ve = {
100
+ key: 1,
101
+ class: "radius-small bg-white"
102
+ }, he = ["src", "onClick"], fe = { class: "t-black p-small mn-thin" }, ye = /* @__PURE__ */ w(() => /* @__PURE__ */ e("span", { class: "uppercase t-transp" }, "Size", -1)), be = /* @__PURE__ */ w(() => /* @__PURE__ */ e("br", null, null, -1)), we = { class: "pd-2px radius-big d-inline-block bg-grey" }, ke = { class: "t-black p-small mn-small uppe" }, xe = /* @__PURE__ */ w(() => /* @__PURE__ */ e("span", { class: "uppercase t-transp" }, "Categories", -1)), Ce = /* @__PURE__ */ w(() => /* @__PURE__ */ e("br", null, null, -1)), Ie = { class: "pd-2px radius-big d-inline-block bg-grey t-semi" }, $e = { class: "flex-nowrap flex" }, Se = ["onClick"], Ee = { class: "modal pd-thin" }, Pe = { class: "modal-content radius-big" }, ze = { class: "" }, Ue = ["src"], Ve = {
103
+ key: 0,
104
+ class: "flex-v-center flex m modal pd-big"
105
+ }, Ge = { class: "modal-content radius-small pd-medium bg-white" }, Me = ["src"], je = ["src"], Be = {
106
+ __name: "BackofficeGallery",
107
+ setup(s) {
108
+ const t = p(!0), n = p(null);
109
+ let l = 1;
110
+ const o = 10;
111
+ let k = p(null), x = p(!1);
112
+ const u = p([]), C = (d) => {
113
+ u.value = d;
114
+ }, v = H(() => B.value === "all" ? g.gallery : g.gallery.filter((d) => d.categories.includes(B.value))), E = async () => {
115
+ x.value = !0, await y.fetchGallery(l, o), x.value = !1;
116
+ }, h = p(null), a = p({
117
+ categories: "",
118
+ size: "",
119
+ image: !1
120
+ }), I = p(null), P = (d) => {
121
+ console.log(t.value), t.value ? N(d) : (h.value = "modal", a.value.image = d, j());
122
+ }, N = (d) => {
123
+ h.value = "edit-modal", a.value = d || {
124
+ categories: "",
125
+ size: "",
126
+ image: null
127
+ }, j();
128
+ }, f = () => {
129
+ a.value = {
130
+ categories: "",
131
+ size: "",
132
+ image: !1
133
+ }, I.value = null, A();
134
+ }, j = () => {
135
+ document.body.style.overflow = "hidden", document.documentElement.style.overflow = "hidden";
136
+ }, A = () => {
137
+ document.body.style.overflow = "", document.documentElement.style.overflow = "";
138
+ }, D = [
139
+ { name: "Small", value: "" },
140
+ { name: "Regular", value: "grid-item--width1 grid-item--height1" },
141
+ { name: "Medium", value: "grid-item--width2 grid-item--height2" },
142
+ { name: "Big", value: "grid-item--width3 grid-item--height3" }
143
+ ], F = async (d) => {
144
+ await y.deletePhoto(d);
145
+ }, O = async () => {
146
+ await y.updatePhoto(a.value), f();
147
+ }, T = async (d) => {
148
+ if (u.length < 1 || !a.value.categories || !a.value.size) {
149
+ console.error("All fields are required.");
150
+ return;
151
+ }
152
+ await y.createPhoto({
153
+ images: u.value,
154
+ size: a.value.size,
155
+ categories: typeof a.value.categories == "string" ? a.value.categories.split(",").map((m) => m.trim()) : a.value.categories
156
+ }), f();
157
+ };
158
+ let B = p("all");
159
+ return J(async () => {
160
+ await y.fetchGallery(l, o), typeof window < "u" && new IntersectionObserver((m) => {
161
+ m.some((i) => i.isIntersecting) && (l += 1, E());
162
+ }).observe(k.value);
163
+ }), (d, m) => (r(), c("div", ue, [
164
+ e("div", me, [
165
+ pe,
166
+ t.value ? (r(), c("button", {
167
+ key: 0,
168
+ onClick: m[0] || (m[0] = (i) => P(null)),
169
+ class: "t-white t-black bg-second i-big radius-extra"
170
+ }, "+")) : S("", !0)
171
+ ]),
172
+ e("div", {
173
+ ref_key: "grid",
174
+ ref: n,
175
+ class: "cols-4 gap-thin"
176
+ }, [
177
+ (r(!0), c(G, null, M(R(v), (i, Re) => (r(), c("div", {
178
+ key: i.id,
179
+ "data-id": i.id
180
+ }, [
181
+ _(z, {
182
+ name: "scaleIn",
183
+ mode: "in-out"
184
+ }, {
185
+ default: b(() => [
186
+ !t.value && n.value ? (r(), c("img", {
187
+ key: 0,
188
+ src: "https://thecommunephuket.com/photos/" + i.cover,
189
+ class: "w-100 h-100 o-hidden radius-medium object-fit-cover",
190
+ onClick: ($) => P(i.image)
191
+ }, null, 8, _e)) : (r(), c("div", ve, [
192
+ e("img", {
193
+ src: "https://thecommunephuket.com/photos/" + i.cover,
194
+ class: "w-100 radius-small mn-small h-10r object-fit-cover",
195
+ onClick: ($) => P(i)
196
+ }, null, 8, he),
197
+ e("p", fe, [
198
+ ye,
199
+ be,
200
+ e("span", we, U(i.size.name), 1)
201
+ ]),
202
+ e("p", ke, [
203
+ xe,
204
+ Ce,
205
+ (r(!0), c(G, null, M(i.categories, ($) => (r(), c("span", Ie, U($), 1))), 256))
206
+ ]),
207
+ e("div", $e, [
208
+ e("button", {
209
+ class: "button-small w-100 button",
210
+ onClick: ($) => F(i._id)
211
+ }, "Delete", 8, Se)
212
+ ])
213
+ ]))
214
+ ]),
215
+ _: 2
216
+ }, 1024)
217
+ ], 8, ge))), 128)),
218
+ e("div", {
219
+ ref_key: "sentinel",
220
+ ref: k,
221
+ class: "sentinel"
222
+ }, null, 512),
223
+ _(z, { name: "modal" }, {
224
+ default: b(() => [
225
+ K(e("div", Ee, [
226
+ e("div", Pe, [
227
+ e("div", ze, [
228
+ e("span", {
229
+ class: "close",
230
+ onClick: f
231
+ }, "×"),
232
+ e("img", {
233
+ src: "https://thecommunephuket.com/photos/" + a.value.image
234
+ }, null, 8, Ue)
235
+ ])
236
+ ])
237
+ ], 512), [
238
+ [Q, a.value.image !== !1 && h.value === "modal"]
239
+ ])
240
+ ]),
241
+ _: 1
242
+ }),
243
+ _(z, { name: "modal" }, {
244
+ default: b(() => [
245
+ a.value.image !== !1 && h.value === "edit-modal" ? (r(), c("div", Ve, [
246
+ e("div", Ge, [
247
+ e("span", {
248
+ class: "close",
249
+ onClick: f
250
+ }, "×"),
251
+ typeof I.value == "string" ? (r(), c("img", {
252
+ key: 0,
253
+ src: I.value,
254
+ class: "radius-small w-100 mn-small h-20r object-fit-cover"
255
+ }, null, 8, Me)) : S("", !0),
256
+ typeof I.value == "object" && a.value.image !== null ? (r(), c("img", {
257
+ key: 1,
258
+ class: "radius-small w-100 mn-small h-20r object-fit-cover",
259
+ src: "/photos/" + a.value.cover
260
+ }, null, 8, je)) : S("", !0),
261
+ _(ae, {
262
+ options: D,
263
+ label: "Size",
264
+ select: a.value.size,
265
+ "onUpdate:select": m[1] || (m[1] = (i) => a.value.size = i),
266
+ placeholder: "Select Size",
267
+ class: "bg-grey pd-thin radius-small mn-thin t-black"
268
+ }, null, 8, ["select"]),
269
+ _(ee, {
270
+ field: a.value.categories,
271
+ "onUpdate:field": m[2] || (m[2] = (i) => a.value.categories = i),
272
+ type: "text",
273
+ label: "Categories",
274
+ placeholder: "Enter categories for image (comma separated)",
275
+ class: "bg-grey pd-thin radius-small mn-medium t-black"
276
+ }, null, 8, ["field"]),
277
+ _(de, {
278
+ images: u.value,
279
+ "onUpdate:images": C,
280
+ uploadPath: "photos",
281
+ class: "mn-semi"
282
+ }, null, 8, ["images"]),
283
+ _(te, {
284
+ submit: a.value._id ? O : T,
285
+ callback: f,
286
+ class: "mn-thin"
287
+ }, {
288
+ default: b(() => [
289
+ W(U(a.value._id ? "Update" : "Create"), 1)
290
+ ]),
291
+ _: 1
292
+ }, 8, ["submit"])
293
+ ])
294
+ ])) : S("", !0)
295
+ ]),
296
+ _: 1
297
+ })
298
+ ], 512)
299
+ ]));
300
+ }
301
+ }, Xe = /* @__PURE__ */ oe(Be, [["__scopeId", "data-v-d6a1c805"]]);
302
+ export {
303
+ Xe as default
304
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),B=require("./Button-2ca405bd.js"),q=require("./Select-3ca5ab39.js"),C=require("./index-b41aac19.js"),M=require("./vue-draggable-next.esm-bundler-80731ae0.js"),G=require("./UploadImageMultiple-eddaac87.js"),j=require("./_plugin-vue_export-helper-f246444f.js");require("./Button.vue_vue_type_style_index_0_lang-0ea8fbf8.js");const D=process.env.API_URL,V=C.axios.create({baseURL:D,withCredentials:!0}),u=e.reactive({gallery:[]}),v={async fetchGallery(a,t){const c=[];a&&c.push(`page=${a}`),t&&c.push(`limit=${t}`);const o=`/api/gallery${c.length?`?${c.join("&")}`:""}`;try{const s=await V.get(o);if(console.log(s),s&&s.data)return u.gallery=[...u.gallery,...s.data],s.data}catch(s){throw console.error("Error fetching gallery:",s),s}},async createPhoto(a){try{const t=await V.post("/api/gallery/create",a);console.log(t.data),u.gallery=[...t.data,...u.gallery]}catch(t){console.error(t)}},async updatePhoto(a){try{const t={...a,categories:typeof a.categories=="string"?a.categories.split(",").map(s=>s.trim()):a.categories},c=await C.axios.post("/api/gallery/update",t),o=u.gallery.findIndex(s=>s._id===a._id);o!==-1&&(u.gallery[o]=c.data)}catch(t){console.error(t)}},async deletePhoto(a){try{const t=await V.post(`/api/gallery/delete/${a}`),c=u.gallery.findIndex(o=>o._id===a);c!==-1&&u.gallery.splice(c,1)}catch(t){console.error(t)}}};const L={class:"pos-relative"},R=["src"],F=["onClick"],T={__name:"EditImages",props:{images:Array},emits:["update"],setup(a,{emit:t}){const c=a,o=e.ref([...c.images]);e.watchEffect(()=>{o.value=[...c.images]});const s=()=>{t("update:images",o.value)},h=i=>{o.value=[...o.value,...i],s()},f=i=>{o.value.splice(i,1),s()};return(i,y)=>(e.openBlock(),e.createElementBlock("div",null,[e.createVNode(G._sfc_main,{"onUpdate:images":h,uploadPath:"photos",class:"mn-semi pd-small w-100 button bg-black t-white"}),e.createVNode(e.unref(M.VueDraggableNext),{class:"gap-small flex dragArea list-group w-full",modelValue:o.value,"onUpdate:modelValue":y[0]||(y[0]=m=>o.value=m),onChange:s},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(m,E)=>(e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("img",{class:"i-extra radius-small o-hidden mn-thin",src:(i.FILE_SERVER_URL||"")+m},null,8,R),e.createElementVNode("a",{onClick:p=>f(E),class:"pos-absolute t-center radius-extra i-medium bg-red pos-t-0 pos-r-0"},"X",8,F)]))),256))]),_:1},8,["modelValue"])]))}};const _=a=>(e.pushScopeId("data-v-d6a1c805"),a=a(),e.popScopeId(),a),A={class:"pos-relative w-100"},O={class:"mn-semi flex-v-center flex-nowrap flex"},H=_(()=>e.createElementVNode("h1",{class:"mn-r-small"},"Manage Gallery",-1)),X=["data-id"],J=["src","onClick"],K={key:1,class:"radius-small bg-white"},Q=["src","onClick"],W={class:"t-black p-small mn-thin"},Y=_(()=>e.createElementVNode("span",{class:"uppercase t-transp"},"Size",-1)),Z=_(()=>e.createElementVNode("br",null,null,-1)),ee={class:"pd-2px radius-big d-inline-block bg-grey"},te={class:"t-black p-small mn-small uppe"},le=_(()=>e.createElementVNode("span",{class:"uppercase t-transp"},"Categories",-1)),ae=_(()=>e.createElementVNode("br",null,null,-1)),oe={class:"pd-2px radius-big d-inline-block bg-grey t-semi"},se={class:"flex-nowrap flex"},ne=["onClick"],ce={class:"modal pd-thin"},re={class:"modal-content radius-big"},ie={class:""},de=["src"],ue={key:0,class:"flex-v-center flex m modal pd-big"},me={class:"modal-content radius-small pd-medium bg-white"},pe=["src"],ge=["src"],ve={__name:"BackofficeGallery",setup(a){const t=e.ref(!0),c=e.ref(null);let o=1;const s=10;let h=e.ref(null),f=e.ref(!1);const i=e.ref([]),y=r=>{i.value=r},m=e.computed(()=>x.value==="all"?u.gallery:u.gallery.filter(r=>r.categories.includes(x.value))),E=async()=>{f.value=!0,await v.fetchGallery(o,s),f.value=!1},p=e.ref(null),l=e.ref({categories:"",size:"",image:!1}),k=e.ref(null),w=r=>{console.log(t.value),t.value?I(r):(p.value="modal",l.value.image=r,N())},I=r=>{p.value="edit-modal",l.value=r||{categories:"",size:"",image:null},N()},g=()=>{l.value={categories:"",size:"",image:!1},k.value=null,S()},N=()=>{document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden"},S=()=>{document.body.style.overflow="",document.documentElement.style.overflow=""},$=[{name:"Small",value:""},{name:"Regular",value:"grid-item--width1 grid-item--height1"},{name:"Medium",value:"grid-item--width2 grid-item--height2"},{name:"Big",value:"grid-item--width3 grid-item--height3"}],P=async r=>{await v.deletePhoto(r)},z=async()=>{await v.updatePhoto(l.value),g()},U=async r=>{if(i.length<1||!l.value.categories||!l.value.size){console.error("All fields are required.");return}await v.createPhoto({images:i.value,size:l.value.size,categories:typeof l.value.categories=="string"?l.value.categories.split(",").map(d=>d.trim()):l.value.categories}),g()};let x=e.ref("all");return e.onMounted(async()=>{await v.fetchGallery(o,s),typeof window<"u"&&new IntersectionObserver(d=>{d.some(n=>n.isIntersecting)&&(o+=1,E())}).observe(h.value)}),(r,d)=>(e.openBlock(),e.createElementBlock("div",A,[e.createElementVNode("div",O,[H,t.value?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:d[0]||(d[0]=n=>w(null)),class:"t-white t-black bg-second i-big radius-extra"},"+")):e.createCommentVNode("",!0)]),e.createElementVNode("div",{ref_key:"grid",ref:c,class:"cols-4 gap-thin"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m),(n,he)=>(e.openBlock(),e.createElementBlock("div",{key:n.id,"data-id":n.id},[e.createVNode(e.Transition,{name:"scaleIn",mode:"in-out"},{default:e.withCtx(()=>[!t.value&&c.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:"https://thecommunephuket.com/photos/"+n.cover,class:"w-100 h-100 o-hidden radius-medium object-fit-cover",onClick:b=>w(n.image)},null,8,J)):(e.openBlock(),e.createElementBlock("div",K,[e.createElementVNode("img",{src:"https://thecommunephuket.com/photos/"+n.cover,class:"w-100 radius-small mn-small h-10r object-fit-cover",onClick:b=>w(n)},null,8,Q),e.createElementVNode("p",W,[Y,Z,e.createElementVNode("span",ee,e.toDisplayString(n.size.name),1)]),e.createElementVNode("p",te,[le,ae,(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.categories,b=>(e.openBlock(),e.createElementBlock("span",oe,e.toDisplayString(b),1))),256))]),e.createElementVNode("div",se,[e.createElementVNode("button",{class:"button-small w-100 button",onClick:b=>P(n._id)},"Delete",8,ne)])]))]),_:2},1024)],8,X))),128)),e.createElementVNode("div",{ref_key:"sentinel",ref:h,class:"sentinel"},null,512),e.createVNode(e.Transition,{name:"modal"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",ce,[e.createElementVNode("div",re,[e.createElementVNode("div",ie,[e.createElementVNode("span",{class:"close",onClick:g},"×"),e.createElementVNode("img",{src:"https://thecommunephuket.com/photos/"+l.value.image},null,8,de)])])],512),[[e.vShow,l.value.image!==!1&&p.value==="modal"]])]),_:1}),e.createVNode(e.Transition,{name:"modal"},{default:e.withCtx(()=>[l.value.image!==!1&&p.value==="edit-modal"?(e.openBlock(),e.createElementBlock("div",ue,[e.createElementVNode("div",me,[e.createElementVNode("span",{class:"close",onClick:g},"×"),typeof k.value=="string"?(e.openBlock(),e.createElementBlock("img",{key:0,src:k.value,class:"radius-small w-100 mn-small h-20r object-fit-cover"},null,8,pe)):e.createCommentVNode("",!0),typeof k.value=="object"&&l.value.image!==null?(e.openBlock(),e.createElementBlock("img",{key:1,class:"radius-small w-100 mn-small h-20r object-fit-cover",src:"/photos/"+l.value.cover},null,8,ge)):e.createCommentVNode("",!0),e.createVNode(q.Select,{options:$,label:"Size",select:l.value.size,"onUpdate:select":d[1]||(d[1]=n=>l.value.size=n),placeholder:"Select Size",class:"bg-grey pd-thin radius-small mn-thin t-black"},null,8,["select"]),e.createVNode(B.Field,{field:l.value.categories,"onUpdate:field":d[2]||(d[2]=n=>l.value.categories=n),type:"text",label:"Categories",placeholder:"Enter categories for image (comma separated)",class:"bg-grey pd-thin radius-small mn-medium t-black"},null,8,["field"]),e.createVNode(T,{images:i.value,"onUpdate:images":y,uploadPath:"photos",class:"mn-semi"},null,8,["images"]),e.createVNode(B._sfc_main,{submit:l.value._id?z:U,callback:g,class:"mn-thin"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value._id?"Update":"Create"),1)]),_:1},8,["submit"])])])):e.createCommentVNode("",!0)]),_:1})],512)]))}},_e=j._export_sfc(ve,[["__scopeId","data-v-d6a1c805"]]);exports.default=_e;
@@ -0,0 +1,44 @@
1
+ import { openBlock as e, createElementBlock as l, createElementVNode as s, Fragment as a, renderList as o, unref as c, toDisplayString as n } from "vue";
2
+ import { a as i, s as p } from "./reports-79cd9459.mjs";
3
+ import "./globals-96ba60e4.mjs";
4
+ import "vue-i18n";
5
+ import "./index-a661083c.mjs";
6
+ const r = /* @__PURE__ */ s("div", { class: "flex-v-center flex-nowrap flex mn-medium" }, [
7
+ /* @__PURE__ */ s("h3", { class: "mn-r-medium" }, "Reports")
8
+ ], -1), d = { class: "cols-3 gap-thin" }, _ = { class: "t-black p-small mn-small" }, m = /* @__PURE__ */ s("span", { class: "uppercase t-transp" }, "User", -1), u = /* @__PURE__ */ s("br", null, null, -1), b = { class: "pd-2px radius-big d-inline-block bg-grey t-semi" }, h = { class: "t-black p-small mn-small" }, g = /* @__PURE__ */ s("span", { class: "uppercase t-transp" }, "Type", -1), f = /* @__PURE__ */ s("br", null, null, -1), k = { class: "pd-2px radius-big d-inline-block bg-grey t-semi" }, x = { class: "t-black p-small mn-small" }, y = /* @__PURE__ */ s("span", { class: "uppercase t-transp" }, "Reason", -1), v = /* @__PURE__ */ s("br", null, null, -1), w = { class: "pd-2px radius-big d-inline-block bg-grey t-semi" }, R = /* @__PURE__ */ s("div", { class: "gap-thin flex-nowrap flex" }, [
9
+ /* @__PURE__ */ s("button", { class: "button-small w-100 bg-black t-white button" }, " Close Report "),
10
+ /* @__PURE__ */ s("button", { class: "button-small w-100 bg-black t-white button" }, " Hide Content ")
11
+ ], -1), S = {
12
+ __name: "BackofficeReports",
13
+ setup(B) {
14
+ return i.read(), (C, E) => (e(), l("div", null, [
15
+ r,
16
+ s("div", d, [
17
+ (e(!0), l(a, null, o(c(p).all, (t) => (e(), l("div", {
18
+ key: t._id,
19
+ class: "radius-medium pd-small bg-grey"
20
+ }, [
21
+ s("p", _, [
22
+ m,
23
+ u,
24
+ s("span", b, n(t.user), 1)
25
+ ]),
26
+ s("p", h, [
27
+ g,
28
+ f,
29
+ s("span", k, n(t.type), 1)
30
+ ]),
31
+ s("p", x, [
32
+ y,
33
+ v,
34
+ s("span", w, n(t.reason), 1)
35
+ ]),
36
+ R
37
+ ]))), 128))
38
+ ])
39
+ ]));
40
+ }
41
+ };
42
+ export {
43
+ S as default
44
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),s=require("./reports-270f69df.js");require("./globals-928eb13c.js");require("vue-i18n");require("./index-b41aac19.js");const l=e.createElementVNode("div",{class:"flex-v-center flex-nowrap flex mn-medium"},[e.createElementVNode("h3",{class:"mn-r-medium"},"Reports")],-1),n={class:"cols-3 gap-thin"},a={class:"t-black p-small mn-small"},o=e.createElementVNode("span",{class:"uppercase t-transp"},"User",-1),c=e.createElementVNode("br",null,null,-1),r={class:"pd-2px radius-big d-inline-block bg-grey t-semi"},i={class:"t-black p-small mn-small"},d=e.createElementVNode("span",{class:"uppercase t-transp"},"Type",-1),m=e.createElementVNode("br",null,null,-1),p={class:"pd-2px radius-big d-inline-block bg-grey t-semi"},u={class:"t-black p-small mn-small"},_=e.createElementVNode("span",{class:"uppercase t-transp"},"Reason",-1),b=e.createElementVNode("br",null,null,-1),g={class:"pd-2px radius-big d-inline-block bg-grey t-semi"},h=e.createElementVNode("div",{class:"gap-thin flex-nowrap flex"},[e.createElementVNode("button",{class:"button-small w-100 bg-black t-white button"}," Close Report "),e.createElementVNode("button",{class:"button-small w-100 bg-black t-white button"}," Hide Content ")],-1),E={__name:"BackofficeReports",setup(N){return s.actions.read(),(V,k)=>(e.openBlock(),e.createElementBlock("div",null,[l,e.createElementVNode("div",n,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s.state).all,t=>(e.openBlock(),e.createElementBlock("div",{key:t._id,class:"radius-medium pd-small bg-grey"},[e.createElementVNode("p",a,[o,c,e.createElementVNode("span",r,e.toDisplayString(t.user),1)]),e.createElementVNode("p",i,[d,m,e.createElementVNode("span",p,e.toDisplayString(t.type),1)]),e.createElementVNode("p",u,[_,b,e.createElementVNode("span",g,e.toDisplayString(t.reason),1)]),h]))),128))])]))}};exports.default=E;
@@ -0,0 +1 @@
1
+ "use strict";const t=require("vue"),V=require("./index-b41aac19.js"),g=require("./_plugin-vue_export-helper-f246444f.js");var $=function e(i,s){if(i===s)return!0;if(i&&s&&typeof i=="object"&&typeof s=="object"){if(i.constructor!==s.constructor)return!1;var n,r,o;if(Array.isArray(i)){if(n=i.length,n!=s.length)return!1;for(r=n;r--!==0;)if(!e(i[r],s[r]))return!1;return!0}if(i.constructor===RegExp)return i.source===s.source&&i.flags===s.flags;if(i.valueOf!==Object.prototype.valueOf)return i.valueOf()===s.valueOf();if(i.toString!==Object.prototype.toString)return i.toString()===s.toString();if(o=Object.keys(i),n=o.length,n!==Object.keys(s).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(s,o[r]))return!1;for(r=n;r--!==0;){var l=o[r];if(!e(i[l],s[l]))return!1}return!0}return i!==i&&s!==s};const O=V.getDefaultExportFromCjs($),B=(e,i)=>i.filter(s=>{const{text:n}=e;if(typeof s.rule=="string")return!new RegExp(s.rule).test(n);if(s.rule instanceof RegExp)return!s.rule.test(n);if({}.toString.call(s.rule)==="[object Function]")return s.rule(e)}).map(s=>s.classes),c=e=>JSON.parse(JSON.stringify(e)),C=(e,i)=>{let s=0;for(;s<e.length;){if(i(e[s],s,e))return s;s++}return-1},k=(e,i,s=[],n)=>{e.text===void 0&&(e={text:e});const r=B(e,s),o=C(i,d=>d===e),l=c(i),a=o!==-1?l.splice(o,1)[0]:c(e);return(n?n(l,a):l.map(d=>d.text).indexOf(a.text)!==-1)&&r.push("ti-duplicate"),r.length===0?r.push("ti-valid"):r.push("ti-invalid"),r},m=(e,...i)=>{e.text===void 0&&(e={text:e});const s=c(e);return s.tiClasses=k(e,...i),s},D=(e,...i)=>e.map(s=>m(s,e,...i));const L={name:"TagInput",props:{scope:{type:Object}}},A=["maxlength"];function N(e,i,s,n,r,o){return s.scope.edit?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,"onUpdate:modelValue":i[0]||(i[0]=l=>s.scope.tag.text=l),maxlength:s.scope.maxlength,type:"text",class:"ti-tag-input",size:"1",onInput:i[1]||(i[1]=l=>s.scope.validateTag(s.scope.index,l)),onBlur:i[2]||(i[2]=l=>s.scope.performCancelEdit(s.scope.index)),onKeydown:i[3]||(i[3]=l=>s.scope.performSaveEdit(s.scope.index,l))},null,40,A)),[[t.vModelText,s.scope.tag.text]]):t.createCommentVNode("",!0)}const M=g._export_sfc(L,[["render",N],["__scopeId","data-v-a1f1c345"]]),b=e=>!e.some(i=>{const s=!i.text;s&&console.warn('Missing property "text"',i);let n=!1;return i.classes&&(n=typeof i.classes!="string"),n&&console.warn('Property "classes" must be type of string',i),s||n}),w=e=>!e.some(i=>{if(typeof i=="number"){const s=isFinite(i)&&Math.floor(i)===i;return s||console.warn("Only numerics are allowed for this prop. Found:",i),!s}else if(typeof i=="string"){const s=/\W|[a-z]|!\d/i.test(i);return s||console.warn("Only alpha strings are allowed for this prop. Found:",i),!s}else return console.warn("Only numeric and string values are allowed. Found:",i),!1}),F={modelValue:{type:String,default:"",required:!0},tags:{type:Array,default:()=>[],validator:b},autocompleteItems:{type:Array,default:()=>[],validator:b},allowEditTags:{type:Boolean,default:!1},autocompleteFilterDuplicates:{default:!0,type:Boolean},addOnlyFromAutocomplete:{type:Boolean,default:!1},autocompleteMinLength:{type:Number,default:1},autocompleteAlwaysOpen:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:"Add Tag"},addOnKey:{type:Array,default:()=>[13],validator:w},saveOnKey:{type:Array,default:()=>[13],validator:w},maxTags:{type:Number},maxlength:{type:Number},validation:{type:Array,default:()=>[],validator(e){return!e.some(i=>{const s=!i.rule;s&&console.warn('Property "rule" is missing',i);const n=i.rule&&(typeof i.rule=="string"||i.rule instanceof RegExp||{}.toString.call(i.rule)==="[object Function]");n||console.warn("A rule must be type of string, RegExp or function. Found:",JSON.stringify(i.rule));const r=!i.classes;r&&console.warn('Property "classes" is missing',i);const o=i.type&&typeof i.type!="string";return o&&console.warn('Property "type" must be type of string. Found:',i),!n||s||r||o})}},separators:{type:Array,default:()=>[";"],validator(e){return!e.some(i=>{const s=typeof i!="string";return s&&console.warn("Separators must be type of string. Found:",i),s})}},avoidAddingDuplicates:{type:Boolean,default:!0},addOnBlur:{type:Boolean,default:!0},isDuplicate:{type:Function,default:null},addFromPaste:{type:Boolean,default:!0},deleteOnBackspace:{default:!0,type:Boolean},onBeforeAddingTag:Function,onBeforeDeletingTag:Function,onBeforeEditingTag:Function,onBeforeSavingTag:Function},I={name:"VueTagsInput",components:{TagInput:M},props:F,emits:["adding-duplicate","before-adding-tag","before-deleting-tag","before-editing-tag","before-saving-tag","max-tags-reached","saving-duplicate","tags-changed","tag-clicked","update:modelValue","update:tags"],inheritAttrs:!1,data(){return{tagCenter:[],newTag:null,tagsCopy:[],tagsEditStatus:null,deletionMark:null,deletionMarkTime:null,selectedItem:null,focused:null}},computed:{autocompleteOpen(){return this.autocompleteAlwaysOpen?!0:this.newTag!==null&&this.newTag.length>=this.autocompleteMinLength&&this.filteredAutocompleteItems.length>0&&this.focused},filteredAutocompleteItems(){const e=this.autocompleteItems.map(i=>m(i,this.tags,this.validation,this.isDuplicate));return this.autocompleteFilterDuplicates?e.filter(this.duplicateFilter):e}},methods:{createClasses:k,getSelectedIndex(e){const i=this.filteredAutocompleteItems,s=this.selectedItem,n=i.length-1;if(i.length!==0)return s===null?0:e==="before"&&s===0?n:e==="after"&&s===n?0:e==="after"?s+1:s-1},selectDefaultItem(){this.addOnlyFromAutocomplete&&this.filteredAutocompleteItems.length>0?this.selectedItem=0:this.selectedItem=null},selectItem(e,i){e.preventDefault(),this.selectedItem=this.getSelectedIndex(i)},isSelected(e){return this.selectedItem===e},isMarked(e){return this.deletionMark===e},setTagCenter(e){e&&this.tagCenter.push(e)},invokeDelete(){if(!this.deleteOnBackspace||this.newTag.length>0)return;const e=this.tagsCopy.length-1;this.deletionMark===null?(this.deletionMarkTime=setTimeout(()=>this.deletionMark=null,1e3),this.deletionMark=e):this.performDeleteTag(e)},addTagsFromPaste(){this.addFromPaste&&setTimeout(()=>this.performAddTags(this.newTag),10)},performEditTag(e){this.allowEditTags&&(this.onBeforeAddingTag||this.editTag(e),this.$emit("before-editing-tag",{index:e,tag:this.tagsCopy[e],editTag:()=>this.editTag(e)}))},editTag(e){this.allowEditTags&&(this.toggleEditMode(e),this.focus(e))},toggleEditMode(e){!this.allowEditTags||this.disabled||(this.tagsEditStatus[e]=!this.tagsEditStatus[e])},createChangedTag(e,i){const s=this.tagsCopy[e];s.text=i?i.target.value:this.tagsCopy[e].text,this.tagsCopy[e]=m(s,this.tagsCopy,this.validation,this.isDuplicate)},focus(e){this.$nextTick(()=>{const i=this.tagCenter[e].querySelector("input.ti-tag-input");i&&i.focus()})},quote(e){return e.replace(/([()[{*+.$^\\|?])/g,"\\$1")},cancelEdit(e){this.tags[e]&&(this.tagsCopy[e]=c(m(this.tags[e],this.tags,this.validation,this.isDuplicate)),this.tagsEditStatus[e]=!1)},hasForbiddingAddRule(e){return e.some(i=>{const s=this.validation.find(n=>i===n.classes);return s?s.disableAdd:!1})},createTagTexts(e){const i=new RegExp(this.separators.map(s=>this.quote(s)).join("|"));return e.split(i).map(s=>({text:s}))},performDeleteTag(e){this.onBeforeDeletingTag||this.deleteTag(e),this.$emit("before-deleting-tag",{index:e,tag:this.tagsCopy[e],deleteTag:()=>this.deleteTag(e)})},deleteTag(e){this.disabled||(this.deletionMark=null,clearTimeout(this.deletionMarkTime),this.tagsCopy.splice(e,1),this.$emit("update:tags",this.tagsCopy),this.$emit("tags-changed",this.tagsCopy))},noTriggerKey(e,i){const s=this[i].indexOf(e.keyCode)!==-1||this[i].indexOf(e.key)!==-1;return s&&e.preventDefault(),!s},performAddTags(e,i,s){if(this.disabled||i&&this.noTriggerKey(i,"addOnKey"))return;let n=[];typeof e=="object"&&(n=[e]),typeof e=="string"&&(n=this.createTagTexts(e)),n=n.filter(r=>r.text.trim().length>0),n.forEach(r=>{r=m(r,this.tags,this.validation,this.isDuplicate),this.onBeforeAddingTag||this.addTag(r,s),this.$emit("before-adding-tag",{tag:r,addTag:()=>this.addTag(r,s)})})},duplicateFilter(e){return this.isDuplicate?!this.isDuplicate(this.tagsCopy,e):!this.tagsCopy.find(i=>i.text===e.text)},addTag(e,i="new-tag-input"){const s=this.filteredAutocompleteItems.map(n=>n.text);this.addOnlyFromAutocomplete&&s.indexOf(e.text)===-1||this.$nextTick(()=>{if(this.maxTags&&this.maxTags<=this.tagsCopy.length)return this.$emit("max-tags-reached",e);if(this.avoidAddingDuplicates&&!this.duplicateFilter(e))return this.$emit("adding-duplicate",e);this.hasForbiddingAddRule(e.tiClasses)||(this.newTag="",this.tagsCopy.push(e),this.$emit("update:tags",this.tagsCopy),i==="autocomplete"&&this.$refs.newTagInput.focus(),this.$emit("tags-changed",this.tagsCopy))})},performSaveTag(e,i){const s=this.tagsCopy[e];this.disabled||i&&this.noTriggerKey(i,"addOnKey")||s.text.trim().length!==0&&(this["on-before-saving-tag"]||this.saveTag(e,s),this.$emit("before-saving-tag",{index:e,tag:s,saveTag:()=>this.saveTag(e,s)}))},saveTag(e,i){if(this.avoidAddingDuplicates){const s=c(this.tagsCopy),n=s.splice(e,1)[0];if(this.isDuplicate?this.isDuplicate(s,n):s.map(o=>o.text).indexOf(n.text)!==-1)return this.$emit("saving-duplicate",i)}this.hasForbiddingAddRule(i.tiClasses)||(this.tagsCopy[e]=i,this.toggleEditMode(e),this.$emit("update:tags",this.tagsCopy),this.$emit("tags-changed",this.tagsCopy))},tagsEqual(){return!this.tagsCopy.some((e,i)=>!O(e,this.tags[i]))},updateNewTag(e){const i=e.target.value;this.newTag=i,this.$emit("update:modelValue",i)},initTags(){this.tagsCopy=D(this.tags,this.validation,this.isDuplicate),this.tagsEditStatus=c(this.tags).map(()=>!1),this.tagsEqual()||this.$emit("update:tags",this.tagsCopy)},blurredOnClick(e){this.$el.contains(e.target)||this.$el.contains(document.activeElement)||this.performBlur(e)},performBlur(){this.addOnBlur&&this.focused&&this.performAddTags(this.newTag),this.focused=!1}},watch:{modelValue(e){this.addOnlyFromAutocomplete||(this.selectedItem=null),this.newTag=e},tags:{handler(){this.initTags()},deep:!0},autocompleteOpen:"selectDefaultItem"},created(){this.newTag=this.modelValue,this.initTags()},mounted(){this.selectDefaultItem(),document.addEventListener("click",this.blurredOnClick)},beforeUpdate(){this.tagCenter=[]},unmounted(){document.removeEventListener("click",this.blurredOnClick)}};const K={class:"ti-input"},P={key:0,class:"ti-tags"},z=["onClick"],R={class:"ti-content"},H={key:0,class:"ti-tag-left"},G=["onClick"],j={key:1,class:"ti-tag-right"},q={class:"ti-actions"},U=["onClick"],J=["onClick"],W={class:"ti-new-tag-input-wrapper"},Y=["placeholder","value","maxlength","disabled"],Q=["onMouseover"],X=["onClick"];function Z(e,i,s,n,r,o){const l=t.resolveComponent("tag-input");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["vue-tags-input",[{"ti-disabled":e.disabled},{"ti-focus":e.focused},e.$attrs.class]]),style:t.normalizeStyle(e.$attrs.style)},[t.createElementVNode("div",K,[e.tagsCopy?(t.openBlock(),t.createElementBlock("ul",P,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.tagsCopy,(a,u)=>(t.openBlock(),t.createElementBlock("li",{key:u,style:t.normalizeStyle(a.style),class:t.normalizeClass([[{"ti-editing":e.tagsEditStatus[u]},a.tiClasses,a.classes,{"ti-deletion-mark":e.isMarked(u)}],"ti-tag"]),tabindex:"0",onClick:d=>e.$emit("tag-clicked",{tag:a,index:u})},[t.createElementVNode("div",R,[e.$slots["tag-left"]?(t.openBlock(),t.createElementBlock("div",H,[t.renderSlot(e.$slots,"tag-left",{tag:a,index:u,edit:e.tagsEditStatus[u],performSaveEdit:e.performSaveTag,performDelete:e.performDeleteTag,performCancelEdit:e.cancelEdit,performOpenEdit:e.performEditTag,deletionMark:e.isMarked(u)},void 0,!0)])):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_for:!0,ref:e.setTagCenter,class:"ti-tag-center"},[e.$slots["tag-center"]?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass({"ti-hidden":e.tagsEditStatus[u]}),onClick:d=>e.performEditTag(u)},t.toDisplayString(a.text),11,G)),e.$slots["tag-center"]?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(l,{key:1,scope:{edit:e.tagsEditStatus[u],maxlength:e.maxlength,tag:a,index:u,validateTag:e.createChangedTag,performCancelEdit:e.cancelEdit,performSaveEdit:e.performSaveTag}},null,8,["scope"])),t.renderSlot(e.$slots,"tag-center",{tag:a,index:u,maxlength:e.maxlength,edit:e.tagsEditStatus[u],performSaveEdit:e.performSaveTag,performDelete:e.performDeleteTag,performCancelEdit:e.cancelEdit,validateTag:e.createChangedTag,performOpenEdit:e.performEditTag,deletionMark:e.isMarked(u)},void 0,!0)],512),e.$slots["tag-right"]?(t.openBlock(),t.createElementBlock("div",j,[t.renderSlot(e.$slots,"tag-right",{tag:a,index:u,edit:e.tagsEditStatus[u],performSaveEdit:e.performSaveTag,performDelete:e.performDeleteTag,performCancelEdit:e.cancelEdit,performOpenEdit:e.performEditTag,deletionMark:e.isMarked(u)},void 0,!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("div",q,[e.$slots["tag-actions"]?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("i",{key:0,class:"ti-icon-undo",onClick:d=>e.cancelEdit(u)},null,8,U)),[[t.vShow,e.tagsEditStatus[u]]]),e.$slots["tag-actions"]?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("i",{key:1,class:"ti-icon-close",onClick:d=>e.performDeleteTag(u)},null,8,J)),[[t.vShow,!e.tagsEditStatus[u]]]),e.$slots["tag-actions"]?t.renderSlot(e.$slots,"tag-actions",{key:2,tag:a,index:u,edit:e.tagsEditStatus[u],performSaveEdit:e.performSaveTag,performDelete:e.performDeleteTag,performCancelEdit:e.cancelEdit,performOpenEdit:e.performEditTag,deletionMark:e.isMarked(u)},void 0,!0):t.createCommentVNode("",!0)])],14,z))),128)),t.createElementVNode("li",W,[t.createElementVNode("input",t.mergeProps({ref:"newTagInput"},e.$attrs,{class:[[e.createClasses(e.newTag,e.tags,e.validation,e.isDuplicate)],"ti-new-tag-input"],placeholder:e.placeholder,value:e.newTag,maxlength:e.maxlength,disabled:e.disabled,type:"text",size:"1",onKeydown:[i[0]||(i[0]=a=>e.performAddTags(e.filteredAutocompleteItems[e.selectedItem]||e.newTag,a)),i[2]||(i[2]=t.withKeys((...a)=>e.invokeDelete&&e.invokeDelete(...a),["delete"])),i[3]||(i[3]=t.withKeys((...a)=>e.performBlur&&e.performBlur(...a),["tab"])),i[4]||(i[4]=t.withKeys(a=>e.selectItem(a,"before"),["up"])),i[5]||(i[5]=t.withKeys(a=>e.selectItem(a,"after"),["down"]))],onPaste:i[1]||(i[1]=(...a)=>e.addTagsFromPaste&&e.addTagsFromPaste(...a)),onInput:i[6]||(i[6]=(...a)=>e.updateNewTag&&e.updateNewTag(...a)),onFocus:i[7]||(i[7]=a=>e.focused=!0),onClick:i[8]||(i[8]=a=>e.addOnlyFromAutocomplete?!1:e.selectedItem=null)}),null,16,Y)])])):t.createCommentVNode("",!0)]),t.renderSlot(e.$slots,"between-elements",{},void 0,!0),e.autocompleteOpen?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["ti-autocomplete",e.$attrs.class]),onMouseout:i[9]||(i[9]=a=>e.selectedItem=null)},[t.renderSlot(e.$slots,"autocomplete-header",{},void 0,!0),t.createElementVNode("ul",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.filteredAutocompleteItems,(a,u)=>(t.openBlock(),t.createElementBlock("li",{key:u,style:t.normalizeStyle(a.style),class:t.normalizeClass([[a.tiClasses,a.classes,{"ti-selected-item":e.isSelected(u)}],"ti-item"]),onMouseover:d=>e.disabled?!1:e.selectedItem=u},[e.$slots["autocomplete-item"]?t.renderSlot(e.$slots,"autocomplete-item",{key:1,item:a,index:u,performAdd:d=>e.performAddTags(d,void 0,"autocomplete"),selected:e.isSelected(u)},void 0,!0):(t.openBlock(),t.createElementBlock("div",{key:0,onClick:d=>e.performAddTags(a,void 0,"autocomplete")},t.toDisplayString(a.text),9,X))],46,Q))),128))]),t.renderSlot(e.$slots,"autocomplete-footer",{},void 0,!0)],34)):t.createCommentVNode("",!0)],6)}const x=g._export_sfc(I,[["render",Z],["__scopeId","data-v-d14eec25"]]);const _=t.createElementVNode("h5",{class:"mn-thin"},"Tags (maximum 20):",-1),ee={class:"mn-medium"},te=t.createElementVNode("p",{class:"p-small mn-thin"},"Suggested:",-1),ie=["onClick"],se={key:1},le={__name:"BlockTags",props:["tags"],emits:["tags-changed"],setup(e,{emit:i}){const s=e,n=t.ref(""),r=t.ref([]),o=t.ref([{text:"story"},{text:"news"},{text:"guide"},{text:"discussion"},{text:"photos"}]);s.tags&&(r.value=s.tags.map(h=>({text:h})));const l=t.computed(()=>o.value.filter(h=>h.text.toLowerCase().includes(n.value.toLowerCase()))),a=t.computed(()=>o.value.filter(h=>!r.value.some(p=>p.text===h.text)));function u(h){r.value.push(h),i("tags-changed",r.value.map(p=>p.text))}function d(h){r.value=h,i("tags-changed",r.value.map(p=>p.text))}return(h,p)=>(t.openBlock(),t.createElementBlock("div",null,[_,t.createVNode(x,{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=f=>n.value=f),tags:r.value,"autocomplete-items":t.unref(l),"add-on-key":[13,":",";",","],"save-on-key":[13,":",";",","],separators:[";",","],"max-tags":20,maxlength:20,placeholder:"Please add tags","add-from-paste":!0,"allow-edit-tags":!0,onTagsChanged:d,class:"mn-thin bg-grey radius-medium pd-small"},null,8,["modelValue","tags","autocomplete-items"]),t.createElementVNode("p",ee,[te,t.unref(a).length>0?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(a),(f,E)=>(t.openBlock(),t.createElementBlock("span",{onClick:Fe=>u(f),class:t.normalizeClass(["cursor-pointer ti-tag-toDefactor",{"mn-r-micro":E!==t.unref(a).length-1}])},t.toDisplayString(f.text),11,ie))),256)):(t.openBlock(),t.createElementBlock("span",se,"You added all suggested tags"))])]))}};const ne={class:"flex-v-center flex-nowrap flex"},re={key:0,class:"mn-r-auto t-transp mn-r-small"},ae=["name","value","checked"],oe={__name:"Checkbox",props:{label:String,name:String,value:String,radio:{type:[Array,Boolean,Object],default:()=>[]}},emits:["update:radio"],setup(e,{emit:i}){const s=e,n=r=>{if(Array.isArray(s.radio)){let o=[...s.radio];if(r.target.checked)o.push(s.value);else{const l=o.indexOf(s.value);l!==-1&&o.splice(l,1)}i("update:radio",o)}else typeof s.radio=="boolean"&&i("update:radio",r.target.checked)};return(r,o)=>(t.openBlock(),t.createElementBlock("label",ne,[e.label?(t.openBlock(),t.createElementBlock("div",re,[t.createElementVNode("span",null,t.toDisplayString(e.label),1)])):t.createCommentVNode("",!0),t.createElementVNode("input",{onChange:n,class:"round radiobutton",type:"checkbox",name:e.name,value:e.value,checked:Array.isArray(e.radio)?e.radio.includes(e.value):e.radio},null,40,ae),t.createElementVNode("div",{class:t.normalizeClass(["transition-elastic pd-thin h-2r w-4r radius-extra",{"bg-grey":!(Array.isArray(e.radio)?e.radio.includes(e.value):e.radio),"bg-main":Array.isArray(e.radio)?e.radio.includes(e.value):e.radio}])},[t.createElementVNode("div",{class:t.normalizeClass(["transition-linear w-1r h-1r radius-extra h-100 bg-white",{"mn-r-auto":!(Array.isArray(e.radio)?e.radio.includes(e.value):e.radio),"mn-l-auto":Array.isArray(e.radio)?e.radio.includes(e.value):e.radio}])},null,2)],2)]))}},ue=g._export_sfc(oe,[["__scopeId","data-v-f641f618"]]);function y(e){return e===0?!1:Array.isArray(e)&&e.length===0?!0:!e}function de(e){return(...i)=>!e(...i)}function he(e,i){return e===void 0&&(e="undefined"),e===null&&(e="null"),e===!1&&(e="false"),e.toString().toLowerCase().indexOf(i.trim())!==-1}function T(e,i,s,n){return i?e.filter(r=>he(n(r,s),i)).sort((r,o)=>n(r,s).length-n(o,s).length):e}function pe(e){return e.filter(i=>!i.$isLabel)}function v(e,i){return s=>s.reduce((n,r)=>r[e]&&r[e].length?(n.push({$groupLabel:r[i],$isLabel:!0}),n.concat(r[e])):n,[])}function ce(e,i,s,n,r){return o=>o.map(l=>{if(!l[s])return console.warn("Options passed to vue-multiselect do not contain groups, despite the config."),[];const a=T(l[s],e,i,r);return a.length?{[n]:l[n],[s]:a}:[]})}const S=(...e)=>i=>e.reduce((s,n)=>n(s),i),me={data(){return{search:"",isOpen:!1,preferredOpenDirection:"below",optimizedHeight:this.maxHeight}},props:{internalSearch:{type:Boolean,default:!0},options:{type:Array,required:!0},multiple:{type:Boolean,default:!1},trackBy:{type:String},label:{type:String},searchable:{type:Boolean,default:!0},clearOnSelect:{type:Boolean,default:!0},hideSelected:{type:Boolean,default:!1},placeholder:{type:String,default:"Select option"},allowEmpty:{type:Boolean,default:!0},resetAfter:{type:Boolean,default:!1},closeOnSelect:{type:Boolean,default:!0},customLabel:{type:Function,default(e,i){return y(e)?"":i?e[i]:e}},taggable:{type:Boolean,default:!1},tagPlaceholder:{type:String,default:"Press enter to create a tag"},tagPosition:{type:String,default:"top"},max:{type:[Number,Boolean],default:!1},id:{default:null},optionsLimit:{type:Number,default:1e3},groupValues:{type:String},groupLabel:{type:String},groupSelect:{type:Boolean,default:!1},blockKeys:{type:Array,default(){return[]}},preserveSearch:{type:Boolean,default:!1},preselectFirst:{type:Boolean,default:!1},preventAutofocus:{type:Boolean,default:!1}},mounted(){!this.multiple&&this.max&&console.warn("[Vue-Multiselect warn]: Max prop should not be used when prop Multiple equals false."),this.preselectFirst&&!this.internalValue.length&&this.options.length&&this.select(this.filteredOptions[0])},computed:{internalValue(){return this.modelValue||this.modelValue===0?Array.isArray(this.modelValue)?this.modelValue:[this.modelValue]:[]},filteredOptions(){const e=this.search||"",i=e.toLowerCase().trim();let s=this.options.concat();return this.internalSearch?s=this.groupValues?this.filterAndFlat(s,i,this.label):T(s,i,this.label,this.customLabel):s=this.groupValues?v(this.groupValues,this.groupLabel)(s):s,s=this.hideSelected?s.filter(de(this.isSelected)):s,this.taggable&&i.length&&!this.isExistingOption(i)&&(this.tagPosition==="bottom"?s.push({isTag:!0,label:e}):s.unshift({isTag:!0,label:e})),s.slice(0,this.optionsLimit)},valueKeys(){return this.trackBy?this.internalValue.map(e=>e[this.trackBy]):this.internalValue},optionKeys(){return(this.groupValues?this.flatAndStrip(this.options):this.options).map(i=>this.customLabel(i,this.label).toString().toLowerCase())},currentOptionLabel(){return this.multiple?this.searchable?"":this.placeholder:this.internalValue.length?this.getOptionLabel(this.internalValue[0]):this.searchable?"":this.placeholder}},watch:{internalValue:{handler(){this.resetAfter&&this.internalValue.length&&(this.search="",this.$emit("update:modelValue",this.multiple?[]:null))},deep:!0},search(){this.$emit("search-change",this.search)}},emits:["open","search-change","close","select","update:modelValue","remove","tag"],methods:{getValue(){return this.multiple?this.internalValue:this.internalValue.length===0?null:this.internalValue[0]},filterAndFlat(e,i,s){return S(ce(i,s,this.groupValues,this.groupLabel,this.customLabel),v(this.groupValues,this.groupLabel))(e)},flatAndStrip(e){return S(v(this.groupValues,this.groupLabel),pe)(e)},updateSearch(e){this.search=e},isExistingOption(e){return this.options?this.optionKeys.indexOf(e)>-1:!1},isSelected(e){const i=this.trackBy?e[this.trackBy]:e;return this.valueKeys.indexOf(i)>-1},isOptionDisabled(e){return!!e.$isDisabled},getOptionLabel(e){if(y(e))return"";if(e.isTag)return e.label;if(e.$isLabel)return e.$groupLabel;const i=this.customLabel(e,this.label);return y(i)?"":i},select(e,i){if(e.$isLabel&&this.groupSelect){this.selectGroup(e);return}if(!(this.blockKeys.indexOf(i)!==-1||this.disabled||e.$isDisabled||e.$isLabel)&&!(this.max&&this.multiple&&this.internalValue.length===this.max)&&!(i==="Tab"&&!this.pointerDirty)){if(e.isTag)this.$emit("tag",e.label,this.id),this.search="",this.closeOnSelect&&!this.multiple&&this.deactivate();else{if(this.isSelected(e)){i!=="Tab"&&this.removeElement(e);return}this.multiple?this.$emit("update:modelValue",this.internalValue.concat([e])):this.$emit("update:modelValue",e),this.$emit("select",e,this.id),this.clearOnSelect&&(this.search="")}this.closeOnSelect&&this.deactivate()}},selectGroup(e){const i=this.options.find(s=>s[this.groupLabel]===e.$groupLabel);if(i){if(this.wholeGroupSelected(i)){this.$emit("remove",i[this.groupValues],this.id);const s=this.internalValue.filter(n=>i[this.groupValues].indexOf(n)===-1);this.$emit("update:modelValue",s)}else{let s=i[this.groupValues].filter(n=>!(this.isOptionDisabled(n)||this.isSelected(n)));this.max&&s.splice(this.max-this.internalValue.length),this.$emit("select",s,this.id),this.$emit("update:modelValue",this.internalValue.concat(s))}this.closeOnSelect&&this.deactivate()}},wholeGroupSelected(e){return e[this.groupValues].every(i=>this.isSelected(i)||this.isOptionDisabled(i))},wholeGroupDisabled(e){return e[this.groupValues].every(this.isOptionDisabled)},removeElement(e,i=!0){if(this.disabled||e.$isDisabled)return;if(!this.allowEmpty&&this.internalValue.length<=1){this.deactivate();return}const s=typeof e=="object"?this.valueKeys.indexOf(e[this.trackBy]):this.valueKeys.indexOf(e);if(this.multiple){const n=this.internalValue.slice(0,s).concat(this.internalValue.slice(s+1));this.$emit("update:modelValue",n)}else this.$emit("update:modelValue",null);this.$emit("remove",e,this.id),this.closeOnSelect&&i&&this.deactivate()},removeLastElement(){this.blockKeys.indexOf("Delete")===-1&&this.search.length===0&&Array.isArray(this.internalValue)&&this.internalValue.length&&this.removeElement(this.internalValue[this.internalValue.length-1],!1)},activate(){this.isOpen||this.disabled||(this.adjustPosition(),this.groupValues&&this.pointer===0&&this.filteredOptions.length&&(this.pointer=1),this.isOpen=!0,this.searchable?(this.preserveSearch||(this.search=""),this.preventAutofocus||this.$nextTick(()=>this.$refs.search&&this.$refs.search.focus())):this.preventAutofocus||typeof this.$el<"u"&&this.$el.focus(),this.$emit("open",this.id))},deactivate(){this.isOpen&&(this.isOpen=!1,this.searchable?typeof this.$refs.search<"u"&&this.$refs.search.blur():typeof this.$el<"u"&&this.$el.blur(),this.preserveSearch||(this.search=""),this.$emit("close",this.getValue(),this.id))},toggle(){this.isOpen?this.deactivate():this.activate()},adjustPosition(){if(typeof window>"u")return;const e=this.$el.getBoundingClientRect().top,i=window.innerHeight-this.$el.getBoundingClientRect().bottom;i>this.maxHeight||i>e||this.openDirection==="below"||this.openDirection==="bottom"?(this.preferredOpenDirection="below",this.optimizedHeight=Math.min(i-40,this.maxHeight)):(this.preferredOpenDirection="above",this.optimizedHeight=Math.min(e-40,this.maxHeight))}}},fe={data(){return{pointer:0,pointerDirty:!1}},props:{showPointer:{type:Boolean,default:!0},optionHeight:{type:Number,default:40}},computed:{pointerPosition(){return this.pointer*this.optionHeight},visibleElements(){return this.optimizedHeight/this.optionHeight}},watch:{filteredOptions(){this.pointerAdjust()},isOpen(){this.pointerDirty=!1},pointer(){this.$refs.search&&this.$refs.search.setAttribute("aria-activedescendant",this.id+"-"+this.pointer.toString())}},methods:{optionHighlight(e,i){return{"multiselect__option--highlight":e===this.pointer&&this.showPointer,"multiselect__option--selected":this.isSelected(i)}},groupHighlight(e,i){if(!this.groupSelect)return["multiselect__option--disabled",{"multiselect__option--group":i.$isLabel}];const s=this.options.find(n=>n[this.groupLabel]===i.$groupLabel);return s&&!this.wholeGroupDisabled(s)?["multiselect__option--group",{"multiselect__option--highlight":e===this.pointer&&this.showPointer},{"multiselect__option--group-selected":this.wholeGroupSelected(s)}]:"multiselect__option--disabled"},addPointerElement({key:e}="Enter"){this.filteredOptions.length>0&&this.select(this.filteredOptions[this.pointer],e),this.pointerReset()},pointerForward(){this.pointer<this.filteredOptions.length-1&&(this.pointer++,this.$refs.list.scrollTop<=this.pointerPosition-(this.visibleElements-1)*this.optionHeight&&(this.$refs.list.scrollTop=this.pointerPosition-(this.visibleElements-1)*this.optionHeight),this.filteredOptions[this.pointer]&&this.filteredOptions[this.pointer].$isLabel&&!this.groupSelect&&this.pointerForward()),this.pointerDirty=!0},pointerBackward(){this.pointer>0?(this.pointer--,this.$refs.list.scrollTop>=this.pointerPosition&&(this.$refs.list.scrollTop=this.pointerPosition),this.filteredOptions[this.pointer]&&this.filteredOptions[this.pointer].$isLabel&&!this.groupSelect&&this.pointerBackward()):this.filteredOptions[this.pointer]&&this.filteredOptions[0].$isLabel&&!this.groupSelect&&this.pointerForward(),this.pointerDirty=!0},pointerReset(){this.closeOnSelect&&(this.pointer=0,this.$refs.list&&(this.$refs.list.scrollTop=0))},pointerAdjust(){this.pointer>=this.filteredOptions.length-1&&(this.pointer=this.filteredOptions.length?this.filteredOptions.length-1:0),this.filteredOptions.length>0&&this.filteredOptions[this.pointer].$isLabel&&!this.groupSelect&&this.pointerForward()},pointerSet(e){this.pointer=e,this.pointerDirty=!0}}};const ge={name:"vue-multiselect",mixins:[me,fe],compatConfig:{MODE:3,ATTR_ENUMERATED_COERCION:!1},props:{name:{type:String,default:""},modelValue:{type:null,default(){return[]}},selectLabel:{type:String,default:"Press enter to select"},selectGroupLabel:{type:String,default:"Press enter to select group"},selectedLabel:{type:String,default:"Selected"},deselectLabel:{type:String,default:"Press enter to remove"},deselectGroupLabel:{type:String,default:"Press enter to deselect group"},showLabels:{type:Boolean,default:!0},limit:{type:Number,default:99999},maxHeight:{type:Number,default:300},limitText:{type:Function,default:e=>`and ${e} more`},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},openDirection:{type:String,default:""},showNoOptions:{type:Boolean,default:!0},showNoResults:{type:Boolean,default:!0},tabindex:{type:Number,default:0}},computed:{hasOptionGroup(){return this.groupValues&&this.groupLabel&&this.groupSelect},isSingleLabelVisible(){return(this.singleValue||this.singleValue===0)&&(!this.isOpen||!this.searchable)&&!this.visibleValues.length},isPlaceholderVisible(){return!this.internalValue.length&&(!this.searchable||!this.isOpen)},visibleValues(){return this.multiple?this.internalValue.slice(0,this.limit):[]},singleValue(){return this.internalValue[0]},deselectLabelText(){return this.showLabels?this.deselectLabel:""},deselectGroupLabelText(){return this.showLabels?this.deselectGroupLabel:""},selectLabelText(){return this.showLabels?this.selectLabel:""},selectGroupLabelText(){return this.showLabels?this.selectGroupLabel:""},selectedLabelText(){return this.showLabels?this.selectedLabel:""},inputStyle(){return this.searchable||this.multiple&&this.modelValue&&this.modelValue.length?this.isOpen?{width:"100%"}:{width:"0",position:"absolute",padding:"0"}:""},contentStyle(){return this.options.length?{display:"inline-block"}:{display:"block"}},isAbove(){return this.openDirection==="above"||this.openDirection==="top"?!0:this.openDirection==="below"||this.openDirection==="bottom"?!1:this.preferredOpenDirection==="above"},showSearchInput(){return this.searchable&&(this.hasSingleSelectedSlot&&(this.visibleSingleValue||this.visibleSingleValue===0)?this.isOpen:!0)}}},ye=["tabindex","aria-owns"],ve={ref:"tags",class:"multiselect__tags"},be={class:"multiselect__tags-wrap"},we=["textContent"],Se=["onKeypress","onMousedown"],ke=["textContent"],Te={class:"multiselect__spinner"},Ee=["name","id","placeholder","value","disabled","tabindex","aria-controls"],Ve=["id"],$e={key:0},Oe={class:"multiselect__option"},Be=["id","role"],Ce=["onClick","onMouseenter","data-select","data-selected","data-deselect"],De=["data-select","data-deselect","onMouseenter","onMousedown"],Le={class:"multiselect__option"},Ae={class:"multiselect__option"};function Ne(e,i,s,n,r,o){return t.openBlock(),t.createElementBlock("div",{tabindex:e.searchable?-1:s.tabindex,class:t.normalizeClass([{"multiselect--active":e.isOpen,"multiselect--disabled":s.disabled,"multiselect--above":o.isAbove,"multiselect--has-options-group":o.hasOptionGroup},"multiselect"]),onFocus:i[13]||(i[13]=l=>e.activate()),onBlur:i[14]||(i[14]=l=>e.searchable?!1:e.deactivate()),onKeydown:[i[15]||(i[15]=t.withKeys(t.withModifiers(l=>e.pointerForward(),["self","prevent"]),["down"])),i[16]||(i[16]=t.withKeys(t.withModifiers(l=>e.pointerBackward(),["self","prevent"]),["up"]))],onKeypress:i[17]||(i[17]=t.withKeys(t.withModifiers(l=>e.addPointerElement(l),["stop","self"]),["enter","tab"])),onKeyup:i[18]||(i[18]=t.withKeys(l=>e.deactivate(),["esc"])),role:"combobox","aria-owns":"listbox-"+e.id},[t.renderSlot(e.$slots,"caret",{toggle:e.toggle},()=>[t.createElementVNode("div",{onMousedown:i[0]||(i[0]=t.withModifiers(l=>e.toggle(),["prevent","stop"])),class:"multiselect__select"},null,32)]),t.renderSlot(e.$slots,"clear",{search:e.search}),t.createElementVNode("div",ve,[t.renderSlot(e.$slots,"selection",{search:e.search,remove:e.removeElement,values:o.visibleValues,isOpen:e.isOpen},()=>[t.withDirectives(t.createElementVNode("div",be,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.visibleValues,(l,a)=>t.renderSlot(e.$slots,"tag",{option:l,search:e.search,remove:e.removeElement},()=>[(t.openBlock(),t.createElementBlock("span",{class:"multiselect__tag",key:a},[t.createElementVNode("span",{textContent:t.toDisplayString(e.getOptionLabel(l))},null,8,we),t.createElementVNode("i",{tabindex:"1",onKeypress:t.withKeys(t.withModifiers(u=>e.removeElement(l),["prevent"]),["enter"]),onMousedown:t.withModifiers(u=>e.removeElement(l),["prevent"]),class:"multiselect__tag-icon"},null,40,Se)]))])),256))],512),[[t.vShow,o.visibleValues.length>0]]),e.internalValue&&e.internalValue.length>s.limit?t.renderSlot(e.$slots,"limit",{key:0},()=>[t.createElementVNode("strong",{class:"multiselect__strong",textContent:t.toDisplayString(s.limitText(e.internalValue.length-s.limit))},null,8,ke)]):t.createCommentVNode("",!0)]),t.createVNode(t.Transition,{name:"multiselect__loading"},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"loading",{},()=>[t.withDirectives(t.createElementVNode("div",Te,null,512),[[t.vShow,s.loading]])])]),_:3}),e.searchable?(t.openBlock(),t.createElementBlock("input",{key:0,ref:"search",name:s.name,id:e.id,type:"text",autocomplete:"off",spellcheck:"false",placeholder:e.placeholder,style:t.normalizeStyle(o.inputStyle),value:e.search,disabled:s.disabled,tabindex:s.tabindex,onInput:i[1]||(i[1]=l=>e.updateSearch(l.target.value)),onFocus:i[2]||(i[2]=t.withModifiers(l=>e.activate(),["prevent"])),onBlur:i[3]||(i[3]=t.withModifiers(l=>e.deactivate(),["prevent"])),onKeyup:i[4]||(i[4]=t.withKeys(l=>e.deactivate(),["esc"])),onKeydown:[i[5]||(i[5]=t.withKeys(t.withModifiers(l=>e.pointerForward(),["prevent"]),["down"])),i[6]||(i[6]=t.withKeys(t.withModifiers(l=>e.pointerBackward(),["prevent"]),["up"])),i[8]||(i[8]=t.withKeys(t.withModifiers(l=>e.removeLastElement(),["stop"]),["delete"]))],onKeypress:i[7]||(i[7]=t.withKeys(t.withModifiers(l=>e.addPointerElement(l),["prevent","stop","self"]),["enter"])),class:"multiselect__input","aria-controls":"listbox-"+e.id},null,44,Ee)):t.createCommentVNode("",!0),o.isSingleLabelVisible?(t.openBlock(),t.createElementBlock("span",{key:1,class:"multiselect__single",onMousedown:i[9]||(i[9]=t.withModifiers((...l)=>e.toggle&&e.toggle(...l),["prevent"]))},[t.renderSlot(e.$slots,"singleLabel",{option:o.singleValue},()=>[t.createTextVNode(t.toDisplayString(e.currentOptionLabel),1)])],32)):t.createCommentVNode("",!0),o.isPlaceholderVisible?(t.openBlock(),t.createElementBlock("span",{key:2,class:"multiselect__placeholder",onMousedown:i[10]||(i[10]=t.withModifiers((...l)=>e.toggle&&e.toggle(...l),["prevent"]))},[t.renderSlot(e.$slots,"placeholder",{},()=>[t.createTextVNode(t.toDisplayString(e.placeholder),1)])],32)):t.createCommentVNode("",!0)],512),t.createVNode(t.Transition,{name:"multiselect"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["multiselect__content-wrapper",e.$attrs.class]),onFocus:i[11]||(i[11]=(...l)=>e.activate&&e.activate(...l)),tabindex:"-1",onMousedown:i[12]||(i[12]=t.withModifiers(()=>{},["prevent"])),style:t.normalizeStyle({maxHeight:e.optimizedHeight+"px"}),ref:"list"},[t.createElementVNode("ul",{class:"multiselect__content",style:t.normalizeStyle(o.contentStyle),role:"listbox",id:"listbox-"+e.id},[t.renderSlot(e.$slots,"beforeList"),e.multiple&&e.max===e.internalValue.length?(t.openBlock(),t.createElementBlock("li",$e,[t.createElementVNode("span",Oe,[t.renderSlot(e.$slots,"maxElements",{},()=>[t.createTextVNode("Maximum of "+t.toDisplayString(e.max)+" options selected. First remove a selected option to select another.",1)])])])):t.createCommentVNode("",!0),!e.max||e.internalValue.length<e.max?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(e.filteredOptions,(l,a)=>(t.openBlock(),t.createElementBlock("li",{class:"multiselect__element",key:a,id:e.id+"-"+a,role:l&&(l.$isLabel||l.$isDisabled)?null:"option"},[l&&(l.$isLabel||l.$isDisabled)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass([e.optionHighlight(a,l),"multiselect__option"]),onClick:t.withModifiers(u=>e.select(l),["stop"]),onMouseenter:t.withModifiers(u=>e.pointerSet(a),["self"]),"data-select":l&&l.isTag?e.tagPlaceholder:o.selectLabelText,"data-selected":o.selectedLabelText,"data-deselect":o.deselectLabelText},[t.renderSlot(e.$slots,"option",{option:l,search:e.search,index:a},()=>[t.createElementVNode("span",null,t.toDisplayString(e.getOptionLabel(l)),1)])],42,Ce)),l&&(l.$isLabel||l.$isDisabled)?(t.openBlock(),t.createElementBlock("span",{key:1,"data-select":e.groupSelect&&o.selectGroupLabelText,"data-deselect":e.groupSelect&&o.deselectGroupLabelText,class:t.normalizeClass([e.groupHighlight(a,l),"multiselect__option"]),onMouseenter:t.withModifiers(u=>e.groupSelect&&e.pointerSet(a),["self"]),onMousedown:t.withModifiers(u=>e.selectGroup(l),["prevent"])},[t.renderSlot(e.$slots,"option",{option:l,search:e.search,index:a},()=>[t.createElementVNode("span",null,t.toDisplayString(e.getOptionLabel(l)),1)])],42,De)):t.createCommentVNode("",!0)],8,Be))),128)):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("li",null,[t.createElementVNode("span",Le,[t.renderSlot(e.$slots,"noResult",{search:e.search},()=>[t.createTextVNode("No elements found. Consider changing the search query.")])])],512),[[t.vShow,s.showNoResults&&e.filteredOptions.length===0&&e.search&&!s.loading]]),t.withDirectives(t.createElementVNode("li",null,[t.createElementVNode("span",Ae,[t.renderSlot(e.$slots,"noOptions",{},()=>[t.createTextVNode("List is empty.")])])],512),[[t.vShow,s.showNoOptions&&(e.options.length===0||o.hasOptionGroup===!0&&e.filteredOptions.length===0)&&!e.search&&!s.loading]]),t.renderSlot(e.$slots,"afterList")],12,Ve)],38),[[t.vShow,e.isOpen]])]),_:3})],42,ye)}const Me=g._export_sfc(ge,[["render",Ne]]);exports.Checkbox=ue;exports.SelectMulti=Me;exports._sfc_main=le;