@telia-ace/widget-components-area-flamingo 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,1470 +0,0 @@
1
- const F = (t, e, s, ...n) => {
2
- const r = `[${t.get("$environment").name || "webprovisions"}] ${s}`;
3
- switch (e) {
4
- case "info":
5
- console.info(r, ...n);
6
- break;
7
- case "warning":
8
- console.warn(r, ...n);
9
- break;
10
- case "error":
11
- console.error(r, ...n);
12
- break;
13
- }
14
- }, _e = (t) => {
15
- const e = t.container || t;
16
- return {
17
- info: (s, ...n) => F(e, "info", s, ...n),
18
- warn: (s, ...n) => F(e, "warning", s, ...n),
19
- error: (s, ...n) => F(e, "error", s, ...n)
20
- };
21
- };
22
- var _ = /* @__PURE__ */ ((t) => (t.Implementation = "implementation", t.Widget = "widget", t))(_ || {}), C = /* @__PURE__ */ ((t) => (t.Pre = "pre", t.Post = "post", t))(C || {});
23
- const Te = (t, e, s, n) => {
24
- try {
25
- const r = new e(s, n);
26
- return {
27
- name: t,
28
- invoke: (o, i) => {
29
- let a;
30
- return r[o] && (a = r[o].call(r, i)), Promise.resolve(a);
31
- },
32
- getInstance: () => r
33
- };
34
- } catch (r) {
35
- if (r.message && r.message.indexOf("is not a constructor") >= 0)
36
- return {
37
- name: t,
38
- invoke: (o) => {
39
- let i;
40
- return o === "initialize" && (i = e(s, n)), Promise.resolve(i);
41
- },
42
- getInstance: () => e
43
- };
44
- throw r;
45
- }
46
- };
47
- function pe(t, e) {
48
- return typeof t == "undefined" ? e : t;
49
- }
50
- let Ie = class {
51
- constructor(t = {}) {
52
- this.part = t;
53
- }
54
- createCommand(t, e, s) {
55
- let n;
56
- typeof e == "function" ? n = {
57
- scope: _.Widget,
58
- stage: C.Post,
59
- defaultArgs: void 0,
60
- handlerResolver: e
61
- } : n = {
62
- scope: pe(e.scope, _.Widget),
63
- stage: pe(e.stage, C.Post),
64
- defaultArgs: e.defaultArgs,
65
- handlerResolver: s
66
- };
67
- let r = this.part;
68
- const o = t.split(".");
69
- return o.forEach((i, a) => {
70
- a === o.length - 1 ? r[i] || (r[i] = () => n) : r = this.part[i] = this.part[i] || {};
71
- }), this;
72
- }
73
- get() {
74
- return this.part;
75
- }
76
- };
77
- const Y = (t) => {
78
- const e = new Ie({});
79
- return t(e), e.get();
80
- };
81
- Y((t) => {
82
- t.createCommand(
83
- "types.register",
84
- { scope: _.Implementation, stage: C.Pre },
85
- (e) => (s, n) => {
86
- e.container.get("$types")[s] = n;
87
- }
88
- ).createCommand(
89
- "type",
90
- { stage: C.Pre },
91
- (e) => (s) => {
92
- e.container.register("$type", s);
93
- }
94
- ).createCommand(
95
- "settings",
96
- { stage: C.Pre, defaultArgs: [null] },
97
- (e) => (s) => {
98
- e.events.dispatch(
99
- "settings:change",
100
- s,
101
- { bubbles: !0 }
102
- ), e.container.register("$settings", s);
103
- }
104
- ).createCommand(
105
- "plugin",
106
- { stage: C.Pre },
107
- (e) => (s, n, r) => {
108
- const { container: o } = e;
109
- let i = null, a = s, c = n;
110
- typeof s == "string" && (i = s, a = n, c = r);
111
- const p = (h) => {
112
- const { transformPluginSettings: l } = e.container.get("$environmentOptions"), d = l ? l(
113
- c || {},
114
- i,
115
- e.container,
116
- a
117
- ) : n;
118
- try {
119
- const u = Te(
120
- i,
121
- a,
122
- o,
123
- d
124
- );
125
- o.get("$plugins").push(u), h && u.invoke("initialize", null);
126
- } catch (u) {
127
- _e(e).warn("Error when initializing plugin", u);
128
- }
129
- };
130
- e.container.get("$instance") ? p(!0) : e.events.subscribeOnce("widget:instance-created", () => p(!1));
131
- }
132
- ).createCommand(
133
- "container.register",
134
- (e) => (s, n) => {
135
- e.container.register(s, n);
136
- }
137
- ).createCommand(
138
- "container.registerAsync",
139
- (e) => (s, n) => {
140
- e.container.registerAsync(s, n);
141
- }
142
- ).createCommand(
143
- "container.registerFactory",
144
- (e) => (s, n) => {
145
- e.container.registerFactory(s, n);
146
- }
147
- ).createCommand(
148
- "container.touch",
149
- (e) => (s, n) => {
150
- e.container.touch(s, n);
151
- }
152
- ).createCommand(
153
- "csp",
154
- {},
155
- (e) => (s) => {
156
- e.container.register("csp", s);
157
- }
158
- );
159
- });
160
- const D = (t, e, ...s) => typeof e == "string" ? t(`[humany] ${e}`, ...s) : t(e, ...s), S = class {
161
- constructor() {
162
- this.keys = [], this.log = (t, ...e) => this.lookup(t, () => S.log(...e)), this.warn = (t, ...e) => this.lookup(t, () => S.warn(...e)), this.error = (t, ...e) => this.lookup(t, () => S.error(...e)), this.info = (t, ...e) => this.lookup(t, () => S.info(...e));
163
- }
164
- lookup(t, e) {
165
- this.keys.indexOf(t) === -1 && (this.keys.push(t), e());
166
- }
167
- };
168
- let g = S;
169
- g.log = (...t) => D(console.log, ...t);
170
- g.warn = (...t) => D(console.warn, ...t);
171
- g.error = (...t) => D(console.error, ...t);
172
- g.info = (...t) => D(console.info, ...t);
173
- const Oe = (t) => {
174
- let e = {}, s, n;
175
- if (typeof t != "object" || t === null)
176
- return t;
177
- e = Array.isArray(t) ? [] : {};
178
- for (n in t)
179
- s = t[n], e[n] = typeof s == "object" && s !== null ? Oe(s) : s;
180
- return e;
181
- }, De = Oe;
182
- function le(t) {
183
- let e = 0;
184
- if (t.length === 0)
185
- return e.toString();
186
- for (let s = 0; s < t.length; s++) {
187
- const n = t.charCodeAt(s);
188
- e = (e << 5) - e + n, e = e & e;
189
- }
190
- return e.toString();
191
- }
192
- let We = class {
193
- constructor(t, e) {
194
- this.lockWarningTime = t, this.lockErrorTime = e, this.tasks = [], this.current = Promise.resolve(), this.next = this.next.bind(this);
195
- }
196
- add(t, e, s, n) {
197
- this.tasks.push({ task: t, resolve: e, reject: s, done: n }), this.next();
198
- }
199
- next() {
200
- this.current = this.current.then(() => {
201
- const t = this.tasks.shift();
202
- if (t) {
203
- let e;
204
- const s = setTimeout(() => {
205
- process.env.NODE_ENV !== "production" && g.warn(
206
- `A lock has exceeded ${this.lockWarningTime} ms. Waiting additional ${this.lockErrorTime} ms before rejecting the task.`,
207
- t
208
- ), e = setTimeout(() => {
209
- t.reject("lock timeout exceeded");
210
- }, this.lockErrorTime);
211
- }, this.lockWarningTime), n = Promise.resolve(t.task()).then((r) => (clearTimeout(s), clearTimeout(e), r));
212
- return Promise.resolve(n).then(this.next).then(
213
- () => n.then((r) => {
214
- t.done(), t.resolve(r);
215
- })
216
- ).catch((r) => (t.done(), t.reject(r), this.next()));
217
- }
218
- return Promise.resolve();
219
- });
220
- }
221
- };
222
- const N = /* @__PURE__ */ new WeakMap();
223
- function W(t, e = 5e3, s = 1e3) {
224
- return N.has(t) || N.set(t, new We(e, s)), (n) => new Promise((r, o) => {
225
- const i = N.get(t);
226
- i.add(n, r, o, () => {
227
- i.tasks.length || N.delete(t);
228
- });
229
- });
230
- }
231
- const w = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
232
- function Z() {
233
- return w() + w() + "-" + w() + "-" + w() + "-" + w() + "-" + w() + w() + w();
234
- }
235
- var Je = Object.defineProperty, Ve = Object.defineProperties, ze = Object.getOwnPropertyDescriptors, ue = Object.getOwnPropertySymbols, Me = Object.prototype.hasOwnProperty, Fe = Object.prototype.propertyIsEnumerable, de = (t, e, s) => e in t ? Je(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s, Le = (t, e) => {
236
- for (var s in e || (e = {}))
237
- Me.call(e, s) && de(t, s, e[s]);
238
- if (ue)
239
- for (var s of ue(e))
240
- Fe.call(e, s) && de(t, s, e[s]);
241
- return t;
242
- }, Re = (t, e) => Ve(t, ze(e));
243
- const qe = (t) => {
244
- const e = [];
245
- return [
246
- (s, n) => {
247
- e.push(t.subscribe(s, n));
248
- },
249
- () => {
250
- e.forEach((s) => {
251
- s();
252
- });
253
- }
254
- ];
255
- };
256
- let ee = class {
257
- constructor(t, e = []) {
258
- this.platform = t, this.rules = e;
259
- }
260
- match(t) {
261
- return this.rules.every((e) => !(e.id && e.id !== t.id || e.type && e.type !== t.type));
262
- }
263
- ofType(t) {
264
- return this.rules.push({ type: t }), this;
265
- }
266
- withId(t) {
267
- return this.rules.push({ id: t }), this;
268
- }
269
- select() {
270
- return new He(this.platform, this);
271
- }
272
- };
273
- class Pe {
274
- constructor(e, s, n) {
275
- this.platform = e, this.node = s, this.actions = new te(
276
- e,
277
- new ee(e).withId(s.id),
278
- n
279
- );
280
- const [r, o] = qe(this.platform.events);
281
- this.subscribe = r, this.unsubscribe = o;
282
- }
283
- properties(e) {
284
- return e && this.node.touchProperties((s) => e(s)), this.node.attributes.properties;
285
- }
286
- context(e) {
287
- return e && this.subscribe("components:context-changed", (s, { node: n }) => {
288
- n === this.node && e(this.node.attributes.context);
289
- }), this.node.attributes.context;
290
- }
291
- layout(e) {
292
- return e && this.subscribe("components:layout-changed", (s, { node: n }) => {
293
- n === this.node && e(this.node.attributes.layout);
294
- }), this.node.attributes.layout;
295
- }
296
- writeProperties(e, s) {
297
- this.node.writeProperties(e, s);
298
- }
299
- writeContext(e, s) {
300
- this.node.writeProperties(e, s);
301
- }
302
- writeLayout(e, s) {
303
- this.node.writeLayout(e, s);
304
- }
305
- dispose() {
306
- this.unsubscribe(), this.actions.dispose();
307
- }
308
- }
309
- class He {
310
- constructor(e, s, n = !0) {
311
- this.platform = e, this.target = s, this.clearOnDispose = n, this.removes = [], this.actions = new te(this.platform, this.target);
312
- }
313
- writeProperties(e, s) {
314
- this.removes.push(
315
- this.platform.write({
316
- options: s,
317
- attributes: { properties: e },
318
- target: this.target,
319
- removable: this.clearOnDispose
320
- })
321
- );
322
- }
323
- writeContext(e, s) {
324
- this.removes.push(
325
- this.platform.write({
326
- options: s,
327
- attributes: { context: e },
328
- target: this.target,
329
- removable: this.clearOnDispose
330
- })
331
- );
332
- }
333
- writeLayout(e, s) {
334
- this.removes.push(
335
- this.platform.write({
336
- options: s,
337
- attributes: { layout: e },
338
- target: this.target,
339
- removable: this.clearOnDispose
340
- })
341
- );
342
- }
343
- dispose() {
344
- this.removes.forEach((e) => {
345
- e();
346
- }), this.actions.dispose();
347
- }
348
- }
349
- const Be = (t, e, s) => {
350
- const n = t.concat(), r = (o, i, a) => {
351
- let c = !0;
352
- if (n.length) {
353
- const p = n.shift(), h = (l, d) => (c = !1, r(l, Object.assign({}, i, d), a));
354
- return Promise.resolve(p(o, h, a)).then((l) => Re(Le({}, l), {
355
- cancelled: c
356
- }));
357
- }
358
- return Promise.resolve({ data: o, cancelled: !1, options: i });
359
- };
360
- return r(e, {}, s);
361
- };
362
- let te = class {
363
- constructor(t, e, s) {
364
- this.platform = t, this.target = e, this.ns = s, this.subscriptions = [], this.create = this.create.bind(this);
365
- }
366
- create(t, e = () => {
367
- }) {
368
- const s = {
369
- key: t,
370
- fn: e,
371
- target: this.target,
372
- ns: this.ns
373
- };
374
- this.platform.actionsState.handlers.push(s);
375
- const n = () => {
376
- const r = this.platform.actionsState.handlers.indexOf(s);
377
- r > -1 && this.platform.actionsState.handlers.splice(r, 1);
378
- };
379
- return this.subscriptions.push(n), n;
380
- }
381
- dispatch(t, e) {
382
- const s = this.platform.nodes.all.concat(
383
- this.platform.nodes.detached
384
- ), n = {}, r = this.platform.actionsState.handlers.filter(
385
- (o) => o.key === t && (!o.ns || !this.ns || o.ns === this.ns)
386
- );
387
- return Promise.all(
388
- r.map((o) => {
389
- const i = s.filter(
390
- (c) => o.target.match(c) && this.target.match(c)
391
- ), a = this.platform.actionsState.watchers.filter((c) => c.key === t && (!c.ns || !this.ns || c.ns === this.ns) && i.some((p) => c.target.match(p))).map((c) => c.fn);
392
- return Promise.all(
393
- i.map((c) => {
394
- const p = new Pe(
395
- this.platform,
396
- c,
397
- this.ns
398
- );
399
- return Be(a, e, p).then((h) => {
400
- const { data: l = {}, options: d, cancelled: u } = h;
401
- return Promise.resolve(
402
- u ? {} : o.fn(l, d, p)
403
- ).then((P) => {
404
- n[c.id] = P;
405
- });
406
- });
407
- })
408
- );
409
- })
410
- ).then(() => n);
411
- }
412
- watch(t, e) {
413
- let s = t, n = this.ns;
414
- const r = t.split(".");
415
- r.length > 1 && (n = r[0], s = r.splice(1).join("."));
416
- const o = {
417
- fn: e,
418
- target: this.target,
419
- key: s,
420
- ns: n
421
- };
422
- this.platform.actionsState.watchers.push(o);
423
- const i = () => {
424
- const a = this.platform.actionsState.watchers.indexOf(o);
425
- a > -1 && this.platform.actionsState.watchers.splice(a, 1);
426
- };
427
- return this.subscriptions.push(i), i;
428
- }
429
- dispose() {
430
- this.subscriptions.forEach((t) => t());
431
- }
432
- };
433
- Y((t) => {
434
- t.createCommand("components", (e) => (s) => {
435
- e.events.subscribeOnce("components:platform-created", (n, { platform: r }) => {
436
- s.handlers && s.handlers.forEach(([o, i]) => {
437
- r.addComponentHandler(o, i);
438
- });
439
- });
440
- });
441
- });
442
- let me = class {
443
- constructor(t, e) {
444
- this.events = t, this.tags = [], this.children = {}, this.changesets = [], this.mountCount = 0, this.id = Z(), this.type = e, this.attributes = {
445
- context: {},
446
- properties: {},
447
- layout: {},
448
- tags: []
449
- }, this.writeLayout({ size: "full", indent: 0 });
450
- }
451
- mount(t, e) {
452
- let s = t.get("mounted-nodes");
453
- return s || (s = /* @__PURE__ */ new Map(), t.register("mounted-nodes", s)), s.has(this) ? (process.env.NODE_ENV !== "production" && g.error("Trying to mount an already mounted component node.", this), () => {
454
- }) : (this.events.dispatch("components:node-mounted", { node: this }), this.mountCount === 0 && (this.mountCount = this.mountCount + 1, this.events.dispatch("components:node-enter", { node: this })), () => {
455
- 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 });
456
- });
457
- }
458
- appendChild(t, e = "default") {
459
- if (t.parent) {
460
- if (t.parent === this)
461
- return;
462
- t.parent.removeChild(t);
463
- }
464
- t.parent = this, this.children[e] || (this.children[e] = []), this.children[e].push(t), this.events.dispatch("components:node-appended", { node: t });
465
- }
466
- prependChild(t, e = "default") {
467
- if (t.parent) {
468
- if (t.parent === this)
469
- return;
470
- t.parent.removeChild(t);
471
- }
472
- t.parent = this, this.children[e] || (this.children[e] = []), this.children[e].unshift(t), this.events.dispatch("components:node-appended", { node: t });
473
- }
474
- touchProperties(t, e = {}, s) {
475
- const n = [{ properties: t }, e];
476
- return this.changesets.push(n), this.events.dispatch("components:set-properties", { node: this }), () => {
477
- if (s) {
478
- const r = this.changesets.indexOf(n);
479
- r > -1 && (this.changesets.splice(r, 1), this.events.dispatch("components:set-properties", { node: this }));
480
- }
481
- };
482
- }
483
- writeProperties(t, e = {}, s) {
484
- const n = [{ properties: t }, e];
485
- return this.changesets.push(n), this.events.dispatch("components:set-properties", { node: this }), () => {
486
- if (s) {
487
- const r = this.changesets.indexOf(n);
488
- r > -1 && (this.changesets.splice(r, 1), this.events.dispatch("components:set-properties", { node: this }));
489
- }
490
- };
491
- }
492
- writeLayout(t, e = {}, s) {
493
- const n = [{ layout: t }, e];
494
- return this.changesets.push(n), this.events.dispatch("components:set-layout", { node: this }), () => {
495
- if (!s)
496
- return;
497
- const r = this.changesets.indexOf(n);
498
- r > -1 && (this.changesets.splice(r, 1), this.events.dispatch("components:set-layout", { node: this }));
499
- };
500
- }
501
- writeContext(t, e = {}, s) {
502
- const n = [{ context: t }, e];
503
- return this.changesets.push(n), this.events.dispatch("components:set-context", { node: this }), () => {
504
- if (!s)
505
- return;
506
- const r = this.changesets.indexOf(n);
507
- r > -1 && (this.changesets.splice(r, 1), this.events.dispatch("components:set-context", { node: this }));
508
- };
509
- }
510
- getChildren(t = "default") {
511
- const e = this.children[t] || [];
512
- return e.reduce((s, n, r) => {
513
- const { order: o = r } = n.attributes.layout;
514
- return s[o] ? s.splice(o, 0, n) : s[o] = n, s;
515
- }, Array(e.length));
516
- }
517
- remove() {
518
- this.parent && this.parent.removeChild(this);
519
- }
520
- removeChild(t) {
521
- Object.keys(this.children).forEach((e) => {
522
- const s = this.children[e], n = s.indexOf(t);
523
- n > -1 && (s.splice(n, 1), this.events.dispatch("components:node-removed", { node: t, parentNode: this }));
524
- }), delete t.parent;
525
- }
526
- };
527
- const Ce = (t, e, s) => {
528
- for (let n = 0, r = t.length; n < r && s(t[n]) !== !0; n++) {
529
- const o = e[t[n].id] || "default", i = t[n].getChildren(o);
530
- Ce(i, e, s);
531
- }
532
- }, se = (t, e, s) => {
533
- if (s(t) !== !0) {
534
- const n = e[t.id] || "default", r = t.children[n];
535
- Ce(r, e, s);
536
- }
537
- }, L = (t, e) => {
538
- const s = [];
539
- return se(t, e, (n) => {
540
- s.push(n);
541
- }), s;
542
- }, Ue = (t, e, s) => {
543
- let n;
544
- return se(t, e, (r) => {
545
- if (s(r))
546
- return n = r, !0;
547
- }), n;
548
- };
549
- let Ke = class {
550
- constructor(t, e, s) {
551
- this.root = t, this.switches = e, this.all = [], this.visible = [], this.detached = [], s.subscribe("components:node-appended", (n, r) => {
552
- this.all.push(r.node), this.visible = L(t, e);
553
- }), s.subscribe("components:node-removed", (n, r) => {
554
- let o = this.all.indexOf(r.node);
555
- o > -1 && this.all.splice(o, 1), o = this.visible.indexOf(r.node), o > -1 && this.visible.splice(o, 1), this.visible = L(t, e);
556
- }), s.subscribe("components:node-switched", (n, r) => {
557
- this.visible = L(t, e);
558
- });
559
- }
560
- query(t = {}) {
561
- const e = [];
562
- return se(this.root, this.switches, (s) => {
563
- Object.keys(t).every((n) => t[n] === s[n]) && e.push(s);
564
- }), e;
565
- }
566
- get(t) {
567
- return Ue(this.root, this.switches, (e) => e.id === t) || this.detached.find((e) => e.id === t);
568
- }
569
- }, Ge = class {
570
- constructor() {
571
- this.handlers = /* @__PURE__ */ new Map();
572
- }
573
- add(t, e) {
574
- this.handlers.set(t, e);
575
- }
576
- get(t) {
577
- return this.handlers.get(t);
578
- }
579
- };
580
- const Qe = (t) => {
581
- let e = t, s = 0;
582
- for (; e.parent; )
583
- s = s + 1, e = e.parent;
584
- return s;
585
- }, Xe = (t) => t.map(([e, s]) => [Qe(e), e, s]).sort(([e], [s]) => e - s).map(([, e, s]) => [e, s]), R = (t) => t instanceof Date ? !1 : t && typeof t == "object" && !Array.isArray(t), v = (t, ...e) => {
586
- if (!e.length)
587
- return t;
588
- const s = e.shift();
589
- if (R(t) && R(s))
590
- for (const n in s)
591
- R(s[n]) ? (t[n] || Object.assign(t, { [n]: {} }), v(t[n], s[n])) : Object.assign(t, { [n]: s[n] });
592
- return v(t, ...e);
593
- }, Ye = (t, e) => !t || t === "all" ? !0 : t.some((s) => e.indexOf(s) > -1), Ze = (t, e) => {
594
- let s = [], n = [], r;
595
- const o = () => {
596
- process.env.NODE_ENV !== "production" && console.time("state-processor.flush");
597
- const a = /* @__PURE__ */ new Map(), c = Xe(s.map((h, l) => [h, n[l]])), p = (h, l) => {
598
- var d;
599
- const u = a.get(h) || {}, P = l.context && !u.context, V = l.properties && !u.properties, z = l.layout && !u.layout;
600
- a.set(h, {
601
- context: u.context || P,
602
- properties: u.properties || V,
603
- layout: u.layout || z
604
- }), V && (h.attributes.properties = {}), z && (h.attributes.layout = {}), P && (h.attributes.context = v({}, (d = h.parent) == null ? void 0 : d.attributes.context));
605
- const ae = [], ce = [], he = [];
606
- if (h.changesets.forEach((y) => {
607
- const [f, M] = y;
608
- Ye(M.breakpoints, t.breakpoints) && (V && (typeof f.properties == "function" ? ae.push(
609
- f.properties
610
- ) : v(h.attributes.properties, f.properties)), z && (typeof f.layout == "function" ? ce.push(f.layout) : v(h.attributes.layout, f.layout)), P && (typeof f.context == "function" ? he.push(f.context) : v(h.attributes.context, f.context)));
611
- }), ae.forEach((y) => {
612
- v(h.attributes.properties, y(h.attributes.properties));
613
- }), ce.forEach((y) => {
614
- v(h.attributes.layout, y(h.attributes.layout));
615
- }), he.forEach((y) => {
616
- v(h.attributes.context, y(h.attributes.context));
617
- }), P || l.recursive) {
618
- const y = t.getBranch(h), f = l.recursive ? l : {
619
- context: !!P
620
- };
621
- h.getChildren(y).forEach((M) => {
622
- p(M, f);
623
- });
624
- }
625
- };
626
- process.env.NODE_ENV !== "production" && console.timeEnd("state-processor.flush"), c.forEach(([h, l]) => {
627
- p(h, l);
628
- }), s = [], n = [], e(a);
629
- }, i = () => {
630
- clearTimeout(r), r = setTimeout(o, 0);
631
- };
632
- return (a, c) => {
633
- const p = s.indexOf(a);
634
- if (p > -1) {
635
- const h = n[p];
636
- return c.context && (h.context = !0), c.properties && (h.properties = !0), c.layout && (h.layout = !0), c.recursive && (h.recursive = !0), i();
637
- }
638
- return s.push(a), n.push(c), i();
639
- };
640
- };
641
- let et = class {
642
- constructor(t, e = {}) {
643
- this.providers = e, this.breakpoints = [], this.actionsState = { handlers: [], watchers: [] }, this.switches = {}, this.changesets = [], this.subscriptions = [], this.customComponentHandler = new Ge(), this.events = t.events.createChild(this);
644
- const s = new me(this.events, "root");
645
- s.name = `root-${t.name}`, this.nodes = new Ke(s, this.switches, this.events);
646
- const n = this.processNode = Ze(this, (r) => {
647
- const o = Array.from(r.keys());
648
- process.env.NODE_ENV !== "production" && console.info(`STATE PROCESSOR: ${o.length} node(s) processed:
649
- ${o.map(
650
- (i) => `${i.name || "<no name>"} (${i.id})
651
- `
652
- )}`), o.forEach((i) => {
653
- const a = r.get(i);
654
- i.parent && i.parent.type === "root" && this.events.dispatch("components:root-children-changed", { node: i }), a != null && a.context && this.events.dispatch("components:context-changed", { node: i }), a != null && a.properties && this.events.dispatch("components:properties-changed", { node: i }), a != null && a.layout && this.events.dispatch("components:layout-changed", { node: i });
655
- }), this.events.dispatch("components:component-model-initialized", {}, { bubbles: !0 });
656
- });
657
- Promise.all(
658
- Object.keys(e).map((r) => e[r].load(this))
659
- ), this.subscriptions.push(
660
- this.events.subscribe(
661
- "components:node-appended",
662
- (r, o) => {
663
- const { node: i } = o;
664
- this.changesets.forEach((a) => {
665
- const { changeset: c, target: p, removes: h } = a, [l, d] = c;
666
- p.match(o.node) && (l.properties && h.push(i.writeProperties(l.properties, d)), l.context && h.push(i.writeContext(l.context, d)), l.layout && h.push(i.writeLayout(l.layout, d)));
667
- });
668
- }
669
- )
670
- ), this.subscriptions.push(
671
- this.events.subscribe(
672
- "components:node-appended",
673
- (r, o) => {
674
- n(o.node, { properties: !0, context: !0 });
675
- }
676
- )
677
- ), this.subscriptions.push(
678
- this.events.subscribe(
679
- "components:set-properties",
680
- (r, o) => {
681
- n(o.node, { properties: !0 });
682
- }
683
- )
684
- ), this.subscriptions.push(
685
- this.events.subscribe(
686
- "components:set-context",
687
- (r, o) => {
688
- n(o.node, { properties: !0, context: !0 });
689
- }
690
- )
691
- ), this.subscriptions.push(
692
- this.events.subscribe(
693
- "components:set-indent",
694
- (r, o) => {
695
- n(o.node, { layout: !0 });
696
- }
697
- )
698
- ), this.subscriptions.push(
699
- this.events.subscribe(
700
- "components:set-layout",
701
- (r, o) => {
702
- n(o.node, { layout: !0 });
703
- }
704
- )
705
- ), this.subscriptions.push(
706
- this.events.subscribe("components:node-switched", (r, { node: o, branch: i }) => {
707
- n(o, {
708
- layout: !0,
709
- recursive: !0,
710
- properties: !0,
711
- context: !0
712
- });
713
- })
714
- ), this.subscriptions.push(
715
- this.events.subscribe("components:node-removed", (r, { parentNode: o }) => {
716
- n(o, { properties: !0 });
717
- })
718
- ), this.events.parent && this.events.parent.dispatch("components:platform-created", { platform: this });
719
- }
720
- static getInstance(t) {
721
- return t.getAsync("components");
722
- }
723
- addBreakpoint(t) {
724
- this.breakpoints.indexOf(t) === -1 && (this.breakpoints.push(t), this.processNode(this.nodes.root, {
725
- context: !0,
726
- properties: !0,
727
- layout: !0,
728
- recursive: !0
729
- }));
730
- }
731
- removeBreakpoint(t) {
732
- const e = this.breakpoints.indexOf(t);
733
- e > -1 && (this.breakpoints.splice(e, 1), this.processNode(this.nodes.root, {
734
- context: !0,
735
- properties: !0,
736
- layout: !0,
737
- recursive: !0
738
- }));
739
- }
740
- setSwitch(t, e) {
741
- this.switches[t.id] = e, this.events.dispatch("components:node-switched", { node: t, branch: e });
742
- }
743
- getBranch(t) {
744
- return this.switches[t.id];
745
- }
746
- /**
747
- * Creates a `ComponentNode` of the specified type.
748
- * @param type Type of node.
749
- */
750
- createNode(t, e = {}) {
751
- const s = new me(this.events, t);
752
- return e.detached && this.nodes.detached.push(s), s;
753
- }
754
- components() {
755
- return new ee(this);
756
- }
757
- actions(t, e) {
758
- return new te(this, t, e);
759
- }
760
- write(t) {
761
- const { provider: e, target: s, attributes: n, options: r = {}, removable: o } = t, i = t.key || Z(), a = { changeset: [n, r], target: s, removes: [] };
762
- if (e) {
763
- const c = this.providers[e];
764
- c.write(i, s, n, r), a.removes.push(() => {
765
- c.remove(i);
766
- });
767
- }
768
- return this.changesets.push(a), this.nodes.all.forEach((c) => {
769
- if (s.match(c)) {
770
- let p = () => {
771
- };
772
- n.properties && (p = c.writeProperties(n.properties, r, o)), n.context && (p = c.writeContext(n.context, r, o)), n.layout && (p = c.writeContext(n.layout, r, o)), a.removes.push(p);
773
- }
774
- }), () => {
775
- if (o) {
776
- a.removes.forEach((p) => p());
777
- const c = this.changesets.indexOf(a);
778
- c > -1 && this.changesets.splice(c, 1);
779
- }
780
- };
781
- }
782
- addComponentHandler(t, e) {
783
- this.customComponentHandler.add(t, e);
784
- }
785
- getComponentHandler(t) {
786
- return this.customComponentHandler.get(t);
787
- }
788
- dispose() {
789
- this.subscriptions.forEach((t) => t());
790
- }
791
- };
792
- const tt = (t, e, s, n = Z(), r = {}) => t.getAsync("components").then((o) => {
793
- let i;
794
- if (typeof e == "string") {
795
- const p = new ee(o);
796
- p.ofType(e), i = p;
797
- } else
798
- i = e;
799
- const a = {}, c = (p) => {
800
- const h = a[p.id];
801
- return h ? Promise.resolve(h.controller) : et.getInstance(t).then((l) => new Pe(l, p, n));
802
- };
803
- o.events.subscribe(
804
- "components:node-enter",
805
- (p, { node: h }) => {
806
- i.match(h) && c(h).then((l) => {
807
- Promise.resolve(s(l)).then((d) => {
808
- a[h.id] = {
809
- dispose: d,
810
- controller: l
811
- };
812
- });
813
- });
814
- }
815
- ), o.events.subscribe(
816
- "components:node-exit",
817
- (p, { node: h }) => {
818
- const l = a[h.id];
819
- l && (l.dispose && l.dispose(), r.reuseController || (l.controller.dispose(), delete a[h.id]));
820
- }
821
- );
822
- });
823
- process.env.NODE_ENV;
824
- var st = Object.defineProperty, ge = Object.getOwnPropertySymbols, nt = Object.prototype.hasOwnProperty, rt = Object.prototype.propertyIsEnumerable, fe = (t, e, s) => e in t ? st(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s, k = (t, e) => {
825
- for (var s in e || (e = {}))
826
- nt.call(e, s) && fe(t, s, e[s]);
827
- if (ge)
828
- for (var s of ge(e))
829
- rt.call(e, s) && fe(t, s, e[s]);
830
- return t;
831
- }, b = /* @__PURE__ */ ((t) => (t.Cookie = "cookie", t.Local = "local", t.Session = "session", t))(b || {}), ne = /* @__PURE__ */ ((t) => (t.Tenant = "tenant", t.Implementation = "implementation", t.Widget = "widget", t))(ne || {}), m = /* @__PURE__ */ ((t) => (t.Necessary = "necessary", t.Functional = "functional", t.Analytical = "analytical", t.Marketing = "marketing", t))(m || {});
832
- const ot = (t, e, s, n = {}) => ye(t, s).then((r) => (process.env.NODE_ENV !== "production" && r && g.warn(
833
- `createStorageWriter: Attempted to create storage writer using unallowed category.
834
- Key: ${e}
835
- Category: ${JSON.stringify(s)}
836
- Options: ${JSON.stringify(n)}`
837
- ), (o) => (oe(t), ye(t, s).then((i) => {
838
- if (i) {
839
- process.env.NODE_ENV !== "production" && g.warn(
840
- `storageWriter: Attempted to write to storage using unallowed category.
841
- Key: ${e}
842
- Category: ${JSON.stringify(s)}
843
- Value: ${JSON.stringify(o)}
844
- Options: ${JSON.stringify(n)}`
845
- );
846
- return;
847
- }
848
- const {
849
- scope: a = ne.Widget,
850
- medium: c = b.Session,
851
- duration: p
852
- } = n, h = ct();
853
- return h[a][e] = Ee(o, s, p), c === b.Cookie ? dt(t, h) : gt(t, c, h);
854
- })))), it = (t, e, s = b.Session) => (oe(t), typeof e == "undefined" ? (process.env.NODE_ENV !== "production" && g.warn("readStorage: Undefined key passed when reading storage. ", e, s), Promise.resolve(void 0)) : s === b.Cookie ? ut(t).then((n) => X(n, e)) : mt(t, s).then((n) => X(n, e))), E = (t) => !!Object.entries(t).filter(([e, s]) => typeof s != "undefined").length, q = (t) => Object.entries(t).filter(([e, s]) => typeof s != "undefined").forEach(([e, { value: s }]) => {
855
- typeof s == "undefined" && delete t[e];
856
- }), xe = (t, e) => {
857
- const s = {
858
- tenant: k(k({}, t.tenant), e.tenant),
859
- implementation: k(k({}, t.implementation), e.implementation),
860
- widget: k(k({}, t.widget), e.widget)
861
- };
862
- return q(s.tenant), q(s.implementation), q(s.widget), s;
863
- }, at = (t) => Object.entries(t).reduce((e, s) => {
864
- const [n, r] = s;
865
- return Object.entries(r).forEach((o) => {
866
- const [i, { expiration: a }] = o;
867
- a && e.push(a);
868
- }), e;
869
- }, []).slice().sort((e, s) => new Date(s).valueOf() - new Date(e).valueOf()).shift() || ie(), J = (t) => {
870
- const {
871
- name: e,
872
- implementation: { name: s, tenant: n }
873
- } = t.get("$widget");
874
- return [
875
- `humany_${n}`,
876
- `humany_${le(n + s)}`,
877
- `humany_${le(n + s + e)}`
878
- ];
879
- }, H = (t) => {
880
- const e = new RegExp(`(?:^|;)\\s?${t}=(.*?)(?:;|$)`, "i"), s = document.cookie.match(e);
881
- return s && s[1] && JSON.parse(s[1]) || void 0;
882
- }, B = (t, e, s) => {
883
- const n = `${t}=${JSON.stringify(e).trim()}`, r = `expires=${new Date(s).toUTCString()}`, o = "path=/", i = "SameSite=None;Secure";
884
- return document.cookie = `${n}; ${r}; ${o}; ${i}`;
885
- }, re = (t) => {
886
- const [e, s, n] = J(t), r = H(e) || {}, o = H(s) || {}, i = H(n) || {};
887
- return {
888
- tenant: r,
889
- implementation: o,
890
- widget: i
891
- };
892
- }, ke = (t, e) => {
893
- const s = re(t), n = xe(s, e), [r, o, i] = J(t), { tenant: a, implementation: c, widget: p } = n, h = at(e), l = ie({ days: -1 });
894
- B(r, a, E(a) ? h : l), B(
895
- o,
896
- c,
897
- E(c) ? h : l
898
- ), B(i, p, E(p) ? h : l);
899
- }, T = (t, e) => {
900
- const [s, n, r] = J(t), o = e.getItem(s) || "{}", i = e.getItem(n) || "{}", a = e.getItem(r) || "{}";
901
- return {
902
- tenant: JSON.parse(o),
903
- implementation: JSON.parse(i),
904
- widget: JSON.parse(a)
905
- };
906
- }, Q = (t, e, s) => {
907
- const n = T(t, e), r = xe(n, s), [o, i, a] = J(t), { tenant: c, implementation: p, widget: h } = r;
908
- E(c) ? e.setItem(o, JSON.stringify(c)) : e.removeItem(o), E(p) ? e.setItem(i, JSON.stringify(p)) : e.removeItem(i), E(h) ? e.setItem(a, JSON.stringify(h)) : e.removeItem(a);
909
- }, ct = () => ({ tenant: {}, implementation: {}, widget: {} }), ht = (t) => t ? !!t && /* @__PURE__ */ new Date() > new Date(t) : !1, X = (t, e) => {
910
- const s = t.widget[e] || t.implementation[e] || t.tenant[e];
911
- return s == null ? void 0 : s.value;
912
- }, Ee = (t, e, s) => s ? {
913
- value: t,
914
- category: e,
915
- expiration: typeof s == "object" ? ie(s) : s
916
- } : {
917
- value: t,
918
- category: e
919
- }, pt = (t, e) => {
920
- const s = De(t);
921
- return Object.entries(s).forEach(([n, r]) => {
922
- Object.entries(r).forEach(([o, i]) => {
923
- const { expiration: a, category: c } = i;
924
- (ht(a) || lt(e, c)) && (r[o] = Ee(void 0, c, a));
925
- });
926
- }), s;
927
- }, ye = (t, e) => it(t, "storagePolicy", b.Cookie).then(
928
- (s = [m.Necessary]) => !!e && s.indexOf(e) === -1
929
- ), lt = (t = [m.Necessary], e) => !!e && t.indexOf(e) === -1, oe = (t) => {
930
- const e = re(t), s = T(t, window.localStorage), n = T(t, sessionStorage), r = X(e, "storagePolicy"), [o, i, a] = [
931
- e,
932
- s,
933
- n
934
- ].map((c) => pt(c, r));
935
- ke(t, o), Q(t, window.localStorage, i), Q(t, window.sessionStorage, a);
936
- }, ie = (t = { days: 30 }) => {
937
- const { days: e = 0, hours: s = 0, minutes: n = 0, seconds: r = 0 } = t, o = /* @__PURE__ */ new Date();
938
- return o.setTime(o.getTime() + s * 60 * 60 * 1e3), o.setTime(o.getTime() + e * 24 * 60 * 60 * 1e3), o.setTime(o.getTime() + n * 60 * 1e3), o.setTime(o.getTime() + r * 1e3), o.toISOString();
939
- }, ut = (t) => W(document)(() => re(t)), dt = (t, e) => W(document)(() => ke(t, e)), mt = (t, e) => {
940
- const s = e === b.Local ? window.localStorage : window.sessionStorage;
941
- return W(s)(() => T(t, s));
942
- }, gt = (t, e, s) => {
943
- const n = e === b.Local ? window.localStorage : window.sessionStorage;
944
- return W(n)(() => Q(t, n, s));
945
- }, U = (t, e, s, ...n) => {
946
- const r = `[${t.get("$environment").name || "webprovisions"}] ${s}`;
947
- switch (e) {
948
- case "info":
949
- console.info(r, ...n);
950
- break;
951
- case "warning":
952
- console.warn(r, ...n);
953
- break;
954
- case "error":
955
- console.error(r, ...n);
956
- break;
957
- }
958
- }, ft = (t) => {
959
- const e = t.container || t;
960
- return {
961
- info: (s, ...n) => U(e, "info", s, ...n),
962
- warn: (s, ...n) => U(e, "warning", s, ...n),
963
- error: (s, ...n) => U(e, "error", s, ...n)
964
- };
965
- };
966
- var I = /* @__PURE__ */ ((t) => (t.Implementation = "implementation", t.Widget = "widget", t))(I || {}), x = /* @__PURE__ */ ((t) => (t.Pre = "pre", t.Post = "post", t))(x || {});
967
- const yt = (t, e, s, n) => {
968
- try {
969
- const r = new e(s, n);
970
- return {
971
- name: t,
972
- invoke: (o, i) => {
973
- let a;
974
- return r[o] && (a = r[o].call(r, i)), Promise.resolve(a);
975
- },
976
- getInstance: () => r
977
- };
978
- } catch (r) {
979
- if (r.message && r.message.indexOf("is not a constructor") >= 0)
980
- return {
981
- name: t,
982
- invoke: (o) => {
983
- let i;
984
- return o === "initialize" && (i = e(s, n)), Promise.resolve(i);
985
- },
986
- getInstance: () => e
987
- };
988
- throw r;
989
- }
990
- };
991
- function ve(t, e) {
992
- return typeof t == "undefined" ? e : t;
993
- }
994
- let vt = class {
995
- constructor(t = {}) {
996
- this.part = t;
997
- }
998
- createCommand(t, e, s) {
999
- let n;
1000
- typeof e == "function" ? n = {
1001
- scope: I.Widget,
1002
- stage: x.Post,
1003
- defaultArgs: void 0,
1004
- handlerResolver: e
1005
- } : n = {
1006
- scope: ve(e.scope, I.Widget),
1007
- stage: ve(e.stage, x.Post),
1008
- defaultArgs: e.defaultArgs,
1009
- handlerResolver: s
1010
- };
1011
- let r = this.part;
1012
- const o = t.split(".");
1013
- return o.forEach((i, a) => {
1014
- a === o.length - 1 ? r[i] || (r[i] = () => n) : r = this.part[i] = this.part[i] || {};
1015
- }), this;
1016
- }
1017
- get() {
1018
- return this.part;
1019
- }
1020
- };
1021
- const Se = (t) => {
1022
- const e = new vt({});
1023
- return t(e), e.get();
1024
- };
1025
- Se((t) => {
1026
- t.createCommand(
1027
- "types.register",
1028
- { scope: I.Implementation, stage: x.Pre },
1029
- (e) => (s, n) => {
1030
- e.container.get("$types")[s] = n;
1031
- }
1032
- ).createCommand(
1033
- "type",
1034
- { stage: x.Pre },
1035
- (e) => (s) => {
1036
- e.container.register("$type", s);
1037
- }
1038
- ).createCommand(
1039
- "settings",
1040
- { stage: x.Pre, defaultArgs: [null] },
1041
- (e) => (s) => {
1042
- e.events.dispatch(
1043
- "settings:change",
1044
- s,
1045
- { bubbles: !0 }
1046
- ), e.container.register("$settings", s);
1047
- }
1048
- ).createCommand(
1049
- "plugin",
1050
- { stage: x.Pre },
1051
- (e) => (s, n, r) => {
1052
- const { container: o } = e;
1053
- let i = null, a = s, c = n;
1054
- typeof s == "string" && (i = s, a = n, c = r);
1055
- const p = (h) => {
1056
- const { transformPluginSettings: l } = e.container.get("$environmentOptions"), d = l ? l(
1057
- c || {},
1058
- i,
1059
- e.container,
1060
- a
1061
- ) : n;
1062
- try {
1063
- const u = yt(
1064
- i,
1065
- a,
1066
- o,
1067
- d
1068
- );
1069
- o.get("$plugins").push(u), h && u.invoke("initialize", null);
1070
- } catch (u) {
1071
- ft(e).warn("Error when initializing plugin", u);
1072
- }
1073
- };
1074
- e.container.get("$instance") ? p(!0) : e.events.subscribeOnce("widget:instance-created", () => p(!1));
1075
- }
1076
- ).createCommand(
1077
- "container.register",
1078
- (e) => (s, n) => {
1079
- e.container.register(s, n);
1080
- }
1081
- ).createCommand(
1082
- "container.registerAsync",
1083
- (e) => (s, n) => {
1084
- e.container.registerAsync(s, n);
1085
- }
1086
- ).createCommand(
1087
- "container.registerFactory",
1088
- (e) => (s, n) => {
1089
- e.container.registerFactory(s, n);
1090
- }
1091
- ).createCommand(
1092
- "container.touch",
1093
- (e) => (s, n) => {
1094
- e.container.touch(s, n);
1095
- }
1096
- ).createCommand(
1097
- "csp",
1098
- {},
1099
- (e) => (s) => {
1100
- e.container.register("csp", s);
1101
- }
1102
- );
1103
- });
1104
- Se((t) => {
1105
- t.createCommand("storage", (e) => (s = {}) => {
1106
- const { consent: n } = s;
1107
- if (typeof n != "undefined") {
1108
- if (typeof n != "number" && typeof n != "string" && !Array.isArray(n)) {
1109
- process.env.NODE_ENV !== "production" && g.warn(
1110
- `storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.
1111
- Passed consent: ${JSON.stringify(n)}`
1112
- );
1113
- return;
1114
- }
1115
- if (Array.isArray(n) && !n.every(
1116
- (o) => typeof o == "number" || typeof o == "string"
1117
- )) {
1118
- process.env.NODE_ENV !== "production" && g.warn(
1119
- `storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.
1120
- Passed consent: ${JSON.stringify(n)}`
1121
- );
1122
- return;
1123
- }
1124
- const r = [
1125
- m.Necessary,
1126
- m.Functional,
1127
- m.Analytical,
1128
- m.Marketing
1129
- ].filter((o, i, a) => typeof n == "number" ? n > i : typeof n == "string" ? a.indexOf(n) + 1 > i : Array.isArray(n) ? n.findIndex((c) => c === i + 1 || c === o) > -1 : !0);
1130
- return r.indexOf(m.Necessary) === -1 && (process.env.NODE_ENV !== "production" && g.warn(
1131
- `storagePolicyConfigurationApi: passed consent does not include category: '${m.Necessary}'. Consent has to atleast include the '${m.Necessary}' category.
1132
- Passed consent: ${JSON.stringify(n)}`
1133
- ), r.unshift(m.Necessary)), ot(
1134
- e.container,
1135
- "storagePolicy",
1136
- m.Necessary,
1137
- {
1138
- medium: b.Cookie,
1139
- scope: ne.Tenant,
1140
- duration: { days: 365 }
1141
- }
1142
- ).then((o) => o(r)).then(() => {
1143
- oe(e.container), e.events.dispatch("storage:policy-changed", r);
1144
- });
1145
- }
1146
- });
1147
- });
1148
- function $e(t) {
1149
- if (t.__esModule)
1150
- return t;
1151
- var e = t.default;
1152
- if (typeof e == "function") {
1153
- var s = function n() {
1154
- if (this instanceof n) {
1155
- var r = [null];
1156
- r.push.apply(r, arguments);
1157
- var o = Function.bind.apply(e, r);
1158
- return new o();
1159
- }
1160
- return e.apply(this, arguments);
1161
- };
1162
- s.prototype = e.prototype;
1163
- } else
1164
- s = {};
1165
- return Object.defineProperty(s, "__esModule", { value: !0 }), Object.keys(t).forEach(function(n) {
1166
- var r = Object.getOwnPropertyDescriptor(t, n);
1167
- Object.defineProperty(s, n, r.get ? r : {
1168
- enumerable: !0,
1169
- get: function() {
1170
- return t[n];
1171
- }
1172
- });
1173
- }), s;
1174
- }
1175
- var Ne = function() {
1176
- };
1177
- process.env.NODE_ENV !== "production" && (Ne = function(t, e, s) {
1178
- var n = arguments.length;
1179
- s = new Array(n > 2 ? n - 2 : 0);
1180
- for (var r = 2; r < n; r++)
1181
- s[r - 2] = arguments[r];
1182
- if (e === void 0)
1183
- throw new Error(
1184
- "`warning(condition, format, ...args)` requires a warning message argument"
1185
- );
1186
- if (e.length < 10 || /^[s\W]*$/.test(e))
1187
- throw new Error(
1188
- "The warning format should be able to uniquely identify this warning. Please, use a more descriptive format than: " + e
1189
- );
1190
- if (!t) {
1191
- var o = 0, i = "Warning: " + e.replace(/%s/g, function() {
1192
- return s[o++];
1193
- });
1194
- typeof console != "undefined" && console.error(i);
1195
- try {
1196
- throw new Error(i);
1197
- } catch (a) {
1198
- }
1199
- }
1200
- });
1201
- var bt = Ne, wt = bt;
1202
- Ot(wt);
1203
- function Ot(t) {
1204
- return t && t.__esModule ? t : { default: t };
1205
- }
1206
- function A(t) {
1207
- return t.charAt(0) === "/";
1208
- }
1209
- function K(t, e) {
1210
- for (var s = e, n = s + 1, r = t.length; n < r; s += 1, n += 1)
1211
- t[s] = t[n];
1212
- t.pop();
1213
- }
1214
- function Pt(t) {
1215
- var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", s = t && t.split("/") || [], n = e && e.split("/") || [], r = t && A(t), o = e && A(e), i = r || o;
1216
- if (t && A(t) ? n = s : s.length && (n.pop(), n = n.concat(s)), !n.length)
1217
- return "/";
1218
- var a = void 0;
1219
- if (n.length) {
1220
- var c = n[n.length - 1];
1221
- a = c === "." || c === ".." || c === "";
1222
- } else
1223
- a = !1;
1224
- for (var p = 0, h = n.length; h >= 0; h--) {
1225
- var l = n[h];
1226
- l === "." ? K(n, h) : l === ".." ? (K(n, h), p++) : p && (K(n, h), p--);
1227
- }
1228
- if (!i)
1229
- for (; p--; p)
1230
- n.unshift("..");
1231
- i && n[0] !== "" && (!n[0] || !A(n[0])) && n.unshift("");
1232
- var d = n.join("/");
1233
- return a && d.substr(-1) !== "/" && (d += "/"), d;
1234
- }
1235
- const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1236
- __proto__: null,
1237
- default: Pt
1238
- }, Symbol.toStringTag, { value: "Module" })), xt = /* @__PURE__ */ $e(Ct);
1239
- var be = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
1240
- return typeof t;
1241
- } : function(t) {
1242
- return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1243
- };
1244
- function j(t, e) {
1245
- if (t === e)
1246
- return !0;
1247
- if (t == null || e == null)
1248
- return !1;
1249
- if (Array.isArray(t))
1250
- return Array.isArray(e) && t.length === e.length && t.every(function(c, p) {
1251
- return j(c, e[p]);
1252
- });
1253
- var s = typeof t == "undefined" ? "undefined" : be(t), n = typeof e == "undefined" ? "undefined" : be(e);
1254
- if (s !== n)
1255
- return !1;
1256
- if (s === "object") {
1257
- var r = t.valueOf(), o = e.valueOf();
1258
- if (r !== t || o !== e)
1259
- return j(r, o);
1260
- var i = Object.keys(t), a = Object.keys(e);
1261
- return i.length !== a.length ? !1 : i.every(function(c) {
1262
- return j(t[c], e[c]);
1263
- });
1264
- }
1265
- return !1;
1266
- }
1267
- const kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1268
- __proto__: null,
1269
- default: j
1270
- }, Symbol.toStringTag, { value: "Module" })), Et = /* @__PURE__ */ $e(kt);
1271
- var St = xt;
1272
- Ae(St);
1273
- var $t = Et;
1274
- Ae($t);
1275
- function Ae(t) {
1276
- return t && t.__esModule ? t : { default: t };
1277
- }
1278
- Y((t) => {
1279
- t.createCommand("routing", (e) => (s) => {
1280
- const n = {
1281
- mode: s.mode
1282
- };
1283
- s.basePath && (n.basePath = s.basePath), e.container.register("routingSettings", n);
1284
- });
1285
- });
1286
- const G = (t, e, s, ...n) => {
1287
- const r = `[${t.get("$environment").name || "webprovisions"}] ${s}`;
1288
- switch (e) {
1289
- case "info":
1290
- console.info(r, ...n);
1291
- break;
1292
- case "warning":
1293
- console.warn(r, ...n);
1294
- break;
1295
- case "error":
1296
- console.error(r, ...n);
1297
- break;
1298
- }
1299
- }, Nt = (t) => {
1300
- const e = t.container || t;
1301
- return {
1302
- info: (s, ...n) => G(e, "info", s, ...n),
1303
- warn: (s, ...n) => G(e, "warning", s, ...n),
1304
- error: (s, ...n) => G(e, "error", s, ...n)
1305
- };
1306
- };
1307
- var $ = /* @__PURE__ */ ((t) => (t.Implementation = "implementation", t.Widget = "widget", t))($ || {}), O = /* @__PURE__ */ ((t) => (t.Pre = "pre", t.Post = "post", t))(O || {});
1308
- const At = (t, e, s, n) => {
1309
- try {
1310
- const r = new e(s, n);
1311
- return {
1312
- name: t,
1313
- invoke: (o, i) => {
1314
- let a;
1315
- return r[o] && (a = r[o].call(r, i)), Promise.resolve(a);
1316
- },
1317
- getInstance: () => r
1318
- };
1319
- } catch (r) {
1320
- if (r.message && r.message.indexOf("is not a constructor") >= 0)
1321
- return {
1322
- name: t,
1323
- invoke: (o) => {
1324
- let i;
1325
- return o === "initialize" && (i = e(s, n)), Promise.resolve(i);
1326
- },
1327
- getInstance: () => e
1328
- };
1329
- throw r;
1330
- }
1331
- };
1332
- function we(t, e) {
1333
- return typeof t == "undefined" ? e : t;
1334
- }
1335
- class jt {
1336
- constructor(e = {}) {
1337
- this.part = e;
1338
- }
1339
- createCommand(e, s, n) {
1340
- let r;
1341
- typeof s == "function" ? r = {
1342
- scope: $.Widget,
1343
- stage: O.Post,
1344
- defaultArgs: void 0,
1345
- handlerResolver: s
1346
- } : r = {
1347
- scope: we(s.scope, $.Widget),
1348
- stage: we(s.stage, O.Post),
1349
- defaultArgs: s.defaultArgs,
1350
- handlerResolver: n
1351
- };
1352
- let o = this.part;
1353
- const i = e.split(".");
1354
- return i.forEach((a, c) => {
1355
- c === i.length - 1 ? o[a] || (o[a] = () => r) : o = this.part[a] = this.part[a] || {};
1356
- }), this;
1357
- }
1358
- get() {
1359
- return this.part;
1360
- }
1361
- }
1362
- const je = (t) => {
1363
- const e = new jt({});
1364
- return t(e), e.get();
1365
- };
1366
- je((t) => {
1367
- t.createCommand(
1368
- "types.register",
1369
- { scope: $.Implementation, stage: O.Pre },
1370
- (e) => (s, n) => {
1371
- e.container.get("$types")[s] = n;
1372
- }
1373
- ).createCommand(
1374
- "type",
1375
- { stage: O.Pre },
1376
- (e) => (s) => {
1377
- e.container.register("$type", s);
1378
- }
1379
- ).createCommand(
1380
- "settings",
1381
- { stage: O.Pre, defaultArgs: [null] },
1382
- (e) => (s) => {
1383
- e.events.dispatch(
1384
- "settings:change",
1385
- s,
1386
- { bubbles: !0 }
1387
- ), e.container.register("$settings", s);
1388
- }
1389
- ).createCommand(
1390
- "plugin",
1391
- { stage: O.Pre },
1392
- (e) => (s, n, r) => {
1393
- const { container: o } = e;
1394
- let i = null, a = s, c = n;
1395
- typeof s == "string" && (i = s, a = n, c = r);
1396
- const p = (h) => {
1397
- const { transformPluginSettings: l } = e.container.get("$environmentOptions"), d = l ? l(
1398
- c || {},
1399
- i,
1400
- e.container,
1401
- a
1402
- ) : n;
1403
- try {
1404
- const u = At(
1405
- i,
1406
- a,
1407
- o,
1408
- d
1409
- );
1410
- o.get("$plugins").push(u), h && u.invoke("initialize", null);
1411
- } catch (u) {
1412
- Nt(e).warn("Error when initializing plugin", u);
1413
- }
1414
- };
1415
- e.container.get("$instance") ? p(!0) : e.events.subscribeOnce("widget:instance-created", () => p(!1));
1416
- }
1417
- ).createCommand(
1418
- "container.register",
1419
- (e) => (s, n) => {
1420
- e.container.register(s, n);
1421
- }
1422
- ).createCommand(
1423
- "container.registerAsync",
1424
- (e) => (s, n) => {
1425
- e.container.registerAsync(s, n);
1426
- }
1427
- ).createCommand(
1428
- "container.registerFactory",
1429
- (e) => (s, n) => {
1430
- e.container.registerFactory(s, n);
1431
- }
1432
- ).createCommand(
1433
- "container.touch",
1434
- (e) => (s, n) => {
1435
- e.container.touch(s, n);
1436
- }
1437
- ).createCommand(
1438
- "csp",
1439
- {},
1440
- (e) => (s) => {
1441
- e.container.register("csp", s);
1442
- }
1443
- );
1444
- });
1445
- je((t) => {
1446
- t.createCommand(
1447
- "ready",
1448
- { scope: $.Implementation, stage: O.Pre },
1449
- (e) => (s) => {
1450
- const { container: n } = e, r = n.owner;
1451
- n.get("bootstrapping").ready ? s(r) : r.events.subscribeOnce("bootstrap:ready", () => {
1452
- s(r);
1453
- });
1454
- }
1455
- );
1456
- });
1457
- const Tt = "children", It = "properties", _t = (t, e, s, n, r) => t.getAsync("componentResolver").then((o) => (o.registerComponent(e, s), tt(t, e, n || (() => {
1458
- }), e, r))), Dt = (t) => _t(
1459
- t,
1460
- "area",
1461
- import("./area-855b53b5.js"),
1462
- (e) => {
1463
- }
1464
- );
1465
- export {
1466
- Dt as A,
1467
- Tt as L,
1468
- It as j
1469
- };
1470
- //# sourceMappingURL=index-7d59ee3f.js.map