@telia-ace/widget-types-grid 1.0.37 → 1.1.1-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/index-008a4ecb.js +1 -0
  2. package/index-1489b1e4.mjs +75 -0
  3. package/index-31330b2a.mjs +9945 -0
  4. package/index-48ee95ae.js +1 -0
  5. package/index-61eaf406.js +703 -0
  6. package/index-dc8062c1.js +9 -0
  7. package/index-ebd3abf1.mjs +76 -0
  8. package/index-fa7051e6.mjs +816 -0
  9. package/index.js +1 -0
  10. package/index.mjs +12 -0
  11. package/package.json +21 -53
  12. package/render-37a76217.mjs +51 -0
  13. package/render-5f9647e7.js +1 -0
  14. package/{dist/unmount-063d8ea3.js → unmount-063d8ea3.mjs} +0 -1
  15. package/unmount-481ce5a7.js +1 -0
  16. package/LICENSE.txt +0 -6
  17. package/README.md +0 -3
  18. package/dist/index.js +0 -950
  19. package/dist/index.js.map +0 -1
  20. package/dist/render-668e4aa4.js +0 -64
  21. package/dist/render-668e4aa4.js.map +0 -1
  22. package/dist/ui/index.d.ts +0 -6
  23. package/dist/unmount-063d8ea3.js.map +0 -1
  24. /package/{dist/component-platform-factory.d.ts → component-platform-factory.d.ts} +0 -0
  25. /package/{dist/index.d.ts → index.d.ts} +0 -0
  26. /package/{dist/services.d.ts → services.d.ts} +0 -0
  27. /package/{dist/ui → ui}/animated-view.d.ts +0 -0
  28. /package/{dist/ui → ui}/component.d.ts +0 -0
  29. /package/{dist/ui → ui}/detached-component.d.ts +0 -0
  30. /package/{dist/ui → ui}/determine-slide-direction.d.ts +0 -0
  31. /package/{dist/ui → ui}/html-element-handlers.d.ts +0 -0
  32. /package/{dist/ui → ui}/not-found.d.ts +0 -0
  33. /package/{dist/ui → ui}/prepare-dom.d.ts +0 -0
  34. /package/{dist/ui → ui}/render.d.ts +0 -0
  35. /package/{dist/ui → ui}/resolvable-component.d.ts +0 -0
  36. /package/{dist/ui → ui}/styles.d.ts +0 -0
  37. /package/{dist/ui → ui}/switch.d.ts +0 -0
  38. /package/{dist/ui → ui}/unmount.d.ts +0 -0
  39. /package/{dist/ui → ui}/use-component-node-properties.d.ts +0 -0
  40. /package/{dist/ui → ui}/use-router.d.ts +0 -0
  41. /package/{dist/ui → ui}/view-outlet.d.ts +0 -0
  42. /package/{dist/ui → ui}/view.d.ts +0 -0
  43. /package/{dist/ui → ui}/wrapper.d.ts +0 -0
  44. /package/{dist/widget.d.ts → widget.d.ts} +0 -0
@@ -0,0 +1,816 @@
1
+ var Ct = Object.defineProperty;
2
+ var Rt = (r, t, e) => t in r ? Ct(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var M = (r, t, e) => (Rt(r, typeof t != "symbol" ? t + "" : t, e), e);
4
+ import { g as Mt, r as Tt, w as U, s as At, f as nt, _ as It, h as z, i as Z, j as ut, k as Dt, l as $t, m as jt, S as ft, n as _t, o as Bt, p as rt, q as it, t as Nt, L as Ut, v as ot, x as Q, y as dt, z as et, A as Ft, B as Wt, D as Kt, H as V, I as J, E as qt } from "./index-31330b2a.mjs";
5
+ import { F as Se, G as xe } from "./index-31330b2a.mjs";
6
+ import "react/jsx-runtime";
7
+ import "react";
8
+ import "react-dom";
9
+ function zt(r = {}) {
10
+ const {
11
+ phrase: t = "",
12
+ category: e,
13
+ guideCategory: n,
14
+ contactCategory: i,
15
+ take: a,
16
+ connectionKey: s,
17
+ accordion: g,
18
+ id: u,
19
+ uriName: f,
20
+ sorting: w,
21
+ tag: p,
22
+ tagId: C,
23
+ tagTitle: D,
24
+ ...T
25
+ } = r, c = {};
26
+ return Object.keys(T).forEach((E) => {
27
+ typeof r[E] == "string" && (c[E] = r[E]);
28
+ }), typeof t == "string" && t.length && (c.phrase = t), t === null && (c.phrase = t), typeof n == "string" && n !== "0" && (c.guideCategory = n), typeof n == "number" && n !== 0 && (c.guideCategory = n), typeof n == "object" && n !== null && (typeof n.id == "string" && n.id !== "0" && (c.guideCategory = n.id), typeof n.id == "number" && n.id !== 0 && (c.guideCategory = n.id)), typeof i == "string" && i !== "0" && (c.contactCategory = i), typeof i == "number" && i !== 0 && (c.contactCategory = i), typeof i == "object" && i !== null && (typeof i.id == "string" && i.id !== "0" && (c.contactCategory = i.id), typeof i.id == "number" && i.id !== 0 && (c.contactCategory = i.id)), typeof e == "string" && e !== "0" && (c.category = e), typeof e == "number" && e !== 0 && (c.category = e), typeof e == "object" && e !== null && (typeof e.id == "string" && e.id !== "0" && (c.category = e.id), typeof e.id == "number" && e.id !== 0 && (c.category = e.id)), u && (c.id = u), f && (+c.category || +c.guideCategory || +c.guide || +c.contactCategory || +c.contactMethod) && (c.uriName = f), s && (c.connectionKey = s), a && (c.take = a), w && (c.sorting = w), typeof g == "string" && g.length > 0 && (c.accordion = g), typeof p == "string" && p !== "0" && (c.tag = p), typeof p == "number" && p !== 0 && (c.tag = p), Array.isArray(p) && p.length && (c.tag = p), (typeof C == "string" || typeof C == "number") && (c.tagId = C), typeof D == "string" && (c.tagTitle = D), typeof c.tag == "string" && (c.tag = c.tag.split(",")), c;
29
+ }
30
+ const lt = (r, t) => {
31
+ let e = !0;
32
+ return Object.keys(r).length !== Object.keys(t).length || Object.keys(r).some((i) => !Object.keys(t).some((s) => i === s)) ? !1 : (Object.keys(r).forEach((i) => {
33
+ if (e) {
34
+ const a = typeof r[i] > "u" ? "" : r[i], s = typeof t[i] > "u" ? "" : t[i];
35
+ e = a.toString() === s.toString();
36
+ }
37
+ }), e);
38
+ };
39
+ var Vt = function(r, t, e, n, i, a, s, g) {
40
+ if (process.env.NODE_ENV !== "production" && t === void 0)
41
+ throw new Error("invariant requires an error message argument");
42
+ if (!r) {
43
+ var u;
44
+ if (t === void 0)
45
+ u = new Error(
46
+ "Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings."
47
+ );
48
+ else {
49
+ var f = [e, n, i, a, s, g], w = 0;
50
+ u = new Error(
51
+ t.replace(/%s/g, function() {
52
+ return f[w++];
53
+ })
54
+ ), u.name = "Invariant Violation";
55
+ }
56
+ throw u.framesToPop = 1, u;
57
+ }
58
+ }, Yt = Vt;
59
+ const Gt = /* @__PURE__ */ Mt(Yt);
60
+ var Qt = function(t) {
61
+ return t.charAt(0) === "/" ? t : "/" + t;
62
+ }, Ht = function(t, e) {
63
+ return new RegExp("^" + e + "(\\/|\\?|#|$)", "i").test(t);
64
+ }, Jt = function(t, e) {
65
+ return Ht(t, e) ? t.substr(e.length) : t;
66
+ }, Xt = function(t) {
67
+ return t.charAt(t.length - 1) === "/" ? t.slice(0, -1) : t;
68
+ }, Zt = function(t) {
69
+ var e = t || "/", n = "", i = "", a = e.indexOf("#");
70
+ a !== -1 && (i = e.substr(a), e = e.substr(0, a));
71
+ var s = e.indexOf("?");
72
+ return s !== -1 && (n = e.substr(s), e = e.substr(0, s)), {
73
+ pathname: e,
74
+ search: n === "?" ? "" : n,
75
+ hash: i === "#" ? "" : i
76
+ };
77
+ }, Et = function(t) {
78
+ var e = t.pathname, n = t.search, i = t.hash, a = e || "/";
79
+ return n && n !== "?" && (a += n.charAt(0) === "?" ? n : "?" + n), i && i !== "#" && (a += i.charAt(0) === "#" ? i : "#" + i), a;
80
+ }, te = Object.assign || function(r) {
81
+ for (var t = 1; t < arguments.length; t++) {
82
+ var e = arguments[t];
83
+ for (var n in e)
84
+ Object.prototype.hasOwnProperty.call(e, n) && (r[n] = e[n]);
85
+ }
86
+ return r;
87
+ }, Y = function(t, e, n, i) {
88
+ var a = void 0;
89
+ typeof t == "string" ? (a = Zt(t), a.state = e) : (a = te({}, t), a.pathname === void 0 && (a.pathname = ""), a.search ? a.search.charAt(0) !== "?" && (a.search = "?" + a.search) : a.search = "", a.hash ? a.hash.charAt(0) !== "#" && (a.hash = "#" + a.hash) : a.hash = "", e !== void 0 && a.state === void 0 && (a.state = e));
90
+ try {
91
+ a.pathname = decodeURI(a.pathname);
92
+ } catch (s) {
93
+ throw s instanceof URIError ? new URIError('Pathname "' + a.pathname + '" could not be decoded. This is likely caused by an invalid percent-encoding.') : s;
94
+ }
95
+ return n && (a.key = n), i ? a.pathname ? a.pathname.charAt(0) !== "/" && (a.pathname = Tt(a.pathname, i.pathname)) : a.pathname = i.pathname : a.pathname || (a.pathname = "/"), a;
96
+ }, kt = function() {
97
+ var t = null, e = function(u) {
98
+ return U(t == null, "A history supports only one prompt at a time"), t = u, function() {
99
+ t === u && (t = null);
100
+ };
101
+ }, n = function(u, f, w, p) {
102
+ if (t != null) {
103
+ var C = typeof t == "function" ? t(u, f) : t;
104
+ typeof C == "string" ? typeof w == "function" ? w(C, p) : (U(!1, "A history needs a getUserConfirmation function in order to use a prompt message"), p(!0)) : p(C !== !1);
105
+ } else
106
+ p(!0);
107
+ }, i = [], a = function(u) {
108
+ var f = !0, w = function() {
109
+ f && u.apply(void 0, arguments);
110
+ };
111
+ return i.push(w), function() {
112
+ f = !1, i = i.filter(function(p) {
113
+ return p !== w;
114
+ });
115
+ };
116
+ }, s = function() {
117
+ for (var u = arguments.length, f = Array(u), w = 0; w < u; w++)
118
+ f[w] = arguments[w];
119
+ i.forEach(function(p) {
120
+ return p.apply(void 0, f);
121
+ });
122
+ };
123
+ return {
124
+ setPrompt: e,
125
+ confirmTransitionTo: n,
126
+ appendListener: a,
127
+ notifyListeners: s
128
+ };
129
+ }, ee = !!(typeof window < "u" && window.document && window.document.createElement), gt = function(t, e, n) {
130
+ return t.addEventListener ? t.addEventListener(e, n, !1) : t.attachEvent("on" + e, n);
131
+ }, pt = function(t, e, n) {
132
+ return t.removeEventListener ? t.removeEventListener(e, n, !1) : t.detachEvent("on" + e, n);
133
+ }, ne = function(t, e) {
134
+ return e(window.confirm(t));
135
+ }, ae = function() {
136
+ var t = window.navigator.userAgent;
137
+ return (t.indexOf("Android 2.") !== -1 || t.indexOf("Android 4.0") !== -1) && t.indexOf("Mobile Safari") !== -1 && t.indexOf("Chrome") === -1 && t.indexOf("Windows Phone") === -1 ? !1 : window.history && "pushState" in window.history;
138
+ }, re = function() {
139
+ return window.navigator.userAgent.indexOf("Trident") === -1;
140
+ }, ie = function(t) {
141
+ return t.state === void 0 && navigator.userAgent.indexOf("CriOS") === -1;
142
+ }, mt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
143
+ return typeof r;
144
+ } : function(r) {
145
+ return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
146
+ }, oe = Object.assign || function(r) {
147
+ for (var t = 1; t < arguments.length; t++) {
148
+ var e = arguments[t];
149
+ for (var n in e)
150
+ Object.prototype.hasOwnProperty.call(e, n) && (r[n] = e[n]);
151
+ }
152
+ return r;
153
+ }, yt = "popstate", vt = "hashchange", wt = function() {
154
+ try {
155
+ return window.history.state || {};
156
+ } catch {
157
+ return {};
158
+ }
159
+ }, se = function() {
160
+ var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
161
+ Gt(ee, "Browser history needs a DOM");
162
+ var e = window.history, n = ae(), i = !re(), a = t.forceRefresh, s = a === void 0 ? !1 : a, g = t.getUserConfirmation, u = g === void 0 ? ne : g, f = t.keyLength, w = f === void 0 ? 6 : f, p = t.basename ? Xt(Qt(t.basename)) : "", C = function(o) {
163
+ var m = o || {}, P = m.key, y = m.state, H = window.location, S = H.pathname, A = H.search, N = H.hash, I = S + A + N;
164
+ return U(!p || Ht(I, p), 'You are attempting to use a basename on a page whose URL path does not begin with the basename. Expected path "' + I + '" to begin with "' + p + '".'), p && (I = Jt(I, p)), Y(I, y, P);
165
+ }, D = function() {
166
+ return Math.random().toString(36).substr(2, w);
167
+ }, T = kt(), c = function(o) {
168
+ oe(l, o), l.length = e.length, T.notifyListeners(l.location, l.action);
169
+ }, E = function(o) {
170
+ ie(o) || W(C(o.state));
171
+ }, j = function() {
172
+ W(C(wt()));
173
+ }, F = !1, W = function(o) {
174
+ if (F)
175
+ F = !1, c();
176
+ else {
177
+ var m = "POP";
178
+ T.confirmTransitionTo(o, m, u, function(P) {
179
+ P ? c({ action: m, location: o }) : X(o);
180
+ });
181
+ }
182
+ }, X = function(o) {
183
+ var m = l.location, P = $.indexOf(m.key);
184
+ P === -1 && (P = 0);
185
+ var y = $.indexOf(o.key);
186
+ y === -1 && (y = 0);
187
+ var H = P - y;
188
+ H && (F = !0, x(H));
189
+ }, G = C(wt()), $ = [G.key], v = function(o) {
190
+ return p + Et(o);
191
+ }, O = function(o, m) {
192
+ U(!((typeof o > "u" ? "undefined" : mt(o)) === "object" && o.state !== void 0 && m !== void 0), "You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored");
193
+ var P = "PUSH", y = Y(o, m, D(), l.location);
194
+ T.confirmTransitionTo(y, P, u, function(H) {
195
+ if (H) {
196
+ var S = v(y), A = y.key, N = y.state;
197
+ if (n)
198
+ if (e.pushState({ key: A, state: N }, null, S), s)
199
+ window.location.href = S;
200
+ else {
201
+ var I = $.indexOf(l.location.key), tt = $.slice(0, I === -1 ? 0 : I + 1);
202
+ tt.push(y.key), $ = tt, c({ action: P, location: y });
203
+ }
204
+ else
205
+ U(N === void 0, "Browser history cannot push state in browsers that do not support HTML5 history"), window.location.href = S;
206
+ }
207
+ });
208
+ }, b = function(o, m) {
209
+ U(!((typeof o > "u" ? "undefined" : mt(o)) === "object" && o.state !== void 0 && m !== void 0), "You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");
210
+ var P = "REPLACE", y = Y(o, m, D(), l.location);
211
+ T.confirmTransitionTo(y, P, u, function(H) {
212
+ if (H) {
213
+ var S = v(y), A = y.key, N = y.state;
214
+ if (n)
215
+ if (e.replaceState({ key: A, state: N }, null, S), s)
216
+ window.location.replace(S);
217
+ else {
218
+ var I = $.indexOf(l.location.key);
219
+ I !== -1 && ($[I] = y.key), c({ action: P, location: y });
220
+ }
221
+ else
222
+ U(N === void 0, "Browser history cannot replace state in browsers that do not support HTML5 history"), window.location.replace(S);
223
+ }
224
+ });
225
+ }, x = function(o) {
226
+ e.go(o);
227
+ }, R = function() {
228
+ return x(-1);
229
+ }, L = function() {
230
+ return x(1);
231
+ }, _ = 0, q = function(o) {
232
+ _ += o, _ === 1 ? (gt(window, yt, E), i && gt(window, vt, j)) : _ === 0 && (pt(window, yt, E), i && pt(window, vt, j));
233
+ }, B = !1, k = function() {
234
+ var o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, m = T.setPrompt(o);
235
+ return B || (q(1), B = !0), function() {
236
+ return B && (B = !1, q(-1)), m();
237
+ };
238
+ }, d = function(o) {
239
+ var m = T.appendListener(o);
240
+ return q(1), function() {
241
+ q(-1), m();
242
+ };
243
+ }, l = {
244
+ length: e.length,
245
+ action: "POP",
246
+ location: G,
247
+ createHref: v,
248
+ push: O,
249
+ replace: b,
250
+ go: x,
251
+ goBack: R,
252
+ goForward: L,
253
+ block: k,
254
+ listen: d
255
+ };
256
+ return l;
257
+ }, Pt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
258
+ return typeof r;
259
+ } : function(r) {
260
+ return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
261
+ }, ce = Object.assign || function(r) {
262
+ for (var t = 1; t < arguments.length; t++) {
263
+ var e = arguments[t];
264
+ for (var n in e)
265
+ Object.prototype.hasOwnProperty.call(e, n) && (r[n] = e[n]);
266
+ }
267
+ return r;
268
+ }, bt = function(t, e, n) {
269
+ return Math.min(Math.max(t, e), n);
270
+ }, he = function() {
271
+ var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, e = t.getUserConfirmation, n = t.initialEntries, i = n === void 0 ? ["/"] : n, a = t.initialIndex, s = a === void 0 ? 0 : a, g = t.keyLength, u = g === void 0 ? 6 : g, f = kt(), w = function(b) {
272
+ ce(v, b), v.length = v.entries.length, f.notifyListeners(v.location, v.action);
273
+ }, p = function() {
274
+ return Math.random().toString(36).substr(2, u);
275
+ }, C = bt(s, 0, i.length - 1), D = i.map(function(O) {
276
+ return typeof O == "string" ? Y(O, void 0, p()) : Y(O, void 0, O.key || p());
277
+ }), T = Et, c = function(b, x) {
278
+ U(!((typeof b > "u" ? "undefined" : Pt(b)) === "object" && b.state !== void 0 && x !== void 0), "You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored");
279
+ var R = "PUSH", L = Y(b, x, p(), v.location);
280
+ f.confirmTransitionTo(L, R, e, function(_) {
281
+ if (_) {
282
+ var q = v.index, B = q + 1, k = v.entries.slice(0);
283
+ k.length > B ? k.splice(B, k.length - B, L) : k.push(L), w({
284
+ action: R,
285
+ location: L,
286
+ index: B,
287
+ entries: k
288
+ });
289
+ }
290
+ });
291
+ }, E = function(b, x) {
292
+ U(!((typeof b > "u" ? "undefined" : Pt(b)) === "object" && b.state !== void 0 && x !== void 0), "You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");
293
+ var R = "REPLACE", L = Y(b, x, p(), v.location);
294
+ f.confirmTransitionTo(L, R, e, function(_) {
295
+ _ && (v.entries[v.index] = L, w({ action: R, location: L }));
296
+ });
297
+ }, j = function(b) {
298
+ var x = bt(v.index + b, 0, v.entries.length - 1), R = "POP", L = v.entries[x];
299
+ f.confirmTransitionTo(L, R, e, function(_) {
300
+ _ ? w({
301
+ action: R,
302
+ location: L,
303
+ index: x
304
+ }) : w();
305
+ });
306
+ }, F = function() {
307
+ return j(-1);
308
+ }, W = function() {
309
+ return j(1);
310
+ }, X = function(b) {
311
+ var x = v.index + b;
312
+ return x >= 0 && x < v.entries.length;
313
+ }, G = function() {
314
+ var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1;
315
+ return f.setPrompt(b);
316
+ }, $ = function(b) {
317
+ return f.appendListener(b);
318
+ }, v = {
319
+ length: D.length,
320
+ action: "POP",
321
+ location: D[C],
322
+ index: C,
323
+ entries: D,
324
+ createHref: T,
325
+ push: c,
326
+ replace: E,
327
+ go: j,
328
+ goBack: F,
329
+ goForward: W,
330
+ canGo: X,
331
+ block: G,
332
+ listen: $
333
+ };
334
+ return v;
335
+ };
336
+ const St = "hashchange", ue = {
337
+ hashbang: {
338
+ encodePath: (r) => r.charAt(0) === "!" ? r : "!/" + ut(r),
339
+ decodePath: (r) => r.charAt(0) === "!" ? r.substr(1) : r
340
+ },
341
+ noslash: {
342
+ encodePath: ut,
343
+ decodePath: nt
344
+ },
345
+ slash: {
346
+ encodePath: nt,
347
+ decodePath: nt
348
+ }
349
+ }, K = () => {
350
+ const r = window.location.href, t = r.indexOf("#");
351
+ return t === -1 ? "" : r.substring(t + 1);
352
+ }, xt = (r) => window.location.hash = r, Ot = (r) => {
353
+ const t = window.location.href.indexOf("#");
354
+ window.location.replace(
355
+ window.location.href.slice(0, t >= 0 ? t : 0) + "#" + r
356
+ );
357
+ }, at = (r = "") => {
358
+ const t = r.replace(";", "?"), e = [
359
+ { from: /\;+/gi, to: "&" },
360
+ { from: /:+/gi, to: "=" }
361
+ ];
362
+ let n = t;
363
+ return e.forEach(({ to: i, from: a }) => {
364
+ n = n.replace(a, i);
365
+ }), n;
366
+ }, fe = (r = {}) => {
367
+ const t = window.history, { getUserConfirmation: e = Dt, hashType: n = "slash" } = r, i = r.basename ? At(nt(r.basename)) : "", { encodePath: a } = ue[n], s = () => {
368
+ const d = K(), l = w(d);
369
+ return Z(l, at);
370
+ }, g = r.transitionManager || It(), u = (d) => {
371
+ Object.assign(k, d), k.length = t.length, g.notifyListeners(
372
+ k.location,
373
+ k.action,
374
+ r.widgetName
375
+ );
376
+ };
377
+ let f = !1;
378
+ const w = (d) => {
379
+ const l = (m) => {
380
+ function P(y, H) {
381
+ const S = {};
382
+ let A;
383
+ for (; A = H.exec(y); )
384
+ S[A[1]] = A[2];
385
+ return S;
386
+ }
387
+ return P(m, /([^#?&=]+)=([^&#]*)(?!.*?\#)/gi) || null;
388
+ }, h = "humany-" + r.widgetName;
389
+ return l(d)[h];
390
+ }, p = () => {
391
+ const d = s(), l = k.location;
392
+ !f && $t(l, d) || C(d);
393
+ }, C = (d) => {
394
+ if (f)
395
+ f = !1, u();
396
+ else {
397
+ const l = "POP";
398
+ g.confirmTransitionTo(
399
+ d,
400
+ l,
401
+ e,
402
+ (h) => {
403
+ h ? u({ action: l, location: d }) : D(d);
404
+ }
405
+ );
406
+ }
407
+ }, D = (d) => {
408
+ const l = k.location;
409
+ let h = E.lastIndexOf(z(l));
410
+ h === -1 && (h = 0);
411
+ let o = E.lastIndexOf(z(d));
412
+ o === -1 && (o = 0);
413
+ const m = h - o;
414
+ m && (f = !0, v(m));
415
+ }, T = K(), c = a(T);
416
+ T !== c && Ot(c);
417
+ let E = [];
418
+ const j = s();
419
+ j.pathname !== null && E.push(z(j));
420
+ const F = (d = "") => {
421
+ const l = [
422
+ { from: /\?+/gi, to: ";" },
423
+ { from: /\&amp;+/gi, to: ";" },
424
+ { from: /\&+/gi, to: ";" },
425
+ { from: /=+/gi, to: ":" }
426
+ ];
427
+ let h = d;
428
+ return l.forEach(({ to: o, from: m }) => {
429
+ h = h.replace(m, o);
430
+ }), h;
431
+ }, W = (d, l, h) => {
432
+ let o = "", m = !1;
433
+ return d.split("&").forEach((y) => {
434
+ const H = y.split("="), S = H[0], A = H[1];
435
+ if (S === l) {
436
+ if (m = !0, h === null)
437
+ return;
438
+ o.length > 0 && (o += "&"), typeof h < "u" ? o += S + "=" + h : o += S;
439
+ } else
440
+ S && (o.length > 0 && (o += "&"), o += S + "=" + A);
441
+ }), !m && h !== null && (o.length > 0 && (o += "&"), typeof h < "u" ? o += l + "=" + h : o += l), o;
442
+ }, X = (d) => {
443
+ const l = d.pathname, h = F(d.search), o = l + (h ? `;${h}` : ""), P = `humany-${r.widgetName}`, y = K();
444
+ return `#${W(y, P, o).replace(
445
+ ";;",
446
+ ";"
447
+ )}`;
448
+ }, G = (d, l) => {
449
+ const h = "PUSH", o = Z(d, at), m = o.pathname, P = F(o.search), y = m + (P ? `${P}` : ""), S = `humany-${r.widgetName}`, A = K(), N = W(A, S, y);
450
+ g.confirmTransitionTo(
451
+ o,
452
+ h,
453
+ e,
454
+ (I) => {
455
+ if (!I)
456
+ return;
457
+ const tt = z(o), st = a(N);
458
+ if (K() !== st) {
459
+ xt(st);
460
+ const ct = E.lastIndexOf(z(k.location)), ht = E.slice(
461
+ 0,
462
+ ct === -1 ? 0 : ct + 1
463
+ );
464
+ ht.push(tt), E = ht, u({ action: h, location: o });
465
+ } else
466
+ u();
467
+ }
468
+ );
469
+ }, $ = (d, l) => {
470
+ const h = "REPLACE", o = Z(d, at);
471
+ g.confirmTransitionTo(
472
+ o,
473
+ h,
474
+ e,
475
+ (m) => {
476
+ if (!m)
477
+ return;
478
+ const P = z(o), y = a(i + P);
479
+ K() !== y && Ot(y);
480
+ const S = E.indexOf(z(k.location));
481
+ S !== -1 && (E[S] = P), u({ action: h, location: o });
482
+ }
483
+ );
484
+ }, v = (d) => {
485
+ t.go(d);
486
+ }, O = () => v(-1), b = () => v(1);
487
+ let x = 0;
488
+ const R = (d) => {
489
+ x += d, x === 1 ? window.addEventListener(St, p) : x === 0 && window.removeEventListener(St, p);
490
+ };
491
+ let L = !1;
492
+ const k = {
493
+ createHref: X,
494
+ createLocation: Z,
495
+ push: G,
496
+ replace: $,
497
+ go: v,
498
+ goBack: O,
499
+ goForward: b,
500
+ block: (d = !1) => {
501
+ const l = g.setPrompt(d);
502
+ return L || (R(1), L = !0), () => (L && (L = !1, R(-1)), l());
503
+ },
504
+ listen: (d) => {
505
+ const l = g.appendListener(d);
506
+ return R(1), () => {
507
+ R(-1), l();
508
+ };
509
+ },
510
+ stop: () => {
511
+ const d = K(), l = W(
512
+ d,
513
+ `humany-${r.widgetName}`,
514
+ null
515
+ ), h = a(l);
516
+ xt(h);
517
+ },
518
+ length: t.length,
519
+ action: "POP",
520
+ location: j
521
+ };
522
+ return k;
523
+ }, de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
524
+ __proto__: null,
525
+ decodeSearch: at,
526
+ default: fe,
527
+ getHashPath: K
528
+ }, Symbol.toStringTag, { value: "Module" })), Lt = "routeData";
529
+ class we {
530
+ constructor(t, e) {
531
+ M(this, "settings");
532
+ M(this, "routes");
533
+ M(this, "steps", []);
534
+ M(this, "location");
535
+ M(this, "history");
536
+ M(this, "widget");
537
+ M(this, "match");
538
+ M(this, "currentRoute");
539
+ M(this, "historyListenSubscription", () => {
540
+ });
541
+ M(this, "initialized");
542
+ M(this, "sticky", !1);
543
+ M(this, "storageWriter", null);
544
+ M(this, "storageMedium");
545
+ this.container = t, this.widget = t.get("$widget");
546
+ const { routes: n, ...i } = e;
547
+ this.settings = { ...i, ...t.get("routingSettings") }, this.sticky = jt(this.settings), this.storageMedium = this.sticky ? ft.Local : ft.Session, _t(t, Lt, Bt.Necessary, {
548
+ medium: this.storageMedium
549
+ }).then((a) => this.storageWriter = a), this.routes = n;
550
+ }
551
+ initialize() {
552
+ return this.initialized = this.initialized || this.createHistory().then((t) => {
553
+ this.history = t, this.location = t.location, this.historyListenSubscription = t.listen(
554
+ (e, n, i) => this.handleLocationChange(e, i)
555
+ );
556
+ });
557
+ }
558
+ setMatch(t) {
559
+ if (this.match = t, this.location) {
560
+ const e = this.getRouteData(), n = {
561
+ routeData: e,
562
+ location: this.location
563
+ }, i = this.steps[0], a = e.name === (i == null ? void 0 : i.routeData.name), s = lt(
564
+ e.params,
565
+ (i == null ? void 0 : i.routeData.params) || {}
566
+ );
567
+ (!a || !s) && (this.widget.events.dispatch("router:change", { next: n, previous: i }), this.steps.unshift(n), this.storageWriter && this.storageWriter(n.routeData), this.widget.events.dispatch("router:changed", {
568
+ previous: i,
569
+ current: n
570
+ }));
571
+ }
572
+ }
573
+ onRouteChange(t) {
574
+ return this.widget.events.subscribe("router:change", t);
575
+ }
576
+ isSticky() {
577
+ return this.sticky;
578
+ }
579
+ /**
580
+ * Generate a formatted path from string
581
+ * @param routeName Name of route to generate path for
582
+ * @param params Optional: route params
583
+ */
584
+ generate(t, e = {}) {
585
+ const n = rt(t, this.routes);
586
+ if (!n || !this.history)
587
+ throw `No route found for ${t}`;
588
+ const i = it(e, n.path);
589
+ if (!i)
590
+ throw `Unable to generate path for "${t}".`;
591
+ const a = Z(i, this.settings.decodeSearch);
592
+ let s = this.history.createHref(a);
593
+ const { mode: g, basePath: u } = this.settings;
594
+ return g === "browser" && u && (s = s.replace(u, "")), s.charAt(0) !== "/" && (s = `/${s}`), s;
595
+ }
596
+ /**
597
+ * Navigate to path
598
+ * @param routeName Route to navigate to
599
+ * @param params Optional: route params
600
+ */
601
+ navigate(t, e = {}) {
602
+ const n = rt(t, this.routes);
603
+ if (!n || !this.history)
604
+ return;
605
+ const i = it(e, n.path);
606
+ if (!i)
607
+ return;
608
+ const a = this.getRouteData(), s = a && a.name === t && Nt(a.params, e);
609
+ if (this.steps[0] && s)
610
+ return;
611
+ const { decodeSearch: u } = this.settings, f = u ? u(i) : i;
612
+ this.widget.events.dispatch("router:navigate", {
613
+ decodedPath: f
614
+ }), f.charAt(0) !== "/" ? this.history.push(`/${f}`) : this.history.push(f);
615
+ }
616
+ /**
617
+ * Return true or false depending
618
+ * on whether it is possible to navigate backwards
619
+ */
620
+ hasBack() {
621
+ if (this.steps.length > 1)
622
+ return !0;
623
+ const t = this.getRouteData(this.settings.initialPath), e = this.getRouteData(), n = e.name === t.name, i = lt(e.params, t.params);
624
+ return !n || !i;
625
+ }
626
+ /**
627
+ * Navigate to previous route
628
+ */
629
+ goBack(t = 1) {
630
+ if (this.steps.length < 2) {
631
+ const e = this.getRouteData(this.settings.initialPath);
632
+ e && e.name && (this.navigate(e.name, e.params), this.steps = []);
633
+ } else {
634
+ const e = t >= this.steps.length ? this.steps.length - 1 : t, { routeData: n } = this.steps[e];
635
+ this.steps = [...this.steps.slice(e + 1)], this.navigate(n.name, zt(n.params));
636
+ }
637
+ }
638
+ /**
639
+ * Navigate to next route
640
+ */
641
+ goForward() {
642
+ this.history && this.history.goForward();
643
+ }
644
+ /**
645
+ * Get the current location
646
+ */
647
+ current() {
648
+ return this.location;
649
+ }
650
+ /**
651
+ * Get the initial route. If the defined initial route does not exist,
652
+ * return the first defined route
653
+ */
654
+ getInitialRoute() {
655
+ const { name: t } = this.getRouteData(this.settings.initialPath), e = this.routes.find((n) => n.name === t);
656
+ return e || (this.routes.length > 0 ? this.routes[0] : (process.env.NODE_ENV !== "production" && Ut.warn("Unable to get initial route as no routes are defined."), null));
657
+ }
658
+ getRouteData(t) {
659
+ const e = ot(this.container);
660
+ if (t) {
661
+ const n = Q(t, this.routes);
662
+ return n ? {
663
+ params: dt(
664
+ et(t, n.path)
665
+ ),
666
+ name: n.name
667
+ } : e || {
668
+ name: "",
669
+ params: {}
670
+ };
671
+ }
672
+ if (this.location) {
673
+ const { pathname: n, search: i } = this.location;
674
+ if (this.currentRoute = this.currentRoute || Q(n, this.routes), this.currentRoute) {
675
+ const { path: a, name: s } = this.currentRoute;
676
+ this.match || (this.match = {
677
+ params: et(n, a),
678
+ isExact: !0,
679
+ path: a,
680
+ url: n
681
+ });
682
+ const g = dt({
683
+ ...this.match.params,
684
+ ...i.length > 0 && Ft(i)
685
+ });
686
+ return {
687
+ name: s,
688
+ params: g
689
+ };
690
+ }
691
+ }
692
+ return e || {
693
+ name: "",
694
+ params: {}
695
+ };
696
+ }
697
+ dispose() {
698
+ return this.historyListenSubscription(), this.stop();
699
+ }
700
+ /**
701
+ * Setup and load the initial route based on router configuration
702
+ */
703
+ setupInitialRoute() {
704
+ return Wt(
705
+ this.container,
706
+ Lt,
707
+ this.storageMedium
708
+ ).then((t) => {
709
+ if (!this.location || !this.history)
710
+ return;
711
+ const { initialPath: e, mode: n } = this.settings;
712
+ switch ((() => {
713
+ const a = Kt(this.container);
714
+ return n === V.browser || a ? J.path : n === V.memory && t ? J.storage : J.initialPath;
715
+ })()) {
716
+ case J.initialPath: {
717
+ const a = this.getRouteData(e);
718
+ return a && a.name ? this.navigate(a.name, a.params) : void 0;
719
+ }
720
+ case J.path: {
721
+ const { pathname: a } = this.location;
722
+ if (this.currentRoute = Q(a, this.routes), this.currentRoute) {
723
+ const { path: g } = this.currentRoute;
724
+ return this.setMatch({
725
+ params: et(a, g),
726
+ isExact: !0,
727
+ path: g,
728
+ url: a
729
+ });
730
+ }
731
+ const s = ot(this.container);
732
+ return s ? this.setMatch({
733
+ params: {},
734
+ isExact: !0,
735
+ path: s.name,
736
+ url: a
737
+ }) : void 0;
738
+ }
739
+ case J.storage: {
740
+ const { pathname: a } = this.location;
741
+ this.currentRoute = Q(a, this.routes);
742
+ const { name: s = "", params: g = {} } = t || {}, u = rt(s, this.routes);
743
+ if (u) {
744
+ const f = it(g, u.path);
745
+ if (f)
746
+ return this.history.push(f), this.location = { ...this.location, pathname: f }, this.currentRoute = Q(f, this.routes), this.setMatch({
747
+ params: g,
748
+ isExact: !0,
749
+ path: u.path,
750
+ url: f
751
+ });
752
+ }
753
+ return;
754
+ }
755
+ }
756
+ });
757
+ }
758
+ start() {
759
+ return this.setupInitialRoute();
760
+ }
761
+ stop() {
762
+ return this.history && (this.settings.mode === V.scopedHash && this.history.stop(), this.steps = [], this.storageWriter) ? this.storageWriter() : Promise.resolve();
763
+ }
764
+ handleLocationChange(t, e) {
765
+ const { pathname: n } = t, { mode: i } = this.settings;
766
+ if (n.indexOf("?") > -1 || n.indexOf(";") > -1 || i === V.scopedHash && e !== this.widget.name)
767
+ return;
768
+ this.location = t, this.currentRoute = Q(n, this.routes);
769
+ const a = ot(this.container);
770
+ if (this.currentRoute) {
771
+ const { path: s } = this.currentRoute;
772
+ this.setMatch({
773
+ params: et(n, s),
774
+ isExact: !0,
775
+ path: s,
776
+ url: n
777
+ });
778
+ } else
779
+ a && this.setMatch({
780
+ params: {},
781
+ isExact: !0,
782
+ path: a.name,
783
+ url: n
784
+ });
785
+ }
786
+ createHistory() {
787
+ return new Promise((t) => {
788
+ const { mode: e, basePath: n } = this.settings;
789
+ if (e === V.scopedHash) {
790
+ const i = this.widget.name, a = qt(this.container);
791
+ return Promise.resolve().then(() => de).then((s) => {
792
+ const g = s.default({
793
+ widgetName: i,
794
+ transitionManager: a,
795
+ hashType: "noslash"
796
+ });
797
+ return t(g);
798
+ });
799
+ }
800
+ if (e === V.memory)
801
+ return t(he());
802
+ if (e === V.browser)
803
+ return t(se({ basename: n }));
804
+ throw "RoutingService: History could not be created.";
805
+ });
806
+ }
807
+ }
808
+ export {
809
+ V as HistoryMode,
810
+ we as RoutingService,
811
+ fe as createHashHistory,
812
+ Se as getScopedHashDOMLocation,
813
+ xe as getSpecificWidgetPath,
814
+ et as matchParams,
815
+ Kt as onWidgetUrl
816
+ };