@floegence/floe-webapp-core 0.35.8 → 0.35.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,79 +1,94 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import { createMemo as
|
|
3
|
-
import { createStore as
|
|
4
|
-
import { deferNonBlocking as
|
|
1
|
+
import { createComponent as Y } from "solid-js/web";
|
|
2
|
+
import { createMemo as p, createEffect as Z, on as $, createSignal as b, useContext as ee, createContext as te, batch as F } from "solid-js";
|
|
3
|
+
import { createStore as oe, reconcile as T, produce as M } from "solid-js/store";
|
|
4
|
+
import { deferNonBlocking as k } from "../../utils/defer.js";
|
|
5
5
|
import { DEFAULT_VIRTUAL_LIST_CONFIG as se } from "./types.js";
|
|
6
|
-
const
|
|
6
|
+
const z = te();
|
|
7
7
|
function Ce() {
|
|
8
|
-
const
|
|
9
|
-
if (!
|
|
8
|
+
const n = ee(z);
|
|
9
|
+
if (!n)
|
|
10
10
|
throw new Error("useChatContext must be used within a ChatProvider");
|
|
11
|
-
return
|
|
11
|
+
return n;
|
|
12
12
|
}
|
|
13
|
-
const
|
|
14
|
-
const
|
|
13
|
+
const xe = (n) => {
|
|
14
|
+
const C = p(() => ({
|
|
15
15
|
placeholder: "Type a message...",
|
|
16
16
|
allowAttachments: !0,
|
|
17
17
|
maxAttachments: 10,
|
|
18
18
|
maxAttachmentSize: 10485760,
|
|
19
19
|
// 10MB
|
|
20
|
-
...
|
|
21
|
-
})),
|
|
20
|
+
...n.config
|
|
21
|
+
})), u = p(() => ({
|
|
22
22
|
...se,
|
|
23
|
-
...
|
|
24
|
-
})), [
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
...n.config?.virtualList
|
|
24
|
+
})), [a, l] = oe(n.initialMessages || []), B = /* @__PURE__ */ new Map(), R = p(() => {
|
|
25
|
+
const e = /* @__PURE__ */ new Map();
|
|
26
|
+
for (let t = 0; t < a.length; t += 1) {
|
|
27
|
+
const o = a[t]?.id;
|
|
28
|
+
o && e.set(o, t);
|
|
29
|
+
}
|
|
30
|
+
return e;
|
|
31
|
+
}), x = (e) => {
|
|
32
|
+
const t = R().get(e);
|
|
33
|
+
if (t !== void 0) return t;
|
|
34
|
+
const o = a.findIndex((s) => s.id === e);
|
|
35
|
+
return o >= 0 ? o : void 0;
|
|
36
|
+
};
|
|
37
|
+
Z($(() => n.initialMessages, (e) => {
|
|
38
|
+
e && e.length > 0 && l(T(e));
|
|
27
39
|
}, {
|
|
28
40
|
defer: !0
|
|
29
41
|
}));
|
|
30
|
-
const [A, H] =
|
|
31
|
-
let
|
|
32
|
-
const g = /* @__PURE__ */ new Set(),
|
|
42
|
+
const [A, H] = b(!1), [P, D] = b(!0), [L, S] = b(null), [O, I] = b(0);
|
|
43
|
+
let j = 0;
|
|
44
|
+
const g = /* @__PURE__ */ new Set(), f = [], h = /* @__PURE__ */ new Map(), q = (e) => {
|
|
33
45
|
if (!g.delete(e)) return;
|
|
34
|
-
const t =
|
|
35
|
-
t >= 0 &&
|
|
36
|
-
},
|
|
37
|
-
const e = ++
|
|
38
|
-
return g.add(e),
|
|
39
|
-
},
|
|
40
|
-
for (;
|
|
41
|
-
const e =
|
|
46
|
+
const t = f.indexOf(e);
|
|
47
|
+
t >= 0 && f.splice(t, 1), I(g.size);
|
|
48
|
+
}, N = () => {
|
|
49
|
+
const e = ++j;
|
|
50
|
+
return g.add(e), f.push(e), I(g.size), e;
|
|
51
|
+
}, W = () => {
|
|
52
|
+
for (; f.length > 0; ) {
|
|
53
|
+
const e = f.shift();
|
|
42
54
|
if (e === void 0) return;
|
|
43
55
|
if (g.has(e)) {
|
|
44
56
|
g.delete(e), I(g.size);
|
|
45
57
|
return;
|
|
46
58
|
}
|
|
47
59
|
}
|
|
48
|
-
}, U =
|
|
49
|
-
|
|
60
|
+
}, U = p(() => O() > 0), _ = p(() => U() || L() !== null), y = (e) => {
|
|
61
|
+
l(M((t) => {
|
|
50
62
|
t.push(e);
|
|
51
63
|
}));
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
n !== -1 && (s[n] = t(s[n]));
|
|
56
|
-
}));
|
|
57
|
-
}, W = (e) => {
|
|
58
|
-
u(M((t) => {
|
|
59
|
-
const s = t.findIndex((n) => n.id === e);
|
|
60
|
-
s !== -1 && t.splice(s, 1);
|
|
61
|
-
})), f.delete(e);
|
|
62
|
-
}, _ = () => {
|
|
63
|
-
u(v([])), f.clear();
|
|
64
|
+
}, E = (e, t) => {
|
|
65
|
+
const o = x(e);
|
|
66
|
+
o !== void 0 && l(o, (s) => t(s));
|
|
64
67
|
}, V = (e) => {
|
|
65
|
-
|
|
68
|
+
const t = x(e);
|
|
69
|
+
t !== void 0 && (l(M((o) => {
|
|
70
|
+
o.splice(t, 1);
|
|
71
|
+
})), h.delete(e));
|
|
72
|
+
}, G = () => {
|
|
73
|
+
l(T([])), h.clear();
|
|
74
|
+
}, Q = (e) => {
|
|
75
|
+
l(T(e));
|
|
76
|
+
}, i = (e, t) => {
|
|
77
|
+
const o = x(e);
|
|
78
|
+
o !== void 0 && l(o, M((s) => {
|
|
79
|
+
t(s);
|
|
80
|
+
}));
|
|
66
81
|
};
|
|
67
|
-
let
|
|
68
|
-
const
|
|
69
|
-
const e =
|
|
70
|
-
|
|
71
|
-
e.forEach(
|
|
82
|
+
let v = [], w = null;
|
|
83
|
+
const J = () => {
|
|
84
|
+
const e = v;
|
|
85
|
+
v = [], w = null, F(() => {
|
|
86
|
+
e.forEach(K);
|
|
72
87
|
});
|
|
73
|
-
},
|
|
88
|
+
}, K = (e) => {
|
|
74
89
|
switch (e.type) {
|
|
75
90
|
case "message-start": {
|
|
76
|
-
|
|
91
|
+
W();
|
|
77
92
|
const t = {
|
|
78
93
|
id: e.messageId,
|
|
79
94
|
role: "assistant",
|
|
@@ -81,105 +96,94 @@ const Me = (o) => {
|
|
|
81
96
|
status: "streaming",
|
|
82
97
|
timestamp: Date.now()
|
|
83
98
|
};
|
|
84
|
-
|
|
99
|
+
y(t), S(e.messageId);
|
|
85
100
|
break;
|
|
86
101
|
}
|
|
87
102
|
case "block-start": {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}));
|
|
103
|
+
i(e.messageId, (t) => {
|
|
104
|
+
t.blocks.push(ne(e.blockType));
|
|
105
|
+
});
|
|
92
106
|
break;
|
|
93
107
|
}
|
|
94
108
|
case "block-delta": {
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
...t,
|
|
99
|
-
blocks: s
|
|
100
|
-
};
|
|
109
|
+
i(e.messageId, (t) => {
|
|
110
|
+
const o = t.blocks[e.blockIndex];
|
|
111
|
+
o && "content" in o && typeof o.content == "string" && (o.content += e.delta);
|
|
101
112
|
});
|
|
102
113
|
break;
|
|
103
114
|
}
|
|
104
115
|
case "block-set": {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return e.blockIndex === s.length ? s.push(e.block) : e.blockIndex >= 0 && e.blockIndex < s.length && (s[e.blockIndex] = e.block), {
|
|
108
|
-
...t,
|
|
109
|
-
blocks: s
|
|
110
|
-
};
|
|
116
|
+
i(e.messageId, (t) => {
|
|
117
|
+
e.blockIndex === t.blocks.length ? t.blocks.push(e.block) : e.blockIndex >= 0 && e.blockIndex < t.blocks.length && (t.blocks[e.blockIndex] = e.block);
|
|
111
118
|
});
|
|
112
119
|
break;
|
|
113
120
|
}
|
|
114
121
|
case "block-end":
|
|
115
122
|
break;
|
|
116
123
|
case "message-end": {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
})), x(null);
|
|
124
|
+
i(e.messageId, (t) => {
|
|
125
|
+
t.status = "complete";
|
|
126
|
+
}), S(null);
|
|
121
127
|
break;
|
|
122
128
|
}
|
|
123
129
|
case "error": {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
error: e.error
|
|
128
|
-
})), x(null);
|
|
130
|
+
i(e.messageId, (t) => {
|
|
131
|
+
t.status = "error", t.error = e.error;
|
|
132
|
+
}), S(null);
|
|
129
133
|
break;
|
|
130
134
|
}
|
|
131
135
|
}
|
|
132
|
-
},
|
|
133
|
-
messages: () =>
|
|
134
|
-
coldMessages:
|
|
136
|
+
}, X = {
|
|
137
|
+
messages: () => a,
|
|
138
|
+
coldMessages: B,
|
|
135
139
|
isLoadingHistory: A,
|
|
136
140
|
hasMoreHistory: P,
|
|
137
141
|
streamingMessageId: L,
|
|
138
142
|
isPreparing: U,
|
|
139
|
-
isWorking:
|
|
140
|
-
config:
|
|
141
|
-
virtualListConfig:
|
|
143
|
+
isWorking: _,
|
|
144
|
+
config: C,
|
|
145
|
+
virtualListConfig: u,
|
|
142
146
|
sendMessage: async (e, t = []) => {
|
|
143
|
-
const
|
|
147
|
+
const o = {
|
|
144
148
|
id: crypto.randomUUID(),
|
|
145
149
|
role: "user",
|
|
146
|
-
blocks:
|
|
150
|
+
blocks: re(e, t),
|
|
147
151
|
status: "sending",
|
|
148
152
|
timestamp: Date.now()
|
|
149
153
|
};
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
...
|
|
154
|
+
F(() => {
|
|
155
|
+
y(o), E(o.id, (c) => ({
|
|
156
|
+
...c,
|
|
153
157
|
status: "complete"
|
|
154
158
|
}));
|
|
155
159
|
});
|
|
156
160
|
try {
|
|
157
|
-
|
|
158
|
-
} catch (
|
|
159
|
-
console.error("onWillSend error:",
|
|
161
|
+
n.callbacks?.onWillSend?.(e, t);
|
|
162
|
+
} catch (c) {
|
|
163
|
+
console.error("onWillSend error:", c);
|
|
160
164
|
}
|
|
161
|
-
const
|
|
162
|
-
if (!
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
Promise.resolve().then(() =>
|
|
166
|
-
console.error("Failed to send message:",
|
|
165
|
+
const s = n.callbacks?.onSendMessage;
|
|
166
|
+
if (!s) return;
|
|
167
|
+
const d = N(), r = e, m = [...t];
|
|
168
|
+
k(() => {
|
|
169
|
+
Promise.resolve().then(() => s(r, m, y)).catch((c) => {
|
|
170
|
+
console.error("Failed to send message:", c);
|
|
167
171
|
}).finally(() => {
|
|
168
|
-
|
|
172
|
+
q(d);
|
|
169
173
|
});
|
|
170
174
|
});
|
|
171
175
|
},
|
|
172
176
|
loadMoreHistory: async () => {
|
|
173
177
|
if (A() || !P()) return;
|
|
174
|
-
const e =
|
|
175
|
-
e && (H(!0),
|
|
178
|
+
const e = n.callbacks?.onLoadMore;
|
|
179
|
+
e && (H(!0), k(() => {
|
|
176
180
|
Promise.resolve(e()).then((t) => {
|
|
177
181
|
if (t.length === 0) {
|
|
178
|
-
|
|
182
|
+
D(!1);
|
|
179
183
|
return;
|
|
180
184
|
}
|
|
181
|
-
|
|
182
|
-
|
|
185
|
+
l(M((o) => {
|
|
186
|
+
o.unshift(...t);
|
|
183
187
|
}));
|
|
184
188
|
}).catch((t) => {
|
|
185
189
|
console.error("Failed to load history:", t);
|
|
@@ -189,106 +193,87 @@ const Me = (o) => {
|
|
|
189
193
|
}));
|
|
190
194
|
},
|
|
191
195
|
retryMessage: (e) => {
|
|
192
|
-
const t =
|
|
193
|
-
t &&
|
|
196
|
+
const t = n.callbacks?.onRetry;
|
|
197
|
+
t && k(() => {
|
|
194
198
|
try {
|
|
195
199
|
t(e);
|
|
196
|
-
} catch (
|
|
197
|
-
console.error("Failed to retry message:",
|
|
200
|
+
} catch (o) {
|
|
201
|
+
console.error("Failed to retry message:", o);
|
|
198
202
|
}
|
|
199
203
|
});
|
|
200
204
|
},
|
|
201
|
-
addMessage:
|
|
202
|
-
updateMessage:
|
|
203
|
-
deleteMessage:
|
|
204
|
-
clearMessages:
|
|
205
|
-
setMessages:
|
|
205
|
+
addMessage: y,
|
|
206
|
+
updateMessage: E,
|
|
207
|
+
deleteMessage: V,
|
|
208
|
+
clearMessages: G,
|
|
209
|
+
setMessages: Q,
|
|
206
210
|
handleStreamEvent: (e) => {
|
|
207
|
-
|
|
211
|
+
v.push(e), w || (w = requestAnimationFrame(J));
|
|
208
212
|
},
|
|
209
213
|
uploadAttachment: async (e) => {
|
|
210
|
-
const t =
|
|
214
|
+
const t = n.callbacks?.onUploadAttachment;
|
|
211
215
|
return t ? await t(e) : URL.createObjectURL(e);
|
|
212
216
|
},
|
|
213
217
|
toggleToolCollapse: (e, t) => {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
return {
|
|
220
|
-
...n,
|
|
221
|
-
collapsed: a
|
|
222
|
-
};
|
|
218
|
+
i(e, (o) => {
|
|
219
|
+
for (const s of o.blocks)
|
|
220
|
+
if (s.type === "tool-call" && s.toolId === t) {
|
|
221
|
+
s.collapsed = s.collapsed === void 0 ? !1 : !s.collapsed;
|
|
222
|
+
break;
|
|
223
223
|
}
|
|
224
|
-
|
|
225
|
-
})
|
|
226
|
-
}));
|
|
224
|
+
});
|
|
227
225
|
},
|
|
228
|
-
approveToolCall: (e, t,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
})
|
|
241
|
-
}));
|
|
242
|
-
const n = o.callbacks?.onToolApproval;
|
|
243
|
-
n && p(() => {
|
|
244
|
-
Promise.resolve(n(e, t, s)).catch((a) => {
|
|
245
|
-
console.error("Failed to approve tool call:", a);
|
|
226
|
+
approveToolCall: (e, t, o) => {
|
|
227
|
+
i(e, (d) => {
|
|
228
|
+
for (const r of d.blocks)
|
|
229
|
+
if (!(r.type !== "tool-call" || r.toolId !== t) && !(r.requiresApproval !== !0 || r.approvalState !== "required")) {
|
|
230
|
+
o ? (r.approvalState = "approved", r.status = "running") : (r.approvalState = "rejected", r.status = "error", r.error = r.error || "Rejected by user");
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
const s = n.callbacks?.onToolApproval;
|
|
235
|
+
s && k(() => {
|
|
236
|
+
Promise.resolve(s(e, t, o)).catch((d) => {
|
|
237
|
+
console.error("Failed to approve tool call:", d);
|
|
246
238
|
});
|
|
247
239
|
});
|
|
248
240
|
},
|
|
249
|
-
heightCache:
|
|
241
|
+
heightCache: h,
|
|
250
242
|
setMessageHeight: (e, t) => {
|
|
251
|
-
|
|
243
|
+
h.set(e, t);
|
|
252
244
|
},
|
|
253
|
-
getMessageHeight: (e) =>
|
|
254
|
-
toggleChecklistItem: (e, t,
|
|
255
|
-
let
|
|
256
|
-
|
|
257
|
-
const m =
|
|
258
|
-
if (
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
...i,
|
|
265
|
-
items: K
|
|
266
|
-
};
|
|
245
|
+
getMessageHeight: (e) => h.get(e) || u().defaultItemHeight,
|
|
246
|
+
toggleChecklistItem: (e, t, o) => {
|
|
247
|
+
let s = null;
|
|
248
|
+
i(e, (r) => {
|
|
249
|
+
const m = r.blocks[t];
|
|
250
|
+
if (m && m.type === "checklist") {
|
|
251
|
+
for (const c of m.items)
|
|
252
|
+
if (c.id === o) {
|
|
253
|
+
s = !c.checked, c.checked = s;
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
267
256
|
}
|
|
268
|
-
return {
|
|
269
|
-
...r,
|
|
270
|
-
blocks: m
|
|
271
|
-
};
|
|
272
257
|
});
|
|
273
|
-
const
|
|
274
|
-
!
|
|
258
|
+
const d = n.callbacks?.onChecklistChange;
|
|
259
|
+
!d || s === null || k(() => {
|
|
275
260
|
try {
|
|
276
|
-
|
|
261
|
+
d(e, t, o, s);
|
|
277
262
|
} catch (r) {
|
|
278
263
|
console.error("Failed to handle checklist change:", r);
|
|
279
264
|
}
|
|
280
265
|
});
|
|
281
266
|
}
|
|
282
267
|
};
|
|
283
|
-
return
|
|
284
|
-
value:
|
|
268
|
+
return Y(z.Provider, {
|
|
269
|
+
value: X,
|
|
285
270
|
get children() {
|
|
286
|
-
return
|
|
271
|
+
return n.children;
|
|
287
272
|
}
|
|
288
273
|
});
|
|
289
274
|
};
|
|
290
|
-
function ne(
|
|
291
|
-
switch (
|
|
275
|
+
function ne(n) {
|
|
276
|
+
switch (n) {
|
|
292
277
|
case "text":
|
|
293
278
|
return {
|
|
294
279
|
type: "text",
|
|
@@ -364,26 +349,26 @@ function ne(o) {
|
|
|
364
349
|
};
|
|
365
350
|
}
|
|
366
351
|
}
|
|
367
|
-
function
|
|
368
|
-
const
|
|
369
|
-
for (const
|
|
370
|
-
|
|
352
|
+
function re(n, C) {
|
|
353
|
+
const u = [];
|
|
354
|
+
for (const a of C)
|
|
355
|
+
a.type === "image" ? u.push({
|
|
371
356
|
type: "image",
|
|
372
|
-
src:
|
|
373
|
-
alt:
|
|
374
|
-
}) :
|
|
357
|
+
src: a.url || a.preview || "",
|
|
358
|
+
alt: a.file.name
|
|
359
|
+
}) : u.push({
|
|
375
360
|
type: "file",
|
|
376
|
-
name:
|
|
377
|
-
size:
|
|
378
|
-
mimeType:
|
|
379
|
-
url:
|
|
361
|
+
name: a.file.name,
|
|
362
|
+
size: a.file.size,
|
|
363
|
+
mimeType: a.file.type,
|
|
364
|
+
url: a.url
|
|
380
365
|
});
|
|
381
|
-
return
|
|
366
|
+
return n.trim() && u.push({
|
|
382
367
|
type: "text",
|
|
383
|
-
content:
|
|
384
|
-
}),
|
|
368
|
+
content: n.trim()
|
|
369
|
+
}), u;
|
|
385
370
|
}
|
|
386
371
|
export {
|
|
387
|
-
|
|
372
|
+
xe as ChatProvider,
|
|
388
373
|
Ce as useChatContext
|
|
389
374
|
};
|
|
@@ -1,379 +1,411 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import { createSignal as p, createEffect as I, createMemo as z, useContext as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { createComponent as pt } from "solid-js/web";
|
|
2
|
+
import { createSignal as p, createEffect as I, createMemo as z, useContext as St, createContext as gt, untrack as It } from "solid-js";
|
|
3
|
+
import { createStore as ae, produce as le } from "solid-js/store";
|
|
4
|
+
import { useResolvedFloeConfig as wt } from "../../context/FloeConfigContext.js";
|
|
5
|
+
import { deferAfterPaint as yt, deferNonBlocking as y } from "../../utils/defer.js";
|
|
6
|
+
const ye = gt(), E = {
|
|
6
7
|
name: 0.65,
|
|
7
8
|
modifiedAt: 0.2,
|
|
8
9
|
size: 0.15
|
|
9
|
-
},
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
return Math.max(
|
|
10
|
+
}, de = "fileBrowser:listColumnRatios", fe = 220, xt = "fileBrowser:sidebarWidth", Ct = 160, Pt = 520, ue = "fileBrowser:viewMode", me = "fileBrowser:sortConfig", he = "fileBrowser:expandedFolders", pe = "fileBrowser:sidebarCollapsed";
|
|
11
|
+
function Se(n, i) {
|
|
12
|
+
const o = typeof n == "number" && Number.isFinite(n) ? n : i;
|
|
13
|
+
return Math.max(Ct, Math.min(Pt, Math.round(o)));
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
return n === "list" || n === "grid" ? n :
|
|
15
|
+
function At(n, i) {
|
|
16
|
+
return n === "list" || n === "grid" ? n : i;
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
-
if (!n || typeof n != "object") return
|
|
19
|
-
const
|
|
20
|
-
return !(
|
|
21
|
-
field:
|
|
18
|
+
function Et(n, i) {
|
|
19
|
+
if (!n || typeof n != "object") return i;
|
|
20
|
+
const o = n, d = o.field, l = o.direction;
|
|
21
|
+
return !(d === "name" || d === "size" || d === "modifiedAt" || d === "type") || !(l === "asc" || l === "desc") ? i : {
|
|
22
|
+
field: d,
|
|
22
23
|
direction: l
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
+
function bt(n) {
|
|
26
27
|
if (!Array.isArray(n)) return ["/"];
|
|
27
|
-
const
|
|
28
|
-
for (const
|
|
29
|
-
if (typeof
|
|
30
|
-
const l =
|
|
31
|
-
!l ||
|
|
28
|
+
const i = [], o = /* @__PURE__ */ new Set();
|
|
29
|
+
for (const d of n) {
|
|
30
|
+
if (typeof d != "string") continue;
|
|
31
|
+
const l = d.trim();
|
|
32
|
+
!l || o.has(l) || (o.add(l), i.push(l));
|
|
32
33
|
}
|
|
33
|
-
return
|
|
34
|
+
return o.has("/") || i.unshift("/"), i;
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
function Mt(n) {
|
|
37
|
+
const i = [], o = /* @__PURE__ */ new Set();
|
|
38
|
+
for (const d of n) {
|
|
39
|
+
if (typeof d != "string") continue;
|
|
40
|
+
const l = d.trim();
|
|
41
|
+
!l || o.has(l) || (o.add(l), i.push(l));
|
|
42
|
+
}
|
|
43
|
+
return i;
|
|
44
|
+
}
|
|
45
|
+
function ge(n) {
|
|
46
|
+
const i = {};
|
|
47
|
+
for (const o of n)
|
|
48
|
+
i[o] = !0;
|
|
49
|
+
return i;
|
|
50
|
+
}
|
|
51
|
+
function Ft(n, i) {
|
|
52
|
+
if (n.length !== i.length) return !1;
|
|
53
|
+
for (let o = 0; o < n.length; o += 1)
|
|
54
|
+
if (n[o] !== i[o]) return !1;
|
|
55
|
+
return !0;
|
|
56
|
+
}
|
|
57
|
+
function Ie(n) {
|
|
58
|
+
const i = Number.isFinite(n.name) ? n.name : E.name, o = Number.isFinite(n.modifiedAt) ? n.modifiedAt : E.modifiedAt, d = Number.isFinite(n.size) ? n.size : E.size, l = Math.max(0, i), u = Math.max(0, o), x = Math.max(0, d), g = l + u + x;
|
|
59
|
+
return g <= 0 ? E : {
|
|
60
|
+
name: l / g,
|
|
61
|
+
modifiedAt: u / g,
|
|
62
|
+
size: x / g
|
|
41
63
|
};
|
|
42
64
|
}
|
|
43
|
-
function
|
|
44
|
-
if (!
|
|
45
|
-
const
|
|
46
|
-
let
|
|
47
|
-
for (const l of
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
|
|
65
|
+
function we(n, i) {
|
|
66
|
+
if (!i) return [];
|
|
67
|
+
const o = [];
|
|
68
|
+
let d = 0;
|
|
69
|
+
for (const l of i) {
|
|
70
|
+
const u = n.indexOf(l, d);
|
|
71
|
+
if (u === -1) return null;
|
|
72
|
+
o.push(u), d = u + 1;
|
|
51
73
|
}
|
|
52
|
-
return
|
|
74
|
+
return o;
|
|
53
75
|
}
|
|
54
|
-
function
|
|
55
|
-
const
|
|
76
|
+
function zt(n) {
|
|
77
|
+
const i = wt(), o = (e) => {
|
|
56
78
|
const t = (e ?? "").trim();
|
|
57
79
|
return t === "" ? "/" : t;
|
|
58
|
-
},
|
|
80
|
+
}, d = (n.persistenceKey ?? "").trim(), l = !!d, u = (e) => d ? `${d}:${e}` : e, x = l ? At(i.persist.load(u(ue), n.initialViewMode ?? "list"), n.initialViewMode ?? "list") : n.initialViewMode ?? "list", g = {
|
|
59
81
|
field: "name",
|
|
60
82
|
direction: "asc"
|
|
61
|
-
},
|
|
62
|
-
let
|
|
83
|
+
}, xe = l ? Et(i.persist.load(u(me), g), g) : g, D = l ? bt(i.persist.load(u(he), ["/"])) : ["/"], Ce = l ? i.persist.load(u(pe), !1) === !0 : !1, Pe = () => typeof n.path == "string" ? o(n.path) : o(n.initialPath ?? "/"), [C, N] = p(Pe()), [W, Ae] = ae({}), [b, Ee] = p([]), [k, be] = p(x), [F, Me] = p(xe), Fe = Ie(i.persist.load(de, n.initialListColumnRatios ?? E)), [K, Le] = p(Fe), U = (n.sidebarWidthStorageKey ?? "").trim() || xt, _e = Se(i.persist.load(U, n.initialSidebarWidth ?? fe), n.initialSidebarWidth ?? fe), [V, ve] = p(_e), [L, G] = ae(ge(D)), [q, X] = p(D), [Y, Be] = p(Ce), [Re, j] = p(null), [Q, H] = p(""), [_, v] = p(""), [Oe, $] = p(!1);
|
|
84
|
+
let B = 0;
|
|
63
85
|
I(() => {
|
|
64
|
-
const e =
|
|
65
|
-
|
|
66
|
-
const t =
|
|
86
|
+
const e = Q().trim();
|
|
87
|
+
B += 1;
|
|
88
|
+
const t = B;
|
|
67
89
|
if (!e) {
|
|
68
|
-
|
|
90
|
+
v("");
|
|
69
91
|
return;
|
|
70
92
|
}
|
|
71
|
-
|
|
72
|
-
t ===
|
|
93
|
+
yt(() => {
|
|
94
|
+
t === B && v(e);
|
|
73
95
|
});
|
|
74
96
|
}), I(() => {
|
|
75
|
-
|
|
97
|
+
i.persist.debouncedSave(de, K());
|
|
76
98
|
}), I(() => {
|
|
77
|
-
|
|
99
|
+
i.persist.debouncedSave(U, V());
|
|
78
100
|
}), I(() => {
|
|
79
|
-
l &&
|
|
101
|
+
l && i.persist.debouncedSave(u(ue), k());
|
|
80
102
|
}), I(() => {
|
|
81
|
-
l &&
|
|
103
|
+
l && i.persist.debouncedSave(u(me), F());
|
|
82
104
|
}), I(() => {
|
|
83
105
|
if (!l) return;
|
|
84
|
-
const e = [...
|
|
85
|
-
|
|
106
|
+
const e = [...q()].sort((t, r) => t.localeCompare(r));
|
|
107
|
+
i.persist.debouncedSave(u(he), e);
|
|
86
108
|
}), I(() => {
|
|
87
|
-
l &&
|
|
109
|
+
l && i.persist.debouncedSave(u(pe), Y());
|
|
88
110
|
});
|
|
89
|
-
const
|
|
90
|
-
|
|
111
|
+
const Te = (e) => be(e), ze = (e) => Me(e), De = () => n.homeLabel ?? "Root", Ne = () => new Set(b()), We = () => new Set(q()), M = (e) => {
|
|
112
|
+
const t = Mt(e), r = ge(t);
|
|
113
|
+
Ae(le((s) => {
|
|
114
|
+
for (const c of Object.keys(s))
|
|
115
|
+
c in r || delete s[c];
|
|
116
|
+
for (const c of t)
|
|
117
|
+
s[c] = !0;
|
|
118
|
+
})), Ee((s) => Ft(s, t) ? s : t);
|
|
119
|
+
}, J = (e) => {
|
|
120
|
+
L[e] !== !0 && (G(e, !0), X((t) => t.includes(e) ? t : [...t, e]));
|
|
121
|
+
}, ke = (e) => {
|
|
122
|
+
if (L[e] === !0) {
|
|
123
|
+
G(le((t) => {
|
|
124
|
+
delete t[e];
|
|
125
|
+
})), X((t) => t.filter((r) => r !== e));
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
J(e);
|
|
129
|
+
}, [Z, P] = p([]);
|
|
130
|
+
let w = null, R = {
|
|
91
131
|
top: 0,
|
|
92
132
|
left: 0
|
|
93
133
|
};
|
|
94
|
-
const
|
|
95
|
-
const t =
|
|
134
|
+
const ee = () => n.files, te = (e) => {
|
|
135
|
+
const t = o(e);
|
|
96
136
|
if (t === "/") return "/";
|
|
97
|
-
const
|
|
98
|
-
return
|
|
99
|
-
},
|
|
100
|
-
const
|
|
101
|
-
if (
|
|
102
|
-
let
|
|
103
|
-
const
|
|
104
|
-
for (const
|
|
105
|
-
switch (
|
|
137
|
+
const r = t.split("/").filter(Boolean);
|
|
138
|
+
return r.pop(), r.length ? "/" + r.join("/") : "/";
|
|
139
|
+
}, Ke = (e, t) => {
|
|
140
|
+
const r = Z();
|
|
141
|
+
if (r.length === 0) return e;
|
|
142
|
+
let s = [...e];
|
|
143
|
+
const c = o(t);
|
|
144
|
+
for (const a of r)
|
|
145
|
+
switch (a.type) {
|
|
106
146
|
case "remove": {
|
|
107
|
-
const
|
|
108
|
-
|
|
147
|
+
const m = new Set(a.paths.map(o));
|
|
148
|
+
s = s.filter((f) => !m.has(o(f.path)));
|
|
109
149
|
break;
|
|
110
150
|
}
|
|
111
151
|
case "update": {
|
|
112
|
-
const
|
|
113
|
-
if (
|
|
114
|
-
const S =
|
|
115
|
-
|
|
116
|
-
...
|
|
117
|
-
...
|
|
118
|
-
} :
|
|
152
|
+
const m = o(a.oldPath), f = s.findIndex((S) => o(S.path) === m);
|
|
153
|
+
if (f !== -1) {
|
|
154
|
+
const S = a.updates.path ?? s[f].path;
|
|
155
|
+
te(S) === c ? s[f] = {
|
|
156
|
+
...s[f],
|
|
157
|
+
...a.updates
|
|
158
|
+
} : s.splice(f, 1);
|
|
119
159
|
} else {
|
|
120
|
-
const S =
|
|
121
|
-
S &&
|
|
160
|
+
const S = a.updates.path;
|
|
161
|
+
S && te(S);
|
|
122
162
|
}
|
|
123
163
|
break;
|
|
124
164
|
}
|
|
125
165
|
case "insert": {
|
|
126
|
-
|
|
166
|
+
o(a.parentPath) === c && (s.some((f) => o(f.path) === o(a.item.path)) || s.push(a.item));
|
|
127
167
|
break;
|
|
128
168
|
}
|
|
129
169
|
}
|
|
130
|
-
return
|
|
131
|
-
},
|
|
132
|
-
const e = /* @__PURE__ */ new Map(), t = (
|
|
133
|
-
for (const
|
|
134
|
-
|
|
135
|
-
},
|
|
136
|
-
return e.set("/",
|
|
137
|
-
}),
|
|
138
|
-
const e =
|
|
139
|
-
let t =
|
|
140
|
-
t =
|
|
141
|
-
const
|
|
142
|
-
if (
|
|
143
|
-
let
|
|
144
|
-
switch (
|
|
170
|
+
return s;
|
|
171
|
+
}, Ue = z(() => {
|
|
172
|
+
const e = /* @__PURE__ */ new Map(), t = (s) => {
|
|
173
|
+
for (const c of s)
|
|
174
|
+
c.type === "folder" && (e.set(o(c.path), c.children ?? []), c.children?.length && t(c.children));
|
|
175
|
+
}, r = ee();
|
|
176
|
+
return e.set("/", r), t(r), e;
|
|
177
|
+
}), Ve = z(() => {
|
|
178
|
+
const e = o(C());
|
|
179
|
+
let t = Ue().get(e) ?? [];
|
|
180
|
+
t = Ke(t, e);
|
|
181
|
+
const r = F(), s = [...t].sort((a, m) => {
|
|
182
|
+
if (a.type !== m.type) return a.type === "folder" ? -1 : 1;
|
|
183
|
+
let f = 0;
|
|
184
|
+
switch (r.field) {
|
|
145
185
|
case "name":
|
|
146
|
-
|
|
186
|
+
f = a.name.localeCompare(m.name);
|
|
147
187
|
break;
|
|
148
188
|
case "size":
|
|
149
|
-
|
|
189
|
+
f = (a.size ?? 0) - (m.size ?? 0);
|
|
150
190
|
break;
|
|
151
191
|
case "modifiedAt":
|
|
152
|
-
|
|
192
|
+
f = (a.modifiedAt?.getTime() ?? 0) - (m.modifiedAt?.getTime() ?? 0);
|
|
153
193
|
break;
|
|
154
194
|
case "type":
|
|
155
|
-
|
|
195
|
+
f = (a.extension ?? "").localeCompare(m.extension ?? "");
|
|
156
196
|
break;
|
|
157
197
|
}
|
|
158
|
-
return
|
|
159
|
-
}),
|
|
160
|
-
for (const
|
|
161
|
-
|
|
198
|
+
return r.direction === "asc" ? f : -f;
|
|
199
|
+
}), c = /* @__PURE__ */ new Map();
|
|
200
|
+
for (const a of s)
|
|
201
|
+
c.set(a.id, a.name.toLowerCase());
|
|
162
202
|
return {
|
|
163
|
-
items:
|
|
164
|
-
nameLowerById:
|
|
203
|
+
items: s,
|
|
204
|
+
nameLowerById: c
|
|
165
205
|
};
|
|
166
206
|
}), O = z(() => {
|
|
167
207
|
const {
|
|
168
208
|
items: e,
|
|
169
209
|
nameLowerById: t
|
|
170
|
-
} =
|
|
171
|
-
if (!
|
|
210
|
+
} = Ve(), s = _().trim().toLowerCase(), c = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
|
|
211
|
+
if (!s) {
|
|
172
212
|
for (let h = 0; h < e.length; h++) {
|
|
173
|
-
const
|
|
174
|
-
|
|
213
|
+
const A = e[h];
|
|
214
|
+
a.set(A.id, A), m.set(A.id, h);
|
|
175
215
|
}
|
|
176
216
|
return {
|
|
177
217
|
items: e,
|
|
178
|
-
matchById:
|
|
179
|
-
fileById:
|
|
180
|
-
indexById:
|
|
218
|
+
matchById: c,
|
|
219
|
+
fileById: a,
|
|
220
|
+
indexById: m
|
|
181
221
|
};
|
|
182
222
|
}
|
|
183
|
-
const
|
|
223
|
+
const f = [];
|
|
184
224
|
let S = 0;
|
|
185
225
|
for (const h of e) {
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
matchedIndices:
|
|
189
|
-
}),
|
|
226
|
+
const A = t.get(h.id) ?? h.name.toLowerCase(), ce = we(A, s);
|
|
227
|
+
ce && (f.push(h), c.set(h.id, {
|
|
228
|
+
matchedIndices: ce
|
|
229
|
+
}), a.set(h.id, h), m.set(h.id, S), S += 1);
|
|
190
230
|
}
|
|
191
231
|
return {
|
|
192
|
-
items:
|
|
193
|
-
matchById:
|
|
194
|
-
fileById:
|
|
195
|
-
indexById:
|
|
232
|
+
items: f,
|
|
233
|
+
matchById: c,
|
|
234
|
+
fileById: a,
|
|
235
|
+
indexById: m
|
|
196
236
|
};
|
|
197
|
-
}),
|
|
198
|
-
const t = O(),
|
|
199
|
-
for (const
|
|
200
|
-
const
|
|
201
|
-
if (!
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
index:
|
|
205
|
-
item:
|
|
237
|
+
}), Ge = () => O().items, ne = (e) => {
|
|
238
|
+
const t = O(), r = [];
|
|
239
|
+
for (const s of e) {
|
|
240
|
+
const c = t.fileById.get(s);
|
|
241
|
+
if (!c) continue;
|
|
242
|
+
const a = t.indexById.get(s);
|
|
243
|
+
r.push({
|
|
244
|
+
index: a ?? Number.MAX_SAFE_INTEGER,
|
|
245
|
+
item: c
|
|
206
246
|
});
|
|
207
247
|
}
|
|
208
|
-
return
|
|
209
|
-
},
|
|
210
|
-
M(
|
|
248
|
+
return r.sort((s, c) => s.index - c.index), r.map((s) => s.item);
|
|
249
|
+
}, oe = () => {
|
|
250
|
+
M([]), H(""), v(""), $(!1);
|
|
211
251
|
const e = n.onSelect;
|
|
212
252
|
y(() => e?.([]));
|
|
213
253
|
};
|
|
214
254
|
I(() => {
|
|
215
255
|
if (typeof n.path != "string") return;
|
|
216
|
-
const e =
|
|
217
|
-
e !==
|
|
256
|
+
const e = o(n.path);
|
|
257
|
+
e !== C() && (N(e), oe());
|
|
218
258
|
});
|
|
219
259
|
const T = (e) => {
|
|
220
|
-
const t =
|
|
221
|
-
if (t ===
|
|
222
|
-
|
|
223
|
-
const
|
|
224
|
-
y(() =>
|
|
225
|
-
const
|
|
226
|
-
y(() =>
|
|
227
|
-
},
|
|
228
|
-
|
|
229
|
-
},
|
|
230
|
-
const e =
|
|
260
|
+
const t = o(e);
|
|
261
|
+
if (t === C()) return;
|
|
262
|
+
N(t), oe();
|
|
263
|
+
const r = n.onNavigate;
|
|
264
|
+
y(() => r?.(t));
|
|
265
|
+
const s = n.onPathChange;
|
|
266
|
+
y(() => s?.(t, "user"));
|
|
267
|
+
}, qe = (e) => {
|
|
268
|
+
Le(Ie(e));
|
|
269
|
+
}, Xe = () => {
|
|
270
|
+
const e = C();
|
|
231
271
|
if (e === "/" || e === "") return;
|
|
232
272
|
const t = e.split("/").filter(Boolean);
|
|
233
273
|
t.pop(), T(t.length ? "/" + t.join("/") : "/");
|
|
234
|
-
},
|
|
235
|
-
e.type === "folder" && (T(e.path),
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
const a = n.onSelect;
|
|
243
|
-
if (a) {
|
|
244
|
-
const c = new Set(i);
|
|
274
|
+
}, ie = (e) => {
|
|
275
|
+
e.type === "folder" && (T(e.path), J(e.path));
|
|
276
|
+
}, Ye = (e, t = !1) => {
|
|
277
|
+
const r = t ? W[e] === !0 ? b().filter((c) => c !== e) : [...b(), e] : [e];
|
|
278
|
+
M(r);
|
|
279
|
+
const s = n.onSelect;
|
|
280
|
+
if (s) {
|
|
281
|
+
const c = [...r];
|
|
245
282
|
y(() => {
|
|
246
|
-
const
|
|
247
|
-
a
|
|
283
|
+
const a = It(() => ne(c));
|
|
284
|
+
s(a);
|
|
248
285
|
});
|
|
249
286
|
}
|
|
250
|
-
},
|
|
251
|
-
M(
|
|
287
|
+
}, je = () => {
|
|
288
|
+
M([]);
|
|
252
289
|
const e = n.onSelect;
|
|
253
290
|
y(() => e?.([]));
|
|
254
|
-
},
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}, We = (e) => v().has(e), Ke = () => Ae((e) => !e), Ue = (e) => {
|
|
260
|
-
xe((t) => le(e, t));
|
|
261
|
-
}, ke = (e) => G(e), Ve = () => G(null), Ge = (e) => {
|
|
262
|
-
Y(e);
|
|
263
|
-
}, Xe = (e) => {
|
|
291
|
+
}, Qe = (e) => W[e] === !0, He = (e) => ke(e), $e = (e) => L[e] === !0, Je = () => Be((e) => !e), Ze = (e) => {
|
|
292
|
+
ve((t) => Se(e, t));
|
|
293
|
+
}, et = (e) => j(e), tt = () => j(null), nt = (e) => {
|
|
294
|
+
H(e);
|
|
295
|
+
}, ot = (e) => {
|
|
264
296
|
const t = _().trim();
|
|
265
297
|
if (!t) return null;
|
|
266
|
-
const
|
|
267
|
-
return
|
|
268
|
-
matchedIndices:
|
|
298
|
+
const r = we(e.toLowerCase(), t.toLowerCase());
|
|
299
|
+
return r ? {
|
|
300
|
+
matchedIndices: r
|
|
269
301
|
} : null;
|
|
270
|
-
},
|
|
302
|
+
}, it = (e) => O().matchById.get(e) ?? null, st = () => ne(b()), rt = (e) => {
|
|
271
303
|
if (e.type === "folder")
|
|
272
|
-
|
|
304
|
+
ie(e);
|
|
273
305
|
else {
|
|
274
306
|
const t = n.onOpen;
|
|
275
307
|
y(() => t?.(e));
|
|
276
308
|
}
|
|
277
|
-
},
|
|
278
|
-
e.length !== 0 &&
|
|
309
|
+
}, ct = (e) => {
|
|
310
|
+
e.length !== 0 && P((t) => [...t, {
|
|
279
311
|
type: "remove",
|
|
280
312
|
paths: e
|
|
281
313
|
}]);
|
|
282
|
-
},
|
|
283
|
-
|
|
314
|
+
}, at = (e, t) => {
|
|
315
|
+
P((r) => [...r, {
|
|
284
316
|
type: "update",
|
|
285
317
|
oldPath: e,
|
|
286
318
|
updates: t
|
|
287
319
|
}]);
|
|
288
|
-
},
|
|
289
|
-
|
|
320
|
+
}, lt = (e, t) => {
|
|
321
|
+
P((r) => [...r, {
|
|
290
322
|
type: "insert",
|
|
291
323
|
parentPath: e,
|
|
292
324
|
item: t
|
|
293
325
|
}]);
|
|
294
|
-
},
|
|
295
|
-
|
|
296
|
-
},
|
|
297
|
-
|
|
298
|
-
},
|
|
299
|
-
|
|
300
|
-
},
|
|
301
|
-
top:
|
|
302
|
-
left:
|
|
326
|
+
}, dt = () => {
|
|
327
|
+
P([]);
|
|
328
|
+
}, ft = () => {
|
|
329
|
+
P([]);
|
|
330
|
+
}, ut = () => Z().length > 0, mt = (e) => {
|
|
331
|
+
w = e;
|
|
332
|
+
}, se = () => w ? {
|
|
333
|
+
top: w.scrollTop,
|
|
334
|
+
left: w.scrollLeft
|
|
303
335
|
} : {
|
|
304
336
|
top: 0,
|
|
305
337
|
left: 0
|
|
306
|
-
},
|
|
307
|
-
|
|
308
|
-
},
|
|
309
|
-
currentPath:
|
|
338
|
+
}, re = (e) => {
|
|
339
|
+
w && (w.scrollTop = e.top, w.scrollLeft = e.left);
|
|
340
|
+
}, ht = {
|
|
341
|
+
currentPath: C,
|
|
310
342
|
setCurrentPath: T,
|
|
311
|
-
navigateUp:
|
|
312
|
-
navigateTo:
|
|
313
|
-
homeLabel:
|
|
314
|
-
selectedItems:
|
|
315
|
-
selectItem:
|
|
316
|
-
clearSelection:
|
|
317
|
-
isSelected:
|
|
318
|
-
getSelectedItemsList:
|
|
319
|
-
viewMode:
|
|
320
|
-
setViewMode:
|
|
343
|
+
navigateUp: Xe,
|
|
344
|
+
navigateTo: ie,
|
|
345
|
+
homeLabel: De,
|
|
346
|
+
selectedItems: Ne,
|
|
347
|
+
selectItem: Ye,
|
|
348
|
+
clearSelection: je,
|
|
349
|
+
isSelected: Qe,
|
|
350
|
+
getSelectedItemsList: st,
|
|
351
|
+
viewMode: k,
|
|
352
|
+
setViewMode: Te,
|
|
321
353
|
sortConfig: F,
|
|
322
|
-
setSortConfig:
|
|
323
|
-
listColumnRatios:
|
|
324
|
-
setListColumnRatios:
|
|
325
|
-
expandedFolders:
|
|
326
|
-
toggleFolder:
|
|
327
|
-
isExpanded:
|
|
328
|
-
files:
|
|
329
|
-
currentFiles:
|
|
330
|
-
filterQuery:
|
|
331
|
-
setFilterQuery:
|
|
354
|
+
setSortConfig: ze,
|
|
355
|
+
listColumnRatios: K,
|
|
356
|
+
setListColumnRatios: qe,
|
|
357
|
+
expandedFolders: We,
|
|
358
|
+
toggleFolder: He,
|
|
359
|
+
isExpanded: $e,
|
|
360
|
+
files: ee,
|
|
361
|
+
currentFiles: Ge,
|
|
362
|
+
filterQuery: Q,
|
|
363
|
+
setFilterQuery: nt,
|
|
332
364
|
filterQueryApplied: _,
|
|
333
|
-
isFilterActive:
|
|
334
|
-
setFilterActive:
|
|
335
|
-
getFilterMatch:
|
|
336
|
-
getFilterMatchForId:
|
|
337
|
-
sidebarCollapsed:
|
|
338
|
-
toggleSidebar:
|
|
339
|
-
sidebarWidth:
|
|
340
|
-
setSidebarWidth:
|
|
341
|
-
contextMenu:
|
|
342
|
-
showContextMenu:
|
|
343
|
-
hideContextMenu:
|
|
344
|
-
openItem:
|
|
365
|
+
isFilterActive: Oe,
|
|
366
|
+
setFilterActive: $,
|
|
367
|
+
getFilterMatch: ot,
|
|
368
|
+
getFilterMatchForId: it,
|
|
369
|
+
sidebarCollapsed: Y,
|
|
370
|
+
toggleSidebar: Je,
|
|
371
|
+
sidebarWidth: V,
|
|
372
|
+
setSidebarWidth: Ze,
|
|
373
|
+
contextMenu: Re,
|
|
374
|
+
showContextMenu: et,
|
|
375
|
+
hideContextMenu: tt,
|
|
376
|
+
openItem: rt,
|
|
345
377
|
// Optimistic updates
|
|
346
|
-
optimisticRemove:
|
|
347
|
-
optimisticUpdate:
|
|
348
|
-
optimisticInsert:
|
|
349
|
-
clearOptimisticUpdates:
|
|
350
|
-
rollbackOptimisticUpdates:
|
|
351
|
-
hasOptimisticUpdates:
|
|
378
|
+
optimisticRemove: ct,
|
|
379
|
+
optimisticUpdate: at,
|
|
380
|
+
optimisticInsert: lt,
|
|
381
|
+
clearOptimisticUpdates: dt,
|
|
382
|
+
rollbackOptimisticUpdates: ft,
|
|
383
|
+
hasOptimisticUpdates: ut,
|
|
352
384
|
// Scroll position management
|
|
353
|
-
setScrollContainer:
|
|
354
|
-
getScrollPosition:
|
|
355
|
-
setScrollPosition:
|
|
356
|
-
saveScrollPosition: () => (
|
|
385
|
+
setScrollContainer: mt,
|
|
386
|
+
getScrollPosition: se,
|
|
387
|
+
setScrollPosition: re,
|
|
388
|
+
saveScrollPosition: () => (R = se(), R),
|
|
357
389
|
restoreScrollPosition: () => {
|
|
358
390
|
requestAnimationFrame(() => {
|
|
359
|
-
|
|
391
|
+
re(R);
|
|
360
392
|
});
|
|
361
393
|
}
|
|
362
394
|
};
|
|
363
|
-
return
|
|
364
|
-
value:
|
|
395
|
+
return pt(ye.Provider, {
|
|
396
|
+
value: ht,
|
|
365
397
|
get children() {
|
|
366
398
|
return n.children;
|
|
367
399
|
}
|
|
368
400
|
});
|
|
369
401
|
}
|
|
370
|
-
function
|
|
371
|
-
const n =
|
|
402
|
+
function Dt() {
|
|
403
|
+
const n = St(ye);
|
|
372
404
|
if (!n)
|
|
373
405
|
throw new Error("useFileBrowser must be used within a FileBrowserProvider");
|
|
374
406
|
return n;
|
|
375
407
|
}
|
|
376
408
|
export {
|
|
377
|
-
|
|
378
|
-
|
|
409
|
+
zt as FileBrowserProvider,
|
|
410
|
+
Dt as useFileBrowser
|
|
379
411
|
};
|