@telia-ace/conversational-hub-bot-provider 0.0.7 → 0.0.9

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.
@@ -0,0 +1,2301 @@
1
+ var it = Object.defineProperty;
2
+ var nt = (t, e, o) => e in t ? it(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
+ var _ = (t, e, o) => (nt(t, typeof e != "symbol" ? e + "" : e, o), o);
4
+ import { jsx as u, jsxs as R, Fragment as st } from "react/jsx-runtime";
5
+ import { C as rt, u as ve, a as Ee, b as at, c as ct, d as lt, e as dt, f as mt, g as G, F as he, W as ue, l as ft, h as ht, L as Oe, I as ne, n as y, i as $e, j as Le, k as qe, m as Z, o as J, p as X, q as x, T as je, B as we, r as ke, s as ut, S as j, t as se, v as Fe, w as ge, x as gt, y as V, z as Be, P as De, A as Ge, H as yt, D as pt, E as bt, G as Ne } from "./index-fb4b566f.mjs";
6
+ import { useContext as Pe, useState as D, useEffect as q, forwardRef as re, useCallback as Y, useMemo as vt, useRef as He, useImperativeHandle as $t, Suspense as wt } from "react";
7
+ import "react-dom";
8
+ function W(t = {}) {
9
+ const {
10
+ phrase: e = "",
11
+ category: o,
12
+ guideCategory: n,
13
+ contactCategory: i,
14
+ take: s,
15
+ connectionKey: a,
16
+ accordion: r,
17
+ id: c,
18
+ uriName: l,
19
+ sorting: h,
20
+ tag: m,
21
+ tagId: g,
22
+ tagTitle: v,
23
+ ...p
24
+ } = t, d = {};
25
+ return Object.keys(p).forEach((f) => {
26
+ typeof t[f] == "string" && (d[f] = t[f]);
27
+ }), typeof e == "string" && e.length && (d.phrase = e), e === null && (d.phrase = e), typeof n == "string" && n !== "0" && (d.guideCategory = n), typeof n == "number" && n !== 0 && (d.guideCategory = n), typeof n == "object" && n !== null && (typeof n.id == "string" && n.id !== "0" && (d.guideCategory = n.id), typeof n.id == "number" && n.id !== 0 && (d.guideCategory = n.id)), typeof i == "string" && i !== "0" && (d.contactCategory = i), typeof i == "number" && i !== 0 && (d.contactCategory = i), typeof i == "object" && i !== null && (typeof i.id == "string" && i.id !== "0" && (d.contactCategory = i.id), typeof i.id == "number" && i.id !== 0 && (d.contactCategory = i.id)), typeof o == "string" && o !== "0" && (d.category = o), typeof o == "number" && o !== 0 && (d.category = o), typeof o == "object" && o !== null && (typeof o.id == "string" && o.id !== "0" && (d.category = o.id), typeof o.id == "number" && o.id !== 0 && (d.category = o.id)), c && (d.id = c), l && (+d.category || +d.guideCategory || +d.guide || +d.contactCategory || +d.contactMethod) && (d.uriName = l), a && (d.connectionKey = a), s && (d.take = s), h && (d.sorting = h), typeof r == "string" && r.length > 0 && (d.accordion = r), typeof m == "string" && m !== "0" && (d.tag = m), typeof m == "number" && m !== 0 && (d.tag = m), Array.isArray(m) && m.length && (d.tag = m), (typeof g == "string" || typeof g == "number") && (d.tagId = g), typeof v == "string" && (d.tagTitle = v), typeof d.tag == "string" && (d.tag = d.tag.split(",")), d;
28
+ }
29
+ const ye = (t) => {
30
+ if (!t)
31
+ return "";
32
+ const e = [
33
+ { from: /[äæǽ]+/gi, to: "ae" },
34
+ { from: /[öœ]+/gi, to: "oe" },
35
+ { from: /[ü]+/gi, to: "ue" },
36
+ { from: /[Ä]+/gi, to: "Ae" },
37
+ { from: /[Ü]+/gi, to: "Ue" },
38
+ { from: /[Ö]+/gi, to: "Oe" },
39
+ { from: /[ÀÁÂÃÄÅǺĀĂĄǍΑΆẢẠẦẪẨẬẰẮẴẲẶА]+/gi, to: "A" },
40
+ { from: /[àáâãåǻāăąǎªαάảạầấẫẩậằắẵẳặа]+/gi, to: "a" },
41
+ { from: /[Б]+/gi, to: "B" },
42
+ { from: /[б]+/gi, to: "b" },
43
+ { from: /[ÇĆĈĊČ]+/gi, to: "C" },
44
+ { from: /[çćĉċč]+/gi, to: "c" },
45
+ { from: /[Д]+/gi, to: "D" },
46
+ { from: /[д]+/gi, to: "d" },
47
+ { from: /[ÐĎĐΔ]+/gi, to: "Dj" },
48
+ { from: /[ðďđδ]+/gi, to: "dj" },
49
+ { from: /[ÈÉÊËĒĔĖĘĚΕΈẼẺẸỀẾỄỂỆЕЭ]+/gi, to: "E" },
50
+ { from: /[èéêëēĕėęěέεẽẻẹềếễểệеэ]+/gi, to: "e" },
51
+ { from: /[Ф]+/gi, to: "F" },
52
+ { from: /[ф]+/gi, to: "f" },
53
+ { from: /[ĜĞĠĢΓГҐ]+/gi, to: "G" },
54
+ { from: /[ĝğġģγгґ]+/gi, to: "g" },
55
+ { from: /[ĤĦ]+/gi, to: "H" },
56
+ { from: /[ĥħ]+/gi, to: "h" },
57
+ { from: /[ÌÍÎÏĨĪĬǏĮİΗΉΊΙΪỈỊИЫ]+/gi, to: "I" },
58
+ { from: /[ìíîïĩīĭǐįıηήίιϊỉịиыї]+/gi, to: "i" },
59
+ { from: /[Ĵ]+/gi, to: "J" },
60
+ { from: /[ĵ]+/gi, to: "j" },
61
+ { from: /[ĶΚК]+/gi, to: "K" },
62
+ { from: /[ķκк]+/gi, to: "k" },
63
+ { from: /[ĹĻĽĿŁΛЛ]+/gi, to: "L" },
64
+ { from: /[ĺļľŀłλл]+/gi, to: "l" },
65
+ { from: /[М]+/gi, to: "M" },
66
+ { from: /[м]+/gi, to: "m" },
67
+ { from: /[ÑŃŅŇΝН]+/gi, to: "N" },
68
+ { from: /[ñńņňʼnνн]+/gi, to: "n" },
69
+ { from: /[ÒÓÔÕŌŎǑŐƠØǾΟΌΩΏỎỌỒỐỖỔỘỜỚỠỞỢО]+/gi, to: "O" },
70
+ { from: /[òóôõōŏǒőơøǿºοόωώỏọồốỗổộờớỡởợо]+/gi, to: "o" },
71
+ { from: /[П]+/gi, to: "P" },
72
+ { from: /[п]+/gi, to: "p" },
73
+ { from: /[ŔŖŘΡР]+/gi, to: "R" },
74
+ { from: /[ŕŗřρр]+/gi, to: "r" },
75
+ { from: /[ŚŜŞȘŠΣС]+/gi, to: "S" },
76
+ { from: /[śŝşșšſσςс]+/gi, to: "s" },
77
+ { from: /[ȚŢŤŦτТ]+/gi, to: "T" },
78
+ { from: /[țţťŧт]+/gi, to: "t" },
79
+ { from: /[ÙÚÛŨŪŬŮŰŲƯǓǕǗǙǛŨỦỤỪỨỮỬỰУ]+/gi, to: "U" },
80
+ { from: /[ùúûũūŭůűųưǔǖǘǚǜυύϋủụừứữửựу]+/gi, to: "u" },
81
+ { from: /[ÝŸŶΥΎΫỲỸỶỴЙ]+/gi, to: "Y" },
82
+ { from: /[ýÿŷỳỹỷỵй]+/gi, to: "y" },
83
+ { from: /[В]+/gi, to: "V" },
84
+ { from: /[в]+/gi, to: "v" },
85
+ { from: /[Ŵ]+/gi, to: "W" },
86
+ { from: /[ŵ]+/gi, to: "w" },
87
+ { from: /[ŹŻŽΖЗ]+/gi, to: "Z" },
88
+ { from: /[źżžζз]+/gi, to: "z" },
89
+ { from: /[ÆǼ]+/gi, to: "AE" },
90
+ { from: /[ß]+/gi, to: "ss" },
91
+ { from: /[IJ]+/gi, to: "IJ" },
92
+ { from: /[ij]+/gi, to: "ij" },
93
+ { from: /[Œ]+/gi, to: "OE" },
94
+ { from: /[ƒ]+/gi, to: "f" },
95
+ { from: /[ξ]+/gi, to: "ks" },
96
+ { from: /[π]+/gi, to: "p" },
97
+ { from: /[β]+/gi, to: "v" },
98
+ { from: /[μ]+/gi, to: "m" },
99
+ { from: /[ψ]+/gi, to: "ps" },
100
+ { from: /[Ё]+/gi, to: "Yo" },
101
+ { from: /[ё]+/gi, to: "yo" },
102
+ { from: /[Є]+/gi, to: "Ye" },
103
+ { from: /[є]+/gi, to: "ye" },
104
+ { from: /[Ї]+/gi, to: "Yi" },
105
+ { from: /[Ж]+/gi, to: "Zh" },
106
+ { from: /[ж]+/gi, to: "zh" },
107
+ { from: /[Х]+/gi, to: "Kh" },
108
+ { from: /[х]+/gi, to: "kh" },
109
+ { from: /[Ц]+/gi, to: "Ts" },
110
+ { from: /[ц]+/gi, to: "ts" },
111
+ { from: /[Ч]+/gi, to: "Ch" },
112
+ { from: /[ч]+/gi, to: "ch" },
113
+ { from: /[Ш]+/gi, to: "Sh" },
114
+ { from: /[ш]+/gi, to: "sh" },
115
+ { from: /[Щ]+/gi, to: "Shch" },
116
+ { from: /[щ]+/gi, to: "shch" },
117
+ { from: /[ЪъЬь]+/gi, to: "" },
118
+ { from: /[Ю]+/gi, to: "Yu" },
119
+ { from: /[ю]+/gi, to: "yu" },
120
+ { from: /[Я]+/gi, to: "Ya" },
121
+ { from: /[я]+/gi, to: "ya" }
122
+ ], o = /[^a-zA-Z0-9]+/g, n = /[-]$/;
123
+ let i = t;
124
+ for (const s in e)
125
+ e.hasOwnProperty(s) && e[s].from.test(t) && (i = i.replace(e[s].from, e[s].to));
126
+ return i = i.replace(o, "-"), i = i.replace(n, ""), i = i.toLowerCase(), i || "humany";
127
+ }, xt = (t, e) => {
128
+ if (!t || !e)
129
+ return !0;
130
+ let o = e.parentNode, n = !1;
131
+ for (; o !== null; )
132
+ o === t && (n = !0), o = o.parentNode;
133
+ return n;
134
+ }, pe = (t = {}) => (Object.keys(t).forEach((e) => {
135
+ (t[e] === null || typeof t[e] > "u") && delete t[e];
136
+ }), t), oe = (t, e) => {
137
+ let o = !0;
138
+ return Object.keys(t).length !== Object.keys(e).length || Object.keys(t).some((i) => !Object.keys(e).some((a) => i === a)) ? !1 : (Object.keys(t).forEach((i) => {
139
+ if (o) {
140
+ const s = typeof t[i] > "u" ? "" : t[i], a = typeof e[i] > "u" ? "" : e[i];
141
+ o = s.toString() === a.toString();
142
+ }
143
+ }), o);
144
+ }, Ye = () => Pe(rt), Ct = (t, e) => {
145
+ const o = Ye(), n = ve(), [i, s] = D(void 0), a = Ee(), r = t || o.type || "";
146
+ return q(() => {
147
+ if (r) {
148
+ let c;
149
+ return (e || n).getAsync("componentResolver").then((l) => {
150
+ if (a.current) {
151
+ const h = l.getComponent(r);
152
+ s(h);
153
+ }
154
+ c = l.registerResolver(r, (h) => {
155
+ a.current && s(h);
156
+ });
157
+ }), () => {
158
+ c && c();
159
+ };
160
+ }
161
+ }, [a, r, e, n]), i;
162
+ }, kt = () => Pe(at), Nt = () => {
163
+ const t = ct(), e = Ye(), [o, n] = D([]), [i, s] = D();
164
+ return q(() => {
165
+ if (t && e) {
166
+ const a = new lt(t).withId(e.id), r = t.actions(a, e.type || dt());
167
+ s(r), o !== null && (o.forEach((c) => {
168
+ r.dispatch(c.key, c.data).then((l) => c.resolve(l)).catch((l) => c.reject(l));
169
+ }), n(null));
170
+ }
171
+ }, [t, e.id]), (a, r) => o !== null ? new Promise((c, l) => {
172
+ o.push({
173
+ key: a,
174
+ data: r,
175
+ resolve: c,
176
+ reject: l
177
+ });
178
+ }) : i.dispatch(a, r);
179
+ }, Mt = () => {
180
+ const [t, e] = D(!1);
181
+ return q(() => {
182
+ const o = () => {
183
+ e(!1);
184
+ }, n = (i) => {
185
+ i.keyCode === 9 && e(!0);
186
+ };
187
+ return window.addEventListener("keydown", n), window.addEventListener("click", o), () => {
188
+ window.removeEventListener("keydown", n), window.removeEventListener("click", o);
189
+ };
190
+ }, []), t;
191
+ }, xe = (t) => {
192
+ const e = ve(), o = mt(), [n, i] = D({
193
+ name: "",
194
+ params: {}
195
+ }), s = Ee();
196
+ return q(() => {
197
+ const a = (t || e).get("$widget");
198
+ if (!a)
199
+ return;
200
+ const { events: r } = a;
201
+ return r.subscribe(
202
+ "router:change",
203
+ (l, { next: { routeData: h } }) => {
204
+ if (s.current) {
205
+ const { name: m, params: g } = h;
206
+ pe(g), i({ name: m, params: g });
207
+ }
208
+ }
209
+ );
210
+ }, [s, t, e]), q(() => {
211
+ if (o && o.history && s.current) {
212
+ const a = o.getRouteData(), { name: r, params: c } = a;
213
+ pe(c), i({ name: r, params: c });
214
+ }
215
+ }, [o, s]), n;
216
+ };
217
+ var Ue = /* @__PURE__ */ ((t) => (t.HH_MM = "hh:mm", t.YYYY_MM_DD = "yyyy-mm-dd", t.YYYY_MM_DD_HH_MM = "yyyy-mm-dd hh:mm", t))(Ue || {});
218
+ const _e = ({
219
+ className: t = "",
220
+ format: e = "hh:mm",
221
+ timestamp: o
222
+ }) => /* @__PURE__ */ u("span", { className: G(t, "humany-timestamp"), children: zt(o, e) }), Me = (t) => `0${t}`.slice(-2);
223
+ function zt(t, e) {
224
+ const o = new Date(t), n = o.toTimeString().split(" ")[0].split(":"), i = n.length > 1 ? `${n[0]}:${n[1]}` : n[0], s = o.getFullYear(), a = o.getMonth() + 1, r = o.getDate(), c = `${s}-${Me(a)}-${Me(
225
+ r
226
+ )}`;
227
+ return e === "yyyy-mm-dd" ? c : e === "hh:mm" ? i : `${c} ${i}`;
228
+ }
229
+ var ie = /* @__PURE__ */ ((t) => (t.guide = "guide", t.link = "link", t.default = "default", t))(ie || {});
230
+ const ze = (t) => import("./index-5c9c2abf.mjs").then(
231
+ ({ ServiceClient: e, ServiceProxy: o }) => t.get("settings").then((n) => {
232
+ const { name: i, events: s } = t.get("$widget"), {
233
+ data: { projection: a = "", site: r = "current", forceHttps: c = !1 }
234
+ } = n, l = new o(a, {
235
+ credentials: "same-origin"
236
+ }), h = new e(
237
+ l,
238
+ {
239
+ funnel: i.replace("_contact-method", "").replace("_contact", ""),
240
+ site: St(r, c)
241
+ },
242
+ null,
243
+ t
244
+ );
245
+ return s.subscribe(
246
+ "widget:settings-updated",
247
+ (m, { data: g }) => {
248
+ g && g.projection !== a && h.proxy.setBaseUrl(g.projection);
249
+ }
250
+ ), h;
251
+ })
252
+ ), St = (t, e) => () => {
253
+ const o = (i) => {
254
+ const s = document.createElement("a");
255
+ return s.href = i, s;
256
+ };
257
+ let n = window.location;
258
+ return t === "referrer" && document.referrer && (n = o(document.referrer)), [
259
+ e ? "https:" : "",
260
+ "//",
261
+ n.host,
262
+ n.pathname
263
+ ].join("");
264
+ }, B = (t) => {
265
+ if (t) {
266
+ const { Type: e, Content: o } = t;
267
+ if (e && o)
268
+ return { type: e, content: o };
269
+ }
270
+ }, be = (t) => t.map((e) => {
271
+ const o = {
272
+ id: e.Id.toString(),
273
+ title: e.Name,
274
+ symbol: B(e.DefaultIcon),
275
+ activeSymbol: e.ActiveIcon && B(e.ActiveIcon),
276
+ description: e.Description || e.Attributes && e.Attributes.description || "",
277
+ matches: e.GuidesCount
278
+ };
279
+ return e.Children && e.Children.length && (o.items = be(e.Children)), o;
280
+ }), L = (t, e) => t.filter(({ Type: o }) => o === e).map(({ Id: o, Title: n, Body: i }) => ({
281
+ id: o.toString(),
282
+ title: n,
283
+ body: i
284
+ })), le = (t) => t.map(({ Id: e, Title: o, DefaultIcon: n, ListNotices: i, Notices: s }) => ({
285
+ id: e.toString(),
286
+ title: o,
287
+ symbol: B(n),
288
+ defaultHeaderOptions: {
289
+ visible: !!i.length
290
+ },
291
+ notifications: (i || []).concat(s || []).map(({ Id: a, Title: r, Body: c, Type: l, Modified: h }) => ({
292
+ id: a.toString(),
293
+ title: r,
294
+ body: c,
295
+ modified: h,
296
+ expandable: l === "listNotice"
297
+ }))
298
+ })), de = ({
299
+ Id: t,
300
+ Title: e,
301
+ DefaultIcon: o,
302
+ Exits: [n],
303
+ ExitType: i,
304
+ ConfirmationText: s,
305
+ ExpandFormAutomatically: a,
306
+ Form: r,
307
+ Description: c
308
+ }, l) => {
309
+ const { Adapter: h } = n || { Adapter: {} }, { ClientName: m = "", Settings: g = {}, CustomClientName: v = "" } = h, p = {
310
+ id: t.toString(),
311
+ title: e,
312
+ description: c,
313
+ symbol: B(o),
314
+ clientName: m === "custom.adapter" ? v : m,
315
+ expanded: !0,
316
+ inline: !0,
317
+ body: {}
318
+ };
319
+ if (m.indexOf("phone") > -1 || m.indexOf("freetext") > -1) {
320
+ const { displayTextBeforeClick: d, textBeforeClick: f } = g;
321
+ d === "true" && (p.expanded = !1, p.title = f), m.indexOf("phone.text") > -1 ? p.body.phoneNumber = g.phoneNumber : p.body.freetext = g.freetext;
322
+ }
323
+ return (m.indexOf("chat.popup") > -1 || m.indexOf("link") > -1 || m === "custom.adapter" && i === "custom") && (p.body = g, p.body.confirmationFallback = s), m.indexOf("ace") > -1 && (p.body = g), r && r.HasValueComponents && (l ? p.body.form = he.fromLegacyForm(
324
+ t.toString(),
325
+ r,
326
+ l
327
+ ).get() : p.body.form = he.fromLegacyForm(
328
+ t.toString(),
329
+ r
330
+ ).get(), a || (p.expanded = p.inline = !1)), p;
331
+ }, K = (t = []) => t.map(
332
+ ({ Id: e, Title: o, TotalMatches: n, Symbol: i, DefaultIcon: s, ActiveIcon: a }) => ({
333
+ id: e.toString(),
334
+ title: o,
335
+ matches: n,
336
+ symbol: B(s || i),
337
+ defaultIcon: B(s),
338
+ activeIcon: B(a)
339
+ })
340
+ ), me = (t) => t.map(({ Id: e, Title: o, Tags: n, FirstPublishedDate: i, Modified: s }) => ({
341
+ id: e.toString(),
342
+ title: o,
343
+ tags: K(n),
344
+ published: i,
345
+ modified: s
346
+ })), Rt = (t, e) => {
347
+ switch (t) {
348
+ case E.MatchByCategory:
349
+ case E.Match: {
350
+ const o = {
351
+ guides: [],
352
+ matches: 0,
353
+ topNotifications: [],
354
+ middleNotifications: [],
355
+ bottomNotifications: [],
356
+ notificationLists: [],
357
+ tags: [],
358
+ byCategory: []
359
+ }, {
360
+ Matches: n,
361
+ TotalMatches: i,
362
+ Notices: s,
363
+ NoticeLists: a,
364
+ Tags: r,
365
+ ByCategory: c
366
+ } = e;
367
+ return o.guides = me(n), o.matches = i, o.byCategory = (c || []).map(
368
+ ({ Id: l, Matches: h, TotalMatches: m }) => ({
369
+ id: l,
370
+ guides: me(h),
371
+ matches: m
372
+ })
373
+ ), o.tags = K(r), o.notificationLists = le(a || []), o.topNotifications = L(s || [], "noticeRowTop"), o.middleNotifications = L(s || [], "noticeRowMiddle"), o.bottomNotifications = L(s || [], "footerNotice"), o;
374
+ }
375
+ case E.Categories: {
376
+ const { Children: o, GuidesCountTotal: n } = e;
377
+ return {
378
+ categories: be(o || []),
379
+ matches: n
380
+ };
381
+ }
382
+ case E.Guide: {
383
+ const {
384
+ Id: o,
385
+ Title: n,
386
+ Body: i,
387
+ Related: s,
388
+ Options: a,
389
+ ConnectionId: r,
390
+ ContactMethods: c,
391
+ EnableFeedback: l,
392
+ HandoverExists: h,
393
+ FirstPublishedDate: m,
394
+ Modified: g,
395
+ ModifiedByDisplayName: v,
396
+ FirstPublishedByDisplayName: p,
397
+ Categories: d,
398
+ Tags: f,
399
+ SeoMetaDescription: $,
400
+ SeoAllowIndex: z,
401
+ Perspectives: S,
402
+ PerspectiveKey: C,
403
+ Translations: A
404
+ } = e, b = C || Object.values(S).find(
405
+ (N) => N === r
406
+ ) || S.Default || null, T = {
407
+ guide: {
408
+ id: o.toString(),
409
+ title: n,
410
+ body: i,
411
+ modified: g,
412
+ published: m,
413
+ modifiedBy: v,
414
+ publishedBy: p,
415
+ connection: r,
416
+ categories: d,
417
+ hasHandover: h,
418
+ allowFeedback: l,
419
+ seoMetaDescription: $,
420
+ seoAllowIndex: z,
421
+ perspectives: S,
422
+ perspective: b,
423
+ translations: Object.keys(A || {}).reduce((N, F) => (N[F] = A[F].toString(), N), {})
424
+ },
425
+ related: me(s || []),
426
+ dialog: [],
427
+ contactMethods: (c || []).map(
428
+ (N) => de(N)
429
+ ),
430
+ tags: K(f)
431
+ };
432
+ return (a || []).forEach(
433
+ ({ CanAccess: N, Description: F, ConnectionId: P, Properties: w }) => {
434
+ if (!N)
435
+ return;
436
+ const M = {
437
+ id: o.toString(),
438
+ title: F,
439
+ connection: P,
440
+ connectionKey: w.ConnectionKey,
441
+ type: ie.default,
442
+ parent: {
443
+ id: o.toString(),
444
+ title: n,
445
+ tags: K(f)
446
+ }
447
+ };
448
+ if (w.Type === "Guide" || w.Type === "Link")
449
+ switch (w.Id && (M.id = w.Id.toString()), w.Uri && (M.href = w.Uri), w.Target && (M.target = w.Target), w.Type) {
450
+ case "Guide":
451
+ M.type = ie.guide;
452
+ break;
453
+ case "Link":
454
+ M.type = ie.link;
455
+ break;
456
+ }
457
+ T.dialog.push(M);
458
+ }
459
+ ), T;
460
+ }
461
+ case E.Contacts: {
462
+ const {
463
+ Children: o,
464
+ Matches: n,
465
+ Notices: i,
466
+ NoticeLists: s
467
+ } = e;
468
+ return {
469
+ contactMethods: (n || []).map(
470
+ (r) => de(r)
471
+ ),
472
+ categories: be(o || []),
473
+ topNotifications: L(i || [], "noticeRowTop"),
474
+ middleNotifications: L(i || [], "noticeRowMiddle"),
475
+ bottomNotifications: L(i || [], "footerNotice"),
476
+ notificationLists: le(s || [])
477
+ };
478
+ }
479
+ case E.ContactMethod: {
480
+ const { ContactMethod: o } = e;
481
+ return de(o || {});
482
+ }
483
+ case E.Tags:
484
+ case E.TagsOnGuides:
485
+ return K(e || []);
486
+ case E.Notifications: {
487
+ const { Notices: o, NoticeLists: n } = e;
488
+ return {
489
+ topNotifications: L(o || [], "noticeRowTop"),
490
+ middleNotifications: L(o || [], "noticeRowMiddle"),
491
+ bottomNotifications: L(o || [], "footerNotice"),
492
+ notificationLists: le(n || [])
493
+ };
494
+ }
495
+ default:
496
+ return {};
497
+ }
498
+ };
499
+ var Ke = /* @__PURE__ */ ((t) => (t.Guide = "guide", t.Guides = "guides", t.GuidesByCategory = "guides-by-category", t.RowNotifications = "row-notices", t.NotificationLists = "notification-lists", t.GuideCategories = "guide-categories", t.ContactMethodCategories = "contact-method-categories", t.ContactMethod = "contact-method", t.ContactMethods = "contact-methods", t.Tags = "tags", t.TagsOnGuides = "tagsonguides", t))(Ke || {}), E = /* @__PURE__ */ ((t) => (t.Match = "match", t.Categories = "categories", t.Guide = "guide", t.Contacts = "contacts", t.ContactMethod = "contact-method", t.MatchByCategory = "match-by-category", t.Tags = "tags", t.TagsOnGuides = "tagsonguides", t.Notifications = "notifications", t))(E || {});
500
+ const Se = (t) => {
501
+ switch (t) {
502
+ case "guides":
503
+ return "match";
504
+ case "guides-by-category":
505
+ return "match-by-category";
506
+ case "guide":
507
+ return "guide";
508
+ case "guide-categories":
509
+ return "categories";
510
+ case "contact-method-categories":
511
+ case "contact-methods":
512
+ return "contacts";
513
+ case "contact-method":
514
+ return "contact-method";
515
+ case "tags":
516
+ return "tags";
517
+ case "tagsonguides":
518
+ return "tagsonguides";
519
+ case "notification-lists":
520
+ case "row-notices":
521
+ return "notifications";
522
+ default:
523
+ throw "error";
524
+ }
525
+ }, Tt = async (t) => {
526
+ const { invoke: e } = t.get("$widget");
527
+ return await e("renderState") === ue.hidden;
528
+ };
529
+ class Q {
530
+ constructor(e, o) {
531
+ _(this, "queries", /* @__PURE__ */ new Map());
532
+ _(this, "lastTake", 0);
533
+ _(this, "events");
534
+ _(this, "getUnresolvedQueries", () => {
535
+ let e = 0;
536
+ return this.queries.forEach((o, n) => {
537
+ o.some((s) => !s.resolved) && (e = 1);
538
+ }), e;
539
+ });
540
+ this.container = e, this.matchingClient = o, this.events = e.get("$widget").events, this.events.subscribe(
541
+ "widget:settings-updated",
542
+ () => this.queries = /* @__PURE__ */ new Map()
543
+ ), this.events.subscribe(
544
+ "widget:render-state-changed",
545
+ (n, { next: i, previous: s }) => {
546
+ s === ue.hidden && i === ue.open && this.fetchAllUnresolvedQueries();
547
+ }
548
+ );
549
+ }
550
+ static getInstance(e, o = "dataClient") {
551
+ return ft(this)(() => e.getAsync(o).then(async (n) => {
552
+ let i = await e.getAsync("matchingClient");
553
+ i || (i = await ze(e), e.registerAsync("matchingClient", () => i));
554
+ let s = n;
555
+ return s || (s = new Q(e, i), e.registerAsync(o, () => s)), s;
556
+ }));
557
+ }
558
+ fetch(e, o, n) {
559
+ return new Promise((i, s) => {
560
+ o.take && (this.lastTake = +(o.take || 0)), pe(o);
561
+ const a = Se(e);
562
+ let r = this.queries.get(a) || [], c = r.find((l) => oe(l.params, o)) || null;
563
+ if (c && (n != null && n.noCache)) {
564
+ const l = r.findIndex(
565
+ (h) => oe(h.params, o)
566
+ );
567
+ r = [...r.slice(0, l), ...r.slice(l + 1)], c = null;
568
+ }
569
+ if (c) {
570
+ const l = r.indexOf(c);
571
+ if (c.resolved ? (this.events.dispatch("data-client:fetched", {
572
+ params: o,
573
+ type: a,
574
+ response: c.data,
575
+ unresolvedQueries: this.getUnresolvedQueries()
576
+ }), this.track(c.data, a, c.error), c.data && c.error ? s({ error: c.error }) : i(c.data)) : c.resolvers.push({ resolve: i, reject: s }), r.splice(l, 1), r.push(c), this.queries.set(a, r), !c.loading && !c.resolved)
577
+ return this.runQuery(a, o);
578
+ } else
579
+ return r.push({
580
+ params: o,
581
+ resolved: !1,
582
+ loading: !0,
583
+ data: {},
584
+ resolvers: [{ resolve: i, reject: s }]
585
+ }), this.queries.set(a, r), this.runQuery(a, o);
586
+ }).then((i) => ht(i));
587
+ }
588
+ // query the cached data
589
+ read(e, o) {
590
+ const { select: n } = o, i = Se(e);
591
+ return (this.queries.get(i) || []).reduce((r, c) => {
592
+ if (typeof n == "function") {
593
+ const l = n(c.data);
594
+ l && r.push(l);
595
+ } else
596
+ r.push(c.data);
597
+ return r;
598
+ }, []);
599
+ }
600
+ feedback(e, o, n) {
601
+ return this.matchingClient.giveFeedback(e, o, n);
602
+ }
603
+ setLoadingStatus(e, o, n) {
604
+ const i = this.queries.get(e) || [], s = i.find((a) => oe(a.params, o));
605
+ s && (s.loading = n), this.queries.set(e, i);
606
+ }
607
+ async runQuery(e, o) {
608
+ const {
609
+ searchPhrase: n = "",
610
+ categories: i = "0",
611
+ contactMethodCategoryId: s = "0",
612
+ contactMethodId: a = "0",
613
+ tagId: r = void 0,
614
+ take: c = 5,
615
+ connection: l = "",
616
+ guideId: h,
617
+ expandCategories: m = "descendants",
618
+ currentCategory: g,
619
+ sorting: v = "popularity-descending",
620
+ guideIds: p = []
621
+ } = o, d = n.toString().trim();
622
+ if (await Tt(this.container))
623
+ return Promise.resolve();
624
+ switch (e) {
625
+ case "match": {
626
+ const f = ($) => {
627
+ const [z, S] = $.split("-");
628
+ return {
629
+ type: (/* @__PURE__ */ new Map([
630
+ ["popularity", "popularity"],
631
+ ["alphabetic", "title"],
632
+ ["modified", "lastModified"],
633
+ ["published", "firstPublished"]
634
+ ])).get(z),
635
+ direction: S
636
+ };
637
+ };
638
+ return p.length ? this.matchingClient.customRequest("guides", "POST", {
639
+ configuration: { ids: p, take: +c }
640
+ }).then(
641
+ ($) => $ && this.handleResponse($, e, o)
642
+ ) : this.matchingClient.match(d, {
643
+ categories: i === "0" ? [] : Array.isArray(i) ? i : [+i],
644
+ take: +c,
645
+ tags: r,
646
+ sorting: f(v),
647
+ ids: p
648
+ }).then(
649
+ ($) => $ && this.handleResponse($, e, o)
650
+ );
651
+ }
652
+ case "match-by-category":
653
+ return this.matchingClient.match(d, {
654
+ groupByCategory: !0,
655
+ categories: i === "0" ? [] : Array.isArray(i) ? i : [+i],
656
+ take: +c,
657
+ tags: r
658
+ }).then(
659
+ (f) => f && this.handleResponse(f, e, o)
660
+ );
661
+ case "guide":
662
+ return this.matchingClient.getGuide(h, { connectionId: l }).then((f) => {
663
+ f && this.handleResponse(f, e, o);
664
+ }).catch((f) => {
665
+ const $ = {
666
+ message: "Something went wrong.",
667
+ status: f.status || 400
668
+ };
669
+ $.status === 404 && ($.message = "The guide could not be found."), this.handleResponse({}, e, o, $);
670
+ });
671
+ case "categories":
672
+ return this.matchingClient.getCategories({
673
+ phrase: d,
674
+ expand: m,
675
+ tags: r
676
+ }).then(
677
+ (f) => f && this.handleResponse(f, e, o)
678
+ );
679
+ case "contacts":
680
+ return h ? this.matchingClient.contactMethods(+h, { phrase: d }).then(
681
+ (f) => f && this.handleResponse(f, e, o)
682
+ ) : this.matchingClient.contacts(+s, { phrase: d }).then(
683
+ (f) => f && this.handleResponse(f, e, o)
684
+ );
685
+ case "contact-method":
686
+ return this.matchingClient.getContactMethod(+a, { guideId: h, currentCategory: g }).then(
687
+ (f) => f && this.handleResponse(f, e, o)
688
+ );
689
+ case "tags":
690
+ return this.matchingClient.customRequest("tags", "GET", {
691
+ configuration: {
692
+ take: 999999,
693
+ phrase: d,
694
+ categories: i === "0" ? [] : Array.isArray(i) ? i : [+i]
695
+ }
696
+ }).then(
697
+ (f) => f && this.handleResponse(f, e, o)
698
+ );
699
+ case "tagsonguides":
700
+ return this.matchingClient.customRequest("tagsonguides", "GET", {
701
+ configuration: {
702
+ take: 999999,
703
+ phrase: d,
704
+ categories: i === "0" ? [] : Array.isArray(i) ? i : [+i],
705
+ tags: r
706
+ }
707
+ }).then(
708
+ (f) => f && this.handleResponse(f, e, o)
709
+ );
710
+ case "notifications":
711
+ return this.matchingClient.customRequest("notices", "GET", {
712
+ configuration: {
713
+ phrase: d,
714
+ categories: i === "0" ? [] : Array.isArray(i) ? i : [+i]
715
+ }
716
+ }).then(
717
+ (f) => f && this.handleResponse(f, e, o)
718
+ );
719
+ }
720
+ }
721
+ handleResponse(e = {}, o, n, i) {
722
+ const s = this.queries.get(o) || [], a = s.find((r) => oe(r.params, n));
723
+ if (a) {
724
+ const r = i || Rt(o, e);
725
+ this.track(r, o, i), a.resolvers.forEach((l) => {
726
+ i ? l.reject({ error: r }) : l.resolve(r);
727
+ });
728
+ const c = s.indexOf(a);
729
+ c > -1 && s.splice(c, 1), s.push({
730
+ ...a,
731
+ error: i,
732
+ resolvers: [],
733
+ data: r,
734
+ resolved: !0
735
+ }), this.setLoadingStatus(o, n, !1), this.queries.set(o, s), i || this.events.dispatch("data-client:fetched", {
736
+ type: o,
737
+ params: n,
738
+ response: r,
739
+ unresolvedQueries: this.getUnresolvedQueries()
740
+ });
741
+ }
742
+ }
743
+ fetchAllUnresolvedQueries() {
744
+ for (const [e, o] of this.queries)
745
+ o.filter((n) => !n.resolved).forEach((n) => {
746
+ this.runQuery(e, n.params);
747
+ });
748
+ }
749
+ track(e = {}, o, n) {
750
+ const i = this.container.get("$widget");
751
+ i && !n ? i.events.dispatch("tracking:service-client-response", {
752
+ type: o,
753
+ data: e
754
+ }) : i && i.events.dispatch("tracking:service-client-error", {
755
+ type: o,
756
+ error: n
757
+ });
758
+ }
759
+ static create(e) {
760
+ return e.getAsync("matchingClient").then(async (o) => {
761
+ if (o)
762
+ return new Q(e, o);
763
+ const n = await ze(e);
764
+ return e.registerAsync("matchingClient", () => n), new Q(e, n);
765
+ });
766
+ }
767
+ getClient() {
768
+ return this.matchingClient;
769
+ }
770
+ }
771
+ const At = ({
772
+ title: t = "",
773
+ className: e,
774
+ id: o,
775
+ parent: n,
776
+ connection: i,
777
+ type: s,
778
+ target: a,
779
+ href: r,
780
+ children: c,
781
+ connectionKey: l
782
+ }) => {
783
+ const h = {}, { name: m, params: g } = xe();
784
+ switch (s) {
785
+ case "default":
786
+ case "guide":
787
+ const { id: v, title: p } = n;
788
+ let d = l || i;
789
+ v !== o && !l && (d = void 0), h.routeName = m, h.params = W({
790
+ ...g,
791
+ guide: o,
792
+ connection: d,
793
+ uriName: ye(o === v ? p : t)
794
+ });
795
+ break;
796
+ case "link":
797
+ h.href = r, h.target = a;
798
+ break;
799
+ }
800
+ return /* @__PURE__ */ u(
801
+ Oe,
802
+ {
803
+ className: G(e, "humany-dialog-link"),
804
+ ...h,
805
+ children: c || /* @__PURE__ */ R(st, { children: [
806
+ s === "link" && /* @__PURE__ */ u(ne, { faIcon: "link" }),
807
+ /* @__PURE__ */ u("span", { children: t })
808
+ ] })
809
+ }
810
+ );
811
+ };
812
+ re(
813
+ ({ className: t, dialog: e, ...o }, n) => e.length ? /* @__PURE__ */ u(
814
+ It,
815
+ {
816
+ className: G(t, "humany-dialog"),
817
+ items: e,
818
+ renderItem: (i) => /* @__PURE__ */ u("li", { "data-dialog": i.connection, children: /* @__PURE__ */ u(At, { ...i }) }, i.connection),
819
+ ...o,
820
+ ref: n
821
+ }
822
+ ) : null
823
+ );
824
+ const It = y($e)`
825
+ ${Le}
826
+ a {
827
+ min-width: 150px;
828
+ max-width: 400px;
829
+ display: block;
830
+ white-space: normal;
831
+ ${(t) => {
832
+ var e, o;
833
+ return ((e = t.theme.colors) == null ? void 0 : e.primary) && qe({
834
+ primaryColor: (o = t.theme.colors) == null ? void 0 : o.primary,
835
+ secondaryColor: "#FFFFFF",
836
+ theme: t.theme
837
+ });
838
+ }}
839
+ }
840
+
841
+ i {
842
+ margin: 0 ${(t) => {
843
+ var e;
844
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
845
+ }} 0 0;
846
+ }
847
+ `;
848
+ y(Z)`
849
+ ${J}
850
+ font-family: ${(t) => {
851
+ var e;
852
+ return (e = t.theme.fonts) == null ? void 0 : e.type;
853
+ }};
854
+ padding: ${(t) => {
855
+ var e;
856
+ return (e = t.theme.sizes) == null ? void 0 : e.medium;
857
+ }};
858
+ > ul > li {
859
+ overflow: visible;
860
+ font-weight: 300;
861
+ font-size: ${(t) => {
862
+ var e;
863
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
864
+ }};
865
+ }
866
+ `;
867
+ y.div`
868
+ background: #fff;
869
+ border: #ccc 1px solid;
870
+ box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
871
+ font-family: ${(t) => {
872
+ var e;
873
+ return (e = t.theme.fonts) == null ? void 0 : e.type;
874
+ }};
875
+ font-size: ${(t) => {
876
+ var e;
877
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
878
+ }};
879
+ `;
880
+ y.div`
881
+ padding: ${(t) => {
882
+ var e;
883
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
884
+ }};
885
+ padding-bottom: 0;
886
+ font-size: ${(t) => {
887
+ var e;
888
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
889
+ }};
890
+ font-weight: normal;
891
+ white-space: nowrap;
892
+ display: flex;
893
+ align-items: center;
894
+
895
+ h1,
896
+ h2,
897
+ h3,
898
+ h4,
899
+ h5,
900
+ h6 {
901
+ margin: 0;
902
+ font-weight: normal;
903
+ padding-bottom: 0;
904
+ }
905
+
906
+ svg,
907
+ i {
908
+ margin-right: ${(t) => {
909
+ var e;
910
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
911
+ }};
912
+ }
913
+ `;
914
+ y($e)`
915
+ list-style: none;
916
+ padding: 0;
917
+ margin: 0;
918
+ padding: ${(t) => {
919
+ var e;
920
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
921
+ }} 0;
922
+
923
+ li {
924
+ background: #fff;
925
+
926
+ a {
927
+ display: block;
928
+ font-size: ${(t) => {
929
+ var e;
930
+ return (e = t.theme.fonts) == null ? void 0 : e.small;
931
+ }};
932
+ padding: ${(t) => {
933
+ var e, o;
934
+ return `${(e = t.theme.sizes) == null ? void 0 : e.small} ${(o = t.theme.sizes) == null ? void 0 : o.normal}`;
935
+ }};
936
+ cursor: pointer;
937
+ color: #555;
938
+ text-decoration: none;
939
+
940
+ &:hover {
941
+ background: #f9f9f9;
942
+ color: ${(t) => {
943
+ var e;
944
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
945
+ }};
946
+ }
947
+ }
948
+ }
949
+ `;
950
+ y(Z)`
951
+ ${J}
952
+ font-family: ${(t) => {
953
+ var e;
954
+ return (e = t.theme.fonts) == null ? void 0 : e.type;
955
+ }};
956
+ > div {
957
+ ${(t) => {
958
+ var e;
959
+ return X(t)(
960
+ "> h1",
961
+ x`
962
+ font-size: ${(e = t.theme.fonts) == null ? void 0 : e.normal};
963
+ line-height: 1.2em;
964
+ `
965
+ );
966
+ }}
967
+ }
968
+ > ul > li {
969
+ overflow: visible;
970
+ font-weight: 300;
971
+ font-size: ${(t) => {
972
+ var e;
973
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
974
+ }};
975
+
976
+ a {
977
+ display: inline-block;
978
+
979
+ @media (hover: hover) {
980
+ &:hover {
981
+ text-decoration: underline;
982
+ }
983
+ }
984
+ }
985
+ }
986
+ `;
987
+ const Et = (t) => x`
988
+ ${t["data-loading"] && "position: relative;"};
989
+ ${t["data-loading"] && "min-height: 150px;"}
990
+ > * {
991
+ transition: 200ms ease-out opacity;
992
+ opacity: ${t["data-loading"] ? "0.5" : "1"};
993
+ }
994
+ .humany-loader {
995
+ opacity: ${t["data-loading"] ? "1" : "0"};
996
+ }
997
+ `;
998
+ y(ne)`
999
+ && {
1000
+ font-size: ${(t) => {
1001
+ var e;
1002
+ return (e = t.theme.fonts) == null ? void 0 : e.small;
1003
+ }};
1004
+ }
1005
+ width: 1.2em;
1006
+ `;
1007
+ y(je)`
1008
+ font-size: ${(t) => {
1009
+ var e;
1010
+ return (e = t.theme.fonts) == null ? void 0 : e.medium;
1011
+ }};
1012
+ font-weight: normal;
1013
+ line-height: 1.2em;
1014
+ color: ${(t) => {
1015
+ var e;
1016
+ return (e = t.theme.colors) == null ? void 0 : e.text;
1017
+ }};
1018
+ `;
1019
+ const Ot = y(we)`
1020
+ display: flex;
1021
+ align-items: center;
1022
+
1023
+ ${(t) => {
1024
+ var e;
1025
+ return t["data-has-label"] === "true" && t["data-has-symbol"] === "true" && `
1026
+ svg, i {
1027
+ margin: 0 ${(e = t.theme.sizes) == null ? void 0 : e.small} 0 0;
1028
+ }
1029
+ `;
1030
+ }}
1031
+
1032
+ &:focus-visible {
1033
+ ${(t) => t["data-has-label"] === "true" && ke}
1034
+
1035
+ svg, i {
1036
+ ${(t) => t["data-has-label"] === "false" && t["data-has-symbol"] === "true" && x`
1037
+ ${ke(t)}
1038
+ box-sizing: content-box;
1039
+ `}
1040
+ }
1041
+ }
1042
+
1043
+ span {
1044
+ flex: 1;
1045
+ font-weight: 300;
1046
+ }
1047
+ `, Lt = ({
1048
+ addFavoriteTooltip: t,
1049
+ removeFavoriteCancelLabel: e,
1050
+ removeFavoriteConfirmLabel: o,
1051
+ removeFavoriteHeader: n,
1052
+ removeFavoriteLabel: i,
1053
+ removeFavoriteTooltip: s,
1054
+ id: a,
1055
+ isFavorite: r,
1056
+ guideTitle: c,
1057
+ buttonLabel: l = "",
1058
+ actions: { addFavorite: h, removeFavorite: m }
1059
+ }) => {
1060
+ const g = Y(() => {
1061
+ m(a);
1062
+ }, [a, m]), v = Y(() => {
1063
+ h(a);
1064
+ }, [a, h]), p = `${r ? s : t}${c ? `: "${c}"` : ""}`;
1065
+ return r ? /* @__PURE__ */ u(
1066
+ ut,
1067
+ {
1068
+ trigger: /* @__PURE__ */ R(
1069
+ Re,
1070
+ {
1071
+ className: "humany-favorite-button",
1072
+ title: p,
1073
+ "aria-label": p,
1074
+ "data-favorite": "true",
1075
+ "data-has-label": l ? "true" : "false",
1076
+ "data-has-symbol": "true",
1077
+ children: [
1078
+ /* @__PURE__ */ u(
1079
+ j,
1080
+ {
1081
+ size: 16,
1082
+ symbol: { type: "Svg", content: "star-empty" }
1083
+ }
1084
+ ),
1085
+ l && /* @__PURE__ */ u(se, { children: l })
1086
+ ]
1087
+ }
1088
+ ),
1089
+ onConfirm: g,
1090
+ cancelLabel: e,
1091
+ confirmLabel: o,
1092
+ header: n,
1093
+ text: i
1094
+ }
1095
+ ) : /* @__PURE__ */ R(
1096
+ Re,
1097
+ {
1098
+ className: "humany-favorite-button",
1099
+ title: p,
1100
+ "aria-label": p,
1101
+ onClick: v,
1102
+ "data-favorite": "false",
1103
+ "data-has-label": l ? "true" : "false",
1104
+ "data-has-symbol": "true",
1105
+ children: [
1106
+ /* @__PURE__ */ u(j, { size: 16, symbol: { type: "Svg", content: "star-empty" } }),
1107
+ l && /* @__PURE__ */ u(se, { children: l })
1108
+ ]
1109
+ }
1110
+ );
1111
+ }, Re = y(Ot)`
1112
+ grid-area: favorite;
1113
+
1114
+ &:focus-visible {
1115
+ svg {
1116
+ ${(t) => {
1117
+ var e, o;
1118
+ return t["data-favorite"] === "true" ? `
1119
+ fill: transparent;
1120
+
1121
+ path {
1122
+ fill: transparent;
1123
+ }
1124
+ ` : `
1125
+ fill: ${(e = t.theme.colors) == null ? void 0 : e.text};
1126
+
1127
+ path {
1128
+ fill: ${(o = t.theme.colors) == null ? void 0 : o.text};
1129
+ }
1130
+ `;
1131
+ }}
1132
+ }
1133
+ }
1134
+
1135
+ ${(t) => {
1136
+ var e, o, n, i, s, a, r;
1137
+ return ((e = t.theme.colors) == null ? void 0 : e.text) && x`
1138
+ svg {
1139
+ stroke: ${(o = t.theme.colors) == null ? void 0 : o.text};
1140
+
1141
+ path {
1142
+ stroke: ${(n = t.theme.colors) == null ? void 0 : n.text};
1143
+ }
1144
+
1145
+ ${t["data-favorite"] === "true" && `
1146
+ fill: ${(i = t.theme.colors) == null ? void 0 : i.text};
1147
+
1148
+ path {
1149
+ fill: ${(s = t.theme.colors) == null ? void 0 : s.text};
1150
+ }
1151
+ `};
1152
+ }
1153
+
1154
+ &:hover {
1155
+ svg {
1156
+ ${t["data-favorite"] === "true" ? `
1157
+ fill: transparent;
1158
+
1159
+ path {
1160
+ fill: transparent;
1161
+ }
1162
+ ` : `
1163
+ fill: ${(a = t.theme.colors) == null ? void 0 : a.text};
1164
+
1165
+ path {
1166
+ fill: ${(r = t.theme.colors) == null ? void 0 : r.text};
1167
+ }
1168
+ `};
1169
+ }
1170
+ }
1171
+ `;
1172
+ }}
1173
+ `;
1174
+ re(
1175
+ ({
1176
+ onFeedback: t = () => {
1177
+ },
1178
+ direction: e = "horizontal",
1179
+ className: o,
1180
+ header: n,
1181
+ positive: i,
1182
+ negative: s,
1183
+ selected: a,
1184
+ ...r
1185
+ }, c) => /* @__PURE__ */ R(
1186
+ jt,
1187
+ {
1188
+ className: G(o, "humany-feedback"),
1189
+ "data-direction": e,
1190
+ ...Fe(r),
1191
+ ref: c,
1192
+ children: [
1193
+ !!n && /* @__PURE__ */ u(qt, { children: n }),
1194
+ /* @__PURE__ */ R(
1195
+ Te,
1196
+ {
1197
+ className: "humany-feedback-button",
1198
+ disabled: !!a,
1199
+ "data-selected": a === "positive",
1200
+ "data-direction": e,
1201
+ onClick: () => t("positive"),
1202
+ children: [
1203
+ /* @__PURE__ */ u(ne, { faIcon: "smile-o" }),
1204
+ /* @__PURE__ */ u("span", { children: i })
1205
+ ]
1206
+ }
1207
+ ),
1208
+ /* @__PURE__ */ R(
1209
+ Te,
1210
+ {
1211
+ className: "humany-feedback-button",
1212
+ disabled: !!a,
1213
+ "data-selected": a === "negative",
1214
+ "data-direction": e,
1215
+ onClick: () => t("negative"),
1216
+ children: [
1217
+ /* @__PURE__ */ u(ne, { faIcon: "frown-o" }),
1218
+ /* @__PURE__ */ u("span", { children: s })
1219
+ ]
1220
+ }
1221
+ )
1222
+ ]
1223
+ }
1224
+ )
1225
+ );
1226
+ const qt = y(se)`
1227
+ font-weight: normal;
1228
+ margin: 0 0 ${(t) => {
1229
+ var e;
1230
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
1231
+ }};
1232
+ font-size: ${(t) => {
1233
+ var e;
1234
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
1235
+ }};
1236
+ display: block;
1237
+ `, Te = y(we)`
1238
+ display: inline-block;
1239
+ font-size: ${(t) => {
1240
+ var e;
1241
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
1242
+ }};
1243
+ font-weight: 300;
1244
+ && {
1245
+ margin-right: ${(t) => {
1246
+ var e;
1247
+ return (e = t.theme.sizes) == null ? void 0 : e.large;
1248
+ }};
1249
+ }
1250
+
1251
+ ${(t) => {
1252
+ var e, o;
1253
+ return t["data-direction"] === "horizontal" && x`
1254
+ width: 225px;
1255
+ max-width: calc(50% - ${(e = t.theme.sizes) == null ? void 0 : e.large} - ${(o = t.theme.sizes) == null ? void 0 : o.small});
1256
+ `;
1257
+ }}
1258
+
1259
+ ${(t) => t["data-direction"] === "vertical" && x`
1260
+ min-width: 190px;
1261
+ `}
1262
+
1263
+ ${(t) => {
1264
+ var e, o;
1265
+ return ((e = t.theme.colors) == null ? void 0 : e.primary) && qe({
1266
+ active: t["data-selected"],
1267
+ primaryColor: (o = t.theme.colors) == null ? void 0 : o.primary,
1268
+ secondaryColor: "#FFFFFF",
1269
+ theme: t.theme
1270
+ });
1271
+ }}
1272
+
1273
+ i {
1274
+ margin: 0 ${(t) => {
1275
+ var e;
1276
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
1277
+ }} 0 0;
1278
+ }
1279
+ `, jt = y.div`
1280
+ ${(t) => {
1281
+ var e;
1282
+ return t["data-direction"] === "vertical" && x`
1283
+ > button {
1284
+ width: 100%;
1285
+ &:not(:last-child) {
1286
+ margin-bottom: ${(e = t.theme.sizes) == null ? void 0 : e.normal};
1287
+ }
1288
+ }
1289
+ `;
1290
+ }}
1291
+ `, Ft = () => {
1292
+ const t = ve(), [e, o] = D([]), n = t.get("favorites");
1293
+ q(() => {
1294
+ if (n) {
1295
+ o(n.get());
1296
+ const { events: c } = t.get("$widget");
1297
+ return c.subscribe(
1298
+ "widget:favorites-updated",
1299
+ (h, { updated: m }) => {
1300
+ o([...m]);
1301
+ }
1302
+ );
1303
+ }
1304
+ }, []);
1305
+ const i = (c) => n ? n.add(c) : Promise.resolve([]), s = (c) => n ? n.remove(c) : Promise.resolve([]), a = () => n ? n.clear() : Promise.resolve([]), r = Y(
1306
+ (c) => e.indexOf(c) > -1 ? s(c) : i(c),
1307
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1308
+ [e]
1309
+ );
1310
+ return [
1311
+ e,
1312
+ vt(
1313
+ () => ({
1314
+ addFavorite: i,
1315
+ removeFavorite: s,
1316
+ clearFavorites: a,
1317
+ toggleFavorite: r
1318
+ }),
1319
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1320
+ [e]
1321
+ )
1322
+ ];
1323
+ }, Bt = ({
1324
+ format: t = Ue.YYYY_MM_DD_HH_MM,
1325
+ className: e = "",
1326
+ byLabel: o = "",
1327
+ modifiedLabel: n = "",
1328
+ publishedLabel: i = "",
1329
+ modifiedBy: s = "",
1330
+ publishedBy: a = "",
1331
+ showModified: r = !1,
1332
+ showPublished: c = !1,
1333
+ modified: l,
1334
+ published: h
1335
+ }) => {
1336
+ const m = c && h ? /* @__PURE__ */ u(Ae, { format: t, timestamp: h }) : null, g = r && l ? /* @__PURE__ */ u(Ae, { format: t, timestamp: l }) : null;
1337
+ return !m && !g ? null : /* @__PURE__ */ R(fe, { className: G(e, "humany-metadata"), children: [
1338
+ m && /* @__PURE__ */ R(fe, { className: "humany-published", children: [
1339
+ i,
1340
+ m,
1341
+ o && a && ` ${o.replace("{{editor}}", a)}`
1342
+ ] }),
1343
+ g && /* @__PURE__ */ R(fe, { className: "humany-modified", children: [
1344
+ m && ", ",
1345
+ n,
1346
+ g,
1347
+ o && s && ` ${o.replace("{{editor}}", s)}`
1348
+ ] })
1349
+ ] });
1350
+ }, Ae = y(_e)`
1351
+ &:not(:first-child) {
1352
+ margin-left: 4px;
1353
+ }
1354
+ &:not(:last-child) {
1355
+ margin-right: 4px;
1356
+ }
1357
+ `, fe = y(je)`
1358
+ font-style: italic;
1359
+ `, Dt = ({ tags: t }) => t.filter((e) => e.symbol).length ? /* @__PURE__ */ u(
1360
+ Ht,
1361
+ {
1362
+ className: "humany-guide-list-tags",
1363
+ items: t,
1364
+ renderItem: ({ id: e, symbol: o, title: n }) => o && /* @__PURE__ */ u("li", { "data-tag": e, children: /* @__PURE__ */ u(Yt, { size: 18, symbol: o, title: n }) }, e)
1365
+ }
1366
+ ) : null;
1367
+ re(({ title: t, id: e, route: o, symbolSize: n, collapseUri: i, children: s }, a) => {
1368
+ const { params: r } = xe();
1369
+ return /* @__PURE__ */ R(Gt, { ref: a, "data-guide": e, children: [
1370
+ /* @__PURE__ */ u(
1371
+ ge,
1372
+ {
1373
+ title: t,
1374
+ "aria-label": t,
1375
+ routeName: o,
1376
+ params: W({
1377
+ ...r,
1378
+ uriName: i || void 0,
1379
+ id: void 0,
1380
+ guide: void 0,
1381
+ accordion: void 0
1382
+ }),
1383
+ text: t,
1384
+ children: /* @__PURE__ */ u(
1385
+ j,
1386
+ {
1387
+ size: n,
1388
+ symbol: { type: "Svg", content: "caret-up" }
1389
+ }
1390
+ )
1391
+ }
1392
+ ),
1393
+ s
1394
+ ] });
1395
+ });
1396
+ const Gt = y.li`
1397
+ > a {
1398
+ grid-column: 1/-1;
1399
+ font-weight: bold;
1400
+ margin: 0 0 ${(t) => {
1401
+ var e;
1402
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
1403
+ }} 0;
1404
+ }
1405
+
1406
+ > div {
1407
+ grid-column: 1/-1;
1408
+ }
1409
+ `;
1410
+ re(
1411
+ ({
1412
+ expandable: t = !1,
1413
+ routing: e = {},
1414
+ paramMappers: o = {},
1415
+ symbolSize: n = 11,
1416
+ pageRole: i = "link",
1417
+ pageCaret: s = "down",
1418
+ showTags: a = !1,
1419
+ showFavoriteToggle: r = !1,
1420
+ localPaging: c = !1,
1421
+ onItemClick: l = () => {
1422
+ },
1423
+ dispatch: h = () => {
1424
+ },
1425
+ metadata: m = {},
1426
+ pageLabel: g,
1427
+ className: v,
1428
+ children: p,
1429
+ items: d,
1430
+ renderItem: f,
1431
+ addFavoriteTooltip: $,
1432
+ removeFavoriteCancelLabel: z,
1433
+ removeFavoriteConfirmLabel: S,
1434
+ removeFavoriteHeader: C,
1435
+ removeFavoriteLabel: A,
1436
+ removeFavoriteTooltip: b,
1437
+ searchResultsEmptyLabel: T,
1438
+ ...N
1439
+ }, F) => {
1440
+ const P = Mt(), w = He(), M = gt(d), { guide: Qe = "guide", page: Ve = "index" } = e, {
1441
+ guide: We = ({ id: k }) => W({ guide: k }),
1442
+ page: Ce = () => W()
1443
+ } = o, [Ze, Je] = Ft();
1444
+ $t(F, () => w.current);
1445
+ const ae = (k) => {
1446
+ const { id: O, title: I, tags: H, published: ee, modified: U, publishedBy: te, modifiedBy: ce } = k;
1447
+ return /* @__PURE__ */ R(
1448
+ "li",
1449
+ {
1450
+ "data-guide": O,
1451
+ "has-metadata": (!!(m != null && m.showPublished) && !!ee || !!(m != null && m.showModified) && !!U).toString(),
1452
+ children: [
1453
+ /* @__PURE__ */ u(
1454
+ ge,
1455
+ {
1456
+ className: "humany-guide-link",
1457
+ title: I,
1458
+ "aria-label": I,
1459
+ routeName: Qe,
1460
+ onClick: (ot) => l(ot, k),
1461
+ params: We(k),
1462
+ text: I,
1463
+ children: /* @__PURE__ */ u(
1464
+ j,
1465
+ {
1466
+ size: n,
1467
+ symbol: {
1468
+ type: "Svg",
1469
+ content: t ? "caret-down" : "caret-right"
1470
+ }
1471
+ }
1472
+ )
1473
+ }
1474
+ ),
1475
+ r && /* @__PURE__ */ u(
1476
+ Lt,
1477
+ {
1478
+ guideTitle: I,
1479
+ addFavoriteTooltip: $,
1480
+ removeFavoriteCancelLabel: z,
1481
+ removeFavoriteConfirmLabel: S,
1482
+ removeFavoriteHeader: C,
1483
+ removeFavoriteLabel: A,
1484
+ removeFavoriteTooltip: b,
1485
+ isFavorite: Ze.indexOf(O) > -1,
1486
+ actions: Je,
1487
+ id: O
1488
+ }
1489
+ ),
1490
+ a && /* @__PURE__ */ u(Dt, { tags: H }),
1491
+ /* @__PURE__ */ u(
1492
+ Ut,
1493
+ {
1494
+ ...m,
1495
+ indent: t ? void 0 : n,
1496
+ modified: U,
1497
+ published: ee,
1498
+ publishedBy: te,
1499
+ modifiedBy: ce
1500
+ }
1501
+ )
1502
+ ]
1503
+ },
1504
+ O
1505
+ );
1506
+ }, Xe = Y(
1507
+ (k, O, I) => f ? f(k, O, I, ae) : ae(k),
1508
+ [f, ae]
1509
+ ), et = Y(
1510
+ (k) => {
1511
+ c && (k.preventDefault(), h("page", Ce()));
1512
+ },
1513
+ [h, c]
1514
+ );
1515
+ q(() => {
1516
+ if (M && M.length < d.length && w.current) {
1517
+ const k = w.current.querySelectorAll(
1518
+ ".humany-guide-list > ul > li"
1519
+ ), O = k[M.length];
1520
+ if (k.length === d.length && M.length) {
1521
+ const I = k[M.length];
1522
+ if (I) {
1523
+ const H = I.querySelector(
1524
+ ".humany-guide-link"
1525
+ );
1526
+ H && H.focus();
1527
+ }
1528
+ } else
1529
+ O && new MutationObserver((H, ee) => {
1530
+ H.forEach((U) => {
1531
+ if (U.addedNodes) {
1532
+ const te = Array.from(
1533
+ U.addedNodes
1534
+ ).find((ce) => ce.tagName === "A");
1535
+ te && xt(w.current, document.activeElement) && (P && te.focus(), ee.disconnect());
1536
+ }
1537
+ });
1538
+ }).observe(O, {
1539
+ attributes: !1,
1540
+ characterData: !1,
1541
+ childList: !0,
1542
+ subtree: !0,
1543
+ attributeOldValue: !1,
1544
+ characterDataOldValue: !1
1545
+ });
1546
+ }
1547
+ });
1548
+ const tt = !!Object.keys(m).filter(
1549
+ (k) => typeof m[k] < "u"
1550
+ ).length;
1551
+ return /* @__PURE__ */ R(
1552
+ Pt,
1553
+ {
1554
+ className: G(v, "humany-guide-list"),
1555
+ "data-item-count": d.length,
1556
+ items: d,
1557
+ renderItem: Xe,
1558
+ isTabbing: P,
1559
+ expandable: t ? "true" : "false",
1560
+ "grid-items": a || r || tt ? "true" : "false",
1561
+ ...Fe(N),
1562
+ ref: w,
1563
+ children: [
1564
+ g ? /* @__PURE__ */ u(
1565
+ ge,
1566
+ {
1567
+ text: g,
1568
+ title: g,
1569
+ "aria-label": g,
1570
+ routeName: Ve,
1571
+ role: i,
1572
+ params: Ce(),
1573
+ onClick: et,
1574
+ children: /* @__PURE__ */ u(
1575
+ j,
1576
+ {
1577
+ size: n,
1578
+ symbol: { type: "Svg", content: `caret-${s}` }
1579
+ }
1580
+ )
1581
+ }
1582
+ ) : null,
1583
+ p,
1584
+ !N["data-loading"] && d.length === 0 && /* @__PURE__ */ u("p", { children: T })
1585
+ ]
1586
+ }
1587
+ );
1588
+ }
1589
+ );
1590
+ const Pt = y(Z)`
1591
+ ${J}
1592
+ padding: ${(t) => {
1593
+ var e;
1594
+ return (e = t.theme.sizes) == null ? void 0 : e.large;
1595
+ }};
1596
+ overflow: auto;
1597
+ justify-content: flex-start;
1598
+ white-space: nowrap;
1599
+ font-weight: 300;
1600
+ text-decoration: none;
1601
+
1602
+ > div {
1603
+ ${(t) => X(t)(
1604
+ "> h1",
1605
+ x`
1606
+ white-space: pre-wrap;
1607
+ `
1608
+ )}
1609
+ }
1610
+
1611
+ > ul > li {
1612
+ ${(t) => {
1613
+ var e, o;
1614
+ return t["grid-items"] === "true" && x`
1615
+ display: grid;
1616
+ grid-template-columns: auto 1fr 1fr;
1617
+ gap: 0px 0px;
1618
+ grid-template-areas: '. favorite tags';
1619
+ align-items: center;
1620
+
1621
+ > button {
1622
+ margin: 0 0 0 ${(e = t.theme.sizes) == null ? void 0 : e.small};
1623
+
1624
+ &[data-favorite='false'] {
1625
+ ${t.isTabbing ? "opacity: 0;" : "display: none;"};
1626
+ &:focus {
1627
+ opacity: 1;
1628
+ }
1629
+ }
1630
+ }
1631
+
1632
+ > span {
1633
+ font-size: ${(o = t.theme.fonts) == null ? void 0 : o.small};
1634
+ }
1635
+
1636
+ &:hover {
1637
+ button[data-favorite='false'] {
1638
+ display: flex;
1639
+ justify-self: flex-start;
1640
+ }
1641
+ }
1642
+
1643
+ &[has-metadata='true'] {
1644
+ grid-template-rows: 1fr 1fr;
1645
+ grid-template-areas:
1646
+ '. favorite tags'
1647
+ 'metadata metadata metadata';
1648
+ }
1649
+ `;
1650
+ }}
1651
+ > a {
1652
+ color: ${(t) => {
1653
+ var e;
1654
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
1655
+ }};
1656
+ overflow: hidden;
1657
+ text-overflow: ellipsis;
1658
+ max-width: 100%;
1659
+ display: inline-block;
1660
+
1661
+ svg {
1662
+ margin: 0 calc(${(t) => {
1663
+ var e;
1664
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
1665
+ }}*2) 0 0;
1666
+ line {
1667
+ stroke: ${(t) => {
1668
+ var e;
1669
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
1670
+ }};
1671
+ }
1672
+ }
1673
+
1674
+ ${(t) => {
1675
+ var e;
1676
+ return t.expandable === "true" && x`
1677
+ display: flex;
1678
+ flex-direction: row-reverse;
1679
+ justify-content: flex-end;
1680
+ align-items: center;
1681
+
1682
+ span {
1683
+ overflow: hidden;
1684
+ text-overflow: ellipsis;
1685
+ }
1686
+
1687
+ svg {
1688
+ margin: 0 0 0 ${(e = t.theme.sizes) == null ? void 0 : e.small};
1689
+ }
1690
+ `;
1691
+ }}
1692
+
1693
+ &:focus-visible {
1694
+ ${V}
1695
+ text-decoration: underline;
1696
+ }
1697
+
1698
+ @media (hover: hover) {
1699
+ &:hover {
1700
+ text-decoration: underline;
1701
+ }
1702
+ }
1703
+ }
1704
+ }
1705
+
1706
+ > a {
1707
+ color: ${(t) => {
1708
+ var e;
1709
+ return (e = t.theme.colors) == null ? void 0 : e.text;
1710
+ }};
1711
+ margin: ${(t) => {
1712
+ var e;
1713
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
1714
+ }} 0 0;
1715
+ align-self: flex-start;
1716
+ align-items: center;
1717
+ display: flex;
1718
+
1719
+ span {
1720
+ text-decoration: underline;
1721
+ }
1722
+
1723
+ svg {
1724
+ margin: 0 calc(${(t) => {
1725
+ var e;
1726
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
1727
+ }}*2) 0 0;
1728
+ line {
1729
+ stroke: ${(t) => {
1730
+ var e;
1731
+ return (e = t.theme.colors) == null ? void 0 : e.text;
1732
+ }};
1733
+ }
1734
+ }
1735
+
1736
+ &:focus-visible {
1737
+ ${V}
1738
+ text-decoration: underline;
1739
+ }
1740
+ }
1741
+ `, Ht = y($e)`
1742
+ ${Le}
1743
+ display: flex;
1744
+ margin: 0 0 0 auto;
1745
+ grid-area: tags;
1746
+
1747
+ li,
1748
+ li:last-child {
1749
+ margin: 0 0 0 ${(t) => {
1750
+ var e;
1751
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
1752
+ }};
1753
+ display: flex;
1754
+ align-items: center;
1755
+ justify-content: space-between;
1756
+ }
1757
+ `, Yt = y(j)`
1758
+ display: block;
1759
+ color: ${(t) => {
1760
+ var e;
1761
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
1762
+ }};
1763
+ ${(t) => {
1764
+ if (t.symbol.type === "Uri")
1765
+ return `
1766
+ width: ${t.size}px;
1767
+ height: ${t.size}px;
1768
+ `;
1769
+ if (t.symbol.type === "FontAwesome")
1770
+ return `
1771
+ font-size: ${t.size}px;
1772
+ `;
1773
+ }}
1774
+ `, Ut = y(Bt)`
1775
+ grid-area: metadata;
1776
+ text-overflow: ellipsis;
1777
+ overflow: hidden;
1778
+ font-size: ${(t) => {
1779
+ var e;
1780
+ return (e = t.theme.fonts) == null ? void 0 : e.small;
1781
+ }};
1782
+ ${(t) => {
1783
+ var e;
1784
+ return typeof t.indent == "number" && `text-indent: calc(${(e = t.theme.sizes) == null ? void 0 : e.small} * 2 + ${t.indent}px);`;
1785
+ }}
1786
+ `, _t = Be`
1787
+ 100% {
1788
+ transform: rotate(360deg);
1789
+ }
1790
+ `, Kt = Be`
1791
+ 0% {
1792
+ stroke-dasharray: 1, 200;
1793
+ stroke-dashoffset: 0;
1794
+ }
1795
+ 50% {
1796
+ stroke-dasharray: 89, 200;
1797
+ stroke-dashoffset: -35px;
1798
+ }
1799
+ 100% {
1800
+ stroke-dasharray: 89, 200;
1801
+ stroke-dashoffset: -124px;
1802
+ }
1803
+ `;
1804
+ y.svg`
1805
+ animation: ${_t} 2s linear infinite;
1806
+ height: 100%;
1807
+ transform-origin: center center;
1808
+ width: 100%;
1809
+ position: absolute;
1810
+ top: 0;
1811
+ bottom: 0;
1812
+ left: 0;
1813
+ right: 0;
1814
+ margin: auto;
1815
+ transition: 200ms ease-out opacity;
1816
+ `;
1817
+ y.div`
1818
+ position: absolute;
1819
+ top: 0;
1820
+ bottom: 0;
1821
+ left: 0;
1822
+ right: 0;
1823
+ height: 100%;
1824
+ width: 100%;
1825
+ pointer-events: ${(t) => t["data-loading"] ? "all" : "none"};
1826
+ display: flex;
1827
+ flex-direction: column;
1828
+ justify-content: center;
1829
+ transition: 200ms ease-out opacity;
1830
+ box-sizing: border-box;
1831
+ overflow: hidden;
1832
+
1833
+ .humany-spinner-svg {
1834
+ opacity: ${(t) => t["data-loading"] ? "1" : "0"};
1835
+ }
1836
+ `;
1837
+ y.div`
1838
+ position: relative;
1839
+ margin: 0 auto;
1840
+ width: 100px;
1841
+ &:before {
1842
+ content: '';
1843
+ display: block;
1844
+ padding-top: 100%;
1845
+ }
1846
+ `;
1847
+ y.circle`
1848
+ stroke-dasharray: 1, 200;
1849
+ stroke-dashoffset: 0;
1850
+ animation: ${Kt} 1.5s ease-in-out infinite;
1851
+ stroke-linecap: round;
1852
+ stroke: ${(t) => {
1853
+ var e;
1854
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
1855
+ }};
1856
+ stroke-width: 2px;
1857
+ `;
1858
+ y(we)`
1859
+ display: flex;
1860
+ justify-content: space-between;
1861
+ align-items: center;
1862
+ width: 100%;
1863
+ text-align: left;
1864
+ svg,
1865
+ i {
1866
+ color: ${(t) => {
1867
+ var e;
1868
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
1869
+ }};
1870
+ }
1871
+ span {
1872
+ color: ${(t) => {
1873
+ var e;
1874
+ return (e = t.theme.colors) == null ? void 0 : e.text;
1875
+ }};
1876
+ font-size: ${(t) => {
1877
+ var e;
1878
+ return (e = t.theme.fonts) == null ? void 0 : e.normal;
1879
+ }};
1880
+ overflow: hidden;
1881
+ text-overflow: ellipsis;
1882
+ flex: 1;
1883
+ white-space: nowrap;
1884
+ }
1885
+ &:focus-visible {
1886
+ ${V}
1887
+ span {
1888
+ color: ${(t) => {
1889
+ var e;
1890
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
1891
+ }};
1892
+ text-decoration: underline;
1893
+ }
1894
+ }
1895
+ `;
1896
+ y(Z)`
1897
+ ${Et}
1898
+ ${J}
1899
+ overflow: hidden;
1900
+ justify-content: flex-start;
1901
+ padding: ${(t) => {
1902
+ var e;
1903
+ return (e = t.theme.sizes) == null ? void 0 : e.large;
1904
+ }};
1905
+ ${(t) => !t["data-show-header"] && x`
1906
+ > div {
1907
+ ${X(t)(
1908
+ "h1",
1909
+ x`
1910
+ display: none;
1911
+ `
1912
+ )}
1913
+ }
1914
+ `}
1915
+
1916
+ @media (hover: hover) {
1917
+ button:hover {
1918
+ text-decoration: underline;
1919
+ }
1920
+ }
1921
+ `;
1922
+ y(De)`
1923
+ ${Ge}
1924
+ font-weight: 300;
1925
+
1926
+ p {
1927
+ white-space: normal;
1928
+ }
1929
+ `;
1930
+ y.li`
1931
+ .humany-paragraph {
1932
+ display: none;
1933
+ &:not(:only-child) {
1934
+ ${(t) => {
1935
+ var e, o, n;
1936
+ return ((e = t.theme.sizes) == null ? void 0 : e.cardinal) && ((o = t.theme.sizes) == null ? void 0 : o.normal) && x`
1937
+ margin: ${(n = t.theme.sizes) == null ? void 0 : n.normal} 0;
1938
+ `;
1939
+ }}
1940
+ }
1941
+ }
1942
+
1943
+ ${(t) => t["data-expanded"] && x`
1944
+ .humany-paragraph {
1945
+ display: block;
1946
+ }
1947
+ `}
1948
+
1949
+ > span {
1950
+ display: block;
1951
+ font-weight: 300;
1952
+ color: ${(t) => {
1953
+ var e;
1954
+ return (e = t.theme.colors) == null ? void 0 : e.accent;
1955
+ }};
1956
+ }
1957
+ `;
1958
+ y(j)`
1959
+ margin: 0 0 0 ${(t) => {
1960
+ var e;
1961
+ return (e = t.theme.sizes) == null ? void 0 : e.small;
1962
+ }};
1963
+ line {
1964
+ stroke: ${(t) => {
1965
+ var e;
1966
+ return (e = t.theme.colors) == null ? void 0 : e.primary;
1967
+ }};
1968
+ }
1969
+ `;
1970
+ y(_e)`
1971
+ font-size: ${(t) => {
1972
+ var e;
1973
+ return (e = t.theme.fonts) == null ? void 0 : e.small;
1974
+ }};
1975
+ font-weight: 300;
1976
+ `;
1977
+ y(De)`
1978
+ ${(t) => {
1979
+ var e;
1980
+ return X(t)(
1981
+ "h1",
1982
+ x`
1983
+ font-weight: normal;
1984
+ font-size: ${(e = t.theme.fonts) == null ? void 0 : e.medium};
1985
+ `
1986
+ );
1987
+ }}
1988
+ `;
1989
+ const Qt = y(yt)`
1990
+ ${Ge}
1991
+ font-weight: 300;
1992
+ line-height: 1.5em;
1993
+ button:focus-visible {
1994
+ ${V};
1995
+ }
1996
+
1997
+ a:focus-visible {
1998
+ ${pt};
1999
+ }
2000
+ `, Vt = (t) => {
2001
+ const e = Ct(t.clientName), {
2002
+ params: { contactCategory: o, guideCategory: n, phrase: i }
2003
+ } = xe();
2004
+ if (typeof e > "u")
2005
+ return null;
2006
+ if (e === null)
2007
+ return process.env.NODE_ENV !== "production" ? /* @__PURE__ */ u(
2008
+ Jt,
2009
+ {
2010
+ title: `client-name: ${t.clientName}, id: ${t.id}`,
2011
+ className: "humany-non-resolved-contact-method",
2012
+ children: /* @__PURE__ */ u(bt, { variant: "h5", children: "Non resolved Contact Method type" })
2013
+ }
2014
+ ) : null;
2015
+ const s = (a = {}) => {
2016
+ const r = { ...t, ...a }, {
2017
+ id: c,
2018
+ title: l,
2019
+ clientName: h,
2020
+ symbol: m,
2021
+ inline: g,
2022
+ onClick: v = () => {
2023
+ },
2024
+ description: p,
2025
+ htmlParseInstruction: d,
2026
+ className: f,
2027
+ disabled: $,
2028
+ guideId: z,
2029
+ dispatch: S = () => {
2030
+ },
2031
+ expanded: C
2032
+ } = r, A = g ? {
2033
+ onKeyDown: (b) => {
2034
+ b.key && b.key === "Enter" && (v(b, r), b.defaultPrevented || !C && S("expand", c));
2035
+ },
2036
+ onClick: (b) => {
2037
+ v(b, r), b.defaultPrevented || !C && S("expand", c);
2038
+ }
2039
+ } : {
2040
+ onClick: (b) => v(b, r),
2041
+ routeName: "contact-method",
2042
+ params: W({
2043
+ contactCategory: o,
2044
+ guideId: z,
2045
+ guideCategory: n,
2046
+ phrase: i,
2047
+ contactMethod: c,
2048
+ uriName: ye(l)
2049
+ })
2050
+ };
2051
+ return /* @__PURE__ */ R(
2052
+ Zt,
2053
+ {
2054
+ title: l,
2055
+ "aria-label": l,
2056
+ className: f,
2057
+ disabled: $,
2058
+ description: p,
2059
+ "data-client-name": h,
2060
+ ...a,
2061
+ ...A,
2062
+ children: [
2063
+ m && /* @__PURE__ */ u(j, { symbol: m }),
2064
+ p ? /* @__PURE__ */ R("div", { className: "humany-contact-link-rich-content", children: [
2065
+ /* @__PURE__ */ u(Ie, { children: l }),
2066
+ /* @__PURE__ */ u(
2067
+ Qt,
2068
+ {
2069
+ html: p,
2070
+ htmlParseInstruction: d
2071
+ }
2072
+ )
2073
+ ] }) : /* @__PURE__ */ u(Ie, { children: l })
2074
+ ]
2075
+ }
2076
+ );
2077
+ };
2078
+ return t.expanded ? /* @__PURE__ */ u(wt, { fallback: null, children: /* @__PURE__ */ u(e, { ...t, renderDefault: s }) }) : s();
2079
+ }, Wt = (t) => {
2080
+ var e, o, n, i, s, a, r, c;
2081
+ return x`
2082
+ display: flex;
2083
+ padding: ${(e = t.theme.sizes) == null ? void 0 : e.large};
2084
+ ${t.description ? "" : "align-items: center;"}
2085
+ text-decoration: none;
2086
+ span {
2087
+ display: inline-block;
2088
+ color: ${(o = t.theme.colors) == null ? void 0 : o.text};
2089
+ }
2090
+ i {
2091
+ font-size: ${(n = t.theme.fonts) == null ? void 0 : n.large};
2092
+ margin: 0 ${(i = t.theme.sizes) == null ? void 0 : i.large} 0 0;
2093
+ min-height: ${(s = t.theme.fonts) == null ? void 0 : s.large};
2094
+ min-width: ${(a = t.theme.fonts) == null ? void 0 : a.large};
2095
+ line-height: ${(r = t.theme.fonts) == null ? void 0 : r.large};
2096
+ display: inline-block;
2097
+ vertical-align: bottom;
2098
+ color: ${(c = t.theme.colors) == null ? void 0 : c.text};
2099
+ }
2100
+ `;
2101
+ }, Ie = y(se)`
2102
+ line-height: ${(t) => {
2103
+ var e;
2104
+ return (e = t.theme.fonts) == null ? void 0 : e.large;
2105
+ }};
2106
+ `, Zt = y(Oe)`
2107
+ ${(t) => Wt(t)}
2108
+
2109
+ &:focus-visible {
2110
+ ${V};
2111
+ }
2112
+ `, Jt = y.div`
2113
+ text-align: center;
2114
+ display: block;
2115
+ ${(t) => {
2116
+ var e, o;
2117
+ return typeof ((e = t.theme.colors) == null ? void 0 : e.warning) < "u" && `color: ${(o = t.theme.colors) == null ? void 0 : o.warning};`;
2118
+ }}
2119
+ `, Xt = (t) => {
2120
+ var e, o, n;
2121
+ return x`
2122
+ ${J(t)}
2123
+
2124
+ > div {
2125
+ padding: ${(e = t.theme.sizes) == null ? void 0 : e.large};
2126
+
2127
+ ${X(t)(
2128
+ "h1",
2129
+ x`
2130
+ margin: 0;
2131
+ `
2132
+ )}
2133
+ }
2134
+
2135
+ > ul {
2136
+ &:not(:first-child) {
2137
+ border-top: ${t.theme.border};
2138
+ }
2139
+
2140
+ > li {
2141
+ margin: 0;
2142
+ white-space: normal;
2143
+
2144
+ > a {
2145
+ overflow: hidden;
2146
+ }
2147
+
2148
+ &:first-child > a {
2149
+ border-radius: ${`${t.theme.borderRadius} ${t.theme.borderRadius} 0 0`};
2150
+ }
2151
+
2152
+ &:last-child:not(:first-child) > a {
2153
+ border-radius: ${`0 0 ${t.theme.borderRadius} ${t.theme.borderRadius}`};
2154
+ }
2155
+
2156
+ &:not(:last-child) {
2157
+ border-bottom: ${t.theme.border};
2158
+ }
2159
+
2160
+ > div {
2161
+ padding: ${(o = t.theme.sizes) == null ? void 0 : o.large};
2162
+ }
2163
+ }
2164
+ }
2165
+
2166
+ @media (hover: hover) {
2167
+ a:hover {
2168
+ background-color: ${(n = t.theme.colors) == null ? void 0 : n.accent};
2169
+ }
2170
+ }
2171
+ `;
2172
+ };
2173
+ y(Z)`
2174
+ ${(t) => Xt(t)}
2175
+ `;
2176
+ const ro = ({
2177
+ contactMethodId: t,
2178
+ guideId: e,
2179
+ groupId: o,
2180
+ className: n,
2181
+ widgetName: i
2182
+ }) => {
2183
+ var v, p, d;
2184
+ const [s, a] = D(), r = Nt(), c = He(!0), l = kt(), h = window.humany.widgets.find(i), m = h.container;
2185
+ q(() => {
2186
+ console.log("¤¤¤Widget", h);
2187
+ const { events: f } = h, $ = f.subscribe(
2188
+ "conversational-hub-provider:form-submitted",
2189
+ async (S, C) => {
2190
+ var w;
2191
+ if (((w = C.form.meta) == null ? void 0 : w.groupId) !== o || C.id !== (s == null ? void 0 : s.id))
2192
+ return;
2193
+ l && (C.form.meta || (C.form.meta = {}), C.form.meta.conversation = l);
2194
+ const A = await (m == null ? void 0 : m.getAsync(
2195
+ "contactMethods"
2196
+ )), b = {
2197
+ ...s,
2198
+ body: {
2199
+ ...s.body,
2200
+ form: C.form
2201
+ }
2202
+ }, { errors: T, valid: N, errorTypes: F } = await A.validate(
2203
+ b
2204
+ );
2205
+ if (!N) {
2206
+ const M = new he(s.body.form);
2207
+ a(void 0), M.setValidationErrors(T), b.body = {
2208
+ ...b.body,
2209
+ form: M.get()
2210
+ }, a({ ...b });
2211
+ return;
2212
+ }
2213
+ const P = await A.submit(b);
2214
+ b.confirmation = P, a(b);
2215
+ }
2216
+ ), z = f.subscribe(
2217
+ "bot-provider:evaluate",
2218
+ async (S, C) => {
2219
+ if (C.id !== t)
2220
+ return;
2221
+ const b = await (await (m == null ? void 0 : m.getAsync(
2222
+ "contactMethods"
2223
+ ))).evaluate(s);
2224
+ let T = {
2225
+ ...s,
2226
+ body: {
2227
+ ...s.body,
2228
+ form: b
2229
+ }
2230
+ };
2231
+ const N = Ne(T, {
2232
+ submit: "Submit",
2233
+ errors: {},
2234
+ meta: { groupId: o }
2235
+ });
2236
+ T = {
2237
+ ...T,
2238
+ body: N
2239
+ }, a(T);
2240
+ }
2241
+ );
2242
+ return () => {
2243
+ $(), z();
2244
+ };
2245
+ }, [m, s, a, l]);
2246
+ const g = Y(
2247
+ async (f) => {
2248
+ const z = await (await Q.getInstance(m)).fetch(
2249
+ Ke.ContactMethod,
2250
+ {
2251
+ contactMethodId: f,
2252
+ guideId: e
2253
+ },
2254
+ { noCache: !0 }
2255
+ ), S = Ne(z, {
2256
+ submit: "Submit",
2257
+ errors: {},
2258
+ meta: { groupId: o }
2259
+ });
2260
+ if (z.body = S, z.body.guideId = e, !c.current)
2261
+ return null;
2262
+ a(z);
2263
+ },
2264
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2265
+ [c]
2266
+ );
2267
+ return q(() => (g(t), () => {
2268
+ c.current = !1;
2269
+ }), [t, g]), s ? /* @__PURE__ */ u(
2270
+ eo,
2271
+ {
2272
+ ...s,
2273
+ body: {
2274
+ ...s.body,
2275
+ form: s.body.form ? {
2276
+ ...s.body.form,
2277
+ data: (v = s.body.form) == null ? void 0 : v.data,
2278
+ layout: { ...s.body.form.layout },
2279
+ meta: (p = s.body.form) == null ? void 0 : p.meta,
2280
+ schema: (d = s.body.form) == null ? void 0 : d.schema
2281
+ } : void 0,
2282
+ guideId: s.body.guideId
2283
+ },
2284
+ inline: !0,
2285
+ expanded: !0,
2286
+ dispatch: r,
2287
+ className: G("humany-bot-contact-method", n)
2288
+ }
2289
+ ) : null;
2290
+ }, eo = y(Vt)`
2291
+ padding: ${(t) => {
2292
+ var e;
2293
+ return (e = t.theme.sizes) == null ? void 0 : e.normal;
2294
+ }} ${(t) => {
2295
+ var e;
2296
+ return (e = t.theme.sizes) == null ? void 0 : e.medium;
2297
+ }};
2298
+ `;
2299
+ export {
2300
+ ro as default
2301
+ };