@telia-ace/widget-runtime-flamingo 0.0.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.
@@ -0,0 +1,3405 @@
1
+ const Lt = (n, t, e, ...s) => {
2
+ const i = `[${n.get("$environment").name || "webprovisions"}] ${e}`;
3
+ switch (t) {
4
+ case "info":
5
+ console.info(i, ...s);
6
+ break;
7
+ case "warning":
8
+ console.warn(i, ...s);
9
+ break;
10
+ case "error":
11
+ console.error(i, ...s);
12
+ break;
13
+ }
14
+ }, ns = (n) => {
15
+ const t = n.container || n;
16
+ return {
17
+ info: (e, ...s) => Lt(t, "info", e, ...s),
18
+ warn: (e, ...s) => Lt(t, "warning", e, ...s),
19
+ error: (e, ...s) => Lt(t, "error", e, ...s)
20
+ };
21
+ };
22
+ var X = /* @__PURE__ */ ((n) => (n.Implementation = "implementation", n.Widget = "widget", n))(X || {}), D = /* @__PURE__ */ ((n) => (n.Pre = "pre", n.Post = "post", n))(D || {});
23
+ const is = (n, t, e, s) => {
24
+ try {
25
+ const i = new t(e, s);
26
+ return {
27
+ name: n,
28
+ invoke: (r, o) => {
29
+ let a;
30
+ return i[r] && (a = i[r].call(i, o)), Promise.resolve(a);
31
+ },
32
+ getInstance: () => i
33
+ };
34
+ } catch (i) {
35
+ if (i.message && i.message.indexOf("is not a constructor") >= 0)
36
+ return {
37
+ name: n,
38
+ invoke: (r) => {
39
+ let o;
40
+ return r === "initialize" && (o = t(e, s)), Promise.resolve(o);
41
+ },
42
+ getInstance: () => t
43
+ };
44
+ throw i;
45
+ }
46
+ };
47
+ function he(n, t) {
48
+ return typeof n > "u" ? t : n;
49
+ }
50
+ let rs = class {
51
+ constructor(t = {}) {
52
+ this.part = t;
53
+ }
54
+ createCommand(t, e, s) {
55
+ let i;
56
+ typeof e == "function" ? i = {
57
+ scope: X.Widget,
58
+ stage: D.Post,
59
+ defaultArgs: void 0,
60
+ handlerResolver: e
61
+ } : i = {
62
+ scope: he(e.scope, X.Widget),
63
+ stage: he(e.stage, D.Post),
64
+ defaultArgs: e.defaultArgs,
65
+ handlerResolver: s
66
+ };
67
+ let r = this.part;
68
+ const o = t.split(".");
69
+ return o.forEach((a, h) => {
70
+ h === o.length - 1 ? r[a] || (r[a] = () => i) : r = this.part[a] = this.part[a] || {};
71
+ }), this;
72
+ }
73
+ get() {
74
+ return this.part;
75
+ }
76
+ };
77
+ const Me = (n) => {
78
+ const t = new rs({});
79
+ return n(t), t.get();
80
+ };
81
+ Me((n) => {
82
+ n.createCommand(
83
+ "types.register",
84
+ { scope: X.Implementation, stage: D.Pre },
85
+ (t) => (e, s) => {
86
+ t.container.get("$types")[e] = s;
87
+ }
88
+ ).createCommand(
89
+ "type",
90
+ { stage: D.Pre },
91
+ (t) => (e) => {
92
+ t.container.register("$type", e);
93
+ }
94
+ ).createCommand(
95
+ "settings",
96
+ { stage: D.Pre, defaultArgs: [null] },
97
+ (t) => (e) => {
98
+ t.events.dispatch(
99
+ "settings:change",
100
+ e,
101
+ { bubbles: !0 }
102
+ ), t.container.register("$settings", e);
103
+ }
104
+ ).createCommand(
105
+ "plugin",
106
+ { stage: D.Pre },
107
+ (t) => (e, s, i) => {
108
+ const { container: r } = t;
109
+ let o = null, a = e, h = s;
110
+ typeof e == "string" && (o = e, a = s, h = i);
111
+ const c = (l) => {
112
+ const { transformPluginSettings: d } = t.container.get("$environmentOptions"), u = d ? d(
113
+ h || {},
114
+ o,
115
+ t.container,
116
+ a
117
+ ) : s;
118
+ try {
119
+ const p = is(
120
+ o,
121
+ a,
122
+ r,
123
+ u
124
+ );
125
+ r.get("$plugins").push(p), l && p.invoke("initialize", null);
126
+ } catch (p) {
127
+ ns(t).warn("Error when initializing plugin", p);
128
+ }
129
+ };
130
+ t.container.get("$instance") ? c(!0) : t.events.subscribeOnce("widget:instance-created", () => c(!1));
131
+ }
132
+ ).createCommand(
133
+ "container.register",
134
+ (t) => (e, s) => {
135
+ t.container.register(e, s);
136
+ }
137
+ ).createCommand(
138
+ "container.registerAsync",
139
+ (t) => (e, s) => {
140
+ t.container.registerAsync(e, s);
141
+ }
142
+ ).createCommand(
143
+ "container.registerFactory",
144
+ (t) => (e, s) => {
145
+ t.container.registerFactory(e, s);
146
+ }
147
+ ).createCommand(
148
+ "container.touch",
149
+ (t) => (e, s) => {
150
+ t.container.touch(e, s);
151
+ }
152
+ ).createCommand(
153
+ "csp",
154
+ {},
155
+ (t) => (e) => {
156
+ t.container.register("csp", e);
157
+ }
158
+ );
159
+ });
160
+ function os(n) {
161
+ const t = {};
162
+ return [].filter.call(n.attributes, (e) => /^data-/.test(e.name)).map((e) => e.name).forEach((e) => t[e.substr(5)] = n.getAttribute(e)), t;
163
+ }
164
+ const le = (n, t, e) => {
165
+ const s = os(n);
166
+ e({
167
+ sourceDOMElement: n,
168
+ eventType: t,
169
+ data: s
170
+ });
171
+ };
172
+ function de(n, t, e) {
173
+ n.forEach((s) => {
174
+ s.dataset.attached !== "true" && (t === "load" ? le(s, t, e) : s.addEventListener(t, (i) => {
175
+ i.preventDefault(), le(s, t, e);
176
+ }), s.dataset.monitored = "true");
177
+ });
178
+ }
179
+ function as(n, t, e) {
180
+ const s = n.container.get("bootstrapping.monitor");
181
+ s && s.events.subscribe("bootstrap:trigger-elements-updated", (r, o) => {
182
+ de(
183
+ o.triggerElements,
184
+ t,
185
+ e
186
+ );
187
+ });
188
+ const i = n.container.get("triggerElements");
189
+ i && de(
190
+ i,
191
+ t,
192
+ e
193
+ );
194
+ }
195
+ Me((n) => {
196
+ n.createCommand(
197
+ "ready",
198
+ { scope: X.Implementation, stage: D.Pre },
199
+ (t) => (e) => {
200
+ const { container: s } = t, i = s.owner;
201
+ s.get("bootstrapping").ready ? e(i) : i.events.subscribeOnce("bootstrap:ready", () => {
202
+ e(i);
203
+ });
204
+ }
205
+ );
206
+ });
207
+ const Mt = (n, t, e, ...s) => {
208
+ const i = `[${n.get("$environment").name || "webprovisions"}] ${e}`;
209
+ switch (t) {
210
+ case "info":
211
+ console.info(i, ...s);
212
+ break;
213
+ case "warning":
214
+ console.warn(i, ...s);
215
+ break;
216
+ case "error":
217
+ console.error(i, ...s);
218
+ break;
219
+ }
220
+ }, cs = (n) => {
221
+ const t = n.container || n;
222
+ return {
223
+ info: (e, ...s) => Mt(t, "info", e, ...s),
224
+ warn: (e, ...s) => Mt(t, "warning", e, ...s),
225
+ error: (e, ...s) => Mt(t, "error", e, ...s)
226
+ };
227
+ };
228
+ var vt = /* @__PURE__ */ ((n) => (n.Implementation = "implementation", n.Widget = "widget", n))(vt || {}), I = /* @__PURE__ */ ((n) => (n.Pre = "pre", n.Post = "post", n))(I || {});
229
+ const hs = (n, t, e, s) => {
230
+ try {
231
+ const i = new t(e, s);
232
+ return {
233
+ name: n,
234
+ invoke: (r, o) => {
235
+ let a;
236
+ return i[r] && (a = i[r].call(i, o)), Promise.resolve(a);
237
+ },
238
+ getInstance: () => i
239
+ };
240
+ } catch (i) {
241
+ if (i.message && i.message.indexOf("is not a constructor") >= 0)
242
+ return {
243
+ name: n,
244
+ invoke: (r) => {
245
+ let o;
246
+ return r === "initialize" && (o = t(e, s)), Promise.resolve(o);
247
+ },
248
+ getInstance: () => t
249
+ };
250
+ throw i;
251
+ }
252
+ };
253
+ function ue(n, t) {
254
+ return typeof n > "u" ? t : n;
255
+ }
256
+ let ls = class {
257
+ constructor(t = {}) {
258
+ this.part = t;
259
+ }
260
+ createCommand(t, e, s) {
261
+ let i;
262
+ typeof e == "function" ? i = {
263
+ scope: vt.Widget,
264
+ stage: I.Post,
265
+ defaultArgs: void 0,
266
+ handlerResolver: e
267
+ } : i = {
268
+ scope: ue(e.scope, vt.Widget),
269
+ stage: ue(e.stage, I.Post),
270
+ defaultArgs: e.defaultArgs,
271
+ handlerResolver: s
272
+ };
273
+ let r = this.part;
274
+ const o = t.split(".");
275
+ return o.forEach((a, h) => {
276
+ h === o.length - 1 ? r[a] || (r[a] = () => i) : r = this.part[a] = this.part[a] || {};
277
+ }), this;
278
+ }
279
+ get() {
280
+ return this.part;
281
+ }
282
+ };
283
+ const Ie = (n) => {
284
+ const t = new ls({});
285
+ return n(t), t.get();
286
+ };
287
+ Ie((n) => {
288
+ n.createCommand(
289
+ "types.register",
290
+ { scope: vt.Implementation, stage: I.Pre },
291
+ (t) => (e, s) => {
292
+ t.container.get("$types")[e] = s;
293
+ }
294
+ ).createCommand(
295
+ "type",
296
+ { stage: I.Pre },
297
+ (t) => (e) => {
298
+ t.container.register("$type", e);
299
+ }
300
+ ).createCommand(
301
+ "settings",
302
+ { stage: I.Pre, defaultArgs: [null] },
303
+ (t) => (e) => {
304
+ t.events.dispatch(
305
+ "settings:change",
306
+ e,
307
+ { bubbles: !0 }
308
+ ), t.container.register("$settings", e);
309
+ }
310
+ ).createCommand(
311
+ "plugin",
312
+ { stage: I.Pre },
313
+ (t) => (e, s, i) => {
314
+ const { container: r } = t;
315
+ let o = null, a = e, h = s;
316
+ typeof e == "string" && (o = e, a = s, h = i);
317
+ const c = (l) => {
318
+ const { transformPluginSettings: d } = t.container.get("$environmentOptions"), u = d ? d(
319
+ h || {},
320
+ o,
321
+ t.container,
322
+ a
323
+ ) : s;
324
+ try {
325
+ const p = hs(
326
+ o,
327
+ a,
328
+ r,
329
+ u
330
+ );
331
+ r.get("$plugins").push(p), l && p.invoke("initialize", null);
332
+ } catch (p) {
333
+ cs(t).warn("Error when initializing plugin", p);
334
+ }
335
+ };
336
+ t.container.get("$instance") ? c(!0) : t.events.subscribeOnce("widget:instance-created", () => c(!1));
337
+ }
338
+ ).createCommand(
339
+ "container.register",
340
+ (t) => (e, s) => {
341
+ t.container.register(e, s);
342
+ }
343
+ ).createCommand(
344
+ "container.registerAsync",
345
+ (t) => (e, s) => {
346
+ t.container.registerAsync(e, s);
347
+ }
348
+ ).createCommand(
349
+ "container.registerFactory",
350
+ (t) => (e, s) => {
351
+ t.container.registerFactory(e, s);
352
+ }
353
+ ).createCommand(
354
+ "container.touch",
355
+ (t) => (e, s) => {
356
+ t.container.touch(e, s);
357
+ }
358
+ ).createCommand(
359
+ "csp",
360
+ {},
361
+ (t) => (e) => {
362
+ t.container.register("csp", e);
363
+ }
364
+ );
365
+ });
366
+ var Re = /* @__PURE__ */ ((n) => (n.Activating = "activating", n.Loading = "loading", n.Activated = "activated", n.Deactivating = "deactivating", n.Deactivated = "deactivated", n))(Re || {});
367
+ class ds {
368
+ /**
369
+ * Creates a new `Widget` instance.
370
+ * @param container The `Container` instance to base the widget upon.
371
+ */
372
+ constructor(t) {
373
+ this.container = t, this.widget = t.get("$widget"), this.settings = t.get("$settings"), this.events = this.widget.events, this.widget.events.subscribe("settings:change", (e, s) => {
374
+ this.settings = s;
375
+ });
376
+ }
377
+ }
378
+ const At = (n, t, ...e) => typeof t == "string" ? n(`[humany] ${t}`, ...e) : n(t, ...e), Z = class {
379
+ constructor() {
380
+ this.keys = [], this.log = (t, ...e) => this.lookup(t, () => Z.log(...e)), this.warn = (t, ...e) => this.lookup(t, () => Z.warn(...e)), this.error = (t, ...e) => this.lookup(t, () => Z.error(...e)), this.info = (t, ...e) => this.lookup(t, () => Z.info(...e));
381
+ }
382
+ lookup(t, e) {
383
+ this.keys.indexOf(t) === -1 && (this.keys.push(t), e());
384
+ }
385
+ };
386
+ let b = Z;
387
+ b.log = (...n) => At(console.log, ...n);
388
+ b.warn = (...n) => At(console.warn, ...n);
389
+ b.error = (...n) => At(console.error, ...n);
390
+ b.info = (...n) => At(console.info, ...n);
391
+ const Te = (n) => {
392
+ let t = {}, e, s;
393
+ if (typeof n != "object" || n === null)
394
+ return n;
395
+ t = Array.isArray(n) ? [] : {};
396
+ for (s in n)
397
+ e = n[s], t[s] = typeof e == "object" && e !== null ? Te(e) : e;
398
+ return t;
399
+ }, us = Te;
400
+ function pe(n) {
401
+ let t = 0;
402
+ if (n.length === 0)
403
+ return t.toString();
404
+ for (let e = 0; e < n.length; e++) {
405
+ const s = n.charCodeAt(e);
406
+ t = (t << 5) - t + s, t = t & t;
407
+ }
408
+ return t.toString();
409
+ }
410
+ let ps = class {
411
+ constructor(t, e) {
412
+ this.lockWarningTime = t, this.lockErrorTime = e, this.tasks = [], this.current = Promise.resolve(), this.next = this.next.bind(this);
413
+ }
414
+ add(t, e, s, i) {
415
+ this.tasks.push({ task: t, resolve: e, reject: s, done: i }), this.next();
416
+ }
417
+ next() {
418
+ this.current = this.current.then(() => {
419
+ const t = this.tasks.shift();
420
+ if (t) {
421
+ let e;
422
+ const s = setTimeout(() => {
423
+ process.env.NODE_ENV !== "production" && b.warn(
424
+ `A lock has exceeded ${this.lockWarningTime} ms. Waiting additional ${this.lockErrorTime} ms before rejecting the task.`,
425
+ t
426
+ ), e = setTimeout(() => {
427
+ t.reject("lock timeout exceeded");
428
+ }, this.lockErrorTime);
429
+ }, this.lockWarningTime), i = Promise.resolve(t.task()).then((r) => (clearTimeout(s), clearTimeout(e), r));
430
+ return Promise.resolve(i).then(this.next).then(
431
+ () => i.then((r) => {
432
+ t.done(), t.resolve(r);
433
+ })
434
+ ).catch((r) => (t.done(), t.reject(r), this.next()));
435
+ }
436
+ return Promise.resolve();
437
+ });
438
+ }
439
+ };
440
+ const ht = /* @__PURE__ */ new WeakMap();
441
+ function C(n, t = 5e3, e = 1e3) {
442
+ return ht.has(n) || ht.set(n, new ps(t, e)), (s) => new Promise((i, r) => {
443
+ const o = ht.get(n);
444
+ o.add(s, i, r, () => {
445
+ o.tasks.length || ht.delete(n);
446
+ });
447
+ });
448
+ }
449
+ const gs = (n, t) => {
450
+ const e = () => t.querySelectorAll("[data-loading=true]").length > 0, s = (() => {
451
+ let i = !1;
452
+ return () => {
453
+ i || (n.get("$widget").events.dispatch("widget:data-loaded", {
454
+ element: t
455
+ }), i = !0);
456
+ };
457
+ })();
458
+ if (!e())
459
+ return s();
460
+ new MutationObserver((i, r) => {
461
+ i.find(
462
+ (o) => o.type === "attributes" && o.attributeName === "data-loading"
463
+ ) && !e() && (r.disconnect(), s());
464
+ }).observe(t, {
465
+ attributes: !0,
466
+ childList: !0,
467
+ subtree: !0
468
+ });
469
+ }, ms = (n, t) => {
470
+ n.get("$widget").container.getAsync("components").then((e) => {
471
+ e.events.subscribeOnce("components:component-model-initialized", () => {
472
+ let s = e.nodes.visible.reduce(
473
+ (r, o) => (!o.name || !o.type || o.type === "view" || o.type === "root" || o.attributes.layout.size === "none" || t.querySelector(`[data-name="${o.name}"]`) || r.push(o.name), r),
474
+ []
475
+ ), i = !1;
476
+ new MutationObserver((r, o) => {
477
+ r.forEach((a) => {
478
+ if (a.addedNodes) {
479
+ const h = Array.from(
480
+ a.addedNodes
481
+ ).reduce((c, l) => {
482
+ const d = l.getAttribute && l.getAttribute("data-name");
483
+ return d && s.indexOf(d) > -1 && c.push(d), c;
484
+ }, []);
485
+ s = s.filter((c) => h.indexOf(c) === -1), !i && s.length === 0 && (i = !0, gs(n, t), o.disconnect());
486
+ }
487
+ });
488
+ }).observe(t, {
489
+ attributes: !1,
490
+ characterData: !1,
491
+ childList: !0,
492
+ subtree: !0,
493
+ attributeOldValue: !1,
494
+ characterDataOldValue: !1
495
+ });
496
+ });
497
+ });
498
+ }, fs = ms, S = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
499
+ function it() {
500
+ return S() + S() + "-" + S() + "-" + S() + "-" + S() + "-" + S() + S() + S();
501
+ }
502
+ var vs = Object.defineProperty, ys = Object.defineProperties, bs = Object.getOwnPropertyDescriptors, ge = Object.getOwnPropertySymbols, ws = Object.prototype.hasOwnProperty, $s = Object.prototype.propertyIsEnumerable, me = (n, t, e) => t in n ? vs(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, _s = (n, t) => {
503
+ for (var e in t || (t = {}))
504
+ ws.call(t, e) && me(n, e, t[e]);
505
+ if (ge)
506
+ for (var e of ge(t))
507
+ $s.call(t, e) && me(n, e, t[e]);
508
+ return n;
509
+ }, Es = (n, t) => ys(n, bs(t));
510
+ class As {
511
+ constructor(t) {
512
+ const { events: e } = t.get("$widget");
513
+ this.events = e.createChild(this);
514
+ }
515
+ action(t, e, s) {
516
+ this.events.dispatch("data:action", { action: e, value: s, target: t }, { bubbles: !0 });
517
+ }
518
+ subscribe(t, e) {
519
+ return this.events.subscribe(
520
+ "data:action",
521
+ (s, { action: i, value: r, target: o }) => t === o && e(t, i, r)
522
+ );
523
+ }
524
+ }
525
+ const je = (n) => {
526
+ const t = [];
527
+ return [
528
+ (e, s) => {
529
+ t.push(n.subscribe(e, s));
530
+ },
531
+ () => {
532
+ t.forEach((e) => {
533
+ e();
534
+ });
535
+ }
536
+ ];
537
+ };
538
+ let F = class {
539
+ constructor(t, e = []) {
540
+ this.platform = t, this.rules = e;
541
+ }
542
+ match(t) {
543
+ return this.rules.every((e) => !(e.id && e.id !== t.id || e.type && e.type !== t.type));
544
+ }
545
+ ofType(t) {
546
+ return this.rules.push({ type: t }), this;
547
+ }
548
+ withId(t) {
549
+ return this.rules.push({ id: t }), this;
550
+ }
551
+ select() {
552
+ return new Cs(this.platform, this);
553
+ }
554
+ }, ee = class {
555
+ constructor(t, e, s) {
556
+ this.platform = t, this.node = e, this.actions = new Ct(
557
+ t,
558
+ new F(t).withId(e.id),
559
+ s
560
+ );
561
+ const [i, r] = je(this.platform.events);
562
+ this.subscribe = i, this.unsubscribe = r;
563
+ }
564
+ properties(t) {
565
+ return t && this.node.touchProperties((e) => t(e)), this.node.attributes.properties;
566
+ }
567
+ context(t) {
568
+ return t && this.subscribe("components:context-changed", (e, { node: s }) => {
569
+ s === this.node && t(this.node.attributes.context);
570
+ }), this.node.attributes.context;
571
+ }
572
+ layout(t) {
573
+ return t && this.subscribe("components:layout-changed", (e, { node: s }) => {
574
+ s === this.node && t(this.node.attributes.layout);
575
+ }), this.node.attributes.layout;
576
+ }
577
+ writeProperties(t, e) {
578
+ this.node.writeProperties(t, e);
579
+ }
580
+ writeContext(t, e) {
581
+ this.node.writeProperties(t, e);
582
+ }
583
+ writeLayout(t, e) {
584
+ this.node.writeLayout(t, e);
585
+ }
586
+ dispose() {
587
+ this.unsubscribe(), this.actions.dispose();
588
+ }
589
+ };
590
+ class Cs {
591
+ constructor(t, e, s = !0) {
592
+ this.platform = t, this.target = e, this.clearOnDispose = s, this.removes = [], this.actions = new Ct(this.platform, this.target);
593
+ }
594
+ writeProperties(t, e) {
595
+ this.removes.push(
596
+ this.platform.write({
597
+ options: e,
598
+ attributes: { properties: t },
599
+ target: this.target,
600
+ removable: this.clearOnDispose
601
+ })
602
+ );
603
+ }
604
+ writeContext(t, e) {
605
+ this.removes.push(
606
+ this.platform.write({
607
+ options: e,
608
+ attributes: { context: t },
609
+ target: this.target,
610
+ removable: this.clearOnDispose
611
+ })
612
+ );
613
+ }
614
+ writeLayout(t, e) {
615
+ this.removes.push(
616
+ this.platform.write({
617
+ options: e,
618
+ attributes: { layout: t },
619
+ target: this.target,
620
+ removable: this.clearOnDispose
621
+ })
622
+ );
623
+ }
624
+ dispose() {
625
+ this.removes.forEach((t) => {
626
+ t();
627
+ }), this.actions.dispose();
628
+ }
629
+ }
630
+ const Os = (n, t, e) => {
631
+ const s = n.concat(), i = (r, o, a) => {
632
+ let h = !0;
633
+ if (s.length) {
634
+ const c = s.shift(), l = (d, u) => (h = !1, i(d, Object.assign({}, o, u), a));
635
+ return Promise.resolve(c(r, l, a)).then((d) => Es(_s({}, d), {
636
+ cancelled: h
637
+ }));
638
+ }
639
+ return Promise.resolve({ data: r, cancelled: !1, options: o });
640
+ };
641
+ return i(t, {}, e);
642
+ };
643
+ let Ct = class {
644
+ constructor(t, e, s) {
645
+ this.platform = t, this.target = e, this.ns = s, this.subscriptions = [], this.create = this.create.bind(this);
646
+ }
647
+ create(t, e = () => {
648
+ }) {
649
+ const s = {
650
+ key: t,
651
+ fn: e,
652
+ target: this.target,
653
+ ns: this.ns
654
+ };
655
+ this.platform.actionsState.handlers.push(s);
656
+ const i = () => {
657
+ const r = this.platform.actionsState.handlers.indexOf(s);
658
+ r > -1 && this.platform.actionsState.handlers.splice(r, 1);
659
+ };
660
+ return this.subscriptions.push(i), i;
661
+ }
662
+ dispatch(t, e) {
663
+ const s = this.platform.nodes.all.concat(
664
+ this.platform.nodes.detached
665
+ ), i = {}, r = this.platform.actionsState.handlers.filter(
666
+ (o) => o.key === t && (!o.ns || !this.ns || o.ns === this.ns)
667
+ );
668
+ return Promise.all(
669
+ r.map((o) => {
670
+ const a = s.filter(
671
+ (c) => o.target.match(c) && this.target.match(c)
672
+ ), h = this.platform.actionsState.watchers.filter((c) => c.key === t && (!c.ns || !this.ns || c.ns === this.ns) && a.some((l) => c.target.match(l))).map((c) => c.fn);
673
+ return Promise.all(
674
+ a.map((c) => {
675
+ const l = new ee(
676
+ this.platform,
677
+ c,
678
+ this.ns
679
+ );
680
+ return Os(h, e, l).then((d) => {
681
+ const { data: u = {}, options: p, cancelled: v } = d;
682
+ return Promise.resolve(
683
+ v ? {} : o.fn(u, p, l)
684
+ ).then((y) => {
685
+ i[c.id] = y;
686
+ });
687
+ });
688
+ })
689
+ );
690
+ })
691
+ ).then(() => i);
692
+ }
693
+ watch(t, e) {
694
+ let s = t, i = this.ns;
695
+ const r = t.split(".");
696
+ r.length > 1 && (i = r[0], s = r.splice(1).join("."));
697
+ const o = {
698
+ fn: e,
699
+ target: this.target,
700
+ key: s,
701
+ ns: i
702
+ };
703
+ this.platform.actionsState.watchers.push(o);
704
+ const a = () => {
705
+ const h = this.platform.actionsState.watchers.indexOf(o);
706
+ h > -1 && this.platform.actionsState.watchers.splice(h, 1);
707
+ };
708
+ return this.subscriptions.push(a), a;
709
+ }
710
+ dispose() {
711
+ this.subscriptions.forEach((t) => t());
712
+ }
713
+ };
714
+ Ie((n) => {
715
+ n.createCommand("components", (t) => (e) => {
716
+ t.events.subscribeOnce("components:platform-created", (s, { platform: i }) => {
717
+ e.handlers && e.handlers.forEach(([r, o]) => {
718
+ i.addComponentHandler(r, o);
719
+ });
720
+ });
721
+ });
722
+ });
723
+ let Gt = class {
724
+ constructor(t, e) {
725
+ this.events = t, this.tags = [], this.children = {}, this.changesets = [], this.mountCount = 0, this.id = it(), this.type = e, this.attributes = {
726
+ context: {},
727
+ properties: {},
728
+ layout: {},
729
+ tags: []
730
+ }, this.writeLayout({ size: "full", indent: 0 });
731
+ }
732
+ mount(t, e) {
733
+ let s = t.get("mounted-nodes");
734
+ return s || (s = /* @__PURE__ */ new Map(), t.register("mounted-nodes", s)), s.has(this) ? (process.env.NODE_ENV !== "production" && b.error("Trying to mount an already mounted component node.", this), () => {
735
+ }) : (this.events.dispatch("components:node-mounted", { node: this }), this.mountCount === 0 && (this.mountCount = this.mountCount + 1, this.events.dispatch("components:node-enter", { node: this })), () => {
736
+ s.delete(this), this.events.dispatch("components:node-unmounted", { node: this }), this.mountCount = this.mountCount - 1, this.mountCount === 0 && this.events.dispatch("components:node-exit", { node: this });
737
+ });
738
+ }
739
+ appendChild(t, e = "default") {
740
+ if (t.parent) {
741
+ if (t.parent === this)
742
+ return;
743
+ t.parent.removeChild(t);
744
+ }
745
+ t.parent = this, this.children[e] || (this.children[e] = []), this.children[e].push(t), this.events.dispatch("components:node-appended", { node: t });
746
+ }
747
+ prependChild(t, e = "default") {
748
+ if (t.parent) {
749
+ if (t.parent === this)
750
+ return;
751
+ t.parent.removeChild(t);
752
+ }
753
+ t.parent = this, this.children[e] || (this.children[e] = []), this.children[e].unshift(t), this.events.dispatch("components:node-appended", { node: t });
754
+ }
755
+ touchProperties(t, e = {}, s) {
756
+ const i = [{ properties: t }, e];
757
+ return this.changesets.push(i), this.events.dispatch("components:set-properties", { node: this }), () => {
758
+ if (s) {
759
+ const r = this.changesets.indexOf(i);
760
+ r > -1 && (this.changesets.splice(r, 1), this.events.dispatch("components:set-properties", { node: this }));
761
+ }
762
+ };
763
+ }
764
+ writeProperties(t, e = {}, s) {
765
+ const i = [{ properties: t }, e];
766
+ return this.changesets.push(i), this.events.dispatch("components:set-properties", { node: this }), () => {
767
+ if (s) {
768
+ const r = this.changesets.indexOf(i);
769
+ r > -1 && (this.changesets.splice(r, 1), this.events.dispatch("components:set-properties", { node: this }));
770
+ }
771
+ };
772
+ }
773
+ writeLayout(t, e = {}, s) {
774
+ const i = [{ layout: t }, e];
775
+ return this.changesets.push(i), this.events.dispatch("components:set-layout", { node: this }), () => {
776
+ if (!s)
777
+ return;
778
+ const r = this.changesets.indexOf(i);
779
+ r > -1 && (this.changesets.splice(r, 1), this.events.dispatch("components:set-layout", { node: this }));
780
+ };
781
+ }
782
+ writeContext(t, e = {}, s) {
783
+ const i = [{ context: t }, e];
784
+ return this.changesets.push(i), this.events.dispatch("components:set-context", { node: this }), () => {
785
+ if (!s)
786
+ return;
787
+ const r = this.changesets.indexOf(i);
788
+ r > -1 && (this.changesets.splice(r, 1), this.events.dispatch("components:set-context", { node: this }));
789
+ };
790
+ }
791
+ getChildren(t = "default") {
792
+ const e = this.children[t] || [];
793
+ return e.reduce((s, i, r) => {
794
+ const { order: o = r } = i.attributes.layout;
795
+ return s[o] ? s.splice(o, 0, i) : s[o] = i, s;
796
+ }, Array(e.length));
797
+ }
798
+ remove() {
799
+ this.parent && this.parent.removeChild(this);
800
+ }
801
+ removeChild(t) {
802
+ Object.keys(this.children).forEach((e) => {
803
+ const s = this.children[e], i = s.indexOf(t);
804
+ i > -1 && (s.splice(i, 1), this.events.dispatch("components:node-removed", { node: t, parentNode: this }));
805
+ }), delete t.parent;
806
+ }
807
+ };
808
+ const Ve = (n, t, e) => {
809
+ for (let s = 0, i = n.length; s < i && e(n[s]) !== !0; s++) {
810
+ const r = t[n[s].id] || "default", o = n[s].getChildren(r);
811
+ Ve(o, t, e);
812
+ }
813
+ }, Ot = (n, t, e) => {
814
+ if (e(n) !== !0) {
815
+ const s = t[n.id] || "default", i = n.children[s];
816
+ Ve(i, t, e);
817
+ }
818
+ }, pt = (n, t) => {
819
+ const e = [];
820
+ return Ot(n, t, (s) => {
821
+ e.push(s);
822
+ }), e;
823
+ }, Ue = (n, t, e) => {
824
+ let s;
825
+ return Ot(n, t, (i) => {
826
+ if (e(i))
827
+ return s = i, !0;
828
+ }), s;
829
+ };
830
+ class xs {
831
+ constructor(t, e, s) {
832
+ this.root = t, this.switches = e, this.all = [], this.visible = [], this.detached = [], s.subscribe("components:node-appended", (i, r) => {
833
+ this.all.push(r.node), this.visible = pt(t, e);
834
+ }), s.subscribe("components:node-removed", (i, r) => {
835
+ let o = this.all.indexOf(r.node);
836
+ o > -1 && this.all.splice(o, 1), o = this.visible.indexOf(r.node), o > -1 && this.visible.splice(o, 1), this.visible = pt(t, e);
837
+ }), s.subscribe("components:node-switched", (i, r) => {
838
+ this.visible = pt(t, e);
839
+ });
840
+ }
841
+ query(t = {}) {
842
+ const e = [];
843
+ return Ot(this.root, this.switches, (s) => {
844
+ Object.keys(t).every((i) => t[i] === s[i]) && e.push(s);
845
+ }), e;
846
+ }
847
+ get(t) {
848
+ return Ue(this.root, this.switches, (e) => e.id === t) || this.detached.find((e) => e.id === t);
849
+ }
850
+ }
851
+ class Ss {
852
+ constructor() {
853
+ this.handlers = /* @__PURE__ */ new Map();
854
+ }
855
+ add(t, e) {
856
+ this.handlers.set(t, e);
857
+ }
858
+ get(t) {
859
+ return this.handlers.get(t);
860
+ }
861
+ }
862
+ const Ps = (n) => {
863
+ let t = n, e = 0;
864
+ for (; t.parent; )
865
+ e = e + 1, t = t.parent;
866
+ return e;
867
+ }, ks = (n) => n.map(([t, e]) => [Ps(t), t, e]).sort(([t], [e]) => t - e).map(([, t, e]) => [t, e]), It = (n) => n instanceof Date ? !1 : n && typeof n == "object" && !Array.isArray(n), O = (n, ...t) => {
868
+ if (!t.length)
869
+ return n;
870
+ const e = t.shift();
871
+ if (It(n) && It(e))
872
+ for (const s in e)
873
+ It(e[s]) ? (n[s] || Object.assign(n, { [s]: {} }), O(n[s], e[s])) : Object.assign(n, { [s]: e[s] });
874
+ return O(n, ...t);
875
+ }, Ns = (n, t) => !n || n === "all" ? !0 : n.some((e) => t.indexOf(e) > -1), Ds = (n, t) => {
876
+ let e = [], s = [], i;
877
+ const r = () => {
878
+ process.env.NODE_ENV !== "production" && console.time("state-processor.flush");
879
+ const a = /* @__PURE__ */ new Map(), h = ks(e.map((l, d) => [l, s[d]])), c = (l, d) => {
880
+ var u;
881
+ const p = a.get(l) || {}, v = d.context && !p.context, y = d.properties && !p.properties, A = d.layout && !p.layout;
882
+ a.set(l, {
883
+ context: p.context || v,
884
+ properties: p.properties || y,
885
+ layout: p.layout || A
886
+ }), y && (l.attributes.properties = {}), A && (l.attributes.layout = {}), v && (l.attributes.context = O({}, (u = l.parent) == null ? void 0 : u.attributes.context));
887
+ const ct = [], kt = [], Nt = [];
888
+ if (l.changesets.forEach(($) => {
889
+ const [_, Dt] = $;
890
+ Ns(Dt.breakpoints, n.breakpoints) && (y && (typeof _.properties == "function" ? ct.push(
891
+ _.properties
892
+ ) : O(l.attributes.properties, _.properties)), A && (typeof _.layout == "function" ? kt.push(_.layout) : O(l.attributes.layout, _.layout)), v && (typeof _.context == "function" ? Nt.push(_.context) : O(l.attributes.context, _.context)));
893
+ }), ct.forEach(($) => {
894
+ O(l.attributes.properties, $(l.attributes.properties));
895
+ }), kt.forEach(($) => {
896
+ O(l.attributes.layout, $(l.attributes.layout));
897
+ }), Nt.forEach(($) => {
898
+ O(l.attributes.context, $(l.attributes.context));
899
+ }), v || d.recursive) {
900
+ const $ = n.getBranch(l), _ = d.recursive ? d : {
901
+ context: !!v
902
+ };
903
+ l.getChildren($).forEach((Dt) => {
904
+ c(Dt, _);
905
+ });
906
+ }
907
+ };
908
+ process.env.NODE_ENV !== "production" && console.timeEnd("state-processor.flush"), h.forEach(([l, d]) => {
909
+ c(l, d);
910
+ }), e = [], s = [], t(a);
911
+ }, o = () => {
912
+ clearTimeout(i), i = setTimeout(r, 0);
913
+ };
914
+ return (a, h) => {
915
+ const c = e.indexOf(a);
916
+ if (c > -1) {
917
+ const l = s[c];
918
+ return h.context && (l.context = !0), h.properties && (l.properties = !0), h.layout && (l.layout = !0), h.recursive && (l.recursive = !0), o();
919
+ }
920
+ return e.push(a), s.push(h), o();
921
+ };
922
+ };
923
+ class rt {
924
+ constructor(t, e = {}) {
925
+ this.providers = e, this.breakpoints = [], this.actionsState = { handlers: [], watchers: [] }, this.switches = {}, this.changesets = [], this.subscriptions = [], this.customComponentHandler = new Ss(), this.events = t.events.createChild(this);
926
+ const s = new Gt(this.events, "root");
927
+ s.name = `root-${t.name}`, this.nodes = new xs(s, this.switches, this.events);
928
+ const i = this.processNode = Ds(this, (r) => {
929
+ const o = Array.from(r.keys());
930
+ process.env.NODE_ENV !== "production" && console.info(`STATE PROCESSOR: ${o.length} node(s) processed:
931
+ ${o.map(
932
+ (a) => `${a.name || "<no name>"} (${a.id})
933
+ `
934
+ )}`), o.forEach((a) => {
935
+ const h = r.get(a);
936
+ a.parent && a.parent.type === "root" && this.events.dispatch("components:root-children-changed", { node: a }), h != null && h.context && this.events.dispatch("components:context-changed", { node: a }), h != null && h.properties && this.events.dispatch("components:properties-changed", { node: a }), h != null && h.layout && this.events.dispatch("components:layout-changed", { node: a });
937
+ }), this.events.dispatch("components:component-model-initialized", {}, { bubbles: !0 });
938
+ });
939
+ Promise.all(
940
+ Object.keys(e).map((r) => e[r].load(this))
941
+ ), this.subscriptions.push(
942
+ this.events.subscribe(
943
+ "components:node-appended",
944
+ (r, o) => {
945
+ const { node: a } = o;
946
+ this.changesets.forEach((h) => {
947
+ const { changeset: c, target: l, removes: d } = h, [u, p] = c;
948
+ l.match(o.node) && (u.properties && d.push(a.writeProperties(u.properties, p)), u.context && d.push(a.writeContext(u.context, p)), u.layout && d.push(a.writeLayout(u.layout, p)));
949
+ });
950
+ }
951
+ )
952
+ ), this.subscriptions.push(
953
+ this.events.subscribe(
954
+ "components:node-appended",
955
+ (r, o) => {
956
+ i(o.node, { properties: !0, context: !0 });
957
+ }
958
+ )
959
+ ), this.subscriptions.push(
960
+ this.events.subscribe(
961
+ "components:set-properties",
962
+ (r, o) => {
963
+ i(o.node, { properties: !0 });
964
+ }
965
+ )
966
+ ), this.subscriptions.push(
967
+ this.events.subscribe(
968
+ "components:set-context",
969
+ (r, o) => {
970
+ i(o.node, { properties: !0, context: !0 });
971
+ }
972
+ )
973
+ ), this.subscriptions.push(
974
+ this.events.subscribe(
975
+ "components:set-indent",
976
+ (r, o) => {
977
+ i(o.node, { layout: !0 });
978
+ }
979
+ )
980
+ ), this.subscriptions.push(
981
+ this.events.subscribe(
982
+ "components:set-layout",
983
+ (r, o) => {
984
+ i(o.node, { layout: !0 });
985
+ }
986
+ )
987
+ ), this.subscriptions.push(
988
+ this.events.subscribe("components:node-switched", (r, { node: o, branch: a }) => {
989
+ i(o, {
990
+ layout: !0,
991
+ recursive: !0,
992
+ properties: !0,
993
+ context: !0
994
+ });
995
+ })
996
+ ), this.subscriptions.push(
997
+ this.events.subscribe("components:node-removed", (r, { parentNode: o }) => {
998
+ i(o, { properties: !0 });
999
+ })
1000
+ ), this.events.parent && this.events.parent.dispatch("components:platform-created", { platform: this });
1001
+ }
1002
+ static getInstance(t) {
1003
+ return t.getAsync("components");
1004
+ }
1005
+ addBreakpoint(t) {
1006
+ this.breakpoints.indexOf(t) === -1 && (this.breakpoints.push(t), this.processNode(this.nodes.root, {
1007
+ context: !0,
1008
+ properties: !0,
1009
+ layout: !0,
1010
+ recursive: !0
1011
+ }));
1012
+ }
1013
+ removeBreakpoint(t) {
1014
+ const e = this.breakpoints.indexOf(t);
1015
+ e > -1 && (this.breakpoints.splice(e, 1), this.processNode(this.nodes.root, {
1016
+ context: !0,
1017
+ properties: !0,
1018
+ layout: !0,
1019
+ recursive: !0
1020
+ }));
1021
+ }
1022
+ setSwitch(t, e) {
1023
+ this.switches[t.id] = e, this.events.dispatch("components:node-switched", { node: t, branch: e });
1024
+ }
1025
+ getBranch(t) {
1026
+ return this.switches[t.id];
1027
+ }
1028
+ /**
1029
+ * Creates a `ComponentNode` of the specified type.
1030
+ * @param type Type of node.
1031
+ */
1032
+ createNode(t, e = {}) {
1033
+ const s = new Gt(this.events, t);
1034
+ return e.detached && this.nodes.detached.push(s), s;
1035
+ }
1036
+ components() {
1037
+ return new F(this);
1038
+ }
1039
+ actions(t, e) {
1040
+ return new Ct(this, t, e);
1041
+ }
1042
+ write(t) {
1043
+ const { provider: e, target: s, attributes: i, options: r = {}, removable: o } = t, a = t.key || it(), h = { changeset: [i, r], target: s, removes: [] };
1044
+ if (e) {
1045
+ const c = this.providers[e];
1046
+ c.write(a, s, i, r), h.removes.push(() => {
1047
+ c.remove(a);
1048
+ });
1049
+ }
1050
+ return this.changesets.push(h), this.nodes.all.forEach((c) => {
1051
+ if (s.match(c)) {
1052
+ let l = () => {
1053
+ };
1054
+ i.properties && (l = c.writeProperties(i.properties, r, o)), i.context && (l = c.writeContext(i.context, r, o)), i.layout && (l = c.writeContext(i.layout, r, o)), h.removes.push(l);
1055
+ }
1056
+ }), () => {
1057
+ if (o) {
1058
+ h.removes.forEach((l) => l());
1059
+ const c = this.changesets.indexOf(h);
1060
+ c > -1 && this.changesets.splice(c, 1);
1061
+ }
1062
+ };
1063
+ }
1064
+ addComponentHandler(t, e) {
1065
+ this.customComponentHandler.add(t, e);
1066
+ }
1067
+ getComponentHandler(t) {
1068
+ return this.customComponentHandler.get(t);
1069
+ }
1070
+ dispose() {
1071
+ this.subscriptions.forEach((t) => t());
1072
+ }
1073
+ }
1074
+ const Ls = (n) => {
1075
+ if (Array.isArray(n)) {
1076
+ const [t, ...e] = n;
1077
+ return {
1078
+ definitionId: t,
1079
+ overrides: e
1080
+ };
1081
+ }
1082
+ return {
1083
+ definitionId: n,
1084
+ overrides: []
1085
+ };
1086
+ }, yt = (n, t, e, s, i, r) => {
1087
+ e.forEach((o) => {
1088
+ const a = Ls(o), h = s[a.definitionId];
1089
+ if (a.definitionId === "view") {
1090
+ const c = n.createNode("view");
1091
+ c.name = "view", Object.keys(i).forEach((l) => {
1092
+ const d = i[l];
1093
+ yt(n, c, [d.entry], s, i, l);
1094
+ }), t.appendChild(c), a.overrides.forEach((l) => {
1095
+ l.properties && c.writeProperties(l.properties, {
1096
+ breakpoints: l.breakpoints
1097
+ }), l.context && c.writeContext(l.context, { breakpoints: l.breakpoints }), l.layout && c.writeLayout(l.layout, { breakpoints: l.breakpoints });
1098
+ });
1099
+ } else if (n.getComponentHandler(h.type)) {
1100
+ const c = n.getComponentHandler(h.type);
1101
+ c && c(a, {
1102
+ platform: n,
1103
+ node: t,
1104
+ references: e,
1105
+ definitions: s,
1106
+ views: i,
1107
+ branch: r
1108
+ });
1109
+ } else {
1110
+ const c = s[a.definitionId];
1111
+ if (process.env.NODE_ENV !== "production" && !c) {
1112
+ b.error(
1113
+ `No definition found for component type '${a.definitionId}'.`
1114
+ );
1115
+ return;
1116
+ }
1117
+ const l = n.createNode(c.type);
1118
+ l.name = a.definitionId, l.tags = c.tags || [], c.properties && l.writeProperties(c.properties), c.context && l.writeContext(c.context), c.layout && l.writeLayout(c.layout), t.appendChild(l, r), a.overrides.forEach((d) => {
1119
+ const u = { breakpoints: d.breakpoints };
1120
+ d.properties && l.writeProperties(d.properties, u), d.context && l.writeContext(d.context, u), d.layout && l.writeLayout(d.layout, u);
1121
+ }), c.children && yt(n, l, c.children, s, i);
1122
+ }
1123
+ });
1124
+ }, He = (n, t) => {
1125
+ const { entry: e, components: s, breakpoints: i, views: r } = t, o = [];
1126
+ return Object.keys(i).forEach((a) => {
1127
+ const h = i[a], c = window.matchMedia(h);
1128
+ c.matches && n.breakpoints.push(a);
1129
+ const l = (d) => {
1130
+ d.matches ? n.addBreakpoint(a) : n.removeBreakpoint(a);
1131
+ };
1132
+ c.addListener(l), o.push(() => c.removeListener(l));
1133
+ }), yt(n, n.nodes.root, [e], s, r), () => o.forEach((a) => {
1134
+ a();
1135
+ });
1136
+ }, Yt = (n, t) => ({
1137
+ id: n.id,
1138
+ type: n.type,
1139
+ name: n.name,
1140
+ branch: t || "default"
1141
+ }), ze = (n, t, e, s = it(), i = {}) => n.getAsync("components").then((r) => {
1142
+ let o;
1143
+ if (typeof t == "string") {
1144
+ const c = new F(r);
1145
+ c.ofType(t), o = c;
1146
+ } else
1147
+ o = t;
1148
+ const a = {}, h = (c) => {
1149
+ const l = a[c.id];
1150
+ return l ? Promise.resolve(l.controller) : rt.getInstance(n).then((d) => new ee(d, c, s));
1151
+ };
1152
+ r.events.subscribe(
1153
+ "components:node-enter",
1154
+ (c, { node: l }) => {
1155
+ o.match(l) && h(l).then((d) => {
1156
+ Promise.resolve(e(d)).then((u) => {
1157
+ a[l.id] = {
1158
+ dispose: u,
1159
+ controller: d
1160
+ };
1161
+ });
1162
+ });
1163
+ }
1164
+ ), r.events.subscribe(
1165
+ "components:node-exit",
1166
+ (c, { node: l }) => {
1167
+ const d = a[l.id];
1168
+ d && (d.dispose && d.dispose(), i.reuseController || (d.controller.dispose(), delete a[l.id]));
1169
+ }
1170
+ );
1171
+ });
1172
+ class Ms {
1173
+ constructor(t) {
1174
+ this.aliases = /* @__PURE__ */ new Map(), this.components = /* @__PURE__ */ new Map(), this.logger = new b();
1175
+ const { events: e } = t.get("$widget");
1176
+ this.events = e;
1177
+ }
1178
+ getComponent(t) {
1179
+ const e = this.aliases.get(t), s = this.components.get(e || t) || null;
1180
+ return process.env.NODE_ENV !== "production" && (s || this.logger.warn(
1181
+ e || t,
1182
+ `Unable to resolve component: "${e || t}". You most likely forgot to register the required plugin for: ${e || t}.`
1183
+ )), s;
1184
+ }
1185
+ registerComponent(t, e) {
1186
+ return this.components.set(t, e), this.events.dispatch("component-resolver:resolve", t), () => {
1187
+ this.components.delete(t);
1188
+ };
1189
+ }
1190
+ registerResolver(t, e) {
1191
+ return this.events.subscribe("component-resolver:resolve", (s, i) => {
1192
+ if (i === t) {
1193
+ const r = this.getComponent(t);
1194
+ e(r);
1195
+ }
1196
+ });
1197
+ }
1198
+ registerAlias(t, e) {
1199
+ return this.aliases.set(t, e), this.events.dispatch("component-resolver:resolve", t), () => {
1200
+ this.aliases.delete(t);
1201
+ };
1202
+ }
1203
+ }
1204
+ var E = /* @__PURE__ */ ((n) => (n.open = "open", n.closed = "closed", n.hidden = "hidden", n))(E || {});
1205
+ const se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1206
+ __proto__: null,
1207
+ ActionResolver: As,
1208
+ ActionsController: Ct,
1209
+ ComponentNode: Gt,
1210
+ ComponentNodeController: ee,
1211
+ ComponentPlatform: rt,
1212
+ ComponentQuery: F,
1213
+ ComponentResolver: Ms,
1214
+ WidgetRenderState: E,
1215
+ asDescriptor: Yt,
1216
+ createChildren: yt,
1217
+ createComponentModel: He,
1218
+ createEventSubscriber: je,
1219
+ extendComponent: ze,
1220
+ findComponent: Ue,
1221
+ findVisibleComponents: pt,
1222
+ traverseComponents: Ot
1223
+ }, Symbol.toStringTag, { value: "Module" }));
1224
+ var Is = Object.defineProperty, fe = Object.getOwnPropertySymbols, Rs = Object.prototype.hasOwnProperty, Ts = Object.prototype.propertyIsEnumerable, ve = (n, t, e) => t in n ? Is(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, z = (n, t) => {
1225
+ for (var e in t || (t = {}))
1226
+ Rs.call(t, e) && ve(n, e, t[e]);
1227
+ if (fe)
1228
+ for (var e of fe(t))
1229
+ Ts.call(t, e) && ve(n, e, t[e]);
1230
+ return n;
1231
+ }, lt = (n, t, e) => new Promise((s, i) => {
1232
+ var r = (h) => {
1233
+ try {
1234
+ a(e.next(h));
1235
+ } catch (c) {
1236
+ i(c);
1237
+ }
1238
+ }, o = (h) => {
1239
+ try {
1240
+ a(e.throw(h));
1241
+ } catch (c) {
1242
+ i(c);
1243
+ }
1244
+ }, a = (h) => h.done ? s(h.value) : Promise.resolve(h.value).then(r, o);
1245
+ a((e = e.apply(n, t)).next());
1246
+ }), m = /* @__PURE__ */ ((n) => (n.Cookie = "cookie", n.Local = "local", n.Session = "session", n))(m || {}), K = /* @__PURE__ */ ((n) => (n.Tenant = "tenant", n.Implementation = "implementation", n.Widget = "widget", n))(K || {}), g = /* @__PURE__ */ ((n) => (n.Necessary = "necessary", n.Functional = "functional", n.Analytical = "analytical", n.Marketing = "marketing", n))(g || {});
1247
+ const P = (n, t, e, s = {}) => ye(n, e).then((i) => (process.env.NODE_ENV !== "production" && i && b.warn(
1248
+ `createStorageWriter: Attempted to create storage writer using unallowed category.
1249
+ Key: ${t}
1250
+ Category: ${JSON.stringify(e)}
1251
+ Options: ${JSON.stringify(s)}`
1252
+ ), (r) => (re(n), ye(n, e).then((o) => {
1253
+ if (o) {
1254
+ process.env.NODE_ENV !== "production" && b.warn(
1255
+ `storageWriter: Attempted to write to storage using unallowed category.
1256
+ Key: ${t}
1257
+ Category: ${JSON.stringify(e)}
1258
+ Value: ${JSON.stringify(r)}
1259
+ Options: ${JSON.stringify(s)}`
1260
+ );
1261
+ return;
1262
+ }
1263
+ const {
1264
+ scope: a = K.Widget,
1265
+ medium: h = m.Session,
1266
+ duration: c
1267
+ } = s, l = Vs();
1268
+ return l[a][t] = ie(r, e, c), h === m.Cookie ? Bs(n, l) : qs(n, h, l);
1269
+ })))), x = (n, t, e = m.Session) => (re(n), typeof t > "u" ? (process.env.NODE_ENV !== "production" && b.warn("readStorage: Undefined key passed when reading storage. ", t, e), Promise.resolve(void 0)) : e === m.Cookie ? zs(n).then((s) => wt(s, t)) : Ws(n, e).then((s) => wt(s, t))), W = (n) => !!Object.entries(n).filter(([t, e]) => typeof e < "u").length, Rt = (n) => Object.entries(n).filter(([t, e]) => typeof e < "u").forEach(([t, { value: e }]) => {
1270
+ typeof e > "u" && delete n[t];
1271
+ }), Be = (n, t) => {
1272
+ const e = {
1273
+ tenant: z(z({}, n.tenant), t.tenant),
1274
+ implementation: z(z({}, n.implementation), t.implementation),
1275
+ widget: z(z({}, n.widget), t.widget)
1276
+ };
1277
+ return Rt(e.tenant), Rt(e.implementation), Rt(e.widget), e;
1278
+ }, js = (n) => Object.entries(n).reduce((t, e) => {
1279
+ const [s, i] = e;
1280
+ return Object.entries(i).forEach((r) => {
1281
+ const [o, { expiration: a }] = r;
1282
+ a && t.push(a);
1283
+ }), t;
1284
+ }, []).slice().sort((t, e) => new Date(e).valueOf() - new Date(t).valueOf()).shift() || St(), xt = (n) => {
1285
+ const {
1286
+ name: t,
1287
+ implementation: { name: e, tenant: s }
1288
+ } = n.get("$widget");
1289
+ return [
1290
+ `humany_${s}`,
1291
+ `humany_${pe(s + e)}`,
1292
+ `humany_${pe(s + e + t)}`
1293
+ ];
1294
+ }, Tt = (n) => {
1295
+ const t = new RegExp(`(?:^|;)\\s?${n}=(.*?)(?:;|$)`, "i"), e = document.cookie.match(t);
1296
+ return e && e[1] && JSON.parse(e[1]) || void 0;
1297
+ }, jt = (n, t, e) => {
1298
+ const s = `${n}=${JSON.stringify(t).trim()}`, i = `expires=${new Date(e).toUTCString()}`, r = "path=/", o = "SameSite=None;Secure";
1299
+ return document.cookie = `${s}; ${i}; ${r}; ${o}`;
1300
+ }, ne = (n) => {
1301
+ const [t, e, s] = xt(n), i = Tt(t) || {}, r = Tt(e) || {}, o = Tt(s) || {};
1302
+ return {
1303
+ tenant: i,
1304
+ implementation: r,
1305
+ widget: o
1306
+ };
1307
+ }, We = (n, t) => {
1308
+ const e = ne(n), s = Be(e, t), [i, r, o] = xt(n), { tenant: a, implementation: h, widget: c } = s, l = js(t), d = St({ days: -1 });
1309
+ jt(i, a, W(a) ? l : d), jt(
1310
+ r,
1311
+ h,
1312
+ W(h) ? l : d
1313
+ ), jt(o, c, W(c) ? l : d);
1314
+ }, bt = (n, t) => {
1315
+ const [e, s, i] = xt(n), r = t.getItem(e) || "{}", o = t.getItem(s) || "{}", a = t.getItem(i) || "{}";
1316
+ return {
1317
+ tenant: JSON.parse(r),
1318
+ implementation: JSON.parse(o),
1319
+ widget: JSON.parse(a)
1320
+ };
1321
+ }, Zt = (n, t, e) => {
1322
+ const s = bt(n, t), i = Be(s, e), [r, o, a] = xt(n), { tenant: h, implementation: c, widget: l } = i;
1323
+ W(h) ? t.setItem(r, JSON.stringify(h)) : t.removeItem(r), W(c) ? t.setItem(o, JSON.stringify(c)) : t.removeItem(o), W(l) ? t.setItem(a, JSON.stringify(l)) : t.removeItem(a);
1324
+ }, Vs = () => ({ tenant: {}, implementation: {}, widget: {} }), Us = (n) => n ? !!n && /* @__PURE__ */ new Date() > new Date(n) : !1, wt = (n, t) => {
1325
+ const e = n.widget[t] || n.implementation[t] || n.tenant[t];
1326
+ return e == null ? void 0 : e.value;
1327
+ }, ie = (n, t, e) => e ? {
1328
+ value: n,
1329
+ category: t,
1330
+ expiration: typeof e == "object" ? St(e) : e
1331
+ } : {
1332
+ value: n,
1333
+ category: t
1334
+ }, gt = (n, t) => {
1335
+ const e = us(n);
1336
+ return Object.entries(e).forEach(([s, i]) => {
1337
+ Object.entries(i).forEach(([r, o]) => {
1338
+ const { expiration: a, category: h } = o;
1339
+ (Us(a) || Hs(t, h)) && (i[r] = ie(void 0, h, a));
1340
+ });
1341
+ }), e;
1342
+ }, ye = (n, t) => x(n, "storagePolicy", m.Cookie).then(
1343
+ (e = [g.Necessary]) => !!t && e.indexOf(t) === -1
1344
+ ), Hs = (n = [g.Necessary], t) => !!t && n.indexOf(t) === -1, re = (n) => {
1345
+ const t = ne(n), e = bt(n, window.localStorage), s = bt(n, sessionStorage), i = wt(t, "storagePolicy"), [r, o, a] = [
1346
+ t,
1347
+ e,
1348
+ s
1349
+ ].map((h) => gt(h, i));
1350
+ We(n, r), Zt(n, window.localStorage, o), Zt(n, window.sessionStorage, a);
1351
+ }, St = (n = { days: 30 }) => {
1352
+ const { days: t = 0, hours: e = 0, minutes: s = 0, seconds: i = 0 } = n, r = /* @__PURE__ */ new Date();
1353
+ return r.setTime(r.getTime() + e * 60 * 60 * 1e3), r.setTime(r.getTime() + t * 24 * 60 * 60 * 1e3), r.setTime(r.getTime() + s * 60 * 1e3), r.setTime(r.getTime() + i * 1e3), r.toISOString();
1354
+ }, zs = (n) => C(document)(() => ne(n)), Bs = (n, t) => C(document)(() => We(n, t)), Ws = (n, t) => {
1355
+ const e = t === m.Local ? window.localStorage : window.sessionStorage;
1356
+ return C(e)(() => bt(n, e));
1357
+ }, qs = (n, t, e) => {
1358
+ const s = t === m.Local ? window.localStorage : window.sessionStorage;
1359
+ return C(s)(() => Zt(n, s, e));
1360
+ };
1361
+ let mt = class {
1362
+ constructor() {
1363
+ this.memory = {
1364
+ tenant: {},
1365
+ implementation: {},
1366
+ widget: {}
1367
+ };
1368
+ }
1369
+ setItem(t, e) {
1370
+ return lt(this, arguments, function* (s, i, r = {}) {
1371
+ return C(this)(() => {
1372
+ const o = gt(this.memory, [g.Necessary]), { scope: a = K.Tenant, expiration: h } = r;
1373
+ o[a][s] = ie(
1374
+ i,
1375
+ g.Necessary,
1376
+ (h == null ? void 0 : h.toISOString()) || St()
1377
+ ), this.memory = o, process.env.NODE_ENV !== "production" && b.warn(
1378
+ `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value stored temporarily in memory.
1379
+ Key: ${s}
1380
+ Value: ${JSON.stringify(i)}
1381
+ Options: ${JSON.stringify(r)}
1382
+ Memory: ${JSON.stringify(o)}`
1383
+ );
1384
+ });
1385
+ });
1386
+ }
1387
+ getItem(t) {
1388
+ return lt(this, null, function* () {
1389
+ return C(this)(() => {
1390
+ const e = gt(this.memory, [g.Necessary]);
1391
+ process.env.NODE_ENV !== "production" && b.warn(
1392
+ `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value fetched from legacy memory storage.
1393
+ Key: ${t}
1394
+ Memory: ${JSON.stringify(e)}`
1395
+ );
1396
+ const s = wt(e, t);
1397
+ return this.memory = e, s;
1398
+ });
1399
+ });
1400
+ }
1401
+ removeItem(t) {
1402
+ return lt(this, null, function* () {
1403
+ return C(this)(() => {
1404
+ const e = gt(this.memory, [g.Necessary]);
1405
+ delete e.tenant[t], delete e.implementation[t], delete e.widget[t], this.memory = e, process.env.NODE_ENV !== "production" && b.warn(
1406
+ `StorageProvider: StorageProvider is deprecated, use createStorageWriter and readStorage instead, value removed from memory.
1407
+ Key: ${t}
1408
+ Memory: ${JSON.stringify(e)}`
1409
+ );
1410
+ });
1411
+ });
1412
+ }
1413
+ clear() {
1414
+ return lt(this, null, function* () {
1415
+ return Promise.resolve();
1416
+ });
1417
+ }
1418
+ };
1419
+ class Js {
1420
+ constructor() {
1421
+ this.cookies = new mt(), this.session = new mt(), this.local = new mt();
1422
+ }
1423
+ }
1424
+ const Vt = (n, t, e, ...s) => {
1425
+ const i = `[${n.get("$environment").name || "webprovisions"}] ${e}`;
1426
+ switch (t) {
1427
+ case "info":
1428
+ console.info(i, ...s);
1429
+ break;
1430
+ case "warning":
1431
+ console.warn(i, ...s);
1432
+ break;
1433
+ case "error":
1434
+ console.error(i, ...s);
1435
+ break;
1436
+ }
1437
+ }, Fs = (n) => {
1438
+ const t = n.container || n;
1439
+ return {
1440
+ info: (e, ...s) => Vt(t, "info", e, ...s),
1441
+ warn: (e, ...s) => Vt(t, "warning", e, ...s),
1442
+ error: (e, ...s) => Vt(t, "error", e, ...s)
1443
+ };
1444
+ };
1445
+ var $t = /* @__PURE__ */ ((n) => (n.Implementation = "implementation", n.Widget = "widget", n))($t || {}), R = /* @__PURE__ */ ((n) => (n.Pre = "pre", n.Post = "post", n))(R || {});
1446
+ const Ks = (n, t, e, s) => {
1447
+ try {
1448
+ const i = new t(e, s);
1449
+ return {
1450
+ name: n,
1451
+ invoke: (r, o) => {
1452
+ let a;
1453
+ return i[r] && (a = i[r].call(i, o)), Promise.resolve(a);
1454
+ },
1455
+ getInstance: () => i
1456
+ };
1457
+ } catch (i) {
1458
+ if (i.message && i.message.indexOf("is not a constructor") >= 0)
1459
+ return {
1460
+ name: n,
1461
+ invoke: (r) => {
1462
+ let o;
1463
+ return r === "initialize" && (o = t(e, s)), Promise.resolve(o);
1464
+ },
1465
+ getInstance: () => t
1466
+ };
1467
+ throw i;
1468
+ }
1469
+ };
1470
+ function be(n, t) {
1471
+ return typeof n > "u" ? t : n;
1472
+ }
1473
+ class Gs {
1474
+ constructor(t = {}) {
1475
+ this.part = t;
1476
+ }
1477
+ createCommand(t, e, s) {
1478
+ let i;
1479
+ typeof e == "function" ? i = {
1480
+ scope: $t.Widget,
1481
+ stage: R.Post,
1482
+ defaultArgs: void 0,
1483
+ handlerResolver: e
1484
+ } : i = {
1485
+ scope: be(e.scope, $t.Widget),
1486
+ stage: be(e.stage, R.Post),
1487
+ defaultArgs: e.defaultArgs,
1488
+ handlerResolver: s
1489
+ };
1490
+ let r = this.part;
1491
+ const o = t.split(".");
1492
+ return o.forEach((a, h) => {
1493
+ h === o.length - 1 ? r[a] || (r[a] = () => i) : r = this.part[a] = this.part[a] || {};
1494
+ }), this;
1495
+ }
1496
+ get() {
1497
+ return this.part;
1498
+ }
1499
+ }
1500
+ const qe = (n) => {
1501
+ const t = new Gs({});
1502
+ return n(t), t.get();
1503
+ };
1504
+ qe((n) => {
1505
+ n.createCommand(
1506
+ "types.register",
1507
+ { scope: $t.Implementation, stage: R.Pre },
1508
+ (t) => (e, s) => {
1509
+ t.container.get("$types")[e] = s;
1510
+ }
1511
+ ).createCommand(
1512
+ "type",
1513
+ { stage: R.Pre },
1514
+ (t) => (e) => {
1515
+ t.container.register("$type", e);
1516
+ }
1517
+ ).createCommand(
1518
+ "settings",
1519
+ { stage: R.Pre, defaultArgs: [null] },
1520
+ (t) => (e) => {
1521
+ t.events.dispatch(
1522
+ "settings:change",
1523
+ e,
1524
+ { bubbles: !0 }
1525
+ ), t.container.register("$settings", e);
1526
+ }
1527
+ ).createCommand(
1528
+ "plugin",
1529
+ { stage: R.Pre },
1530
+ (t) => (e, s, i) => {
1531
+ const { container: r } = t;
1532
+ let o = null, a = e, h = s;
1533
+ typeof e == "string" && (o = e, a = s, h = i);
1534
+ const c = (l) => {
1535
+ const { transformPluginSettings: d } = t.container.get("$environmentOptions"), u = d ? d(
1536
+ h || {},
1537
+ o,
1538
+ t.container,
1539
+ a
1540
+ ) : s;
1541
+ try {
1542
+ const p = Ks(
1543
+ o,
1544
+ a,
1545
+ r,
1546
+ u
1547
+ );
1548
+ r.get("$plugins").push(p), l && p.invoke("initialize", null);
1549
+ } catch (p) {
1550
+ Fs(t).warn("Error when initializing plugin", p);
1551
+ }
1552
+ };
1553
+ t.container.get("$instance") ? c(!0) : t.events.subscribeOnce("widget:instance-created", () => c(!1));
1554
+ }
1555
+ ).createCommand(
1556
+ "container.register",
1557
+ (t) => (e, s) => {
1558
+ t.container.register(e, s);
1559
+ }
1560
+ ).createCommand(
1561
+ "container.registerAsync",
1562
+ (t) => (e, s) => {
1563
+ t.container.registerAsync(e, s);
1564
+ }
1565
+ ).createCommand(
1566
+ "container.registerFactory",
1567
+ (t) => (e, s) => {
1568
+ t.container.registerFactory(e, s);
1569
+ }
1570
+ ).createCommand(
1571
+ "container.touch",
1572
+ (t) => (e, s) => {
1573
+ t.container.touch(e, s);
1574
+ }
1575
+ ).createCommand(
1576
+ "csp",
1577
+ {},
1578
+ (t) => (e) => {
1579
+ t.container.register("csp", e);
1580
+ }
1581
+ );
1582
+ });
1583
+ qe((n) => {
1584
+ n.createCommand("storage", (t) => (e = {}) => {
1585
+ const { consent: s } = e;
1586
+ if (typeof s < "u") {
1587
+ if (typeof s != "number" && typeof s != "string" && !Array.isArray(s)) {
1588
+ process.env.NODE_ENV !== "production" && b.warn(
1589
+ `storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.
1590
+ Passed consent: ${JSON.stringify(s)}`
1591
+ );
1592
+ return;
1593
+ }
1594
+ if (Array.isArray(s) && !s.every(
1595
+ (r) => typeof r == "number" || typeof r == "string"
1596
+ )) {
1597
+ process.env.NODE_ENV !== "production" && b.warn(
1598
+ `storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.
1599
+ Passed consent: ${JSON.stringify(s)}`
1600
+ );
1601
+ return;
1602
+ }
1603
+ const i = [
1604
+ g.Necessary,
1605
+ g.Functional,
1606
+ g.Analytical,
1607
+ g.Marketing
1608
+ ].filter((r, o, a) => typeof s == "number" ? s > o : typeof s == "string" ? a.indexOf(s) + 1 > o : Array.isArray(s) ? s.findIndex((h) => h === o + 1 || h === r) > -1 : !0);
1609
+ return i.indexOf(g.Necessary) === -1 && (process.env.NODE_ENV !== "production" && b.warn(
1610
+ `storagePolicyConfigurationApi: passed consent does not include category: '${g.Necessary}'. Consent has to atleast include the '${g.Necessary}' category.
1611
+ Passed consent: ${JSON.stringify(s)}`
1612
+ ), i.unshift(g.Necessary)), P(
1613
+ t.container,
1614
+ "storagePolicy",
1615
+ g.Necessary,
1616
+ {
1617
+ medium: m.Cookie,
1618
+ scope: K.Tenant,
1619
+ duration: { days: 365 }
1620
+ }
1621
+ ).then((r) => r(i)).then(() => {
1622
+ re(t.container), t.events.dispatch("storage:policy-changed", i);
1623
+ });
1624
+ }
1625
+ });
1626
+ });
1627
+ const Ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1628
+ __proto__: null,
1629
+ StorageCategory: g,
1630
+ StorageMedium: m,
1631
+ StorageProvider: Js,
1632
+ StorageScope: K,
1633
+ StorageService: mt,
1634
+ createStorageWriter: P,
1635
+ readStorage: x
1636
+ }, Symbol.toStringTag, { value: "Module" })), Zs = (n) => {
1637
+ const t = (i, r) => {
1638
+ i && (r ? i.classList.add("ace-tabbing") : i.classList.remove("ace-tabbing"));
1639
+ }, e = (i) => {
1640
+ i.key === "Tab" ? t(n, !0) : i.key === "Enter" && document.activeElement && document.activeElement.classList.contains("ace-widget-trigger") || t(n, !1);
1641
+ }, s = (i) => {
1642
+ document.activeElement && document.activeElement.classList.contains("ace-widget-trigger") && document.activeElement.classList.contains("ace-tabbing") || t(n, !1);
1643
+ };
1644
+ return document.addEventListener("keydown", e), document.addEventListener("click", s), () => {
1645
+ document.removeEventListener("keydown", e), document.removeEventListener("click", s);
1646
+ };
1647
+ };
1648
+ function Qs(n, t) {
1649
+ const {
1650
+ // symbol,
1651
+ widgetName: e,
1652
+ label: s = "",
1653
+ ariaLabel: i = "",
1654
+ tooltip: r = ""
1655
+ } = t;
1656
+ return n.classList.add("ace-widget-trigger"), n.classList.add(`ace-widget_${e}`), s.length && n.classList.add("trigger-has-text"), i.length && !n.getAttribute("aria-label") && n.setAttribute("aria-label", i), i.length && !n.getAttribute("tabindex") && n.setAttribute("tabindex", "0"), r.length && !n.getAttribute("title") && n.setAttribute("title", r), Zs(n);
1657
+ }
1658
+ function Xs(n, t) {
1659
+ n instanceof HTMLElement ? (t && n.setAttribute("title", t), n.classList.remove("ace-trigger-active"), n.classList.remove("ace-trigger-loading")) : n instanceof Array && n.forEach((e) => {
1660
+ t && e.setAttribute("title", t), e.classList.remove("ace-trigger-active"), e.classList.remove("ace-trigger-loading");
1661
+ });
1662
+ }
1663
+ function tn(n) {
1664
+ n instanceof HTMLElement ? (n.classList.remove("ace-trigger-active"), n.classList.add("ace-trigger-loading")) : n instanceof Array && n.forEach((t) => {
1665
+ t.classList.remove("ace-trigger-active"), t.classList.add("ace-trigger-loading");
1666
+ });
1667
+ }
1668
+ function Je(n, t) {
1669
+ n instanceof HTMLElement ? (t && n.setAttribute("title", t), n.classList.add("ace-trigger-active"), n.classList.remove("ace-trigger-loading")) : n instanceof Array && n.forEach((e) => {
1670
+ t && e.setAttribute("title", t), e.classList.add("ace-trigger-active"), e.classList.remove("ace-trigger-loading");
1671
+ });
1672
+ }
1673
+ /**
1674
+ * @license
1675
+ * Copyright 2019 Google LLC
1676
+ * SPDX-License-Identifier: BSD-3-Clause
1677
+ */
1678
+ const ft = window, oe = ft.ShadowRoot && (ft.ShadyCSS === void 0 || ft.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ae = Symbol(), we = /* @__PURE__ */ new WeakMap();
1679
+ let Fe = class {
1680
+ constructor(t, e, s) {
1681
+ if (this._$cssResult$ = !0, s !== ae)
1682
+ throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
1683
+ this.cssText = t, this.t = e;
1684
+ }
1685
+ get styleSheet() {
1686
+ let t = this.o;
1687
+ const e = this.t;
1688
+ if (oe && t === void 0) {
1689
+ const s = e !== void 0 && e.length === 1;
1690
+ s && (t = we.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && we.set(e, t));
1691
+ }
1692
+ return t;
1693
+ }
1694
+ toString() {
1695
+ return this.cssText;
1696
+ }
1697
+ };
1698
+ const en = (n) => new Fe(typeof n == "string" ? n : n + "", void 0, ae), Ke = (n, ...t) => {
1699
+ const e = n.length === 1 ? n[0] : t.reduce((s, i, r) => s + ((o) => {
1700
+ if (o._$cssResult$ === !0)
1701
+ return o.cssText;
1702
+ if (typeof o == "number")
1703
+ return o;
1704
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + o + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
1705
+ })(i) + n[r + 1], n[0]);
1706
+ return new Fe(e, n, ae);
1707
+ }, sn = (n, t) => {
1708
+ oe ? n.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet) : t.forEach((e) => {
1709
+ const s = document.createElement("style"), i = ft.litNonce;
1710
+ i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, n.appendChild(s);
1711
+ });
1712
+ }, $e = oe ? (n) => n : (n) => n instanceof CSSStyleSheet ? ((t) => {
1713
+ let e = "";
1714
+ for (const s of t.cssRules)
1715
+ e += s.cssText;
1716
+ return en(e);
1717
+ })(n) : n;
1718
+ /**
1719
+ * @license
1720
+ * Copyright 2017 Google LLC
1721
+ * SPDX-License-Identifier: BSD-3-Clause
1722
+ */
1723
+ var Ut;
1724
+ const _t = window, _e = _t.trustedTypes, nn = _e ? _e.emptyScript : "", Ee = _t.reactiveElementPolyfillSupport, Qt = { toAttribute(n, t) {
1725
+ switch (t) {
1726
+ case Boolean:
1727
+ n = n ? nn : null;
1728
+ break;
1729
+ case Object:
1730
+ case Array:
1731
+ n = n == null ? n : JSON.stringify(n);
1732
+ }
1733
+ return n;
1734
+ }, fromAttribute(n, t) {
1735
+ let e = n;
1736
+ switch (t) {
1737
+ case Boolean:
1738
+ e = n !== null;
1739
+ break;
1740
+ case Number:
1741
+ e = n === null ? null : Number(n);
1742
+ break;
1743
+ case Object:
1744
+ case Array:
1745
+ try {
1746
+ e = JSON.parse(n);
1747
+ } catch {
1748
+ e = null;
1749
+ }
1750
+ }
1751
+ return e;
1752
+ } }, Ge = (n, t) => t !== n && (t == t || n == n), Ht = { attribute: !0, type: String, converter: Qt, reflect: !1, hasChanged: Ge }, Xt = "finalized";
1753
+ let B = class extends HTMLElement {
1754
+ constructor() {
1755
+ super(), this._$Ei = /* @__PURE__ */ new Map(), this.isUpdatePending = !1, this.hasUpdated = !1, this._$El = null, this._$Eu();
1756
+ }
1757
+ static addInitializer(t) {
1758
+ var e;
1759
+ this.finalize(), ((e = this.h) !== null && e !== void 0 ? e : this.h = []).push(t);
1760
+ }
1761
+ static get observedAttributes() {
1762
+ this.finalize();
1763
+ const t = [];
1764
+ return this.elementProperties.forEach((e, s) => {
1765
+ const i = this._$Ep(s, e);
1766
+ i !== void 0 && (this._$Ev.set(i, s), t.push(i));
1767
+ }), t;
1768
+ }
1769
+ static createProperty(t, e = Ht) {
1770
+ if (e.state && (e.attribute = !1), this.finalize(), this.elementProperties.set(t, e), !e.noAccessor && !this.prototype.hasOwnProperty(t)) {
1771
+ const s = typeof t == "symbol" ? Symbol() : "__" + t, i = this.getPropertyDescriptor(t, s, e);
1772
+ i !== void 0 && Object.defineProperty(this.prototype, t, i);
1773
+ }
1774
+ }
1775
+ static getPropertyDescriptor(t, e, s) {
1776
+ return { get() {
1777
+ return this[e];
1778
+ }, set(i) {
1779
+ const r = this[t];
1780
+ this[e] = i, this.requestUpdate(t, r, s);
1781
+ }, configurable: !0, enumerable: !0 };
1782
+ }
1783
+ static getPropertyOptions(t) {
1784
+ return this.elementProperties.get(t) || Ht;
1785
+ }
1786
+ static finalize() {
1787
+ if (this.hasOwnProperty(Xt))
1788
+ return !1;
1789
+ this[Xt] = !0;
1790
+ const t = Object.getPrototypeOf(this);
1791
+ if (t.finalize(), t.h !== void 0 && (this.h = [...t.h]), this.elementProperties = new Map(t.elementProperties), this._$Ev = /* @__PURE__ */ new Map(), this.hasOwnProperty("properties")) {
1792
+ const e = this.properties, s = [...Object.getOwnPropertyNames(e), ...Object.getOwnPropertySymbols(e)];
1793
+ for (const i of s)
1794
+ this.createProperty(i, e[i]);
1795
+ }
1796
+ return this.elementStyles = this.finalizeStyles(this.styles), !0;
1797
+ }
1798
+ static finalizeStyles(t) {
1799
+ const e = [];
1800
+ if (Array.isArray(t)) {
1801
+ const s = new Set(t.flat(1 / 0).reverse());
1802
+ for (const i of s)
1803
+ e.unshift($e(i));
1804
+ } else
1805
+ t !== void 0 && e.push($e(t));
1806
+ return e;
1807
+ }
1808
+ static _$Ep(t, e) {
1809
+ const s = e.attribute;
1810
+ return s === !1 ? void 0 : typeof s == "string" ? s : typeof t == "string" ? t.toLowerCase() : void 0;
1811
+ }
1812
+ _$Eu() {
1813
+ var t;
1814
+ this._$E_ = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$Eg(), this.requestUpdate(), (t = this.constructor.h) === null || t === void 0 || t.forEach((e) => e(this));
1815
+ }
1816
+ addController(t) {
1817
+ var e, s;
1818
+ ((e = this._$ES) !== null && e !== void 0 ? e : this._$ES = []).push(t), this.renderRoot !== void 0 && this.isConnected && ((s = t.hostConnected) === null || s === void 0 || s.call(t));
1819
+ }
1820
+ removeController(t) {
1821
+ var e;
1822
+ (e = this._$ES) === null || e === void 0 || e.splice(this._$ES.indexOf(t) >>> 0, 1);
1823
+ }
1824
+ _$Eg() {
1825
+ this.constructor.elementProperties.forEach((t, e) => {
1826
+ this.hasOwnProperty(e) && (this._$Ei.set(e, this[e]), delete this[e]);
1827
+ });
1828
+ }
1829
+ createRenderRoot() {
1830
+ var t;
1831
+ const e = (t = this.shadowRoot) !== null && t !== void 0 ? t : this.attachShadow(this.constructor.shadowRootOptions);
1832
+ return sn(e, this.constructor.elementStyles), e;
1833
+ }
1834
+ connectedCallback() {
1835
+ var t;
1836
+ this.renderRoot === void 0 && (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (t = this._$ES) === null || t === void 0 || t.forEach((e) => {
1837
+ var s;
1838
+ return (s = e.hostConnected) === null || s === void 0 ? void 0 : s.call(e);
1839
+ });
1840
+ }
1841
+ enableUpdating(t) {
1842
+ }
1843
+ disconnectedCallback() {
1844
+ var t;
1845
+ (t = this._$ES) === null || t === void 0 || t.forEach((e) => {
1846
+ var s;
1847
+ return (s = e.hostDisconnected) === null || s === void 0 ? void 0 : s.call(e);
1848
+ });
1849
+ }
1850
+ attributeChangedCallback(t, e, s) {
1851
+ this._$AK(t, s);
1852
+ }
1853
+ _$EO(t, e, s = Ht) {
1854
+ var i;
1855
+ const r = this.constructor._$Ep(t, s);
1856
+ if (r !== void 0 && s.reflect === !0) {
1857
+ const o = (((i = s.converter) === null || i === void 0 ? void 0 : i.toAttribute) !== void 0 ? s.converter : Qt).toAttribute(e, s.type);
1858
+ this._$El = t, o == null ? this.removeAttribute(r) : this.setAttribute(r, o), this._$El = null;
1859
+ }
1860
+ }
1861
+ _$AK(t, e) {
1862
+ var s;
1863
+ const i = this.constructor, r = i._$Ev.get(t);
1864
+ if (r !== void 0 && this._$El !== r) {
1865
+ const o = i.getPropertyOptions(r), a = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((s = o.converter) === null || s === void 0 ? void 0 : s.fromAttribute) !== void 0 ? o.converter : Qt;
1866
+ this._$El = r, this[r] = a.fromAttribute(e, o.type), this._$El = null;
1867
+ }
1868
+ }
1869
+ requestUpdate(t, e, s) {
1870
+ let i = !0;
1871
+ t !== void 0 && (((s = s || this.constructor.getPropertyOptions(t)).hasChanged || Ge)(this[t], e) ? (this._$AL.has(t) || this._$AL.set(t, e), s.reflect === !0 && this._$El !== t && (this._$EC === void 0 && (this._$EC = /* @__PURE__ */ new Map()), this._$EC.set(t, s))) : i = !1), !this.isUpdatePending && i && (this._$E_ = this._$Ej());
1872
+ }
1873
+ async _$Ej() {
1874
+ this.isUpdatePending = !0;
1875
+ try {
1876
+ await this._$E_;
1877
+ } catch (e) {
1878
+ Promise.reject(e);
1879
+ }
1880
+ const t = this.scheduleUpdate();
1881
+ return t != null && await t, !this.isUpdatePending;
1882
+ }
1883
+ scheduleUpdate() {
1884
+ return this.performUpdate();
1885
+ }
1886
+ performUpdate() {
1887
+ var t;
1888
+ if (!this.isUpdatePending)
1889
+ return;
1890
+ this.hasUpdated, this._$Ei && (this._$Ei.forEach((i, r) => this[r] = i), this._$Ei = void 0);
1891
+ let e = !1;
1892
+ const s = this._$AL;
1893
+ try {
1894
+ e = this.shouldUpdate(s), e ? (this.willUpdate(s), (t = this._$ES) === null || t === void 0 || t.forEach((i) => {
1895
+ var r;
1896
+ return (r = i.hostUpdate) === null || r === void 0 ? void 0 : r.call(i);
1897
+ }), this.update(s)) : this._$Ek();
1898
+ } catch (i) {
1899
+ throw e = !1, this._$Ek(), i;
1900
+ }
1901
+ e && this._$AE(s);
1902
+ }
1903
+ willUpdate(t) {
1904
+ }
1905
+ _$AE(t) {
1906
+ var e;
1907
+ (e = this._$ES) === null || e === void 0 || e.forEach((s) => {
1908
+ var i;
1909
+ return (i = s.hostUpdated) === null || i === void 0 ? void 0 : i.call(s);
1910
+ }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
1911
+ }
1912
+ _$Ek() {
1913
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
1914
+ }
1915
+ get updateComplete() {
1916
+ return this.getUpdateComplete();
1917
+ }
1918
+ getUpdateComplete() {
1919
+ return this._$E_;
1920
+ }
1921
+ shouldUpdate(t) {
1922
+ return !0;
1923
+ }
1924
+ update(t) {
1925
+ this._$EC !== void 0 && (this._$EC.forEach((e, s) => this._$EO(s, this[s], e)), this._$EC = void 0), this._$Ek();
1926
+ }
1927
+ updated(t) {
1928
+ }
1929
+ firstUpdated(t) {
1930
+ }
1931
+ };
1932
+ B[Xt] = !0, B.elementProperties = /* @__PURE__ */ new Map(), B.elementStyles = [], B.shadowRootOptions = { mode: "open" }, Ee == null || Ee({ ReactiveElement: B }), ((Ut = _t.reactiveElementVersions) !== null && Ut !== void 0 ? Ut : _t.reactiveElementVersions = []).push("1.6.3");
1933
+ /**
1934
+ * @license
1935
+ * Copyright 2017 Google LLC
1936
+ * SPDX-License-Identifier: BSD-3-Clause
1937
+ */
1938
+ var zt;
1939
+ const Et = window, q = Et.trustedTypes, Ae = q ? q.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, te = "$lit$", k = `lit$${(Math.random() + "").slice(9)}$`, Ye = "?" + k, rn = `<${Ye}>`, V = document, tt = () => V.createComment(""), et = (n) => n === null || typeof n != "object" && typeof n != "function", Ze = Array.isArray, on = (n) => Ze(n) || typeof (n == null ? void 0 : n[Symbol.iterator]) == "function", Bt = `[
1940
+ \f\r]`, G = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Ce = /-->/g, Oe = />/g, L = RegExp(`>|${Bt}(?:([^\\s"'>=/]+)(${Bt}*=${Bt}*(?:[^
1941
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), xe = /'/g, Se = /"/g, Qe = /^(?:script|style|textarea|title)$/i, an = (n) => (t, ...e) => ({ _$litType$: n, strings: t, values: e }), dt = an(1), U = Symbol.for("lit-noChange"), f = Symbol.for("lit-nothing"), Pe = /* @__PURE__ */ new WeakMap(), T = V.createTreeWalker(V, 129, null, !1);
1942
+ function Xe(n, t) {
1943
+ if (!Array.isArray(n) || !n.hasOwnProperty("raw"))
1944
+ throw Error("invalid template strings array");
1945
+ return Ae !== void 0 ? Ae.createHTML(t) : t;
1946
+ }
1947
+ const cn = (n, t) => {
1948
+ const e = n.length - 1, s = [];
1949
+ let i, r = t === 2 ? "<svg>" : "", o = G;
1950
+ for (let a = 0; a < e; a++) {
1951
+ const h = n[a];
1952
+ let c, l, d = -1, u = 0;
1953
+ for (; u < h.length && (o.lastIndex = u, l = o.exec(h), l !== null); )
1954
+ u = o.lastIndex, o === G ? l[1] === "!--" ? o = Ce : l[1] !== void 0 ? o = Oe : l[2] !== void 0 ? (Qe.test(l[2]) && (i = RegExp("</" + l[2], "g")), o = L) : l[3] !== void 0 && (o = L) : o === L ? l[0] === ">" ? (o = i ?? G, d = -1) : l[1] === void 0 ? d = -2 : (d = o.lastIndex - l[2].length, c = l[1], o = l[3] === void 0 ? L : l[3] === '"' ? Se : xe) : o === Se || o === xe ? o = L : o === Ce || o === Oe ? o = G : (o = L, i = void 0);
1955
+ const p = o === L && n[a + 1].startsWith("/>") ? " " : "";
1956
+ r += o === G ? h + rn : d >= 0 ? (s.push(c), h.slice(0, d) + te + h.slice(d) + k + p) : h + k + (d === -2 ? (s.push(void 0), a) : p);
1957
+ }
1958
+ return [Xe(n, r + (n[e] || "<?>") + (t === 2 ? "</svg>" : "")), s];
1959
+ };
1960
+ class st {
1961
+ constructor({ strings: t, _$litType$: e }, s) {
1962
+ let i;
1963
+ this.parts = [];
1964
+ let r = 0, o = 0;
1965
+ const a = t.length - 1, h = this.parts, [c, l] = cn(t, e);
1966
+ if (this.el = st.createElement(c, s), T.currentNode = this.el.content, e === 2) {
1967
+ const d = this.el.content, u = d.firstChild;
1968
+ u.remove(), d.append(...u.childNodes);
1969
+ }
1970
+ for (; (i = T.nextNode()) !== null && h.length < a; ) {
1971
+ if (i.nodeType === 1) {
1972
+ if (i.hasAttributes()) {
1973
+ const d = [];
1974
+ for (const u of i.getAttributeNames())
1975
+ if (u.endsWith(te) || u.startsWith(k)) {
1976
+ const p = l[o++];
1977
+ if (d.push(u), p !== void 0) {
1978
+ const v = i.getAttribute(p.toLowerCase() + te).split(k), y = /([.?@])?(.*)/.exec(p);
1979
+ h.push({ type: 1, index: r, name: y[2], strings: v, ctor: y[1] === "." ? ln : y[1] === "?" ? un : y[1] === "@" ? pn : Pt });
1980
+ } else
1981
+ h.push({ type: 6, index: r });
1982
+ }
1983
+ for (const u of d)
1984
+ i.removeAttribute(u);
1985
+ }
1986
+ if (Qe.test(i.tagName)) {
1987
+ const d = i.textContent.split(k), u = d.length - 1;
1988
+ if (u > 0) {
1989
+ i.textContent = q ? q.emptyScript : "";
1990
+ for (let p = 0; p < u; p++)
1991
+ i.append(d[p], tt()), T.nextNode(), h.push({ type: 2, index: ++r });
1992
+ i.append(d[u], tt());
1993
+ }
1994
+ }
1995
+ } else if (i.nodeType === 8)
1996
+ if (i.data === Ye)
1997
+ h.push({ type: 2, index: r });
1998
+ else {
1999
+ let d = -1;
2000
+ for (; (d = i.data.indexOf(k, d + 1)) !== -1; )
2001
+ h.push({ type: 7, index: r }), d += k.length - 1;
2002
+ }
2003
+ r++;
2004
+ }
2005
+ }
2006
+ static createElement(t, e) {
2007
+ const s = V.createElement("template");
2008
+ return s.innerHTML = t, s;
2009
+ }
2010
+ }
2011
+ function J(n, t, e = n, s) {
2012
+ var i, r, o, a;
2013
+ if (t === U)
2014
+ return t;
2015
+ let h = s !== void 0 ? (i = e._$Co) === null || i === void 0 ? void 0 : i[s] : e._$Cl;
2016
+ const c = et(t) ? void 0 : t._$litDirective$;
2017
+ return (h == null ? void 0 : h.constructor) !== c && ((r = h == null ? void 0 : h._$AO) === null || r === void 0 || r.call(h, !1), c === void 0 ? h = void 0 : (h = new c(n), h._$AT(n, e, s)), s !== void 0 ? ((o = (a = e)._$Co) !== null && o !== void 0 ? o : a._$Co = [])[s] = h : e._$Cl = h), h !== void 0 && (t = J(n, h._$AS(n, t.values), h, s)), t;
2018
+ }
2019
+ class hn {
2020
+ constructor(t, e) {
2021
+ this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
2022
+ }
2023
+ get parentNode() {
2024
+ return this._$AM.parentNode;
2025
+ }
2026
+ get _$AU() {
2027
+ return this._$AM._$AU;
2028
+ }
2029
+ u(t) {
2030
+ var e;
2031
+ const { el: { content: s }, parts: i } = this._$AD, r = ((e = t == null ? void 0 : t.creationScope) !== null && e !== void 0 ? e : V).importNode(s, !0);
2032
+ T.currentNode = r;
2033
+ let o = T.nextNode(), a = 0, h = 0, c = i[0];
2034
+ for (; c !== void 0; ) {
2035
+ if (a === c.index) {
2036
+ let l;
2037
+ c.type === 2 ? l = new ot(o, o.nextSibling, this, t) : c.type === 1 ? l = new c.ctor(o, c.name, c.strings, this, t) : c.type === 6 && (l = new gn(o, this, t)), this._$AV.push(l), c = i[++h];
2038
+ }
2039
+ a !== (c == null ? void 0 : c.index) && (o = T.nextNode(), a++);
2040
+ }
2041
+ return T.currentNode = V, r;
2042
+ }
2043
+ v(t) {
2044
+ let e = 0;
2045
+ for (const s of this._$AV)
2046
+ s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++;
2047
+ }
2048
+ }
2049
+ class ot {
2050
+ constructor(t, e, s, i) {
2051
+ var r;
2052
+ this.type = 2, this._$AH = f, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = i, this._$Cp = (r = i == null ? void 0 : i.isConnected) === null || r === void 0 || r;
2053
+ }
2054
+ get _$AU() {
2055
+ var t, e;
2056
+ return (e = (t = this._$AM) === null || t === void 0 ? void 0 : t._$AU) !== null && e !== void 0 ? e : this._$Cp;
2057
+ }
2058
+ get parentNode() {
2059
+ let t = this._$AA.parentNode;
2060
+ const e = this._$AM;
2061
+ return e !== void 0 && (t == null ? void 0 : t.nodeType) === 11 && (t = e.parentNode), t;
2062
+ }
2063
+ get startNode() {
2064
+ return this._$AA;
2065
+ }
2066
+ get endNode() {
2067
+ return this._$AB;
2068
+ }
2069
+ _$AI(t, e = this) {
2070
+ t = J(this, t, e), et(t) ? t === f || t == null || t === "" ? (this._$AH !== f && this._$AR(), this._$AH = f) : t !== this._$AH && t !== U && this._(t) : t._$litType$ !== void 0 ? this.g(t) : t.nodeType !== void 0 ? this.$(t) : on(t) ? this.T(t) : this._(t);
2071
+ }
2072
+ k(t) {
2073
+ return this._$AA.parentNode.insertBefore(t, this._$AB);
2074
+ }
2075
+ $(t) {
2076
+ this._$AH !== t && (this._$AR(), this._$AH = this.k(t));
2077
+ }
2078
+ _(t) {
2079
+ this._$AH !== f && et(this._$AH) ? this._$AA.nextSibling.data = t : this.$(V.createTextNode(t)), this._$AH = t;
2080
+ }
2081
+ g(t) {
2082
+ var e;
2083
+ const { values: s, _$litType$: i } = t, r = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = st.createElement(Xe(i.h, i.h[0]), this.options)), i);
2084
+ if (((e = this._$AH) === null || e === void 0 ? void 0 : e._$AD) === r)
2085
+ this._$AH.v(s);
2086
+ else {
2087
+ const o = new hn(r, this), a = o.u(this.options);
2088
+ o.v(s), this.$(a), this._$AH = o;
2089
+ }
2090
+ }
2091
+ _$AC(t) {
2092
+ let e = Pe.get(t.strings);
2093
+ return e === void 0 && Pe.set(t.strings, e = new st(t)), e;
2094
+ }
2095
+ T(t) {
2096
+ Ze(this._$AH) || (this._$AH = [], this._$AR());
2097
+ const e = this._$AH;
2098
+ let s, i = 0;
2099
+ for (const r of t)
2100
+ i === e.length ? e.push(s = new ot(this.k(tt()), this.k(tt()), this, this.options)) : s = e[i], s._$AI(r), i++;
2101
+ i < e.length && (this._$AR(s && s._$AB.nextSibling, i), e.length = i);
2102
+ }
2103
+ _$AR(t = this._$AA.nextSibling, e) {
2104
+ var s;
2105
+ for ((s = this._$AP) === null || s === void 0 || s.call(this, !1, !0, e); t && t !== this._$AB; ) {
2106
+ const i = t.nextSibling;
2107
+ t.remove(), t = i;
2108
+ }
2109
+ }
2110
+ setConnected(t) {
2111
+ var e;
2112
+ this._$AM === void 0 && (this._$Cp = t, (e = this._$AP) === null || e === void 0 || e.call(this, t));
2113
+ }
2114
+ }
2115
+ class Pt {
2116
+ constructor(t, e, s, i, r) {
2117
+ this.type = 1, this._$AH = f, this._$AN = void 0, this.element = t, this.name = e, this._$AM = i, this.options = r, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = f;
2118
+ }
2119
+ get tagName() {
2120
+ return this.element.tagName;
2121
+ }
2122
+ get _$AU() {
2123
+ return this._$AM._$AU;
2124
+ }
2125
+ _$AI(t, e = this, s, i) {
2126
+ const r = this.strings;
2127
+ let o = !1;
2128
+ if (r === void 0)
2129
+ t = J(this, t, e, 0), o = !et(t) || t !== this._$AH && t !== U, o && (this._$AH = t);
2130
+ else {
2131
+ const a = t;
2132
+ let h, c;
2133
+ for (t = r[0], h = 0; h < r.length - 1; h++)
2134
+ c = J(this, a[s + h], e, h), c === U && (c = this._$AH[h]), o || (o = !et(c) || c !== this._$AH[h]), c === f ? t = f : t !== f && (t += (c ?? "") + r[h + 1]), this._$AH[h] = c;
2135
+ }
2136
+ o && !i && this.j(t);
2137
+ }
2138
+ j(t) {
2139
+ t === f ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
2140
+ }
2141
+ }
2142
+ class ln extends Pt {
2143
+ constructor() {
2144
+ super(...arguments), this.type = 3;
2145
+ }
2146
+ j(t) {
2147
+ this.element[this.name] = t === f ? void 0 : t;
2148
+ }
2149
+ }
2150
+ const dn = q ? q.emptyScript : "";
2151
+ class un extends Pt {
2152
+ constructor() {
2153
+ super(...arguments), this.type = 4;
2154
+ }
2155
+ j(t) {
2156
+ t && t !== f ? this.element.setAttribute(this.name, dn) : this.element.removeAttribute(this.name);
2157
+ }
2158
+ }
2159
+ class pn extends Pt {
2160
+ constructor(t, e, s, i, r) {
2161
+ super(t, e, s, i, r), this.type = 5;
2162
+ }
2163
+ _$AI(t, e = this) {
2164
+ var s;
2165
+ if ((t = (s = J(this, t, e, 0)) !== null && s !== void 0 ? s : f) === U)
2166
+ return;
2167
+ const i = this._$AH, r = t === f && i !== f || t.capture !== i.capture || t.once !== i.once || t.passive !== i.passive, o = t !== f && (i === f || r);
2168
+ r && this.element.removeEventListener(this.name, this, i), o && this.element.addEventListener(this.name, this, t), this._$AH = t;
2169
+ }
2170
+ handleEvent(t) {
2171
+ var e, s;
2172
+ typeof this._$AH == "function" ? this._$AH.call((s = (e = this.options) === null || e === void 0 ? void 0 : e.host) !== null && s !== void 0 ? s : this.element, t) : this._$AH.handleEvent(t);
2173
+ }
2174
+ }
2175
+ class gn {
2176
+ constructor(t, e, s) {
2177
+ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
2178
+ }
2179
+ get _$AU() {
2180
+ return this._$AM._$AU;
2181
+ }
2182
+ _$AI(t) {
2183
+ J(this, t);
2184
+ }
2185
+ }
2186
+ const ke = Et.litHtmlPolyfillSupport;
2187
+ ke == null || ke(st, ot), ((zt = Et.litHtmlVersions) !== null && zt !== void 0 ? zt : Et.litHtmlVersions = []).push("2.8.0");
2188
+ const mn = (n, t, e) => {
2189
+ var s, i;
2190
+ const r = (s = e == null ? void 0 : e.renderBefore) !== null && s !== void 0 ? s : t;
2191
+ let o = r._$litPart$;
2192
+ if (o === void 0) {
2193
+ const a = (i = e == null ? void 0 : e.renderBefore) !== null && i !== void 0 ? i : null;
2194
+ r._$litPart$ = o = new ot(t.insertBefore(tt(), a), a, void 0, e ?? {});
2195
+ }
2196
+ return o._$AI(n), o;
2197
+ };
2198
+ /**
2199
+ * @license
2200
+ * Copyright 2017 Google LLC
2201
+ * SPDX-License-Identifier: BSD-3-Clause
2202
+ */
2203
+ var Wt, qt;
2204
+ let Q = class extends B {
2205
+ constructor() {
2206
+ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
2207
+ }
2208
+ createRenderRoot() {
2209
+ var t, e;
2210
+ const s = super.createRenderRoot();
2211
+ return (t = (e = this.renderOptions).renderBefore) !== null && t !== void 0 || (e.renderBefore = s.firstChild), s;
2212
+ }
2213
+ update(t) {
2214
+ const e = this.render();
2215
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = mn(e, this.renderRoot, this.renderOptions);
2216
+ }
2217
+ connectedCallback() {
2218
+ var t;
2219
+ super.connectedCallback(), (t = this._$Do) === null || t === void 0 || t.setConnected(!0);
2220
+ }
2221
+ disconnectedCallback() {
2222
+ var t;
2223
+ super.disconnectedCallback(), (t = this._$Do) === null || t === void 0 || t.setConnected(!1);
2224
+ }
2225
+ render() {
2226
+ return U;
2227
+ }
2228
+ };
2229
+ Q.finalized = !0, Q._$litElement$ = !0, (Wt = globalThis.litElementHydrateSupport) === null || Wt === void 0 || Wt.call(globalThis, { LitElement: Q });
2230
+ const Ne = globalThis.litElementPolyfillSupport;
2231
+ Ne == null || Ne({ LitElement: Q });
2232
+ ((qt = globalThis.litElementVersions) !== null && qt !== void 0 ? qt : globalThis.litElementVersions = []).push("3.3.3");
2233
+ /**
2234
+ * @license
2235
+ * Copyright 2017 Google LLC
2236
+ * SPDX-License-Identifier: BSD-3-Clause
2237
+ */
2238
+ const fn = (n, t) => t.kind === "method" && t.descriptor && !("value" in t.descriptor) ? { ...t, finisher(e) {
2239
+ e.createProperty(t.key, n);
2240
+ } } : { kind: "field", key: Symbol(), placement: "own", descriptor: {}, originalKey: t.key, initializer() {
2241
+ typeof t.initializer == "function" && (this[t.key] = t.initializer.call(this));
2242
+ }, finisher(e) {
2243
+ e.createProperty(t.key, n);
2244
+ } }, vn = (n, t, e) => {
2245
+ t.constructor.createProperty(e, n);
2246
+ };
2247
+ function nt(n) {
2248
+ return (t, e) => e !== void 0 ? vn(n, t, e) : fn(n, t);
2249
+ }
2250
+ /**
2251
+ * @license
2252
+ * Copyright 2017 Google LLC
2253
+ * SPDX-License-Identifier: BSD-3-Clause
2254
+ */
2255
+ function N(n) {
2256
+ return nt({ ...n, state: !0 });
2257
+ }
2258
+ /**
2259
+ * @license
2260
+ * Copyright 2017 Google LLC
2261
+ * SPDX-License-Identifier: BSD-3-Clause
2262
+ */
2263
+ const yn = ({ finisher: n, descriptor: t }) => (e, s) => {
2264
+ var i;
2265
+ if (s === void 0) {
2266
+ const r = (i = e.originalKey) !== null && i !== void 0 ? i : e.key, o = t != null ? { kind: "method", placement: "prototype", key: r, descriptor: t(e.key) } : { ...e, key: r };
2267
+ return n != null && (o.finisher = function(a) {
2268
+ n(a, r);
2269
+ }), o;
2270
+ }
2271
+ {
2272
+ const r = e.constructor;
2273
+ t !== void 0 && Object.defineProperty(e, s, t(s)), n == null || n(r, s);
2274
+ }
2275
+ };
2276
+ /**
2277
+ * @license
2278
+ * Copyright 2021 Google LLC
2279
+ * SPDX-License-Identifier: BSD-3-Clause
2280
+ */
2281
+ var Jt;
2282
+ ((Jt = window.HTMLSlotElement) === null || Jt === void 0 ? void 0 : Jt.prototype.assignedElements) != null;
2283
+ /**
2284
+ * @license
2285
+ * Copyright 2017 Google LLC
2286
+ * SPDX-License-Identifier: BSD-3-Clause
2287
+ */
2288
+ const bn = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, wn = (n) => (...t) => ({ _$litDirective$: n, values: t });
2289
+ let $n = class {
2290
+ constructor(t) {
2291
+ }
2292
+ get _$AU() {
2293
+ return this._$AM._$AU;
2294
+ }
2295
+ _$AT(t, e, s) {
2296
+ this._$Ct = t, this._$AM = e, this._$Ci = s;
2297
+ }
2298
+ _$AS(t, e) {
2299
+ return this.update(t, e);
2300
+ }
2301
+ update(t, e) {
2302
+ return this.render(...e);
2303
+ }
2304
+ };
2305
+ /**
2306
+ * @license
2307
+ * Copyright 2018 Google LLC
2308
+ * SPDX-License-Identifier: BSD-3-Clause
2309
+ */
2310
+ const _n = wn(class extends $n {
2311
+ constructor(n) {
2312
+ var t;
2313
+ if (super(n), n.type !== bn.ATTRIBUTE || n.name !== "class" || ((t = n.strings) === null || t === void 0 ? void 0 : t.length) > 2)
2314
+ throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
2315
+ }
2316
+ render(n) {
2317
+ return " " + Object.keys(n).filter((t) => n[t]).join(" ") + " ";
2318
+ }
2319
+ update(n, [t]) {
2320
+ var e, s;
2321
+ if (this.it === void 0) {
2322
+ this.it = /* @__PURE__ */ new Set(), n.strings !== void 0 && (this.nt = new Set(n.strings.join(" ").split(/\s/).filter((r) => r !== "")));
2323
+ for (const r in t)
2324
+ t[r] && !(!((e = this.nt) === null || e === void 0) && e.has(r)) && this.it.add(r);
2325
+ return this.render(t);
2326
+ }
2327
+ const i = n.element.classList;
2328
+ this.it.forEach((r) => {
2329
+ r in t || (i.remove(r), this.it.delete(r));
2330
+ });
2331
+ for (const r in t) {
2332
+ const o = !!t[r];
2333
+ o === this.it.has(r) || !((s = this.nt) === null || s === void 0) && s.has(r) || (o ? (i.add(r), this.it.add(r)) : (i.remove(r), this.it.delete(r)));
2334
+ }
2335
+ return U;
2336
+ }
2337
+ }), w = (n, t, e) => {
2338
+ n && e.style.setProperty(t, n);
2339
+ }, ts = (n, t) => {
2340
+ var e, s, i, r, o, a, h, c, l, d, u;
2341
+ w((e = n.colors) == null ? void 0 : e.primary, "--primary-color", t), w((s = n.colors) == null ? void 0 : s.secondary, "--secondary-color", t), w((i = n.colors) == null ? void 0 : i.text, "--text-color", t), w((r = n.colors) == null ? void 0 : r.link, "--link-color", t), w((o = n.colors) == null ? void 0 : o.gray, "--gray-color", t), w((a = n.colors) == null ? void 0 : a.grayDark, "--gray-dark-color", t), w((h = n.spacing) == null ? void 0 : h.xs, "--spacing-xs", t), w((c = n.spacing) == null ? void 0 : c.sm, "--spacing-sm", t), w((l = n.spacing) == null ? void 0 : l.md, "--spacing-md", t), w((d = n.spacing) == null ? void 0 : d.lg, "--spacing-lg", t), w((u = n.spacing) == null ? void 0 : u.xl, "--spacing-xl", t), w(n.boxShadow, "--box-shadow", t), w(n.borderRadius, "--border-radius", t), w(n.borderRadiusSm, "--border-radius-sm", t), w(n.fontFamily, "--font-family", t);
2342
+ };
2343
+ var En = Object.defineProperty, An = Object.getOwnPropertyDescriptor, at = (n, t, e, s) => {
2344
+ for (var i = s > 1 ? void 0 : s ? An(t, e) : t, r = n.length - 1, o; r >= 0; r--)
2345
+ (o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
2346
+ return s && i && En(t, e, i), i;
2347
+ };
2348
+ class H extends Q {
2349
+ constructor() {
2350
+ super(...arguments), this.active = !1, this.loaded = !1;
2351
+ }
2352
+ async connectedCallback() {
2353
+ super.connectedCallback(), this.icon = await this._renderSymbol(this.symbol), this.loaded = !0, this._applyBranding();
2354
+ }
2355
+ _toggleActive() {
2356
+ this.active = !this.active;
2357
+ }
2358
+ _applyBranding() {
2359
+ var s;
2360
+ const t = ((s = this.container) == null ? void 0 : s.get("$settings")) ?? {}, e = t == null ? void 0 : t.components[t == null ? void 0 : t.entry];
2361
+ e && ts(e.context, this);
2362
+ }
2363
+ async _renderSymbol(t) {
2364
+ const e = async (r) => await import("./index-5087564d.mjs").then((a) => a[r]);
2365
+ if (!t)
2366
+ return f;
2367
+ const { type: s, content: i } = t;
2368
+ switch (s) {
2369
+ case "Telia": {
2370
+ const r = await e(i);
2371
+ return r ? dt`<telia-icon
2372
+ class="trigger-icon"
2373
+ svg=${r.svg}
2374
+ size="lg"
2375
+ ></telia-icon>` : f;
2376
+ }
2377
+ case "FontAwesome":
2378
+ return dt`<i class="trigger-fa-icon fa fa-${i}"></i>`;
2379
+ case "Uri":
2380
+ return dt`<i
2381
+ class="trigger-custom-icon"
2382
+ style="background: url(${i}) no-repeat center center;background-size: contain;"
2383
+ ></i>`;
2384
+ default:
2385
+ return f;
2386
+ }
2387
+ }
2388
+ render() {
2389
+ return dt`<button
2390
+ class=${_n({
2391
+ trigger: !0,
2392
+ active: this.active,
2393
+ rendered: this.loaded
2394
+ })}
2395
+ @click=${this._toggleActive}
2396
+ >
2397
+ ${this.icon}
2398
+ <span class="trigger-close">
2399
+ <svg
2400
+ width="18"
2401
+ height="9"
2402
+ viewBox="0 0 18 9"
2403
+ fill="none"
2404
+ xmlns="http://www.w3.org/2000/svg"
2405
+ >
2406
+ <path
2407
+ d="M9 9C8.81794 9.00045 8.63759 8.96634 8.46939 8.89965C8.3012 8.83295 8.14851 8.735 8.02015 8.61145L0.194523 1.12367C0.068294 0.99862 -0.00155266 0.831133 2.61958e-05 0.657285C0.00160506 0.483436 0.0744832 0.317136 0.202964 0.194202C0.331445 0.0712675 0.505249 0.00153576 0.686941 2.50649e-05C0.868634 -0.00148563 1.04368 0.0653456 1.17437 0.186125L9 7.6739L16.8256 0.186125C16.9563 0.0653456 17.1314 -0.00148563 17.3131 2.50649e-05C17.4948 0.00153576 17.6686 0.0712675 17.797 0.194202C17.9255 0.317136 17.9984 0.483436 18 0.657285C18.0016 0.831133 17.9317 0.99862 17.8055 1.12367L9.97985 8.61145C9.85149 8.735 9.6988 8.83295 9.53061 8.89965C9.36241 8.96634 9.18206 9.00045 9 9Z"
2408
+ fill="white"
2409
+ />
2410
+ </svg>
2411
+ </span>
2412
+ <span class="trigger-loader">
2413
+ <svg viewBox="25 25 50 50">
2414
+ <circle
2415
+ cx="50"
2416
+ cy="50"
2417
+ r="20"
2418
+ fill="none"
2419
+ stroke="#000"
2420
+ stroke-width="2"
2421
+ stroke-miterlimit="10"
2422
+ />
2423
+ </svg>
2424
+ </span>
2425
+ </button>`;
2426
+ }
2427
+ }
2428
+ H.styles = [
2429
+ Ke`
2430
+ :host {
2431
+ --voca-rem-multiplier: 0.625;
2432
+ display: block;
2433
+ box-sizing: border-box;
2434
+ }
2435
+
2436
+ .trigger {
2437
+ position: fixed;
2438
+ transform: scale(0);
2439
+ box-shadow: rgba(0, 0, 0, 0.16) 0px 5px 40px;
2440
+ bottom: 20px;
2441
+ right: 20px;
2442
+ z-index: 5;
2443
+ display: flex;
2444
+ align-items: center;
2445
+ justify-content: center;
2446
+ border: none;
2447
+ line-height: 55px;
2448
+ height: 55px;
2449
+ width: 55px;
2450
+ border-radius: 55px;
2451
+ cursor: pointer;
2452
+ background-color: var(--trigger-bg, var(--primary-color));
2453
+ font-family: Lato;
2454
+ text-decoration: none;
2455
+ border: 3px dashed transparent;
2456
+ box-sizing: border-box;
2457
+ transition: transform 200ms ease-out;
2458
+ }
2459
+ .trigger:hover {
2460
+ transform: scale(1.1) !important;
2461
+ }
2462
+ .trigger.rendered {
2463
+ transform: scale(1);
2464
+ }
2465
+ .trigger.active .trigger-icon {
2466
+ opacity: 0;
2467
+ transform: rotate(-180deg) scale(0);
2468
+ }
2469
+ .trigger.active .trigger-close {
2470
+ opacity: 1;
2471
+ transform: rotate(0deg) scale(1);
2472
+ }
2473
+
2474
+ .trigger-icon {
2475
+ display: inline-block;
2476
+ line-height: inherit;
2477
+ text-align: center;
2478
+ opacity: 1;
2479
+ transform: rotate(0deg) scale(1);
2480
+ transition: opacity 200ms ease-out, transform 200ms ease-out;
2481
+ color: var(--trigger-text-color, #fff);
2482
+ }
2483
+ .trigger-close {
2484
+ opacity: 0;
2485
+ transition: transform 200ms ease-out;
2486
+ transform: rotate(180deg) scale(0);
2487
+ position: absolute;
2488
+ top: 0;
2489
+ bottom: 0;
2490
+ left: 0;
2491
+ right: 0;
2492
+ display: flex;
2493
+ justify-content: center;
2494
+ align-items: center;
2495
+ fill: var(--trigger-text-color, #fff);
2496
+ }
2497
+ `
2498
+ ];
2499
+ at([
2500
+ nt({ attribute: !1 })
2501
+ ], H.prototype, "symbol", 2);
2502
+ at([
2503
+ nt({ attribute: !1 })
2504
+ ], H.prototype, "container", 2);
2505
+ at([
2506
+ N()
2507
+ ], H.prototype, "active", 2);
2508
+ at([
2509
+ N()
2510
+ ], H.prototype, "loaded", 2);
2511
+ at([
2512
+ N()
2513
+ ], H.prototype, "icon", 2);
2514
+ var j = /* @__PURE__ */ ((n) => (n.Inline = "inline", n.Link = "link", n.Badge = "badge", n.Unsupported = "unsupported", n))(j || {});
2515
+ const Cn = (n, t) => n && t ? "both" : n ? "widgetDOM" : t ? "triggerDOM" : "none", es = (n) => n ? typeof n == "boolean" && n ? "link" : typeof n == "object" && !Array.isArray(n) ? "badge" : "unsupported" : "inline", On = async (n, t, e, s, i, r = !1) => {
2516
+ var l, d;
2517
+ const o = Cn(
2518
+ e,
2519
+ s
2520
+ ), a = es(i), h = {
2521
+ widgetDOMElement: e ? e.cloneNode(!0) : void 0,
2522
+ triggerDOMElement: s ? s.cloneNode(!0) : void 0
2523
+ }, c = {
2524
+ triggerType: a,
2525
+ cachedOriginals: h,
2526
+ widgetDOMElement: document.createElement("div")
2527
+ };
2528
+ switch (o) {
2529
+ case "both": {
2530
+ c.widgetDOMElement = e || document.createElement("div"), a !== "inline" && (c.triggerDOMElement = s);
2531
+ break;
2532
+ }
2533
+ case "widgetDOM": {
2534
+ if (c.widgetDOMElement = e || document.createElement("div"), a !== "inline") {
2535
+ const u = document.body.appendChild(
2536
+ document.createElement("a")
2537
+ );
2538
+ a === "link" && (u.innerText = t), c.triggerDOMElement = u;
2539
+ }
2540
+ break;
2541
+ }
2542
+ case "triggerDOM": {
2543
+ const u = document.createElement("div");
2544
+ c.widgetDOMElement = u, a === "inline" ? (u.id = (s == null ? void 0 : s.id) || "", r ? (u.style.display = "none", (l = s == null ? void 0 : s.parentNode) == null || l.appendChild(u), c.callback = () => {
2545
+ var p;
2546
+ (p = s == null ? void 0 : s.parentNode) == null || p.replaceChild(
2547
+ u,
2548
+ s
2549
+ ), u.style.display = (s == null ? void 0 : s.style.display) || "block";
2550
+ }) : (d = s == null ? void 0 : s.parentNode) == null || d.replaceChild(
2551
+ u,
2552
+ s
2553
+ ), c.cachedOriginals.widgetDOMElement = s, c.cachedOriginals.triggerDOMElement = void 0) : (c.widgetDOMElement = document.body.appendChild(u), c.triggerDOMElement = s);
2554
+ break;
2555
+ }
2556
+ case "none": {
2557
+ const u = document.body.appendChild(
2558
+ document.createElement("div")
2559
+ );
2560
+ if (c.widgetDOMElement = u, a !== "inline") {
2561
+ customElements.get("ace-widget-trigger") || customElements.define("ace-widget-trigger", H);
2562
+ const p = document.createElement("ace-widget-trigger");
2563
+ p.symbol = i.symbol, p.container = n, document.body.appendChild(p), console.log("Created trigger"), c.triggerDOMElement = p;
2564
+ }
2565
+ break;
2566
+ }
2567
+ }
2568
+ return c;
2569
+ }, xn = "modals";
2570
+ class Sn {
2571
+ constructor(t, e) {
2572
+ this.options = e, this.unsubscribe = [], this.container = t.createChild(this), this.container.register("widgetDOMElement", this.options.widgetDOMElement), this.container.register(
2573
+ "triggerDOMElement",
2574
+ this.options.triggerDOMElement
2575
+ );
2576
+ const s = this.container.get("$widget");
2577
+ this.options.widgetDOMElement.classList.add("ace-widget"), this.options.widgetDOMElement.classList.add(`ace-widget_${s.name}`);
2578
+ const i = t.get("widgetDOMElements") || [];
2579
+ t.register("widgetDOMElements", [
2580
+ ...i,
2581
+ this.options.widgetDOMElement
2582
+ ]);
2583
+ }
2584
+ /**
2585
+ * Renders the view outlet to the DOM.
2586
+ */
2587
+ render() {
2588
+ const { widgetDOMElement: t, triggerDOMElement: e } = this.options, s = this.container.get("$widget");
2589
+ return t.getAttribute("data-rendered") === "true" ? Promise.resolve() : (e && this.options.triggerType === j.Badge && tn(e), import("./render-05a26598.mjs").then((i) => i.default(this.container, t)).then(() => {
2590
+ if (t.setAttribute("data-rendered", "true"), e && this.options.triggerType === j.Badge) {
2591
+ const r = this.options.triggerOptions.openTooltip;
2592
+ Je(e, r);
2593
+ }
2594
+ fs(this.container, t);
2595
+ const i = this.container.get("$environment").widgets.all();
2596
+ x(
2597
+ this.container,
2598
+ xn,
2599
+ m.Session
2600
+ ).then((r) => {
2601
+ r && r.forEach((o) => {
2602
+ i.find(
2603
+ (a) => a.name === o.name && a.state === "activated"
2604
+ ) && s.events.dispatch("widget:modal-opened", o);
2605
+ });
2606
+ });
2607
+ }));
2608
+ }
2609
+ renderBadge(t) {
2610
+ const { triggerDOMElement: e } = this.options;
2611
+ if (!e)
2612
+ return;
2613
+ e.getAttribute("role") || e.setAttribute("role", "button");
2614
+ const { name: s } = this.container.get("$widget"), { label: i, symbol: r, ariaLabel: o, closedTooltip: a, openTooltip: h } = t, c = { closedTooltip: a, openTooltip: h };
2615
+ this.options.triggerOptions = c;
2616
+ const l = Qs(e, {
2617
+ label: i,
2618
+ symbol: r,
2619
+ ariaLabel: o,
2620
+ widgetName: s,
2621
+ tooltip: a
2622
+ });
2623
+ this.unsubscribe.push(l);
2624
+ }
2625
+ async dispose() {
2626
+ var s, i, r, o;
2627
+ const { triggerDOMElement: t, widgetDOMElement: e } = this.options;
2628
+ this.options.cachedOriginals.widgetDOMElement && e && ((s = e.parentNode) == null || s.replaceChild(
2629
+ this.options.cachedOriginals.widgetDOMElement,
2630
+ e
2631
+ )), this.options.cachedOriginals.triggerDOMElement && t && ((i = t.parentNode) == null || i.replaceChild(
2632
+ this.options.cachedOriginals.triggerDOMElement,
2633
+ t
2634
+ )), this.unsubscribe.forEach((a) => {
2635
+ a();
2636
+ }), (r = e.parentNode) == null || r.removeChild(e), (o = t == null ? void 0 : t.parentNode) == null || o.removeChild(t);
2637
+ }
2638
+ }
2639
+ const ut = "changesets", Pn = (n) => {
2640
+ const t = { tags: n.tags };
2641
+ return n.context && typeof n.context != "function" && (t.context = n.context), n.properties && typeof n.properties != "function" && (t.properties = n.properties), n.layout && typeof n.layout != "function" && (t.layout = n.layout), t;
2642
+ };
2643
+ class ce {
2644
+ constructor(t, e) {
2645
+ this.container = t, this.storageWriter = e;
2646
+ }
2647
+ static create(t) {
2648
+ return P(
2649
+ t,
2650
+ ut,
2651
+ g.Necessary,
2652
+ {
2653
+ medium: m.Local
2654
+ }
2655
+ ).then(
2656
+ (e) => new ce(t, e)
2657
+ );
2658
+ }
2659
+ write(t, e, s, i) {
2660
+ return C(this)(() => x(
2661
+ this.container,
2662
+ ut,
2663
+ m.Local
2664
+ ).then((r = {}) => {
2665
+ const { keys: o = [], items: a = {} } = r, h = o.indexOf(t);
2666
+ return h > -1 && o.splice(h, 1), o.push(t), a[t] = {
2667
+ options: i,
2668
+ attributes: Pn(s),
2669
+ rules: e.rules
2670
+ }, this.storageWriter({ keys: o, items: a });
2671
+ }));
2672
+ }
2673
+ remove(t) {
2674
+ return C(this)(() => x(
2675
+ this.container,
2676
+ ut,
2677
+ m.Local
2678
+ ).then((e = {}) => {
2679
+ const { keys: s = [], items: i = {} } = e, r = s.indexOf(t);
2680
+ if (r > -1)
2681
+ return s.splice(r, 1), delete i[t], this.storageWriter(e);
2682
+ }));
2683
+ }
2684
+ load(t) {
2685
+ return C(this)(() => x(
2686
+ this.container,
2687
+ ut,
2688
+ m.Local
2689
+ ).then((e = {}) => {
2690
+ const { keys: s = [], items: i = {} } = e;
2691
+ s.forEach((r) => {
2692
+ const o = i[r];
2693
+ if (o) {
2694
+ const { rules: a, attributes: h, options: c } = o;
2695
+ t.write({
2696
+ attributes: h,
2697
+ options: c,
2698
+ target: new F(t, a)
2699
+ });
2700
+ }
2701
+ });
2702
+ }));
2703
+ }
2704
+ }
2705
+ const kn = (n) => {
2706
+ const { container: t } = n;
2707
+ return ce.create(t).then(
2708
+ (e) => {
2709
+ const s = t.get("$settings"), i = { localStorage: e }, r = new rt(n, i), o = He(r, s);
2710
+ return n.events.subscribe(
2711
+ "widget:state-change",
2712
+ (a, h) => {
2713
+ h.state === Re.Deactivating && o();
2714
+ }
2715
+ ), r;
2716
+ }
2717
+ );
2718
+ }, Nn = (n) => Promise.resolve().then(() => Ys).then(({ StorageProvider: t }) => new t()), Dn = (n) => Promise.resolve().then(() => se).then(({ ActionResolver: t }) => new t(n)), Ln = (n) => Promise.resolve().then(() => se).then(({ ComponentResolver: t }) => new t(n)), Mn = (n) => Promise.resolve().then(() => se).then(() => kn(n.get("$widget"))), Ft = "$settings", Kt = "open", De = "activeStickyWidget";
2719
+ class ui extends ds {
2720
+ constructor(t) {
2721
+ super(t), this.outlets = /* @__PURE__ */ new Map(), this.activated = void 0, this.subs = [], this.handleBootstrapping = (e) => {
2722
+ const s = {
2723
+ triggerDOMElement: e.sourceDOMElement,
2724
+ withRenderState: "storage"
2725
+ /* Storage */
2726
+ };
2727
+ this.container.get("settings").then((i) => {
2728
+ const { activate: r } = i;
2729
+ (typeof r > "u" || r === null || r === !0) && (this.activated = (this.activated || this.widget.activate()).then(
2730
+ () => this.attach(s)
2731
+ ));
2732
+ });
2733
+ }, this.container.registerAsync(
2734
+ "storage",
2735
+ () => Nn(this.container)
2736
+ ), this.container.registerFactory("settings", () => x(
2737
+ this.container,
2738
+ Ft,
2739
+ m.Local
2740
+ ).then((e = {}) => ({
2741
+ ...this.container.get("$settings"),
2742
+ ...e
2743
+ }))), as(this, "load", this.handleBootstrapping), this.container.registerAsync(
2744
+ "componentResolver",
2745
+ () => Ln(this.container)
2746
+ ), this.container.registerAsync(
2747
+ "actionResolver",
2748
+ () => Dn(this.container)
2749
+ ), this.container.register("matchMedia", window.matchMedia), this.container.registerAsync(
2750
+ "components",
2751
+ () => Mn(this.container)
2752
+ );
2753
+ }
2754
+ initialize() {
2755
+ const t = this.container.getManyAsync(
2756
+ "actionResolver",
2757
+ "components"
2758
+ ), e = this.container.get("csp");
2759
+ return e && (window.webprovisionsEnvironmentVariables || (window.webprovisionsEnvironmentVariables = {}), window.webprovisionsEnvironmentVariables.cspNonce = e.nonce), Promise.all([t, this.container.get("settings")]).then(
2760
+ ([{ actionResolver: s, components: i }, r]) => (s.subscribe(
2761
+ this.widget.name,
2762
+ (h, c, l) => this.onAction(c, l)
2763
+ ), ((h) => {
2764
+ i.nodes.query({ type: "view" }).forEach((c) => {
2765
+ i.setSwitch(c, h);
2766
+ });
2767
+ })("index"), this.events.subscribe("widget:data-loaded", (h, { element: c }) => {
2768
+ this.widget.container.get("seoConfiguration") && this.events.dispatch("widget:preloaded-replaced", {
2769
+ element: c
2770
+ });
2771
+ }), Promise.resolve())
2772
+ );
2773
+ }
2774
+ attach(t = {}) {
2775
+ return this.container.get("settings").then(async ({ trigger: e }) => {
2776
+ var u, p;
2777
+ const {
2778
+ widgetDOMElement: s,
2779
+ key: i = it(),
2780
+ triggerDOMElement: r,
2781
+ withRenderState: o
2782
+ } = t, h = es(e) === j.Inline && ((r == null ? void 0 : r.childElementCount) || 0) > 0, c = await On(
2783
+ this.container,
2784
+ this.widget.name,
2785
+ s,
2786
+ r,
2787
+ e,
2788
+ h
2789
+ );
2790
+ this.outlets.size < 1 && !o && this.setRenderState("unset");
2791
+ const l = () => {
2792
+ const v = () => y.querySelectorAll("[data-loading=true]").length === 0, [y] = this.widget.container.get("widgetDOMElements"), A = (Nt, $) => {
2793
+ v() && (c.callback && c.callback(), $.disconnect());
2794
+ }, ct = {
2795
+ attributes: !0,
2796
+ subtree: !0,
2797
+ childList: !0
2798
+ };
2799
+ v() && c.callback && c.callback(), new MutationObserver(A).observe(y, ct);
2800
+ };
2801
+ h && this.widget.container.getAsync("dataClient").then(({ events: v }) => {
2802
+ v.subscribe(
2803
+ "data-client:fetched",
2804
+ (y, A) => {
2805
+ A.unresolvedQueries === 0 && l();
2806
+ }
2807
+ );
2808
+ });
2809
+ const d = this.getOrCreateViewOutlet(i, c);
2810
+ if (this.outlets.set(i, d), this.widget.events.dispatch("widget:attached", {}, { bubbles: !0 }), c.triggerType === j.Badge && e && ((u = c.triggerDOMElement) == null || u.setAttribute(
2811
+ "aria-expanded",
2812
+ "false"
2813
+ ), d == null || d.renderBadge(e)), c.triggerType !== j.Inline && ((p = c.triggerDOMElement) == null || p.addEventListener(
2814
+ "click",
2815
+ (v) => {
2816
+ v.preventDefault(), this.container.get("settings").then(({ trigger: y }) => {
2817
+ d.render().then(() => this.renderState()).then((A) => y && y.action && y.action === "hide" ? A === E.open ? this.hide() : this.open() : A === E.open ? this.close() : this.open());
2818
+ });
2819
+ }
2820
+ )), this.outlets.size > 1)
2821
+ return this.renderState().then((v) => {
2822
+ this.triggerStateIfApplicable(v);
2823
+ });
2824
+ if (o)
2825
+ return o === "storage" ? this.renderState().then((v) => {
2826
+ if (c.triggerType === j.Inline) {
2827
+ this.triggerStateIfApplicable("open");
2828
+ return;
2829
+ }
2830
+ this.triggerStateIfApplicable(v);
2831
+ }) : this.triggerStateIfApplicable(o);
2832
+ });
2833
+ }
2834
+ detach(t) {
2835
+ if (t) {
2836
+ if (this.outlets.has(t)) {
2837
+ const e = this.outlets.get(t);
2838
+ e == null || e.dispose(), this.outlets.delete(t);
2839
+ return;
2840
+ }
2841
+ process.env.NODE_ENV !== "production" && console.warn(`detach(): Could not find View Outlet with key ${t}`);
2842
+ return;
2843
+ }
2844
+ this.outlets.forEach((e) => {
2845
+ e.dispose();
2846
+ }), this.outlets.clear();
2847
+ }
2848
+ triggerStateIfApplicable(t) {
2849
+ switch (t) {
2850
+ case "closed":
2851
+ this.close();
2852
+ break;
2853
+ case "open":
2854
+ this.open();
2855
+ break;
2856
+ case "hidden":
2857
+ this.hide();
2858
+ break;
2859
+ default:
2860
+ return;
2861
+ }
2862
+ }
2863
+ getOrCreateViewOutlet(t, e) {
2864
+ return this.outlets.has(t) ? this.outlets.get(t) : new Sn(this.container, e);
2865
+ }
2866
+ render(t = {}) {
2867
+ if (process.env.NODE_ENV !== "production" && console.warn(
2868
+ "widget.render() is deprecated. Use widget.attach() instead."
2869
+ ), t.open) {
2870
+ const e = {
2871
+ ...t,
2872
+ withRenderState: "open"
2873
+ /* Open */
2874
+ };
2875
+ return this.attach(e);
2876
+ }
2877
+ return this.attach(t);
2878
+ }
2879
+ activate(t) {
2880
+ t != null && t.override && this.setSettings(() => t.override), t != null && t.apiNotificationPriorityBy && this.container.register(
2881
+ "apiNotificationPriorityBy",
2882
+ t.apiNotificationPriorityBy
2883
+ );
2884
+ }
2885
+ setSettings(t) {
2886
+ return Promise.all([
2887
+ this.container.get("settings"),
2888
+ P(
2889
+ this.container,
2890
+ Ft,
2891
+ g.Necessary,
2892
+ {
2893
+ medium: m.Local
2894
+ }
2895
+ )
2896
+ ]).then(([e, s]) => Promise.resolve(t(e)).then((i) => s(i).then(() => {
2897
+ const r = { ...e, ...i };
2898
+ return this.widget.events.dispatch("widget:settings-updated", r), r;
2899
+ })));
2900
+ }
2901
+ clearSettings() {
2902
+ return P(
2903
+ this.container,
2904
+ Ft,
2905
+ g.Necessary,
2906
+ { medium: m.Local }
2907
+ ).then((t) => t()).then(() => this.container.get("settings")).then((t) => {
2908
+ this.widget.events.dispatch("widget:settings-updated", t);
2909
+ });
2910
+ }
2911
+ action({ action: t, value: e }) {
2912
+ return this.container.getAsync("actionResolver").then((s) => {
2913
+ s.action(this.widget.name, t, e);
2914
+ });
2915
+ }
2916
+ renderState() {
2917
+ return (() => x(
2918
+ this.container,
2919
+ Kt,
2920
+ m.Session
2921
+ ).then((e = E.closed) => e))();
2922
+ }
2923
+ hide() {
2924
+ return this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn(
2925
+ "hide(): No-op as no view outlets are registered. Invoke the attach() command first."
2926
+ ), Promise.resolve()) : (this.outlets.forEach((t) => t.render()), this.action({ action: "hide" }).then(() => {
2927
+ this.setTriggerState(!1);
2928
+ }));
2929
+ }
2930
+ open() {
2931
+ return this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn(
2932
+ "open(): No-op as no view outlets are registered. Invoke the attach() command first."
2933
+ ), Promise.resolve()) : (this.outlets.forEach((t) => t.render()), this.action({ action: "open" }).then(() => (this.widget.events.dispatch("tracking:widget-rendered", {}), this.onOpen())));
2934
+ }
2935
+ close() {
2936
+ return this.outlets.size < 1 ? (process.env.NODE_ENV !== "production" && console.warn(
2937
+ "close(): No-op as no view outlets are registered. Invoke the attach() command first."
2938
+ ), Promise.resolve()) : this.action({ action: "close" }).then(() => this.onClose());
2939
+ }
2940
+ show() {
2941
+ return process.env.NODE_ENV !== "production" && console.warn(
2942
+ "show(): Command is deprecated and will be removed in the future. Use open() instead."
2943
+ ), this.open();
2944
+ }
2945
+ onAction(t, e) {
2946
+ switch (t) {
2947
+ case "close":
2948
+ case "open":
2949
+ case "hide":
2950
+ const s = t === "open" ? E.open : t === "close" ? E.closed : E.hidden;
2951
+ return this.setRenderState(s).then(() => {
2952
+ this.setTriggerState(s === E.open), s !== E.hidden ? s === E.open ? this.onOpen() : this.onClose() : this.outlets.forEach(
2953
+ (i) => {
2954
+ var r;
2955
+ return (r = i.options.triggerDOMElement) == null ? void 0 : r.setAttribute(
2956
+ "aria-expanded",
2957
+ "false"
2958
+ );
2959
+ }
2960
+ );
2961
+ });
2962
+ }
2963
+ }
2964
+ setRenderState(t) {
2965
+ const { invoke: e, events: s } = this.container.get("$widget");
2966
+ return Promise.all([
2967
+ P(
2968
+ this.container,
2969
+ Kt,
2970
+ g.Necessary,
2971
+ {
2972
+ medium: m.Session
2973
+ }
2974
+ ),
2975
+ P(
2976
+ this.container,
2977
+ Kt,
2978
+ g.Necessary,
2979
+ {
2980
+ medium: m.Local,
2981
+ duration: { minutes: 5 }
2982
+ }
2983
+ ),
2984
+ e("renderState")
2985
+ ]).then(([i, r, o]) => {
2986
+ t === "unset" || !t ? (r(), i()) : i(t), s.dispatch("widget:render-state-changed", {
2987
+ previous: o,
2988
+ next: t
2989
+ });
2990
+ });
2991
+ }
2992
+ onOpen() {
2993
+ return this.outlets.forEach(
2994
+ (t) => {
2995
+ var e;
2996
+ return (e = t.options.triggerDOMElement) == null ? void 0 : e.setAttribute("aria-expanded", "true");
2997
+ }
2998
+ ), Promise.resolve();
2999
+ }
3000
+ onClose() {
3001
+ const t = this.container.getManyAsync("components");
3002
+ return (() => this.container.get("settings").then((s) => {
3003
+ const { activate: i } = this.container.get("$settings");
3004
+ return s.activate !== i ? this.setSettings(() => Promise.resolve({ activate: i })) : Promise.resolve();
3005
+ }))().then(() => t).then(
3006
+ ({ components: s }) => {
3007
+ this.outlets.forEach(
3008
+ (i) => {
3009
+ var r;
3010
+ return (r = i.options.triggerDOMElement) == null ? void 0 : r.setAttribute(
3011
+ "aria-expanded",
3012
+ "false"
3013
+ );
3014
+ }
3015
+ );
3016
+ }
3017
+ );
3018
+ }
3019
+ setTriggerState(t) {
3020
+ this.outlets.forEach((e) => {
3021
+ const {
3022
+ options: { triggerDOMElement: s, triggerOptions: i }
3023
+ } = e, { openTooltip: r, closedTooltip: o } = i || {};
3024
+ s && (t ? Je(s, r) : Xs(s, o));
3025
+ });
3026
+ }
3027
+ deactivate() {
3028
+ this.subs.forEach((e) => e());
3029
+ const t = [];
3030
+ return this.outlets.forEach((e) => t.push(e.dispose())), x(
3031
+ this.container,
3032
+ De,
3033
+ m.Local
3034
+ ).then((e) => e === this.widget.name ? P(
3035
+ this.container,
3036
+ De,
3037
+ g.Necessary,
3038
+ {
3039
+ medium: m.Local,
3040
+ scope: K.Implementation
3041
+ }
3042
+ ).then((s) => s()).then(() => Promise.all(t)) : Promise.all(t));
3043
+ }
3044
+ }
3045
+ /**
3046
+ * @license
3047
+ * Copyright 2021 Google LLC
3048
+ * SPDX-License-Identifier: BSD-3-Clause
3049
+ */
3050
+ let ss = class extends Event {
3051
+ constructor(t, e, s) {
3052
+ super("context-request", { bubbles: !0, composed: !0 }), this.context = t, this.callback = e, this.subscribe = s != null && s;
3053
+ }
3054
+ };
3055
+ /**
3056
+ * @license
3057
+ * Copyright 2021 Google LLC
3058
+ * SPDX-License-Identifier: BSD-3-Clause
3059
+ */
3060
+ /**
3061
+ * @license
3062
+ * Copyright 2021 Google LLC
3063
+ * SPDX-License-Identifier: BSD-3-Clause
3064
+ */
3065
+ let In = class {
3066
+ constructor(t, e, s, i) {
3067
+ var r;
3068
+ if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (o, a) => {
3069
+ this.unsubscribe && (this.unsubscribe !== a && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = o, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(o, a)), this.unsubscribe = a;
3070
+ }, this.host = t, e.context !== void 0) {
3071
+ const o = e;
3072
+ this.context = o.context, this.callback = o.callback, this.subscribe = (r = o.subscribe) !== null && r !== void 0 && r;
3073
+ } else
3074
+ this.context = e, this.callback = s, this.subscribe = i != null && i;
3075
+ this.host.addController(this);
3076
+ }
3077
+ hostConnected() {
3078
+ this.dispatchRequest();
3079
+ }
3080
+ hostDisconnected() {
3081
+ this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0);
3082
+ }
3083
+ dispatchRequest() {
3084
+ this.host.dispatchEvent(new ss(this.context, this.t, this.subscribe));
3085
+ }
3086
+ };
3087
+ /**
3088
+ * @license
3089
+ * Copyright 2021 Google LLC
3090
+ * SPDX-License-Identifier: BSD-3-Clause
3091
+ */
3092
+ class Rn {
3093
+ constructor(t) {
3094
+ this.subscriptions = /* @__PURE__ */ new Map(), this.updateObservers = () => {
3095
+ for (const [e, { disposer: s }] of this.subscriptions)
3096
+ e(this.o, s);
3097
+ }, t !== void 0 && (this.value = t);
3098
+ }
3099
+ get value() {
3100
+ return this.o;
3101
+ }
3102
+ set value(t) {
3103
+ this.setValue(t);
3104
+ }
3105
+ setValue(t, e = !1) {
3106
+ const s = e || !Object.is(t, this.o);
3107
+ this.o = t, s && this.updateObservers();
3108
+ }
3109
+ addCallback(t, e, s) {
3110
+ if (!s)
3111
+ return void t(this.value);
3112
+ this.subscriptions.has(t) || this.subscriptions.set(t, { disposer: () => {
3113
+ this.subscriptions.delete(t);
3114
+ }, consumerHost: e });
3115
+ const { disposer: i } = this.subscriptions.get(t);
3116
+ t(this.value, i);
3117
+ }
3118
+ clearCallbacks() {
3119
+ this.subscriptions.clear();
3120
+ }
3121
+ }
3122
+ /**
3123
+ * @license
3124
+ * Copyright 2021 Google LLC
3125
+ * SPDX-License-Identifier: BSD-3-Clause
3126
+ */
3127
+ class Tn extends Event {
3128
+ constructor(t) {
3129
+ super("context-provider", { bubbles: !0, composed: !0 }), this.context = t;
3130
+ }
3131
+ }
3132
+ class Y extends Rn {
3133
+ constructor(t, e, s) {
3134
+ super(e.context !== void 0 ? e.initialValue : s), this.onContextRequest = (i) => {
3135
+ const r = i.composedPath()[0];
3136
+ i.context === this.context && r !== this.host && (i.stopPropagation(), this.addCallback(i.callback, r, i.subscribe));
3137
+ }, this.onProviderRequest = (i) => {
3138
+ const r = i.composedPath()[0];
3139
+ if (i.context !== this.context || r === this.host)
3140
+ return;
3141
+ const o = /* @__PURE__ */ new Set();
3142
+ for (const [a, { consumerHost: h }] of this.subscriptions)
3143
+ o.has(a) || (o.add(a), h.dispatchEvent(new ss(this.context, a, !0)));
3144
+ i.stopPropagation();
3145
+ }, this.host = t, e.context !== void 0 ? this.context = e.context : this.context = e, this.attachListeners(), this.host.addController(this);
3146
+ }
3147
+ attachListeners() {
3148
+ this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
3149
+ }
3150
+ hostConnected() {
3151
+ this.host.dispatchEvent(new Tn(this.context));
3152
+ }
3153
+ }
3154
+ /**
3155
+ * @license
3156
+ * Copyright 2022 Google LLC
3157
+ * SPDX-License-Identifier: BSD-3-Clause
3158
+ */
3159
+ function jn({ context: n, subscribe: t }) {
3160
+ return yn({ finisher: (e, s) => {
3161
+ e.addInitializer((i) => {
3162
+ new In(i, { context: n, callback: (r) => {
3163
+ i[s] = r;
3164
+ }, subscribe: t });
3165
+ });
3166
+ } });
3167
+ }
3168
+ const Vn = "children", Un = "descriptor", Hn = "container", zn = "context", Bn = "layout", Wn = "properties";
3169
+ class qn {
3170
+ constructor(t) {
3171
+ (this.host = t).addController(this);
3172
+ }
3173
+ hostConnected() {
3174
+ }
3175
+ hostDisconnected() {
3176
+ }
3177
+ setDescriptor(t) {
3178
+ this._descriptor = t;
3179
+ }
3180
+ setContainer(t) {
3181
+ this._container = t;
3182
+ }
3183
+ async dispatch(t, e) {
3184
+ if (!this._container || !this._descriptor)
3185
+ return;
3186
+ const s = await rt.getInstance(
3187
+ this._container
3188
+ ), i = new F(s).withId(
3189
+ this._descriptor.id
3190
+ );
3191
+ await s.actions(
3192
+ i,
3193
+ this._descriptor.type || it()
3194
+ ).dispatch(t, e);
3195
+ }
3196
+ }
3197
+ const Jn = async (n, t) => {
3198
+ const e = n.properties().provider;
3199
+ let s = {}, i = "";
3200
+ Array.isArray(e) ? (i = e[0], s = e[1]) : i = e || "";
3201
+ const r = await t.getAsync(
3202
+ i
3203
+ );
3204
+ if (!r)
3205
+ throw new Error("No provider defined in ListComponent");
3206
+ return r.applyComponentNodeSettings(n.node.id, s), { provider: r, settings: s };
3207
+ }, mi = async (n, t) => {
3208
+ const { provider: e, settings: s = {} } = await Jn(n, t);
3209
+ return {
3210
+ addResource: (i, r) => e.addResource(i, r),
3211
+ getData: (i, r) => e.getData(i, r, s)
3212
+ };
3213
+ };
3214
+ class Fn {
3215
+ constructor(t) {
3216
+ this.container = t, this.resources = /* @__PURE__ */ new Map(), this.nodeConfiguration = /* @__PURE__ */ new Map();
3217
+ }
3218
+ async getData(t, e, s) {
3219
+ const i = this.resources.get(t);
3220
+ if (!i)
3221
+ throw new Error(`Unable to get EntityProvider for "${t}"`);
3222
+ return await i.query(e, s);
3223
+ }
3224
+ addResource(t, e) {
3225
+ this.resources.set(t, e);
3226
+ }
3227
+ applyComponentNodeSettings(t, e) {
3228
+ this.nodeConfiguration.set(t, e);
3229
+ }
3230
+ }
3231
+ const Le = (n) => ({
3232
+ title: n.Title,
3233
+ id: n.Id.toString()
3234
+ });
3235
+ class Kn extends Fn {
3236
+ constructor(t) {
3237
+ super(t), this.addResource("item", {
3238
+ query: async (e, s) => {
3239
+ const i = e.itemId, r = "78aacc09-ae6f-5485-5ca3-9dacebb95825", o = t.get("$widget").name, a = s.projection || "", c = await (await fetch(
3240
+ `${a}/guides/${i}?client=${r}&funnel=${o}&site=%2F%2Fdemo.humany.cc%2Fadmin%2Finterfaces&phrase=&connectionId=&p.LastGuideId=2857`
3241
+ )).json();
3242
+ return c ? Le(c) : null;
3243
+ }
3244
+ }), this.addResource("items", {
3245
+ query: async (e, s) => {
3246
+ const i = "", r = t.get("$widget").name, o = s.projection || "", d = await (await fetch(
3247
+ `${o}/guides?client=${i}&funnel=${r}&site=&phrase=&skip=0&take=10&sorting.type=popularity&sorting.direction=descending`
3248
+ )).json();
3249
+ return {
3250
+ items: (d.Matches || []).map((u) => Le(u)),
3251
+ totalItems: (d == null ? void 0 : d.TotalMatches) || 0
3252
+ };
3253
+ }
3254
+ });
3255
+ }
3256
+ }
3257
+ const fi = async (n) => {
3258
+ n.registerAsync("guideProvider", () => new Kn(n));
3259
+ }, vi = (n, t, e, s, i) => n.getAsync("componentResolver").then((r) => (r.registerComponent(t, e), ze(n, t, s || (() => {
3260
+ }), t, i))), Gn = (n) => {
3261
+ const t = {};
3262
+ return Object.keys(n).forEach((e) => {
3263
+ e.indexOf("css-") > -1 && (t[e] = n[e]);
3264
+ }), t;
3265
+ }, Yn = (n, t) => {
3266
+ const e = Gn(t);
3267
+ Object.entries(e).forEach(([s, i]) => {
3268
+ n.style.setProperty(s.replace("css-", ""), i);
3269
+ });
3270
+ };
3271
+ var Zn = Object.defineProperty, Qn = Object.getOwnPropertyDescriptor, M = (n, t, e, s) => {
3272
+ for (var i = s > 1 ? void 0 : s ? Qn(t, e) : t, r = n.length - 1, o; r >= 0; r--)
3273
+ (o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
3274
+ return s && i && Zn(t, e, i), i;
3275
+ };
3276
+ const yi = (n) => {
3277
+ class t extends n {
3278
+ constructor() {
3279
+ super(...arguments), this.entry = "", this._descriptorProvider = new Y(
3280
+ this,
3281
+ Un,
3282
+ void 0
3283
+ ), this._childrenProvider = new Y(this, Vn, []), this._propertiesProvider = new Y(this, Wn, {}), this._contextProvider = new Y(this, zn, {}), this._layoutProvider = new Y(this, Bn, {}), this.actions = new qn(this), this.context = {}, this.layout = {}, this.properties = {};
3284
+ }
3285
+ connectedCallback() {
3286
+ super.connectedCallback(), this.container && (this.actions.setContainer(this.container), rt.getInstance(this.container).then(
3287
+ async (s) => {
3288
+ var r;
3289
+ const i = s.nodes.get(this.entry);
3290
+ if (i) {
3291
+ this._propertyChangeListener = s.events.subscribe(
3292
+ "components:properties-changed",
3293
+ (l, d) => {
3294
+ i.id === d.node.id && this._setProperties(d.node.attributes.properties);
3295
+ }
3296
+ ), this._contextChangeListener = s.events.subscribe(
3297
+ "components:context-changed",
3298
+ (l, d) => {
3299
+ i.id === d.node.id && this._setContext(d.node.attributes.context);
3300
+ }
3301
+ ), this._layoutChangeListener = s.events.subscribe(
3302
+ "components:layout-changed",
3303
+ (l, d) => {
3304
+ i.id === d.node.id && this._setLayout(d.node.attributes.layout);
3305
+ }
3306
+ );
3307
+ const o = "default";
3308
+ this._unmountNode = i.mount(this.container), this._setDescriptor(Yt(i, o)), this._setProperties(i.attributes.properties), this._setContext(i.attributes.context), this._setLayout(this.layout);
3309
+ const a = i.getChildren(o).map((l) => Yt(l));
3310
+ this._childrenProvider.setValue(a);
3311
+ const c = (await this.container.getAsync("componentResolver")).getComponent(
3312
+ ((r = this.descriptor) == null ? void 0 : r.type) || ""
3313
+ );
3314
+ c.then && c.then((l) => {
3315
+ this.component = l.default;
3316
+ });
3317
+ }
3318
+ }
3319
+ ));
3320
+ }
3321
+ disconnectedCallback() {
3322
+ super.disconnectedCallback(), this._propertyChangeListener && this._propertyChangeListener(), this._contextChangeListener && this._contextChangeListener(), this._layoutChangeListener && this._layoutChangeListener(), this._unmountNode && this._unmountNode();
3323
+ }
3324
+ updated() {
3325
+ this.container && this.actions.setContainer(this.container), ts(this.context, this.renderRoot.host), this.renderRoot.host.style.setProperty(
3326
+ "--width",
3327
+ this.layout.size === "full" ? "var(--columns, 1)" : `min(${this.layout.size || "var(--columns)"}, var(--columns))`
3328
+ ), Yn(this.renderRoot.host, this.properties);
3329
+ }
3330
+ _setProperties(s) {
3331
+ this._propertiesProvider.setValue(s), this.properties = s;
3332
+ }
3333
+ _setContext(s) {
3334
+ this._contextProvider.setValue(s), this.context = s;
3335
+ }
3336
+ _setLayout(s) {
3337
+ this._layoutProvider.setValue(s), this.layout = s;
3338
+ }
3339
+ _setDescriptor(s) {
3340
+ this.descriptor = s, this._descriptorProvider.setValue(s), this.actions.setDescriptor(s);
3341
+ }
3342
+ }
3343
+ return t.styles = [
3344
+ n.styles ?? [],
3345
+ Ke`
3346
+ :host {
3347
+ font-family: var(--font-family);
3348
+ grid-column: span var(--width);
3349
+ max-width: 100%;
3350
+ overflow: hidden;
3351
+ box-sizing: border-box;
3352
+ display: block;
3353
+ }
3354
+ * {
3355
+ box-sizing: border-box;
3356
+ }
3357
+ `
3358
+ ], M([
3359
+ jn({ context: Hn }),
3360
+ nt({ attribute: !1 })
3361
+ ], t.prototype, "container", 2), M([
3362
+ nt()
3363
+ ], t.prototype, "entry", 2), M([
3364
+ N()
3365
+ ], t.prototype, "descriptor", 2), M([
3366
+ N()
3367
+ ], t.prototype, "component", 2), M([
3368
+ N()
3369
+ ], t.prototype, "context", 2), M([
3370
+ N()
3371
+ ], t.prototype, "layout", 2), M([
3372
+ N()
3373
+ ], t.prototype, "properties", 2), t;
3374
+ };
3375
+ console.log("test123234253");
3376
+ export {
3377
+ f as A,
3378
+ Fn as D,
3379
+ fi as G,
3380
+ U as T,
3381
+ yi as W,
3382
+ Y as a,
3383
+ Ke as b,
3384
+ Hn as c,
3385
+ N as d,
3386
+ wn as e,
3387
+ ts as f,
3388
+ Yn as g,
3389
+ ui as h,
3390
+ $n as i,
3391
+ Vn as j,
3392
+ Un as k,
3393
+ zn as l,
3394
+ E as m,
3395
+ nt as n,
3396
+ Bn as o,
3397
+ rt as p,
3398
+ Wn as q,
3399
+ qn as r,
3400
+ Q as s,
3401
+ bn as t,
3402
+ mi as u,
3403
+ vi as v,
3404
+ dt as x
3405
+ };