@har-analyzer/components 0.0.5 → 0.0.8

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.
@@ -1,1149 +0,0 @@
1
- import { b as At, d as Pt, T as Xe, P as ie, e as le, m as at, f as Ue, h as p, k as me, _ as Y, l as We, c as E, n as ot, u as He, a as Ae, o as ge, p as K, q as Ft, r as Dt, w as Le, s as St, t as G, v as $e, x as Tt, y as Nt, i as lt, z as Ot, A as Mt, B as ze, C as ct, D as kt, E as jt, F as qt, G as Bt, H as Ut, J as Wt, K as ut, L as dt, M as Ht, N as $t, O as zt, j as z } from "./content-type.js";
2
- import { _ as Vt, V as Ze, B as Ke } from "./vertical-gap.js";
3
- import d, { isValidElement as we, cloneElement as ye, Children as Gt, useState as S, useRef as D, useEffect as ce, useLayoutEffect as Ce, useMemo as ft, useCallback as et } from "react";
4
- import { c as Yt, j as Jt, S as Qt, a as tt, g as Xt } from "./index4.js";
5
- import '../assets/index2.css';function Zt(n) {
6
- if (n === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
7
- return n;
8
- }
9
- function Ve(n, e) {
10
- var t = function(r) {
11
- return e && we(r) ? e(r) : r;
12
- }, s = /* @__PURE__ */ Object.create(null);
13
- return n && Gt.map(n, function(i) {
14
- return i;
15
- }).forEach(function(i) {
16
- s[i.key] = t(i);
17
- }), s;
18
- }
19
- function Kt(n, e) {
20
- n = n || {}, e = e || {};
21
- function t(f) {
22
- return f in e ? e[f] : n[f];
23
- }
24
- var s = /* @__PURE__ */ Object.create(null), i = [];
25
- for (var r in n)
26
- r in e ? i.length && (s[r] = i, i = []) : i.push(r);
27
- var a, l = {};
28
- for (var o in e) {
29
- if (s[o])
30
- for (a = 0; a < s[o].length; a++) {
31
- var h = s[o][a];
32
- l[s[o][a]] = t(h);
33
- }
34
- l[o] = t(o);
35
- }
36
- for (a = 0; a < i.length; a++)
37
- l[i[a]] = t(i[a]);
38
- return l;
39
- }
40
- function Z(n, e, t) {
41
- return t[e] != null ? t[e] : n.props[e];
42
- }
43
- function en(n, e) {
44
- return Ve(n.children, function(t) {
45
- return ye(t, {
46
- onExited: e.bind(null, t),
47
- in: !0,
48
- appear: Z(t, "appear", n),
49
- enter: Z(t, "enter", n),
50
- exit: Z(t, "exit", n)
51
- });
52
- });
53
- }
54
- function tn(n, e, t) {
55
- var s = Ve(n.children), i = Kt(e, s);
56
- return Object.keys(i).forEach(function(r) {
57
- var a = i[r];
58
- if (we(a)) {
59
- var l = r in e, o = r in s, h = e[r], f = we(h) && !h.props.in;
60
- o && (!l || f) ? i[r] = ye(a, {
61
- onExited: t.bind(null, a),
62
- in: !0,
63
- exit: Z(a, "exit", n),
64
- enter: Z(a, "enter", n)
65
- }) : !o && l && !f ? i[r] = ye(a, {
66
- in: !1
67
- }) : o && l && we(h) && (i[r] = ye(a, {
68
- onExited: t.bind(null, a),
69
- in: h.props.in,
70
- exit: Z(a, "exit", n),
71
- enter: Z(a, "enter", n)
72
- }));
73
- }
74
- }), i;
75
- }
76
- var nn = Object.values || function(n) {
77
- return Object.keys(n).map(function(e) {
78
- return n[e];
79
- });
80
- }, sn = {
81
- component: "div",
82
- childFactory: function(e) {
83
- return e;
84
- }
85
- }, Pe = /* @__PURE__ */ function(n) {
86
- At(e, n);
87
- function e(s, i) {
88
- var r;
89
- r = n.call(this, s, i) || this;
90
- var a = r.handleExited.bind(Zt(r));
91
- return r.state = {
92
- contextValue: {
93
- isMounting: !0
94
- },
95
- handleExited: a,
96
- firstRender: !0
97
- }, r;
98
- }
99
- var t = e.prototype;
100
- return t.componentDidMount = function() {
101
- this.mounted = !0, this.setState({
102
- contextValue: {
103
- isMounting: !1
104
- }
105
- });
106
- }, t.componentWillUnmount = function() {
107
- this.mounted = !1;
108
- }, e.getDerivedStateFromProps = function(i, r) {
109
- var a = r.children, l = r.handleExited, o = r.firstRender;
110
- return {
111
- children: o ? en(i, l) : tn(i, a, l),
112
- firstRender: !1
113
- };
114
- }, t.handleExited = function(i, r) {
115
- var a = Ve(this.props.children);
116
- i.key in a || (i.props.onExited && i.props.onExited(r), this.mounted && this.setState(function(l) {
117
- var o = Vt({}, l.children);
118
- return delete o[i.key], {
119
- children: o
120
- };
121
- }));
122
- }, t.render = function() {
123
- var i = this.props, r = i.component, a = i.childFactory, l = Pt(i, ["component", "childFactory"]), o = this.state.contextValue, h = nn(this.state.children).map(a);
124
- return delete l.appear, delete l.enter, delete l.exit, r === null ? /* @__PURE__ */ d.createElement(Xe.Provider, {
125
- value: o
126
- }, h) : /* @__PURE__ */ d.createElement(Xe.Provider, {
127
- value: o
128
- }, /* @__PURE__ */ d.createElement(r, l, h));
129
- }, e;
130
- }(d.Component);
131
- Pe.propTypes = process.env.NODE_ENV !== "production" ? {
132
- /**
133
- * `<TransitionGroup>` renders a `<div>` by default. You can change this
134
- * behavior by providing a `component` prop.
135
- * If you use React v16+ and would like to avoid a wrapping `<div>` element
136
- * you can pass in `component={null}`. This is useful if the wrapping div
137
- * borks your css styles.
138
- */
139
- component: ie.any,
140
- /**
141
- * A set of `<Transition>` components, that are toggled `in` and out as they
142
- * leave. the `<TransitionGroup>` will inject specific transition props, so
143
- * remember to spread them through if you are wrapping the `<Transition>` as
144
- * with our `<Fade>` example.
145
- *
146
- * While this component is meant for multiple `Transition` or `CSSTransition`
147
- * children, sometimes you may want to have a single transition child with
148
- * content that you want to be transitioned out and in when you change it
149
- * (e.g. routes, images etc.) In that case you can change the `key` prop of
150
- * the transition child as you change its content, this will cause
151
- * `TransitionGroup` to transition the child out and back in.
152
- */
153
- children: ie.node,
154
- /**
155
- * A convenience prop that enables or disables appear animations
156
- * for all children. Note that specifying this will override any defaults set
157
- * on individual children Transitions.
158
- */
159
- appear: ie.bool,
160
- /**
161
- * A convenience prop that enables or disables enter animations
162
- * for all children. Note that specifying this will override any defaults set
163
- * on individual children Transitions.
164
- */
165
- enter: ie.bool,
166
- /**
167
- * A convenience prop that enables or disables exit animations
168
- * for all children. Note that specifying this will override any defaults set
169
- * on individual children Transitions.
170
- */
171
- exit: ie.bool,
172
- /**
173
- * You may need to apply reactive updates to a child as it is exiting.
174
- * This is generally done by using `cloneElement` however in the case of an exiting
175
- * child the element has already been removed and not accessible to the consumer.
176
- *
177
- * If you do need to update a child as it leaves you can provide a `childFactory`
178
- * to wrap every child, even the ones that are leaving.
179
- *
180
- * @type Function(child: ReactElement) -> ReactElement
181
- */
182
- childFactory: ie.func
183
- } : {};
184
- Pe.defaultProps = sn;
185
- function rn(n) {
186
- return n.slice().sort((e, t) => {
187
- var s, i;
188
- return t.orderPriority !== e.orderPriority ? Math.sign(((s = t.orderPriority) !== null && s !== void 0 ? s : 0) - ((i = e.orderPriority) !== null && i !== void 0 ? i : 0)) : t.id < e.id ? 1 : -1;
189
- });
190
- }
191
- class nt {
192
- constructor() {
193
- this.listeners = [], this.actions = [], this.scheduleUpdate = le(() => {
194
- this.listeners.forEach((e) => e(this.actions));
195
- }, 0), this.registerAction = (e) => {
196
- this.actions.push(e), this.actions = rn(this.actions), this.scheduleUpdate();
197
- }, this.clearRegisteredActions = () => {
198
- this.actions = [];
199
- }, this.onActionRegistered = (e) => (this.listeners.push(e), this.scheduleUpdate(), () => {
200
- this.listeners = this.listeners.filter((t) => t !== e);
201
- });
202
- }
203
- installPublic(e = {}) {
204
- var t;
205
- return (t = e.registerAction) !== null && t !== void 0 || (e.registerAction = this.registerAction), e;
206
- }
207
- installInternal(e = {}) {
208
- var t, s;
209
- return (t = e.clearRegisteredActions) !== null && t !== void 0 || (e.clearRegisteredActions = this.clearRegisteredActions), (s = e.onActionRegistered) !== null && s !== void 0 || (e.onActionRegistered = this.onActionRegistered), e;
210
- }
211
- }
212
- function an() {
213
- at.sendPanoramaMetric({ eventContext: "awsui-runtime-api-loaded", eventDetail: { version: Ue } });
214
- }
215
- function oe(n, e) {
216
- console.warn("[AwsUi]", `[${n}]`, e), at.sendPanoramaMetric({
217
- eventContext: "awsui-runtime-api-warning",
218
- eventDetail: { version: Ue, component: n, message: e }
219
- });
220
- }
221
- var Q, ae, O, je;
222
- class st {
223
- constructor() {
224
- Q.set(this, []), ae.set(this, /* @__PURE__ */ new Map()), O.set(this, void 0), je.set(this, le(() => p(this, Q, "f").forEach((e) => {
225
- if (p(this, O, "f")) {
226
- const t = e(p(this, O, "f"));
227
- p(this, ae, "f").set(e, t);
228
- }
229
- }), 0)), this.registerContentReplacer = (e) => {
230
- if (p(this, O, "f")) {
231
- oe("alert-flash-content", `Cannot call \`registerContentReplacer\` with new provider: provider with id "${p(this, O, "f").id}" already registered.`);
232
- return;
233
- }
234
- me(this, O, e, "f"), p(this, je, "f").call(this);
235
- }, this.clearRegisteredReplacer = () => {
236
- me(this, O, void 0, "f");
237
- }, this.initialCheck = (e) => {
238
- var t;
239
- return !((t = p(this, O, "f")) === null || t === void 0) && t.initialCheck ? p(this, O, "f").initialCheck(e) : !1;
240
- }, this.onContentRegistered = (e) => {
241
- if (p(this, O, "f")) {
242
- const t = e(p(this, O, "f"));
243
- p(this, Q, "f").push(e), p(this, ae, "f").set(e, t);
244
- } else
245
- p(this, Q, "f").push(e);
246
- return () => {
247
- var t;
248
- (t = p(this, ae, "f").get(e)) === null || t === void 0 || t(), me(this, Q, p(this, Q, "f").filter((s) => s !== e), "f"), p(this, ae, "f").delete(e);
249
- };
250
- };
251
- }
252
- installPublic(e = {}) {
253
- var t;
254
- return (t = e.registerContentReplacer) !== null && t !== void 0 || (e.registerContentReplacer = this.registerContentReplacer), e;
255
- }
256
- installInternal(e = {}) {
257
- var t, s, i;
258
- return (t = e.clearRegisteredReplacer) !== null && t !== void 0 || (e.clearRegisteredReplacer = this.clearRegisteredReplacer), (s = e.onContentRegistered) !== null && s !== void 0 || (e.onContentRegistered = this.onContentRegistered), (i = e.initialCheck) !== null && i !== void 0 || (e.initialCheck = this.initialCheck), e;
259
- }
260
- }
261
- Q = /* @__PURE__ */ new WeakMap(), ae = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new WeakMap(), je = /* @__PURE__ */ new WeakMap();
262
- var M, qe, Ie, Re;
263
- class on {
264
- constructor() {
265
- M.set(this, []), qe.set(this, () => {
266
- const e = p(this, M, "f").find((t) => t.forceType === "primary");
267
- if (e)
268
- return e;
269
- for (const t of p(this, M, "f").slice())
270
- if (t.forceType !== "secondary")
271
- return t;
272
- }), Ie.set(this, () => {
273
- const e = p(this, qe, "f").call(this), t = p(this, M, "f").filter((s) => s !== e).map((s) => s.props);
274
- for (const s of p(this, M, "f"))
275
- s === e ? s.onChange({
276
- type: "primary",
277
- discoveredProps: t
278
- }) : s.onChange(s.secondaryInstance);
279
- }), Re.set(this, le(() => p(this, Ie, "f").call(this), 0)), this.register = (e, t) => {
280
- const s = p(this, M, "f").some((r) => r.forceType === "primary");
281
- if (e === "primary" && s)
282
- throw new Error("Double primary registration attempt");
283
- const i = {
284
- forceType: e,
285
- onChange: t,
286
- props: {},
287
- secondaryInstance: {
288
- type: "secondary",
289
- update: (r) => {
290
- i.props = r, p(this, Re, "f").call(this);
291
- }
292
- }
293
- };
294
- return p(this, M, "f").push(i), p(this, Ie, "f").call(this), () => {
295
- p(this, M, "f").splice(p(this, M, "f").indexOf(i), 1), p(this, Re, "f").call(this);
296
- };
297
- }, this.getStateForTesting = () => ({
298
- registrations: p(this, M, "f")
299
- }), this.installInternal = (e = {}) => {
300
- var t, s;
301
- return (t = e.register) !== null && t !== void 0 || (e.register = this.register), (s = e.getStateForTesting) !== null && s !== void 0 || (e.getStateForTesting = this.getStateForTesting), e;
302
- };
303
- }
304
- }
305
- M = /* @__PURE__ */ new WeakMap(), qe = /* @__PURE__ */ new WeakMap(), Ie = /* @__PURE__ */ new WeakMap(), Re = /* @__PURE__ */ new WeakMap();
306
- var U, V, X, he, pe;
307
- class ln {
308
- constructor() {
309
- U.set(this, null), V.set(this, []), X.set(this, []), he.set(this, le(() => {
310
- var e;
311
- if (!p(this, U, "f"))
312
- return;
313
- const t = p(this, V, "f")[p(this, V, "f").length - 1];
314
- p(this, U, "f").call(this, (e = t?.props) !== null && e !== void 0 ? e : null);
315
- }, 0)), pe.set(this, le(() => {
316
- p(this, X, "f").forEach((e) => e(!!p(this, U, "f")));
317
- }, 0)), this.registerAppLayout = (e) => {
318
- if (!p(this, U, "f"))
319
- return me(this, U, e, "f"), p(this, pe, "f").call(this), () => {
320
- me(this, U, null, "f"), p(this, pe, "f").call(this);
321
- };
322
- }, this.registerBreadcrumbs = (e, t) => {
323
- const s = { props: e };
324
- return p(this, V, "f").push(s), p(this, X, "f").push(t), p(this, pe, "f").call(this), p(this, he, "f").call(this), {
325
- update: (i) => {
326
- s.props = i, p(this, he, "f").call(this);
327
- },
328
- cleanup: () => {
329
- p(this, V, "f").splice(p(this, V, "f").indexOf(s), 1), p(this, X, "f").splice(p(this, X, "f").indexOf(t), 1), p(this, he, "f").call(this);
330
- }
331
- };
332
- }, this.getStateForTesting = () => ({
333
- appLayoutUpdateCallback: p(this, U, "f"),
334
- breadcrumbInstances: p(this, V, "f"),
335
- breadcrumbRegistrations: p(this, X, "f")
336
- });
337
- }
338
- installInternal(e = {}) {
339
- var t, s, i;
340
- return (t = e.registerBreadcrumbs) !== null && t !== void 0 || (e.registerBreadcrumbs = this.registerBreadcrumbs), (s = e.registerAppLayout) !== null && s !== void 0 || (e.registerAppLayout = this.registerAppLayout), (i = e.getStateForTesting) !== null && i !== void 0 || (e.getStateForTesting = this.getStateForTesting), e;
341
- }
342
- }
343
- U = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap(), he = /* @__PURE__ */ new WeakMap(), pe = /* @__PURE__ */ new WeakMap();
344
- const cn = [
345
- "badge",
346
- "resizable",
347
- "defaultSize",
348
- "orderPriority",
349
- "defaultActive",
350
- "onResize"
351
- ];
352
- class un {
353
- constructor() {
354
- this.drawers = [], this.drawersRegistrationListener = null, this.drawerOpenedListener = null, this.drawerClosedListener = null, this.drawersUpdateListeners = [], this.scheduleUpdate = le(() => {
355
- var e;
356
- (e = this.drawersRegistrationListener) === null || e === void 0 || e.call(this, this.drawers), this.drawersUpdateListeners.forEach((t) => {
357
- t?.(this.drawers);
358
- });
359
- }, 0), this.registerDrawer = (e) => {
360
- this.drawers.find((t) => t.id === e.id) && oe("app-layout-drawers", `drawer with id "${e.id}" is already registered`), this.drawers = this.drawers.concat(e), this.scheduleUpdate();
361
- }, this.updateDrawer = (e) => {
362
- var t, { id: s } = e, i = Y(e, ["id"]);
363
- const r = this.drawers.findIndex(({ id: h }) => h === s), a = (t = this.drawers) === null || t === void 0 ? void 0 : t[r];
364
- if (!a)
365
- throw new Error(`[AwsUi] [runtime drawers] drawer with id ${s} not found`);
366
- const l = this.drawers.slice(), o = Object.assign({}, a);
367
- for (const h of cn)
368
- h in i && (o[h] = i[h]);
369
- l[r] = o, this.drawers = l, this.scheduleUpdate();
370
- }, this.onDrawersRegistered = (e) => (this.drawersRegistrationListener !== null && oe("app-layout-drawers", "multiple app layout instances detected when calling onDrawersRegistered"), this.drawersRegistrationListener = e, this.scheduleUpdate(), () => {
371
- this.drawersRegistrationListener = null, this.drawersUpdateListeners = [];
372
- }), this.clearRegisteredDrawers = () => {
373
- this.drawers = [];
374
- }, this.onDrawerOpened = (e) => (this.drawerOpenedListener !== null && oe("app-layout-drawers", "multiple app layout instances detected when calling onDrawerOpened"), this.drawerOpenedListener = e, () => {
375
- this.drawerOpenedListener = null;
376
- }), this.onDrawerClosed = (e) => (this.drawerClosedListener !== null && oe("app-layout-drawers", "multiple app layout instances detected when calling onDrawerClosed"), this.drawerClosedListener = e, () => {
377
- this.drawerClosedListener = null;
378
- }), this.openDrawer = (e, t) => {
379
- var s;
380
- (s = this.drawerOpenedListener) === null || s === void 0 || s.call(this, e, t);
381
- }, this.closeDrawer = (e, t) => {
382
- var s;
383
- (s = this.drawerClosedListener) === null || s === void 0 || s.call(this, e, t);
384
- }, this.onDrawersUpdated = (e) => (this.drawersUpdateListeners.push(e), () => {
385
- this.drawersUpdateListeners = this.drawersUpdateListeners.filter((t) => t !== e);
386
- }), this.getDrawersState = () => this.drawers;
387
- }
388
- installPublic(e = {}) {
389
- var t, s, i, r;
390
- return (t = e.registerDrawer) !== null && t !== void 0 || (e.registerDrawer = this.registerDrawer), (s = e.updateDrawer) !== null && s !== void 0 || (e.updateDrawer = this.updateDrawer), (i = e.openDrawer) !== null && i !== void 0 || (e.openDrawer = this.openDrawer), (r = e.closeDrawer) !== null && r !== void 0 || (e.closeDrawer = this.closeDrawer), e;
391
- }
392
- installInternal(e = {}) {
393
- var t, s, i, r, a, l;
394
- return (t = e.clearRegisteredDrawers) !== null && t !== void 0 || (e.clearRegisteredDrawers = this.clearRegisteredDrawers), (s = e.onDrawersRegistered) !== null && s !== void 0 || (e.onDrawersRegistered = this.onDrawersRegistered), (i = e.onDrawerOpened) !== null && i !== void 0 || (e.onDrawerOpened = this.onDrawerOpened), (r = e.onDrawerClosed) !== null && r !== void 0 || (e.onDrawerClosed = this.onDrawerClosed), (a = e.onDrawersUpdated) !== null && a !== void 0 || (e.onDrawersUpdated = this.onDrawersUpdated), (l = e.getDrawersState) !== null && l !== void 0 || (e.getDrawersState = this.getDrawersState), e;
395
- }
396
- }
397
- var Ee;
398
- class dn {
399
- constructor() {
400
- Ee.set(this, /* @__PURE__ */ new WeakMap()), this.createContext = (e, t) => {
401
- let s = p(this, Ee, "f").get(e);
402
- s || (s = /* @__PURE__ */ new Map(), p(this, Ee, "f").set(e, s));
403
- let i = s.get(t);
404
- return i || (i = e.createContext(void 0), s.set(t, i)), i;
405
- };
406
- }
407
- installInternal(e = {}) {
408
- var t;
409
- return (t = e.createContext) !== null && t !== void 0 || (e.createContext = this.createContext), e;
410
- }
411
- }
412
- Ee = /* @__PURE__ */ new WeakMap();
413
- const xe = Symbol.for("awsui-plugin-api");
414
- function ht(n) {
415
- try {
416
- return n?.[xe] ? n[xe] : !n || n.parent === n ? void 0 : ht(n.parent);
417
- } catch {
418
- return;
419
- }
420
- }
421
- function fn() {
422
- if (typeof window > "u")
423
- return it({});
424
- const n = window, e = ht(n);
425
- return e || an(), n[xe] = it(e ?? {}), n[xe];
426
- }
427
- const { awsuiPlugins: Jn, awsuiPluginsInternal: pt } = fn();
428
- function it(n) {
429
- var e, t;
430
- (e = n.awsuiPlugins) !== null && e !== void 0 || (n.awsuiPlugins = {}), (t = n.awsuiPluginsInternal) !== null && t !== void 0 || (n.awsuiPluginsInternal = {});
431
- const s = new un();
432
- n.awsuiPlugins.appLayout = s.installPublic(n.awsuiPlugins.appLayout), n.awsuiPluginsInternal.appLayout = s.installInternal(n.awsuiPluginsInternal.appLayout);
433
- const i = new on();
434
- n.awsuiPluginsInternal.appLayoutWidget = i.installInternal(n.awsuiPluginsInternal.appLayoutWidget);
435
- const r = new nt();
436
- n.awsuiPlugins.alert = r.installPublic(n.awsuiPlugins.alert), n.awsuiPluginsInternal.alert = r.installInternal(n.awsuiPluginsInternal.alert);
437
- const a = new st();
438
- n.awsuiPlugins.alertContent = a.installPublic(n.awsuiPlugins.alertContent), n.awsuiPluginsInternal.alertContent = a.installInternal(n.awsuiPluginsInternal.alertContent);
439
- const l = new st();
440
- n.awsuiPlugins.flashContent = l.installPublic(n.awsuiPlugins.flashContent), n.awsuiPluginsInternal.flashContent = l.installInternal(n.awsuiPluginsInternal.flashContent);
441
- const o = new nt();
442
- n.awsuiPlugins.flashbar = o.installPublic(n.awsuiPlugins.flashbar), n.awsuiPluginsInternal.flashbar = o.installInternal(n.awsuiPluginsInternal.flashbar);
443
- const h = new ln();
444
- n.awsuiPluginsInternal.breadcrumbs = h.installInternal(n.awsuiPluginsInternal.breadcrumbs);
445
- const f = new dn();
446
- return n.awsuiPluginsInternal.sharedReactContexts = f.installInternal(n.awsuiPluginsInternal.sharedReactContexts), n;
447
- }
448
- const ke = {
449
- root: "awsui_root_ptw8i_wv87u_181",
450
- hovered: "awsui_hovered_ptw8i_wv87u_194",
451
- content: "awsui_content_ptw8i_wv87u_201"
452
- };
453
- function hn(n) {
454
- var { onChange: e, children: t, __internalRootRef: s = null } = n, i = Y(n, ["onChange", "children", "__internalRootRef"]);
455
- const [r, a] = S(!1), l = We(i), o = (m) => {
456
- m.preventDefault(), m.dataTransfer && (a(!0), m.dataTransfer.dropEffect = "copy");
457
- }, h = (m) => {
458
- m.preventDefault(), a(!1), m.dataTransfer && (m.dataTransfer.dropEffect = "none");
459
- }, f = (m) => {
460
- m.preventDefault(), a(!1), ot(e, { value: Array.from(m.dataTransfer.files) });
461
- };
462
- return d.createElement(
463
- "div",
464
- Object.assign({}, l, { ref: s, className: E(l.className, ke.root, {
465
- [ke.hovered]: r
466
- }), onDragOver: o, onDragLeave: h, onDrop: f }),
467
- d.createElement("div", { className: ke.content }, t)
468
- );
469
- }
470
- function mt(n) {
471
- const e = He("FileDropzone");
472
- return d.createElement(hn, Object.assign({}, e, n));
473
- }
474
- Ae(mt, "FileDropzone");
475
- const re = {
476
- root: "awsui_root_1wp4s_1c9ou_185",
477
- "file-input": "awsui_file-input_1wp4s_1c9ou_186",
478
- hidden: "awsui_hidden_1wp4s_1c9ou_190",
479
- "file-input-button": "awsui_file-input-button_1wp4s_1c9ou_196",
480
- "force-focus-outline-icon": "awsui_force-focus-outline-icon_1wp4s_1c9ou_196",
481
- "force-focus-outline-button": "awsui_force-focus-outline-button_1wp4s_1c9ou_217"
482
- }, pn = d.forwardRef((n, e) => {
483
- var t, { accept: s, ariaRequired: i, ariaLabel: r, multiple: a = !1, value: l, onChange: o, variant: h = "button", children: f, __internalRootRef: m = null, __inputClassName: A, __inputNativeAttributes: w, __injectAnalyticsComponentMetadata: F } = n, P = Y(n, ["accept", "ariaRequired", "ariaLabel", "multiple", "value", "onChange", "variant", "children", "__internalRootRef", "__inputClassName", "__inputNativeAttributes", "__injectAnalyticsComponentMetadata"]);
484
- const R = We(P), g = D(null), _ = D(null), y = ge(m, _), v = K("upload-button-label"), C = Ft(P), L = K("upload-input"), k = (t = C.controlId) !== null && t !== void 0 ? t : L;
485
- Dt(e, g);
486
- const [W, q] = S(!1), ee = () => {
487
- var x;
488
- return (x = g.current) === null || x === void 0 ? void 0 : x.click();
489
- }, te = () => {
490
- var x, B;
491
- q(!0), (B = (x = _.current) === null || x === void 0 ? void 0 : x.scrollIntoView) === null || B === void 0 || B.call(x);
492
- }, j = () => q(!1), b = ({ target: x }) => {
493
- ot(o, { value: x.files ? Array.from(x.files) : [] });
494
- };
495
- Yt("FileInput", "value", l, "onChange", o);
496
- const T = Object.assign({ "aria-label": r || f, "aria-labelledby": Jt(C.ariaLabelledby, v), "aria-describedby": C.ariaDescribedby }, w);
497
- C.invalid && (T["aria-invalid"] = !0), i && (T["aria-required"] = !0), h === "icon" && !r && Le("FileInput", "Aria label is required with icon variant."), ce(() => {
498
- if (window.DataTransfer) {
499
- const x = new DataTransfer();
500
- for (const B of l)
501
- x.items.add(B);
502
- g.current.files = x.files;
503
- }
504
- g.current && (g.current.value = "");
505
- }, [l]);
506
- const { tabIndex: ue } = St(g), H = h === "button" && f ? "button" : "input", ne = {
507
- name: "awsui.FileInput",
508
- label: H
509
- }, J = { detail: { label: H } };
510
- return F && (J.component = ne), d.createElement(
511
- "div",
512
- Object.assign({}, R, { ref: y, className: E(R.className, re.root) }, G(J)),
513
- d.createElement("input", Object.assign({ id: k, ref: g, type: "file", hidden: !1, multiple: a, accept: s, onChange: b, onFocus: te, onBlur: j, className: E(re["file-input"], re.hidden, A), tabIndex: ue }, T)),
514
- d.createElement($e, { iconName: "upload", variant: h === "icon" ? "icon" : void 0, formAction: "none", onClick: ee, className: E(re["file-input-button"], {
515
- [re["force-focus-outline-button"]]: W && h === "button",
516
- [re["force-focus-outline-icon"]]: W && h === "icon"
517
- }), __nativeAttributes: { tabIndex: -1, "aria-hidden": !0 } }, h === "button" && f),
518
- d.createElement(Qt, { id: v }, r || f)
519
- );
520
- }), gt = d.forwardRef((n, e) => {
521
- var { multiple: t, variant: s } = n, i = Y(n, ["multiple", "variant"]);
522
- const r = He("FileInput", {
523
- props: {
524
- multiple: t,
525
- variant: s
526
- }
527
- });
528
- return d.createElement(pn, Object.assign({ multiple: t, variant: s }, i, r, { ref: e, __injectAnalyticsComponentMetadata: !0 }));
529
- });
530
- Ae(gt, "FileInput");
531
- const Ge = ".har";
532
- function mn(n) {
533
- return n ? n.name.toLowerCase().endsWith(Ge) : !1;
534
- }
535
- function gn(n) {
536
- return n.length !== 1;
537
- }
538
- function _n(n) {
539
- const e = [];
540
- return gn(n) && e.push("You can only upload one file at a time"), mn(n[0]) || e.push(`Only files with the "${Ge}" extension are allowed`), e;
541
- }
542
- function vn(n) {
543
- return new Promise((e, t) => {
544
- if (!n) {
545
- t(new Error("No HAR file provided"));
546
- return;
547
- }
548
- const s = new FileReader();
549
- s.onload = (i) => {
550
- try {
551
- const r = i.target?.result;
552
- e(r);
553
- } catch (r) {
554
- console.error("Failed to JSON parse file content:", r), t(new Error("errorMessage"));
555
- }
556
- }, s.onerror = () => {
557
- t(new Error("Error reading HAR file"));
558
- }, s.readAsText(n);
559
- });
560
- }
561
- function bn(n) {
562
- const e = {};
563
- for (const t in n) {
564
- const s = n[t];
565
- s && (e[t] = s.getBoundingClientRect());
566
- }
567
- return e;
568
- }
569
- function wn({ oldState: n, elements: e, onTransitionsEnd: t, newElementInitialState: s }) {
570
- for (const i in e) {
571
- const r = e[i], a = n[i];
572
- if (r) {
573
- const l = r.getBoundingClientRect(), o = { scale: 1, x: 0, y: 0 }, h = a ? {
574
- scale: a.width / l.width,
575
- x: (a.left + a.right) / 2 - (l.left + l.right) / 2,
576
- y: (a.top + a.bottom) / 2 - (l.top + l.bottom) / 2
577
- } : s ? s(l) : {}, f = Object.assign(Object.assign({}, o), h);
578
- r.style.transitionProperty = "none", r.style.transform = `scale(${f.scale}) translate(${f.x}px, ${f.y}px)`, a || (r.style.opacity = "0");
579
- }
580
- }
581
- requestAnimationFrame(() => {
582
- const i = /* @__PURE__ */ new Set();
583
- for (const r in e) {
584
- const a = e[r];
585
- if (a) {
586
- n[r] ? (a.style.transitionProperty = "transform", a.style.transform = "") : (a.style.transitionProperty = "transform, opacity", a.style.transform = "", a.style.opacity = "");
587
- const o = (f) => {
588
- f.target === a && (i.add(r), a.removeEventListener("transitionstart", o));
589
- }, h = (f) => {
590
- f.target === a && (a.style.transitionProperty = "", a.removeEventListener("transitionend", h), t && (i.delete(r), i.size === 0 && t()));
591
- };
592
- a.addEventListener("transitionstart", o), a.addEventListener("transitionend", h);
593
- }
594
- }
595
- });
596
- }
597
- function _t(n, e, { trailing: t = !0 } = {}) {
598
- let s = null, i = null, r = null;
599
- function a() {
600
- if (s === null || i === null)
601
- return;
602
- const h = Date.now();
603
- h - i >= e ? (n.apply(s.this, s.args), i = h, s = null, r = null) : t && l();
604
- }
605
- function l() {
606
- r && cancelAnimationFrame(r), r = requestAnimationFrame(a);
607
- }
608
- function o(...h) {
609
- i === null ? (i = Date.now(), n.apply(this, h)) : (s = { this: this, args: h }, l());
610
- }
611
- return o.cancel = () => {
612
- r && cancelAnimationFrame(r), s = null, i = null, r = null;
613
- }, o;
614
- }
615
- const Be = {
616
- "flash-header": "awsui_flash-header_4c95g_vov7p_5"
617
- }, vt = (n, e, t) => {
618
- const s = {
619
- component: {
620
- name: "awsui.Flashbar",
621
- label: e ? { root: "self", selector: "ul" } : { root: "self" },
622
- properties: {
623
- itemsCount: `${n}`,
624
- stackItems: `${e}`
625
- }
626
- }
627
- };
628
- return t !== void 0 && (s.component.properties.expanded = `${t}`), s;
629
- }, bt = (n, e, t) => {
630
- const s = {
631
- itemLabel: `.${Be["flash-header"]}`,
632
- itemPosition: `${n}`,
633
- itemType: e
634
- };
635
- return t && (s.itemId = t), {
636
- component: { innerContext: s }
637
- };
638
- }, yn = {
639
- root: "awsui_root_37gf8_1udtb_9"
640
- };
641
- function Cn(n, e, t, s) {
642
- return !e && t && (e = d.createElement(
643
- "span",
644
- Object.assign({}, G({
645
- action: "buttonClick"
646
- })),
647
- d.createElement($e, { className: n.actionButton, onClick: s, formAction: "none" }, t)
648
- )), e ? d.createElement("div", { className: n.actionSlot }, e) : null;
649
- }
650
- const In = ({ className: n, testUtilClasses: e, action: t, discoveredActions: s, buttonText: i, wrappedClass: r, containerWidth: a, onButtonClick: l }) => {
651
- const [o, h] = S(!1), f = d.useRef(null);
652
- Ce(() => {
653
- if (!f.current || !a || !r)
654
- return;
655
- function A() {
656
- const F = Tt(f.current), { offsetWidth: P, offsetLeft: R } = f.current, g = F ? a - P - R : R;
657
- h(g < 100);
658
- }
659
- const w = new MutationObserver(A);
660
- return w.observe(f.current, { attributes: !1, childList: !0, subtree: !0 }), A(), () => w.disconnect();
661
- });
662
- const m = Cn(e, t, i, l);
663
- return !m && s.length === 0 ? null : d.createElement(
664
- "div",
665
- { ref: f, className: E(yn.root, n, o && r) },
666
- m,
667
- s
668
- );
669
- };
670
- function Rn({ mountContent: n, unmountContent: e, context: t }) {
671
- const s = D(null);
672
- return ce(() => {
673
- const i = s.current;
674
- return n(i, t), () => {
675
- e(i);
676
- };
677
- }, []), d.createElement("div", { ref: s });
678
- }
679
- function En(n, e) {
680
- return n ? d.createElement(Rn, { key: n.id + "-" + e.type, context: e, mountContent: n.mountContent, unmountContent: n.unmountContent }) : null;
681
- }
682
- function Ln(n) {
683
- return function(t) {
684
- const [s, i] = S([]), r = D(null), a = D(null);
685
- return ce(() => n((l) => {
686
- i(l.map((o) => En(o, { type: t, headerRef: r, contentRef: a })));
687
- }), [t]), { discoveredActions: s, headerRef: r, contentRef: a };
688
- };
689
- }
690
- function xn(n, e) {
691
- return function({ type: s, header: i, children: r }) {
692
- const a = K(`${n}-discovered-content`), l = D(null), o = D(null), h = D(null), f = D(null), [m, A] = S(() => e.initialCheck({
693
- instanceId: a,
694
- type: s,
695
- header: i,
696
- content: r
697
- })), [w, F] = S("original"), [P, R] = S("original"), g = D();
698
- return ce(() => {
699
- const _ = { instanceId: a, type: s, headerRef: l, contentRef: o };
700
- return A(!1), e.onContentRegistered((y) => {
701
- let v = !0;
702
- function C(L) {
703
- return v ? !0 : (oe(`${n}-content-replacer`, `"${L}" called after component unmounted`), !1);
704
- }
705
- return g.current = y.runReplacer(_, {
706
- hideHeader() {
707
- C("hideHeader") && F("remove");
708
- },
709
- restoreHeader() {
710
- C("restoreHeader") && F("original");
711
- },
712
- replaceHeader(L) {
713
- C("replaceHeader") && (L(h.current), F("replaced"));
714
- },
715
- hideContent() {
716
- C("hideContent") && R("remove");
717
- },
718
- restoreContent() {
719
- C("restoreContent") && R("original");
720
- },
721
- replaceContent(L) {
722
- C("replaceContent") && (L(f.current), R("replaced"));
723
- }
724
- }), () => {
725
- var L;
726
- (L = g.current) === null || L === void 0 || L.unmount({
727
- replacementHeaderContainer: h.current,
728
- replacementContentContainer: f.current
729
- }), v = !1;
730
- };
731
- });
732
- }, [a, s]), ce(() => {
733
- var _;
734
- (_ = g.current) === null || _ === void 0 || _.update();
735
- }, [s, i, r]), {
736
- initialHidden: m,
737
- headerReplacementType: w,
738
- contentReplacementType: P,
739
- headerRef: l,
740
- replacementHeaderRef: h,
741
- contentRef: o,
742
- replacementContentRef: f
743
- };
744
- };
745
- }
746
- function An(n = 0, e = 1) {
747
- const [t, s] = Nt((i, r) => r === null || Math.abs(r - i.contentBoxWidth) >= e ? i.contentBoxWidth : r);
748
- return [t ?? n, s];
749
- }
750
- const Pn = 2e3, wt = {
751
- error: "red",
752
- info: "blue",
753
- "in-progress": "blue",
754
- success: "green",
755
- warning: "yellow"
756
- };
757
- function Fn(n) {
758
- const e = "blue";
759
- return n && wt[n] || e;
760
- }
761
- function yt(n) {
762
- return n.loading ? "in-progress" : n.type || "info";
763
- }
764
- function Ct(n) {
765
- return Fn(yt(n));
766
- }
767
- function Dn(n, e) {
768
- const t = [], s = [], i = /* @__PURE__ */ new Set(), r = Object.keys(wt).length, a = Math.min(n.length, e);
769
- for (let f = 0; f < n.length; f++) {
770
- const m = n[f], A = Ct(m), w = i.has(A);
771
- if (f < a)
772
- t.push({ item: Object.assign(Object.assign({}, m), { expandedIndex: f }), isColorRepeated: w });
773
- else {
774
- if (i.size === r)
775
- break;
776
- w || s.push(Object.assign(Object.assign({}, m), { expandedIndex: f }));
777
- }
778
- i.add(A);
779
- }
780
- const l = [];
781
- let o = 0;
782
- for (let f = t.length - 1; f >= 0; f--) {
783
- const m = t[f];
784
- m.isColorRepeated && o < s.length ? o += 1 : l.push(m.item);
785
- }
786
- const h = l.reverse();
787
- for (let f = 0; h.length < e; f++)
788
- h.push(s[f]);
789
- return h;
790
- }
791
- function Sn(n) {
792
- const e = { error: 0, info: 0, "in-progress": 0, success: 0, warning: 0 };
793
- for (const t of n) {
794
- const s = yt(t);
795
- e[s] += 1;
796
- }
797
- return e;
798
- }
799
- const Tn = [
800
- { type: "error", labelName: "errorIconAriaLabel", iconName: "status-negative" },
801
- { type: "warning", labelName: "warningIconAriaLabel", iconName: "status-warning" },
802
- { type: "success", labelName: "successIconAriaLabel", iconName: "status-positive" },
803
- { type: "info", labelName: "infoIconAriaLabel", iconName: "status-info" },
804
- { type: "in-progress", labelName: "inProgressIconAriaLabel", iconName: "status-in-progress" }
805
- ], c = {
806
- "flash-with-motion": "awsui_flash-with-motion_1q84n_1iiuy_157",
807
- enter: "awsui_enter_1q84n_1iiuy_157",
808
- "flash-body": "awsui_flash-body_1q84n_1iiuy_171",
809
- "flash-message": "awsui_flash-message_1q84n_1iiuy_171",
810
- "flash-header": "awsui_flash-header_1q84n_1iiuy_171",
811
- "flash-content": "awsui_flash-content_1q84n_1iiuy_172",
812
- "action-button-wrapper": "awsui_action-button-wrapper_1q84n_1iiuy_173",
813
- "dismiss-button-wrapper": "awsui_dismiss-button-wrapper_1q84n_1iiuy_174",
814
- "flash-icon": "awsui_flash-icon_1q84n_1iiuy_197",
815
- entering: "awsui_entering_1q84n_1iiuy_210",
816
- entered: "awsui_entered_1q84n_1iiuy_231",
817
- exiting: "awsui_exiting_1q84n_1iiuy_336",
818
- stack: "awsui_stack_1q84n_1iiuy_370",
819
- "animation-running": "awsui_animation-running_1q84n_1iiuy_370",
820
- item: "awsui_item_1q84n_1iiuy_370",
821
- "flash-list-item": "awsui_flash-list-item_1q84n_1iiuy_371",
822
- "notification-bar": "awsui_notification-bar_1q84n_1iiuy_372",
823
- collapsed: "awsui_collapsed_1q84n_1iiuy_392",
824
- "animation-ready": "awsui_animation-ready_1q84n_1iiuy_392",
825
- "expanded-only": "awsui_expanded-only_1q84n_1iiuy_392",
826
- expanded: "awsui_expanded_1q84n_1iiuy_392",
827
- flash: "awsui_flash_1q84n_1iiuy_157",
828
- collapsible: "awsui_collapsible_1q84n_1iiuy_448",
829
- "short-list": "awsui_short-list_1q84n_1iiuy_454",
830
- "visual-refresh": "awsui_visual-refresh_1q84n_1iiuy_454",
831
- status: "awsui_status_1q84n_1iiuy_601",
832
- header: "awsui_header_1q84n_1iiuy_601",
833
- "item-count": "awsui_item-count_1q84n_1iiuy_602",
834
- button: "awsui_button_1q84n_1iiuy_603",
835
- "type-count": "awsui_type-count_1q84n_1iiuy_636",
836
- "count-number": "awsui_count-number_1q84n_1iiuy_636",
837
- icon: "awsui_icon_1q84n_1iiuy_674",
838
- floating: "awsui_floating_1q84n_1iiuy_715",
839
- flashbar: "awsui_flashbar_1q84n_1iiuy_719",
840
- "initial-hidden": "awsui_initial-hidden_1q84n_1iiuy_778",
841
- "flash-list": "awsui_flash-list_1q84n_1iiuy_371",
842
- "flash-focus-container": "awsui_flash-focus-container_1q84n_1iiuy_802",
843
- "flash-text": "awsui_flash-text_1q84n_1iiuy_832",
844
- hidden: "awsui_hidden_1q84n_1iiuy_851",
845
- "header-replacement": "awsui_header-replacement_1q84n_1iiuy_856",
846
- "content-replacement": "awsui_content-replacement_1q84n_1iiuy_861",
847
- "dismiss-button": "awsui_dismiss-button_1q84n_1iiuy_174",
848
- "action-wrapped": "awsui_action-wrapped_1q84n_1iiuy_879",
849
- "action-button": "awsui_action-button_1q84n_1iiuy_173",
850
- "action-slot": "awsui_action-slot_1q84n_1iiuy_886",
851
- "flash-type-success": "awsui_flash-type-success_1q84n_1iiuy_890",
852
- "flash-type-error": "awsui_flash-type-error_1q84n_1iiuy_894",
853
- "flash-type-info": "awsui_flash-type-info_1q84n_1iiuy_898",
854
- "flash-type-in-progress": "awsui_flash-type-in-progress_1q84n_1iiuy_899",
855
- "flash-type-warning": "awsui_flash-type-warning_1q84n_1iiuy_903"
856
- }, Nn = {
857
- success: "status-positive",
858
- warning: "status-warning",
859
- info: "status-info",
860
- error: "status-negative",
861
- "in-progress": "status-in-progress"
862
- }, On = Ln(pt.flashbar.onActionRegistered), Mn = xn("flash", pt.flashContent);
863
- function kn(n, e, t, s) {
864
- return d.createElement(
865
- "div",
866
- Object.assign({ className: c["dismiss-button-wrapper"] }, G({
867
- action: "dismiss"
868
- })),
869
- d.createElement($e, { onClick: e, className: c["dismiss-button"], variant: "flashbar-icon", iconName: "close", formAction: "none", ariaLabel: n, style: void 0 })
870
- );
871
- }
872
- const It = _t((n, e) => {
873
- var t;
874
- const s = `[data-itemid="${CSS.escape(e)}"] .${c["flash-focus-container"]}`;
875
- (t = n?.querySelector(s)) === null || t === void 0 || t.focus();
876
- }, Pn, { trailing: !1 }), Rt = d.forwardRef((n, e) => {
877
- var { id: t, header: s, content: i, dismissible: r, dismissLabel: a, loading: l, action: o, buttonText: h, onButtonClick: f, onDismiss: m, className: A, transitionState: w, ariaRole: F, i18nStrings: P, type: R = "info", analyticsMetadata: g, style: _ } = n, y = Y(n, ["id", "header", "content", "dismissible", "dismissLabel", "loading", "action", "buttonText", "onButtonClick", "onDismiss", "className", "transitionState", "ariaRole", "i18nStrings", "type", "analyticsMetadata", "style"]);
878
- lt && (h && !f && Le("Flashbar", "You provided a `buttonText` prop without an `onButtonClick` handler. This will render a non-interactive action button."), r && !m && Le("Flashbar", "You have set the `dismissible` prop without an `onDismiss` handler. This will render a non-interactive dismiss button."));
879
- const [v, C] = An(), L = Ot("Flash", Ue, g), k = ge(e, L, C), W = K("flash-icon"), q = K("flash-message"), ee = D(null), te = D(null), { discoveredActions: j, headerRef: b, contentRef: T } = On(R), { initialHidden: ue, headerReplacementType: H, contentReplacementType: ne, headerRef: J, contentRef: x, replacementHeaderRef: B, replacementContentRef: Fe } = Mn({ type: R, header: s, children: i }), De = ge(b, J, ee), _e = ge(T, x, te), de = y.statusIconAriaLabel || P?.[`${l || R === "in-progress" ? "inProgress" : R}IconAriaLabel`], se = Nn[R], Se = l ? d.createElement(
880
- "span",
881
- { role: "img", "aria-label": de },
882
- d.createElement(Mt, null)
883
- ) : d.createElement(ze, { name: se, ariaLabel: de }), $ = l ? "info" : R, ve = {
884
- [jt]: $
885
- };
886
- return g?.suppressFlowMetricEvents && (ve[qt] = "true"), // We're not using "polite" or "assertive" here, just turning default behavior off.
887
- // eslint-disable-next-line @cloudscape-design/components/prefer-live-region
888
- d.createElement(
889
- "div",
890
- Object.assign({ ref: k, role: F, "aria-live": F ? "off" : void 0, "data-itemid": t, className: E(c.flash, c[`flash-type-${$}`], A, w && {
891
- [c.enter]: w === "enter",
892
- [c.entering]: w === "entering",
893
- [c.entered]: w === "entered",
894
- [c.exit]: w === "exit",
895
- [c.exiting]: w === "exiting",
896
- [c.exited]: w === "exited"
897
- }, ct(R === "warning" && !l ? "flashbar-warning" : "flashbar"), ue && c["initial-hidden"]), style: void 0 }, ve),
898
- d.createElement(
899
- "div",
900
- { className: c["flash-body"] },
901
- d.createElement(
902
- "div",
903
- { className: c["flash-focus-container"], tabIndex: -1, role: "group", "aria-labelledby": `${W} ${q}` },
904
- d.createElement("div", { className: E(c["flash-icon"], c["flash-text"]), id: W }, Se),
905
- d.createElement(
906
- "div",
907
- { className: E(c["flash-message"], c["flash-text"]), id: q },
908
- d.createElement("div", { className: E(c["flash-header"], H !== "original" ? c.hidden : Be["flash-header"]), ref: De }, s),
909
- d.createElement("div", { className: E(c["header-replacement"], H !== "replaced" && c.hidden), ref: B }),
910
- d.createElement("div", { className: E(c["flash-content"], ne !== "original" ? c.hidden : Be["flash-header"]), ref: _e }, i),
911
- d.createElement("div", { className: E(c["content-replacement"], ne !== "replaced" && c.hidden), ref: Fe })
912
- )
913
- ),
914
- d.createElement(In, { className: c["action-button-wrapper"], testUtilClasses: {
915
- actionSlot: c["action-slot"],
916
- actionButton: c["action-button"]
917
- }, action: o, discoveredActions: j, buttonText: h, onButtonClick: f, containerWidth: v, wrappedClass: c["action-wrapped"] })
918
- ),
919
- r && kn(a, m, _, $),
920
- F === "status" && d.createElement(kt, { sources: [de, ee, te] })
921
- );
922
- });
923
- function Et(n) {
924
- var { items: e, onItemsAdded: t, onItemsChanged: s, onItemsRemoved: i } = n, r = Y(n, ["items", "onItemsAdded", "onItemsChanged", "onItemsRemoved"]);
925
- const { __internalRootRef: a } = He("Flashbar", {
926
- props: { stackItems: r.stackItems }
927
- }), l = ft(() => e.every((g) => "id" in g), [e]), o = We(r), h = D(null), f = ge(h, a), m = Bt(h), A = Ut(), [w, F] = S(e), [P, R] = S(null);
928
- if (lt && e?.some((g) => g.ariaRole === "alert" && !g.id) && Le("Flashbar", 'You provided `ariaRole="alert"` for a flashbar item without providing an `id`. Focus will not be moved to the newly added flash message.'), e) {
929
- const g = e.filter(({ id: y }) => y && !w.some((v) => v.id === y)), _ = w.filter(({ id: y }) => y && !e.some((v) => v.id === y));
930
- if (g.length > 0 || _.length > 0) {
931
- F(e), t?.(g), i?.(_), s?.({ allItemsHaveId: l, isReducedMotion: m });
932
- const y = g.filter(({ ariaRole: v }) => v === "alert");
933
- y.length > 0 && R(y[0].id);
934
- }
935
- }
936
- return ce(() => {
937
- P && It(h.current, P);
938
- }, [P, h]), {
939
- allItemsHaveId: l,
940
- baseProps: o,
941
- isReducedMotion: m,
942
- isVisualRefresh: A,
943
- mergedRef: f,
944
- ref: h
945
- };
946
- }
947
- const rt = 1, jn = 100;
948
- function qn(n) {
949
- var { items: e, style: t } = n, s = Y(n, ["items", "style"]);
950
- const [i, r] = S([]), [a, l] = S([]), [o, h] = S(!1), f = et(() => {
951
- const u = o ? g.current : R.current;
952
- return Object.assign(Object.assign({}, u), { notificationBar: C.current });
953
- }, [o]), m = et(() => {
954
- const u = bn(f());
955
- y(u);
956
- }, [f]), { baseProps: A, isReducedMotion: w, mergedRef: F, ref: P } = Et(Object.assign(Object.assign({ items: e }, s), { onItemsAdded: (u) => {
957
- r([...i, ...u]);
958
- }, onItemsChanged: (u) => {
959
- u?.allItemsHaveId && !u?.isReducedMotion && m();
960
- }, onItemsRemoved: (u) => {
961
- l([...a, ...u]);
962
- } })), R = D({}), g = D({}), [_, y] = S(null), v = D(null), C = D(null), [L, k] = S(!1), W = K("flashbar"), q = K("item-count");
963
- e.length <= rt && o && h(!1);
964
- const ee = !w;
965
- function te() {
966
- w || m(), h((u) => !u);
967
- }
968
- Ce(() => {
969
- if (o && e?.length) {
970
- const u = e[0];
971
- u.id !== void 0 && It(P.current, u.id);
972
- }
973
- }, [o]), Wt(() => {
974
- !o && C.current && Ht(C.current);
975
- }, [o]);
976
- const j = ft(() => _t(() => {
977
- const u = v?.current, I = u?.parentElement;
978
- if (u && I) {
979
- I.classList.remove(c.floating);
980
- const N = window.innerHeight, Oe = $t(I, (fe) => fe.getAttribute("role") === "region") || I;
981
- o && Math.ceil(Oe.getBoundingClientRect().bottom) >= N || I.classList.add(c.floating);
982
- }
983
- }, jn), [o]);
984
- Ce(() => (window.addEventListener("resize", j), () => {
985
- window.removeEventListener("resize", j), j.cancel();
986
- }), [j]);
987
- const { i18nStrings: b } = s, T = ut("flashbar"), ue = T("i18nStrings.ariaLabel", b?.ariaLabel), H = T("i18nStrings.notificationBarText", b?.notificationBarText), ne = T("i18nStrings.notificationBarAriaLabel", b?.notificationBarAriaLabel), J = {
988
- errorIconAriaLabel: T("i18nStrings.errorIconAriaLabel", b?.errorIconAriaLabel),
989
- inProgressIconAriaLabel: T("i18nStrings.inProgressIconAriaLabel", b?.inProgressIconAriaLabel),
990
- infoIconAriaLabel: T("i18nStrings.infoIconAriaLabel", b?.infoIconAriaLabel),
991
- successIconAriaLabel: T("i18nStrings.successIconAriaLabel", b?.successIconAriaLabel),
992
- warningIconAriaLabel: T("i18nStrings.warningIconAriaLabel", b?.warningIconAriaLabel)
993
- };
994
- Ce(() => {
995
- _ && (j(), wn({
996
- elements: f(),
997
- oldState: _,
998
- newElementInitialState: ({ top: u }) => ({ scale: 0.9, y: -0.2 * u }),
999
- onTransitionsEnd: () => k(!1)
1000
- }), k(!0), y(null));
1001
- }, [j, f, _, o]);
1002
- const x = e.length > rt, B = Sn(e), Fe = new Set(e.map(Ct)).size, De = Math.max(Fe, 3), _e = Math.min(De, e.length), de = o ? e.map((u, I) => Object.assign(Object.assign({}, u), { expandedIndex: I })) : Dn(e, _e).map((u, I) => Object.assign(Object.assign({}, u), { collapsedIndex: I })), se = (u) => {
1003
- var I, N;
1004
- return (N = (I = u.id) !== null && I !== void 0 ? I : u.expandedIndex) !== null && N !== void 0 ? N : 0;
1005
- }, Se = (u) => i.some((I) => I.id && I.id === u.id), $ = (u) => !("expandedIndex" in u), ve = (u) => Se(u) || $(u), Te = (u) => o || $(u) || "expandedIndex" in u && u.expandedIndex === 0, Ye = (u, I) => I === 0 && ve(u), Ne = (u) => `flash-${se(u)}`, Je = () => d.createElement(
1006
- "ul",
1007
- { ref: v, className: E(c["flash-list"], o ? c.expanded : c.collapsed, L && c["animation-running"], _ && c["animation-ready"], c["visual-refresh"]), id: W, "aria-label": ue, "aria-describedby": x ? q : void 0, style: !o || L ? {
1008
- [tt.flashbarStackDepth]: _e
1009
- } : void 0 },
1010
- d.createElement(Un, { withMotion: !w }, de.map((u, I) => d.createElement(dt, { key: se(u), in: !$(u), onStatusChange: (N) => {
1011
- N === "entered" ? r([]) : N === "exited" && l([]);
1012
- } }, (N, Oe) => {
1013
- var be, fe, Me;
1014
- return d.createElement("li", Object.assign({ "aria-hidden": !Te(u), className: Te(u) ? E(c["flash-list-item"], !o && c.item, !R.current[Ne(u)] && c["expanded-only"]) : E(c.flash, c[`flash-type-${(be = u.type) !== null && be !== void 0 ? be : "info"}`], c.item), ref: (Qe) => {
1015
- o ? g.current[Ne(u)] = Qe : R.current[Ne(u)] = Qe;
1016
- }, style: Object.assign(Object.assign({}, I > 0 && !o && (u.type, void 0)), (!o || L) && {
1017
- [tt.flashbarStackIndex]: (Me = (fe = u.collapsedIndex) !== null && fe !== void 0 ? fe : u.expandedIndex) !== null && Me !== void 0 ? Me : I
1018
- }), key: se(u) }, G(bt(I + 1, u.type || "info", u.id))), Te(u) && d.createElement(Rt, Object.assign({ className: E(ee && c["flash-with-motion"], c["flash-refresh"]), key: se(u), ref: Ye(u, I) ? Oe : void 0, transitionState: Ye(u, I) ? N : void 0, i18nStrings: J, style: t }, u)));
1019
- })))
1020
- );
1021
- return d.createElement(
1022
- "div",
1023
- Object.assign({}, A, { className: E(A.className, c.flashbar, c.stack, x && c.collapsible, e.length === 2 && c["short-list"], o && c.expanded, c["visual-refresh"]), ref: F }, G(vt(e.length, !0, o))),
1024
- o && Je(),
1025
- x && d.createElement(
1026
- "div",
1027
- Object.assign({ className: E(
1028
- c["notification-bar"],
1029
- c["visual-refresh"],
1030
- o ? c.expanded : c.collapsed,
1031
- L && c["animation-running"],
1032
- e.length === 2 && c["short-list"],
1033
- ct("flashbar")
1034
- // Visual context is needed for focus ring to be white
1035
- ), onClick: te, ref: C, style: void 0 }, G({
1036
- action: o ? "collapse" : "expand",
1037
- detail: {
1038
- label: "h2"
1039
- }
1040
- })),
1041
- d.createElement(
1042
- "span",
1043
- { "aria-live": "polite", className: c.status, role: "status", id: q },
1044
- H && d.createElement("h2", { className: c.header }, H),
1045
- d.createElement("span", { className: c["item-count"] }, Tn.map(({ type: u, labelName: I, iconName: N }) => d.createElement(Bn, { key: u, iconName: N, label: J[I], count: B[u] })))
1046
- ),
1047
- d.createElement(
1048
- "button",
1049
- { "aria-controls": W, "aria-describedby": q, "aria-expanded": o, "aria-label": ne, className: E(c.button, o && c.expanded) },
1050
- d.createElement(ze, { className: c.icon, size: "normal", name: "angle-down" })
1051
- )
1052
- ),
1053
- !o && Je()
1054
- );
1055
- }
1056
- const Bn = ({ iconName: n, label: e, count: t }) => d.createElement(
1057
- "span",
1058
- { className: c["type-count"] },
1059
- d.createElement(
1060
- "span",
1061
- { title: e },
1062
- d.createElement(ze, { name: n, ariaLabel: e })
1063
- ),
1064
- d.createElement("span", { className: c["count-number"] }, t)
1065
- ), Un = ({ children: n, withMotion: e }) => e ? d.createElement(Pe, { component: null }, n) : d.createElement(d.Fragment, null, n), Wn = 115;
1066
- function Hn(n) {
1067
- var { items: e, i18nStrings: t, style: s } = n, i = Y(n, ["items", "i18nStrings", "style"]);
1068
- const { allItemsHaveId: r, baseProps: a, isReducedMotion: l, isVisualRefresh: o, mergedRef: h } = Et(Object.assign({ items: e }, i)), f = ut("flashbar"), m = f("i18nStrings.ariaLabel", t?.ariaLabel), A = {
1069
- errorIconAriaLabel: f("i18nStrings.errorIconAriaLabel", t?.errorIconAriaLabel),
1070
- inProgressIconAriaLabel: f("i18nStrings.inProgressIconAriaLabel", t?.inProgressIconAriaLabel),
1071
- infoIconAriaLabel: f("i18nStrings.infoIconAriaLabel", t?.infoIconAriaLabel),
1072
- successIconAriaLabel: f("i18nStrings.successIconAriaLabel", t?.successIconAriaLabel),
1073
- warningIconAriaLabel: f("i18nStrings.warningIconAriaLabel", t?.warningIconAriaLabel)
1074
- }, w = l || !o || !r, F = !l && o;
1075
- function P() {
1076
- if (!(w || !e))
1077
- return (
1078
- // This is a proxy for <ul>, so we're not applying a class to another actual component.
1079
- d.createElement(Pe, { component: "ul", className: c["flash-list"], "aria-label": m }, e.map((_, y) => {
1080
- var v;
1081
- return d.createElement(dt, { transitionChangeDelay: { entering: Wn }, key: (v = _.id) !== null && v !== void 0 ? v : y, in: !0 }, (C, L) => {
1082
- var k;
1083
- return d.createElement("li", { className: c["flash-list-item"] }, g(_, (k = _.id) !== null && k !== void 0 ? k : y, L, C));
1084
- });
1085
- }))
1086
- );
1087
- }
1088
- function R() {
1089
- if (!(!w || !e))
1090
- return d.createElement("ul", Object.assign({ className: c["flash-list"], "aria-label": m }, G(vt(e.length, !1))), e.map((_, y) => {
1091
- var v, C;
1092
- return d.createElement("li", Object.assign({ key: (v = _.id) !== null && v !== void 0 ? v : y, className: c["flash-list-item"] }, G(bt(y + 1, _.type || "info", _.id))), g(_, (C = _.id) !== null && C !== void 0 ? C : y));
1093
- }));
1094
- }
1095
- function g(_, y, v, C) {
1096
- return d.createElement(Rt, Object.assign({ className: E(F && c["flash-with-motion"], c["flash-refresh"]), key: y, ref: v, transitionState: C, i18nStrings: A, style: s }, _));
1097
- }
1098
- return d.createElement(
1099
- "div",
1100
- Object.assign({}, a, { className: E(a.className, c.flashbar), ref: h }),
1101
- P(),
1102
- R()
1103
- );
1104
- }
1105
- function Lt(n) {
1106
- return n.stackItems ? d.createElement(qn, Object.assign({}, n)) : d.createElement(Hn, Object.assign({}, n));
1107
- }
1108
- Ae(Lt, "Flashbar");
1109
- const xt = (n) => (zt("Flashbar", n, ["style"], {}), d.createElement(Lt, n));
1110
- Ae(xt, "Flashbar");
1111
- function $n({ errors: n }) {
1112
- const e = n.map((t) => ({
1113
- type: "error",
1114
- content: t,
1115
- id: t
1116
- }));
1117
- return /* @__PURE__ */ z.jsx(xt, { items: e });
1118
- }
1119
- function Qn({ onChange: n }) {
1120
- const [e, t] = S([]), s = async (i) => {
1121
- t([]);
1122
- const r = _n(i);
1123
- if (r.length > 0) {
1124
- t(r);
1125
- return;
1126
- }
1127
- try {
1128
- const a = i[0], l = a?.name, o = await vn(a), h = Xt(o);
1129
- n(h, l);
1130
- } catch (a) {
1131
- console.error("Error reading HAR file:", a);
1132
- const l = a instanceof Error ? a.message : "An unknown error occurred";
1133
- t([l]);
1134
- }
1135
- };
1136
- return /* @__PURE__ */ z.jsxs(Ze, { children: [
1137
- /* @__PURE__ */ z.jsx($n, { errors: e }),
1138
- /* @__PURE__ */ z.jsx(mt, { onChange: ({ detail: i }) => s(i.value), children: /* @__PURE__ */ z.jsxs(Ze, { alignItems: "center", size: "s", children: [
1139
- /* @__PURE__ */ z.jsx(Ke, { color: "inherit", children: "Drop your .har file here" }),
1140
- /* @__PURE__ */ z.jsx(Ke, { color: "inherit", children: "or" }),
1141
- /* @__PURE__ */ z.jsx(gt, { accept: Ge, value: [], onChange: ({ detail: i }) => s(i.value), children: "Choose file" })
1142
- ] }) })
1143
- ] });
1144
- }
1145
- export {
1146
- Qn as H,
1147
- pt as a,
1148
- rn as s
1149
- };