groove-dev 0.27.72 → 0.27.73
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/node_modules/@groove-dev/cli/package.json +1 -1
- package/node_modules/@groove-dev/daemon/package.json +1 -1
- package/node_modules/@groove-dev/daemon/src/api.js +10 -7
- package/node_modules/@groove-dev/gui/dist/assets/index-BFc7Ov6v.css +1 -0
- package/node_modules/@groove-dev/gui/dist/assets/{index-CHSXqfwy.js → index-Deza1S0i.js} +159 -159
- package/node_modules/@groove-dev/gui/dist/index.html +2 -2
- package/node_modules/@groove-dev/gui/package.json +1 -1
- package/node_modules/@groove-dev/gui/src/components/editor/editor-tabs.jsx +5 -5
- package/node_modules/@groove-dev/gui/src/components/settings/ProviderSetupWizard.jsx +7 -2
- package/node_modules/@groove-dev/gui/src/stores/groove.js +41 -52
- package/node_modules/@groove-dev/gui/src/views/editor.jsx +2 -9
- package/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/daemon/package.json +1 -1
- package/packages/daemon/src/api.js +10 -7
- package/packages/gui/dist/assets/index-BFc7Ov6v.css +1 -0
- package/packages/gui/dist/assets/{index-CHSXqfwy.js → index-Deza1S0i.js} +159 -159
- package/packages/gui/dist/index.html +2 -2
- package/packages/gui/package.json +1 -1
- package/packages/gui/src/components/editor/editor-tabs.jsx +5 -5
- package/packages/gui/src/components/settings/ProviderSetupWizard.jsx +7 -2
- package/packages/gui/src/stores/groove.js +41 -52
- package/packages/gui/src/views/editor.jsx +2 -9
- package/node_modules/@groove-dev/gui/dist/assets/index-74E3YTkT.css +0 -1
- package/packages/gui/dist/assets/index-74E3YTkT.css +0 -1
- package/packages/gui/node_modules/.vite/deps/@codemirror_autocomplete.js +0 -68
- package/packages/gui/node_modules/.vite/deps/@codemirror_autocomplete.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@codemirror_commands.js +0 -1420
- package/packages/gui/node_modules/.vite/deps/@codemirror_commands.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@codemirror_lang-css.js +0 -17
- package/packages/gui/node_modules/.vite/deps/@codemirror_lang-css.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@codemirror_lang-html.js +0 -22
- package/packages/gui/node_modules/.vite/deps/@codemirror_lang-html.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@codemirror_lang-javascript.js +0 -34
- package/packages/gui/node_modules/.vite/deps/@codemirror_lang-javascript.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@codemirror_lang-json.js +0 -101
- package/packages/gui/node_modules/.vite/deps/@codemirror_lang-json.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@codemirror_lang-markdown.js +0 -2534
- package/packages/gui/node_modules/.vite/deps/@codemirror_lang-markdown.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@codemirror_lang-python.js +0 -789
- package/packages/gui/node_modules/.vite/deps/@codemirror_lang-python.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@codemirror_language.js +0 -115
- package/packages/gui/node_modules/.vite/deps/@codemirror_language.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@codemirror_search.js +0 -1136
- package/packages/gui/node_modules/.vite/deps/@codemirror_search.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@codemirror_state.js +0 -63
- package/packages/gui/node_modules/.vite/deps/@codemirror_state.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@codemirror_theme-one-dark.js +0 -179
- package/packages/gui/node_modules/.vite/deps/@codemirror_theme-one-dark.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@codemirror_view.js +0 -104
- package/packages/gui/node_modules/.vite/deps/@codemirror_view.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@radix-ui_react-context-menu.js +0 -1202
- package/packages/gui/node_modules/.vite/deps/@radix-ui_react-context-menu.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@radix-ui_react-dialog.js +0 -365
- package/packages/gui/node_modules/.vite/deps/@radix-ui_react-dialog.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@radix-ui_react-scroll-area.js +0 -757
- package/packages/gui/node_modules/.vite/deps/@radix-ui_react-scroll-area.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@radix-ui_react-tabs.js +0 -219
- package/packages/gui/node_modules/.vite/deps/@radix-ui_react-tabs.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@radix-ui_react-tooltip.js +0 -562
- package/packages/gui/node_modules/.vite/deps/@radix-ui_react-tooltip.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@xterm_addon-fit.js +0 -46
- package/packages/gui/node_modules/.vite/deps/@xterm_addon-fit.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@xterm_addon-web-links.js +0 -121
- package/packages/gui/node_modules/.vite/deps/@xterm_addon-web-links.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@xterm_xterm.js +0 -9237
- package/packages/gui/node_modules/.vite/deps/@xterm_xterm.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/@xyflow_react.js +0 -9934
- package/packages/gui/node_modules/.vite/deps/@xyflow_react.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/_metadata.json +0 -259
- package/packages/gui/node_modules/.vite/deps/chunk-3EE34IFC.js +0 -5169
- package/packages/gui/node_modules/.vite/deps/chunk-3EE34IFC.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/chunk-3IB5EUP7.js +0 -2000
- package/packages/gui/node_modules/.vite/deps/chunk-3IB5EUP7.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/chunk-44CLUOQE.js +0 -1776
- package/packages/gui/node_modules/.vite/deps/chunk-44CLUOQE.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/chunk-4JHIKDUF.js +0 -435
- package/packages/gui/node_modules/.vite/deps/chunk-4JHIKDUF.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/chunk-ACEP5X2F.js +0 -292
- package/packages/gui/node_modules/.vite/deps/chunk-ACEP5X2F.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/chunk-CDLO3JFW.js +0 -1004
- package/packages/gui/node_modules/.vite/deps/chunk-CDLO3JFW.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/chunk-FOR2E6IR.js +0 -105
- package/packages/gui/node_modules/.vite/deps/chunk-FOR2E6IR.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/chunk-HPXOV7QR.js +0 -23
- package/packages/gui/node_modules/.vite/deps/chunk-HPXOV7QR.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/chunk-HVFOBSCQ.js +0 -1062
- package/packages/gui/node_modules/.vite/deps/chunk-HVFOBSCQ.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/chunk-PGL3TTJA.js +0 -1115
- package/packages/gui/node_modules/.vite/deps/chunk-PGL3TTJA.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/chunk-PGMATLPZ.js +0 -2294
- package/packages/gui/node_modules/.vite/deps/chunk-PGMATLPZ.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/chunk-PR4QN5HX.js +0 -42
- package/packages/gui/node_modules/.vite/deps/chunk-PR4QN5HX.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/chunk-QX3PPTYO.js +0 -315
- package/packages/gui/node_modules/.vite/deps/chunk-QX3PPTYO.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/chunk-RE2FU7ZU.js +0 -10985
- package/packages/gui/node_modules/.vite/deps/chunk-RE2FU7ZU.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/chunk-SPKVQGZX.js +0 -701
- package/packages/gui/node_modules/.vite/deps/chunk-SPKVQGZX.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/chunk-YAD7VOVN.js +0 -280
- package/packages/gui/node_modules/.vite/deps/chunk-YAD7VOVN.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/chunk-YEUURE4V.js +0 -264
- package/packages/gui/node_modules/.vite/deps/chunk-YEUURE4V.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/chunk-YYJMNVCJ.js +0 -3459
- package/packages/gui/node_modules/.vite/deps/chunk-YYJMNVCJ.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/chunk-Z5NIFSCT.js +0 -1106
- package/packages/gui/node_modules/.vite/deps/chunk-Z5NIFSCT.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/clsx.js +0 -22
- package/packages/gui/node_modules/.vite/deps/clsx.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/framer-motion.js +0 -12732
- package/packages/gui/node_modules/.vite/deps/framer-motion.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/lucide-react.js +0 -29653
- package/packages/gui/node_modules/.vite/deps/lucide-react.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/package.json +0 -3
- package/packages/gui/node_modules/.vite/deps/react-dom.js +0 -6
- package/packages/gui/node_modules/.vite/deps/react-dom.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/react-dom_client.js +0 -20217
- package/packages/gui/node_modules/.vite/deps/react-dom_client.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/react.js +0 -5
- package/packages/gui/node_modules/.vite/deps/react.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/react_jsx-dev-runtime.js +0 -278
- package/packages/gui/node_modules/.vite/deps/react_jsx-dev-runtime.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/react_jsx-runtime.js +0 -6
- package/packages/gui/node_modules/.vite/deps/react_jsx-runtime.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/tailwind-merge.js +0 -3263
- package/packages/gui/node_modules/.vite/deps/tailwind-merge.js.map +0 -7
- package/packages/gui/node_modules/.vite/deps/zustand.js +0 -56
- package/packages/gui/node_modules/.vite/deps/zustand.js.map +0 -7
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useDirection
|
|
3
|
-
} from "./chunk-HPXOV7QR.js";
|
|
4
|
-
import {
|
|
5
|
-
useControllableState,
|
|
6
|
-
useId
|
|
7
|
-
} from "./chunk-FOR2E6IR.js";
|
|
8
|
-
import {
|
|
9
|
-
Primitive,
|
|
10
|
-
composeEventHandlers,
|
|
11
|
-
createContextScope,
|
|
12
|
-
createSlot,
|
|
13
|
-
useCallbackRef,
|
|
14
|
-
useComposedRefs
|
|
15
|
-
} from "./chunk-4JHIKDUF.js";
|
|
16
|
-
import {
|
|
17
|
-
require_jsx_runtime
|
|
18
|
-
} from "./chunk-ACEP5X2F.js";
|
|
19
|
-
import {
|
|
20
|
-
require_react
|
|
21
|
-
} from "./chunk-CDLO3JFW.js";
|
|
22
|
-
import {
|
|
23
|
-
__toESM
|
|
24
|
-
} from "./chunk-PR4QN5HX.js";
|
|
25
|
-
|
|
26
|
-
// ../../node_modules/@radix-ui/react-roving-focus/dist/index.mjs
|
|
27
|
-
var React3 = __toESM(require_react(), 1);
|
|
28
|
-
|
|
29
|
-
// ../../node_modules/@radix-ui/react-collection/dist/index.mjs
|
|
30
|
-
var import_react = __toESM(require_react(), 1);
|
|
31
|
-
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
|
|
32
|
-
var import_react2 = __toESM(require_react(), 1);
|
|
33
|
-
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
|
|
34
|
-
function createCollection(name) {
|
|
35
|
-
const PROVIDER_NAME = name + "CollectionProvider";
|
|
36
|
-
const [createCollectionContext, createCollectionScope2] = createContextScope(PROVIDER_NAME);
|
|
37
|
-
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
|
|
38
|
-
PROVIDER_NAME,
|
|
39
|
-
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
40
|
-
);
|
|
41
|
-
const CollectionProvider = (props) => {
|
|
42
|
-
const { scope, children } = props;
|
|
43
|
-
const ref = import_react.default.useRef(null);
|
|
44
|
-
const itemMap = import_react.default.useRef(/* @__PURE__ */ new Map()).current;
|
|
45
|
-
return (0, import_jsx_runtime.jsx)(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
46
|
-
};
|
|
47
|
-
CollectionProvider.displayName = PROVIDER_NAME;
|
|
48
|
-
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
49
|
-
const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
|
|
50
|
-
const CollectionSlot = import_react.default.forwardRef(
|
|
51
|
-
(props, forwardedRef) => {
|
|
52
|
-
const { scope, children } = props;
|
|
53
|
-
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
54
|
-
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
55
|
-
return (0, import_jsx_runtime.jsx)(CollectionSlotImpl, { ref: composedRefs, children });
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
59
|
-
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
60
|
-
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
61
|
-
const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);
|
|
62
|
-
const CollectionItemSlot = import_react.default.forwardRef(
|
|
63
|
-
(props, forwardedRef) => {
|
|
64
|
-
const { scope, children, ...itemData } = props;
|
|
65
|
-
const ref = import_react.default.useRef(null);
|
|
66
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
67
|
-
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
68
|
-
import_react.default.useEffect(() => {
|
|
69
|
-
context.itemMap.set(ref, { ref, ...itemData });
|
|
70
|
-
return () => void context.itemMap.delete(ref);
|
|
71
|
-
});
|
|
72
|
-
return (0, import_jsx_runtime.jsx)(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
76
|
-
function useCollection2(scope) {
|
|
77
|
-
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
78
|
-
const getItems = import_react.default.useCallback(() => {
|
|
79
|
-
const collectionNode = context.collectionRef.current;
|
|
80
|
-
if (!collectionNode) return [];
|
|
81
|
-
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
82
|
-
const items = Array.from(context.itemMap.values());
|
|
83
|
-
const orderedItems = items.sort(
|
|
84
|
-
(a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
|
|
85
|
-
);
|
|
86
|
-
return orderedItems;
|
|
87
|
-
}, [context.collectionRef, context.itemMap]);
|
|
88
|
-
return getItems;
|
|
89
|
-
}
|
|
90
|
-
return [
|
|
91
|
-
{ Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
|
|
92
|
-
useCollection2,
|
|
93
|
-
createCollectionScope2
|
|
94
|
-
];
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// ../../node_modules/@radix-ui/react-roving-focus/dist/index.mjs
|
|
98
|
-
var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
|
|
99
|
-
var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
100
|
-
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
101
|
-
var GROUP_NAME = "RovingFocusGroup";
|
|
102
|
-
var [Collection, useCollection, createCollectionScope] = createCollection(GROUP_NAME);
|
|
103
|
-
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(
|
|
104
|
-
GROUP_NAME,
|
|
105
|
-
[createCollectionScope]
|
|
106
|
-
);
|
|
107
|
-
var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);
|
|
108
|
-
var RovingFocusGroup = React3.forwardRef(
|
|
109
|
-
(props, forwardedRef) => {
|
|
110
|
-
return (0, import_jsx_runtime3.jsx)(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: (0, import_jsx_runtime3.jsx)(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: (0, import_jsx_runtime3.jsx)(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });
|
|
111
|
-
}
|
|
112
|
-
);
|
|
113
|
-
RovingFocusGroup.displayName = GROUP_NAME;
|
|
114
|
-
var RovingFocusGroupImpl = React3.forwardRef((props, forwardedRef) => {
|
|
115
|
-
const {
|
|
116
|
-
__scopeRovingFocusGroup,
|
|
117
|
-
orientation,
|
|
118
|
-
loop = false,
|
|
119
|
-
dir,
|
|
120
|
-
currentTabStopId: currentTabStopIdProp,
|
|
121
|
-
defaultCurrentTabStopId,
|
|
122
|
-
onCurrentTabStopIdChange,
|
|
123
|
-
onEntryFocus,
|
|
124
|
-
preventScrollOnEntryFocus = false,
|
|
125
|
-
...groupProps
|
|
126
|
-
} = props;
|
|
127
|
-
const ref = React3.useRef(null);
|
|
128
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
129
|
-
const direction = useDirection(dir);
|
|
130
|
-
const [currentTabStopId, setCurrentTabStopId] = useControllableState({
|
|
131
|
-
prop: currentTabStopIdProp,
|
|
132
|
-
defaultProp: defaultCurrentTabStopId ?? null,
|
|
133
|
-
onChange: onCurrentTabStopIdChange,
|
|
134
|
-
caller: GROUP_NAME
|
|
135
|
-
});
|
|
136
|
-
const [isTabbingBackOut, setIsTabbingBackOut] = React3.useState(false);
|
|
137
|
-
const handleEntryFocus = useCallbackRef(onEntryFocus);
|
|
138
|
-
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
139
|
-
const isClickFocusRef = React3.useRef(false);
|
|
140
|
-
const [focusableItemsCount, setFocusableItemsCount] = React3.useState(0);
|
|
141
|
-
React3.useEffect(() => {
|
|
142
|
-
const node = ref.current;
|
|
143
|
-
if (node) {
|
|
144
|
-
node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
145
|
-
return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
146
|
-
}
|
|
147
|
-
}, [handleEntryFocus]);
|
|
148
|
-
return (0, import_jsx_runtime3.jsx)(
|
|
149
|
-
RovingFocusProvider,
|
|
150
|
-
{
|
|
151
|
-
scope: __scopeRovingFocusGroup,
|
|
152
|
-
orientation,
|
|
153
|
-
dir: direction,
|
|
154
|
-
loop,
|
|
155
|
-
currentTabStopId,
|
|
156
|
-
onItemFocus: React3.useCallback(
|
|
157
|
-
(tabStopId) => setCurrentTabStopId(tabStopId),
|
|
158
|
-
[setCurrentTabStopId]
|
|
159
|
-
),
|
|
160
|
-
onItemShiftTab: React3.useCallback(() => setIsTabbingBackOut(true), []),
|
|
161
|
-
onFocusableItemAdd: React3.useCallback(
|
|
162
|
-
() => setFocusableItemsCount((prevCount) => prevCount + 1),
|
|
163
|
-
[]
|
|
164
|
-
),
|
|
165
|
-
onFocusableItemRemove: React3.useCallback(
|
|
166
|
-
() => setFocusableItemsCount((prevCount) => prevCount - 1),
|
|
167
|
-
[]
|
|
168
|
-
),
|
|
169
|
-
children: (0, import_jsx_runtime3.jsx)(
|
|
170
|
-
Primitive.div,
|
|
171
|
-
{
|
|
172
|
-
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
173
|
-
"data-orientation": orientation,
|
|
174
|
-
...groupProps,
|
|
175
|
-
ref: composedRefs,
|
|
176
|
-
style: { outline: "none", ...props.style },
|
|
177
|
-
onMouseDown: composeEventHandlers(props.onMouseDown, () => {
|
|
178
|
-
isClickFocusRef.current = true;
|
|
179
|
-
}),
|
|
180
|
-
onFocus: composeEventHandlers(props.onFocus, (event) => {
|
|
181
|
-
const isKeyboardFocus = !isClickFocusRef.current;
|
|
182
|
-
if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
|
|
183
|
-
const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
184
|
-
event.currentTarget.dispatchEvent(entryFocusEvent);
|
|
185
|
-
if (!entryFocusEvent.defaultPrevented) {
|
|
186
|
-
const items = getItems().filter((item) => item.focusable);
|
|
187
|
-
const activeItem = items.find((item) => item.active);
|
|
188
|
-
const currentItem = items.find((item) => item.id === currentTabStopId);
|
|
189
|
-
const candidateItems = [activeItem, currentItem, ...items].filter(
|
|
190
|
-
Boolean
|
|
191
|
-
);
|
|
192
|
-
const candidateNodes = candidateItems.map((item) => item.ref.current);
|
|
193
|
-
focusFirst(candidateNodes, preventScrollOnEntryFocus);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
isClickFocusRef.current = false;
|
|
197
|
-
}),
|
|
198
|
-
onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))
|
|
199
|
-
}
|
|
200
|
-
)
|
|
201
|
-
}
|
|
202
|
-
);
|
|
203
|
-
});
|
|
204
|
-
var ITEM_NAME = "RovingFocusGroupItem";
|
|
205
|
-
var RovingFocusGroupItem = React3.forwardRef(
|
|
206
|
-
(props, forwardedRef) => {
|
|
207
|
-
const {
|
|
208
|
-
__scopeRovingFocusGroup,
|
|
209
|
-
focusable = true,
|
|
210
|
-
active = false,
|
|
211
|
-
tabStopId,
|
|
212
|
-
children,
|
|
213
|
-
...itemProps
|
|
214
|
-
} = props;
|
|
215
|
-
const autoId = useId();
|
|
216
|
-
const id = tabStopId || autoId;
|
|
217
|
-
const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);
|
|
218
|
-
const isCurrentTabStop = context.currentTabStopId === id;
|
|
219
|
-
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
220
|
-
const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;
|
|
221
|
-
React3.useEffect(() => {
|
|
222
|
-
if (focusable) {
|
|
223
|
-
onFocusableItemAdd();
|
|
224
|
-
return () => onFocusableItemRemove();
|
|
225
|
-
}
|
|
226
|
-
}, [focusable, onFocusableItemAdd, onFocusableItemRemove]);
|
|
227
|
-
return (0, import_jsx_runtime3.jsx)(
|
|
228
|
-
Collection.ItemSlot,
|
|
229
|
-
{
|
|
230
|
-
scope: __scopeRovingFocusGroup,
|
|
231
|
-
id,
|
|
232
|
-
focusable,
|
|
233
|
-
active,
|
|
234
|
-
children: (0, import_jsx_runtime3.jsx)(
|
|
235
|
-
Primitive.span,
|
|
236
|
-
{
|
|
237
|
-
tabIndex: isCurrentTabStop ? 0 : -1,
|
|
238
|
-
"data-orientation": context.orientation,
|
|
239
|
-
...itemProps,
|
|
240
|
-
ref: forwardedRef,
|
|
241
|
-
onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {
|
|
242
|
-
if (!focusable) event.preventDefault();
|
|
243
|
-
else context.onItemFocus(id);
|
|
244
|
-
}),
|
|
245
|
-
onFocus: composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),
|
|
246
|
-
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
247
|
-
if (event.key === "Tab" && event.shiftKey) {
|
|
248
|
-
context.onItemShiftTab();
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
if (event.target !== event.currentTarget) return;
|
|
252
|
-
const focusIntent = getFocusIntent(event, context.orientation, context.dir);
|
|
253
|
-
if (focusIntent !== void 0) {
|
|
254
|
-
if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
|
|
255
|
-
event.preventDefault();
|
|
256
|
-
const items = getItems().filter((item) => item.focusable);
|
|
257
|
-
let candidateNodes = items.map((item) => item.ref.current);
|
|
258
|
-
if (focusIntent === "last") candidateNodes.reverse();
|
|
259
|
-
else if (focusIntent === "prev" || focusIntent === "next") {
|
|
260
|
-
if (focusIntent === "prev") candidateNodes.reverse();
|
|
261
|
-
const currentIndex = candidateNodes.indexOf(event.currentTarget);
|
|
262
|
-
candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
|
|
263
|
-
}
|
|
264
|
-
setTimeout(() => focusFirst(candidateNodes));
|
|
265
|
-
}
|
|
266
|
-
}),
|
|
267
|
-
children: typeof children === "function" ? children({ isCurrentTabStop, hasTabStop: currentTabStopId != null }) : children
|
|
268
|
-
}
|
|
269
|
-
)
|
|
270
|
-
}
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
);
|
|
274
|
-
RovingFocusGroupItem.displayName = ITEM_NAME;
|
|
275
|
-
var MAP_KEY_TO_FOCUS_INTENT = {
|
|
276
|
-
ArrowLeft: "prev",
|
|
277
|
-
ArrowUp: "prev",
|
|
278
|
-
ArrowRight: "next",
|
|
279
|
-
ArrowDown: "next",
|
|
280
|
-
PageUp: "first",
|
|
281
|
-
Home: "first",
|
|
282
|
-
PageDown: "last",
|
|
283
|
-
End: "last"
|
|
284
|
-
};
|
|
285
|
-
function getDirectionAwareKey(key, dir) {
|
|
286
|
-
if (dir !== "rtl") return key;
|
|
287
|
-
return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
288
|
-
}
|
|
289
|
-
function getFocusIntent(event, orientation, dir) {
|
|
290
|
-
const key = getDirectionAwareKey(event.key, dir);
|
|
291
|
-
if (orientation === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key)) return void 0;
|
|
292
|
-
if (orientation === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key)) return void 0;
|
|
293
|
-
return MAP_KEY_TO_FOCUS_INTENT[key];
|
|
294
|
-
}
|
|
295
|
-
function focusFirst(candidates, preventScroll = false) {
|
|
296
|
-
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
297
|
-
for (const candidate of candidates) {
|
|
298
|
-
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
299
|
-
candidate.focus({ preventScroll });
|
|
300
|
-
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
function wrapArray(array, startIndex) {
|
|
304
|
-
return array.map((_, index) => array[(startIndex + index) % array.length]);
|
|
305
|
-
}
|
|
306
|
-
var Root = RovingFocusGroup;
|
|
307
|
-
var Item = RovingFocusGroupItem;
|
|
308
|
-
|
|
309
|
-
export {
|
|
310
|
-
createCollection,
|
|
311
|
-
createRovingFocusGroupScope,
|
|
312
|
-
Root,
|
|
313
|
-
Item
|
|
314
|
-
};
|
|
315
|
-
//# sourceMappingURL=chunk-QX3PPTYO.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../node_modules/@radix-ui/react-roving-focus/src/roving-focus-group.tsx", "../../../../../node_modules/@radix-ui/react-collection/src/collection-legacy.tsx", "../../../../../node_modules/@radix-ui/react-collection/src/collection.tsx", "../../../../../node_modules/@radix-ui/react-collection/src/ordered-dictionary.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createCollection } from '@radix-ui/react-collection';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useId } from '@radix-ui/react-id';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useDirection } from '@radix-ui/react-direction';\n\nimport type { Scope } from '@radix-ui/react-context';\n\nconst ENTRY_FOCUS = 'rovingFocusGroup.onEntryFocus';\nconst EVENT_OPTIONS = { bubbles: false, cancelable: true };\n\n/* -------------------------------------------------------------------------------------------------\n * RovingFocusGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'RovingFocusGroup';\n\ntype ItemData = { id: string; focusable: boolean; active: boolean };\nconst [Collection, useCollection, createCollectionScope] = createCollection<\n HTMLSpanElement,\n ItemData\n>(GROUP_NAME);\n\ntype ScopedProps<P> = P & { __scopeRovingFocusGroup?: Scope };\nconst [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(\n GROUP_NAME,\n [createCollectionScope]\n);\n\ntype Orientation = React.AriaAttributes['aria-orientation'];\ntype Direction = 'ltr' | 'rtl';\n\ninterface RovingFocusGroupOptions {\n /**\n * The orientation of the group.\n * Mainly so arrow navigation is done accordingly (left & right vs. up & down)\n */\n orientation?: Orientation;\n /**\n * The direction of navigation between items.\n */\n dir?: Direction;\n /**\n * Whether keyboard navigation should loop around\n * @defaultValue false\n */\n loop?: boolean;\n}\n\ntype RovingContextValue = RovingFocusGroupOptions & {\n currentTabStopId: string | null;\n onItemFocus(tabStopId: string): void;\n onItemShiftTab(): void;\n onFocusableItemAdd(): void;\n onFocusableItemRemove(): void;\n};\n\nconst [RovingFocusProvider, useRovingFocusContext] =\n createRovingFocusGroupContext<RovingContextValue>(GROUP_NAME);\n\ntype RovingFocusGroupElement = RovingFocusGroupImplElement;\ninterface RovingFocusGroupProps extends RovingFocusGroupImplProps {}\n\nconst RovingFocusGroup = React.forwardRef<RovingFocusGroupElement, RovingFocusGroupProps>(\n (props: ScopedProps<RovingFocusGroupProps>, forwardedRef) => {\n return (\n <Collection.Provider scope={props.__scopeRovingFocusGroup}>\n <Collection.Slot scope={props.__scopeRovingFocusGroup}>\n <RovingFocusGroupImpl {...props} ref={forwardedRef} />\n </Collection.Slot>\n </Collection.Provider>\n );\n }\n);\n\nRovingFocusGroup.displayName = GROUP_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype RovingFocusGroupImplElement = React.ComponentRef<typeof Primitive.div>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface RovingFocusGroupImplProps\n extends Omit<PrimitiveDivProps, 'dir'>,\n RovingFocusGroupOptions {\n currentTabStopId?: string | null;\n defaultCurrentTabStopId?: string;\n onCurrentTabStopIdChange?: (tabStopId: string | null) => void;\n onEntryFocus?: (event: Event) => void;\n preventScrollOnEntryFocus?: boolean;\n}\n\nconst RovingFocusGroupImpl = React.forwardRef<\n RovingFocusGroupImplElement,\n RovingFocusGroupImplProps\n>((props: ScopedProps<RovingFocusGroupImplProps>, forwardedRef) => {\n const {\n __scopeRovingFocusGroup,\n orientation,\n loop = false,\n dir,\n currentTabStopId: currentTabStopIdProp,\n defaultCurrentTabStopId,\n onCurrentTabStopIdChange,\n onEntryFocus,\n preventScrollOnEntryFocus = false,\n ...groupProps\n } = props;\n const ref = React.useRef<RovingFocusGroupImplElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const direction = useDirection(dir);\n const [currentTabStopId, setCurrentTabStopId] = useControllableState({\n prop: currentTabStopIdProp,\n defaultProp: defaultCurrentTabStopId ?? null,\n onChange: onCurrentTabStopIdChange,\n caller: GROUP_NAME,\n });\n const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false);\n const handleEntryFocus = useCallbackRef(onEntryFocus);\n const getItems = useCollection(__scopeRovingFocusGroup);\n const isClickFocusRef = React.useRef(false);\n const [focusableItemsCount, setFocusableItemsCount] = React.useState(0);\n\n React.useEffect(() => {\n const node = ref.current;\n if (node) {\n node.addEventListener(ENTRY_FOCUS, handleEntryFocus);\n return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);\n }\n }, [handleEntryFocus]);\n\n return (\n <RovingFocusProvider\n scope={__scopeRovingFocusGroup}\n orientation={orientation}\n dir={direction}\n loop={loop}\n currentTabStopId={currentTabStopId}\n onItemFocus={React.useCallback(\n (tabStopId) => setCurrentTabStopId(tabStopId),\n [setCurrentTabStopId]\n )}\n onItemShiftTab={React.useCallback(() => setIsTabbingBackOut(true), [])}\n onFocusableItemAdd={React.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount + 1),\n []\n )}\n onFocusableItemRemove={React.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount - 1),\n []\n )}\n >\n <Primitive.div\n tabIndex={isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0}\n data-orientation={orientation}\n {...groupProps}\n ref={composedRefs}\n style={{ outline: 'none', ...props.style }}\n onMouseDown={composeEventHandlers(props.onMouseDown, () => {\n isClickFocusRef.current = true;\n })}\n onFocus={composeEventHandlers(props.onFocus, (event) => {\n // We normally wouldn't need this check, because we already check\n // that the focus is on the current target and not bubbling to it.\n // We do this because Safari doesn't focus buttons when clicked, and\n // instead, the wrapper will get focused and not through a bubbling event.\n const isKeyboardFocus = !isClickFocusRef.current;\n\n if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {\n const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);\n event.currentTarget.dispatchEvent(entryFocusEvent);\n\n if (!entryFocusEvent.defaultPrevented) {\n const items = getItems().filter((item) => item.focusable);\n const activeItem = items.find((item) => item.active);\n const currentItem = items.find((item) => item.id === currentTabStopId);\n const candidateItems = [activeItem, currentItem, ...items].filter(\n Boolean\n ) as typeof items;\n const candidateNodes = candidateItems.map((item) => item.ref.current!);\n focusFirst(candidateNodes, preventScrollOnEntryFocus);\n }\n }\n\n isClickFocusRef.current = false;\n })}\n onBlur={composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))}\n />\n </RovingFocusProvider>\n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * RovingFocusGroupItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'RovingFocusGroupItem';\n\ntype RovingFocusItemElement = React.ComponentRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface RovingFocusItemProps extends Omit<PrimitiveSpanProps, 'children'> {\n tabStopId?: string;\n focusable?: boolean;\n active?: boolean;\n children?:\n | React.ReactNode\n | ((props: { hasTabStop: boolean; isCurrentTabStop: boolean }) => React.ReactNode);\n}\n\nconst RovingFocusGroupItem = React.forwardRef<RovingFocusItemElement, RovingFocusItemProps>(\n (props: ScopedProps<RovingFocusItemProps>, forwardedRef) => {\n const {\n __scopeRovingFocusGroup,\n focusable = true,\n active = false,\n tabStopId,\n children,\n ...itemProps\n } = props;\n const autoId = useId();\n const id = tabStopId || autoId;\n const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);\n const isCurrentTabStop = context.currentTabStopId === id;\n const getItems = useCollection(__scopeRovingFocusGroup);\n\n const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;\n\n React.useEffect(() => {\n if (focusable) {\n onFocusableItemAdd();\n return () => onFocusableItemRemove();\n }\n }, [focusable, onFocusableItemAdd, onFocusableItemRemove]);\n\n return (\n <Collection.ItemSlot\n scope={__scopeRovingFocusGroup}\n id={id}\n focusable={focusable}\n active={active}\n >\n <Primitive.span\n tabIndex={isCurrentTabStop ? 0 : -1}\n data-orientation={context.orientation}\n {...itemProps}\n ref={forwardedRef}\n onMouseDown={composeEventHandlers(props.onMouseDown, (event) => {\n // We prevent focusing non-focusable items on `mousedown`.\n // Even though the item has tabIndex={-1}, that only means take it out of the tab order.\n if (!focusable) event.preventDefault();\n // Safari doesn't focus a button when clicked so we run our logic on mousedown also\n else context.onItemFocus(id);\n })}\n onFocus={composeEventHandlers(props.onFocus, () => context.onItemFocus(id))}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key === 'Tab' && event.shiftKey) {\n context.onItemShiftTab();\n return;\n }\n\n if (event.target !== event.currentTarget) return;\n\n const focusIntent = getFocusIntent(event, context.orientation, context.dir);\n\n if (focusIntent !== undefined) {\n if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;\n event.preventDefault();\n const items = getItems().filter((item) => item.focusable);\n let candidateNodes = items.map((item) => item.ref.current!);\n\n if (focusIntent === 'last') candidateNodes.reverse();\n else if (focusIntent === 'prev' || focusIntent === 'next') {\n if (focusIntent === 'prev') candidateNodes.reverse();\n const currentIndex = candidateNodes.indexOf(event.currentTarget);\n candidateNodes = context.loop\n ? wrapArray(candidateNodes, currentIndex + 1)\n : candidateNodes.slice(currentIndex + 1);\n }\n\n /**\n * Imperative focus during keydown is risky so we prevent React's batching updates\n * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332\n */\n setTimeout(() => focusFirst(candidateNodes));\n }\n })}\n >\n {typeof children === 'function'\n ? children({ isCurrentTabStop, hasTabStop: currentTabStopId != null })\n : children}\n </Primitive.span>\n </Collection.ItemSlot>\n );\n }\n);\n\nRovingFocusGroupItem.displayName = ITEM_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\n// prettier-ignore\nconst MAP_KEY_TO_FOCUS_INTENT: Record<string, FocusIntent> = {\n ArrowLeft: 'prev', ArrowUp: 'prev',\n ArrowRight: 'next', ArrowDown: 'next',\n PageUp: 'first', Home: 'first',\n PageDown: 'last', End: 'last',\n};\n\nfunction getDirectionAwareKey(key: string, dir?: Direction) {\n if (dir !== 'rtl') return key;\n return key === 'ArrowLeft' ? 'ArrowRight' : key === 'ArrowRight' ? 'ArrowLeft' : key;\n}\n\ntype FocusIntent = 'first' | 'last' | 'prev' | 'next';\n\nfunction getFocusIntent(event: React.KeyboardEvent, orientation?: Orientation, dir?: Direction) {\n const key = getDirectionAwareKey(event.key, dir);\n if (orientation === 'vertical' && ['ArrowLeft', 'ArrowRight'].includes(key)) return undefined;\n if (orientation === 'horizontal' && ['ArrowUp', 'ArrowDown'].includes(key)) return undefined;\n return MAP_KEY_TO_FOCUS_INTENT[key];\n}\n\nfunction focusFirst(candidates: HTMLElement[], preventScroll = false) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus({ preventScroll });\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\n\n/**\n * Wraps an array around itself at a given start index\n * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`\n */\nfunction wrapArray<T>(array: T[], startIndex: number) {\n return array.map<T>((_, index) => array[(startIndex + index) % array.length]!);\n}\n\nconst Root = RovingFocusGroup;\nconst Item = RovingFocusGroupItem;\n\nexport {\n createRovingFocusGroupScope,\n //\n RovingFocusGroup,\n RovingFocusGroupItem,\n //\n Root,\n Item,\n};\nexport type { RovingFocusGroupProps, RovingFocusItemProps };\n", "import React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createSlot, type Slot } from '@radix-ui/react-slot';\n\ntype SlotProps = React.ComponentPropsWithoutRef<typeof Slot>;\ntype CollectionElement = HTMLElement;\ninterface CollectionProps extends SlotProps {\n scope: any;\n}\n\n// We have resorted to returning slots directly rather than exposing primitives that can then\n// be slotted like `<CollectionItem as={Slot}>\u2026</CollectionItem>`.\n// This is because we encountered issues with generic types that cannot be statically analysed\n// due to creating them dynamically via createCollection.\n\nfunction createCollection<ItemElement extends HTMLElement, ItemData = {}>(name: string) {\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = name + 'CollectionProvider';\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n type ContextValue = {\n collectionRef: React.RefObject<CollectionElement | null>;\n itemMap: Map<\n React.RefObject<ItemElement | null>,\n { ref: React.RefObject<ItemElement | null> } & ItemData\n >;\n };\n\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext<ContextValue>(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: new Map() }\n );\n\n const CollectionProvider: React.FC<{ children?: React.ReactNode; scope: any }> = (props) => {\n const { scope, children } = props;\n const ref = React.useRef<CollectionElement>(null);\n const itemMap = React.useRef<ContextValue['itemMap']>(new Map()).current;\n return (\n <CollectionProviderImpl scope={scope} itemMap={itemMap} collectionRef={ref}>\n {children}\n </CollectionProviderImpl>\n );\n };\n\n CollectionProvider.displayName = PROVIDER_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = name + 'CollectionSlot';\n\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef<CollectionElement, CollectionProps>(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return <CollectionSlotImpl ref={composedRefs}>{children}</CollectionSlotImpl>;\n }\n );\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = name + 'CollectionItemSlot';\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = ItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef<ItemElement, CollectionItemSlotProps>(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef<ItemElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...(itemData as unknown as ItemData) });\n return () => void context.itemMap.delete(ref);\n });\n\n return (\n <CollectionItemSlotImpl {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs}>\n {children}\n </CollectionItemSlotImpl>\n );\n }\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useCollection(scope: any) {\n const context = useCollectionContext(name + 'CollectionConsumer', scope);\n\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current!) - orderedNodes.indexOf(b.ref.current!)\n );\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n\n return getItems;\n }\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionProps };\n", "import React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createSlot, type Slot } from '@radix-ui/react-slot';\nimport type { EntryOf } from './ordered-dictionary';\nimport { OrderedDict } from './ordered-dictionary';\n\ntype SlotProps = React.ComponentPropsWithoutRef<typeof Slot>;\ntype CollectionElement = HTMLElement;\ninterface CollectionProps extends SlotProps {\n scope: any;\n}\n\ninterface BaseItemData {\n id?: string;\n}\n\ntype ItemDataWithElement<\n ItemData extends BaseItemData,\n ItemElement extends HTMLElement,\n> = ItemData & {\n element: ItemElement;\n};\n\ntype ItemMap<ItemElement extends HTMLElement, ItemData extends BaseItemData> = OrderedDict<\n ItemElement,\n ItemDataWithElement<ItemData, ItemElement>\n>;\n\nfunction createCollection<\n ItemElement extends HTMLElement,\n ItemData extends BaseItemData = BaseItemData,\n>(name: string) {\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = name + 'CollectionProvider';\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n type ContextValue = {\n collectionElement: CollectionElement | null;\n collectionRef: React.Ref<CollectionElement | null>;\n collectionRefObject: React.RefObject<CollectionElement | null>;\n itemMap: ItemMap<ItemElement, ItemData>;\n setItemMap: React.Dispatch<React.SetStateAction<ItemMap<ItemElement, ItemData>>>;\n };\n\n const [CollectionContextProvider, useCollectionContext] = createCollectionContext<ContextValue>(\n PROVIDER_NAME,\n {\n collectionElement: null,\n collectionRef: { current: null },\n collectionRefObject: { current: null },\n itemMap: new OrderedDict(),\n setItemMap: () => void 0,\n }\n );\n\n type CollectionState = [\n ItemMap: ItemMap<ItemElement, ItemData>,\n SetItemMap: React.Dispatch<React.SetStateAction<ItemMap<ItemElement, ItemData>>>,\n ];\n\n const CollectionProvider: React.FC<{\n children?: React.ReactNode;\n scope: any;\n state?: CollectionState;\n }> = ({ state, ...props }) => {\n return state ? (\n <CollectionProviderImpl {...props} state={state} />\n ) : (\n <CollectionInit {...props} />\n );\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n\n const CollectionInit: React.FC<{\n children?: React.ReactNode;\n scope: any;\n }> = (props) => {\n const state = useInitCollection();\n return <CollectionProviderImpl {...props} state={state} />;\n };\n CollectionInit.displayName = PROVIDER_NAME + 'Init';\n\n const CollectionProviderImpl: React.FC<{\n children?: React.ReactNode;\n scope: any;\n state: CollectionState;\n }> = (props) => {\n const { scope, children, state } = props;\n const ref = React.useRef<CollectionElement>(null);\n const [collectionElement, setCollectionElement] = React.useState<CollectionElement | null>(\n null\n );\n const composeRefs = useComposedRefs(ref, setCollectionElement);\n const [itemMap, setItemMap] = state;\n\n React.useEffect(() => {\n if (!collectionElement) return;\n\n const observer = getChildListObserver(() => {\n // setItemMap((map) => {\n // const copy = new OrderedDict(map).toSorted(([, a], [, b]) =>\n // !a.element || !b.element ? 0 : isElementPreceding(a.element, b.element) ? -1 : 1\n // );\n // // check if the order has changed\n // let index = -1;\n // for (const entry of copy) {\n // index++;\n // const key = map.keyAt(index)!;\n // const [copyKey] = entry;\n // if (key !== copyKey) {\n // // order has changed!\n // return copy;\n // }\n // }\n // return map;\n // });\n });\n observer.observe(collectionElement, {\n childList: true,\n subtree: true,\n });\n return () => {\n observer.disconnect();\n };\n }, [collectionElement]);\n\n return (\n <CollectionContextProvider\n scope={scope}\n itemMap={itemMap}\n setItemMap={setItemMap}\n collectionRef={composeRefs}\n collectionRefObject={ref}\n collectionElement={collectionElement}\n >\n {children}\n </CollectionContextProvider>\n );\n };\n\n CollectionProviderImpl.displayName = PROVIDER_NAME + 'Impl';\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = name + 'CollectionSlot';\n\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef<CollectionElement, CollectionProps>(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return <CollectionSlotImpl ref={composedRefs}>{children}</CollectionSlotImpl>;\n }\n );\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = name + 'CollectionItemSlot';\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = ItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef<ItemElement, CollectionItemSlotProps>(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef<ItemElement>(null);\n const [element, setElement] = React.useState<ItemElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref, setElement);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n\n const { setItemMap } = context;\n\n const itemDataRef = React.useRef(itemData);\n if (!shallowEqual(itemDataRef.current, itemData)) {\n itemDataRef.current = itemData;\n }\n const memoizedItemData = itemDataRef.current;\n\n React.useEffect(() => {\n const itemData = memoizedItemData;\n setItemMap((map) => {\n if (!element) {\n return map;\n }\n\n if (!map.has(element)) {\n map.set(element, { ...(itemData as unknown as ItemData), element });\n return map.toSorted(sortByDocumentPosition);\n }\n\n return map\n .set(element, { ...(itemData as unknown as ItemData), element })\n .toSorted(sortByDocumentPosition);\n });\n\n return () => {\n setItemMap((map) => {\n if (!element || !map.has(element)) {\n return map;\n }\n map.delete(element);\n return new OrderedDict(map);\n });\n };\n }, [element, memoizedItemData, setItemMap]);\n\n return (\n <CollectionItemSlotImpl {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs as any}>\n {children}\n </CollectionItemSlotImpl>\n );\n }\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useInitCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useInitCollection() {\n return React.useState<ItemMap<ItemElement, ItemData>>(new OrderedDict());\n }\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useCollection(scope: any) {\n const { itemMap } = useCollectionContext(name + 'CollectionConsumer', scope);\n\n return itemMap;\n }\n\n const functions = {\n createCollectionScope,\n useCollection,\n useInitCollection,\n };\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n functions,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionProps };\n\nfunction shallowEqual(a: any, b: any) {\n if (a === b) return true;\n if (typeof a !== 'object' || typeof b !== 'object') return false;\n if (a == null || b == null) return false;\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n if (keysA.length !== keysB.length) return false;\n for (const key of keysA) {\n if (!Object.prototype.hasOwnProperty.call(b, key)) return false;\n if (a[key] !== b[key]) return false;\n }\n return true;\n}\n\nfunction isElementPreceding(a: Element, b: Element) {\n return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);\n}\n\nfunction sortByDocumentPosition<E extends HTMLElement, T extends BaseItemData>(\n a: EntryOf<ItemMap<E, T>>,\n b: EntryOf<ItemMap<E, T>>\n) {\n return !a[1].element || !b[1].element\n ? 0\n : isElementPreceding(a[1].element, b[1].element)\n ? -1\n : 1;\n}\n\nfunction getChildListObserver(callback: () => void) {\n const observer = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (mutation.type === 'childList') {\n callback();\n return;\n }\n }\n });\n\n return observer;\n}\n", "// Not a real member because it shouldn't be accessible, but the super class\n// calls `set` which needs to read the instanciation state, so it can't be a\n// private member.\nconst __instanciated = new WeakMap<OrderedDict<any, any>, boolean>();\nexport class OrderedDict<K, V> extends Map<K, V> {\n #keys: K[];\n\n constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);\n constructor(entries?: readonly (readonly [K, V])[] | null) {\n super(entries);\n this.#keys = [...super.keys()];\n __instanciated.set(this, true);\n }\n\n set(key: K, value: V) {\n if (__instanciated.get(this)) {\n if (this.has(key)) {\n this.#keys[this.#keys.indexOf(key)] = key;\n } else {\n this.#keys.push(key);\n }\n }\n super.set(key, value);\n return this;\n }\n\n insert(index: number, key: K, value: V) {\n const has = this.has(key);\n const length = this.#keys.length;\n const relativeIndex = toSafeInteger(index);\n let actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n const safeIndex = actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n\n if (safeIndex === this.size || (has && safeIndex === this.size - 1) || safeIndex === -1) {\n this.set(key, value);\n return this;\n }\n\n const size = this.size + (has ? 0 : 1);\n\n // If you insert at, say, -2, without this bit you'd replace the\n // second-to-last item and push the rest up one, which means the new item is\n // 3rd to last. This isn't very intuitive; inserting at -2 is more like\n // saying \"make this item the second to last\".\n if (relativeIndex < 0) {\n actualIndex++;\n }\n\n const keys = [...this.#keys];\n let nextValue: V | undefined;\n let shouldSkip = false;\n for (let i = actualIndex; i < size; i++) {\n if (actualIndex === i) {\n let nextKey = keys[i]!;\n if (keys[i] === key) {\n nextKey = keys[i + 1]!;\n }\n if (has) {\n // delete first to ensure that the item is moved to the end\n this.delete(key);\n }\n nextValue = this.get(nextKey);\n this.set(key, value);\n } else {\n if (!shouldSkip && keys[i - 1] === key) {\n shouldSkip = true;\n }\n const currentKey = keys[shouldSkip ? i : i - 1]!;\n const currentValue = nextValue!;\n nextValue = this.get(currentKey);\n this.delete(currentKey);\n this.set(currentKey, currentValue);\n }\n }\n return this;\n }\n\n with(index: number, key: K, value: V) {\n const copy = new OrderedDict(this);\n copy.insert(index, key, value);\n return copy;\n }\n\n before(key: K) {\n const index = this.#keys.indexOf(key) - 1;\n if (index < 0) {\n return undefined;\n }\n return this.entryAt(index);\n }\n\n /**\n * Sets a new key-value pair at the position before the given key.\n */\n setBefore(key: K, newKey: K, value: V) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index, newKey, value);\n }\n\n after(key: K) {\n let index = this.#keys.indexOf(key);\n index = index === -1 || index === this.size - 1 ? -1 : index + 1;\n if (index === -1) {\n return undefined;\n }\n return this.entryAt(index);\n }\n\n /**\n * Sets a new key-value pair at the position after the given key.\n */\n setAfter(key: K, newKey: K, value: V) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index + 1, newKey, value);\n }\n\n first() {\n return this.entryAt(0);\n }\n\n last() {\n return this.entryAt(-1);\n }\n\n clear() {\n this.#keys = [];\n return super.clear();\n }\n\n delete(key: K) {\n const deleted = super.delete(key);\n if (deleted) {\n this.#keys.splice(this.#keys.indexOf(key), 1);\n }\n return deleted;\n }\n\n deleteAt(index: number) {\n const key = this.keyAt(index);\n if (key !== undefined) {\n return this.delete(key);\n }\n return false;\n }\n\n at(index: number) {\n const key = at(this.#keys, index);\n if (key !== undefined) {\n return this.get(key);\n }\n }\n\n entryAt(index: number): [K, V] | undefined {\n const key = at(this.#keys, index);\n if (key !== undefined) {\n return [key, this.get(key)!];\n }\n }\n\n indexOf(key: K) {\n return this.#keys.indexOf(key);\n }\n\n keyAt(index: number) {\n return at(this.#keys, index);\n }\n\n from(key: K, offset: number) {\n const index = this.indexOf(key);\n if (index === -1) {\n return undefined;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.at(dest);\n }\n\n keyFrom(key: K, offset: number) {\n const index = this.indexOf(key);\n if (index === -1) {\n return undefined;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.keyAt(dest);\n }\n\n find(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean,\n thisArg?: any\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return entry;\n }\n index++;\n }\n return undefined;\n }\n\n findIndex(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean,\n thisArg?: any\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return index;\n }\n index++;\n }\n return -1;\n }\n\n filter<KK extends K, VV extends V>(\n predicate: (entry: [K, V], index: number, dict: OrderedDict<K, V>) => entry is [KK, VV],\n thisArg?: any\n ): OrderedDict<KK, VV>;\n\n filter(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any\n ): OrderedDict<K, V>;\n\n filter(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any\n ) {\n const entries: Array<[K, V]> = [];\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n entries.push(entry);\n }\n index++;\n }\n return new OrderedDict(entries);\n }\n\n map<U>(\n callbackfn: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => U,\n thisArg?: any\n ): OrderedDict<K, U> {\n const entries: [K, U][] = [];\n let index = 0;\n for (const entry of this) {\n entries.push([entry[0], Reflect.apply(callbackfn, thisArg, [entry, index, this])]);\n index++;\n }\n return new OrderedDict(entries);\n }\n\n reduce(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>\n ) => [K, V]\n ): [K, V];\n reduce(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>\n ) => [K, V],\n initialValue: [K, V]\n ): [K, V];\n reduce<U>(\n callbackfn: (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>\n ) => U,\n initialValue: U\n ): U;\n\n reduce<U>(\n ...args: [\n (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>\n ) => U,\n U?,\n ]\n ) {\n const [callbackfn, initialValue] = args;\n let index = 0;\n let accumulator = initialValue ?? this.at(0)!;\n for (const entry of this) {\n if (index === 0 && args.length === 1) {\n accumulator = entry as any;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n index++;\n }\n return accumulator;\n }\n\n reduceRight(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>\n ) => [K, V]\n ): [K, V];\n reduceRight(\n callbackfn: (\n previousValue: [K, V],\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>\n ) => [K, V],\n initialValue: [K, V]\n ): [K, V];\n reduceRight<U>(\n callbackfn: (\n previousValue: [K, V],\n currentValue: U,\n currentIndex: number,\n dictionary: OrderedDict<K, V>\n ) => U,\n initialValue: U\n ): U;\n\n reduceRight<U>(\n ...args: [\n (\n previousValue: U,\n currentEntry: [K, V],\n currentIndex: number,\n dictionary: OrderedDict<K, V>\n ) => U,\n U?,\n ]\n ) {\n const [callbackfn, initialValue] = args;\n let accumulator = initialValue ?? this.at(-1)!;\n for (let index = this.size - 1; index >= 0; index--) {\n const entry = this.at(index)!;\n if (index === this.size - 1 && args.length === 1) {\n accumulator = entry as any;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n }\n return accumulator;\n }\n\n toSorted(compareFn?: (a: [K, V], b: [K, V]) => number): OrderedDict<K, V> {\n const entries = [...this.entries()].sort(compareFn);\n return new OrderedDict(entries);\n }\n\n toReversed(): OrderedDict<K, V> {\n const reversed = new OrderedDict<K, V>();\n for (let index = this.size - 1; index >= 0; index--) {\n const key = this.keyAt(index)!;\n const element = this.get(key)!;\n reversed.set(key, element);\n }\n return reversed;\n }\n\n toSpliced(start: number, deleteCount?: number): OrderedDict<K, V>;\n toSpliced(start: number, deleteCount: number, ...items: [K, V][]): OrderedDict<K, V>;\n\n toSpliced(...args: [start: number, deleteCount: number, ...items: [K, V][]]) {\n const entries = [...this.entries()];\n entries.splice(...args);\n return new OrderedDict(entries);\n }\n\n slice(start?: number, end?: number) {\n const result = new OrderedDict<K, V>();\n let stop = this.size - 1;\n\n if (start === undefined) {\n return result;\n }\n\n if (start < 0) {\n start = start + this.size;\n }\n\n if (end !== undefined && end > 0) {\n stop = end - 1;\n }\n\n for (let index = start; index <= stop; index++) {\n const key = this.keyAt(index)!;\n const element = this.get(key)!;\n result.set(key, element);\n }\n return result;\n }\n\n every(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any\n ) {\n let index = 0;\n for (const entry of this) {\n if (!Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return false;\n }\n index++;\n }\n return true;\n }\n\n some(\n predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown,\n thisArg?: any\n ) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return true;\n }\n index++;\n }\n return false;\n }\n}\n\nexport type KeyOf<D extends OrderedDict<any, any>> =\n D extends OrderedDict<infer K, any> ? K : never;\nexport type ValueOf<D extends OrderedDict<any, any>> =\n D extends OrderedDict<any, infer V> ? V : never;\nexport type EntryOf<D extends OrderedDict<any, any>> = [KeyOf<D>, ValueOf<D>];\nexport type KeyFrom<E extends EntryOf<any>> = E[0];\nexport type ValueFrom<E extends EntryOf<any>> = E[1];\n\nfunction at<T>(array: ArrayLike<T>, index: number): T | undefined {\n if ('at' in Array.prototype) {\n return Array.prototype.at.call(array, index);\n }\n const actualIndex = toSafeIndex(array, index);\n return actualIndex === -1 ? undefined : array[actualIndex];\n}\n\nfunction toSafeIndex(array: ArrayLike<any>, index: number) {\n const length = array.length;\n const relativeIndex = toSafeInteger(index);\n const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n}\n\nfunction toSafeInteger(number: number) {\n // eslint-disable-next-line no-self-compare\n return number !== number || number === 0 ? 0 : Math.trunc(number);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,SAAuB;;;ACAvB,mBAAkB;AA0CZ,yBAAA;AC1CN,IAAAC,gBAAkB;AAsEZ,IAAAC,sBAAA;ADtDN,SAAS,iBAAiE,MAAc;AAKtF,QAAM,gBAAgB,OAAO;AAC7B,QAAM,CAAC,yBAAyBC,sBAAqB,IAAI,mBAAmB,aAAa;AAUzF,QAAM,CAAC,wBAAwB,oBAAoB,IAAI;IACrD;IACA,EAAE,eAAe,EAAE,SAAS,KAAK,GAAG,SAAS,oBAAI,IAAI,EAAE;EACzD;AAEA,QAAM,qBAA2E,CAAC,UAAU;AAC1F,UAAM,EAAE,OAAO,SAAS,IAAI;AAC5B,UAAM,MAAM,aAAAC,QAAM,OAA0B,IAAI;AAChD,UAAM,UAAU,aAAAA,QAAM,OAAgC,oBAAI,IAAI,CAAC,EAAE;AACjE,eACE,wBAAC,wBAAA,EAAuB,OAAc,SAAkB,eAAe,KACpE,SAAA,CACH;EAEJ;AAEA,qBAAmB,cAAc;AAMjC,QAAM,uBAAuB,OAAO;AAEpC,QAAM,qBAAqB,WAAW,oBAAoB;AAC1D,QAAM,iBAAiB,aAAAA,QAAM;IAC3B,CAAC,OAAO,iBAAiB;AACvB,YAAM,EAAE,OAAO,SAAS,IAAI;AAC5B,YAAM,UAAU,qBAAqB,sBAAsB,KAAK;AAChE,YAAM,eAAe,gBAAgB,cAAc,QAAQ,aAAa;AACxE,iBAAO,wBAAC,oBAAA,EAAmB,KAAK,cAAe,SAAA,CAAS;IAC1D;EACF;AAEA,iBAAe,cAAc;AAM7B,QAAM,iBAAiB,OAAO;AAC9B,QAAM,iBAAiB;A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