@industry-theme/xterm-terminal-panel 0.5.5 → 0.5.7
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.
- package/dist/index.css +1650 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2905 -305
- package/dist/src/components/TabBar/TabBar.d.ts.map +1 -1
- package/dist/src/components/TabBar/TabButton.d.ts.map +1 -1
- package/dist/src/panel-types/index.d.ts +17 -0
- package/dist/src/panel-types/index.d.ts.map +1 -1
- package/dist/src/panels/TabbedTerminalPanel.d.ts +1 -0
- package/dist/src/panels/TabbedTerminalPanel.d.ts.map +1 -1
- package/dist/src/types/tab.d.ts +12 -0
- package/dist/src/types/tab.d.ts.map +1 -1
- package/package.json +7 -4
package/dist/index.js
CHANGED
|
@@ -1159,10 +1159,11 @@ function useThemedTerminal() {
|
|
|
1159
1159
|
// src/components/TabBar/TabBar.tsx
|
|
1160
1160
|
import { useTheme as useTheme4 } from "@principal-ade/industry-theme";
|
|
1161
1161
|
import { Plus } from "lucide-react";
|
|
1162
|
-
import { useState as useState2 } from "react";
|
|
1162
|
+
import { useState as useState2, useCallback as useCallback3 } from "react";
|
|
1163
1163
|
|
|
1164
1164
|
// src/components/TabBar/TabButton.tsx
|
|
1165
1165
|
import { useTheme as useTheme3 } from "@principal-ade/industry-theme";
|
|
1166
|
+
import { useCallback as useCallback2 } from "react";
|
|
1166
1167
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1167
1168
|
var TabButton = ({
|
|
1168
1169
|
tab,
|
|
@@ -1175,12 +1176,68 @@ var TabButton = ({
|
|
|
1175
1176
|
keyboardHint,
|
|
1176
1177
|
renderAccessory,
|
|
1177
1178
|
renderIcon,
|
|
1178
|
-
renderLabel
|
|
1179
|
+
renderLabel,
|
|
1180
|
+
draggable = false,
|
|
1181
|
+
onDragStart,
|
|
1182
|
+
onDragEnd,
|
|
1183
|
+
onDrop,
|
|
1184
|
+
canAcceptDrop = false,
|
|
1185
|
+
isDragOver = false,
|
|
1186
|
+
onDragEnter,
|
|
1187
|
+
onDragLeave,
|
|
1188
|
+
isBeingDragged: _isBeingDragged = false
|
|
1179
1189
|
}) => {
|
|
1180
1190
|
const { theme } = useTheme3();
|
|
1181
1191
|
const showCloseButton = isHovered || isActive;
|
|
1182
1192
|
const closable = tab.closable !== false;
|
|
1193
|
+
const handleDragStart = useCallback2((e) => {
|
|
1194
|
+
e.dataTransfer.setData("application/x-tab-association", tab.id);
|
|
1195
|
+
e.dataTransfer.effectAllowed = "move";
|
|
1196
|
+
onDragStart?.(tab.id);
|
|
1197
|
+
}, [tab.id, onDragStart]);
|
|
1198
|
+
const handleDragEnd = useCallback2(() => {
|
|
1199
|
+
onDragEnd?.();
|
|
1200
|
+
}, [onDragEnd]);
|
|
1201
|
+
const handleDragOver = useCallback2((e) => {
|
|
1202
|
+
if (canAcceptDrop) {
|
|
1203
|
+
e.preventDefault();
|
|
1204
|
+
e.dataTransfer.dropEffect = "move";
|
|
1205
|
+
}
|
|
1206
|
+
}, [canAcceptDrop]);
|
|
1207
|
+
const handleDrop = useCallback2((e) => {
|
|
1208
|
+
e.preventDefault();
|
|
1209
|
+
const draggedTabId = e.dataTransfer.getData("text/plain");
|
|
1210
|
+
if (draggedTabId && draggedTabId !== tab.id) {
|
|
1211
|
+
onDrop?.(draggedTabId);
|
|
1212
|
+
}
|
|
1213
|
+
}, [tab.id, onDrop]);
|
|
1214
|
+
const handleDragEnter = useCallback2((e) => {
|
|
1215
|
+
e.preventDefault();
|
|
1216
|
+
onDragEnter?.();
|
|
1217
|
+
}, [onDragEnter]);
|
|
1218
|
+
const handleDragLeave = useCallback2((e) => {
|
|
1219
|
+
e.preventDefault();
|
|
1220
|
+
onDragLeave?.();
|
|
1221
|
+
}, [onDragLeave]);
|
|
1222
|
+
const getDragOverStyles = () => {
|
|
1223
|
+
if (isDragOver && canAcceptDrop) {
|
|
1224
|
+
return {
|
|
1225
|
+
outline: `2px solid ${theme.colors.primary}`,
|
|
1226
|
+
outlineOffset: "-2px",
|
|
1227
|
+
backgroundColor: theme.colors.backgroundTertiary
|
|
1228
|
+
};
|
|
1229
|
+
}
|
|
1230
|
+
return {};
|
|
1231
|
+
};
|
|
1183
1232
|
return /* @__PURE__ */ jsxs3("div", {
|
|
1233
|
+
"data-tab-id": tab.id,
|
|
1234
|
+
draggable,
|
|
1235
|
+
onDragStart: draggable ? handleDragStart : undefined,
|
|
1236
|
+
onDragEnd: draggable ? handleDragEnd : undefined,
|
|
1237
|
+
onDragOver: handleDragOver,
|
|
1238
|
+
onDrop: handleDrop,
|
|
1239
|
+
onDragEnter: handleDragEnter,
|
|
1240
|
+
onDragLeave: handleDragLeave,
|
|
1184
1241
|
onMouseEnter,
|
|
1185
1242
|
onMouseLeave,
|
|
1186
1243
|
onClick,
|
|
@@ -1191,7 +1248,7 @@ var TabButton = ({
|
|
|
1191
1248
|
gap: "6px",
|
|
1192
1249
|
padding: "6px 8px",
|
|
1193
1250
|
backgroundColor: isActive ? theme.colors.background : theme.colors.backgroundSecondary,
|
|
1194
|
-
cursor: "pointer",
|
|
1251
|
+
cursor: draggable ? "grab" : "pointer",
|
|
1195
1252
|
fontSize: theme.fontSizes[1],
|
|
1196
1253
|
fontWeight: isActive ? theme.fontWeights.semibold : theme.fontWeights.body,
|
|
1197
1254
|
fontFamily: theme.fonts.body,
|
|
@@ -1202,7 +1259,8 @@ var TabButton = ({
|
|
|
1202
1259
|
minWidth: 0,
|
|
1203
1260
|
height: "100%",
|
|
1204
1261
|
position: "relative",
|
|
1205
|
-
boxSizing: "border-box"
|
|
1262
|
+
boxSizing: "border-box",
|
|
1263
|
+
...getDragOverStyles()
|
|
1206
1264
|
},
|
|
1207
1265
|
children: [
|
|
1208
1266
|
closable && showCloseButton && /* @__PURE__ */ jsx4("button", {
|
|
@@ -1283,10 +1341,35 @@ var TabBar = ({
|
|
|
1283
1341
|
renderTabIcon,
|
|
1284
1342
|
renderTabLabel,
|
|
1285
1343
|
className,
|
|
1286
|
-
showKeyboardHints = true
|
|
1344
|
+
showKeyboardHints = true,
|
|
1345
|
+
onTabDrop,
|
|
1346
|
+
canDropOnTab,
|
|
1347
|
+
enableDragAndDrop = false
|
|
1287
1348
|
}) => {
|
|
1288
1349
|
const { theme } = useTheme4();
|
|
1289
1350
|
const [hoveredTabId, setHoveredTabId] = useState2(null);
|
|
1351
|
+
const [draggedTabId, setDraggedTabId] = useState2(null);
|
|
1352
|
+
const [dragOverTabId, setDragOverTabId] = useState2(null);
|
|
1353
|
+
const handleDragStart = useCallback3((tabId) => {
|
|
1354
|
+
setDraggedTabId(tabId);
|
|
1355
|
+
}, []);
|
|
1356
|
+
const handleDragEnd = useCallback3(() => {
|
|
1357
|
+
setDraggedTabId(null);
|
|
1358
|
+
setDragOverTabId(null);
|
|
1359
|
+
}, []);
|
|
1360
|
+
const handleDrop = useCallback3((targetTabId, draggedId) => {
|
|
1361
|
+
if (draggedId !== targetTabId) {
|
|
1362
|
+
onTabDrop?.(draggedId, targetTabId);
|
|
1363
|
+
}
|
|
1364
|
+
setDraggedTabId(null);
|
|
1365
|
+
setDragOverTabId(null);
|
|
1366
|
+
}, [onTabDrop]);
|
|
1367
|
+
const handleDragEnter = useCallback3((tabId) => {
|
|
1368
|
+
setDragOverTabId(tabId);
|
|
1369
|
+
}, []);
|
|
1370
|
+
const handleDragLeave = useCallback3(() => {
|
|
1371
|
+
setDragOverTabId(null);
|
|
1372
|
+
}, []);
|
|
1290
1373
|
return /* @__PURE__ */ jsxs4("div", {
|
|
1291
1374
|
className,
|
|
1292
1375
|
style: {
|
|
@@ -1320,19 +1403,31 @@ var TabBar = ({
|
|
|
1320
1403
|
borderBottom: `1px solid ${theme.colors.border}`,
|
|
1321
1404
|
boxSizing: "border-box"
|
|
1322
1405
|
},
|
|
1323
|
-
children: tabs.map((tab, index) =>
|
|
1324
|
-
tab,
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1406
|
+
children: tabs.map((tab, index) => {
|
|
1407
|
+
const canDrop = enableDragAndDrop && draggedTabId !== null && draggedTabId !== tab.id ? canDropOnTab ? canDropOnTab(draggedTabId, tab.id) : true : false;
|
|
1408
|
+
return /* @__PURE__ */ jsx5(TabButton, {
|
|
1409
|
+
tab,
|
|
1410
|
+
isActive: tab.id === activeTabId,
|
|
1411
|
+
isHovered: tab.id === hoveredTabId,
|
|
1412
|
+
onMouseEnter: () => setHoveredTabId(tab.id),
|
|
1413
|
+
onMouseLeave: () => setHoveredTabId(null),
|
|
1414
|
+
onClick: () => onTabClick(tab.id),
|
|
1415
|
+
onClose: () => onTabClose(tab.id),
|
|
1416
|
+
keyboardHint: showKeyboardHints && index < 9 ? `⌘ ${index + 1}` : undefined,
|
|
1417
|
+
renderAccessory: renderTabAccessory,
|
|
1418
|
+
renderIcon: renderTabIcon,
|
|
1419
|
+
renderLabel: renderTabLabel,
|
|
1420
|
+
draggable: enableDragAndDrop,
|
|
1421
|
+
onDragStart: handleDragStart,
|
|
1422
|
+
onDragEnd: handleDragEnd,
|
|
1423
|
+
onDrop: (draggedId) => handleDrop(tab.id, draggedId),
|
|
1424
|
+
canAcceptDrop: canDrop,
|
|
1425
|
+
isDragOver: dragOverTabId === tab.id,
|
|
1426
|
+
isBeingDragged: draggedTabId === tab.id,
|
|
1427
|
+
onDragEnter: () => handleDragEnter(tab.id),
|
|
1428
|
+
onDragLeave: handleDragLeave
|
|
1429
|
+
}, tab.id);
|
|
1430
|
+
})
|
|
1336
1431
|
}),
|
|
1337
1432
|
rightSection !== undefined ? rightSection && /* @__PURE__ */ jsx5("div", {
|
|
1338
1433
|
style: {
|
|
@@ -1431,7 +1526,7 @@ var useTabKeyboardShortcuts = ({
|
|
|
1431
1526
|
// src/panels/TerminalPanel.tsx
|
|
1432
1527
|
import { useTheme as useTheme5 } from "@principal-ade/industry-theme";
|
|
1433
1528
|
import { Lock, Unlock, ArrowDown } from "lucide-react";
|
|
1434
|
-
import { useCallback as
|
|
1529
|
+
import { useCallback as useCallback4, useEffect as useEffect3, useRef as useRef2, useState as useState3 } from "react";
|
|
1435
1530
|
|
|
1436
1531
|
// src/panel-types/index.ts
|
|
1437
1532
|
function getTerminalSessions(context2) {
|
|
@@ -1595,197 +1690,2573 @@ var TerminalPanel = ({
|
|
|
1595
1690
|
if (autoScrollTimeout) {
|
|
1596
1691
|
clearTimeout(autoScrollTimeout);
|
|
1597
1692
|
}
|
|
1598
|
-
};
|
|
1599
|
-
}, [usingMessagePort]);
|
|
1600
|
-
const handleTerminalData =
|
|
1601
|
-
if (sessionId && actions.writeToTerminal) {
|
|
1602
|
-
actions.writeToTerminal(sessionId, data);
|
|
1693
|
+
};
|
|
1694
|
+
}, [usingMessagePort]);
|
|
1695
|
+
const handleTerminalData = useCallback4((data) => {
|
|
1696
|
+
if (sessionId && actions.writeToTerminal) {
|
|
1697
|
+
actions.writeToTerminal(sessionId, data);
|
|
1698
|
+
}
|
|
1699
|
+
}, [sessionId, actions.writeToTerminal]);
|
|
1700
|
+
const hasNotifiedPtyRef = useRef2(false);
|
|
1701
|
+
const handleTerminalResize = useCallback4((cols, rows) => {
|
|
1702
|
+
if (sessionId && actions.resizeTerminal) {
|
|
1703
|
+
const isInitialNotification = !hasNotifiedPtyRef.current;
|
|
1704
|
+
actions.resizeTerminal(sessionId, cols, rows);
|
|
1705
|
+
if (isInitialNotification && actions.writeToTerminal) {
|
|
1706
|
+
setTimeout(() => {
|
|
1707
|
+
actions.writeToTerminal(sessionId, "\f");
|
|
1708
|
+
}, 50);
|
|
1709
|
+
}
|
|
1710
|
+
hasNotifiedPtyRef.current = true;
|
|
1711
|
+
}
|
|
1712
|
+
}, [sessionId, actions.resizeTerminal, actions.writeToTerminal]);
|
|
1713
|
+
useEffect3(() => {
|
|
1714
|
+
hasNotifiedPtyRef.current = false;
|
|
1715
|
+
}, [sessionId]);
|
|
1716
|
+
const handleScrollPositionChange = useCallback4((position) => {
|
|
1717
|
+
setScrollPosition(position);
|
|
1718
|
+
isScrollLockedRef.current = position.isScrollLocked;
|
|
1719
|
+
}, []);
|
|
1720
|
+
const sessionInfo = sessionId ? getTerminalSession(context2, sessionId) : undefined;
|
|
1721
|
+
if (error) {
|
|
1722
|
+
return /* @__PURE__ */ jsxs5("div", {
|
|
1723
|
+
style: {
|
|
1724
|
+
padding: "20px",
|
|
1725
|
+
color: "#ef4444",
|
|
1726
|
+
backgroundColor: "#1a1a1a",
|
|
1727
|
+
height: "100%",
|
|
1728
|
+
display: "flex",
|
|
1729
|
+
alignItems: "center",
|
|
1730
|
+
justifyContent: "center",
|
|
1731
|
+
flexDirection: "column",
|
|
1732
|
+
gap: "10px"
|
|
1733
|
+
},
|
|
1734
|
+
children: [
|
|
1735
|
+
/* @__PURE__ */ jsx6("div", {
|
|
1736
|
+
style: { fontSize: "16px", fontWeight: "bold" },
|
|
1737
|
+
children: "Terminal Error"
|
|
1738
|
+
}),
|
|
1739
|
+
/* @__PURE__ */ jsx6("div", {
|
|
1740
|
+
style: { fontSize: "14px", opacity: 0.8 },
|
|
1741
|
+
children: error
|
|
1742
|
+
})
|
|
1743
|
+
]
|
|
1744
|
+
});
|
|
1745
|
+
}
|
|
1746
|
+
if (isInitializing || !sessionId) {
|
|
1747
|
+
return /* @__PURE__ */ jsx6("div", {
|
|
1748
|
+
style: {
|
|
1749
|
+
padding: "20px",
|
|
1750
|
+
color: "#a0a0a0",
|
|
1751
|
+
backgroundColor: "#1a1a1a",
|
|
1752
|
+
height: "100%",
|
|
1753
|
+
display: "flex",
|
|
1754
|
+
alignItems: "center",
|
|
1755
|
+
justifyContent: "center"
|
|
1756
|
+
},
|
|
1757
|
+
children: "Initializing terminal..."
|
|
1758
|
+
});
|
|
1759
|
+
}
|
|
1760
|
+
const handleScrollToBottom = () => {
|
|
1761
|
+
terminalRef.current?.scrollToBottom();
|
|
1762
|
+
};
|
|
1763
|
+
const handleToggleScrollLock = () => {
|
|
1764
|
+
if (scrollPosition.isScrollLocked) {
|
|
1765
|
+
const terminal = terminalRef.current?.getTerminal();
|
|
1766
|
+
if (terminal) {
|
|
1767
|
+
terminal.scrollLines(-1);
|
|
1768
|
+
}
|
|
1769
|
+
} else {
|
|
1770
|
+
terminalRef.current?.scrollToBottom();
|
|
1771
|
+
}
|
|
1772
|
+
};
|
|
1773
|
+
return /* @__PURE__ */ jsxs5("div", {
|
|
1774
|
+
style: { height: "100%", width: "100%", display: "flex", flexDirection: "column" },
|
|
1775
|
+
children: [
|
|
1776
|
+
/* @__PURE__ */ jsxs5("div", {
|
|
1777
|
+
style: {
|
|
1778
|
+
display: "flex",
|
|
1779
|
+
gap: "8px",
|
|
1780
|
+
padding: "8px 12px",
|
|
1781
|
+
backgroundColor: theme.colors.backgroundSecondary,
|
|
1782
|
+
borderBottom: `1px solid ${theme.colors.border}`,
|
|
1783
|
+
alignItems: "center"
|
|
1784
|
+
},
|
|
1785
|
+
children: [
|
|
1786
|
+
/* @__PURE__ */ jsxs5("span", {
|
|
1787
|
+
style: {
|
|
1788
|
+
fontSize: "12px",
|
|
1789
|
+
color: theme.colors.textSecondary,
|
|
1790
|
+
marginRight: "auto",
|
|
1791
|
+
fontFamily: theme.fonts.monospace
|
|
1792
|
+
},
|
|
1793
|
+
children: [
|
|
1794
|
+
sessionInfo?.cwd || "Terminal",
|
|
1795
|
+
" • ",
|
|
1796
|
+
sessionInfo?.shell
|
|
1797
|
+
]
|
|
1798
|
+
}),
|
|
1799
|
+
/* @__PURE__ */ jsxs5("button", {
|
|
1800
|
+
onClick: handleToggleScrollLock,
|
|
1801
|
+
style: {
|
|
1802
|
+
display: "flex",
|
|
1803
|
+
alignItems: "center",
|
|
1804
|
+
gap: "4px",
|
|
1805
|
+
fontSize: "11px",
|
|
1806
|
+
padding: "4px 8px",
|
|
1807
|
+
borderRadius: "4px",
|
|
1808
|
+
backgroundColor: scrollPosition.isScrollLocked ? `${theme.colors.success}22` : `${theme.colors.warning}22`,
|
|
1809
|
+
color: scrollPosition.isScrollLocked ? theme.colors.success : theme.colors.warning,
|
|
1810
|
+
border: `1px solid ${scrollPosition.isScrollLocked ? `${theme.colors.success}44` : `${theme.colors.warning}44`}`,
|
|
1811
|
+
cursor: "pointer",
|
|
1812
|
+
transition: "opacity 0.2s"
|
|
1813
|
+
},
|
|
1814
|
+
onMouseEnter: (e) => e.currentTarget.style.opacity = "0.8",
|
|
1815
|
+
onMouseLeave: (e) => e.currentTarget.style.opacity = "1",
|
|
1816
|
+
title: scrollPosition.isScrollLocked ? "Click to unlock scroll" : "Click to lock scroll to bottom",
|
|
1817
|
+
children: [
|
|
1818
|
+
scrollPosition.isScrollLocked ? /* @__PURE__ */ jsx6(Lock, {
|
|
1819
|
+
size: 12
|
|
1820
|
+
}) : /* @__PURE__ */ jsx6(Unlock, {
|
|
1821
|
+
size: 12
|
|
1822
|
+
}),
|
|
1823
|
+
/* @__PURE__ */ jsx6("span", {
|
|
1824
|
+
children: scrollPosition.isScrollLocked ? "Locked" : "Unlocked"
|
|
1825
|
+
})
|
|
1826
|
+
]
|
|
1827
|
+
}),
|
|
1828
|
+
/* @__PURE__ */ jsxs5("button", {
|
|
1829
|
+
onClick: handleScrollToBottom,
|
|
1830
|
+
disabled: scrollPosition.isAtBottom,
|
|
1831
|
+
style: {
|
|
1832
|
+
display: "flex",
|
|
1833
|
+
alignItems: "center",
|
|
1834
|
+
gap: "4px",
|
|
1835
|
+
fontSize: "11px",
|
|
1836
|
+
padding: "4px 10px",
|
|
1837
|
+
borderRadius: "4px",
|
|
1838
|
+
backgroundColor: scrollPosition.isAtBottom ? theme.colors.backgroundHover : theme.colors.accent,
|
|
1839
|
+
color: scrollPosition.isAtBottom ? theme.colors.textTertiary : theme.colors.text,
|
|
1840
|
+
border: `1px solid ${theme.colors.border}`,
|
|
1841
|
+
cursor: scrollPosition.isAtBottom ? "not-allowed" : "pointer",
|
|
1842
|
+
transition: "opacity 0.2s",
|
|
1843
|
+
opacity: scrollPosition.isAtBottom ? 0.5 : 1
|
|
1844
|
+
},
|
|
1845
|
+
onMouseEnter: (e) => !scrollPosition.isAtBottom && (e.currentTarget.style.opacity = "0.8"),
|
|
1846
|
+
onMouseLeave: (e) => !scrollPosition.isAtBottom && (e.currentTarget.style.opacity = "1"),
|
|
1847
|
+
title: "Scroll to bottom and lock",
|
|
1848
|
+
children: [
|
|
1849
|
+
/* @__PURE__ */ jsx6(ArrowDown, {
|
|
1850
|
+
size: 12
|
|
1851
|
+
}),
|
|
1852
|
+
/* @__PURE__ */ jsx6("span", {
|
|
1853
|
+
children: "Bottom"
|
|
1854
|
+
})
|
|
1855
|
+
]
|
|
1856
|
+
})
|
|
1857
|
+
]
|
|
1858
|
+
}),
|
|
1859
|
+
/* @__PURE__ */ jsx6("div", {
|
|
1860
|
+
style: { flex: 1 },
|
|
1861
|
+
children: /* @__PURE__ */ jsx6(ThemedTerminalWithProvider, {
|
|
1862
|
+
ref: terminalRef,
|
|
1863
|
+
onData: handleTerminalData,
|
|
1864
|
+
onResize: handleTerminalResize,
|
|
1865
|
+
onScrollPositionChange: handleScrollPositionChange,
|
|
1866
|
+
hideHeader: true,
|
|
1867
|
+
autoFocus: true,
|
|
1868
|
+
convertEol: true,
|
|
1869
|
+
cursorBlink: true,
|
|
1870
|
+
scrollback: 1e4,
|
|
1871
|
+
enableSearch: true,
|
|
1872
|
+
enableWebLinks: true
|
|
1873
|
+
})
|
|
1874
|
+
})
|
|
1875
|
+
]
|
|
1876
|
+
});
|
|
1877
|
+
};
|
|
1878
|
+
// src/panels/TabbedTerminalPanel.tsx
|
|
1879
|
+
import { useTheme as useTheme6 } from "@principal-ade/industry-theme";
|
|
1880
|
+
|
|
1881
|
+
// node_modules/@principal-ade/panels/dist/index.esm.js
|
|
1882
|
+
import { jsx as e, jsxs as t, Fragment as n } from "react/jsx-runtime";
|
|
1883
|
+
import r, { useState as o, useRef as i, useCallback as a, useEffect as l, createContext as s, useContext as c, forwardRef as d, useImperativeHandle as u, useMemo as p, useLayoutEffect as h, memo as m, useReducer as f } from "react";
|
|
1884
|
+
|
|
1885
|
+
// node_modules/react-resizable-panels/dist/react-resizable-panels.js
|
|
1886
|
+
import { jsx as ie } from "react/jsx-runtime";
|
|
1887
|
+
import { useState as re, useCallback as ne, useId as pt, useLayoutEffect as Be, useEffect as de, useRef as T, createContext as ht, useImperativeHandle as We, useMemo as Ue, useSyncExternalStore as Ke, useContext as mt } from "react";
|
|
1888
|
+
"use client";
|
|
1889
|
+
function gt(e, t) {
|
|
1890
|
+
const n = getComputedStyle(e), o = parseFloat(n.fontSize);
|
|
1891
|
+
return t * o;
|
|
1892
|
+
}
|
|
1893
|
+
function St(e, t) {
|
|
1894
|
+
const n = getComputedStyle(e.ownerDocument.body), o = parseFloat(n.fontSize);
|
|
1895
|
+
return t * o;
|
|
1896
|
+
}
|
|
1897
|
+
function yt(e) {
|
|
1898
|
+
return e / 100 * window.innerHeight;
|
|
1899
|
+
}
|
|
1900
|
+
function vt(e) {
|
|
1901
|
+
return e / 100 * window.innerWidth;
|
|
1902
|
+
}
|
|
1903
|
+
function zt(e) {
|
|
1904
|
+
switch (typeof e) {
|
|
1905
|
+
case "number":
|
|
1906
|
+
return [e, "px"];
|
|
1907
|
+
case "string": {
|
|
1908
|
+
const t = parseFloat(e);
|
|
1909
|
+
return e.endsWith("%") ? [t, "%"] : e.endsWith("px") ? [t, "px"] : e.endsWith("rem") ? [t, "rem"] : e.endsWith("em") ? [t, "em"] : e.endsWith("vh") ? [t, "vh"] : e.endsWith("vw") ? [t, "vw"] : [t, "%"];
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
function te({
|
|
1914
|
+
groupSize: e,
|
|
1915
|
+
panelElement: t,
|
|
1916
|
+
styleProp: n
|
|
1917
|
+
}) {
|
|
1918
|
+
let o;
|
|
1919
|
+
const [i, s] = zt(n);
|
|
1920
|
+
switch (s) {
|
|
1921
|
+
case "%": {
|
|
1922
|
+
o = i / 100 * e;
|
|
1923
|
+
break;
|
|
1924
|
+
}
|
|
1925
|
+
case "px": {
|
|
1926
|
+
o = i;
|
|
1927
|
+
break;
|
|
1928
|
+
}
|
|
1929
|
+
case "rem": {
|
|
1930
|
+
o = St(t, i);
|
|
1931
|
+
break;
|
|
1932
|
+
}
|
|
1933
|
+
case "em": {
|
|
1934
|
+
o = gt(t, i);
|
|
1935
|
+
break;
|
|
1936
|
+
}
|
|
1937
|
+
case "vh": {
|
|
1938
|
+
o = yt(i);
|
|
1939
|
+
break;
|
|
1940
|
+
}
|
|
1941
|
+
case "vw": {
|
|
1942
|
+
o = vt(i);
|
|
1943
|
+
break;
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
return o;
|
|
1947
|
+
}
|
|
1948
|
+
function D(e) {
|
|
1949
|
+
return parseFloat(e.toFixed(3));
|
|
1950
|
+
}
|
|
1951
|
+
function Q({
|
|
1952
|
+
group: e
|
|
1953
|
+
}) {
|
|
1954
|
+
const { orientation: t, panels: n } = e;
|
|
1955
|
+
return n.reduce((o, i) => (o += t === "horizontal" ? i.element.offsetWidth : i.element.offsetHeight, o), 0);
|
|
1956
|
+
}
|
|
1957
|
+
function ge(e) {
|
|
1958
|
+
const { panels: t } = e, n = Q({ group: e });
|
|
1959
|
+
return n === 0 ? t.map((o) => ({
|
|
1960
|
+
groupResizeBehavior: o.panelConstraints.groupResizeBehavior,
|
|
1961
|
+
collapsedSize: 0,
|
|
1962
|
+
collapsible: o.panelConstraints.collapsible === true,
|
|
1963
|
+
defaultSize: undefined,
|
|
1964
|
+
disabled: o.panelConstraints.disabled,
|
|
1965
|
+
minSize: 0,
|
|
1966
|
+
maxSize: 100,
|
|
1967
|
+
panelId: o.id
|
|
1968
|
+
})) : t.map((o) => {
|
|
1969
|
+
const { element: i, panelConstraints: s } = o;
|
|
1970
|
+
let l = 0;
|
|
1971
|
+
if (s.collapsedSize !== undefined) {
|
|
1972
|
+
const c = te({
|
|
1973
|
+
groupSize: n,
|
|
1974
|
+
panelElement: i,
|
|
1975
|
+
styleProp: s.collapsedSize
|
|
1976
|
+
});
|
|
1977
|
+
l = D(c / n * 100);
|
|
1978
|
+
}
|
|
1979
|
+
let r;
|
|
1980
|
+
if (s.defaultSize !== undefined) {
|
|
1981
|
+
const c = te({
|
|
1982
|
+
groupSize: n,
|
|
1983
|
+
panelElement: i,
|
|
1984
|
+
styleProp: s.defaultSize
|
|
1985
|
+
});
|
|
1986
|
+
r = D(c / n * 100);
|
|
1987
|
+
}
|
|
1988
|
+
let a = 0;
|
|
1989
|
+
if (s.minSize !== undefined) {
|
|
1990
|
+
const c = te({
|
|
1991
|
+
groupSize: n,
|
|
1992
|
+
panelElement: i,
|
|
1993
|
+
styleProp: s.minSize
|
|
1994
|
+
});
|
|
1995
|
+
a = D(c / n * 100);
|
|
1996
|
+
}
|
|
1997
|
+
let u = 100;
|
|
1998
|
+
if (s.maxSize !== undefined) {
|
|
1999
|
+
const c = te({
|
|
2000
|
+
groupSize: n,
|
|
2001
|
+
panelElement: i,
|
|
2002
|
+
styleProp: s.maxSize
|
|
2003
|
+
});
|
|
2004
|
+
u = D(c / n * 100);
|
|
2005
|
+
}
|
|
2006
|
+
return {
|
|
2007
|
+
groupResizeBehavior: s.groupResizeBehavior,
|
|
2008
|
+
collapsedSize: l,
|
|
2009
|
+
collapsible: s.collapsible === true,
|
|
2010
|
+
defaultSize: r,
|
|
2011
|
+
disabled: s.disabled,
|
|
2012
|
+
minSize: a,
|
|
2013
|
+
maxSize: u,
|
|
2014
|
+
panelId: o.id
|
|
2015
|
+
};
|
|
2016
|
+
});
|
|
2017
|
+
}
|
|
2018
|
+
function L(e, t = "Assertion error") {
|
|
2019
|
+
if (!e)
|
|
2020
|
+
throw Error(t);
|
|
2021
|
+
}
|
|
2022
|
+
function Se(e, t) {
|
|
2023
|
+
return Array.from(t).sort(e === "horizontal" ? bt : xt);
|
|
2024
|
+
}
|
|
2025
|
+
function bt(e, t) {
|
|
2026
|
+
const n = e.element.offsetLeft - t.element.offsetLeft;
|
|
2027
|
+
return n !== 0 ? n : e.element.offsetWidth - t.element.offsetWidth;
|
|
2028
|
+
}
|
|
2029
|
+
function xt(e, t) {
|
|
2030
|
+
const n = e.element.offsetTop - t.element.offsetTop;
|
|
2031
|
+
return n !== 0 ? n : e.element.offsetHeight - t.element.offsetHeight;
|
|
2032
|
+
}
|
|
2033
|
+
function Xe(e) {
|
|
2034
|
+
return e !== null && typeof e == "object" && "nodeType" in e && e.nodeType === Node.ELEMENT_NODE;
|
|
2035
|
+
}
|
|
2036
|
+
function qe(e, t) {
|
|
2037
|
+
return {
|
|
2038
|
+
x: e.x >= t.left && e.x <= t.right ? 0 : Math.min(Math.abs(e.x - t.left), Math.abs(e.x - t.right)),
|
|
2039
|
+
y: e.y >= t.top && e.y <= t.bottom ? 0 : Math.min(Math.abs(e.y - t.top), Math.abs(e.y - t.bottom))
|
|
2040
|
+
};
|
|
2041
|
+
}
|
|
2042
|
+
function wt({
|
|
2043
|
+
orientation: e,
|
|
2044
|
+
rects: t,
|
|
2045
|
+
targetRect: n
|
|
2046
|
+
}) {
|
|
2047
|
+
const o = {
|
|
2048
|
+
x: n.x + n.width / 2,
|
|
2049
|
+
y: n.y + n.height / 2
|
|
2050
|
+
};
|
|
2051
|
+
let i, s = Number.MAX_VALUE;
|
|
2052
|
+
for (const l of t) {
|
|
2053
|
+
const { x: r, y: a } = qe(o, l), u = e === "horizontal" ? r : a;
|
|
2054
|
+
u < s && (s = u, i = l);
|
|
2055
|
+
}
|
|
2056
|
+
return L(i, "No rect found"), i;
|
|
2057
|
+
}
|
|
2058
|
+
var ue;
|
|
2059
|
+
function Pt() {
|
|
2060
|
+
return ue === undefined && (typeof matchMedia == "function" ? ue = !!matchMedia("(pointer:coarse)").matches : ue = false), ue;
|
|
2061
|
+
}
|
|
2062
|
+
function Ye(e) {
|
|
2063
|
+
const { element: t, orientation: n, panels: o, separators: i } = e, s = Se(n, Array.from(t.children).filter(Xe).map((x) => ({ element: x }))).map(({ element: x }) => x), l = [];
|
|
2064
|
+
let r = false, a = false, u = -1, c = -1, m = 0, d, v = [];
|
|
2065
|
+
{
|
|
2066
|
+
let x = -1;
|
|
2067
|
+
for (const f of s)
|
|
2068
|
+
f.hasAttribute("data-panel") && (x++, f.ariaDisabled === null && (m++, u === -1 && (u = x), c = x));
|
|
2069
|
+
}
|
|
2070
|
+
if (m > 1) {
|
|
2071
|
+
let x = -1;
|
|
2072
|
+
for (const f of s)
|
|
2073
|
+
if (f.hasAttribute("data-panel")) {
|
|
2074
|
+
x++;
|
|
2075
|
+
const h = o.find((g) => g.element === f);
|
|
2076
|
+
if (h) {
|
|
2077
|
+
if (d) {
|
|
2078
|
+
const g = d.element.getBoundingClientRect(), y = f.getBoundingClientRect();
|
|
2079
|
+
let z;
|
|
2080
|
+
if (a) {
|
|
2081
|
+
const S = n === "horizontal" ? new DOMRect(g.right, g.top, 0, g.height) : new DOMRect(g.left, g.bottom, g.width, 0), p = n === "horizontal" ? new DOMRect(y.left, y.top, 0, y.height) : new DOMRect(y.left, y.top, y.width, 0);
|
|
2082
|
+
switch (v.length) {
|
|
2083
|
+
case 0: {
|
|
2084
|
+
z = [
|
|
2085
|
+
S,
|
|
2086
|
+
p
|
|
2087
|
+
];
|
|
2088
|
+
break;
|
|
2089
|
+
}
|
|
2090
|
+
case 1: {
|
|
2091
|
+
const P = v[0], R = wt({
|
|
2092
|
+
orientation: n,
|
|
2093
|
+
rects: [g, y],
|
|
2094
|
+
targetRect: P.element.getBoundingClientRect()
|
|
2095
|
+
});
|
|
2096
|
+
z = [
|
|
2097
|
+
P,
|
|
2098
|
+
R === g ? p : S
|
|
2099
|
+
];
|
|
2100
|
+
break;
|
|
2101
|
+
}
|
|
2102
|
+
default: {
|
|
2103
|
+
z = v;
|
|
2104
|
+
break;
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
} else
|
|
2108
|
+
v.length ? z = v : z = [
|
|
2109
|
+
n === "horizontal" ? new DOMRect(g.right, y.top, y.left - g.right, y.height) : new DOMRect(y.left, g.bottom, y.width, y.top - g.bottom)
|
|
2110
|
+
];
|
|
2111
|
+
for (const S of z) {
|
|
2112
|
+
let p = "width" in S ? S : S.element.getBoundingClientRect();
|
|
2113
|
+
const P = Pt() ? e.resizeTargetMinimumSize.coarse : e.resizeTargetMinimumSize.fine;
|
|
2114
|
+
if (p.width < P) {
|
|
2115
|
+
const C = P - p.width;
|
|
2116
|
+
p = new DOMRect(p.x - C / 2, p.y, p.width + C, p.height);
|
|
2117
|
+
}
|
|
2118
|
+
if (p.height < P) {
|
|
2119
|
+
const C = P - p.height;
|
|
2120
|
+
p = new DOMRect(p.x, p.y - C / 2, p.width, p.height + C);
|
|
2121
|
+
}
|
|
2122
|
+
const R = x <= u || x > c;
|
|
2123
|
+
!r && !R && l.push({
|
|
2124
|
+
group: e,
|
|
2125
|
+
groupSize: Q({ group: e }),
|
|
2126
|
+
panels: [d, h],
|
|
2127
|
+
separator: "width" in S ? undefined : S,
|
|
2128
|
+
rect: p
|
|
2129
|
+
}), r = false;
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
a = false, d = h, v = [];
|
|
2133
|
+
}
|
|
2134
|
+
} else if (f.hasAttribute("data-separator")) {
|
|
2135
|
+
f.ariaDisabled !== null && (r = true);
|
|
2136
|
+
const h = i.find((g) => g.element === f);
|
|
2137
|
+
h ? v.push(h) : (d = undefined, v = []);
|
|
2138
|
+
} else
|
|
2139
|
+
a = true;
|
|
2140
|
+
}
|
|
2141
|
+
return l;
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
class Je {
|
|
2145
|
+
#e = {};
|
|
2146
|
+
addListener(t, n) {
|
|
2147
|
+
const o = this.#e[t];
|
|
2148
|
+
return o === undefined ? this.#e[t] = [n] : o.includes(n) || o.push(n), () => {
|
|
2149
|
+
this.removeListener(t, n);
|
|
2150
|
+
};
|
|
2151
|
+
}
|
|
2152
|
+
emit(t, n) {
|
|
2153
|
+
const o = this.#e[t];
|
|
2154
|
+
if (o !== undefined)
|
|
2155
|
+
if (o.length === 1)
|
|
2156
|
+
o[0].call(null, n);
|
|
2157
|
+
else {
|
|
2158
|
+
let i = false, s = null;
|
|
2159
|
+
const l = Array.from(o);
|
|
2160
|
+
for (let r = 0;r < l.length; r++) {
|
|
2161
|
+
const a = l[r];
|
|
2162
|
+
try {
|
|
2163
|
+
a.call(null, n);
|
|
2164
|
+
} catch (u) {
|
|
2165
|
+
s === null && (i = true, s = u);
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
if (i)
|
|
2169
|
+
throw s;
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
removeAllListeners() {
|
|
2173
|
+
this.#e = {};
|
|
2174
|
+
}
|
|
2175
|
+
removeListener(t, n) {
|
|
2176
|
+
const o = this.#e[t];
|
|
2177
|
+
if (o !== undefined) {
|
|
2178
|
+
const i = o.indexOf(n);
|
|
2179
|
+
i >= 0 && o.splice(i, 1);
|
|
2180
|
+
}
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
var A = /* @__PURE__ */ new Map;
|
|
2184
|
+
var Ze = new Je;
|
|
2185
|
+
function Lt(e) {
|
|
2186
|
+
A = new Map(A), A.delete(e);
|
|
2187
|
+
}
|
|
2188
|
+
function Me(e, t) {
|
|
2189
|
+
for (const [n] of A)
|
|
2190
|
+
if (n.id === e)
|
|
2191
|
+
return n;
|
|
2192
|
+
}
|
|
2193
|
+
function $(e, t) {
|
|
2194
|
+
for (const [n, o] of A)
|
|
2195
|
+
if (n.id === e)
|
|
2196
|
+
return o;
|
|
2197
|
+
if (t)
|
|
2198
|
+
throw Error(`Could not find data for Group with id ${e}`);
|
|
2199
|
+
}
|
|
2200
|
+
function U() {
|
|
2201
|
+
return A;
|
|
2202
|
+
}
|
|
2203
|
+
function ye(e, t) {
|
|
2204
|
+
return Ze.addListener("groupChange", (n) => {
|
|
2205
|
+
n.group.id === e && t(n);
|
|
2206
|
+
});
|
|
2207
|
+
}
|
|
2208
|
+
function _(e, t) {
|
|
2209
|
+
const n = A.get(e);
|
|
2210
|
+
A = new Map(A), A.set(e, t), Ze.emit("groupChange", {
|
|
2211
|
+
group: e,
|
|
2212
|
+
prev: n,
|
|
2213
|
+
next: t
|
|
2214
|
+
});
|
|
2215
|
+
}
|
|
2216
|
+
function Ct(e, t, n) {
|
|
2217
|
+
let o, i = {
|
|
2218
|
+
x: 1 / 0,
|
|
2219
|
+
y: 1 / 0
|
|
2220
|
+
};
|
|
2221
|
+
for (const s of t) {
|
|
2222
|
+
const l = qe(n, s.rect);
|
|
2223
|
+
switch (e) {
|
|
2224
|
+
case "horizontal": {
|
|
2225
|
+
l.x <= i.x && (o = s, i = l);
|
|
2226
|
+
break;
|
|
2227
|
+
}
|
|
2228
|
+
case "vertical": {
|
|
2229
|
+
l.y <= i.y && (o = s, i = l);
|
|
2230
|
+
break;
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
return o ? {
|
|
2235
|
+
distance: i,
|
|
2236
|
+
hitRegion: o
|
|
2237
|
+
} : undefined;
|
|
2238
|
+
}
|
|
2239
|
+
function Rt(e) {
|
|
2240
|
+
return e !== null && typeof e == "object" && "nodeType" in e && e.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
|
|
2241
|
+
}
|
|
2242
|
+
function Mt(e, t) {
|
|
2243
|
+
if (e === t)
|
|
2244
|
+
throw new Error("Cannot compare node with itself");
|
|
2245
|
+
const n = {
|
|
2246
|
+
a: ke(e),
|
|
2247
|
+
b: ke(t)
|
|
2248
|
+
};
|
|
2249
|
+
let o;
|
|
2250
|
+
for (;n.a.at(-1) === n.b.at(-1); )
|
|
2251
|
+
o = n.a.pop(), n.b.pop();
|
|
2252
|
+
L(o, "Stacking order can only be calculated for elements with a common ancestor");
|
|
2253
|
+
const i = {
|
|
2254
|
+
a: Ie(Ee(n.a)),
|
|
2255
|
+
b: Ie(Ee(n.b))
|
|
2256
|
+
};
|
|
2257
|
+
if (i.a === i.b) {
|
|
2258
|
+
const s = o.childNodes, l = {
|
|
2259
|
+
a: n.a.at(-1),
|
|
2260
|
+
b: n.b.at(-1)
|
|
2261
|
+
};
|
|
2262
|
+
let r = s.length;
|
|
2263
|
+
for (;r--; ) {
|
|
2264
|
+
const a = s[r];
|
|
2265
|
+
if (a === l.a)
|
|
2266
|
+
return 1;
|
|
2267
|
+
if (a === l.b)
|
|
2268
|
+
return -1;
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
return Math.sign(i.a - i.b);
|
|
2272
|
+
}
|
|
2273
|
+
var Et = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
|
|
2274
|
+
function It(e) {
|
|
2275
|
+
const t = getComputedStyle(Qe(e) ?? e).display;
|
|
2276
|
+
return t === "flex" || t === "inline-flex";
|
|
2277
|
+
}
|
|
2278
|
+
function kt(e) {
|
|
2279
|
+
const t = getComputedStyle(e);
|
|
2280
|
+
return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" || It(e)) || +t.opacity < 1 || ("transform" in t) && t.transform !== "none" || ("webkitTransform" in t) && t.webkitTransform !== "none" || ("mixBlendMode" in t) && t.mixBlendMode !== "normal" || ("filter" in t) && t.filter !== "none" || ("webkitFilter" in t) && t.webkitFilter !== "none" || ("isolation" in t) && t.isolation === "isolate" || Et.test(t.willChange) || t.webkitOverflowScrolling === "touch");
|
|
2281
|
+
}
|
|
2282
|
+
function Ee(e) {
|
|
2283
|
+
let t = e.length;
|
|
2284
|
+
for (;t--; ) {
|
|
2285
|
+
const n = e[t];
|
|
2286
|
+
if (L(n, "Missing node"), kt(n))
|
|
2287
|
+
return n;
|
|
2288
|
+
}
|
|
2289
|
+
return null;
|
|
2290
|
+
}
|
|
2291
|
+
function Ie(e) {
|
|
2292
|
+
return e && Number(getComputedStyle(e).zIndex) || 0;
|
|
2293
|
+
}
|
|
2294
|
+
function ke(e) {
|
|
2295
|
+
const t = [];
|
|
2296
|
+
for (;e; )
|
|
2297
|
+
t.push(e), e = Qe(e);
|
|
2298
|
+
return t;
|
|
2299
|
+
}
|
|
2300
|
+
function Qe(e) {
|
|
2301
|
+
const { parentNode: t } = e;
|
|
2302
|
+
return Rt(t) ? t.host : t;
|
|
2303
|
+
}
|
|
2304
|
+
function Dt(e, t) {
|
|
2305
|
+
return e.x < t.x + t.width && e.x + e.width > t.x && e.y < t.y + t.height && e.y + e.height > t.y;
|
|
2306
|
+
}
|
|
2307
|
+
function Tt({
|
|
2308
|
+
groupElement: e,
|
|
2309
|
+
hitRegion: t,
|
|
2310
|
+
pointerEventTarget: n
|
|
2311
|
+
}) {
|
|
2312
|
+
if (!Xe(n) || n.contains(e) || e.contains(n))
|
|
2313
|
+
return true;
|
|
2314
|
+
if (Mt(n, e) > 0) {
|
|
2315
|
+
let o = n;
|
|
2316
|
+
for (;o; ) {
|
|
2317
|
+
if (o.contains(e))
|
|
2318
|
+
return true;
|
|
2319
|
+
if (Dt(o.getBoundingClientRect(), t))
|
|
2320
|
+
return false;
|
|
2321
|
+
o = o.parentElement;
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
return true;
|
|
2325
|
+
}
|
|
2326
|
+
function ve(e, t) {
|
|
2327
|
+
const n = [];
|
|
2328
|
+
return t.forEach((o, i) => {
|
|
2329
|
+
if (i.disabled)
|
|
2330
|
+
return;
|
|
2331
|
+
const s = Ye(i), l = Ct(i.orientation, s, {
|
|
2332
|
+
x: e.clientX,
|
|
2333
|
+
y: e.clientY
|
|
2334
|
+
});
|
|
2335
|
+
l && l.distance.x <= 0 && l.distance.y <= 0 && Tt({
|
|
2336
|
+
groupElement: i.element,
|
|
2337
|
+
hitRegion: l.hitRegion.rect,
|
|
2338
|
+
pointerEventTarget: e.target
|
|
2339
|
+
}) && n.push(l.hitRegion);
|
|
2340
|
+
}), n;
|
|
2341
|
+
}
|
|
2342
|
+
function Ot(e, t) {
|
|
2343
|
+
if (e.length !== t.length)
|
|
2344
|
+
return false;
|
|
2345
|
+
for (let n = 0;n < e.length; n++)
|
|
2346
|
+
if (e[n] != t[n])
|
|
2347
|
+
return false;
|
|
2348
|
+
return true;
|
|
2349
|
+
}
|
|
2350
|
+
function I(e, t, n = 0) {
|
|
2351
|
+
return Math.abs(D(e) - D(t)) <= n;
|
|
2352
|
+
}
|
|
2353
|
+
function G(e, t) {
|
|
2354
|
+
return I(e, t) ? 0 : e > t ? 1 : -1;
|
|
2355
|
+
}
|
|
2356
|
+
function Y({
|
|
2357
|
+
overrideDisabledPanels: e,
|
|
2358
|
+
panelConstraints: t,
|
|
2359
|
+
prevSize: n,
|
|
2360
|
+
size: o
|
|
2361
|
+
}) {
|
|
2362
|
+
const {
|
|
2363
|
+
collapsedSize: i = 0,
|
|
2364
|
+
collapsible: s,
|
|
2365
|
+
disabled: l,
|
|
2366
|
+
maxSize: r = 100,
|
|
2367
|
+
minSize: a = 0
|
|
2368
|
+
} = t;
|
|
2369
|
+
if (l && !e)
|
|
2370
|
+
return n;
|
|
2371
|
+
if (G(o, a) < 0)
|
|
2372
|
+
if (s) {
|
|
2373
|
+
const u = (i + a) / 2;
|
|
2374
|
+
G(o, u) < 0 ? o = i : o = a;
|
|
2375
|
+
} else
|
|
2376
|
+
o = a;
|
|
2377
|
+
return o = Math.min(r, o), o = D(o), o;
|
|
2378
|
+
}
|
|
2379
|
+
function se({
|
|
2380
|
+
delta: e,
|
|
2381
|
+
initialLayout: t,
|
|
2382
|
+
panelConstraints: n,
|
|
2383
|
+
pivotIndices: o,
|
|
2384
|
+
prevLayout: i,
|
|
2385
|
+
trigger: s
|
|
2386
|
+
}) {
|
|
2387
|
+
if (I(e, 0))
|
|
2388
|
+
return t;
|
|
2389
|
+
const l = s === "imperative-api", r = Object.values(t), a = Object.values(i), u = [...r], [c, m] = o;
|
|
2390
|
+
L(c != null, "Invalid first pivot index"), L(m != null, "Invalid second pivot index");
|
|
2391
|
+
let d = 0;
|
|
2392
|
+
switch (s) {
|
|
2393
|
+
case "keyboard": {
|
|
2394
|
+
{
|
|
2395
|
+
const f = e < 0 ? m : c, h = n[f];
|
|
2396
|
+
L(h, `Panel constraints not found for index ${f}`);
|
|
2397
|
+
const {
|
|
2398
|
+
collapsedSize: g = 0,
|
|
2399
|
+
collapsible: y,
|
|
2400
|
+
minSize: z = 0
|
|
2401
|
+
} = h;
|
|
2402
|
+
if (y) {
|
|
2403
|
+
const S = r[f];
|
|
2404
|
+
if (L(S != null, `Previous layout not found for panel index ${f}`), I(S, g)) {
|
|
2405
|
+
const p = z - S;
|
|
2406
|
+
G(p, Math.abs(e)) > 0 && (e = e < 0 ? 0 - p : p);
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
}
|
|
2410
|
+
{
|
|
2411
|
+
const f = e < 0 ? c : m, h = n[f];
|
|
2412
|
+
L(h, `No panel constraints found for index ${f}`);
|
|
2413
|
+
const {
|
|
2414
|
+
collapsedSize: g = 0,
|
|
2415
|
+
collapsible: y,
|
|
2416
|
+
minSize: z = 0
|
|
2417
|
+
} = h;
|
|
2418
|
+
if (y) {
|
|
2419
|
+
const S = r[f];
|
|
2420
|
+
if (L(S != null, `Previous layout not found for panel index ${f}`), I(S, z)) {
|
|
2421
|
+
const p = S - g;
|
|
2422
|
+
G(p, Math.abs(e)) > 0 && (e = e < 0 ? 0 - p : p);
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
break;
|
|
2427
|
+
}
|
|
2428
|
+
default: {
|
|
2429
|
+
const f = e < 0 ? m : c, h = n[f];
|
|
2430
|
+
L(h, `Panel constraints not found for index ${f}`);
|
|
2431
|
+
const g = r[f], { collapsible: y, collapsedSize: z, minSize: S } = h;
|
|
2432
|
+
if (y && G(g, S) < 0)
|
|
2433
|
+
if (e > 0) {
|
|
2434
|
+
const p = S - z, P = p / 2, R = g + e;
|
|
2435
|
+
G(R, S) < 0 && (e = G(e, P) <= 0 ? 0 : p);
|
|
2436
|
+
} else {
|
|
2437
|
+
const p = S - z, P = 100 - p / 2, R = g - e;
|
|
2438
|
+
G(R, S) < 0 && (e = G(100 + e, P) > 0 ? 0 : -p);
|
|
2439
|
+
}
|
|
2440
|
+
break;
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
{
|
|
2444
|
+
const f = e < 0 ? 1 : -1;
|
|
2445
|
+
let h = e < 0 ? m : c, g = 0;
|
|
2446
|
+
for (;; ) {
|
|
2447
|
+
const z = r[h];
|
|
2448
|
+
L(z != null, `Previous layout not found for panel index ${h}`);
|
|
2449
|
+
const p = Y({
|
|
2450
|
+
overrideDisabledPanels: l,
|
|
2451
|
+
panelConstraints: n[h],
|
|
2452
|
+
prevSize: z,
|
|
2453
|
+
size: 100
|
|
2454
|
+
}) - z;
|
|
2455
|
+
if (g += p, h += f, h < 0 || h >= n.length)
|
|
2456
|
+
break;
|
|
2457
|
+
}
|
|
2458
|
+
const y = Math.min(Math.abs(e), Math.abs(g));
|
|
2459
|
+
e = e < 0 ? 0 - y : y;
|
|
2460
|
+
}
|
|
2461
|
+
{
|
|
2462
|
+
let h = e < 0 ? c : m;
|
|
2463
|
+
for (;h >= 0 && h < n.length; ) {
|
|
2464
|
+
const g = Math.abs(e) - Math.abs(d), y = r[h];
|
|
2465
|
+
L(y != null, `Previous layout not found for panel index ${h}`);
|
|
2466
|
+
const z = y - g, S = Y({
|
|
2467
|
+
overrideDisabledPanels: l,
|
|
2468
|
+
panelConstraints: n[h],
|
|
2469
|
+
prevSize: y,
|
|
2470
|
+
size: z
|
|
2471
|
+
});
|
|
2472
|
+
if (!I(y, S) && (d += y - S, u[h] = S, d.toFixed(3).localeCompare(Math.abs(e).toFixed(3), undefined, {
|
|
2473
|
+
numeric: true
|
|
2474
|
+
}) >= 0))
|
|
2475
|
+
break;
|
|
2476
|
+
e < 0 ? h-- : h++;
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2479
|
+
if (Ot(a, u))
|
|
2480
|
+
return i;
|
|
2481
|
+
{
|
|
2482
|
+
const f = e < 0 ? m : c, h = r[f];
|
|
2483
|
+
L(h != null, `Previous layout not found for panel index ${f}`);
|
|
2484
|
+
const g = h + d, y = Y({
|
|
2485
|
+
overrideDisabledPanels: l,
|
|
2486
|
+
panelConstraints: n[f],
|
|
2487
|
+
prevSize: h,
|
|
2488
|
+
size: g
|
|
2489
|
+
});
|
|
2490
|
+
if (u[f] = y, !I(y, g)) {
|
|
2491
|
+
let z = g - y, p = e < 0 ? m : c;
|
|
2492
|
+
for (;p >= 0 && p < n.length; ) {
|
|
2493
|
+
const P = u[p];
|
|
2494
|
+
L(P != null, `Previous layout not found for panel index ${p}`);
|
|
2495
|
+
const R = P + z, C = Y({
|
|
2496
|
+
overrideDisabledPanels: l,
|
|
2497
|
+
panelConstraints: n[p],
|
|
2498
|
+
prevSize: P,
|
|
2499
|
+
size: R
|
|
2500
|
+
});
|
|
2501
|
+
if (I(P, C) || (z -= C - P, u[p] = C), I(z, 0))
|
|
2502
|
+
break;
|
|
2503
|
+
e > 0 ? p-- : p++;
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
const v = Object.values(u).reduce((f, h) => h + f, 0);
|
|
2508
|
+
if (!I(v, 100, 0.1))
|
|
2509
|
+
return i;
|
|
2510
|
+
const x = Object.keys(i);
|
|
2511
|
+
return u.reduce((f, h, g) => (f[x[g]] = h, f), {});
|
|
2512
|
+
}
|
|
2513
|
+
function j(e, t) {
|
|
2514
|
+
if (Object.keys(e).length !== Object.keys(t).length)
|
|
2515
|
+
return false;
|
|
2516
|
+
for (const n in e)
|
|
2517
|
+
if (t[n] === undefined || G(e[n], t[n]) !== 0)
|
|
2518
|
+
return false;
|
|
2519
|
+
return true;
|
|
2520
|
+
}
|
|
2521
|
+
function B({
|
|
2522
|
+
layout: e,
|
|
2523
|
+
panelConstraints: t
|
|
2524
|
+
}) {
|
|
2525
|
+
const n = Object.values(e), o = [...n], i = o.reduce((r, a) => r + a, 0);
|
|
2526
|
+
if (o.length !== t.length)
|
|
2527
|
+
throw Error(`Invalid ${t.length} panel layout: ${o.map((r) => `${r}%`).join(", ")}`);
|
|
2528
|
+
if (!I(i, 100) && o.length > 0)
|
|
2529
|
+
for (let r = 0;r < t.length; r++) {
|
|
2530
|
+
const a = o[r];
|
|
2531
|
+
L(a != null, `No layout data found for index ${r}`);
|
|
2532
|
+
const u = 100 / i * a;
|
|
2533
|
+
o[r] = u;
|
|
2534
|
+
}
|
|
2535
|
+
let s = 0;
|
|
2536
|
+
for (let r = 0;r < t.length; r++) {
|
|
2537
|
+
const a = n[r];
|
|
2538
|
+
L(a != null, `No layout data found for index ${r}`);
|
|
2539
|
+
const u = o[r];
|
|
2540
|
+
L(u != null, `No layout data found for index ${r}`);
|
|
2541
|
+
const c = Y({
|
|
2542
|
+
overrideDisabledPanels: true,
|
|
2543
|
+
panelConstraints: t[r],
|
|
2544
|
+
prevSize: a,
|
|
2545
|
+
size: u
|
|
2546
|
+
});
|
|
2547
|
+
u != c && (s += u - c, o[r] = c);
|
|
2548
|
+
}
|
|
2549
|
+
if (!I(s, 0))
|
|
2550
|
+
for (let r = 0;r < t.length; r++) {
|
|
2551
|
+
const a = o[r];
|
|
2552
|
+
L(a != null, `No layout data found for index ${r}`);
|
|
2553
|
+
const u = a + s, c = Y({
|
|
2554
|
+
overrideDisabledPanels: true,
|
|
2555
|
+
panelConstraints: t[r],
|
|
2556
|
+
prevSize: a,
|
|
2557
|
+
size: u
|
|
2558
|
+
});
|
|
2559
|
+
if (a !== c && (s -= c - a, o[r] = c, I(s, 0)))
|
|
2560
|
+
break;
|
|
2561
|
+
}
|
|
2562
|
+
const l = Object.keys(e);
|
|
2563
|
+
return o.reduce((r, a, u) => (r[l[u]] = a, r), {});
|
|
2564
|
+
}
|
|
2565
|
+
function et({
|
|
2566
|
+
groupId: e,
|
|
2567
|
+
panelId: t
|
|
2568
|
+
}) {
|
|
2569
|
+
const n = () => {
|
|
2570
|
+
const r = U();
|
|
2571
|
+
for (const [
|
|
2572
|
+
a,
|
|
2573
|
+
{
|
|
2574
|
+
defaultLayoutDeferred: u,
|
|
2575
|
+
derivedPanelConstraints: c,
|
|
2576
|
+
layout: m,
|
|
2577
|
+
groupSize: d,
|
|
2578
|
+
separatorToPanels: v
|
|
2579
|
+
}
|
|
2580
|
+
] of r)
|
|
2581
|
+
if (a.id === e)
|
|
2582
|
+
return {
|
|
2583
|
+
defaultLayoutDeferred: u,
|
|
2584
|
+
derivedPanelConstraints: c,
|
|
2585
|
+
group: a,
|
|
2586
|
+
groupSize: d,
|
|
2587
|
+
layout: m,
|
|
2588
|
+
separatorToPanels: v
|
|
2589
|
+
};
|
|
2590
|
+
throw Error(`Group ${e} not found`);
|
|
2591
|
+
}, o = () => {
|
|
2592
|
+
const r = n().derivedPanelConstraints.find((a) => a.panelId === t);
|
|
2593
|
+
if (r !== undefined)
|
|
2594
|
+
return r;
|
|
2595
|
+
throw Error(`Panel constraints not found for Panel ${t}`);
|
|
2596
|
+
}, i = () => {
|
|
2597
|
+
const r = n().group.panels.find((a) => a.id === t);
|
|
2598
|
+
if (r !== undefined)
|
|
2599
|
+
return r;
|
|
2600
|
+
throw Error(`Layout not found for Panel ${t}`);
|
|
2601
|
+
}, s = () => {
|
|
2602
|
+
const r = n().layout[t];
|
|
2603
|
+
if (r !== undefined)
|
|
2604
|
+
return r;
|
|
2605
|
+
throw Error(`Layout not found for Panel ${t}`);
|
|
2606
|
+
}, l = (r) => {
|
|
2607
|
+
const a = s();
|
|
2608
|
+
if (r === a)
|
|
2609
|
+
return;
|
|
2610
|
+
const {
|
|
2611
|
+
defaultLayoutDeferred: u,
|
|
2612
|
+
derivedPanelConstraints: c,
|
|
2613
|
+
group: m,
|
|
2614
|
+
groupSize: d,
|
|
2615
|
+
layout: v,
|
|
2616
|
+
separatorToPanels: x
|
|
2617
|
+
} = n(), f = m.panels.findIndex((z) => z.id === t), h = f === m.panels.length - 1, g = se({
|
|
2618
|
+
delta: h ? a - r : r - a,
|
|
2619
|
+
initialLayout: v,
|
|
2620
|
+
panelConstraints: c,
|
|
2621
|
+
pivotIndices: h ? [f - 1, f] : [f, f + 1],
|
|
2622
|
+
prevLayout: v,
|
|
2623
|
+
trigger: "imperative-api"
|
|
2624
|
+
}), y = B({
|
|
2625
|
+
layout: g,
|
|
2626
|
+
panelConstraints: c
|
|
2627
|
+
});
|
|
2628
|
+
j(v, y) || _(m, {
|
|
2629
|
+
defaultLayoutDeferred: u,
|
|
2630
|
+
derivedPanelConstraints: c,
|
|
2631
|
+
groupSize: d,
|
|
2632
|
+
layout: y,
|
|
2633
|
+
separatorToPanels: x
|
|
2634
|
+
});
|
|
2635
|
+
};
|
|
2636
|
+
return {
|
|
2637
|
+
collapse: () => {
|
|
2638
|
+
const { collapsible: r, collapsedSize: a } = o(), { mutableValues: u } = i(), c = s();
|
|
2639
|
+
r && c !== a && (u.expandToSize = c, l(a));
|
|
2640
|
+
},
|
|
2641
|
+
expand: () => {
|
|
2642
|
+
const { collapsible: r, collapsedSize: a, minSize: u } = o(), { mutableValues: c } = i(), m = s();
|
|
2643
|
+
if (r && m === a) {
|
|
2644
|
+
let d = c.expandToSize ?? u;
|
|
2645
|
+
d === 0 && (d = 1), l(d);
|
|
2646
|
+
}
|
|
2647
|
+
},
|
|
2648
|
+
getSize: () => {
|
|
2649
|
+
const { group: r } = n(), a = s(), { element: u } = i(), c = r.orientation === "horizontal" ? u.offsetWidth : u.offsetHeight;
|
|
2650
|
+
return {
|
|
2651
|
+
asPercentage: a,
|
|
2652
|
+
inPixels: c
|
|
2653
|
+
};
|
|
2654
|
+
},
|
|
2655
|
+
isCollapsed: () => {
|
|
2656
|
+
const { collapsible: r, collapsedSize: a } = o(), u = s();
|
|
2657
|
+
return r && I(a, u);
|
|
2658
|
+
},
|
|
2659
|
+
resize: (r) => {
|
|
2660
|
+
const { group: a } = n(), { element: u } = i(), c = Q({ group: a }), m = te({
|
|
2661
|
+
groupSize: c,
|
|
2662
|
+
panelElement: u,
|
|
2663
|
+
styleProp: r
|
|
2664
|
+
}), d = D(m / c * 100);
|
|
2665
|
+
l(d);
|
|
2666
|
+
}
|
|
2667
|
+
};
|
|
2668
|
+
}
|
|
2669
|
+
function De(e) {
|
|
2670
|
+
if (e.defaultPrevented)
|
|
2671
|
+
return;
|
|
2672
|
+
const t = U();
|
|
2673
|
+
ve(e, t).forEach((o) => {
|
|
2674
|
+
if (o.separator) {
|
|
2675
|
+
const i = o.panels.find((s) => s.panelConstraints.defaultSize !== undefined);
|
|
2676
|
+
if (i) {
|
|
2677
|
+
const s = i.panelConstraints.defaultSize, l = et({
|
|
2678
|
+
groupId: o.group.id,
|
|
2679
|
+
panelId: i.id
|
|
2680
|
+
});
|
|
2681
|
+
l && s !== undefined && (l.resize(s), e.preventDefault());
|
|
2682
|
+
}
|
|
2683
|
+
}
|
|
2684
|
+
});
|
|
2685
|
+
}
|
|
2686
|
+
function fe(e) {
|
|
2687
|
+
const t = U();
|
|
2688
|
+
for (const [n] of t)
|
|
2689
|
+
if (n.separators.some((o) => o.element === e))
|
|
2690
|
+
return n;
|
|
2691
|
+
throw Error("Could not find parent Group for separator element");
|
|
2692
|
+
}
|
|
2693
|
+
function tt({
|
|
2694
|
+
groupId: e
|
|
2695
|
+
}) {
|
|
2696
|
+
const t = () => {
|
|
2697
|
+
const n = U();
|
|
2698
|
+
for (const [o, i] of n)
|
|
2699
|
+
if (o.id === e)
|
|
2700
|
+
return { group: o, ...i };
|
|
2701
|
+
throw Error(`Could not find Group with id "${e}"`);
|
|
2702
|
+
};
|
|
2703
|
+
return {
|
|
2704
|
+
getLayout() {
|
|
2705
|
+
const { defaultLayoutDeferred: n, layout: o } = t();
|
|
2706
|
+
return n ? {} : o;
|
|
2707
|
+
},
|
|
2708
|
+
setLayout(n) {
|
|
2709
|
+
const {
|
|
2710
|
+
defaultLayoutDeferred: o,
|
|
2711
|
+
derivedPanelConstraints: i,
|
|
2712
|
+
group: s,
|
|
2713
|
+
groupSize: l,
|
|
2714
|
+
layout: r,
|
|
2715
|
+
separatorToPanels: a
|
|
2716
|
+
} = t(), u = B({
|
|
2717
|
+
layout: n,
|
|
2718
|
+
panelConstraints: i
|
|
2719
|
+
});
|
|
2720
|
+
return o ? r : (j(r, u) || _(s, {
|
|
2721
|
+
defaultLayoutDeferred: o,
|
|
2722
|
+
derivedPanelConstraints: i,
|
|
2723
|
+
groupSize: l,
|
|
2724
|
+
layout: u,
|
|
2725
|
+
separatorToPanels: a
|
|
2726
|
+
}), u);
|
|
2727
|
+
}
|
|
2728
|
+
};
|
|
2729
|
+
}
|
|
2730
|
+
function V(e, t) {
|
|
2731
|
+
const n = fe(e), o = $(n.id, true), i = n.separators.find((m) => m.element === e);
|
|
2732
|
+
L(i, "Matching separator not found");
|
|
2733
|
+
const s = o.separatorToPanels.get(i);
|
|
2734
|
+
L(s, "Matching panels not found");
|
|
2735
|
+
const l = s.map((m) => n.panels.indexOf(m)), a = tt({ groupId: n.id }).getLayout(), u = se({
|
|
2736
|
+
delta: t,
|
|
2737
|
+
initialLayout: a,
|
|
2738
|
+
panelConstraints: o.derivedPanelConstraints,
|
|
2739
|
+
pivotIndices: l,
|
|
2740
|
+
prevLayout: a,
|
|
2741
|
+
trigger: "keyboard"
|
|
2742
|
+
}), c = B({
|
|
2743
|
+
layout: u,
|
|
2744
|
+
panelConstraints: o.derivedPanelConstraints
|
|
2745
|
+
});
|
|
2746
|
+
j(a, c) || _(n, {
|
|
2747
|
+
defaultLayoutDeferred: o.defaultLayoutDeferred,
|
|
2748
|
+
derivedPanelConstraints: o.derivedPanelConstraints,
|
|
2749
|
+
groupSize: o.groupSize,
|
|
2750
|
+
layout: c,
|
|
2751
|
+
separatorToPanels: o.separatorToPanels
|
|
2752
|
+
});
|
|
2753
|
+
}
|
|
2754
|
+
function Te(e) {
|
|
2755
|
+
if (e.defaultPrevented)
|
|
2756
|
+
return;
|
|
2757
|
+
const t = e.currentTarget, n = fe(t);
|
|
2758
|
+
if (!n.disabled)
|
|
2759
|
+
switch (e.key) {
|
|
2760
|
+
case "ArrowDown": {
|
|
2761
|
+
e.preventDefault(), n.orientation === "vertical" && V(t, 5);
|
|
2762
|
+
break;
|
|
2763
|
+
}
|
|
2764
|
+
case "ArrowLeft": {
|
|
2765
|
+
e.preventDefault(), n.orientation === "horizontal" && V(t, -5);
|
|
2766
|
+
break;
|
|
2767
|
+
}
|
|
2768
|
+
case "ArrowRight": {
|
|
2769
|
+
e.preventDefault(), n.orientation === "horizontal" && V(t, 5);
|
|
2770
|
+
break;
|
|
2771
|
+
}
|
|
2772
|
+
case "ArrowUp": {
|
|
2773
|
+
e.preventDefault(), n.orientation === "vertical" && V(t, -5);
|
|
2774
|
+
break;
|
|
2775
|
+
}
|
|
2776
|
+
case "End": {
|
|
2777
|
+
e.preventDefault(), V(t, 100);
|
|
2778
|
+
break;
|
|
2779
|
+
}
|
|
2780
|
+
case "Enter": {
|
|
2781
|
+
e.preventDefault();
|
|
2782
|
+
const o = fe(t), i = $(o.id, true), { derivedPanelConstraints: s, layout: l, separatorToPanels: r } = i, a = o.separators.find((d) => d.element === t);
|
|
2783
|
+
L(a, "Matching separator not found");
|
|
2784
|
+
const u = r.get(a);
|
|
2785
|
+
L(u, "Matching panels not found");
|
|
2786
|
+
const c = u[0], m = s.find((d) => d.panelId === c.id);
|
|
2787
|
+
if (L(m, "Panel metadata not found"), m.collapsible) {
|
|
2788
|
+
const d = l[c.id], v = m.collapsedSize === d ? o.mutableState.expandedPanelSizes[c.id] ?? m.minSize : m.collapsedSize;
|
|
2789
|
+
V(t, v - d);
|
|
2790
|
+
}
|
|
2791
|
+
break;
|
|
2792
|
+
}
|
|
2793
|
+
case "F6": {
|
|
2794
|
+
e.preventDefault();
|
|
2795
|
+
const i = fe(t).separators.map((a) => a.element), s = Array.from(i).findIndex((a) => a === e.currentTarget);
|
|
2796
|
+
L(s !== null, "Index not found");
|
|
2797
|
+
const l = e.shiftKey ? s > 0 ? s - 1 : i.length - 1 : s + 1 < i.length ? s + 1 : 0;
|
|
2798
|
+
i[l].focus({
|
|
2799
|
+
preventScroll: true
|
|
2800
|
+
});
|
|
2801
|
+
break;
|
|
2802
|
+
}
|
|
2803
|
+
case "Home": {
|
|
2804
|
+
e.preventDefault(), V(t, -100);
|
|
2805
|
+
break;
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
var J = {
|
|
2810
|
+
cursorFlags: 0,
|
|
2811
|
+
state: "inactive"
|
|
2812
|
+
};
|
|
2813
|
+
var ze = new Je;
|
|
2814
|
+
function W() {
|
|
2815
|
+
return J;
|
|
2816
|
+
}
|
|
2817
|
+
function Gt(e) {
|
|
2818
|
+
return ze.addListener("change", e);
|
|
2819
|
+
}
|
|
2820
|
+
function At(e) {
|
|
2821
|
+
const t = J, n = { ...J };
|
|
2822
|
+
n.cursorFlags = e, J = n, ze.emit("change", {
|
|
2823
|
+
prev: t,
|
|
2824
|
+
next: n
|
|
2825
|
+
});
|
|
2826
|
+
}
|
|
2827
|
+
function Z(e) {
|
|
2828
|
+
const t = J;
|
|
2829
|
+
J = e, ze.emit("change", {
|
|
2830
|
+
prev: t,
|
|
2831
|
+
next: e
|
|
2832
|
+
});
|
|
2833
|
+
}
|
|
2834
|
+
function Oe(e) {
|
|
2835
|
+
if (e.defaultPrevented)
|
|
2836
|
+
return;
|
|
2837
|
+
if (e.pointerType === "mouse" && e.button > 0)
|
|
2838
|
+
return;
|
|
2839
|
+
const t = U(), n = ve(e, t), o = /* @__PURE__ */ new Map;
|
|
2840
|
+
let i = false;
|
|
2841
|
+
n.forEach((s) => {
|
|
2842
|
+
s.separator && (i || (i = true, s.separator.element.focus({
|
|
2843
|
+
preventScroll: true
|
|
2844
|
+
})));
|
|
2845
|
+
const l = t.get(s.group);
|
|
2846
|
+
l && o.set(s.group, l.layout);
|
|
2847
|
+
}), Z({
|
|
2848
|
+
cursorFlags: 0,
|
|
2849
|
+
hitRegions: n,
|
|
2850
|
+
initialLayoutMap: o,
|
|
2851
|
+
pointerDownAtPoint: { x: e.clientX, y: e.clientY },
|
|
2852
|
+
state: "active"
|
|
2853
|
+
}), n.length && e.preventDefault();
|
|
2854
|
+
}
|
|
2855
|
+
var Nt = (e) => e;
|
|
2856
|
+
var he = () => {};
|
|
2857
|
+
var nt = 1;
|
|
2858
|
+
var ot = 2;
|
|
2859
|
+
var it = 4;
|
|
2860
|
+
var rt = 8;
|
|
2861
|
+
var Ge = 3;
|
|
2862
|
+
var Ae = 12;
|
|
2863
|
+
var ce;
|
|
2864
|
+
function Ne() {
|
|
2865
|
+
return ce === undefined && (ce = false, typeof window < "u" && (window.navigator.userAgent.includes("Chrome") || window.navigator.userAgent.includes("Firefox")) && (ce = true)), ce;
|
|
2866
|
+
}
|
|
2867
|
+
function _t({
|
|
2868
|
+
cursorFlags: e,
|
|
2869
|
+
groups: t,
|
|
2870
|
+
state: n
|
|
2871
|
+
}) {
|
|
2872
|
+
let o = 0, i = 0;
|
|
2873
|
+
switch (n) {
|
|
2874
|
+
case "active":
|
|
2875
|
+
case "hover":
|
|
2876
|
+
t.forEach((s) => {
|
|
2877
|
+
if (!s.mutableState.disableCursor)
|
|
2878
|
+
switch (s.orientation) {
|
|
2879
|
+
case "horizontal": {
|
|
2880
|
+
o++;
|
|
2881
|
+
break;
|
|
2882
|
+
}
|
|
2883
|
+
case "vertical": {
|
|
2884
|
+
i++;
|
|
2885
|
+
break;
|
|
2886
|
+
}
|
|
2887
|
+
}
|
|
2888
|
+
});
|
|
2889
|
+
}
|
|
2890
|
+
if (!(o === 0 && i === 0)) {
|
|
2891
|
+
switch (n) {
|
|
2892
|
+
case "active": {
|
|
2893
|
+
if (e && Ne()) {
|
|
2894
|
+
const s = (e & nt) !== 0, l = (e & ot) !== 0, r = (e & it) !== 0, a = (e & rt) !== 0;
|
|
2895
|
+
if (s)
|
|
2896
|
+
return r ? "se-resize" : a ? "ne-resize" : "e-resize";
|
|
2897
|
+
if (l)
|
|
2898
|
+
return r ? "sw-resize" : a ? "nw-resize" : "w-resize";
|
|
2899
|
+
if (r)
|
|
2900
|
+
return "s-resize";
|
|
2901
|
+
if (a)
|
|
2902
|
+
return "n-resize";
|
|
2903
|
+
}
|
|
2904
|
+
break;
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
return Ne() ? o > 0 && i > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize" : o > 0 && i > 0 ? "grab" : o > 0 ? "col-resize" : "row-resize";
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
var _e = /* @__PURE__ */ new WeakMap;
|
|
2911
|
+
function be(e) {
|
|
2912
|
+
if (e.defaultView === null || e.defaultView === undefined)
|
|
2913
|
+
return;
|
|
2914
|
+
let { prevStyle: t, styleSheet: n } = _e.get(e) ?? {};
|
|
2915
|
+
n === undefined && (n = new e.defaultView.CSSStyleSheet, e.adoptedStyleSheets && e.adoptedStyleSheets.push(n));
|
|
2916
|
+
const o = W();
|
|
2917
|
+
switch (o.state) {
|
|
2918
|
+
case "active":
|
|
2919
|
+
case "hover": {
|
|
2920
|
+
const i = _t({
|
|
2921
|
+
cursorFlags: o.cursorFlags,
|
|
2922
|
+
groups: o.hitRegions.map((l) => l.group),
|
|
2923
|
+
state: o.state
|
|
2924
|
+
}), s = `*, *:hover {cursor: ${i} !important; }`;
|
|
2925
|
+
if (t === s)
|
|
2926
|
+
return;
|
|
2927
|
+
t = s, i ? n.cssRules.length === 0 ? n.insertRule(s) : n.replaceSync(s) : n.cssRules.length === 1 && n.deleteRule(0);
|
|
2928
|
+
break;
|
|
2929
|
+
}
|
|
2930
|
+
case "inactive": {
|
|
2931
|
+
t = undefined, n.cssRules.length === 1 && n.deleteRule(0);
|
|
2932
|
+
break;
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2935
|
+
_e.set(e, {
|
|
2936
|
+
prevStyle: t,
|
|
2937
|
+
styleSheet: n
|
|
2938
|
+
});
|
|
2939
|
+
}
|
|
2940
|
+
function st({
|
|
2941
|
+
document: e,
|
|
2942
|
+
event: t,
|
|
2943
|
+
hitRegions: n,
|
|
2944
|
+
initialLayoutMap: o,
|
|
2945
|
+
mountedGroups: i,
|
|
2946
|
+
pointerDownAtPoint: s,
|
|
2947
|
+
prevCursorFlags: l
|
|
2948
|
+
}) {
|
|
2949
|
+
let r = 0;
|
|
2950
|
+
n.forEach((u) => {
|
|
2951
|
+
const { group: c, groupSize: m } = u, { orientation: d, panels: v } = c, { disableCursor: x } = c.mutableState;
|
|
2952
|
+
let f = 0;
|
|
2953
|
+
s ? d === "horizontal" ? f = (t.clientX - s.x) / m * 100 : f = (t.clientY - s.y) / m * 100 : d === "horizontal" ? f = t.clientX < 0 ? -100 : 100 : f = t.clientY < 0 ? -100 : 100;
|
|
2954
|
+
const h = o.get(c), g = i.get(c);
|
|
2955
|
+
if (!h || !g)
|
|
2956
|
+
return;
|
|
2957
|
+
const {
|
|
2958
|
+
defaultLayoutDeferred: y,
|
|
2959
|
+
derivedPanelConstraints: z,
|
|
2960
|
+
groupSize: S,
|
|
2961
|
+
layout: p,
|
|
2962
|
+
separatorToPanels: P
|
|
2963
|
+
} = g;
|
|
2964
|
+
if (z && p && P) {
|
|
2965
|
+
const R = se({
|
|
2966
|
+
delta: f,
|
|
2967
|
+
initialLayout: h,
|
|
2968
|
+
panelConstraints: z,
|
|
2969
|
+
pivotIndices: u.panels.map((C) => v.indexOf(C)),
|
|
2970
|
+
prevLayout: p,
|
|
2971
|
+
trigger: "mouse-or-touch"
|
|
2972
|
+
});
|
|
2973
|
+
if (j(R, p)) {
|
|
2974
|
+
if (f !== 0 && !x)
|
|
2975
|
+
switch (d) {
|
|
2976
|
+
case "horizontal": {
|
|
2977
|
+
r |= f < 0 ? nt : ot;
|
|
2978
|
+
break;
|
|
2979
|
+
}
|
|
2980
|
+
case "vertical": {
|
|
2981
|
+
r |= f < 0 ? it : rt;
|
|
2982
|
+
break;
|
|
2983
|
+
}
|
|
2984
|
+
}
|
|
2985
|
+
} else
|
|
2986
|
+
_(u.group, {
|
|
2987
|
+
defaultLayoutDeferred: y,
|
|
2988
|
+
derivedPanelConstraints: z,
|
|
2989
|
+
groupSize: S,
|
|
2990
|
+
layout: R,
|
|
2991
|
+
separatorToPanels: P
|
|
2992
|
+
});
|
|
2993
|
+
}
|
|
2994
|
+
});
|
|
2995
|
+
let a = 0;
|
|
2996
|
+
t.movementX === 0 ? a |= l & Ge : a |= r & Ge, t.movementY === 0 ? a |= l & Ae : a |= r & Ae, At(a), be(e);
|
|
2997
|
+
}
|
|
2998
|
+
function Fe(e) {
|
|
2999
|
+
const t = U(), n = W();
|
|
3000
|
+
switch (n.state) {
|
|
3001
|
+
case "active":
|
|
3002
|
+
st({
|
|
3003
|
+
document: e.currentTarget,
|
|
3004
|
+
event: e,
|
|
3005
|
+
hitRegions: n.hitRegions,
|
|
3006
|
+
initialLayoutMap: n.initialLayoutMap,
|
|
3007
|
+
mountedGroups: t,
|
|
3008
|
+
prevCursorFlags: n.cursorFlags
|
|
3009
|
+
});
|
|
3010
|
+
}
|
|
3011
|
+
}
|
|
3012
|
+
function $e(e) {
|
|
3013
|
+
if (e.defaultPrevented)
|
|
3014
|
+
return;
|
|
3015
|
+
const t = W(), n = U();
|
|
3016
|
+
switch (t.state) {
|
|
3017
|
+
case "active": {
|
|
3018
|
+
if (e.buttons === 0) {
|
|
3019
|
+
Z({
|
|
3020
|
+
cursorFlags: 0,
|
|
3021
|
+
state: "inactive"
|
|
3022
|
+
}), t.hitRegions.forEach((o) => {
|
|
3023
|
+
const i = $(o.group.id, true);
|
|
3024
|
+
_(o.group, i);
|
|
3025
|
+
});
|
|
3026
|
+
return;
|
|
3027
|
+
}
|
|
3028
|
+
st({
|
|
3029
|
+
document: e.currentTarget,
|
|
3030
|
+
event: e,
|
|
3031
|
+
hitRegions: t.hitRegions,
|
|
3032
|
+
initialLayoutMap: t.initialLayoutMap,
|
|
3033
|
+
mountedGroups: n,
|
|
3034
|
+
pointerDownAtPoint: t.pointerDownAtPoint,
|
|
3035
|
+
prevCursorFlags: t.cursorFlags
|
|
3036
|
+
});
|
|
3037
|
+
break;
|
|
3038
|
+
}
|
|
3039
|
+
default: {
|
|
3040
|
+
const o = ve(e, n);
|
|
3041
|
+
o.length === 0 ? t.state !== "inactive" && Z({
|
|
3042
|
+
cursorFlags: 0,
|
|
3043
|
+
state: "inactive"
|
|
3044
|
+
}) : Z({
|
|
3045
|
+
cursorFlags: 0,
|
|
3046
|
+
hitRegions: o,
|
|
3047
|
+
state: "hover"
|
|
3048
|
+
}), be(e.currentTarget);
|
|
3049
|
+
break;
|
|
3050
|
+
}
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
function He(e) {
|
|
3054
|
+
if (e.relatedTarget instanceof HTMLIFrameElement)
|
|
3055
|
+
switch (W().state) {
|
|
3056
|
+
case "hover":
|
|
3057
|
+
Z({
|
|
3058
|
+
cursorFlags: 0,
|
|
3059
|
+
state: "inactive"
|
|
3060
|
+
});
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
3063
|
+
function Ve(e) {
|
|
3064
|
+
if (e.defaultPrevented)
|
|
3065
|
+
return;
|
|
3066
|
+
if (e.pointerType === "mouse" && e.button > 0)
|
|
3067
|
+
return;
|
|
3068
|
+
const t = W();
|
|
3069
|
+
switch (t.state) {
|
|
3070
|
+
case "active":
|
|
3071
|
+
Z({
|
|
3072
|
+
cursorFlags: 0,
|
|
3073
|
+
state: "inactive"
|
|
3074
|
+
}), t.hitRegions.length > 0 && (be(e.currentTarget), t.hitRegions.forEach((n) => {
|
|
3075
|
+
const o = $(n.group.id, true);
|
|
3076
|
+
_(n.group, o);
|
|
3077
|
+
}), e.preventDefault());
|
|
3078
|
+
}
|
|
3079
|
+
}
|
|
3080
|
+
function je(e) {
|
|
3081
|
+
let t = 0, n = 0;
|
|
3082
|
+
const o = {};
|
|
3083
|
+
for (const s of e)
|
|
3084
|
+
if (s.defaultSize !== undefined) {
|
|
3085
|
+
t++;
|
|
3086
|
+
const l = D(s.defaultSize);
|
|
3087
|
+
n += l, o[s.panelId] = l;
|
|
3088
|
+
} else
|
|
3089
|
+
o[s.panelId] = undefined;
|
|
3090
|
+
const i = e.length - t;
|
|
3091
|
+
if (i !== 0) {
|
|
3092
|
+
const s = D((100 - n) / i);
|
|
3093
|
+
for (const l of e)
|
|
3094
|
+
l.defaultSize === undefined && (o[l.panelId] = s);
|
|
3095
|
+
}
|
|
3096
|
+
return o;
|
|
3097
|
+
}
|
|
3098
|
+
function Ft(e, t, n) {
|
|
3099
|
+
if (!n[0])
|
|
3100
|
+
return;
|
|
3101
|
+
const i = e.panels.find((u) => u.element === t);
|
|
3102
|
+
if (!i || !i.onResize)
|
|
3103
|
+
return;
|
|
3104
|
+
const s = Q({ group: e }), l = e.orientation === "horizontal" ? i.element.offsetWidth : i.element.offsetHeight, r = i.mutableValues.prevSize, a = {
|
|
3105
|
+
asPercentage: D(l / s * 100),
|
|
3106
|
+
inPixels: l
|
|
3107
|
+
};
|
|
3108
|
+
i.mutableValues.prevSize = a, i.onResize(a, i.id, r);
|
|
3109
|
+
}
|
|
3110
|
+
function $t(e, t) {
|
|
3111
|
+
if (Object.keys(e).length !== Object.keys(t).length)
|
|
3112
|
+
return false;
|
|
3113
|
+
for (const o in e)
|
|
3114
|
+
if (e[o] !== t[o])
|
|
3115
|
+
return false;
|
|
3116
|
+
return true;
|
|
3117
|
+
}
|
|
3118
|
+
function Ht({
|
|
3119
|
+
group: e,
|
|
3120
|
+
nextGroupSize: t,
|
|
3121
|
+
prevGroupSize: n,
|
|
3122
|
+
prevLayout: o
|
|
3123
|
+
}) {
|
|
3124
|
+
if (n <= 0 || t <= 0 || n === t)
|
|
3125
|
+
return o;
|
|
3126
|
+
let i = 0, s = 0, l = false;
|
|
3127
|
+
const r = /* @__PURE__ */ new Map, a = [];
|
|
3128
|
+
for (const m of e.panels) {
|
|
3129
|
+
const d = o[m.id] ?? 0;
|
|
3130
|
+
switch (m.panelConstraints.groupResizeBehavior) {
|
|
3131
|
+
case "preserve-pixel-size": {
|
|
3132
|
+
l = true;
|
|
3133
|
+
const v = d / 100 * n, x = D(v / t * 100);
|
|
3134
|
+
r.set(m.id, x), i += x;
|
|
3135
|
+
break;
|
|
3136
|
+
}
|
|
3137
|
+
case "preserve-relative-size":
|
|
3138
|
+
default: {
|
|
3139
|
+
a.push(m.id), s += d;
|
|
3140
|
+
break;
|
|
3141
|
+
}
|
|
3142
|
+
}
|
|
3143
|
+
}
|
|
3144
|
+
if (!l || a.length === 0)
|
|
3145
|
+
return o;
|
|
3146
|
+
const u = 100 - i, c = { ...o };
|
|
3147
|
+
if (r.forEach((m, d) => {
|
|
3148
|
+
c[d] = m;
|
|
3149
|
+
}), s > 0)
|
|
3150
|
+
for (const m of a) {
|
|
3151
|
+
const d = o[m] ?? 0;
|
|
3152
|
+
c[m] = D(d / s * u);
|
|
3153
|
+
}
|
|
3154
|
+
else {
|
|
3155
|
+
const m = D(u / a.length);
|
|
3156
|
+
for (const d of a)
|
|
3157
|
+
c[d] = m;
|
|
3158
|
+
}
|
|
3159
|
+
return c;
|
|
3160
|
+
}
|
|
3161
|
+
function Vt(e, t) {
|
|
3162
|
+
const n = e.map((i) => i.id), o = Object.keys(t);
|
|
3163
|
+
if (n.length !== o.length)
|
|
3164
|
+
return false;
|
|
3165
|
+
for (const i of n)
|
|
3166
|
+
if (!o.includes(i))
|
|
3167
|
+
return false;
|
|
3168
|
+
return true;
|
|
3169
|
+
}
|
|
3170
|
+
var q = /* @__PURE__ */ new Map;
|
|
3171
|
+
function jt(e) {
|
|
3172
|
+
let t = true;
|
|
3173
|
+
L(e.element.ownerDocument.defaultView, "Cannot register an unmounted Group");
|
|
3174
|
+
const n = e.element.ownerDocument.defaultView.ResizeObserver, o = /* @__PURE__ */ new Set, i = /* @__PURE__ */ new Set, s = new n((f) => {
|
|
3175
|
+
for (const h of f) {
|
|
3176
|
+
const { borderBoxSize: g, target: y } = h;
|
|
3177
|
+
if (y === e.element) {
|
|
3178
|
+
if (t) {
|
|
3179
|
+
const z = Q({ group: e });
|
|
3180
|
+
if (z === 0)
|
|
3181
|
+
return;
|
|
3182
|
+
const S = $(e.id);
|
|
3183
|
+
if (!S)
|
|
3184
|
+
return;
|
|
3185
|
+
const p = ge(e), P = S.defaultLayoutDeferred ? je(p) : S.layout, R = Ht({
|
|
3186
|
+
group: e,
|
|
3187
|
+
nextGroupSize: z,
|
|
3188
|
+
prevGroupSize: S.groupSize,
|
|
3189
|
+
prevLayout: P
|
|
3190
|
+
}), C = B({
|
|
3191
|
+
layout: R,
|
|
3192
|
+
panelConstraints: p
|
|
3193
|
+
});
|
|
3194
|
+
if (!S.defaultLayoutDeferred && j(S.layout, C) && $t(S.derivedPanelConstraints, p) && S.groupSize === z)
|
|
3195
|
+
return;
|
|
3196
|
+
_(e, {
|
|
3197
|
+
defaultLayoutDeferred: false,
|
|
3198
|
+
derivedPanelConstraints: p,
|
|
3199
|
+
groupSize: z,
|
|
3200
|
+
layout: C,
|
|
3201
|
+
separatorToPanels: S.separatorToPanels
|
|
3202
|
+
});
|
|
3203
|
+
}
|
|
3204
|
+
} else
|
|
3205
|
+
Ft(e, y, g);
|
|
3206
|
+
}
|
|
3207
|
+
});
|
|
3208
|
+
s.observe(e.element), e.panels.forEach((f) => {
|
|
3209
|
+
L(!o.has(f.id), `Panel ids must be unique; id "${f.id}" was used more than once`), o.add(f.id), f.onResize && s.observe(f.element);
|
|
3210
|
+
});
|
|
3211
|
+
const l = Q({ group: e }), r = ge(e), a = e.panels.map(({ id: f }) => f).join(",");
|
|
3212
|
+
let u = e.mutableState.defaultLayout;
|
|
3213
|
+
u && (Vt(e.panels, u) || (u = undefined));
|
|
3214
|
+
const c = e.mutableState.layouts[a] ?? u ?? je(r), m = B({
|
|
3215
|
+
layout: c,
|
|
3216
|
+
panelConstraints: r
|
|
3217
|
+
}), d = e.element.ownerDocument;
|
|
3218
|
+
q.set(d, (q.get(d) ?? 0) + 1);
|
|
3219
|
+
const v = /* @__PURE__ */ new Map;
|
|
3220
|
+
return Ye(e).forEach((f) => {
|
|
3221
|
+
f.separator && v.set(f.separator, f.panels);
|
|
3222
|
+
}), _(e, {
|
|
3223
|
+
defaultLayoutDeferred: l === 0,
|
|
3224
|
+
derivedPanelConstraints: r,
|
|
3225
|
+
groupSize: l,
|
|
3226
|
+
layout: m,
|
|
3227
|
+
separatorToPanels: v
|
|
3228
|
+
}), e.separators.forEach((f) => {
|
|
3229
|
+
L(!i.has(f.id), `Separator ids must be unique; id "${f.id}" was used more than once`), i.add(f.id), f.element.addEventListener("keydown", Te);
|
|
3230
|
+
}), q.get(d) === 1 && (d.addEventListener("dblclick", De, true), d.addEventListener("pointerdown", Oe, true), d.addEventListener("pointerleave", Fe), d.addEventListener("pointermove", $e), d.addEventListener("pointerout", He), d.addEventListener("pointerup", Ve, true)), function() {
|
|
3231
|
+
t = false, q.set(d, Math.max(0, (q.get(d) ?? 0) - 1)), Lt(e), e.separators.forEach((h) => {
|
|
3232
|
+
h.element.removeEventListener("keydown", Te);
|
|
3233
|
+
}), q.get(d) || (d.removeEventListener("dblclick", De, true), d.removeEventListener("pointerdown", Oe, true), d.removeEventListener("pointerleave", Fe), d.removeEventListener("pointermove", $e), d.removeEventListener("pointerout", He), d.removeEventListener("pointerup", Ve, true)), s.disconnect();
|
|
3234
|
+
};
|
|
3235
|
+
}
|
|
3236
|
+
function Bt() {
|
|
3237
|
+
const [e, t] = re({}), n = ne(() => t({}), []);
|
|
3238
|
+
return [e, n];
|
|
3239
|
+
}
|
|
3240
|
+
function xe(e) {
|
|
3241
|
+
const t = pt();
|
|
3242
|
+
return `${e ?? t}`;
|
|
3243
|
+
}
|
|
3244
|
+
var K = typeof window < "u" ? Be : de;
|
|
3245
|
+
function oe(e) {
|
|
3246
|
+
const t = T(e);
|
|
3247
|
+
return K(() => {
|
|
3248
|
+
t.current = e;
|
|
3249
|
+
}, [e]), ne((...n) => t.current?.(...n), [t]);
|
|
3250
|
+
}
|
|
3251
|
+
function we(...e) {
|
|
3252
|
+
return oe((t) => {
|
|
3253
|
+
e.forEach((n) => {
|
|
3254
|
+
if (n)
|
|
3255
|
+
switch (typeof n) {
|
|
3256
|
+
case "function": {
|
|
3257
|
+
n(t);
|
|
3258
|
+
break;
|
|
3259
|
+
}
|
|
3260
|
+
case "object": {
|
|
3261
|
+
n.current = t;
|
|
3262
|
+
break;
|
|
3263
|
+
}
|
|
3264
|
+
}
|
|
3265
|
+
});
|
|
3266
|
+
});
|
|
3267
|
+
}
|
|
3268
|
+
function Pe(e) {
|
|
3269
|
+
const t = T({ ...e });
|
|
3270
|
+
return K(() => {
|
|
3271
|
+
for (const n in e)
|
|
3272
|
+
t.current[n] = e[n];
|
|
3273
|
+
}, [e]), t.current;
|
|
3274
|
+
}
|
|
3275
|
+
var at = ht(null);
|
|
3276
|
+
function Wt(e, t) {
|
|
3277
|
+
const n = T({
|
|
3278
|
+
getLayout: () => ({}),
|
|
3279
|
+
setLayout: Nt
|
|
3280
|
+
});
|
|
3281
|
+
We(t, () => n.current, []), K(() => {
|
|
3282
|
+
Object.assign(n.current, tt({ groupId: e }));
|
|
3283
|
+
});
|
|
3284
|
+
}
|
|
3285
|
+
function Ut({
|
|
3286
|
+
children: e,
|
|
3287
|
+
className: t,
|
|
3288
|
+
defaultLayout: n,
|
|
3289
|
+
disableCursor: o,
|
|
3290
|
+
disabled: i,
|
|
3291
|
+
elementRef: s,
|
|
3292
|
+
groupRef: l,
|
|
3293
|
+
id: r,
|
|
3294
|
+
onLayoutChange: a,
|
|
3295
|
+
onLayoutChanged: u,
|
|
3296
|
+
orientation: c = "horizontal",
|
|
3297
|
+
resizeTargetMinimumSize: m = {
|
|
3298
|
+
coarse: 20,
|
|
3299
|
+
fine: 10
|
|
3300
|
+
},
|
|
3301
|
+
style: d,
|
|
3302
|
+
...v
|
|
3303
|
+
}) {
|
|
3304
|
+
const x = T({
|
|
3305
|
+
onLayoutChange: {},
|
|
3306
|
+
onLayoutChanged: {}
|
|
3307
|
+
}), f = oe((b) => {
|
|
3308
|
+
j(x.current.onLayoutChange, b) || (x.current.onLayoutChange = b, a?.(b));
|
|
3309
|
+
}), h = oe((b) => {
|
|
3310
|
+
j(x.current.onLayoutChanged, b) || (x.current.onLayoutChanged = b, u?.(b));
|
|
3311
|
+
}), g = xe(r), y = T(null), [z, S] = Bt(), p = T({
|
|
3312
|
+
lastExpandedPanelSizes: {},
|
|
3313
|
+
layouts: {},
|
|
3314
|
+
panels: [],
|
|
3315
|
+
resizeTargetMinimumSize: m,
|
|
3316
|
+
separators: []
|
|
3317
|
+
}), P = we(y, s);
|
|
3318
|
+
Wt(g, l);
|
|
3319
|
+
const R = oe((b, w) => {
|
|
3320
|
+
const E = W(), M = Me(b), k = $(b);
|
|
3321
|
+
if (k) {
|
|
3322
|
+
let O = false;
|
|
3323
|
+
switch (E.state) {
|
|
3324
|
+
case "active": {
|
|
3325
|
+
O = E.hitRegions.some((H) => H.group === M);
|
|
3326
|
+
break;
|
|
3327
|
+
}
|
|
3328
|
+
}
|
|
3329
|
+
return {
|
|
3330
|
+
flexGrow: k.layout[w] ?? 1,
|
|
3331
|
+
pointerEvents: O ? "none" : undefined
|
|
3332
|
+
};
|
|
3333
|
+
}
|
|
3334
|
+
return {
|
|
3335
|
+
flexGrow: n?.[w] ?? 1
|
|
3336
|
+
};
|
|
3337
|
+
}), C = Pe({
|
|
3338
|
+
defaultLayout: n,
|
|
3339
|
+
disableCursor: o
|
|
3340
|
+
}), X2 = Ue(() => ({
|
|
3341
|
+
get disableCursor() {
|
|
3342
|
+
return !!C.disableCursor;
|
|
3343
|
+
},
|
|
3344
|
+
getPanelStyles: R,
|
|
3345
|
+
id: g,
|
|
3346
|
+
orientation: c,
|
|
3347
|
+
registerPanel: (b) => {
|
|
3348
|
+
const w = p.current;
|
|
3349
|
+
return w.panels = Se(c, [
|
|
3350
|
+
...w.panels,
|
|
3351
|
+
b
|
|
3352
|
+
]), S(), () => {
|
|
3353
|
+
w.panels = w.panels.filter((E) => E !== b), S();
|
|
3354
|
+
};
|
|
3355
|
+
},
|
|
3356
|
+
registerSeparator: (b) => {
|
|
3357
|
+
const w = p.current;
|
|
3358
|
+
return w.separators = Se(c, [
|
|
3359
|
+
...w.separators,
|
|
3360
|
+
b
|
|
3361
|
+
]), S(), () => {
|
|
3362
|
+
w.separators = w.separators.filter((E) => E !== b), S();
|
|
3363
|
+
};
|
|
3364
|
+
},
|
|
3365
|
+
togglePanelDisabled: (b, w) => {
|
|
3366
|
+
const M = p.current.panels.find((H) => H.id === b);
|
|
3367
|
+
M && (M.panelConstraints.disabled = w);
|
|
3368
|
+
const k = Me(g), O = $(g);
|
|
3369
|
+
k && O && _(k, {
|
|
3370
|
+
...O,
|
|
3371
|
+
derivedPanelConstraints: ge(k)
|
|
3372
|
+
});
|
|
3373
|
+
},
|
|
3374
|
+
toggleSeparatorDisabled: (b, w) => {
|
|
3375
|
+
const M = p.current.separators.find((k) => k.id === b);
|
|
3376
|
+
M && (M.disabled = w);
|
|
3377
|
+
}
|
|
3378
|
+
}), [R, g, S, c, C]), F = T(null);
|
|
3379
|
+
return K(() => {
|
|
3380
|
+
const b = y.current;
|
|
3381
|
+
if (b === null)
|
|
3382
|
+
return;
|
|
3383
|
+
const w = p.current;
|
|
3384
|
+
let E;
|
|
3385
|
+
if (C.defaultLayout !== undefined && Object.keys(C.defaultLayout).length === w.panels.length) {
|
|
3386
|
+
E = {};
|
|
3387
|
+
for (const ee of w.panels) {
|
|
3388
|
+
const ae = C.defaultLayout[ee.id];
|
|
3389
|
+
ae !== undefined && (E[ee.id] = ae);
|
|
3390
|
+
}
|
|
3391
|
+
}
|
|
3392
|
+
const M = {
|
|
3393
|
+
disabled: !!i,
|
|
3394
|
+
element: b,
|
|
3395
|
+
id: g,
|
|
3396
|
+
mutableState: {
|
|
3397
|
+
defaultLayout: E,
|
|
3398
|
+
disableCursor: !!C.disableCursor,
|
|
3399
|
+
expandedPanelSizes: p.current.lastExpandedPanelSizes,
|
|
3400
|
+
layouts: p.current.layouts
|
|
3401
|
+
},
|
|
3402
|
+
orientation: c,
|
|
3403
|
+
panels: w.panels,
|
|
3404
|
+
resizeTargetMinimumSize: w.resizeTargetMinimumSize,
|
|
3405
|
+
separators: w.separators
|
|
3406
|
+
};
|
|
3407
|
+
F.current = M;
|
|
3408
|
+
const k = jt(M), { defaultLayoutDeferred: O, derivedPanelConstraints: H, layout: Ce } = $(M.id, true);
|
|
3409
|
+
!O && H.length > 0 && (f(Ce), h(Ce));
|
|
3410
|
+
const lt = ye(g, (ee) => {
|
|
3411
|
+
const { defaultLayoutDeferred: ae, derivedPanelConstraints: Re, layout: le } = ee.next;
|
|
3412
|
+
if (ae || Re.length === 0)
|
|
3413
|
+
return;
|
|
3414
|
+
const ut = M.panels.map(({ id: N }) => N).join(",");
|
|
3415
|
+
M.mutableState.layouts[ut] = le, Re.forEach((N) => {
|
|
3416
|
+
if (N.collapsible) {
|
|
3417
|
+
const { layout: pe } = ee.prev ?? {};
|
|
3418
|
+
if (pe) {
|
|
3419
|
+
const ft = I(N.collapsedSize, le[N.panelId]), dt = I(N.collapsedSize, pe[N.panelId]);
|
|
3420
|
+
ft && !dt && (M.mutableState.expandedPanelSizes[N.panelId] = pe[N.panelId]);
|
|
3421
|
+
}
|
|
3422
|
+
}
|
|
3423
|
+
});
|
|
3424
|
+
const ct = W().state !== "active";
|
|
3425
|
+
f(le), ct && h(le);
|
|
3426
|
+
});
|
|
3427
|
+
return () => {
|
|
3428
|
+
F.current = null, k(), lt();
|
|
3429
|
+
};
|
|
3430
|
+
}, [
|
|
3431
|
+
i,
|
|
3432
|
+
g,
|
|
3433
|
+
h,
|
|
3434
|
+
f,
|
|
3435
|
+
c,
|
|
3436
|
+
z,
|
|
3437
|
+
C
|
|
3438
|
+
]), de(() => {
|
|
3439
|
+
const b = F.current;
|
|
3440
|
+
b && (b.mutableState.defaultLayout = n, b.mutableState.disableCursor = !!o);
|
|
3441
|
+
}), /* @__PURE__ */ ie(at.Provider, { value: X2, children: /* @__PURE__ */ ie("div", {
|
|
3442
|
+
...v,
|
|
3443
|
+
className: t,
|
|
3444
|
+
"data-group": true,
|
|
3445
|
+
"data-testid": g,
|
|
3446
|
+
id: g,
|
|
3447
|
+
ref: P,
|
|
3448
|
+
style: {
|
|
3449
|
+
height: "100%",
|
|
3450
|
+
width: "100%",
|
|
3451
|
+
overflow: "hidden",
|
|
3452
|
+
...d,
|
|
3453
|
+
display: "flex",
|
|
3454
|
+
flexDirection: c === "horizontal" ? "row" : "column",
|
|
3455
|
+
flexWrap: "nowrap",
|
|
3456
|
+
touchAction: c === "horizontal" ? "pan-y" : "pan-x"
|
|
3457
|
+
},
|
|
3458
|
+
children: e
|
|
3459
|
+
}) });
|
|
3460
|
+
}
|
|
3461
|
+
Ut.displayName = "Group";
|
|
3462
|
+
function Le() {
|
|
3463
|
+
const e = mt(at);
|
|
3464
|
+
return L(e, "Group Context not found; did you render a Panel or Separator outside of a Group?"), e;
|
|
3465
|
+
}
|
|
3466
|
+
function Xt(e, t) {
|
|
3467
|
+
const { id: n } = Le(), o = T({
|
|
3468
|
+
collapse: he,
|
|
3469
|
+
expand: he,
|
|
3470
|
+
getSize: () => ({
|
|
3471
|
+
asPercentage: 0,
|
|
3472
|
+
inPixels: 0
|
|
3473
|
+
}),
|
|
3474
|
+
isCollapsed: () => false,
|
|
3475
|
+
resize: he
|
|
3476
|
+
});
|
|
3477
|
+
We(t, () => o.current, []), K(() => {
|
|
3478
|
+
Object.assign(o.current, et({ groupId: n, panelId: e }));
|
|
3479
|
+
});
|
|
3480
|
+
}
|
|
3481
|
+
function qt({
|
|
3482
|
+
children: e,
|
|
3483
|
+
className: t,
|
|
3484
|
+
collapsedSize: n = "0%",
|
|
3485
|
+
collapsible: o = false,
|
|
3486
|
+
defaultSize: i,
|
|
3487
|
+
disabled: s,
|
|
3488
|
+
elementRef: l,
|
|
3489
|
+
groupResizeBehavior: r = "preserve-relative-size",
|
|
3490
|
+
id: a,
|
|
3491
|
+
maxSize: u = "100%",
|
|
3492
|
+
minSize: c = "0%",
|
|
3493
|
+
onResize: m,
|
|
3494
|
+
panelRef: d,
|
|
3495
|
+
style: v,
|
|
3496
|
+
...x
|
|
3497
|
+
}) {
|
|
3498
|
+
const f = !!a, h = xe(a), g = Pe({
|
|
3499
|
+
disabled: s
|
|
3500
|
+
}), y = T(null), z = we(y, l), {
|
|
3501
|
+
getPanelStyles: S,
|
|
3502
|
+
id: p,
|
|
3503
|
+
orientation: P,
|
|
3504
|
+
registerPanel: R,
|
|
3505
|
+
togglePanelDisabled: C
|
|
3506
|
+
} = Le(), X2 = m !== null, F = oe((w, E, M) => {
|
|
3507
|
+
m?.(w, a, M);
|
|
3508
|
+
});
|
|
3509
|
+
K(() => {
|
|
3510
|
+
const w = y.current;
|
|
3511
|
+
if (w !== null) {
|
|
3512
|
+
const E = {
|
|
3513
|
+
element: w,
|
|
3514
|
+
id: h,
|
|
3515
|
+
idIsStable: f,
|
|
3516
|
+
mutableValues: {
|
|
3517
|
+
expandToSize: undefined,
|
|
3518
|
+
prevSize: undefined
|
|
3519
|
+
},
|
|
3520
|
+
onResize: X2 ? F : undefined,
|
|
3521
|
+
panelConstraints: {
|
|
3522
|
+
groupResizeBehavior: r,
|
|
3523
|
+
collapsedSize: n,
|
|
3524
|
+
collapsible: o,
|
|
3525
|
+
defaultSize: i,
|
|
3526
|
+
disabled: g.disabled,
|
|
3527
|
+
maxSize: u,
|
|
3528
|
+
minSize: c
|
|
3529
|
+
}
|
|
3530
|
+
};
|
|
3531
|
+
return R(E);
|
|
3532
|
+
}
|
|
3533
|
+
}, [
|
|
3534
|
+
r,
|
|
3535
|
+
n,
|
|
3536
|
+
o,
|
|
3537
|
+
i,
|
|
3538
|
+
X2,
|
|
3539
|
+
h,
|
|
3540
|
+
f,
|
|
3541
|
+
u,
|
|
3542
|
+
c,
|
|
3543
|
+
F,
|
|
3544
|
+
R,
|
|
3545
|
+
g
|
|
3546
|
+
]), de(() => {
|
|
3547
|
+
C(h, !!s);
|
|
3548
|
+
}, [s, h, C]), Xt(h, d);
|
|
3549
|
+
const b = Ke((w) => ye(p, w), () => JSON.stringify(S(p, h)), () => JSON.stringify(S(p, h)));
|
|
3550
|
+
return /* @__PURE__ */ ie("div", {
|
|
3551
|
+
...x,
|
|
3552
|
+
"aria-disabled": s || undefined,
|
|
3553
|
+
"data-panel": true,
|
|
3554
|
+
"data-testid": h,
|
|
3555
|
+
id: h,
|
|
3556
|
+
ref: z,
|
|
3557
|
+
style: {
|
|
3558
|
+
...Yt,
|
|
3559
|
+
display: "flex",
|
|
3560
|
+
flexBasis: 0,
|
|
3561
|
+
flexShrink: 1,
|
|
3562
|
+
overflow: "visible",
|
|
3563
|
+
...JSON.parse(b)
|
|
3564
|
+
},
|
|
3565
|
+
children: /* @__PURE__ */ ie("div", {
|
|
3566
|
+
className: t,
|
|
3567
|
+
style: {
|
|
3568
|
+
maxHeight: "100%",
|
|
3569
|
+
maxWidth: "100%",
|
|
3570
|
+
flexGrow: 1,
|
|
3571
|
+
overflow: "auto",
|
|
3572
|
+
...v,
|
|
3573
|
+
touchAction: P === "horizontal" ? "pan-y" : "pan-x"
|
|
3574
|
+
},
|
|
3575
|
+
children: e
|
|
3576
|
+
})
|
|
3577
|
+
});
|
|
3578
|
+
}
|
|
3579
|
+
qt.displayName = "Panel";
|
|
3580
|
+
var Yt = {
|
|
3581
|
+
minHeight: 0,
|
|
3582
|
+
maxHeight: "100%",
|
|
3583
|
+
height: "auto",
|
|
3584
|
+
minWidth: 0,
|
|
3585
|
+
maxWidth: "100%",
|
|
3586
|
+
width: "auto",
|
|
3587
|
+
border: "none",
|
|
3588
|
+
borderWidth: 0,
|
|
3589
|
+
padding: 0,
|
|
3590
|
+
margin: 0
|
|
3591
|
+
};
|
|
3592
|
+
function Jt({
|
|
3593
|
+
layout: e,
|
|
3594
|
+
panelConstraints: t,
|
|
3595
|
+
panelId: n,
|
|
3596
|
+
panelIndex: o
|
|
3597
|
+
}) {
|
|
3598
|
+
let i, s;
|
|
3599
|
+
const l = e[n], r = t.find((a) => a.panelId === n);
|
|
3600
|
+
if (r) {
|
|
3601
|
+
const a = r.maxSize, u = r.collapsible ? r.collapsedSize : r.minSize, c = [o, o + 1];
|
|
3602
|
+
s = B({
|
|
3603
|
+
layout: se({
|
|
3604
|
+
delta: u - l,
|
|
3605
|
+
initialLayout: e,
|
|
3606
|
+
panelConstraints: t,
|
|
3607
|
+
pivotIndices: c,
|
|
3608
|
+
prevLayout: e
|
|
3609
|
+
}),
|
|
3610
|
+
panelConstraints: t
|
|
3611
|
+
})[n], i = B({
|
|
3612
|
+
layout: se({
|
|
3613
|
+
delta: a - l,
|
|
3614
|
+
initialLayout: e,
|
|
3615
|
+
panelConstraints: t,
|
|
3616
|
+
pivotIndices: c,
|
|
3617
|
+
prevLayout: e
|
|
3618
|
+
}),
|
|
3619
|
+
panelConstraints: t
|
|
3620
|
+
})[n];
|
|
3621
|
+
}
|
|
3622
|
+
return {
|
|
3623
|
+
valueControls: n,
|
|
3624
|
+
valueMax: i,
|
|
3625
|
+
valueMin: s,
|
|
3626
|
+
valueNow: l
|
|
3627
|
+
};
|
|
3628
|
+
}
|
|
3629
|
+
function Zt({
|
|
3630
|
+
children: e,
|
|
3631
|
+
className: t,
|
|
3632
|
+
disabled: n,
|
|
3633
|
+
elementRef: o,
|
|
3634
|
+
id: i,
|
|
3635
|
+
style: s,
|
|
3636
|
+
...l
|
|
3637
|
+
}) {
|
|
3638
|
+
const r = xe(i), a = Pe({
|
|
3639
|
+
disabled: n
|
|
3640
|
+
}), [u, c] = re({}), [m, d] = re("inactive"), v = T(null), x = we(v, o), {
|
|
3641
|
+
disableCursor: f,
|
|
3642
|
+
id: h,
|
|
3643
|
+
orientation: g,
|
|
3644
|
+
registerSeparator: y,
|
|
3645
|
+
toggleSeparatorDisabled: z
|
|
3646
|
+
} = Le(), S = g === "horizontal" ? "vertical" : "horizontal";
|
|
3647
|
+
K(() => {
|
|
3648
|
+
const P = v.current;
|
|
3649
|
+
if (P !== null) {
|
|
3650
|
+
const R = {
|
|
3651
|
+
disabled: a.disabled,
|
|
3652
|
+
element: P,
|
|
3653
|
+
id: r
|
|
3654
|
+
}, C = y(R), X2 = Gt((b) => {
|
|
3655
|
+
d(b.next.state !== "inactive" && b.next.hitRegions.some((w) => w.separator === R) ? b.next.state : "inactive");
|
|
3656
|
+
}), F = ye(h, (b) => {
|
|
3657
|
+
const { derivedPanelConstraints: w, layout: E, separatorToPanels: M } = b.next, k = M.get(R);
|
|
3658
|
+
if (k) {
|
|
3659
|
+
const O = k[0], H = k.indexOf(O);
|
|
3660
|
+
c(Jt({
|
|
3661
|
+
layout: E,
|
|
3662
|
+
panelConstraints: w,
|
|
3663
|
+
panelId: O.id,
|
|
3664
|
+
panelIndex: H
|
|
3665
|
+
}));
|
|
3666
|
+
}
|
|
3667
|
+
});
|
|
3668
|
+
return () => {
|
|
3669
|
+
X2(), F(), C();
|
|
3670
|
+
};
|
|
3671
|
+
}
|
|
3672
|
+
}, [h, r, y, a]), de(() => {
|
|
3673
|
+
z(r, !!n);
|
|
3674
|
+
}, [n, r, z]);
|
|
3675
|
+
let p;
|
|
3676
|
+
return n && !f && (p = "not-allowed"), /* @__PURE__ */ ie("div", {
|
|
3677
|
+
...l,
|
|
3678
|
+
"aria-controls": u.valueControls,
|
|
3679
|
+
"aria-disabled": n || undefined,
|
|
3680
|
+
"aria-orientation": S,
|
|
3681
|
+
"aria-valuemax": u.valueMax,
|
|
3682
|
+
"aria-valuemin": u.valueMin,
|
|
3683
|
+
"aria-valuenow": u.valueNow,
|
|
3684
|
+
children: e,
|
|
3685
|
+
className: t,
|
|
3686
|
+
"data-separator": n ? "disabled" : m,
|
|
3687
|
+
"data-testid": r,
|
|
3688
|
+
id: r,
|
|
3689
|
+
ref: x,
|
|
3690
|
+
role: "separator",
|
|
3691
|
+
style: {
|
|
3692
|
+
flexBasis: "auto",
|
|
3693
|
+
cursor: p,
|
|
3694
|
+
...s,
|
|
3695
|
+
flexGrow: 0,
|
|
3696
|
+
flexShrink: 0,
|
|
3697
|
+
touchAction: "none"
|
|
3698
|
+
},
|
|
3699
|
+
tabIndex: n ? undefined : 0
|
|
3700
|
+
});
|
|
3701
|
+
}
|
|
3702
|
+
Zt.displayName = "Separator";
|
|
3703
|
+
|
|
3704
|
+
// node_modules/@principal-ade/panels/dist/index.esm.js
|
|
3705
|
+
import { flushSync as y, unstable_batchedUpdates as w, createPortal as x } from "react-dom";
|
|
3706
|
+
import { useTheme as C } from "@principal-ade/industry-theme";
|
|
3707
|
+
function S(e2) {
|
|
3708
|
+
return { "--panel-background": e2.colors.background, "--panel-border": e2.colors.border, "--panel-handle": e2.colors.backgroundSecondary, "--panel-handle-hover": e2.colors.backgroundHover, "--panel-handle-active": e2.colors.primary, "--panel-button-bg": e2.colors.surface, "--panel-button-hover": e2.colors.backgroundHover, "--panel-button-border": e2.colors.border, "--panel-button-icon": e2.colors.textSecondary, "--panel-accent-bg": e2.colors.primary + "15" };
|
|
3709
|
+
}
|
|
3710
|
+
var z = ({ primaryContent: t2, secondaryContent: n2, collapsedHeader: r2, collapsed: o2 = true, onCollapsedChange: i2, ratio: a2 = 0.3, onRatioChange: l2, maxRatio: s2 = 0.8, collapsedHeight: c2 = 28, theme: d2, className: u2 = "", style: p2, animationDuration: h2 = 200, onCollapseStart: m2, onCollapseComplete: f2, onExpandStart: g, onExpandComplete: v }) => {
|
|
3711
|
+
const b = S(d2);
|
|
3712
|
+
return n2 ? /* @__PURE__ */ e(D2, { primaryContent: t2, secondaryContent: n2, collapsedHeader: r2 ?? { title: "Content" }, collapsed: o2, onCollapsedChange: i2 ?? (() => {}), ratio: a2, onRatioChange: l2 ?? (() => {}), maxRatio: s2, collapsedHeight: c2, theme: d2, className: u2, style: p2, animationDuration: h2, onCollapseStart: m2, onCollapseComplete: f2, onExpandStart: g, onExpandComplete: v }) : /* @__PURE__ */ e("div", { className: `collapsible-split-pane ${u2}`, style: { ...b, ...p2 }, children: /* @__PURE__ */ e("div", { className: "csp-primary-content-full", children: t2 }) });
|
|
3713
|
+
};
|
|
3714
|
+
var D2 = ({ primaryContent: n2, secondaryContent: r2, collapsedHeader: s2, collapsed: c2, onCollapsedChange: d2, ratio: u2, onRatioChange: p2, maxRatio: h2 = 0.8, collapsedHeight: m2 = 28, theme: f2, className: y2 = "", style: w2, animationDuration: x2 = 200, onCollapseStart: C2, onCollapseComplete: R, onExpandStart: N, onExpandComplete: E }) => {
|
|
3715
|
+
const [z2, D3] = o(false), [M, T2] = o(false), A2 = i(null), k = i(undefined), L2 = i(undefined), $2 = i(u2), P = i(false), F = i(c2), B2 = (e2) => 100 * e2;
|
|
3716
|
+
l(() => {
|
|
3717
|
+
F.current = c2;
|
|
3718
|
+
}, [c2]), l(() => {
|
|
3719
|
+
!c2 && u2 > 0 && ($2.current = u2);
|
|
3720
|
+
}, [c2, u2]);
|
|
3721
|
+
const O = a((e2, t2, n3) => {
|
|
3722
|
+
if (!A2.current)
|
|
3723
|
+
return;
|
|
3724
|
+
k.current && cancelAnimationFrame(k.current), L2.current = performance.now();
|
|
3725
|
+
const r3 = (o2) => {
|
|
3726
|
+
if (!L2.current || !A2.current)
|
|
3727
|
+
return;
|
|
3728
|
+
const i2 = o2 - L2.current, a2 = Math.min(i2 / x2, 1), l2 = a2 < 0.5 ? 4 * a2 * a2 * a2 : 1 - Math.pow(-2 * a2 + 2, 3) / 2, s3 = e2 + (t2 - e2) * l2;
|
|
3729
|
+
A2.current.resize(`${s3}%`), a2 < 1 ? k.current = requestAnimationFrame(r3) : (A2.current.resize(`${t2}%`), n3 && n3(), P.current = false, D3(false));
|
|
3730
|
+
};
|
|
3731
|
+
k.current = requestAnimationFrame(r3);
|
|
3732
|
+
}, [x2]), I2 = a(() => {
|
|
3733
|
+
if (z2 || M || !A2.current)
|
|
3734
|
+
return;
|
|
3735
|
+
u2 > 0 && ($2.current = u2), P.current = true, D3(true), C2?.();
|
|
3736
|
+
const e2 = B2(u2);
|
|
3737
|
+
O(e2, 0, () => {
|
|
3738
|
+
F.current = true, d2(true), R?.();
|
|
3739
|
+
});
|
|
3740
|
+
}, [z2, M, u2, O, d2, C2, R]), q2 = a(() => {
|
|
3741
|
+
if (z2 || M || !A2.current)
|
|
3742
|
+
return;
|
|
3743
|
+
P.current = true, D3(true), N?.();
|
|
3744
|
+
const e2 = $2.current || u2 || 0.3, t2 = B2(e2);
|
|
3745
|
+
O(0, t2, () => {
|
|
3746
|
+
F.current = false, d2(false), p2(e2), E?.();
|
|
3747
|
+
});
|
|
3748
|
+
}, [z2, M, u2, O, d2, p2, N, E]), W2 = a(() => {
|
|
3749
|
+
c2 ? q2() : I2();
|
|
3750
|
+
}, [c2, I2, q2]), H = a((e2) => {
|
|
3751
|
+
if (P.current)
|
|
3752
|
+
return;
|
|
3753
|
+
const t2 = e2.asPercentage / 100;
|
|
3754
|
+
t2 <= 0.01 && !F.current ? ($2.current = 0.4, F.current = true, d2(true)) : t2 > 0.01 && F.current && (F.current = false, d2(false)), F.current || p2(t2);
|
|
3755
|
+
}, [p2, d2]), j2 = a(() => {
|
|
3756
|
+
z2 || T2(true);
|
|
3757
|
+
}, [z2]), K2 = a(() => {
|
|
3758
|
+
T2(false);
|
|
3759
|
+
}, []);
|
|
3760
|
+
l(() => {
|
|
3761
|
+
if (c2 && !z2 && A2.current) {
|
|
3762
|
+
A2.current.getSize().asPercentage > 0 && I2();
|
|
3763
|
+
} else if (!c2 && !z2 && A2.current) {
|
|
3764
|
+
A2.current.getSize().asPercentage === 0 && q2();
|
|
3765
|
+
}
|
|
3766
|
+
}, [c2]), l(() => () => {
|
|
3767
|
+
k.current && cancelAnimationFrame(k.current);
|
|
3768
|
+
}, []);
|
|
3769
|
+
const U2 = S(f2), X2 = ["csp-secondary-panel", z2 && !M ? "csp-animating" : "", c2 ? "csp-collapsed" : ""].filter(Boolean).join(" ");
|
|
3770
|
+
return t("div", { className: `collapsible-split-pane ${y2}`, style: { ...U2, ...w2 }, children: [
|
|
3771
|
+
/* @__PURE__ */ t("div", { className: "csp-header " + (c2 ? "csp-header-collapsed" : ""), style: { height: m2, backgroundColor: f2.colors.backgroundSecondary, borderBottom: `1px solid ${f2.colors.border}` }, onClick: c2 ? W2 : undefined, role: c2 ? "button" : undefined, tabIndex: c2 ? 0 : undefined, onKeyDown: c2 ? (e2) => {
|
|
3772
|
+
e2.key !== "Enter" && e2.key !== " " || (e2.preventDefault(), W2());
|
|
3773
|
+
} : undefined, "aria-expanded": !c2, "aria-label": c2 ? `Expand ${s2.title}` : s2.title, children: [
|
|
3774
|
+
s2.icon && /* @__PURE__ */ e("span", { className: "csp-header-icon", style: { color: f2.colors.textSecondary }, children: s2.icon }),
|
|
3775
|
+
/* @__PURE__ */ e("span", { className: "csp-header-title", style: { color: f2.colors.text, fontFamily: f2.fonts.body, fontSize: f2.fontSizes[1], fontWeight: f2.fontWeights.medium }, children: s2.title }),
|
|
3776
|
+
/* @__PURE__ */ e("button", { className: "csp-header-toggle", style: { color: f2.colors.textSecondary }, onClick: (e2) => {
|
|
3777
|
+
e2.stopPropagation(), W2();
|
|
3778
|
+
}, "aria-label": c2 ? `Expand ${s2.title}` : `Collapse ${s2.title}`, children: /* @__PURE__ */ e("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: /* @__PURE__ */ e("path", { d: c2 ? "M3 5L6 8L9 5" : "M3 7L6 4L9 7" }) }) })
|
|
3779
|
+
] }),
|
|
3780
|
+
/* @__PURE__ */ e("div", { className: "csp-content-area", children: /* @__PURE__ */ t(Ut, { orientation: "vertical", onLayoutChange: j2, onLayoutChanged: K2, children: [
|
|
3781
|
+
/* @__PURE__ */ e(qt, { panelRef: A2, defaultSize: c2 ? "0%" : `${B2(u2)}%`, minSize: "0%", maxSize: `${B2(h2)}%`, onResize: H, className: X2, children: /* @__PURE__ */ e("div", { className: "csp-secondary-body", children: r2 }) }),
|
|
3782
|
+
/* @__PURE__ */ e(Zt, { className: "csp-resize-handle", children: /* @__PURE__ */ e("div", { className: "csp-resize-handle-bar" }) }),
|
|
3783
|
+
/* @__PURE__ */ e(qt, { className: "csp-primary-panel", minSize: "20%", children: /* @__PURE__ */ e("div", { className: "csp-panel-content", children: n2 }) })
|
|
3784
|
+
] }) })
|
|
3785
|
+
] });
|
|
3786
|
+
};
|
|
3787
|
+
var A2 = s(null);
|
|
3788
|
+
var F = d(({ panels: o2, className: a2 = "", style: s2, theme: c2, minPanelWidth: d2 = 350, idealPanelWidth: p2 = 0.333, showSeparator: h2 = false, onPanelChange: m2, preventKeyboardScroll: f2 = true, disableSwipe: g = false }, v) => {
|
|
3789
|
+
const b = i(null), y2 = i(false), w2 = i(null), x2 = S(c2);
|
|
3790
|
+
u(v, () => ({ scrollToPanel: (e2) => {
|
|
3791
|
+
if (!b.current)
|
|
3792
|
+
return;
|
|
3793
|
+
const t2 = b.current, n2 = t2.children[e2];
|
|
3794
|
+
if (n2) {
|
|
3795
|
+
y2.current = true, w2.current && clearTimeout(w2.current);
|
|
3796
|
+
const e3 = n2.offsetLeft;
|
|
3797
|
+
t2.scrollTo({ left: e3, behavior: "smooth" }), w2.current = setTimeout(() => {
|
|
3798
|
+
y2.current = false;
|
|
3799
|
+
}, 500);
|
|
3800
|
+
}
|
|
3801
|
+
}, getCurrentPanel: () => {
|
|
3802
|
+
if (!b.current || b.current.children.length === 0)
|
|
3803
|
+
return 0;
|
|
3804
|
+
const e2 = b.current, t2 = e2.getBoundingClientRect().left;
|
|
3805
|
+
let n2 = 0, r2 = 1 / 0;
|
|
3806
|
+
for (let o3 = 0;o3 < e2.children.length; o3++) {
|
|
3807
|
+
const i2 = e2.children[o3].getBoundingClientRect(), a3 = Math.abs(i2.left - t2);
|
|
3808
|
+
a3 < r2 && (r2 = a3, n2 = o3);
|
|
3809
|
+
}
|
|
3810
|
+
return n2;
|
|
3811
|
+
} }));
|
|
3812
|
+
l(() => {
|
|
3813
|
+
if (!f2 || !b.current)
|
|
3814
|
+
return;
|
|
3815
|
+
const e2 = b.current, t2 = (e3) => {
|
|
3816
|
+
const t3 = e3.target;
|
|
3817
|
+
if (t3.tagName === "INPUT" || t3.tagName === "TEXTAREA" || t3.tagName === "SELECT" || t3.isContentEditable || t3.closest(".xterm") !== null || t3.closest('[contenteditable="true"]') !== null)
|
|
3818
|
+
return;
|
|
3819
|
+
[" ", "Space", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "PageUp", "PageDown"].includes(e3.key) && e3.preventDefault();
|
|
3820
|
+
};
|
|
3821
|
+
return e2.addEventListener("keydown", t2), () => {
|
|
3822
|
+
e2.removeEventListener("keydown", t2);
|
|
3823
|
+
};
|
|
3824
|
+
}, [f2]), l(() => () => {
|
|
3825
|
+
w2.current && clearTimeout(w2.current);
|
|
3826
|
+
}, []);
|
|
3827
|
+
const C2 = o2.length, R = 2 * d2;
|
|
3828
|
+
let N;
|
|
3829
|
+
N = C2 === 1 || C2 === 2 ? "100%" : `max(${d2}px, ${100 * p2}%)`;
|
|
3830
|
+
const E = r.useId().replace(/:/g, "_");
|
|
3831
|
+
return t(n, { children: [
|
|
3832
|
+
C2 === 2 && /* @__PURE__ */ e("style", { children: `
|
|
3833
|
+
.snap-carousel-container[data-carousel-id="${E}"][data-panel-count="2"] .snap-carousel-panel {
|
|
3834
|
+
width: 100%;
|
|
3835
|
+
}
|
|
3836
|
+
@container (min-width: ${R}px) {
|
|
3837
|
+
.snap-carousel-container[data-carousel-id="${E}"][data-panel-count="2"] .snap-carousel-panel {
|
|
3838
|
+
width: 50%;
|
|
3839
|
+
}
|
|
3840
|
+
}
|
|
3841
|
+
` }),
|
|
3842
|
+
/* @__PURE__ */ e("div", { ref: b, className: `snap-carousel-container ${g ? "swipe-disabled" : ""} ${a2}`, style: { ...x2, ...s2, "--snap-carousel-min-width": `${d2}px`, "--snap-carousel-ideal-width": 100 * p2 + "%", "--snap-carousel-gap": h2 ? "1px" : "0px", "--snap-carousel-panel-width": N, "--snap-carousel-panel-count": C2, "--snap-carousel-two-panel-threshold": `${R}px` }, onScroll: (e2) => {
|
|
3843
|
+
if (!m2 || !b.current || b.current.children.length === 0)
|
|
3844
|
+
return;
|
|
3845
|
+
if (y2.current)
|
|
3846
|
+
return;
|
|
3847
|
+
const t2 = b.current, n2 = t2.getBoundingClientRect().left;
|
|
3848
|
+
let r2 = 0, o3 = 1 / 0;
|
|
3849
|
+
for (let i2 = 0;i2 < t2.children.length; i2++) {
|
|
3850
|
+
const e3 = t2.children[i2].getBoundingClientRect(), a3 = Math.abs(e3.left - n2);
|
|
3851
|
+
a3 < o3 && (o3 = a3, r2 = i2);
|
|
3852
|
+
}
|
|
3853
|
+
m2(r2);
|
|
3854
|
+
}, "data-panel-count": C2, "data-carousel-id": E, children: o2.map((t2, n2) => /* @__PURE__ */ e("div", { className: "snap-carousel-panel", children: t2 }, n2)) })
|
|
3855
|
+
] });
|
|
3856
|
+
});
|
|
3857
|
+
F.displayName = "SnapCarousel";
|
|
3858
|
+
var I2 = typeof window != "undefined" && window.document !== undefined && window.document.createElement !== undefined;
|
|
3859
|
+
function q2(e2) {
|
|
3860
|
+
const t2 = Object.prototype.toString.call(e2);
|
|
3861
|
+
return t2 === "[object Window]" || t2 === "[object global]";
|
|
3862
|
+
}
|
|
3863
|
+
function W2(e2) {
|
|
3864
|
+
return "nodeType" in e2;
|
|
3865
|
+
}
|
|
3866
|
+
function H(e2) {
|
|
3867
|
+
var t2, n2;
|
|
3868
|
+
return e2 ? q2(e2) ? e2 : W2(e2) && (t2 = (n2 = e2.ownerDocument) == null ? undefined : n2.defaultView) != null ? t2 : window : window;
|
|
3869
|
+
}
|
|
3870
|
+
function j2(e2) {
|
|
3871
|
+
const { Document: t2 } = H(e2);
|
|
3872
|
+
return e2 instanceof t2;
|
|
3873
|
+
}
|
|
3874
|
+
function K2(e2) {
|
|
3875
|
+
return !q2(e2) && e2 instanceof H(e2).HTMLElement;
|
|
3876
|
+
}
|
|
3877
|
+
function U2(e2) {
|
|
3878
|
+
return e2 instanceof H(e2).SVGElement;
|
|
3879
|
+
}
|
|
3880
|
+
function X2(e2) {
|
|
3881
|
+
return e2 ? q2(e2) ? e2.document : W2(e2) ? j2(e2) ? e2 : K2(e2) || U2(e2) ? e2.ownerDocument : document : document : document;
|
|
3882
|
+
}
|
|
3883
|
+
function te2(e2) {
|
|
3884
|
+
return function(t2) {
|
|
3885
|
+
for (var n2 = arguments.length, r2 = new Array(n2 > 1 ? n2 - 1 : 0), o2 = 1;o2 < n2; o2++)
|
|
3886
|
+
r2[o2 - 1] = arguments[o2];
|
|
3887
|
+
return r2.reduce((t3, n3) => {
|
|
3888
|
+
const r3 = Object.entries(n3);
|
|
3889
|
+
for (const [o3, i2] of r3) {
|
|
3890
|
+
const n4 = t3[o3];
|
|
3891
|
+
n4 != null && (t3[o3] = n4 + e2 * i2);
|
|
3892
|
+
}
|
|
3893
|
+
return t3;
|
|
3894
|
+
}, { ...t2 });
|
|
3895
|
+
};
|
|
3896
|
+
}
|
|
3897
|
+
var ne2 = /* @__PURE__ */ te2(1);
|
|
3898
|
+
var re2 = /* @__PURE__ */ te2(-1);
|
|
3899
|
+
function oe2(e2) {
|
|
3900
|
+
if (!e2)
|
|
3901
|
+
return false;
|
|
3902
|
+
const { KeyboardEvent: t2 } = H(e2.target);
|
|
3903
|
+
return t2 && e2 instanceof t2;
|
|
3904
|
+
}
|
|
3905
|
+
function ie2(e2) {
|
|
3906
|
+
if (function(e3) {
|
|
3907
|
+
if (!e3)
|
|
3908
|
+
return false;
|
|
3909
|
+
const { TouchEvent: t2 } = H(e3.target);
|
|
3910
|
+
return t2 && e3 instanceof t2;
|
|
3911
|
+
}(e2)) {
|
|
3912
|
+
if (e2.touches && e2.touches.length) {
|
|
3913
|
+
const { clientX: t2, clientY: n2 } = e2.touches[0];
|
|
3914
|
+
return { x: t2, y: n2 };
|
|
3915
|
+
}
|
|
3916
|
+
if (e2.changedTouches && e2.changedTouches.length) {
|
|
3917
|
+
const { clientX: t2, clientY: n2 } = e2.changedTouches[0];
|
|
3918
|
+
return { x: t2, y: n2 };
|
|
3919
|
+
}
|
|
3920
|
+
}
|
|
3921
|
+
return function(e3) {
|
|
3922
|
+
return "clientX" in e3 && "clientY" in e3;
|
|
3923
|
+
}(e2) ? { x: e2.clientX, y: e2.clientY } : null;
|
|
3924
|
+
}
|
|
3925
|
+
var fe2;
|
|
3926
|
+
var ge2;
|
|
3927
|
+
(ge2 = fe2 || (fe2 = {})).DragStart = "dragStart", ge2.DragMove = "dragMove", ge2.DragEnd = "dragEnd", ge2.DragCancel = "dragCancel", ge2.DragOver = "dragOver", ge2.RegisterDroppable = "registerDroppable", ge2.SetDroppableDisabled = "setDroppableDisabled", ge2.UnregisterDroppable = "unregisterDroppable";
|
|
3928
|
+
var be2 = /* @__PURE__ */ Object.freeze({ x: 0, y: 0 });
|
|
3929
|
+
var Me2 = { ignoreTransform: false };
|
|
3930
|
+
function Te2(e2, t2) {
|
|
3931
|
+
t2 === undefined && (t2 = Me2);
|
|
3932
|
+
let n2 = e2.getBoundingClientRect();
|
|
3933
|
+
if (t2.ignoreTransform) {
|
|
3934
|
+
const { transform: t3, transformOrigin: r3 } = H(e2).getComputedStyle(e2);
|
|
3935
|
+
t3 && (n2 = function(e3, t4, n3) {
|
|
3936
|
+
const r4 = function(e4) {
|
|
3937
|
+
if (e4.startsWith("matrix3d(")) {
|
|
3938
|
+
const t5 = e4.slice(9, -1).split(/, /);
|
|
3939
|
+
return { x: +t5[12], y: +t5[13], scaleX: +t5[0], scaleY: +t5[5] };
|
|
3940
|
+
}
|
|
3941
|
+
if (e4.startsWith("matrix(")) {
|
|
3942
|
+
const t5 = e4.slice(7, -1).split(/, /);
|
|
3943
|
+
return { x: +t5[4], y: +t5[5], scaleX: +t5[0], scaleY: +t5[3] };
|
|
3944
|
+
}
|
|
3945
|
+
return null;
|
|
3946
|
+
}(t4);
|
|
3947
|
+
if (!r4)
|
|
3948
|
+
return e3;
|
|
3949
|
+
const { scaleX: o3, scaleY: i3, x: a3, y: l3 } = r4, s3 = e3.left - a3 - (1 - o3) * parseFloat(n3), c2 = e3.top - l3 - (1 - i3) * parseFloat(n3.slice(n3.indexOf(" ") + 1)), d2 = o3 ? e3.width / o3 : e3.width, u2 = i3 ? e3.height / i3 : e3.height;
|
|
3950
|
+
return { width: d2, height: u2, top: c2, right: s3 + d2, bottom: c2 + u2, left: s3 };
|
|
3951
|
+
}(n2, t3, r3));
|
|
3952
|
+
}
|
|
3953
|
+
const { top: r2, left: o2, width: i2, height: a2, bottom: l2, right: s2 } = n2;
|
|
3954
|
+
return { top: r2, left: o2, width: i2, height: a2, bottom: l2, right: s2 };
|
|
3955
|
+
}
|
|
3956
|
+
function Ae2(e2) {
|
|
3957
|
+
return Te2(e2, { ignoreTransform: true });
|
|
3958
|
+
}
|
|
3959
|
+
function ke2(e2, t2) {
|
|
3960
|
+
const n2 = [];
|
|
3961
|
+
return e2 ? function r(o2) {
|
|
3962
|
+
if (t2 != null && n2.length >= t2)
|
|
3963
|
+
return n2;
|
|
3964
|
+
if (!o2)
|
|
3965
|
+
return n2;
|
|
3966
|
+
if (j2(o2) && o2.scrollingElement != null && !n2.includes(o2.scrollingElement))
|
|
3967
|
+
return n2.push(o2.scrollingElement), n2;
|
|
3968
|
+
if (!K2(o2) || U2(o2))
|
|
3969
|
+
return n2;
|
|
3970
|
+
if (n2.includes(o2))
|
|
3971
|
+
return n2;
|
|
3972
|
+
const i2 = H(e2).getComputedStyle(o2);
|
|
3973
|
+
return o2 !== e2 && function(e3, t3) {
|
|
3974
|
+
t3 === undefined && (t3 = H(e3).getComputedStyle(e3));
|
|
3975
|
+
const n3 = /(auto|scroll|overlay)/;
|
|
3976
|
+
return ["overflow", "overflowX", "overflowY"].some((e4) => {
|
|
3977
|
+
const r2 = t3[e4];
|
|
3978
|
+
return typeof r2 == "string" && n3.test(r2);
|
|
3979
|
+
});
|
|
3980
|
+
}(o2, i2) && n2.push(o2), function(e3, t3) {
|
|
3981
|
+
return t3 === undefined && (t3 = H(e3).getComputedStyle(e3)), t3.position === "fixed";
|
|
3982
|
+
}(o2, i2) ? n2 : r(o2.parentNode);
|
|
3983
|
+
}(e2) : n2;
|
|
3984
|
+
}
|
|
3985
|
+
function Le2(e2) {
|
|
3986
|
+
const [t2] = ke2(e2, 1);
|
|
3987
|
+
return t2 != null ? t2 : null;
|
|
3988
|
+
}
|
|
3989
|
+
var Oe2;
|
|
3990
|
+
var Ie2;
|
|
3991
|
+
function qe2(e2) {
|
|
3992
|
+
return !(!I2 || !e2) && e2 === document.scrollingElement;
|
|
3993
|
+
}
|
|
3994
|
+
function We2(e2) {
|
|
3995
|
+
const t2 = { x: 0, y: 0 }, n2 = qe2(e2) ? { height: window.innerHeight, width: window.innerWidth } : { height: e2.clientHeight, width: e2.clientWidth }, r2 = { x: e2.scrollWidth - n2.width, y: e2.scrollHeight - n2.height };
|
|
3996
|
+
return { isTop: e2.scrollTop <= t2.y, isLeft: e2.scrollLeft <= t2.x, isBottom: e2.scrollTop >= r2.y, isRight: e2.scrollLeft >= r2.x, maxScroll: r2, minScroll: t2 };
|
|
3997
|
+
}
|
|
3998
|
+
(Ie2 = Oe2 || (Oe2 = {}))[Ie2.Forward = 1] = "Forward", Ie2[Ie2.Backward = -1] = "Backward";
|
|
3999
|
+
function Ke2(e2) {
|
|
4000
|
+
if (e2 === document.scrollingElement) {
|
|
4001
|
+
const { innerWidth: e3, innerHeight: t3 } = window;
|
|
4002
|
+
return { top: 0, left: 0, right: e3, bottom: t3, width: e3, height: t3 };
|
|
4003
|
+
}
|
|
4004
|
+
const { top: t2, left: n2, right: r2, bottom: o2 } = e2.getBoundingClientRect();
|
|
4005
|
+
return { top: t2, left: n2, right: r2, bottom: o2, width: e2.clientWidth, height: e2.clientHeight };
|
|
4006
|
+
}
|
|
4007
|
+
class Ve2 {
|
|
4008
|
+
constructor(e2) {
|
|
4009
|
+
this.target = undefined, this.listeners = [], this.removeAll = () => {
|
|
4010
|
+
this.listeners.forEach((e3) => {
|
|
4011
|
+
var t2;
|
|
4012
|
+
return (t2 = this.target) == null ? undefined : t2.removeEventListener(...e3);
|
|
4013
|
+
});
|
|
4014
|
+
}, this.target = e2;
|
|
4015
|
+
}
|
|
4016
|
+
add(e2, t2, n2) {
|
|
4017
|
+
var r2;
|
|
4018
|
+
(r2 = this.target) == null || r2.addEventListener(e2, t2, n2), this.listeners.push([e2, t2, n2]);
|
|
4019
|
+
}
|
|
4020
|
+
}
|
|
4021
|
+
function Je2(e2, t2) {
|
|
4022
|
+
const n2 = Math.abs(e2.x), r2 = Math.abs(e2.y);
|
|
4023
|
+
return typeof t2 == "number" ? Math.sqrt(n2 ** 2 + r2 ** 2) > t2 : ("x" in t2) && ("y" in t2) ? n2 > t2.x && r2 > t2.y : ("x" in t2) ? n2 > t2.x : ("y" in t2) && r2 > t2.y;
|
|
4024
|
+
}
|
|
4025
|
+
var Ge2;
|
|
4026
|
+
var _e2;
|
|
4027
|
+
var Qe2;
|
|
4028
|
+
var Ze2;
|
|
4029
|
+
function et2(e2) {
|
|
4030
|
+
e2.preventDefault();
|
|
4031
|
+
}
|
|
4032
|
+
function tt2(e2) {
|
|
4033
|
+
e2.stopPropagation();
|
|
4034
|
+
}
|
|
4035
|
+
(_e2 = Ge2 || (Ge2 = {})).Click = "click", _e2.DragStart = "dragstart", _e2.Keydown = "keydown", _e2.ContextMenu = "contextmenu", _e2.Resize = "resize", _e2.SelectionChange = "selectionchange", _e2.VisibilityChange = "visibilitychange", (Ze2 = Qe2 || (Qe2 = {})).Space = "Space", Ze2.Down = "ArrowDown", Ze2.Right = "ArrowRight", Ze2.Left = "ArrowLeft", Ze2.Up = "ArrowUp", Ze2.Esc = "Escape", Ze2.Enter = "Enter", Ze2.Tab = "Tab";
|
|
4036
|
+
var nt2 = { start: [Qe2.Space, Qe2.Enter], cancel: [Qe2.Esc], end: [Qe2.Space, Qe2.Enter, Qe2.Tab] };
|
|
4037
|
+
var rt2 = (e2, t2) => {
|
|
4038
|
+
let { currentCoordinates: n2 } = t2;
|
|
4039
|
+
switch (e2.code) {
|
|
4040
|
+
case Qe2.Right:
|
|
4041
|
+
return { ...n2, x: n2.x + 25 };
|
|
4042
|
+
case Qe2.Left:
|
|
4043
|
+
return { ...n2, x: n2.x - 25 };
|
|
4044
|
+
case Qe2.Down:
|
|
4045
|
+
return { ...n2, y: n2.y + 25 };
|
|
4046
|
+
case Qe2.Up:
|
|
4047
|
+
return { ...n2, y: n2.y - 25 };
|
|
4048
|
+
}
|
|
4049
|
+
};
|
|
4050
|
+
|
|
4051
|
+
class ot2 {
|
|
4052
|
+
constructor(e2) {
|
|
4053
|
+
this.props = undefined, this.autoScrollEnabled = false, this.referenceCoordinates = undefined, this.listeners = undefined, this.windowListeners = undefined, this.props = e2;
|
|
4054
|
+
const { event: { target: t2 } } = e2;
|
|
4055
|
+
this.props = e2, this.listeners = new Ve2(X2(t2)), this.windowListeners = new Ve2(H(t2)), this.handleKeyDown = this.handleKeyDown.bind(this), this.handleCancel = this.handleCancel.bind(this), this.attach();
|
|
4056
|
+
}
|
|
4057
|
+
attach() {
|
|
4058
|
+
this.handleStart(), this.windowListeners.add(Ge2.Resize, this.handleCancel), this.windowListeners.add(Ge2.VisibilityChange, this.handleCancel), setTimeout(() => this.listeners.add(Ge2.Keydown, this.handleKeyDown));
|
|
4059
|
+
}
|
|
4060
|
+
handleStart() {
|
|
4061
|
+
const { activeNode: e2, onStart: t2 } = this.props, n2 = e2.node.current;
|
|
4062
|
+
n2 && function(e3, t3) {
|
|
4063
|
+
if (t3 === undefined && (t3 = Te2), !e3)
|
|
4064
|
+
return;
|
|
4065
|
+
const { top: n3, left: r2, bottom: o2, right: i2 } = t3(e3);
|
|
4066
|
+
Le2(e3) && (o2 <= 0 || i2 <= 0 || n3 >= window.innerHeight || r2 >= window.innerWidth) && e3.scrollIntoView({ block: "center", inline: "center" });
|
|
4067
|
+
}(n2), t2(be2);
|
|
4068
|
+
}
|
|
4069
|
+
handleKeyDown(e2) {
|
|
4070
|
+
if (oe2(e2)) {
|
|
4071
|
+
const { active: t2, context: n2, options: r2 } = this.props, { keyboardCodes: o2 = nt2, coordinateGetter: i2 = rt2, scrollBehavior: a2 = "smooth" } = r2, { code: l2 } = e2;
|
|
4072
|
+
if (o2.end.includes(l2))
|
|
4073
|
+
return void this.handleEnd(e2);
|
|
4074
|
+
if (o2.cancel.includes(l2))
|
|
4075
|
+
return void this.handleCancel(e2);
|
|
4076
|
+
const { collisionRect: s2 } = n2.current, c2 = s2 ? { x: s2.left, y: s2.top } : be2;
|
|
4077
|
+
this.referenceCoordinates || (this.referenceCoordinates = c2);
|
|
4078
|
+
const d2 = i2(e2, { active: t2, context: n2.current, currentCoordinates: c2 });
|
|
4079
|
+
if (d2) {
|
|
4080
|
+
const t3 = re2(d2, c2), r3 = { x: 0, y: 0 }, { scrollableAncestors: o3 } = n2.current;
|
|
4081
|
+
for (const n3 of o3) {
|
|
4082
|
+
const o4 = e2.code, { isTop: i3, isRight: l3, isLeft: s3, isBottom: c3, maxScroll: u2, minScroll: p2 } = We2(n3), h2 = Ke2(n3), m2 = { x: Math.min(o4 === Qe2.Right ? h2.right - h2.width / 2 : h2.right, Math.max(o4 === Qe2.Right ? h2.left : h2.left + h2.width / 2, d2.x)), y: Math.min(o4 === Qe2.Down ? h2.bottom - h2.height / 2 : h2.bottom, Math.max(o4 === Qe2.Down ? h2.top : h2.top + h2.height / 2, d2.y)) }, f2 = o4 === Qe2.Right && !l3 || o4 === Qe2.Left && !s3, g = o4 === Qe2.Down && !c3 || o4 === Qe2.Up && !i3;
|
|
4083
|
+
if (f2 && m2.x !== d2.x) {
|
|
4084
|
+
const e3 = n3.scrollLeft + t3.x, i4 = o4 === Qe2.Right && e3 <= u2.x || o4 === Qe2.Left && e3 >= p2.x;
|
|
4085
|
+
if (i4 && !t3.y)
|
|
4086
|
+
return void n3.scrollTo({ left: e3, behavior: a2 });
|
|
4087
|
+
r3.x = i4 ? n3.scrollLeft - e3 : o4 === Qe2.Right ? n3.scrollLeft - u2.x : n3.scrollLeft - p2.x, r3.x && n3.scrollBy({ left: -r3.x, behavior: a2 });
|
|
4088
|
+
break;
|
|
4089
|
+
}
|
|
4090
|
+
if (g && m2.y !== d2.y) {
|
|
4091
|
+
const e3 = n3.scrollTop + t3.y, i4 = o4 === Qe2.Down && e3 <= u2.y || o4 === Qe2.Up && e3 >= p2.y;
|
|
4092
|
+
if (i4 && !t3.x)
|
|
4093
|
+
return void n3.scrollTo({ top: e3, behavior: a2 });
|
|
4094
|
+
r3.y = i4 ? n3.scrollTop - e3 : o4 === Qe2.Down ? n3.scrollTop - u2.y : n3.scrollTop - p2.y, r3.y && n3.scrollBy({ top: -r3.y, behavior: a2 });
|
|
4095
|
+
break;
|
|
4096
|
+
}
|
|
4097
|
+
}
|
|
4098
|
+
this.handleMove(e2, ne2(re2(d2, this.referenceCoordinates), r3));
|
|
4099
|
+
}
|
|
1603
4100
|
}
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
4101
|
+
}
|
|
4102
|
+
handleMove(e2, t2) {
|
|
4103
|
+
const { onMove: n2 } = this.props;
|
|
4104
|
+
e2.preventDefault(), n2(t2);
|
|
4105
|
+
}
|
|
4106
|
+
handleEnd(e2) {
|
|
4107
|
+
const { onEnd: t2 } = this.props;
|
|
4108
|
+
e2.preventDefault(), this.detach(), t2();
|
|
4109
|
+
}
|
|
4110
|
+
handleCancel(e2) {
|
|
4111
|
+
const { onCancel: t2 } = this.props;
|
|
4112
|
+
e2.preventDefault(), this.detach(), t2();
|
|
4113
|
+
}
|
|
4114
|
+
detach() {
|
|
4115
|
+
this.listeners.removeAll(), this.windowListeners.removeAll();
|
|
4116
|
+
}
|
|
4117
|
+
}
|
|
4118
|
+
function it2(e2) {
|
|
4119
|
+
return Boolean(e2 && "distance" in e2);
|
|
4120
|
+
}
|
|
4121
|
+
function at2(e2) {
|
|
4122
|
+
return Boolean(e2 && "delay" in e2);
|
|
4123
|
+
}
|
|
4124
|
+
ot2.activators = [{ eventName: "onKeyDown", handler: (e2, t2, n2) => {
|
|
4125
|
+
let { keyboardCodes: r2 = nt2, onActivation: o2 } = t2, { active: i2 } = n2;
|
|
4126
|
+
const { code: a2 } = e2.nativeEvent;
|
|
4127
|
+
if (r2.start.includes(a2)) {
|
|
4128
|
+
const t3 = i2.activatorNode.current;
|
|
4129
|
+
return (!t3 || e2.target === t3) && (e2.preventDefault(), o2 == null || o2({ event: e2.nativeEvent }), true);
|
|
4130
|
+
}
|
|
4131
|
+
return false;
|
|
4132
|
+
} }];
|
|
4133
|
+
|
|
4134
|
+
class lt {
|
|
4135
|
+
constructor(e2, t2, n2) {
|
|
4136
|
+
var r2;
|
|
4137
|
+
n2 === undefined && (n2 = function(e3) {
|
|
4138
|
+
const { EventTarget: t3 } = H(e3);
|
|
4139
|
+
return e3 instanceof t3 ? e3 : X2(e3);
|
|
4140
|
+
}(e2.event.target)), this.props = undefined, this.events = undefined, this.autoScrollEnabled = true, this.document = undefined, this.activated = false, this.initialCoordinates = undefined, this.timeoutId = null, this.listeners = undefined, this.documentListeners = undefined, this.windowListeners = undefined, this.props = e2, this.events = t2;
|
|
4141
|
+
const { event: o2 } = e2, { target: i2 } = o2;
|
|
4142
|
+
this.props = e2, this.events = t2, this.document = X2(i2), this.documentListeners = new Ve2(this.document), this.listeners = new Ve2(n2), this.windowListeners = new Ve2(H(i2)), this.initialCoordinates = (r2 = ie2(o2)) != null ? r2 : be2, this.handleStart = this.handleStart.bind(this), this.handleMove = this.handleMove.bind(this), this.handleEnd = this.handleEnd.bind(this), this.handleCancel = this.handleCancel.bind(this), this.handleKeydown = this.handleKeydown.bind(this), this.removeTextSelection = this.removeTextSelection.bind(this), this.attach();
|
|
4143
|
+
}
|
|
4144
|
+
attach() {
|
|
4145
|
+
const { events: e2, props: { options: { activationConstraint: t2, bypassActivationConstraint: n2 } } } = this;
|
|
4146
|
+
if (this.listeners.add(e2.move.name, this.handleMove, { passive: false }), this.listeners.add(e2.end.name, this.handleEnd), e2.cancel && this.listeners.add(e2.cancel.name, this.handleCancel), this.windowListeners.add(Ge2.Resize, this.handleCancel), this.windowListeners.add(Ge2.DragStart, et2), this.windowListeners.add(Ge2.VisibilityChange, this.handleCancel), this.windowListeners.add(Ge2.ContextMenu, et2), this.documentListeners.add(Ge2.Keydown, this.handleKeydown), t2) {
|
|
4147
|
+
if (n2 != null && n2({ event: this.props.event, activeNode: this.props.activeNode, options: this.props.options }))
|
|
4148
|
+
return this.handleStart();
|
|
4149
|
+
if (at2(t2))
|
|
4150
|
+
return this.timeoutId = setTimeout(this.handleStart, t2.delay), void this.handlePending(t2);
|
|
4151
|
+
if (it2(t2))
|
|
4152
|
+
return void this.handlePending(t2);
|
|
1616
4153
|
}
|
|
1617
|
-
|
|
1618
|
-
useEffect3(() => {
|
|
1619
|
-
hasNotifiedPtyRef.current = false;
|
|
1620
|
-
}, [sessionId]);
|
|
1621
|
-
const handleScrollPositionChange = useCallback2((position) => {
|
|
1622
|
-
setScrollPosition(position);
|
|
1623
|
-
isScrollLockedRef.current = position.isScrollLocked;
|
|
1624
|
-
}, []);
|
|
1625
|
-
const sessionInfo = sessionId ? getTerminalSession(context2, sessionId) : undefined;
|
|
1626
|
-
if (error) {
|
|
1627
|
-
return /* @__PURE__ */ jsxs5("div", {
|
|
1628
|
-
style: {
|
|
1629
|
-
padding: "20px",
|
|
1630
|
-
color: "#ef4444",
|
|
1631
|
-
backgroundColor: "#1a1a1a",
|
|
1632
|
-
height: "100%",
|
|
1633
|
-
display: "flex",
|
|
1634
|
-
alignItems: "center",
|
|
1635
|
-
justifyContent: "center",
|
|
1636
|
-
flexDirection: "column",
|
|
1637
|
-
gap: "10px"
|
|
1638
|
-
},
|
|
1639
|
-
children: [
|
|
1640
|
-
/* @__PURE__ */ jsx6("div", {
|
|
1641
|
-
style: { fontSize: "16px", fontWeight: "bold" },
|
|
1642
|
-
children: "Terminal Error"
|
|
1643
|
-
}),
|
|
1644
|
-
/* @__PURE__ */ jsx6("div", {
|
|
1645
|
-
style: { fontSize: "14px", opacity: 0.8 },
|
|
1646
|
-
children: error
|
|
1647
|
-
})
|
|
1648
|
-
]
|
|
1649
|
-
});
|
|
4154
|
+
this.handleStart();
|
|
1650
4155
|
}
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
style: {
|
|
1654
|
-
padding: "20px",
|
|
1655
|
-
color: "#a0a0a0",
|
|
1656
|
-
backgroundColor: "#1a1a1a",
|
|
1657
|
-
height: "100%",
|
|
1658
|
-
display: "flex",
|
|
1659
|
-
alignItems: "center",
|
|
1660
|
-
justifyContent: "center"
|
|
1661
|
-
},
|
|
1662
|
-
children: "Initializing terminal..."
|
|
1663
|
-
});
|
|
4156
|
+
detach() {
|
|
4157
|
+
this.listeners.removeAll(), this.windowListeners.removeAll(), setTimeout(this.documentListeners.removeAll, 50), this.timeoutId !== null && (clearTimeout(this.timeoutId), this.timeoutId = null);
|
|
1664
4158
|
}
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
4159
|
+
handlePending(e2, t2) {
|
|
4160
|
+
const { active: n2, onPending: r2 } = this.props;
|
|
4161
|
+
r2(n2, e2, this.initialCoordinates, t2);
|
|
4162
|
+
}
|
|
4163
|
+
handleStart() {
|
|
4164
|
+
const { initialCoordinates: e2 } = this, { onStart: t2 } = this.props;
|
|
4165
|
+
e2 && (this.activated = true, this.documentListeners.add(Ge2.Click, tt2, { capture: true }), this.removeTextSelection(), this.documentListeners.add(Ge2.SelectionChange, this.removeTextSelection), t2(e2));
|
|
4166
|
+
}
|
|
4167
|
+
handleMove(e2) {
|
|
4168
|
+
var t2;
|
|
4169
|
+
const { activated: n2, initialCoordinates: r2, props: o2 } = this, { onMove: i2, options: { activationConstraint: a2 } } = o2;
|
|
4170
|
+
if (!r2)
|
|
4171
|
+
return;
|
|
4172
|
+
const l2 = (t2 = ie2(e2)) != null ? t2 : be2, s2 = re2(r2, l2);
|
|
4173
|
+
if (!n2 && a2) {
|
|
4174
|
+
if (it2(a2)) {
|
|
4175
|
+
if (a2.tolerance != null && Je2(s2, a2.tolerance))
|
|
4176
|
+
return this.handleCancel();
|
|
4177
|
+
if (Je2(s2, a2.distance))
|
|
4178
|
+
return this.handleStart();
|
|
1673
4179
|
}
|
|
1674
|
-
|
|
1675
|
-
terminalRef.current?.scrollToBottom();
|
|
4180
|
+
return at2(a2) && Je2(s2, a2.tolerance) ? this.handleCancel() : void this.handlePending(a2, s2);
|
|
1676
4181
|
}
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
onMouseEnter: (e) => !scrollPosition.isAtBottom && (e.currentTarget.style.opacity = "0.8"),
|
|
1751
|
-
onMouseLeave: (e) => !scrollPosition.isAtBottom && (e.currentTarget.style.opacity = "1"),
|
|
1752
|
-
title: "Scroll to bottom and lock",
|
|
1753
|
-
children: [
|
|
1754
|
-
/* @__PURE__ */ jsx6(ArrowDown, {
|
|
1755
|
-
size: 12
|
|
1756
|
-
}),
|
|
1757
|
-
/* @__PURE__ */ jsx6("span", {
|
|
1758
|
-
children: "Bottom"
|
|
1759
|
-
})
|
|
1760
|
-
]
|
|
1761
|
-
})
|
|
1762
|
-
]
|
|
1763
|
-
}),
|
|
1764
|
-
/* @__PURE__ */ jsx6("div", {
|
|
1765
|
-
style: { flex: 1 },
|
|
1766
|
-
children: /* @__PURE__ */ jsx6(ThemedTerminalWithProvider, {
|
|
1767
|
-
ref: terminalRef,
|
|
1768
|
-
onData: handleTerminalData,
|
|
1769
|
-
onResize: handleTerminalResize,
|
|
1770
|
-
onScrollPositionChange: handleScrollPositionChange,
|
|
1771
|
-
hideHeader: true,
|
|
1772
|
-
autoFocus: true,
|
|
1773
|
-
convertEol: true,
|
|
1774
|
-
cursorBlink: true,
|
|
1775
|
-
scrollback: 1e4,
|
|
1776
|
-
enableSearch: true,
|
|
1777
|
-
enableWebLinks: true
|
|
1778
|
-
})
|
|
1779
|
-
})
|
|
1780
|
-
]
|
|
1781
|
-
});
|
|
1782
|
-
};
|
|
4182
|
+
e2.cancelable && e2.preventDefault(), i2(l2);
|
|
4183
|
+
}
|
|
4184
|
+
handleEnd() {
|
|
4185
|
+
const { onAbort: e2, onEnd: t2 } = this.props;
|
|
4186
|
+
this.detach(), this.activated || e2(this.props.active), t2();
|
|
4187
|
+
}
|
|
4188
|
+
handleCancel() {
|
|
4189
|
+
const { onAbort: e2, onCancel: t2 } = this.props;
|
|
4190
|
+
this.detach(), this.activated || e2(this.props.active), t2();
|
|
4191
|
+
}
|
|
4192
|
+
handleKeydown(e2) {
|
|
4193
|
+
e2.code === Qe2.Esc && this.handleCancel();
|
|
4194
|
+
}
|
|
4195
|
+
removeTextSelection() {
|
|
4196
|
+
var e2;
|
|
4197
|
+
(e2 = this.document.getSelection()) == null || e2.removeAllRanges();
|
|
4198
|
+
}
|
|
4199
|
+
}
|
|
4200
|
+
var st2 = { cancel: { name: "pointercancel" }, move: { name: "pointermove" }, end: { name: "pointerup" } };
|
|
4201
|
+
|
|
4202
|
+
class ct extends lt {
|
|
4203
|
+
constructor(e2) {
|
|
4204
|
+
const { event: t2 } = e2, n2 = X2(t2.target);
|
|
4205
|
+
super(e2, st2, n2);
|
|
4206
|
+
}
|
|
4207
|
+
}
|
|
4208
|
+
ct.activators = [{ eventName: "onPointerDown", handler: (e2, t2) => {
|
|
4209
|
+
let { nativeEvent: n2 } = e2, { onActivation: r2 } = t2;
|
|
4210
|
+
return !(!n2.isPrimary || n2.button !== 0) && (r2 == null || r2({ event: n2 }), true);
|
|
4211
|
+
} }];
|
|
4212
|
+
var dt = { move: { name: "mousemove" }, end: { name: "mouseup" } };
|
|
4213
|
+
var ut;
|
|
4214
|
+
var pt2;
|
|
4215
|
+
(pt2 = ut || (ut = {}))[pt2.RightClick = 2] = "RightClick";
|
|
4216
|
+
(class extends lt {
|
|
4217
|
+
constructor(e2) {
|
|
4218
|
+
super(e2, dt, X2(e2.event.target));
|
|
4219
|
+
}
|
|
4220
|
+
}).activators = [{ eventName: "onMouseDown", handler: (e2, t2) => {
|
|
4221
|
+
let { nativeEvent: n2 } = e2, { onActivation: r2 } = t2;
|
|
4222
|
+
return n2.button !== ut.RightClick && (r2 == null || r2({ event: n2 }), true);
|
|
4223
|
+
} }];
|
|
4224
|
+
var ht2 = { cancel: { name: "touchcancel" }, move: { name: "touchmove" }, end: { name: "touchend" } };
|
|
4225
|
+
var mt2;
|
|
4226
|
+
var ft;
|
|
4227
|
+
var gt2;
|
|
4228
|
+
var vt2;
|
|
4229
|
+
(class extends lt {
|
|
4230
|
+
constructor(e2) {
|
|
4231
|
+
super(e2, ht2);
|
|
4232
|
+
}
|
|
4233
|
+
static setup() {
|
|
4234
|
+
return window.addEventListener(ht2.move.name, e2, { capture: false, passive: false }), function() {
|
|
4235
|
+
window.removeEventListener(ht2.move.name, e2);
|
|
4236
|
+
};
|
|
4237
|
+
function e2() {}
|
|
4238
|
+
}
|
|
4239
|
+
}).activators = [{ eventName: "onTouchStart", handler: (e2, t2) => {
|
|
4240
|
+
let { nativeEvent: n2 } = e2, { onActivation: r2 } = t2;
|
|
4241
|
+
const { touches: o2 } = n2;
|
|
4242
|
+
return !(o2.length > 1) && (r2 == null || r2({ event: n2 }), true);
|
|
4243
|
+
} }], (ft = mt2 || (mt2 = {}))[ft.Pointer = 0] = "Pointer", ft[ft.DraggableRect = 1] = "DraggableRect", (vt2 = gt2 || (gt2 = {}))[vt2.TreeOrder = 0] = "TreeOrder", vt2[vt2.ReversedTreeOrder = 1] = "ReversedTreeOrder";
|
|
4244
|
+
var yt2 = { x: { [Oe2.Backward]: false, [Oe2.Forward]: false }, y: { [Oe2.Backward]: false, [Oe2.Forward]: false } };
|
|
4245
|
+
var wt2;
|
|
4246
|
+
var xt2;
|
|
4247
|
+
var Ct2;
|
|
4248
|
+
(xt2 = wt2 || (wt2 = {}))[xt2.Always = 0] = "Always", xt2[xt2.BeforeDragging = 1] = "BeforeDragging", xt2[xt2.WhileDragging = 2] = "WhileDragging", (Ct2 || (Ct2 = {})).Optimized = "optimized";
|
|
4249
|
+
var Pt2 = { draggable: { measure: Ae2 }, droppable: { measure: Ae2, strategy: wt2.WhileDragging, frequency: Ct2.Optimized }, dragOverlay: { measure: Te2 } };
|
|
4250
|
+
var jt2 = /* @__PURE__ */ s({ ...be2, scaleX: 1, scaleY: 1 });
|
|
4251
|
+
var Kt;
|
|
4252
|
+
var Ut2;
|
|
4253
|
+
(Ut2 = Kt || (Kt = {}))[Ut2.Uninitialized = 0] = "Uninitialized", Ut2[Ut2.Initializing = 1] = "Initializing", Ut2[Ut2.Initialized = 2] = "Initialized";
|
|
4254
|
+
|
|
1783
4255
|
// src/panels/TabbedTerminalPanel.tsx
|
|
1784
|
-
import { useTheme as useTheme6 } from "@principal-ade/industry-theme";
|
|
1785
4256
|
import { Terminal as TerminalIcon2, Lock as Lock2, Unlock as Unlock2, Box, Boxes } from "lucide-react";
|
|
1786
|
-
import
|
|
4257
|
+
import React3, {
|
|
1787
4258
|
useState as useState4,
|
|
1788
|
-
useCallback as
|
|
4259
|
+
useCallback as useCallback5,
|
|
1789
4260
|
useEffect as useEffect4,
|
|
1790
4261
|
useRef as useRef3
|
|
1791
4262
|
} from "react";
|
|
@@ -1793,7 +4264,7 @@ import { jsx as jsx7, jsxs as jsxs6, Fragment as Fragment2 } from "react/jsx-run
|
|
|
1793
4264
|
var ActivityIndicator = ({ color, isAnimating }) => /* @__PURE__ */ jsxs6("div", {
|
|
1794
4265
|
style: { display: "flex", gap: 1, alignItems: "center", height: 12 },
|
|
1795
4266
|
children: [
|
|
1796
|
-
[0, 1, 2, 3, 4].map((
|
|
4267
|
+
[0, 1, 2, 3, 4].map((i2) => /* @__PURE__ */ jsx7("div", {
|
|
1797
4268
|
style: {
|
|
1798
4269
|
width: 2,
|
|
1799
4270
|
height: 10,
|
|
@@ -1801,9 +4272,9 @@ var ActivityIndicator = ({ color, isAnimating }) => /* @__PURE__ */ jsxs6("div",
|
|
|
1801
4272
|
borderRadius: 1,
|
|
1802
4273
|
transformOrigin: "center",
|
|
1803
4274
|
transform: isAnimating ? undefined : "scaleY(0.4)",
|
|
1804
|
-
animation: isAnimating ? `waveSine 1.2s ease-in-out ${
|
|
4275
|
+
animation: isAnimating ? `waveSine 1.2s ease-in-out ${i2 * 0.1}s infinite` : "none"
|
|
1805
4276
|
}
|
|
1806
|
-
},
|
|
4277
|
+
}, i2)),
|
|
1807
4278
|
/* @__PURE__ */ jsx7("style", {
|
|
1808
4279
|
children: `
|
|
1809
4280
|
@keyframes waveSine {
|
|
@@ -1830,7 +4301,7 @@ function TerminalTabContentInner(props, ref) {
|
|
|
1830
4301
|
const [shouldRenderTerminal, setShouldRenderTerminal] = useState4(true);
|
|
1831
4302
|
const [ownerWindowId, setOwnerWindowId] = useState4(null);
|
|
1832
4303
|
const needsRefreshOnResizeRef = useRef3(false);
|
|
1833
|
-
const claimAndConnect =
|
|
4304
|
+
const claimAndConnect = useCallback5(async (targetSessionId, force = false) => {
|
|
1834
4305
|
try {
|
|
1835
4306
|
if (actions.claimTerminalOwnership) {
|
|
1836
4307
|
await actions.claimTerminalOwnership(targetSessionId, force);
|
|
@@ -1938,17 +4409,17 @@ function TerminalTabContentInner(props, ref) {
|
|
|
1938
4409
|
unsubscribe();
|
|
1939
4410
|
};
|
|
1940
4411
|
}, [localSessionId, isInitialized, actions, shouldRenderTerminal, tab.id]);
|
|
1941
|
-
const handleData =
|
|
4412
|
+
const handleData = useCallback5((data) => {
|
|
1942
4413
|
if (localSessionId && actions.writeToTerminal) {
|
|
1943
4414
|
actions.writeToTerminal(localSessionId, data);
|
|
1944
4415
|
}
|
|
1945
4416
|
}, [localSessionId, actions]);
|
|
1946
|
-
const handleResize =
|
|
4417
|
+
const handleResize = useCallback5((cols, rows) => {
|
|
1947
4418
|
if (localSessionId && actions.resizeTerminal) {
|
|
1948
4419
|
actions.resizeTerminal(localSessionId, cols, rows);
|
|
1949
4420
|
}
|
|
1950
4421
|
}, [localSessionId, actions]);
|
|
1951
|
-
const handleReady =
|
|
4422
|
+
const handleReady = useCallback5((cols, rows) => {
|
|
1952
4423
|
if (localSessionId && actions.resizeTerminal) {
|
|
1953
4424
|
const shouldForce = needsRefreshOnResizeRef.current;
|
|
1954
4425
|
if (shouldForce) {
|
|
@@ -1957,7 +4428,7 @@ function TerminalTabContentInner(props, ref) {
|
|
|
1957
4428
|
actions.resizeTerminal(localSessionId, cols, rows, shouldForce);
|
|
1958
4429
|
}
|
|
1959
4430
|
}, [localSessionId, actions]);
|
|
1960
|
-
const handleLinkClick =
|
|
4431
|
+
const handleLinkClick = useCallback5((url, modifiers) => {
|
|
1961
4432
|
if (localSessionId) {
|
|
1962
4433
|
events.emit({
|
|
1963
4434
|
type: "terminal:link-click",
|
|
@@ -1988,17 +4459,17 @@ function TerminalTabContentInner(props, ref) {
|
|
|
1988
4459
|
unsubscribe();
|
|
1989
4460
|
};
|
|
1990
4461
|
}, [localSessionId, actions]);
|
|
1991
|
-
const handleTakeControl =
|
|
4462
|
+
const handleTakeControl = useCallback5(async () => {
|
|
1992
4463
|
if (!localSessionId) {
|
|
1993
4464
|
return;
|
|
1994
4465
|
}
|
|
1995
4466
|
await claimAndConnect(localSessionId, true);
|
|
1996
4467
|
}, [localSessionId, claimAndConnect]);
|
|
1997
|
-
const handleScrollPositionChange =
|
|
4468
|
+
const handleScrollPositionChange = useCallback5((position) => {
|
|
1998
4469
|
setScrollPosition(position);
|
|
1999
4470
|
onScrollPositionChange?.(tab.id, position);
|
|
2000
4471
|
}, [tab.id, onScrollPositionChange]);
|
|
2001
|
-
const handleShortcut =
|
|
4472
|
+
const handleShortcut = useCallback5((shortcutEvent) => {
|
|
2002
4473
|
if (localSessionId) {
|
|
2003
4474
|
events.emit({
|
|
2004
4475
|
type: "terminal:shortcut",
|
|
@@ -2011,7 +4482,7 @@ function TerminalTabContentInner(props, ref) {
|
|
|
2011
4482
|
});
|
|
2012
4483
|
}
|
|
2013
4484
|
}, [localSessionId, events]);
|
|
2014
|
-
const handleActivityChange =
|
|
4485
|
+
const handleActivityChange = useCallback5((state) => {
|
|
2015
4486
|
if (localSessionId) {
|
|
2016
4487
|
onActivityStateChange?.(localSessionId, state.isActive);
|
|
2017
4488
|
events.emit({
|
|
@@ -2026,10 +4497,10 @@ function TerminalTabContentInner(props, ref) {
|
|
|
2026
4497
|
});
|
|
2027
4498
|
}
|
|
2028
4499
|
}, [localSessionId, events, onActivityStateChange]);
|
|
2029
|
-
const handleScrollToBottom =
|
|
4500
|
+
const handleScrollToBottom = useCallback5(() => {
|
|
2030
4501
|
terminalRef.current?.scrollToBottom();
|
|
2031
4502
|
}, []);
|
|
2032
|
-
const handleToggleScrollLock =
|
|
4503
|
+
const handleToggleScrollLock = useCallback5(() => {
|
|
2033
4504
|
if (scrollPosition.isScrollLocked) {
|
|
2034
4505
|
const terminal = terminalRef.current?.getTerminal();
|
|
2035
4506
|
if (terminal) {
|
|
@@ -2039,7 +4510,7 @@ function TerminalTabContentInner(props, ref) {
|
|
|
2039
4510
|
terminalRef.current?.scrollToBottom();
|
|
2040
4511
|
}
|
|
2041
4512
|
}, [scrollPosition.isScrollLocked]);
|
|
2042
|
-
|
|
4513
|
+
React3.useImperativeHandle(ref, () => ({
|
|
2043
4514
|
scrollToBottom: handleScrollToBottom,
|
|
2044
4515
|
toggleScrollLock: handleToggleScrollLock
|
|
2045
4516
|
}), [handleScrollToBottom, handleToggleScrollLock]);
|
|
@@ -2142,8 +4613,8 @@ var areTerminalTabContentPropsEqual = (prevProps, nextProps) => {
|
|
|
2142
4613
|
}
|
|
2143
4614
|
return changes.length === 0;
|
|
2144
4615
|
};
|
|
2145
|
-
var TerminalTabContentForwarded =
|
|
2146
|
-
var TerminalTabContent =
|
|
4616
|
+
var TerminalTabContentForwarded = React3.forwardRef(TerminalTabContentInner);
|
|
4617
|
+
var TerminalTabContent = React3.memo(TerminalTabContentForwarded, areTerminalTabContentPropsEqual);
|
|
2147
4618
|
TerminalTabContent.displayName = "TerminalTabContent";
|
|
2148
4619
|
var TabbedTerminalPanelInner = ({
|
|
2149
4620
|
context: _context,
|
|
@@ -2170,7 +4641,15 @@ var TabbedTerminalPanelInner = ({
|
|
|
2170
4641
|
workingStates,
|
|
2171
4642
|
activityDetection = true,
|
|
2172
4643
|
activityTimeout = 500,
|
|
2173
|
-
autoShowBlinds = false
|
|
4644
|
+
autoShowBlinds = false,
|
|
4645
|
+
associations,
|
|
4646
|
+
onAssociationCollapsedChange,
|
|
4647
|
+
onAssociationRatioChange,
|
|
4648
|
+
renderAssociatedContent,
|
|
4649
|
+
getAssociatedHeader,
|
|
4650
|
+
enableTabAssociationDrag = false,
|
|
4651
|
+
onTabAssociate,
|
|
4652
|
+
onTabDissociate: _onTabDissociate
|
|
2174
4653
|
}) => {
|
|
2175
4654
|
console.log("[TabbedTerminalPanel] RENDER", { terminalContext, directory, width });
|
|
2176
4655
|
const { theme } = useTheme6();
|
|
@@ -2179,7 +4658,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
2179
4658
|
const [internalActiveTabId, setInternalActiveTabId] = useState4(null);
|
|
2180
4659
|
const isControlled = activeTabIdProp !== undefined;
|
|
2181
4660
|
const activeTabId = isControlled ? activeTabIdProp : internalActiveTabId;
|
|
2182
|
-
const setActiveTabId =
|
|
4661
|
+
const setActiveTabId = React3.useCallback((tabId) => {
|
|
2183
4662
|
if (isControlled) {
|
|
2184
4663
|
onActiveTabChange?.(tabId);
|
|
2185
4664
|
} else {
|
|
@@ -2190,7 +4669,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
2190
4669
|
const [sessionIds, setSessionIds] = useState4(new Map);
|
|
2191
4670
|
const [scrollPositions, setScrollPositions] = useState4(new Map);
|
|
2192
4671
|
const [activityStates, setActivityStates] = useState4(new Map);
|
|
2193
|
-
const customTabsKey =
|
|
4672
|
+
const customTabsKey = React3.useMemo(() => {
|
|
2194
4673
|
const customTabs = initialTabs.filter((tab) => tab.contentType !== "terminal");
|
|
2195
4674
|
return JSON.stringify(customTabs);
|
|
2196
4675
|
}, [initialTabs]);
|
|
@@ -2198,16 +4677,13 @@ var TabbedTerminalPanelInner = ({
|
|
|
2198
4677
|
const customTabsFromProp = initialTabs.filter((tab) => tab.contentType !== "terminal");
|
|
2199
4678
|
setOwnedTabs((prevTabs) => {
|
|
2200
4679
|
const existingTerminalTabs = prevTabs.filter((tab) => tab.contentType === "terminal");
|
|
2201
|
-
const customTabIds = new Set(customTabsFromProp.map((t) => t.id));
|
|
2202
|
-
const existingCustomTabs = prevTabs.filter((tab) => tab.contentType !== "terminal" && !customTabIds.has(tab.id));
|
|
2203
4680
|
const mergedTabs = [
|
|
2204
4681
|
...existingTerminalTabs,
|
|
2205
|
-
...existingCustomTabs,
|
|
2206
4682
|
...customTabsFromProp
|
|
2207
4683
|
];
|
|
2208
4684
|
const prevCustomTabs = prevTabs.filter((tab) => tab.contentType !== "terminal");
|
|
2209
4685
|
const customTabsChanged = prevCustomTabs.length !== customTabsFromProp.length || !customTabsFromProp.every((tab) => {
|
|
2210
|
-
const prev = prevCustomTabs.find((
|
|
4686
|
+
const prev = prevCustomTabs.find((p2) => p2.id === tab.id);
|
|
2211
4687
|
if (!prev)
|
|
2212
4688
|
return false;
|
|
2213
4689
|
return JSON.stringify(tab) === JSON.stringify(prev);
|
|
@@ -2233,21 +4709,21 @@ var TabbedTerminalPanelInner = ({
|
|
|
2233
4709
|
onFocusTabHandled?.();
|
|
2234
4710
|
}
|
|
2235
4711
|
}, [requestFocusTabId, ownedTabs, foreignTabs, setActiveTabId, onFocusTabHandled, activeTabId]);
|
|
2236
|
-
const getOwnedTabLabel =
|
|
4712
|
+
const getOwnedTabLabel = useCallback5((index, _directory) => {
|
|
2237
4713
|
if (tabLabelPrefix) {
|
|
2238
4714
|
return `${tabLabelPrefix} ${index + 1}`;
|
|
2239
4715
|
}
|
|
2240
4716
|
return `⌘ ${index + 1}`;
|
|
2241
4717
|
}, [tabLabelPrefix]);
|
|
2242
|
-
const tabs =
|
|
4718
|
+
const tabs = React3.useMemo(() => {
|
|
2243
4719
|
const labeledOwnedTabs = ownedTabs.map((tab, index) => ({
|
|
2244
4720
|
...tab,
|
|
2245
4721
|
label: tab.contentType === "terminal" ? getOwnedTabLabel(index, tab.directory) : tab.label
|
|
2246
4722
|
}));
|
|
2247
|
-
const sortedForeignTabs = [...foreignTabs].sort((
|
|
4723
|
+
const sortedForeignTabs = [...foreignTabs].sort((a2, b) => a2.label.localeCompare(b.label));
|
|
2248
4724
|
return [...labeledOwnedTabs, ...sortedForeignTabs];
|
|
2249
4725
|
}, [ownedTabs, foreignTabs, getOwnedTabLabel]);
|
|
2250
|
-
const genericTabs =
|
|
4726
|
+
const genericTabs = React3.useMemo(() => {
|
|
2251
4727
|
return tabs.map((tab) => ({
|
|
2252
4728
|
id: tab.id,
|
|
2253
4729
|
label: tab.label,
|
|
@@ -2261,7 +4737,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
2261
4737
|
}, [tabs]);
|
|
2262
4738
|
const tabRefsMap = useRef3(new Map);
|
|
2263
4739
|
const refCallbacksMap = useRef3(new Map);
|
|
2264
|
-
const getRefCallback =
|
|
4740
|
+
const getRefCallback = useCallback5((tabId) => {
|
|
2265
4741
|
let callback = refCallbacksMap.current.get(tabId);
|
|
2266
4742
|
if (!callback) {
|
|
2267
4743
|
callback = (ref) => {
|
|
@@ -2278,7 +4754,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
2278
4754
|
const hasInitializedRef = useRef3(false);
|
|
2279
4755
|
const isCreatingTabRef = useRef3(false);
|
|
2280
4756
|
const headerRef = useRef3(null);
|
|
2281
|
-
const handleTabScrollPositionChange =
|
|
4757
|
+
const handleTabScrollPositionChange = useCallback5((tabId, position) => {
|
|
2282
4758
|
setScrollPositions((prev) => new Map(prev).set(tabId, position));
|
|
2283
4759
|
}, []);
|
|
2284
4760
|
const defaultScrollPosition = {
|
|
@@ -2286,12 +4762,12 @@ var TabbedTerminalPanelInner = ({
|
|
|
2286
4762
|
isAtBottom: true,
|
|
2287
4763
|
isScrollLocked: false
|
|
2288
4764
|
};
|
|
2289
|
-
const handleToggleScrollLock =
|
|
4765
|
+
const handleToggleScrollLock = useCallback5(() => {
|
|
2290
4766
|
if (activeTabId) {
|
|
2291
4767
|
tabRefsMap.current.get(activeTabId)?.toggleScrollLock();
|
|
2292
4768
|
}
|
|
2293
4769
|
}, [activeTabId]);
|
|
2294
|
-
const restoreOwnedSessions =
|
|
4770
|
+
const restoreOwnedSessions = useCallback5(async () => {
|
|
2295
4771
|
try {
|
|
2296
4772
|
let sessions = [];
|
|
2297
4773
|
if (actions.listTerminalSessions) {
|
|
@@ -2326,7 +4802,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
2326
4802
|
console.error("[TabbedTerminalPanel] Failed to restore owned sessions:", err);
|
|
2327
4803
|
}
|
|
2328
4804
|
}, [terminalContext, initialTabs, onTabsChange, actions, directory]);
|
|
2329
|
-
const fetchForeignSessions =
|
|
4805
|
+
const fetchForeignSessions = useCallback5(async () => {
|
|
2330
4806
|
try {
|
|
2331
4807
|
if (!actions.listTerminalSessions) {
|
|
2332
4808
|
return;
|
|
@@ -2358,9 +4834,9 @@ var TabbedTerminalPanelInner = ({
|
|
|
2358
4834
|
console.error("[TabbedTerminalPanel] Failed to fetch foreign sessions:", err);
|
|
2359
4835
|
}
|
|
2360
4836
|
}, [terminalContext, actions]);
|
|
2361
|
-
const clearForeignTabs =
|
|
4837
|
+
const clearForeignTabs = useCallback5(() => {
|
|
2362
4838
|
setForeignTabs((prevForeign) => {
|
|
2363
|
-
const foreignTabIds = new Set(prevForeign.map((
|
|
4839
|
+
const foreignTabIds = new Set(prevForeign.map((t2) => t2.id));
|
|
2364
4840
|
setSessionIds((prev) => {
|
|
2365
4841
|
const updated = new Map(prev);
|
|
2366
4842
|
foreignTabIds.forEach((id) => updated.delete(id));
|
|
@@ -2396,10 +4872,10 @@ var TabbedTerminalPanelInner = ({
|
|
|
2396
4872
|
clearForeignTabs();
|
|
2397
4873
|
}
|
|
2398
4874
|
}, [showAllTerminals, fetchForeignSessions, clearForeignTabs]);
|
|
2399
|
-
const switchTab =
|
|
4875
|
+
const switchTab = useCallback5((tabId) => {
|
|
2400
4876
|
setActiveTabId(tabId);
|
|
2401
4877
|
}, [setActiveTabId]);
|
|
2402
|
-
const addNewTab =
|
|
4878
|
+
const addNewTab = useCallback5((label, command, targetDirectory) => {
|
|
2403
4879
|
const targetDir = targetDirectory || directory;
|
|
2404
4880
|
const directoryName = targetDir.split("/").pop() || targetDir;
|
|
2405
4881
|
const newTab = {
|
|
@@ -2417,10 +4893,10 @@ var TabbedTerminalPanelInner = ({
|
|
|
2417
4893
|
});
|
|
2418
4894
|
setActiveTabId(newTab.id);
|
|
2419
4895
|
}, [directory, onTabsChange]);
|
|
2420
|
-
const isForeignTab =
|
|
4896
|
+
const isForeignTab = useCallback5((tabId) => {
|
|
2421
4897
|
return tabId.startsWith("tab-foreign-");
|
|
2422
4898
|
}, []);
|
|
2423
|
-
const closeTab =
|
|
4899
|
+
const closeTab = useCallback5(async (tabId) => {
|
|
2424
4900
|
const sessionId = sessionIds.get(tabId);
|
|
2425
4901
|
const isForeign = isForeignTab(tabId);
|
|
2426
4902
|
if (!isForeign && sessionId && actions.destroyTerminalSession) {
|
|
@@ -2462,7 +4938,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
2462
4938
|
return newMap;
|
|
2463
4939
|
});
|
|
2464
4940
|
const findNextActiveTab = (allTabs) => {
|
|
2465
|
-
const remaining = allTabs.filter((
|
|
4941
|
+
const remaining = allTabs.filter((t2) => t2.id !== tabId);
|
|
2466
4942
|
if (activeTabId === tabId && remaining.length > 0) {
|
|
2467
4943
|
const newActive = remaining[remaining.length - 1];
|
|
2468
4944
|
return newActive.id;
|
|
@@ -2471,7 +4947,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
2471
4947
|
};
|
|
2472
4948
|
if (isForeign) {
|
|
2473
4949
|
setForeignTabs((prevTabs) => {
|
|
2474
|
-
const newTabs = prevTabs.filter((
|
|
4950
|
+
const newTabs = prevTabs.filter((t2) => t2.id !== tabId);
|
|
2475
4951
|
const nextActiveId = findNextActiveTab([...ownedTabs, ...newTabs]);
|
|
2476
4952
|
if (nextActiveId !== activeTabId) {
|
|
2477
4953
|
setActiveTabId(nextActiveId);
|
|
@@ -2480,7 +4956,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
2480
4956
|
});
|
|
2481
4957
|
} else {
|
|
2482
4958
|
setOwnedTabs((prevTabs) => {
|
|
2483
|
-
const newTabs = prevTabs.filter((
|
|
4959
|
+
const newTabs = prevTabs.filter((t2) => t2.id !== tabId);
|
|
2484
4960
|
const nextActiveId = findNextActiveTab([...newTabs, ...foreignTabs]);
|
|
2485
4961
|
if (nextActiveId !== activeTabId) {
|
|
2486
4962
|
setActiveTabId(nextActiveId);
|
|
@@ -2490,10 +4966,10 @@ var TabbedTerminalPanelInner = ({
|
|
|
2490
4966
|
});
|
|
2491
4967
|
}
|
|
2492
4968
|
}, [activeTabId, sessionIds, actions, onTabsChange, isForeignTab, ownedTabs, foreignTabs]);
|
|
2493
|
-
const handleSessionCreated =
|
|
4969
|
+
const handleSessionCreated = useCallback5((tabId, sessionId) => {
|
|
2494
4970
|
setSessionIds((prev) => new Map(prev).set(tabId, sessionId));
|
|
2495
4971
|
}, []);
|
|
2496
|
-
const handleActivityStateChange =
|
|
4972
|
+
const handleActivityStateChange = useCallback5((sessionId, isActive) => {
|
|
2497
4973
|
setActivityStates((prev) => {
|
|
2498
4974
|
const next = new Map(prev);
|
|
2499
4975
|
if (isActive) {
|
|
@@ -2524,7 +5000,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
2524
5000
|
}
|
|
2525
5001
|
}
|
|
2526
5002
|
});
|
|
2527
|
-
const renderTabAccessory =
|
|
5003
|
+
const renderTabAccessory = useCallback5((tab) => {
|
|
2528
5004
|
const tabSessionId = sessionIds.get(tab.id);
|
|
2529
5005
|
const hasExternalWorkingState = tabSessionId ? workingStates?.[tabSessionId]?.isWorking : false;
|
|
2530
5006
|
const hasInternalActivity = tabSessionId ? activityStates.get(tabSessionId) : false;
|
|
@@ -2536,8 +5012,8 @@ var TabbedTerminalPanelInner = ({
|
|
|
2536
5012
|
return /* @__PURE__ */ jsxs6(Fragment2, {
|
|
2537
5013
|
children: [
|
|
2538
5014
|
/* @__PURE__ */ jsx7("button", {
|
|
2539
|
-
onClick: (
|
|
2540
|
-
|
|
5015
|
+
onClick: (e2) => {
|
|
5016
|
+
e2.stopPropagation();
|
|
2541
5017
|
handleToggleScrollLock();
|
|
2542
5018
|
},
|
|
2543
5019
|
style: {
|
|
@@ -2553,11 +5029,11 @@ var TabbedTerminalPanelInner = ({
|
|
|
2553
5029
|
color: scrollPosition.isScrollLocked ? theme.colors.success : theme.colors.warning,
|
|
2554
5030
|
padding: 0
|
|
2555
5031
|
},
|
|
2556
|
-
onMouseEnter: (
|
|
2557
|
-
|
|
5032
|
+
onMouseEnter: (e2) => {
|
|
5033
|
+
e2.currentTarget.style.backgroundColor = theme.colors.backgroundTertiary;
|
|
2558
5034
|
},
|
|
2559
|
-
onMouseLeave: (
|
|
2560
|
-
|
|
5035
|
+
onMouseLeave: (e2) => {
|
|
5036
|
+
e2.currentTarget.style.backgroundColor = "transparent";
|
|
2561
5037
|
},
|
|
2562
5038
|
title: scrollPosition.isScrollLocked ? "Scroll locked" : "Scroll unlocked",
|
|
2563
5039
|
children: scrollPosition.isScrollLocked ? /* @__PURE__ */ jsx7(Lock2, {
|
|
@@ -2585,6 +5061,112 @@ var TabbedTerminalPanelInner = ({
|
|
|
2585
5061
|
]
|
|
2586
5062
|
});
|
|
2587
5063
|
}, [activeTabId, scrollPositions, defaultScrollPosition, handleToggleScrollLock, theme, sessionIds, workingStates, activityStates]);
|
|
5064
|
+
const renderTerminalWithAssociation = useCallback5((tab, isActive, sessionId, association) => {
|
|
5065
|
+
const terminalContent = /* @__PURE__ */ jsx7(TerminalTabContent, {
|
|
5066
|
+
ref: getRefCallback(tab.id),
|
|
5067
|
+
tab,
|
|
5068
|
+
sessionId,
|
|
5069
|
+
isActive,
|
|
5070
|
+
isVisible,
|
|
5071
|
+
actions,
|
|
5072
|
+
events,
|
|
5073
|
+
terminalContext,
|
|
5074
|
+
onSessionCreated: handleSessionCreated,
|
|
5075
|
+
onScrollPositionChange: handleTabScrollPositionChange,
|
|
5076
|
+
isForeign: tab.id.startsWith("tab-foreign-"),
|
|
5077
|
+
defaultScrollLocked,
|
|
5078
|
+
activityDetection,
|
|
5079
|
+
activityTimeout,
|
|
5080
|
+
autoShowBlinds,
|
|
5081
|
+
onActivityStateChange: handleActivityStateChange
|
|
5082
|
+
}, `terminal-${tab.id}`);
|
|
5083
|
+
const secondaryContent = association && renderAssociatedContent ? renderAssociatedContent(association.associatedTabId, isActive) : /* @__PURE__ */ jsx7("div", {
|
|
5084
|
+
style: {
|
|
5085
|
+
height: "100%",
|
|
5086
|
+
display: "flex",
|
|
5087
|
+
alignItems: "center",
|
|
5088
|
+
justifyContent: "center",
|
|
5089
|
+
color: theme.colors.textMuted,
|
|
5090
|
+
fontSize: "13px",
|
|
5091
|
+
backgroundColor: theme.colors.backgroundSecondary,
|
|
5092
|
+
borderBottom: `1px solid ${theme.colors.border}`
|
|
5093
|
+
},
|
|
5094
|
+
children: "Drag a tab here to associate it with this terminal"
|
|
5095
|
+
});
|
|
5096
|
+
const headerConfig = association && getAssociatedHeader ? getAssociatedHeader(association.associatedTabId) : { title: "Drop zone", icon: "\uD83D\uDCCE" };
|
|
5097
|
+
const hasAssociation = !!association;
|
|
5098
|
+
return /* @__PURE__ */ jsx7(z, {
|
|
5099
|
+
style: { height: "100%" },
|
|
5100
|
+
primaryContent: terminalContent,
|
|
5101
|
+
secondaryContent,
|
|
5102
|
+
collapsedHeader: headerConfig,
|
|
5103
|
+
collapsed: hasAssociation ? association.collapsed : false,
|
|
5104
|
+
onCollapsedChange: hasAssociation ? (collapsed) => onAssociationCollapsedChange?.(tab.id, collapsed) : undefined,
|
|
5105
|
+
ratio: hasAssociation ? association.ratio : 0.15,
|
|
5106
|
+
onRatioChange: hasAssociation ? (ratio) => onAssociationRatioChange?.(tab.id, ratio) : undefined,
|
|
5107
|
+
theme
|
|
5108
|
+
});
|
|
5109
|
+
}, [
|
|
5110
|
+
getRefCallback,
|
|
5111
|
+
isVisible,
|
|
5112
|
+
actions,
|
|
5113
|
+
events,
|
|
5114
|
+
terminalContext,
|
|
5115
|
+
handleSessionCreated,
|
|
5116
|
+
handleTabScrollPositionChange,
|
|
5117
|
+
defaultScrollLocked,
|
|
5118
|
+
activityDetection,
|
|
5119
|
+
activityTimeout,
|
|
5120
|
+
autoShowBlinds,
|
|
5121
|
+
handleActivityStateChange,
|
|
5122
|
+
renderAssociatedContent,
|
|
5123
|
+
getAssociatedHeader,
|
|
5124
|
+
onAssociationCollapsedChange,
|
|
5125
|
+
onAssociationRatioChange,
|
|
5126
|
+
theme
|
|
5127
|
+
]);
|
|
5128
|
+
const handleTabDrop = useCallback5((draggedTabId, targetTabId) => {
|
|
5129
|
+
const draggedTab = tabs.find((t2) => t2.id === draggedTabId);
|
|
5130
|
+
const targetTab = tabs.find((t2) => t2.id === targetTabId);
|
|
5131
|
+
if (targetTab?.contentType === "terminal" && draggedTab?.contentType !== "terminal") {
|
|
5132
|
+
onTabAssociate?.(targetTabId, draggedTabId);
|
|
5133
|
+
}
|
|
5134
|
+
}, [tabs, onTabAssociate]);
|
|
5135
|
+
const canDropOnTab = useCallback5((draggedTabId, targetTabId) => {
|
|
5136
|
+
const draggedTab = tabs.find((t2) => t2.id === draggedTabId);
|
|
5137
|
+
const targetTab = tabs.find((t2) => t2.id === targetTabId);
|
|
5138
|
+
return targetTab?.contentType === "terminal" && draggedTab?.contentType !== "terminal";
|
|
5139
|
+
}, [tabs]);
|
|
5140
|
+
const [isDragOverContent, setIsDragOverContent] = useState4(false);
|
|
5141
|
+
const handleContentDragEnter = useCallback5((e2) => {
|
|
5142
|
+
e2.preventDefault();
|
|
5143
|
+
if (activeTabId) {
|
|
5144
|
+
const activeTab = tabs.find((t2) => t2.id === activeTabId);
|
|
5145
|
+
if (activeTab?.contentType === "terminal") {
|
|
5146
|
+
setIsDragOverContent(true);
|
|
5147
|
+
}
|
|
5148
|
+
}
|
|
5149
|
+
}, [activeTabId, tabs]);
|
|
5150
|
+
const handleContentDragLeave = useCallback5((e2) => {
|
|
5151
|
+
const relatedTarget = e2.relatedTarget;
|
|
5152
|
+
if (!e2.currentTarget.contains(relatedTarget)) {
|
|
5153
|
+
setIsDragOverContent(false);
|
|
5154
|
+
}
|
|
5155
|
+
}, []);
|
|
5156
|
+
const handleContentDrop = useCallback5((e2) => {
|
|
5157
|
+
e2.preventDefault();
|
|
5158
|
+
e2.stopPropagation();
|
|
5159
|
+
setIsDragOverContent(false);
|
|
5160
|
+
const draggedTabId = e2.dataTransfer.getData("application/x-tab-association");
|
|
5161
|
+
if (!draggedTabId || !activeTabId) {
|
|
5162
|
+
return;
|
|
5163
|
+
}
|
|
5164
|
+
const draggedTab = tabs.find((t2) => t2.id === draggedTabId);
|
|
5165
|
+
const activeTab = tabs.find((t2) => t2.id === activeTabId);
|
|
5166
|
+
if (activeTab?.contentType === "terminal" && draggedTab?.contentType !== "terminal") {
|
|
5167
|
+
onTabAssociate?.(activeTabId, draggedTabId);
|
|
5168
|
+
}
|
|
5169
|
+
}, [activeTabId, tabs, onTabAssociate]);
|
|
2588
5170
|
return /* @__PURE__ */ jsxs6("div", {
|
|
2589
5171
|
style: {
|
|
2590
5172
|
display: "flex",
|
|
@@ -2615,14 +5197,14 @@ var TabbedTerminalPanelInner = ({
|
|
|
2615
5197
|
cursor: "pointer",
|
|
2616
5198
|
color: showAllTerminals ? theme.colors.primary : theme.colors.textSecondary
|
|
2617
5199
|
},
|
|
2618
|
-
onMouseEnter: (
|
|
5200
|
+
onMouseEnter: (e2) => {
|
|
2619
5201
|
if (!showAllTerminals) {
|
|
2620
|
-
|
|
5202
|
+
e2.currentTarget.style.backgroundColor = theme.colors.backgroundTertiary;
|
|
2621
5203
|
}
|
|
2622
5204
|
},
|
|
2623
|
-
onMouseLeave: (
|
|
5205
|
+
onMouseLeave: (e2) => {
|
|
2624
5206
|
if (!showAllTerminals) {
|
|
2625
|
-
|
|
5207
|
+
e2.currentTarget.style.backgroundColor = "transparent";
|
|
2626
5208
|
}
|
|
2627
5209
|
},
|
|
2628
5210
|
title: showAllTerminals ? "Showing all terminals (click to filter by context)" : "Show all terminals",
|
|
@@ -2635,7 +5217,10 @@ var TabbedTerminalPanelInner = ({
|
|
|
2635
5217
|
renderTabAccessory,
|
|
2636
5218
|
renderTabIcon,
|
|
2637
5219
|
renderTabLabel,
|
|
2638
|
-
showKeyboardHints: false
|
|
5220
|
+
showKeyboardHints: false,
|
|
5221
|
+
enableDragAndDrop: enableTabAssociationDrag,
|
|
5222
|
+
onTabDrop: handleTabDrop,
|
|
5223
|
+
canDropOnTab
|
|
2639
5224
|
})
|
|
2640
5225
|
}),
|
|
2641
5226
|
/* @__PURE__ */ jsxs6("div", {
|
|
@@ -2645,7 +5230,44 @@ var TabbedTerminalPanelInner = ({
|
|
|
2645
5230
|
flexDirection: "column",
|
|
2646
5231
|
overflow: "hidden",
|
|
2647
5232
|
width: "100%",
|
|
2648
|
-
minHeight: 0
|
|
5233
|
+
minHeight: 0,
|
|
5234
|
+
position: "relative",
|
|
5235
|
+
outline: isDragOverContent ? `3px dashed ${theme.colors.primary}` : "none",
|
|
5236
|
+
outlineOffset: "-3px"
|
|
5237
|
+
},
|
|
5238
|
+
onDragEnterCapture: (e2) => {
|
|
5239
|
+
if (!enableTabAssociationDrag)
|
|
5240
|
+
return;
|
|
5241
|
+
if (!e2.dataTransfer.types.includes("application/x-tab-association"))
|
|
5242
|
+
return;
|
|
5243
|
+
e2.preventDefault();
|
|
5244
|
+
e2.stopPropagation();
|
|
5245
|
+
handleContentDragEnter(e2);
|
|
5246
|
+
},
|
|
5247
|
+
onDragOverCapture: (e2) => {
|
|
5248
|
+
if (!enableTabAssociationDrag)
|
|
5249
|
+
return;
|
|
5250
|
+
if (!e2.dataTransfer.types.includes("application/x-tab-association"))
|
|
5251
|
+
return;
|
|
5252
|
+
e2.preventDefault();
|
|
5253
|
+
e2.stopPropagation();
|
|
5254
|
+
e2.dataTransfer.dropEffect = "move";
|
|
5255
|
+
},
|
|
5256
|
+
onDragLeaveCapture: (e2) => {
|
|
5257
|
+
if (!enableTabAssociationDrag)
|
|
5258
|
+
return;
|
|
5259
|
+
if (!e2.dataTransfer.types.includes("application/x-tab-association"))
|
|
5260
|
+
return;
|
|
5261
|
+
handleContentDragLeave(e2);
|
|
5262
|
+
},
|
|
5263
|
+
onDropCapture: (e2) => {
|
|
5264
|
+
if (!enableTabAssociationDrag)
|
|
5265
|
+
return;
|
|
5266
|
+
if (!e2.dataTransfer.types.includes("application/x-tab-association"))
|
|
5267
|
+
return;
|
|
5268
|
+
e2.preventDefault();
|
|
5269
|
+
e2.stopPropagation();
|
|
5270
|
+
handleContentDrop(e2);
|
|
2649
5271
|
},
|
|
2650
5272
|
children: [
|
|
2651
5273
|
tabs.map((tab) => {
|
|
@@ -2654,23 +5276,15 @@ var TabbedTerminalPanelInner = ({
|
|
|
2654
5276
|
if (renderTabContent) {
|
|
2655
5277
|
const customContent = renderTabContent(tab, isActive, sessionId, width);
|
|
2656
5278
|
if (customContent === null && tab.contentType === "terminal") {
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
onSessionCreated: handleSessionCreated,
|
|
2667
|
-
onScrollPositionChange: handleTabScrollPositionChange,
|
|
2668
|
-
isForeign: tab.id.startsWith("tab-foreign-"),
|
|
2669
|
-
defaultScrollLocked,
|
|
2670
|
-
activityDetection,
|
|
2671
|
-
activityTimeout,
|
|
2672
|
-
autoShowBlinds,
|
|
2673
|
-
onActivityStateChange: handleActivityStateChange
|
|
5279
|
+
const association = associations?.[tab.id];
|
|
5280
|
+
return /* @__PURE__ */ jsx7("div", {
|
|
5281
|
+
style: {
|
|
5282
|
+
display: isActive ? "flex" : "none",
|
|
5283
|
+
flexDirection: "column",
|
|
5284
|
+
height: "100%",
|
|
5285
|
+
width: "100%"
|
|
5286
|
+
},
|
|
5287
|
+
children: renderTerminalWithAssociation(tab, isActive, sessionId, association)
|
|
2674
5288
|
}, tab.id);
|
|
2675
5289
|
}
|
|
2676
5290
|
return /* @__PURE__ */ jsx7("div", {
|
|
@@ -2684,23 +5298,15 @@ var TabbedTerminalPanelInner = ({
|
|
|
2684
5298
|
}, tab.id);
|
|
2685
5299
|
}
|
|
2686
5300
|
if (tab.contentType === "terminal") {
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
onSessionCreated: handleSessionCreated,
|
|
2697
|
-
onScrollPositionChange: handleTabScrollPositionChange,
|
|
2698
|
-
isForeign: tab.id.startsWith("tab-foreign-"),
|
|
2699
|
-
defaultScrollLocked,
|
|
2700
|
-
activityDetection,
|
|
2701
|
-
activityTimeout,
|
|
2702
|
-
autoShowBlinds,
|
|
2703
|
-
onActivityStateChange: handleActivityStateChange
|
|
5301
|
+
const association = associations?.[tab.id];
|
|
5302
|
+
return /* @__PURE__ */ jsx7("div", {
|
|
5303
|
+
style: {
|
|
5304
|
+
display: isActive ? "flex" : "none",
|
|
5305
|
+
flexDirection: "column",
|
|
5306
|
+
height: "100%",
|
|
5307
|
+
width: "100%"
|
|
5308
|
+
},
|
|
5309
|
+
children: renderTerminalWithAssociation(tab, isActive, sessionId, association)
|
|
2704
5310
|
}, tab.id);
|
|
2705
5311
|
}
|
|
2706
5312
|
return /* @__PURE__ */ jsxs6("div", {
|
|
@@ -2739,10 +5345,6 @@ var TabbedTerminalPanelInner = ({
|
|
|
2739
5345
|
size: 32,
|
|
2740
5346
|
style: { opacity: 0.5, marginBottom: "16px" }
|
|
2741
5347
|
}),
|
|
2742
|
-
/* @__PURE__ */ jsx7("p", {
|
|
2743
|
-
style: { fontFamily: theme.fonts.body, fontSize: theme.fontSizes[1] },
|
|
2744
|
-
children: "No terminal sessions"
|
|
2745
|
-
}),
|
|
2746
5348
|
/* @__PURE__ */ jsx7("button", {
|
|
2747
5349
|
onClick: () => addNewTab(),
|
|
2748
5350
|
style: {
|
|
@@ -2766,7 +5368,7 @@ var TabbedTerminalPanelInner = ({
|
|
|
2766
5368
|
});
|
|
2767
5369
|
};
|
|
2768
5370
|
TabbedTerminalPanelInner.displayName = "TabbedTerminalPanelInner";
|
|
2769
|
-
var TabbedTerminalPanelMemoized =
|
|
5371
|
+
var TabbedTerminalPanelMemoized = React3.memo(TabbedTerminalPanelInner, (prevProps, nextProps) => {
|
|
2770
5372
|
const changes = [];
|
|
2771
5373
|
if (prevProps.terminalContext !== nextProps.terminalContext)
|
|
2772
5374
|
changes.push("terminalContext");
|
|
@@ -2808,19 +5410,17 @@ var TabbedTerminalPanelMemoized = React2.memo(TabbedTerminalPanelInner, (prevPro
|
|
|
2808
5410
|
changes.push("activityTimeout");
|
|
2809
5411
|
if (prevProps.autoShowBlinds !== nextProps.autoShowBlinds)
|
|
2810
5412
|
changes.push("autoShowBlinds");
|
|
5413
|
+
if (prevProps.associations !== nextProps.associations)
|
|
5414
|
+
changes.push("associations");
|
|
5415
|
+
if (prevProps.renderAssociatedContent !== nextProps.renderAssociatedContent)
|
|
5416
|
+
changes.push("renderAssociatedContent");
|
|
5417
|
+
if (prevProps.getAssociatedHeader !== nextProps.getAssociatedHeader)
|
|
5418
|
+
changes.push("getAssociatedHeader");
|
|
2811
5419
|
const ignoredChanges = [];
|
|
2812
5420
|
if (prevProps.context !== nextProps.context)
|
|
2813
5421
|
ignoredChanges.push("context");
|
|
2814
5422
|
if (prevProps.events !== nextProps.events)
|
|
2815
5423
|
ignoredChanges.push("events");
|
|
2816
|
-
console.log("[TabbedTerminalPanel] MEMO check", {
|
|
2817
|
-
willRerender: changes.length > 0,
|
|
2818
|
-
propsChanged: changes.length > 0 ? changes : "none",
|
|
2819
|
-
ignoredPropsChanged: ignoredChanges.length > 0 ? ignoredChanges : "none"
|
|
2820
|
-
});
|
|
2821
|
-
if (changes.length > 0) {
|
|
2822
|
-
console.log("[TabbedTerminalPanel] MEMO - will re-render, props changed:", changes);
|
|
2823
|
-
}
|
|
2824
5424
|
return changes.length === 0;
|
|
2825
5425
|
});
|
|
2826
5426
|
TabbedTerminalPanelMemoized.displayName = "TabbedTerminalPanel";
|