@floegence/floe-webapp-core 0.86.50 → 0.86.51

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,81 +1,95 @@
1
- import { insert as l, createComponent as s, use as M, setAttribute as g, effect as k, className as Q, spread as U, mergeProps as j, memo as L, template as h, delegateEvents as X } from "solid-js/web";
2
- import { createEffect as q, on as Y, untrack as Z, createMemo as V, createUniqueId as ee, Show as m, For as F, createSignal as D } from "solid-js";
3
- import { cn as N } from "../../../utils/cn.js";
4
- import { FileItemIcon as te } from "../../file-browser/FileIcons.js";
5
- import { FolderOpen as O, ChevronRight as H } from "../../icons/index.js";
6
- import { Button as I } from "../Button.js";
7
- import { Input as W } from "../Input.js";
8
- import { resolveTabNavigationTargetId as re } from "../Tabs.js";
9
- import { createFilesystemPickerDataSource as ne, defaultPickerCopy as ie, parsePickerPath as G, PickerNavigationError as ae } from "./PickerNavigation.js";
10
- import { pickerParentPath as Se } from "./PickerNavigation.js";
11
- var le = /* @__PURE__ */ h('<div role=tablist class="mb-1 flex min-w-0 items-center gap-4 border-b border-border">'), se = /* @__PURE__ */ h('<div class="flex min-w-0 items-start gap-1.5"><div class="min-w-0 flex-1">'), oe = /* @__PURE__ */ h('<div class="flex items-start gap-2 rounded border border-error/30 bg-error/5 px-2 py-1.5 text-xs"role=alert><span class="min-w-0 flex-1 break-words">'), S = /* @__PURE__ */ h("<div>"), ue = /* @__PURE__ */ h('<div class="flex min-w-0 flex-col gap-2"data-filesystem-picker><div class="flex min-w-0 flex-col gap-2">'), ce = /* @__PURE__ */ h('<div class="flex flex-wrap items-center gap-1">'), de = /* @__PURE__ */ h("<button type=button role=tab>"), ge = /* @__PURE__ */ h('<nav class="flex min-w-0 flex-wrap items-center gap-0.5 text-xs">'), he = /* @__PURE__ */ h("<span role=status>"), fe = /* @__PURE__ */ h('<div class="flex flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground"><label class="flex cursor-pointer items-center gap-1.5"><input type=checkbox class=cursor-pointer>'), ve = /* @__PURE__ */ h('<button type=button class="max-w-full cursor-pointer truncate rounded px-1 py-0.5 hover:bg-muted focus-visible:ring-1 focus-visible:ring-ring">'), be = /* @__PURE__ */ h('<p class="px-3 py-6 text-center text-xs text-muted-foreground"role=status>'), me = /* @__PURE__ */ h('<p class="px-3 py-6 text-center text-xs text-muted-foreground">'), xe = /* @__PURE__ */ h('<button type=button class="flex min-h-8 w-full cursor-pointer items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-accent/60 focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"><span class="min-w-0 flex-1 truncate">'), we = /* @__PURE__ */ h('<button type=button class="flex min-h-14 w-full cursor-pointer items-center gap-3 rounded-md px-2 py-2.5 text-left hover:bg-accent/60 focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"><span class="flex min-w-0 flex-1 flex-col gap-0.5"><span class="truncate text-xs font-medium"></span><span class="truncate text-[11px] text-muted-foreground">'), ye = /* @__PURE__ */ h('<div class="flex items-center gap-1.5">'), pe = /* @__PURE__ */ h('<p role=alert class="text-xs text-error">');
12
- function T(e) {
1
+ import { insert as o, createComponent as l, use as S, setAttribute as g, effect as P, className as de, memo as C, spread as te, mergeProps as re, template as f, delegateEvents as ce } from "solid-js/web";
2
+ import { createSignal as E, createEffect as U, on as ae, untrack as ue, createMemo as V, createUniqueId as ge, Show as h, For as N } from "solid-js";
3
+ import { cn as H } from "../../../utils/cn.js";
4
+ import { FileItemIcon as ve } from "../../file-browser/FileIcons.js";
5
+ import { FolderOpen as le, ChevronRight as L } from "../../icons/index.js";
6
+ import { Button as z } from "../Button.js";
7
+ import { Input as j } from "../Input.js";
8
+ import { PickerDirectoryRow as ie, DirectoryFavoriteButton as fe } from "./DirectoryFavorites.js";
9
+ import { resolveTabNavigationTargetId as he } from "../Tabs.js";
10
+ import { createFilesystemPickerDataSource as be, parsePickerPath as q, defaultPickerCopy as me, PickerNavigationError as we } from "./PickerNavigation.js";
11
+ import { pickerParentPath as Xe } from "./PickerNavigation.js";
12
+ var xe = /* @__PURE__ */ f('<div role=tablist class="mb-1 flex min-w-0 items-center gap-4 border-b border-border">'), ye = /* @__PURE__ */ f('<div class="flex min-w-0 items-start gap-1.5"><div class="min-w-0 flex-1">'), ke = /* @__PURE__ */ f('<div role=alert class="flex items-center gap-2 text-xs text-error"><span class="min-w-0 flex-1 break-words">'), $e = /* @__PURE__ */ f('<div class="flex items-start gap-2 rounded border border-error/30 bg-error/5 px-2 py-1.5 text-xs"role=alert><span class="min-w-0 flex-1 break-words">'), O = /* @__PURE__ */ f("<div>"), pe = /* @__PURE__ */ f('<div class="flex min-w-0 flex-col gap-2"data-filesystem-picker><div class="flex min-w-0 flex-col gap-2">'), Pe = /* @__PURE__ */ f('<div class="flex flex-wrap items-center gap-1">'), _e = /* @__PURE__ */ f("<button type=button role=tab>"), Fe = /* @__PURE__ */ f('<nav class="flex min-w-0 flex-wrap items-center gap-0.5 text-xs">'), Ce = /* @__PURE__ */ f("<span role=status>"), Ie = /* @__PURE__ */ f('<div class="flex flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground"><label class="flex cursor-pointer items-center gap-1.5"><input type=checkbox class=cursor-pointer>'), Ee = /* @__PURE__ */ f('<button type=button class="max-w-full cursor-pointer truncate rounded px-1 py-0.5 hover:bg-muted focus-visible:ring-1 focus-visible:ring-ring">'), ne = /* @__PURE__ */ f('<p class="px-3 py-6 text-center text-xs text-muted-foreground"role=status>'), ze = /* @__PURE__ */ f('<p class="px-3 py-6 text-center text-xs text-muted-foreground">'), Ae = /* @__PURE__ */ f('<button type=button class="flex min-h-8 min-w-0 flex-1 cursor-pointer items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-accent/60 focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"><span class="min-w-0 flex-1 truncate">'), Ve = /* @__PURE__ */ f('<button type=button class="flex min-h-14 min-w-0 flex-1 cursor-pointer items-center gap-3 rounded-md px-2 py-2.5 text-left hover:bg-accent/60 focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"><span class="flex min-w-0 flex-1 flex-col gap-0.5"><span class="truncate text-xs font-medium"></span><span class="truncate text-[11px] text-muted-foreground">'), De = /* @__PURE__ */ f('<div class="flex items-center gap-1.5">'), Re = /* @__PURE__ */ f('<p role=alert class="text-xs text-error">');
13
+ function W(e) {
13
14
  return {
14
- ...ie,
15
+ ...me,
15
16
  ...e.copy
16
17
  };
17
18
  }
18
- function J(e, u) {
19
- const i = T(e);
20
- return u instanceof ae ? i[u.kind] : e.formatError?.(u) || (u instanceof Error ? u.message : "") || i.loadFailed;
19
+ function oe(e, s) {
20
+ const n = W(e);
21
+ return s instanceof we ? n[s.kind] : e.formatError?.(s) || (s instanceof Error ? s.message : "") || n.loadFailed;
21
22
  }
22
- function Ve(e, u, i, y) {
23
- const v = ne(() => e, i);
24
- return q(Y(() => [u(), e.scopeKey], ([x]) => {
25
- v.close(), x && (y?.(), v.open(e.initialPath));
26
- })), q(() => e.onValidityChange?.(v.valid())), v;
23
+ function Oe(e, s, n, y, _ = () => "browse") {
24
+ const [m, F] = E("browse"), k = be(() => e, n);
25
+ return U(ae(() => [s(), e.scopeKey], ([I]) => {
26
+ k.close(), I && (F(_()), e.directoryFavorites?.onRefresh?.(), y?.(), k.open(e.initialPath));
27
+ })), U(() => e.onValidityChange?.(k.valid() && m() === "browse")), {
28
+ ...k,
29
+ view: m,
30
+ setView: F
31
+ };
27
32
  }
28
- function De(e) {
29
- const u = () => T(e), i = Z(() => e.source), y = V(() => i.entries().filter((o) => o.type === "folder")), v = V(() => i.context()?.roots.filter((o) => !o.hidden) ?? []), x = ee();
30
- let C;
31
- const A = V(() => [{
33
+ function We(e) {
34
+ const s = () => W(e), n = ue(() => e.source), y = V(() => n.entries().filter((d) => d.type === "folder")), _ = V(() => n.context()?.roots.filter((d) => !d.hidden) ?? []), m = ge(), [F, k] = E(""), [I, $] = E(""), A = () => n.view() !== "browse", w = () => !!(e.suggestions?.paths.length || e.directoryFavorites), x = V(() => [...new Set((e.directoryFavorites?.paths ?? []).map((d) => q(d)).filter(Boolean))]), D = V(() => n.view() === "suggestions" ? e.suggestions?.paths ?? [] : x().filter((d) => d.toLocaleLowerCase().includes(F().trim().toLocaleLowerCase())));
35
+ U(ae(() => e.scopeKey, () => {
36
+ k(""), $("");
37
+ }));
38
+ let B;
39
+ const G = V(() => [...e.suggestions?.paths.length ? [{
32
40
  id: "suggestions",
33
- label: e.suggestions?.label ?? "",
41
+ label: e.suggestions.label,
42
+ disabled: e.disabled
43
+ }] : [], ...e.directoryFavorites ? [{
44
+ id: "favorites",
45
+ label: s().favorites,
34
46
  disabled: e.disabled
35
- }, ...v().map((o) => ({
36
- id: `root:${o.id}`,
37
- label: o.label,
38
- path: o.pathAbs,
39
- disabled: e.disabled || o.permissions?.read === !1
40
- }))]), P = () => {
41
- if (e.suggestions?.visible) return "suggestions";
42
- const o = G(i.pathInput(), i.context()?.homePathAbs);
43
- return `root:${v().filter((n) => o === n.pathAbs || o.startsWith(n.pathAbs.replace(/\/$/, "") + "/")).sort((n, t) => t.pathAbs.length - n.pathAbs.length)[0]?.id ?? i.context()?.defaultRootId ?? v()[0]?.id}`;
44
- }, _ = /* @__PURE__ */ new Map(), z = [], p = (o, f, n, t) => {
47
+ }] : [], ..._().map((d) => ({
48
+ id: `root:${d.id}`,
49
+ label: d.label,
50
+ path: d.pathAbs,
51
+ disabled: e.disabled || d.permissions?.read === !1
52
+ }))]), T = () => {
53
+ if (A()) return n.view();
54
+ const d = q(n.pathInput(), n.context()?.homePathAbs);
55
+ return `root:${_().filter((i) => d === i.pathAbs || d.startsWith(i.pathAbs.replace(/\/$/, "") + "/")).sort((i, t) => t.pathAbs.length - i.pathAbs.length)[0]?.id ?? n.context()?.defaultRootId ?? _()[0]?.id}`;
56
+ }, J = /* @__PURE__ */ new Map(), Q = [], X = (d, b, i, t) => {
45
57
  let a;
46
- o.key === "ArrowDown" && (a = Math.min(f + 1, t - 1)), o.key === "ArrowUp" && (a = Math.max(0, f - 1)), o.key === "Home" && (a = 0), o.key === "End" && (a = t - 1), a !== void 0 && (o.preventDefault(), o.stopPropagation(), n[a]?.focus());
47
- }, w = V(() => {
48
- const o = i.currentPath();
49
- if (!o) return [];
50
- let f = "";
58
+ d.key === "ArrowDown" && (a = Math.min(b + 1, t - 1)), d.key === "ArrowUp" && (a = Math.max(0, b - 1)), d.key === "Home" && (a = 0), d.key === "End" && (a = t - 1), a !== void 0 && (d.preventDefault(), d.stopPropagation(), i[a]?.focus(), i[a]?.scrollIntoView?.({
59
+ block: "nearest"
60
+ }));
61
+ }, se = V(() => {
62
+ const d = n.currentPath();
63
+ if (!d) return [];
64
+ let b = "";
51
65
  return [{
52
66
  path: "/",
53
- name: u().root
54
- }, ...o.split("/").filter(Boolean).map((n) => (f += `/${n}`, {
55
- path: f,
56
- name: n
67
+ name: s().root
68
+ }, ...d.split("/").filter(Boolean).map((i) => (b += `/${i}`, {
69
+ path: b,
70
+ name: i
57
71
  }))];
58
- }), E = [], R = () => {
59
- i.navigate(i.pathInput());
60
- };
72
+ }), Y = [], K = (d) => {
73
+ n.setView("browse"), n.navigate(d), B?.focus();
74
+ }, Z = () => K(n.pathInput());
61
75
  return (() => {
62
- var o = ue(), f = o.firstChild;
63
- return l(o, s(m, {
76
+ var d = pe(), b = d.firstChild;
77
+ return o(d, l(h, {
64
78
  get when() {
65
- return e.suggestions?.paths.length;
79
+ return w();
66
80
  },
67
81
  get fallback() {
68
82
  return (() => {
69
- var n = ce();
70
- return l(n, s(F, {
83
+ var i = Pe();
84
+ return o(i, l(N, {
71
85
  get each() {
72
- return v();
86
+ return _();
73
87
  },
74
- children: (t) => s(I, {
88
+ children: (t) => l(z, {
75
89
  type: "button",
76
90
  size: "sm",
77
91
  get variant() {
78
- return i.currentPath() === t.pathAbs ? "secondary" : "ghost";
92
+ return n.currentPath() === t.pathAbs ? "secondary" : "ghost";
79
93
  },
80
94
  get disabled() {
81
95
  return e.disabled || t.permissions?.read === !1;
@@ -84,31 +98,31 @@ function De(e) {
84
98
  return t.pathAbs;
85
99
  },
86
100
  onClick: () => {
87
- i.navigate(t.pathAbs);
101
+ n.navigate(t.pathAbs);
88
102
  },
89
103
  get children() {
90
104
  return t.label;
91
105
  }
92
106
  })
93
- })), k(() => g(n, "aria-label", u().roots)), n;
107
+ })), P(() => g(i, "aria-label", s().roots)), i;
94
108
  })();
95
109
  },
96
110
  get children() {
97
- var n = le();
98
- return l(n, s(F, {
111
+ var i = xe();
112
+ return o(i, l(N, {
99
113
  get each() {
100
- return A();
114
+ return G();
101
115
  },
102
116
  children: (t) => (() => {
103
- var a = de();
117
+ var a = _e();
104
118
  return a.$$keydown = (r) => {
105
- const c = re(A(), t.id, r.key);
106
- c && (r.preventDefault(), r.stopPropagation(), _.get(c)?.focus());
119
+ const u = he(G(), t.id, r.key);
120
+ u && (r.preventDefault(), r.stopPropagation(), J.get(u)?.focus());
107
121
  }, a.$$click = () => {
108
- e.suggestions?.onVisibilityChange(t.id === "suggestions"), "path" in t && i.navigate(t.path);
109
- }, M((r) => _.set(t.id, r), a), g(a, "aria-controls", x), l(a, () => t.label), k((r) => {
110
- var c = `${x}-${t.id}`, d = P() === t.id, $ = P() === t.id ? 0 : -1, b = t.disabled, B = "path" in t ? t.path : t.label, K = N("min-w-0 cursor-pointer truncate border-b-2 px-0.5 py-2 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50", P() === t.id ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground");
111
- return c !== r.e && g(a, "id", r.e = c), d !== r.t && g(a, "aria-selected", r.t = d), $ !== r.a && g(a, "tabindex", r.a = $), b !== r.o && (a.disabled = r.o = b), B !== r.i && g(a, "title", r.i = B), K !== r.n && Q(a, r.n = K), r;
122
+ "path" in t ? K(t.path) : (n.setView(t.id), t.id === "favorites" && e.directoryFavorites?.onRefresh?.());
123
+ }, S((r) => J.set(t.id, r), a), g(a, "aria-controls", m), o(a, () => t.label), P((r) => {
124
+ var u = `${m}-${t.id}`, v = T() === t.id, p = T() === t.id ? 0 : -1, c = t.disabled, R = "path" in t ? t.path : t.label, M = H("min-w-0 cursor-pointer truncate border-b-2 px-0.5 py-2 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50", T() === t.id ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground");
125
+ return u !== r.e && g(a, "id", r.e = u), v !== r.t && g(a, "aria-selected", r.t = v), p !== r.a && g(a, "tabindex", r.a = p), c !== r.o && (a.disabled = r.o = c), R !== r.i && g(a, "title", r.i = R), M !== r.n && de(a, r.n = M), r;
112
126
  }, {
113
127
  e: void 0,
114
128
  t: void 0,
@@ -118,321 +132,448 @@ function De(e) {
118
132
  n: void 0
119
133
  }), a;
120
134
  })()
121
- })), k(() => g(n, "aria-label", u().roots)), n;
135
+ })), P(() => g(i, "aria-label", s().roots)), i;
122
136
  }
123
- }), f), g(f, "id", x), l(f, s(m, {
137
+ }), b), g(b, "id", m), o(b, l(h, {
124
138
  get when() {
125
- return !e.suggestions?.visible;
139
+ return !A();
126
140
  },
127
141
  get children() {
128
- var n = se(), t = n.firstChild;
129
- return l(t, s(W, {
142
+ var i = ye(), t = i.firstChild;
143
+ return o(t, l(j, {
130
144
  ref(a) {
131
- var r = C;
132
- typeof r == "function" ? r(a) : C = a;
145
+ var r = B;
146
+ typeof r == "function" ? r(a) : B = a;
133
147
  },
134
148
  size: "sm",
135
149
  get "aria-label"() {
136
- return u().path;
150
+ return s().path;
137
151
  },
138
152
  placeholder: "/",
139
153
  get value() {
140
- return i.pathInput();
154
+ return n.pathInput();
141
155
  },
142
156
  get disabled() {
143
- return e.disabled || !i.context();
157
+ return e.disabled || !n.context();
144
158
  },
145
- onInput: (a) => i.setPathInput(a.currentTarget.value),
159
+ onInput: (a) => n.setPathInput(a.currentTarget.value),
146
160
  onKeyDown: (a) => {
147
- a.key === "Enter" && (a.preventDefault(), a.stopPropagation(), R());
161
+ a.key === "Enter" && (a.preventDefault(), a.stopPropagation(), Z());
148
162
  }
149
- })), l(n, s(I, {
163
+ })), o(i, l(z, {
150
164
  size: "sm",
151
165
  variant: "outline",
152
- onClick: R,
166
+ onClick: Z,
153
167
  get disabled() {
154
- return e.disabled || !i.context() || !i.pathInput();
168
+ return e.disabled || !n.context() || !n.pathInput();
169
+ },
170
+ get children() {
171
+ return s().go;
172
+ }
173
+ }), null), i;
174
+ }
175
+ }), null), o(b, l(h, {
176
+ get when() {
177
+ return I() || e.directoryFavorites?.error;
178
+ },
179
+ get children() {
180
+ var i = ke(), t = i.firstChild;
181
+ return o(t, () => I() || e.directoryFavorites?.error), o(i, l(z, {
182
+ size: "sm",
183
+ variant: "ghost",
184
+ get disabled() {
185
+ return e.directoryFavorites?.loading;
186
+ },
187
+ onClick: () => {
188
+ $(""), e.directoryFavorites?.onRefresh?.();
155
189
  },
156
190
  get children() {
157
- return u().go;
191
+ return s().retry;
158
192
  }
159
- }), null), n;
193
+ }), null), i;
160
194
  }
161
- }), null), l(f, s(m, {
195
+ }), null), o(b, l(h, {
162
196
  get when() {
163
- return i.error();
197
+ return C(() => !!n.error())() && !A();
164
198
  },
165
199
  get children() {
166
- var n = oe(), t = n.firstChild;
167
- return l(t, () => J(e, i.error())), l(n, s(I, {
200
+ var i = $e(), t = i.firstChild;
201
+ return o(t, () => oe(e, n.error())), o(i, l(z, {
168
202
  size: "sm",
169
203
  variant: "ghost",
170
204
  onClick: () => {
171
- i.retry();
205
+ n.retry();
172
206
  },
173
207
  get disabled() {
174
- return e.disabled || i.pending();
208
+ return e.disabled || n.pending();
175
209
  },
176
210
  get children() {
177
- return u().retry;
211
+ return s().retry;
178
212
  }
179
- }), null), n;
213
+ }), null), i;
180
214
  }
181
- }), null), l(f, s(m, {
215
+ }), null), o(b, l(h, {
182
216
  get when() {
183
- return e.suggestions?.visible;
217
+ return A();
184
218
  },
185
219
  get fallback() {
186
220
  return [(() => {
187
- var n = ge();
188
- return l(n, s(F, {
221
+ var i = Fe();
222
+ return o(i, l(N, {
189
223
  get each() {
190
- return w();
224
+ return se();
191
225
  },
192
- children: (t, a) => [s(m, {
226
+ children: (t, a) => [l(h, {
193
227
  get when() {
194
228
  return a() > 0;
195
229
  },
196
230
  get children() {
197
- return s(H, {
231
+ return l(L, {
198
232
  class: "h-3 w-3 shrink-0 text-muted-foreground"
199
233
  });
200
234
  }
201
235
  }), (() => {
202
- var r = ve();
236
+ var r = Ee();
203
237
  return r.$$click = () => {
204
- i.navigate(t.path);
205
- }, l(r, () => t.name), k((c) => {
206
- var d = t.path, $ = e.disabled, b = t.path === i.currentPath() ? "location" : void 0;
207
- return d !== c.e && g(r, "title", c.e = d), $ !== c.t && (r.disabled = c.t = $), b !== c.a && g(r, "aria-current", c.a = b), c;
238
+ n.navigate(t.path);
239
+ }, o(r, () => t.name), P((u) => {
240
+ var v = t.path, p = e.disabled, c = t.path === n.currentPath() ? "location" : void 0;
241
+ return v !== u.e && g(r, "title", u.e = v), p !== u.t && (r.disabled = u.t = p), c !== u.a && g(r, "aria-current", u.a = c), u;
208
242
  }, {
209
243
  e: void 0,
210
244
  t: void 0,
211
245
  a: void 0
212
246
  }), r;
213
247
  })()]
214
- })), k(() => g(n, "aria-label", u().currentDirectory)), n;
248
+ }), null), o(i, l(h, {
249
+ get when() {
250
+ return e.directoryFavorites;
251
+ },
252
+ get children() {
253
+ return l(fe, {
254
+ get path() {
255
+ return n.currentPath();
256
+ },
257
+ get favorites() {
258
+ return e.directoryFavorites;
259
+ },
260
+ get copy() {
261
+ return s();
262
+ },
263
+ get disabled() {
264
+ return e.disabled || !n.valid();
265
+ },
266
+ onError: $
267
+ });
268
+ }
269
+ }), null), P(() => g(i, "aria-label", s().currentDirectory)), i;
215
270
  })(), (() => {
216
- var n = S();
217
- return U(n, j(() => e.scrollViewportProps, {
271
+ var i = O();
272
+ return te(i, re(() => e.scrollViewportProps, {
218
273
  get class() {
219
- return N("min-h-[120px] overflow-y-auto rounded border border-border", e.scrollViewportProps?.class);
274
+ return H("min-h-[120px] overflow-y-auto rounded border border-border", e.scrollViewportProps?.class);
220
275
  },
221
276
  get style() {
222
277
  return {
223
278
  "max-height": e.treeMaxHeight ?? "240px"
224
279
  };
225
280
  }
226
- }), !1, !0), l(n, s(m, {
281
+ }), !1, !0), o(i, l(h, {
227
282
  get when() {
228
- return !i.pending() || i.currentPath();
283
+ return !n.pending() || n.currentPath();
229
284
  },
230
285
  get fallback() {
231
286
  return (() => {
232
- var t = be();
233
- return l(t, () => u().loading), t;
287
+ var t = ne();
288
+ return o(t, () => s().loading), t;
234
289
  })();
235
290
  },
236
291
  get children() {
237
- return s(m, {
292
+ return l(h, {
238
293
  get when() {
239
294
  return y().length;
240
295
  },
241
296
  get fallback() {
242
- return s(m, {
297
+ return l(h, {
243
298
  get when() {
244
- return i.currentPath();
299
+ return n.currentPath();
245
300
  },
246
301
  get children() {
247
- var t = me();
248
- return l(t, () => u().empty), t;
302
+ var t = ze();
303
+ return o(t, () => s().empty), t;
249
304
  }
250
305
  });
251
306
  },
252
307
  get children() {
253
- return s(F, {
308
+ return l(N, {
254
309
  get each() {
255
310
  return y();
256
311
  },
257
- children: (t, a) => (() => {
258
- var r = xe(), c = r.firstChild;
259
- return r.$$keydown = (d) => p(d, a(), E, y().length), r.$$click = () => {
260
- i.navigate(t.path);
261
- }, M((d) => {
262
- E[a()] = d;
263
- }, r), l(r, s(te, {
264
- item: t,
265
- size: 16,
266
- class: "h-4 w-4 shrink-0"
267
- }), c), l(c, () => t.name), l(r, s(H, {
268
- class: "h-3 w-3 shrink-0 text-muted-foreground"
269
- }), null), k((d) => {
270
- var $ = t.path, b = e.disabled || e.filter?.(t) === !1;
271
- return $ !== d.e && g(r, "data-picker-row-path", d.e = $), b !== d.t && (r.disabled = d.t = b), d;
272
- }, {
273
- e: void 0,
274
- t: void 0
275
- }), r;
276
- })()
312
+ children: (t, a) => l(ie, {
313
+ get path() {
314
+ return t.path;
315
+ },
316
+ get favorites() {
317
+ return e.directoryFavorites;
318
+ },
319
+ get copy() {
320
+ return s();
321
+ },
322
+ get scopeKey() {
323
+ return e.scopeKey;
324
+ },
325
+ get disabled() {
326
+ return e.disabled || e.filter?.(t) === !1;
327
+ },
328
+ onError: $,
329
+ get children() {
330
+ var r = Ae(), u = r.firstChild;
331
+ return r.$$keydown = (v) => X(v, a(), Y, y().length), r.$$click = () => {
332
+ n.navigate(t.path);
333
+ }, S((v) => {
334
+ Y[a()] = v;
335
+ }, r), o(r, l(ve, {
336
+ item: t,
337
+ size: 16,
338
+ class: "h-4 w-4 shrink-0"
339
+ }), u), o(u, () => t.name), o(r, l(L, {
340
+ class: "h-3 w-3 shrink-0 text-muted-foreground"
341
+ }), null), P((v) => {
342
+ var p = t.path, c = e.disabled || e.filter?.(t) === !1;
343
+ return p !== v.e && g(r, "data-picker-row-path", v.e = p), c !== v.t && (r.disabled = v.t = c), v;
344
+ }, {
345
+ e: void 0,
346
+ t: void 0
347
+ }), r;
348
+ }
349
+ })
277
350
  });
278
351
  }
279
352
  });
280
353
  }
281
- })), n;
354
+ })), i;
282
355
  })(), (() => {
283
- var n = fe(), t = n.firstChild, a = t.firstChild;
356
+ var i = Ie(), t = i.firstChild, a = t.firstChild;
284
357
  return a.addEventListener("change", (r) => {
285
- i.setShowHidden(r.currentTarget.checked);
286
- }), l(t, () => u().showHidden, null), l(n, s(m, {
358
+ n.setShowHidden(r.currentTarget.checked);
359
+ }), o(t, () => s().showHidden, null), o(i, l(h, {
287
360
  get when() {
288
- return L(() => !!i.pending())() && i.currentPath();
361
+ return C(() => !!n.pending())() && n.currentPath();
289
362
  },
290
363
  get children() {
291
- var r = he();
292
- return l(r, () => u().loading), r;
364
+ var r = Ce();
365
+ return o(r, () => s().loading), r;
293
366
  }
294
- }), null), k(() => a.disabled = e.disabled || !i.context()), k(() => a.checked = i.showHidden()), n;
295
- })(), s(m, {
367
+ }), null), P(() => a.disabled = e.disabled || !n.context()), P(() => a.checked = n.showHidden()), i;
368
+ })(), l(h, {
296
369
  get when() {
297
370
  return e.onCreateFolder;
298
371
  },
299
372
  get children() {
300
- return s($e, e);
373
+ return l(Me, e);
301
374
  }
302
375
  })];
303
376
  },
304
377
  get children() {
305
- var n = S();
306
- return U(n, j(() => e.scrollViewportProps, {
307
- "data-picker-suggestions": "",
308
- get "aria-label"() {
309
- return e.suggestions?.label;
310
- },
311
- get class() {
312
- return N("min-h-[180px] min-w-0 overflow-y-auto", e.scrollViewportProps?.class);
378
+ return [l(h, {
379
+ get when() {
380
+ return n.view() === "favorites";
313
381
  },
314
- get style() {
315
- return {
316
- "max-height": e.treeMaxHeight ?? "240px"
317
- };
382
+ get children() {
383
+ return l(j, {
384
+ size: "sm",
385
+ get "aria-label"() {
386
+ return s().favoritesFilter;
387
+ },
388
+ get placeholder() {
389
+ return s().favoritesFilter;
390
+ },
391
+ get value() {
392
+ return F();
393
+ },
394
+ onInput: (i) => k(i.currentTarget.value)
395
+ });
318
396
  }
319
- }), !1, !0), l(n, s(F, {
320
- get each() {
321
- return e.suggestions?.paths;
322
- },
323
- children: (t, a) => (() => {
324
- var r = we(), c = r.firstChild, d = c.firstChild, $ = d.nextSibling;
325
- return r.$$keydown = (b) => p(b, a(), z, e.suggestions?.paths.length ?? 0), r.$$click = () => {
326
- e.suggestions?.onVisibilityChange(!1), i.navigate(t), C?.focus();
327
- }, M((b) => {
328
- z[a()] = b;
329
- }, r), g(r, "data-picker-suggested-path", t), g(r, "title", t), g(r, "aria-label", t), l(r, s(O, {
330
- class: "h-4 w-4 shrink-0 text-muted-foreground"
331
- }), c), l(d, () => t.split("/").filter(Boolean).at(-1) ?? u().root), l($, t), l(r, s(H, {
332
- class: "h-3 w-3 shrink-0 text-muted-foreground/60"
333
- }), null), k(() => r.disabled = e.disabled || !i.context()), r;
334
- })()
335
- })), n;
397
+ }), (() => {
398
+ var i = O();
399
+ return te(i, re(() => e.scrollViewportProps, {
400
+ get "data-picker-suggestions"() {
401
+ return n.view() === "suggestions" ? "" : void 0;
402
+ },
403
+ get "data-picker-favorites"() {
404
+ return n.view() === "favorites" ? "" : void 0;
405
+ },
406
+ get "aria-label"() {
407
+ return C(() => n.view() === "favorites")() ? s().favorites : e.suggestions?.label;
408
+ },
409
+ get "aria-busy"() {
410
+ return C(() => n.view() === "favorites")() && e.directoryFavorites?.loading;
411
+ },
412
+ get class() {
413
+ return H("min-h-[180px] min-w-0 overflow-y-auto", e.scrollViewportProps?.class);
414
+ },
415
+ get style() {
416
+ return {
417
+ "max-height": e.treeMaxHeight ?? "240px"
418
+ };
419
+ }
420
+ }), !1, !0), o(i, l(h, {
421
+ get when() {
422
+ return D().length;
423
+ },
424
+ get fallback() {
425
+ return (() => {
426
+ var t = ne();
427
+ return o(t, (() => {
428
+ var a = C(() => !!e.directoryFavorites?.loading);
429
+ return () => a() ? s().loading : C(() => !!e.directoryFavorites?.error)() ? s().favoritesLoadFailed : C(() => !!F().trim())() ? s().favoritesNoMatches : s().favoritesEmpty;
430
+ })()), t;
431
+ })();
432
+ },
433
+ get children() {
434
+ return l(N, {
435
+ get each() {
436
+ return D();
437
+ },
438
+ children: (t, a) => l(ie, {
439
+ path: t,
440
+ get favorites() {
441
+ return e.directoryFavorites;
442
+ },
443
+ get copy() {
444
+ return s();
445
+ },
446
+ get scopeKey() {
447
+ return e.scopeKey;
448
+ },
449
+ get disabled() {
450
+ return e.disabled;
451
+ },
452
+ onError: $,
453
+ get children() {
454
+ var r = Ve(), u = r.firstChild, v = u.firstChild, p = v.nextSibling;
455
+ return r.$$keydown = (c) => X(c, a(), Q, D().length), r.$$click = () => {
456
+ K(t);
457
+ }, S((c) => {
458
+ Q[a()] = c;
459
+ }, r), g(r, "title", t), g(r, "aria-label", t), o(r, l(le, {
460
+ class: "h-4 w-4 shrink-0 text-muted-foreground"
461
+ }), u), o(v, () => t.split("/").filter(Boolean).at(-1) ?? s().root), o(p, t), o(r, l(L, {
462
+ class: "h-3 w-3 shrink-0 text-muted-foreground/60"
463
+ }), null), P((c) => {
464
+ var R = n.view() === "suggestions" ? t : void 0, M = n.view() === "favorites" ? t : void 0, ee = e.disabled || !n.context();
465
+ return R !== c.e && g(r, "data-picker-suggested-path", c.e = R), M !== c.t && g(r, "data-picker-favorite-path", c.t = M), ee !== c.a && (r.disabled = c.a = ee), c;
466
+ }, {
467
+ e: void 0,
468
+ t: void 0,
469
+ a: void 0
470
+ }), r;
471
+ }
472
+ })
473
+ });
474
+ }
475
+ })), i;
476
+ })()];
336
477
  }
337
- }), null), k((n) => {
338
- var t = i.pending(), a = e.suggestions?.paths.length ? "tabpanel" : void 0, r = e.suggestions?.paths.length ? `${x}-${P()}` : void 0;
339
- return t !== n.e && g(o, "aria-busy", n.e = t), a !== n.t && g(f, "role", n.t = a), r !== n.a && g(f, "aria-labelledby", n.a = r), n;
478
+ }), null), P((i) => {
479
+ var t = n.pending(), a = w() ? "tabpanel" : void 0, r = w() ? `${m}-${T()}` : void 0;
480
+ return t !== i.e && g(d, "aria-busy", i.e = t), a !== i.t && g(b, "role", i.t = a), r !== i.a && g(b, "aria-labelledby", i.a = r), i;
340
481
  }, {
341
482
  e: void 0,
342
483
  t: void 0,
343
484
  a: void 0
344
- }), o;
485
+ }), d;
345
486
  })();
346
487
  }
347
- function $e(e) {
348
- const [u, i] = D(!1), [y, v] = D(""), [x, C] = D(!1), [A, P] = D(null), _ = () => T(e), z = async () => {
349
- if (!y().trim() || !e.source.valid() || !e.onCreateFolder || x()) return;
350
- const p = e.source.currentPath();
351
- C(!0), P(null);
488
+ function Me(e) {
489
+ const [s, n] = E(!1), [y, _] = E(""), [m, F] = E(!1), [k, I] = E(null), $ = () => W(e), A = async () => {
490
+ if (!y().trim() || !e.source.valid() || !e.onCreateFolder || m()) return;
491
+ const w = e.source.currentPath();
492
+ F(!0), I(null);
352
493
  try {
353
- await e.onCreateFolder(p, y().trim()), v(""), i(!1), e.source.active() && p === e.source.currentPath() && await e.source.navigate(p);
354
- } catch (w) {
355
- P(w);
494
+ await e.onCreateFolder(w, y().trim()), _(""), n(!1), e.source.active() && w === e.source.currentPath() && await e.source.navigate(w);
495
+ } catch (x) {
496
+ I(x);
356
497
  } finally {
357
- C(!1);
498
+ F(!1);
358
499
  }
359
500
  };
360
501
  return (() => {
361
- var p = S();
362
- return l(p, s(m, {
502
+ var w = O();
503
+ return o(w, l(h, {
363
504
  get when() {
364
- return u();
505
+ return s();
365
506
  },
366
507
  get fallback() {
367
- return s(I, {
508
+ return l(z, {
368
509
  size: "sm",
369
510
  variant: "ghost",
370
511
  get disabled() {
371
512
  return e.disabled || !e.source.valid();
372
513
  },
373
- onClick: () => i(!0),
514
+ onClick: () => n(!0),
374
515
  get children() {
375
- return [s(O, {
516
+ return [l(le, {
376
517
  class: "mr-1 h-3.5 w-3.5"
377
- }), L(() => _().newFolder)];
518
+ }), C(() => $().newFolder)];
378
519
  }
379
520
  });
380
521
  },
381
522
  get children() {
382
- var w = ye();
383
- return l(w, s(W, {
523
+ var x = De();
524
+ return o(x, l(j, {
384
525
  size: "sm",
385
526
  get "aria-label"() {
386
- return _().folderName;
527
+ return $().folderName;
387
528
  },
388
529
  get value() {
389
530
  return y();
390
531
  },
391
- onInput: (E) => v(E.currentTarget.value),
532
+ onInput: (D) => _(D.currentTarget.value),
392
533
  get disabled() {
393
- return e.disabled || x();
534
+ return e.disabled || m();
394
535
  }
395
- }), null), l(w, s(I, {
536
+ }), null), o(x, l(z, {
396
537
  size: "sm",
397
538
  get disabled() {
398
- return e.disabled || x() || !y().trim() || !e.source.valid();
539
+ return e.disabled || m() || !y().trim() || !e.source.valid();
399
540
  },
400
541
  onClick: () => {
401
- z();
542
+ A();
402
543
  },
403
544
  get children() {
404
- return _().create;
545
+ return $().create;
405
546
  }
406
- }), null), l(w, s(I, {
547
+ }), null), o(x, l(z, {
407
548
  size: "sm",
408
549
  variant: "ghost-destructive",
409
550
  get disabled() {
410
- return e.disabled || x();
551
+ return e.disabled || m();
411
552
  },
412
- onClick: () => i(!1),
553
+ onClick: () => n(!1),
413
554
  get children() {
414
- return _().cancel;
555
+ return $().cancel;
415
556
  }
416
- }), null), w;
557
+ }), null), x;
417
558
  }
418
- }), null), l(p, s(m, {
559
+ }), null), o(w, l(h, {
419
560
  get when() {
420
- return A();
561
+ return k();
421
562
  },
422
563
  get children() {
423
- var w = pe();
424
- return l(w, () => J(e, A())), w;
564
+ var x = Re();
565
+ return o(x, () => oe(e, k())), x;
425
566
  }
426
- }), null), p;
567
+ }), null), w;
427
568
  })();
428
569
  }
429
- const Me = G;
430
- X(["click", "keydown"]);
570
+ const Ge = q;
571
+ ce(["click", "keydown"]);
431
572
  export {
432
- De as PickerPanel,
433
- Se as getParentPath,
434
- Me as normalizePath,
435
- T as pickerCopy,
436
- J as pickerErrorMessage,
437
- Ve as usePickerNavigation
573
+ We as PickerPanel,
574
+ Xe as getParentPath,
575
+ Ge as normalizePath,
576
+ W as pickerCopy,
577
+ oe as pickerErrorMessage,
578
+ Oe as usePickerNavigation
438
579
  };