@har-analyzer/components 0.0.20 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/chunks/collapsible-key-value-list.js +41 -10
  2. package/dist/chunks/collapsible-section.js +1 -1
  3. package/dist/chunks/common.js +10 -0
  4. package/dist/chunks/content-type.js +15 -21
  5. package/dist/chunks/har-entry-response-status.js +14 -0
  6. package/dist/chunks/har.js +47 -20
  7. package/dist/chunks/horizontal-padding.js +8 -0
  8. package/dist/chunks/index.js +589 -891
  9. package/dist/chunks/index2.js +271 -49
  10. package/dist/chunks/list-har-entries.js +30 -0
  11. package/dist/chunks/request-headers.js +34 -0
  12. package/dist/chunks/request-payload.js +25 -0
  13. package/dist/chunks/response-headers.js +19 -0
  14. package/dist/chunks/response-payload.js +10 -0
  15. package/dist/components/collapsible-key-value-list.d.ts +7 -2
  16. package/dist/components/collapsible-section.d.ts +2 -1
  17. package/dist/components/enhanced-board/i18n.d.ts +26 -0
  18. package/dist/components/enhanced-board/index.d.ts +15 -0
  19. package/dist/components/{enhanced-table.d.ts → enhanced-table/index.d.ts} +9 -15
  20. package/dist/components/enhanced-table/preferences.d.ts +13 -0
  21. package/dist/components/har-entry-response-status.d.ts +4 -0
  22. package/dist/components/space-between.d.ts +2 -0
  23. package/dist/features/har-analyzer/components/app-layout.d.ts +3 -2
  24. package/dist/features/har-analyzer/components/top-navigation.d.ts +3 -2
  25. package/dist/features/har-analyzer/index.d.ts +2 -1
  26. package/dist/features/har-entries-viewer/components/har-entries-viewer-action-stripe/har-entry-header-picker.d.ts +6 -0
  27. package/dist/features/har-entries-viewer/components/har-entries-viewer-action-stripe/index.d.ts +8 -0
  28. package/dist/features/har-entries-viewer/components/har-entries-viewer-provider.d.ts +2 -0
  29. package/dist/features/har-entries-viewer/components/view-har-entry-header.d.ts +7 -0
  30. package/dist/features/har-entries-viewer/context/preferences.d.ts +2 -0
  31. package/dist/features/har-entries-viewer/index.d.ts +1 -1
  32. package/dist/features/list-har-entries/components/list-har-entries-provider.d.ts +2 -0
  33. package/dist/features/list-har-entries/components/list-har-entries-table-header/index.d.ts +6 -0
  34. package/dist/features/list-har-entries/components/list-har-entries-table.d.ts +8 -0
  35. package/dist/features/list-har-entries/components/list-har-entries.d.ts +5 -0
  36. package/dist/features/list-har-entries/context/preferences.d.ts +1 -3
  37. package/dist/features/list-har-entries/hooks/filter-har-entries.d.ts +2 -0
  38. package/dist/features/list-har-entries/index.d.ts +8 -4
  39. package/dist/features/view-har-entry/components/request-headers.d.ts +4 -0
  40. package/dist/features/view-har-entry/components/request-payload.d.ts +6 -0
  41. package/dist/features/view-har-entry/components/response-headers.d.ts +4 -0
  42. package/dist/features/view-har-entry/components/response-payload.d.ts +6 -0
  43. package/dist/features/view-har-entry/index.d.ts +1 -1
  44. package/dist/har-analyzer.js +16 -15
  45. package/dist/har-entries-viewer.js +271 -630
  46. package/dist/index.d.ts +1 -1
  47. package/dist/index.js +25 -17
  48. package/dist/list-har-entries.js +6 -3
  49. package/dist/utils/array.d.ts +7 -0
  50. package/dist/utils/har.d.ts +12 -1
  51. package/dist/view-har-entry.js +58 -6
  52. package/package.json +2 -2
  53. package/dist/assets/har-entries-viewer.css +0 -1
  54. package/dist/chunks/headers-viewer.js +0 -32
  55. package/dist/chunks/payload-viewer.js +0 -15
  56. package/dist/chunks/response-viewer.js +0 -10
  57. package/dist/components/r2-layout/fgl.d.ts +0 -10
  58. package/dist/components/r2-layout/index.d.ts +0 -22
  59. package/dist/features/list-har-entries/components/har-entries-table.d.ts +0 -8
  60. package/dist/features/view-har-entry/components/headers-viewer.d.ts +0 -6
  61. package/dist/features/view-har-entry/components/payload-viewer.d.ts +0 -6
  62. package/dist/features/view-har-entry/components/response-viewer.d.ts +0 -6
  63. /package/dist/features/{list-har-entries/components → har-entries-viewer/components/har-entries-viewer-action-stripe}/compare-mode-switcher.d.ts +0 -0
  64. /package/dist/features/list-har-entries/components/{content-type-filter.d.ts → list-har-entries-table-header/content-type-filter.d.ts} +0 -0
  65. /package/dist/features/list-har-entries/components/{errors-filter.d.ts → list-har-entries-table-header/errors-filter.d.ts} +0 -0
@@ -1,671 +1,312 @@
1
- import { jsx as C, jsxs as q, Fragment as j } from "react/jsx-runtime";
2
- import { colorBorderDividerDefault as B, borderWidthField as K, borderRadiusContainer as Y } from "@cloudscape-design/design-tokens";
3
- import { useMemo as P, useRef as O, useEffect as H, useCallback as G, useState as z } from "react";
4
- import N from "@cloudscape-design/components/button";
5
- import V from "@cloudscape-design/components/box";
6
- import { L as X } from "./chunks/index.js";
7
- import { D as $, V as Z } from "./chunks/index2.js";
8
- import { d as S } from "./chunks/har.js";
9
- import './assets/har-entries-viewer.css';function J(E) {
10
- const { onClose: e } = E;
11
- return /* @__PURE__ */ C(
12
- "div",
1
+ import { jsx as r, jsxs as T } from "react/jsx-runtime";
2
+ import { useMemo as $, useState as H, useEffect as v } from "react";
3
+ import j from "@cloudscape-design/board-components/board";
4
+ import G from "@cloudscape-design/board-components/board-item";
5
+ import Y from "@cloudscape-design/components/button";
6
+ import { H as W } from "./chunks/horizontal-padding.js";
7
+ import { V as K } from "./chunks/vertical-gap.js";
8
+ import { H as q, L as J, a as Q, b as X } from "./chunks/index.js";
9
+ import Z from "./view-har-entry.js";
10
+ import { D as ee, e as N, f as A } from "./chunks/har.js";
11
+ import ne from "@cloudscape-design/components/segmented-control";
12
+ import { c as O } from "./chunks/index2.js";
13
+ import { o as V } from "./chunks/common.js";
14
+ import te from "@cloudscape-design/components/multiselect";
15
+ import "@cloudscape-design/components/header";
16
+ import "@cloudscape-design/components/space-between";
17
+ import "./chunks/content-type.js";
18
+ import re from "@cloudscape-design/components/token-group";
19
+ const oe = {
20
+ dragHandleAriaLabel: "Drag handle",
21
+ dragHandleAriaDescription: "Use Space or Enter to activate drag, arrow keys to move, Space or Enter to submit, or Escape to discard. Be sure to temporarily disable any screen reader navigation feature that may interfere with the functionality of the arrow keys.",
22
+ resizeHandleAriaLabel: "Resize handle",
23
+ resizeHandleAriaDescription: "Use Space or Enter to activate resize, arrow keys to move, Space or Enter to submit, or Escape to discard. Be sure to temporarily disable any screen reader navigation feature that may interfere with the functionality of the arrow keys."
24
+ };
25
+ function y(e, n, t) {
26
+ const o = n.length > 0 ? `Conflicts with ${n.map(({ data: { componentType: f, instanceId: s } }) => `Component type: ${f}, Instance ID: ${s}`).join(", ")}.` : "", d = t.length > 0 ? `Disturbed ${t.length} items.` : "";
27
+ return [e, o, d].filter(Boolean).join(" ");
28
+ }
29
+ const ie = {
30
+ liveAnnouncementDndStarted: (e) => e === "resize" ? "Resizing" : "Dragging",
31
+ liveAnnouncementDndItemReordered: (e) => {
32
+ const n = `column ${e.placement.x + 1}`, t = `row ${e.placement.y + 1}`;
33
+ return y(
34
+ `Item moved to ${e.direction === "horizontal" ? n : t}.`,
35
+ e.conflicts,
36
+ e.disturbed
37
+ );
38
+ },
39
+ liveAnnouncementDndItemResized: (e) => {
40
+ const n = e.isMinimalColumnsReached ? " (minimal)" : "", t = e.isMinimalRowsReached ? " (minimal)" : "", o = e.direction === "horizontal" ? `columns ${e.placement.width}${n}` : `rows ${e.placement.height}${t}`;
41
+ return y(`Item resized to ${o}.`, e.conflicts, e.disturbed);
42
+ },
43
+ liveAnnouncementDndItemInserted: (e) => {
44
+ const n = `column ${e.placement.x + 1}`, t = `row ${e.placement.y + 1}`;
45
+ return y(`Item inserted to ${n}, ${t}.`, e.conflicts, e.disturbed);
46
+ },
47
+ liveAnnouncementDndCommitted: (e) => `${e} committed`,
48
+ liveAnnouncementDndDiscarded: (e) => `${e} discarded`,
49
+ liveAnnouncementItemRemoved: (e) => y(`Removed item ${e.item.id}.`, [], e.disturbed),
50
+ navigationAriaLabel: "Board navigation",
51
+ navigationAriaDescription: "Click on non-empty item to move focus over",
52
+ navigationItemAriaLabel: (e) => e ? e.id : "Empty"
53
+ };
54
+ function se(e) {
55
+ const {
56
+ components: n,
57
+ definitions: t,
58
+ onDefinitionsChange: o,
59
+ empty: d
60
+ } = e, f = t.map((s, a) => ({
61
+ ...s,
62
+ id: String(a)
63
+ }));
64
+ return /* @__PURE__ */ r(
65
+ j,
13
66
  {
14
- style: {
15
- position: "absolute",
16
- top: 0,
17
- right: 0,
18
- zIndex: 1
67
+ i18nStrings: ie,
68
+ items: f,
69
+ renderItem: ({ data: s }) => {
70
+ const { componentType: a, instanceId: m } = s;
71
+ let p, E, h;
72
+ const c = n[a];
73
+ if (typeof c == "function") {
74
+ const i = c(m);
75
+ p = i.content, E = i.header, h = i.onRemove;
76
+ } else
77
+ p = c?.content, E = c?.header, h = c?.onRemove;
78
+ return /* @__PURE__ */ r(
79
+ G,
80
+ {
81
+ disableContentPaddings: !0,
82
+ i18nStrings: oe,
83
+ header: E,
84
+ settings: h && /* @__PURE__ */ r(Y, { variant: "icon", iconName: "close", onClick: h }),
85
+ children: p
86
+ }
87
+ );
19
88
  },
20
- children: /* @__PURE__ */ C(
21
- N,
22
- {
23
- variant: "icon",
24
- iconName: "close",
25
- onClick: e
26
- }
27
- )
89
+ onItemsChange: ({ detail: { items: s } }) => {
90
+ o(s);
91
+ },
92
+ empty: d
28
93
  }
29
94
  );
30
95
  }
31
- function Q({ children: E }) {
32
- return /* @__PURE__ */ C(V, { padding: "m", children: E });
96
+ function ae(e) {
97
+ return e.filter((n) => n !== void 0);
33
98
  }
34
- class D {
35
- constructor(e, t) {
36
- this.layouts = /* @__PURE__ */ new Map(), this.editable = !1, this.layoutChangeCallback = () => {
37
- }, this.selectionChangeCallback = () => {
38
- }, this.selection = /* @__PURE__ */ new Set(), this.dragPointerId = 0, this.dragStartTime = 0, this.dragStartX = 0, this.dragStartY = 0, this.dragEndX = 0, this.dragEndY = 0, this.dragging = !1, this.preventClick = !1, this.renderRequested = !1, this.layoutFlag = !0, this.selectionFlag = !0, this.metaFlag = !0, this.manipulationCache = /* @__PURE__ */ new WeakMap(), this.fn = this.constructor, this._handleMouseDown = this.handleMouseDown.bind(this), this._handleMouseMove = this.handleMouseMove.bind(this), this._handleMouseUp = this.handleMouseUp.bind(this), this._handlePointerDown = this.handlePointerDown.bind(this), this._handlePointerMove = this.handlePointerMove.bind(this), this._handlePointerUp = this.handlePointerUp.bind(this), this._handleClick = this.handleClick.bind(this), this._handleKeyUp = this.handleKeyUp.bind(this), this.container = e, this.containerWidth = e.offsetWidth, this.breakpoints = this.fn.compileBreakpoints(t), this.resizeObserver = new ResizeObserver(() => this.handleResize()), this.resizeObserver.observe(this.container), this.addEventListeners();
39
- }
40
- setConfig(e) {
41
- this.breakpoints = this.fn.compileBreakpoints(e);
42
- for (const [t, n] of this.layouts) {
43
- const s = this.getBreakpoint(t);
44
- this.fn.repairLayout(n, s.columns) !== n && (this.layouts.set(t, this.fn.repairLayout(n, s.columns)), this.layoutChangeCallback(n, s.name));
45
- }
46
- this.layoutFlag = !0, this.selectionFlag = !0, this.metaFlag = !0, this.requestRender();
47
- }
48
- setLayout(e, t) {
49
- const n = this.getBreakpoint(t), s = this.layouts.get(n.name);
50
- if (e !== s) {
51
- this.layouts.set(n.name, this.fn.repairLayout(e, n.columns)), this.layoutChangeCallback(e, n.name);
52
- for (const a of this.breakpoints)
53
- this.layouts.has(a.name) || (this.layouts.set(a.name, this.fn.repairLayout(e, a.columns)), this.layoutChangeCallback(e, a.name));
54
- this.layoutFlag = !0, this.requestRender();
55
- }
56
- }
57
- setEditable(e) {
58
- this.editable = e, this.selectionFlag = !0, this.metaFlag = !0, this.requestRender();
59
- }
60
- onLayoutChange(e) {
61
- this.layoutChangeCallback = e;
62
- }
63
- onSelectionChange(e) {
64
- this.selectionChangeCallback = e;
65
- }
66
- setSelection(e) {
67
- ee(e, this.selection) || (this.selection = e, this.selectionChangeCallback(this.selection), this.selectionFlag = !0, this.requestRender());
68
- }
69
- toggleSelection(e, t = !1) {
70
- this.selection.has(e) ? this.selection.delete(e) : (t && this.selection.clear(), this.selection.add(e)), this.selectionChangeCallback(this.selection), this.selectionFlag = !0, this.requestRender();
71
- }
72
- clearSelection() {
73
- this.selection.size > 0 && (this.selection.clear(), this.selectionChangeCallback(this.selection), this.selectionFlag = !0, this.requestRender());
74
- }
75
- getBreakpoint(e) {
76
- const t = this.breakpoints;
77
- if (e) {
78
- const n = t.find((s) => s.name === e);
79
- if (n)
80
- return n;
81
- }
82
- return t.find((n) => n.maxWidth >= this.containerWidth);
83
- }
84
- //
85
- requestRender() {
86
- this.renderRequested || (this.renderRequested = !0, requestAnimationFrame(() => this.render()));
87
- }
88
- render() {
89
- this.renderRequested = !1;
90
- const e = this.getBreakpoint(), t = this.getNextLayout();
91
- (this.layoutFlag || t !== this.lastLayoutToRender) && (this.fn.renderLayout(this.container, t, e), this.layoutFlag = !1, this.lastLayoutToRender = t), this.selectionFlag && (this.renderSelection(), this.selectionFlag = !1), this.metaFlag && (this.renderMeta(), this.metaFlag = !1);
92
- }
93
- renderSelection() {
94
- const e = this.container.children;
95
- for (let t = 0, n = e.length; t < n; ++t) {
96
- const s = e[t];
97
- s instanceof HTMLElement && s.classList.toggle("-selected", this.selection.has(s.dataset.key));
98
- }
99
- }
100
- renderMeta() {
101
- const { container: e, editable: t, dragging: n, resizeHandle: s } = this;
102
- e.classList.toggle("-editable", t), e.classList.toggle("-moving", n && !s), e.classList.toggle("-resizing", n && !!s);
103
- const a = e.ownerDocument.documentElement;
104
- a.classList.toggle("_hide-selection", n), a.classList.toggle("_force-cursor", !!s);
105
- const g = this.fn.getResizeCursor(s);
106
- a.style.getPropertyValue("--force-cursor") !== g && a.style.setProperty("--force-cursor", g);
107
- }
108
- //
109
- getNextLayout() {
110
- const e = this.getBreakpoint(), t = this.layouts.get(e.name);
111
- if (!t)
112
- return [];
113
- if (!this.dragging)
114
- return t;
115
- const n = this.dragEndX - this.dragStartX, s = this.dragEndY - this.dragStartY, g = this.fn.getColumnWidth(this.containerWidth, e.columns, e.columnGap) + e.columnGap, u = e.rowHeight + e.rowGap, f = R(n / g), p = R(s / u);
116
- if (f === 0 && p === 0)
117
- return t;
118
- let i = this.manipulationCache.get(t);
119
- i || (i = /* @__PURE__ */ new Map(), this.manipulationCache.set(t, i));
120
- const l = `${Array.from(this.selection).join(",")}@${f},${p}@${this.resizeHandle}`, o = i.get(l);
121
- if (o)
122
- return o;
123
- const r = this.resizeHandle ? this.fn.resizeItems(t, e.columns, this.selection, f, p, this.resizeHandle) : this.fn.moveItems(t, e.columns, this.selection, f, p);
124
- return i.set(l, r), r;
125
- }
126
- //
127
- handleResize() {
128
- this.containerWidth = this.container.offsetWidth, this.layoutFlag = !0, this.requestRender();
129
- }
130
- handleMouseDown(e) {
131
- if (this.editable === !1 || e.pointerType !== "mouse" || e.button !== 0)
132
- return;
133
- this.dragStartTime = Date.now(), this.dragStartX = this.dragEndX = e.pageX, this.dragStartY = this.dragEndY = e.pageY;
134
- const t = this.getTargetElement(e);
135
- t && (this.resizeHandle = this.checkResizeHandle(t, e), this.dragKey = t.dataset.key);
136
- }
137
- handleMouseMove(e) {
138
- if (this.editable !== !1 && e.pointerType === "mouse") {
139
- if (this.dragEndX = e.pageX, this.dragEndY = e.pageY, this.metaFlag = !0, this.requestRender(), !this.dragKey) {
140
- const t = this.getTargetElement(e);
141
- this.resizeHandle = t ? this.checkResizeHandle(t, e) : void 0;
142
- }
143
- !this.dragging && this.dragKey && (T(this.dragEndX - this.dragStartX) > this.fn.DRAG_THRESHOLD || T(this.dragEndY - this.dragStartY) > this.fn.DRAG_THRESHOLD) && (this.dragging = !0, (!this.selection.has(this.dragKey) || this.resizeHandle) && this.setSelection(new Set(this.dragKey)));
144
- }
145
- }
146
- handleMouseUp(e) {
147
- this.editable !== !1 && (e.pointerType !== "mouse" || e.button !== 0 || (this.setLayout(this.getNextLayout()), this.resetDrag()));
148
- }
149
- handlePointerDown(e) {
150
- if (this.editable === !1 || e.pointerType === "mouse" || this.dragPointerId)
151
- return;
152
- this.dragPointerId = e.pointerId, this.dragStartTime = Date.now(), this.dragStartX = this.dragEndX = e.pageX, this.dragStartY = this.dragEndY = e.pageY;
153
- const t = this.getTargetElement(e);
154
- t?.dataset.key && this.selection.has(t.dataset.key) && (this.dragging = !0, this.resizeHandle = this.checkResizeHandle(t, e), this.requestRender());
155
- }
156
- handlePointerMove(e) {
157
- this.editable !== !1 && e.pointerType !== "mouse" && e.pointerId === this.dragPointerId && (this.dragEndX = e.pageX, this.dragEndY = e.pageY, this.metaFlag = !0, this.requestRender());
158
- }
159
- handlePointerUp(e) {
160
- if (this.editable !== !1 && e.pointerType !== "mouse" && e.pointerId === this.dragPointerId) {
161
- if (this.dragStartTime > Date.now() - this.fn.TAP_DELAY && T(this.dragEndX - this.dragStartX) < this.fn.TAP_THRESHOLD && T(this.dragEndY - this.dragStartY) < this.fn.TAP_THRESHOLD) {
162
- const t = this.getTargetElement(e);
163
- t?.dataset.key ? this.toggleSelection(t.dataset.key, !0) : this.clearSelection();
164
- } else
165
- this.setLayout(this.getNextLayout());
166
- this.resetDrag();
167
- }
168
- }
169
- handleClick(e) {
170
- if (this.editable !== !1)
171
- if (this.preventClick)
172
- this.preventClick = !1, e.preventDefault(), e.stopImmediatePropagation();
173
- else {
174
- !e.ctrlKey && !e.metaKey && this.clearSelection();
175
- const t = this.getTargetElement(e);
176
- t?.dataset.key && this.toggleSelection(t.dataset.key);
177
- }
178
- }
179
- handleKeyUp(e) {
180
- if (this.editable !== !1)
181
- switch (e.key) {
182
- case "Escape":
183
- this.layoutFlag = !0, this.clearSelection(), this.resetDrag();
184
- break;
185
- }
186
- }
187
- resetDrag() {
188
- if (this.dragging) {
189
- try {
190
- const e = (document.defaultView || window).getSelection();
191
- e && e.type !== "Caret" && e.removeAllRanges();
192
- } catch {
193
- }
194
- this.preventClick = !0;
195
- }
196
- this.dragPointerId = 0, this.dragging = !1, this.dragKey = void 0, this.resizeHandle = void 0, this.metaFlag = !0, this.requestRender();
197
- }
198
- getTargetElement(e) {
199
- if (e.target instanceof Element) {
200
- const t = e.target.closest(".fast-grid-layout > .item");
201
- if (t) {
202
- if (t.classList.contains("-static"))
203
- return;
204
- if (t.classList.contains("-selected") || !e.target.closest(".fast-grid-layout .content, button, input, textarea, select"))
205
- return t;
206
- }
207
- }
208
- }
209
- checkResizeHandle(e, t) {
210
- const n = this.fn.checkResizeHandle(e.getBoundingClientRect(), t.clientX, t.clientY, this.fn.RESIZE_THRESHOLD);
211
- switch (n) {
212
- case "n":
213
- case "ne":
214
- case "nw":
215
- return;
216
- default:
217
- return n;
218
- }
219
- }
220
- //
221
- disconnect() {
222
- this.selection = /* @__PURE__ */ new Set(), this.resetDrag(), this.renderSelection(), this.renderMeta(), this.resizeObserver.unobserve(this.container), this.removeEventListeners();
223
- }
224
- addEventListeners() {
225
- this.container.addEventListener("pointerdown", this._handleMouseDown), window.addEventListener("pointermove", this._handleMouseMove, U), window.addEventListener("pointerup", this._handleMouseUp), window.addEventListener("pointercancel", this._handleMouseUp), this.container.addEventListener("pointerdown", this._handlePointerDown), window.addEventListener("pointermove", this._handlePointerMove, U), window.addEventListener("pointerup", this._handlePointerUp), window.addEventListener("pointercancel", this._handlePointerUp), window.addEventListener("click", this._handleClick, W), window.addEventListener("keyup", this._handleKeyUp);
226
- }
227
- removeEventListeners() {
228
- this.container.removeEventListener("pointerdown", this._handleMouseDown), window.removeEventListener("pointermove", this._handleMouseMove), window.removeEventListener("pointerup", this._handleMouseUp), window.removeEventListener("pointercancel", this._handleMouseUp), this.container.removeEventListener("pointerdown", this._handlePointerDown), window.removeEventListener("pointermove", this._handlePointerMove), window.removeEventListener("pointerup", this._handlePointerUp), window.removeEventListener("pointercancel", this._handlePointerUp), window.removeEventListener("click", this._handleClick, W), window.removeEventListener("keyup", this._handleKeyUp);
229
- }
230
- static compileBreakpoints(e) {
231
- var t, n, s, a, g, u, f;
232
- const l = Object.entries((t = e.breakpoints) !== null && t !== void 0 ? t : {}).map(([o, r]) => {
233
- var m, d, h, c, y, v, k, w, b, _, M, A;
234
- return {
235
- name: o,
236
- maxWidth: r.maxWidth,
237
- columns: (d = (m = r.columns) !== null && m !== void 0 ? m : e.columns) !== null && d !== void 0 ? d : 12,
238
- rowHeight: (c = (h = r.rowHeight) !== null && h !== void 0 ? h : e.rowHeight) !== null && c !== void 0 ? c : 30,
239
- rowGap: (w = (k = (v = (y = r.rowGap) !== null && y !== void 0 ? y : r.gap) !== null && v !== void 0 ? v : e.rowGap) !== null && k !== void 0 ? k : e.gap) !== null && w !== void 0 ? w : 0,
240
- columnGap: (A = (M = (_ = (b = r.columnGap) !== null && b !== void 0 ? b : r.gap) !== null && _ !== void 0 ? _ : e.columnGap) !== null && M !== void 0 ? M : e.gap) !== null && A !== void 0 ? A : 0
241
- };
242
- }).sort((o, r) => o.maxWidth - r.maxWidth);
243
- return l.push({
244
- name: "default",
245
- maxWidth: 1 / 0,
246
- columns: (n = e.columns) !== null && n !== void 0 ? n : 12,
247
- rowHeight: (s = e.rowHeight) !== null && s !== void 0 ? s : 30,
248
- rowGap: (g = (a = e.rowGap) !== null && a !== void 0 ? a : e.gap) !== null && g !== void 0 ? g : 0,
249
- columnGap: (f = (u = e.columnGap) !== null && u !== void 0 ? u : e.gap) !== null && f !== void 0 ? f : 0
250
- }), l;
251
- }
252
- static renderLayout(e, t, n) {
253
- const { columns: s, columnGap: a, rowGap: g, rowHeight: u } = n, f = e.offsetWidth, i = this.getColumnWidth(f, s, a) + a, l = u + g;
254
- e.classList.add("fast-grid-layout");
255
- const o = /* @__PURE__ */ new Map();
256
- for (let d = 0, h = t.length; d < h; ++d) {
257
- const c = t[d];
258
- o.set(c.i, c);
259
- }
260
- let r = 0;
261
- for (let d = 0, h = e.children.length; d < h; ++d) {
262
- const c = e.children[d];
263
- if (!(c instanceof HTMLElement))
264
- continue;
265
- c.dataset.key || (c.dataset.key = d.toString());
266
- const y = c.dataset.key, v = o.get(y);
267
- if (!v)
268
- continue;
269
- c.classList.add("item"), c.classList.toggle("-dynamic", !v.static), c.classList.toggle("-static", !!v.static);
270
- const k = v.y + v.h;
271
- k > r && (r = k);
272
- const w = R(v.w * i - a) + "px", b = R(v.h * l - g) + "px", _ = "translate(" + R(v.x * i) + "px, " + R(v.y * l) + "px)";
273
- c.style.width !== w && (c.style.width = w), c.style.height !== b && (c.style.height = b), c.style.transform !== _ && (c.style.transform = _);
274
- }
275
- const m = R(r * l - g) + "px";
276
- e.style.height !== m && (e.style.height = m);
277
- }
278
- static getColumnWidth(e, t, n) {
279
- return (e - (t - 1) * n) / t;
280
- }
281
- static checkResizeHandle(e, t, n, s) {
282
- const a = n - e.top < s, g = e.right - t < s, u = e.bottom - n < s, f = t - e.left < s;
283
- if (u)
284
- return g ? "se" : f ? "sw" : "s";
285
- if (g)
286
- return a ? "ne" : "e";
287
- if (f)
288
- return a ? "nw" : "w";
289
- if (a)
290
- return "n";
291
- }
292
- static getResizeCursor(e) {
293
- switch (e) {
294
- case "n":
295
- case "s":
296
- return "ns-resize";
297
- case "e":
298
- case "w":
299
- return "ew-resize";
300
- case "ne":
301
- case "sw":
302
- return "nesw-resize";
303
- case "se":
304
- case "nw":
305
- return "nwse-resize";
306
- default:
307
- return "";
308
- }
309
- }
310
- /**
311
- * Moves the specified items (in grid units).
312
- * Returns a new layout if modified.
313
- */
314
- static moveItems(e, t, n, s, a) {
315
- if (s === 0 && a === 0 || n.size === 0)
316
- return e;
317
- let g = e;
318
- for (let u = 0, f = e.length; u < f; ++u) {
319
- const p = e[u];
320
- if (n.has(p.i)) {
321
- const i = p.x + s, l = p.y + a;
322
- (p.x !== i || p.y !== l) && (g === e && (g = e.slice(0)), g[u] = Object.assign(Object.assign({}, p), { x: i, y: l }));
323
- }
324
- }
325
- return g === e ? e : this.repairLayout(g, t, n);
326
- }
327
- /**
328
- * Resizes the specified item (in grid units).
329
- * Returns a new layout if modified.
330
- */
331
- static resizeItems(e, t, n, s, a, g) {
332
- if (s === 0 && a === 0 || n.size === 0)
333
- return e;
334
- let u = e;
335
- for (let f = 0, p = e.length; f < p; ++f) {
336
- const i = e[f];
337
- if (n.has(i.i)) {
338
- const { maxW: l = t, maxH: o = 1 / 0 } = i;
339
- let { x: r, y: m, w: d, h } = i;
340
- const c = r + d, y = m + h, v = t - r;
341
- switch (g) {
342
- case "n":
343
- h = L(h - a, 1, o), m = L(m + a, 0, y - 1);
344
- break;
345
- case "e":
346
- d = L(d + s, 1, x(l, v));
347
- break;
348
- case "s":
349
- h = L(h + a, 1, o);
350
- break;
351
- case "w":
352
- d = L(d - s, 1, x(l, c)), r = L(r + s, 0, c - 1);
353
- break;
354
- case "ne":
355
- d = L(d + s, 1, x(l, v)), h = L(h - a, 1, o), m = L(m + a, 0, y - 1);
356
- break;
357
- case "se":
358
- d = L(d + s, 1, x(l, v)), h = L(h + a, 1, o);
359
- break;
360
- case "sw":
361
- d = L(d - s, 1, x(l, c)), h = L(h + a, 1, o), r = L(r + s, 0, c - 1);
362
- break;
363
- case "nw":
364
- d = L(d - s, 1, x(l, c)), h = L(h - a, 1, o), r = L(r + s, 0, c - 1), m = L(m + a, 0, y - 1);
365
- break;
366
- }
367
- (i.x !== r || i.y !== m || i.w !== d || i.h !== h) && (u === e && (u = e.slice(0)), u[f] = Object.assign(Object.assign({}, i), { x: r, y: m, w: d, h }));
99
+ function ce({ children: e }) {
100
+ return /* @__PURE__ */ r("div", { style: {
101
+ display: "flex",
102
+ justifyContent: "space-between",
103
+ alignItems: "center",
104
+ flexWrap: "wrap",
105
+ gap: "1rem"
106
+ }, children: e });
107
+ }
108
+ const L = "har-entries-viewer", {
109
+ useUserPreferences: z,
110
+ Provider: de
111
+ } = O(`${L}.isCompareMode`, !1), le = V(ee)[0], {
112
+ useUserPreferences: U,
113
+ Provider: me
114
+ } = O(`${L}.harEntryHeaders`, [le]), M = "Single", S = "Compare";
115
+ function ue() {
116
+ const [e, n] = z();
117
+ return /* @__PURE__ */ r(
118
+ ne,
119
+ {
120
+ options: [M, S].map((t) => ({ text: t, id: t })),
121
+ selectedId: e ? S : M,
122
+ onChange: ({ detail: t }) => {
123
+ const o = t.selectedId === S;
124
+ n(o);
368
125
  }
369
126
  }
370
- return u === e ? e : this.repairLayout(u, t, n);
371
- }
372
- /**
373
- * Fixes overlaps, gaps, and layout out of bounds.
374
- * Returns a new layout if there was anything to repair.
375
- */
376
- static repairLayout(e, t, n) {
377
- const s = e.slice(0).sort((i, l) => {
378
- if (i.y < l.y)
379
- return -1;
380
- if (i.y > l.y)
381
- return 1;
382
- if (n) {
383
- if (n.has(i.i)) {
384
- if (!n.has(l.i))
385
- return -1;
386
- } else if (n.has(l.i))
387
- return 1;
388
- }
389
- return i.x < l.x ? -1 : i.x > l.x ? 1 : 0;
390
- }), a = s.filter((i) => i.static), g = a.length;
391
- let u = !1, f = 0;
392
- const p = Array(t);
393
- for (let i = 0; i < t; ++i)
394
- p[i] = 0;
395
- for (let i = 0, l = s.length; i < l; i++) {
396
- let o = this.repairItem(s[i], t);
397
- const r = o.x + o.w;
398
- if (o.static)
399
- ++f;
400
- else {
401
- let d = 1 / 0;
402
- for (let c = o.x; c < r; ++c) {
403
- const y = o.y - p[c];
404
- y < d && (d = y);
405
- }
406
- let h = o.y - d;
407
- for (let c = f; c < g; ++c) {
408
- const y = a[c];
409
- if (y.y >= h + o.h)
410
- break;
411
- //staticItem.y < yNext + item.h && // This is implied above.
412
- y.y + y.h > h && y.x < o.x + o.w && y.x + y.w > o.x && (h = y.y + y.h, c = f);
413
- }
414
- o.y !== h && (o = Object.assign(Object.assign({}, o), { y: h })), o !== s[i] && (s[i] = o, u = !0);
127
+ );
128
+ }
129
+ function fe(e) {
130
+ const { harEntries: n } = e, t = $(() => {
131
+ const a = N(n);
132
+ return V(a).map((m) => ({
133
+ label: m,
134
+ value: m
135
+ }));
136
+ }, [n]), [o, d] = U(), f = t.filter(({ value: a }) => o.includes(a)), s = (a) => {
137
+ const m = a.map(({ value: p }) => p);
138
+ d(m);
139
+ };
140
+ return /* @__PURE__ */ r(
141
+ te,
142
+ {
143
+ inlineTokens: !0,
144
+ filteringType: "auto",
145
+ placeholder: "Pick HAR entry headers",
146
+ options: t,
147
+ selectedOptions: f,
148
+ onChange: ({ detail: a }) => {
149
+ s(a.selectedOptions);
415
150
  }
416
- const m = o.y + o.h;
417
- for (let d = o.x; d < r; ++d)
418
- p[d] < m && (p[d] = m);
419
151
  }
420
- return u ? s : e;
421
- }
422
- /**
423
- * Repair bounds of the given item to fit the given config.
424
- * Returns a new item if there was anything to repair.
425
- */
426
- static repairItem(e, t) {
427
- const { minW: n = 1, maxW: s = t, minH: a = 1, maxH: g = 1 / 0 } = e;
428
- let { x: u, y: f, w: p, h: i } = e;
429
- return p = L(p, n, x(s, t)), i = L(i, a, g), u = L(u, 0, t - p), f < 0 && (f = 0), e.x === u && e.y === f && e.w === p && e.h === i ? e : Object.assign(Object.assign({}, e), { x: u, y: f, w: p, h: i });
430
- }
152
+ );
431
153
  }
432
- D.RESIZE_THRESHOLD = 10;
433
- D.TAP_DELAY = 250;
434
- D.TAP_THRESHOLD = 10;
435
- D.DRAG_THRESHOLD = 7;
436
- function ee(E, e) {
437
- if (E === e)
438
- return !0;
439
- if (E.size !== e.size)
440
- return !1;
441
- for (const t of E)
442
- if (!e.has(t))
443
- return !1;
444
- return !0;
154
+ function pe(e) {
155
+ const { harEntries: n, additionalActions: t } = e;
156
+ return /* @__PURE__ */ T(ce, { children: [
157
+ /* @__PURE__ */ T(q, { children: [
158
+ /* @__PURE__ */ r(ue, {}),
159
+ /* @__PURE__ */ r(fe, { harEntries: n })
160
+ ] }),
161
+ t
162
+ ] });
445
163
  }
446
- function L(E, e, t) {
447
- return E < e ? e : E > t ? t : E;
164
+ function he({ children: e }) {
165
+ return /* @__PURE__ */ r(de, { children: /* @__PURE__ */ r(me, { children: /* @__PURE__ */ r(J, { children: e }) }) });
448
166
  }
449
- const T = Math.abs, x = Math.min, R = Math.round, W = { capture: !0 }, U = { passive: !0 };
450
- function te(E) {
451
- const {
452
- layout: e,
453
- onChange: t,
454
- totalColumns: n = 12,
455
- gap: s = 0,
456
- rowHeight: a = 120,
457
- children: g
458
- } = E, u = P(() => ({
459
- columns: n,
460
- gap: s,
461
- rowHeight: a
462
- }), [n, s, a]), f = O(null), p = O(null);
463
- return H(() => {
464
- if (!f.current)
465
- return;
466
- const i = new D(f.current, u);
467
- return i.setEditable(!0), i.setLayout(e), i.onLayoutChange(t), p.current = i, () => {
468
- i.disconnect();
469
- };
470
- }, []), H(() => {
471
- p.current?.setConfig(u);
472
- }, [u]), H(() => {
473
- const i = p.current;
474
- i?.onLayoutChange(() => {
475
- }), i?.setLayout(e), i?.onLayoutChange(t);
476
- }, [e, t]), /* @__PURE__ */ C("div", { ref: f, children: g });
477
- }
478
- const ie = 12;
479
- function ne(E) {
480
- const {
481
- layoutDefinitions: e,
482
- onRender: t,
483
- onChange: n,
484
- layoutItemStyle: s = {},
485
- totalColumns: a = ie,
486
- gap: g
487
- } = E, u = P(() => e.map((i) => {
488
- const { id: l, props: o } = i, r = t(l, o);
489
- return /* @__PURE__ */ C(
490
- "div",
491
- {
492
- "data-key": l,
493
- style: {
494
- overflow: "scroll",
495
- ...s
496
- },
497
- children: r
498
- },
499
- l
500
- );
501
- }), [e, s, t]), f = P(() => e.map((i) => {
502
- const {
503
- id: l,
504
- props: o,
505
- ...r
506
- } = i;
507
- return {
508
- i: l,
509
- ...r
510
- };
511
- }), [e]), p = G((i) => {
512
- const l = i.map((o) => {
513
- const {
514
- i: r,
515
- ...m
516
- } = o, d = e.find((h) => h.id === r);
517
- if (!d)
518
- throw new Error(`No existing cell definition found for layout item with id ${r}`);
519
- return {
520
- id: r,
521
- ...m,
522
- props: d.props
523
- };
524
- });
525
- n(l);
526
- }, [e, n]);
527
- return /* @__PURE__ */ C(
528
- te,
167
+ function Ee(e) {
168
+ const { harEntries: n, harEntry: t } = e, o = $(() => N(n), [n]), [d] = U(), f = d.flatMap((s) => {
169
+ if (!o[s])
170
+ return [];
171
+ const a = o[s](t);
172
+ return Array.isArray(a) ? a.map((m) => ({
173
+ label: m,
174
+ description: s
175
+ })) : [{
176
+ label: String(a),
177
+ description: s
178
+ }];
179
+ });
180
+ return /* @__PURE__ */ r(
181
+ re,
529
182
  {
530
- totalColumns: a,
531
- gap: g,
532
- layout: f,
533
- onChange: p,
534
- children: u
183
+ items: f,
184
+ disableOuterPadding: !0
535
185
  }
536
186
  );
537
187
  }
538
- const F = "list-har-entries", I = 12, se = [
188
+ const C = {
189
+ rowSpan: 4,
190
+ columnSpan: 12
191
+ }, g = "har-entries-viewer", w = "view-har-entry", Ae = [
539
192
  {
540
- x: 0,
541
- y: 0,
542
- w: 12,
543
- h: 4,
544
- id: "0",
545
- props: {
546
- instanceId: F
193
+ ...C,
194
+ data: {
195
+ componentType: g,
196
+ instanceId: g
547
197
  }
548
198
  }
549
199
  ];
550
- function fe(E) {
200
+ function Ie(e) {
551
201
  const {
552
- harEntries: e,
202
+ harEntries: n,
553
203
  tableTitle: t
554
- } = E, [n, s] = z([]), [a, g] = z(se), [u, f] = z($);
555
- H(() => {
556
- const i = new Set(e.map(S));
557
- s((l) => {
558
- if (!l.length)
559
- return l;
560
- const o = l.filter(
561
- (r) => i.has(S(r))
204
+ } = e, [o, d] = H([]), [f, s] = H(Ae), [a, m] = H(), [p] = z();
205
+ v(() => {
206
+ !p && o.length > 1 && d([]);
207
+ }, [p, o.length]), v(() => {
208
+ const c = new Set(n.map(A));
209
+ d((i) => {
210
+ if (!i.length)
211
+ return i;
212
+ const u = i.filter(
213
+ (I) => c.has(A(I))
562
214
  );
563
- return o.length === l.length ? l : o;
215
+ return u.length !== i.length ? u : i;
564
216
  });
565
- }, [e]), H(() => {
566
- const i = n.map(S), l = new Set(i);
567
- g((o) => {
568
- let r = o.filter(({ props: { instanceId: w } }) => l.has(w) || w === F);
569
- const m = new Set(r.map(({ props: { instanceId: w } }) => w)), d = i.filter((w) => !m.has(w));
570
- if (!d.length)
571
- return r;
572
- let h = {
573
- x: 0,
574
- y: 0,
575
- w: 6,
576
- h: 4
577
- };
578
- const c = o.at(-1), y = r.at(-1);
579
- if (c && (h = {
580
- x: c.x,
581
- y: c.y,
582
- w: c.w,
583
- h: c.h
584
- }), y && c?.props.instanceId === y.props.instanceId && (h.x = h.x + h.w), o.length === 1 && r.length === 1) {
585
- const w = r[0];
586
- let b = w.x + w.w, _ = I - b;
587
- _ < 1 && (_ = I / 2, b = _, r = [
588
- {
589
- ...w,
590
- x: 0,
591
- y: 0,
592
- w: _
593
- }
594
- ]), h = {
595
- x: b,
596
- y: 0,
597
- w: _,
598
- h: w.h
599
- };
600
- }
601
- const v = d.map((w) => {
602
- h.x >= I && (h.x = 0, h.y += h.h);
603
- const b = {
604
- w: h.w,
605
- h: h.h,
606
- x: h.x,
607
- y: h.y,
608
- props: {
609
- instanceId: w
610
- }
611
- };
612
- return h.x = h.x + h.w, b;
613
- }), k = [...r, ...v].map((w, b) => ({
614
- ...w,
615
- id: String(b)
217
+ }, [n]), v(() => {
218
+ const c = o.map(A), i = /* @__PURE__ */ new Set([...c, g]);
219
+ s((u) => {
220
+ const I = u.map(({ data: { instanceId: l } }) => l), P = new Set(I.filter((l) => i.has(l))), R = c.filter((l) => !P.has(l));
221
+ if (!R.length && I.length === P.size)
222
+ return u;
223
+ const D = u.map((l) => {
224
+ const { data: { instanceId: x } } = l;
225
+ if (i.has(x))
226
+ return l;
227
+ const _ = R.shift();
228
+ if (_)
229
+ return {
230
+ ...l,
231
+ data: {
232
+ componentType: w,
233
+ instanceId: _
234
+ }
235
+ };
236
+ }), b = D.at(-1), B = b?.rowSpan ?? C.rowSpan, k = b?.columnSpan ?? C.columnSpan, F = R.map((l) => ({
237
+ rowSpan: B,
238
+ columnSpan: k,
239
+ data: {
240
+ componentType: w,
241
+ instanceId: l
242
+ }
616
243
  }));
617
- return console.warn({ layoutDefinitions: k }), k;
244
+ return ae([...D, ...F]);
618
245
  });
619
- }, [n]);
620
- const p = G((i, { instanceId: l }) => {
621
- if (l === F)
622
- return /* @__PURE__ */ C(Q, { children: /* @__PURE__ */ C(
246
+ }, [o]);
247
+ const E = (c) => {
248
+ d(
249
+ (i) => i.filter((u) => A(u) !== c)
250
+ );
251
+ }, h = {
252
+ [g]: {
253
+ header: /* @__PURE__ */ r(
623
254
  X,
624
255
  {
625
- title: t,
626
- harEntries: e,
627
- selectedHAREntries: n,
628
- onSelectionChange: s
256
+ harEntries: n,
257
+ title: t
629
258
  }
630
- ) });
631
- const o = n.find((r) => S(r) === l);
632
- if (o)
633
- return /* @__PURE__ */ q(j, { children: [
634
- /* @__PURE__ */ C(
635
- J,
259
+ ),
260
+ content: /* @__PURE__ */ r(W, { children: /* @__PURE__ */ r(
261
+ Q,
262
+ {
263
+ harEntries: n,
264
+ selectedHAREntries: o,
265
+ onSelectionChange: d,
266
+ enableMultiSelect: p
267
+ }
268
+ ) })
269
+ },
270
+ [w]: (c) => {
271
+ const i = o.find((u) => A(u) === c);
272
+ return {
273
+ header: i ? /* @__PURE__ */ r(
274
+ Ee,
636
275
  {
637
- onClose: () => {
638
- s((r) => r.filter((m) => S(m) !== l));
639
- }
276
+ harEntries: n,
277
+ harEntry: i
640
278
  }
641
- ),
642
- /* @__PURE__ */ C(
279
+ ) : void 0,
280
+ content: i ? /* @__PURE__ */ r(
643
281
  Z,
644
282
  {
645
- harEntry: o,
646
- initialSelectedTabId: u,
647
- onSelectedTabIdChange: n.length === 1 ? f : void 0
283
+ harEntry: i,
284
+ initialSelectedTabId: a,
285
+ onSelectedTabIdChange: m
648
286
  }
649
- )
650
- ] });
651
- }, [n, t, e, u]);
652
- return /* @__PURE__ */ C(
653
- ne,
287
+ ) : void 0,
288
+ onRemove: () => {
289
+ E(c);
290
+ }
291
+ };
292
+ }
293
+ };
294
+ return /* @__PURE__ */ r(
295
+ se,
654
296
  {
655
- totalColumns: I,
656
- gap: 16,
657
- layoutItemStyle: {
658
- borderRadius: Y,
659
- borderWidth: K,
660
- borderColor: B,
661
- borderStyle: "solid"
662
- },
663
- layoutDefinitions: a,
664
- onRender: p,
665
- onChange: g
297
+ components: h,
298
+ definitions: f,
299
+ onDefinitionsChange: s
666
300
  }
667
301
  );
668
302
  }
303
+ function Le(e) {
304
+ const { harEntries: n, ...t } = e;
305
+ return /* @__PURE__ */ r(he, { children: /* @__PURE__ */ T(K, { children: [
306
+ /* @__PURE__ */ r(pe, { harEntries: n }),
307
+ /* @__PURE__ */ r(Ie, { harEntries: n, ...t })
308
+ ] }) });
309
+ }
669
310
  export {
670
- fe as default
311
+ Le as default
671
312
  };