@synopackageland/sdk 0.0.0-stage → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -2
  3. package/dist/i18n/authorization/de.json +37 -0
  4. package/dist/i18n/authorization/en.json +37 -0
  5. package/dist/i18n/authorization/es.json +37 -0
  6. package/dist/i18n/authorization/fr.json +37 -0
  7. package/dist/i18n/authorization/it.json +37 -0
  8. package/dist/i18n/authorization/ja.json +37 -0
  9. package/dist/i18n/authorization/ko.json +37 -0
  10. package/dist/i18n/authorization/zh-CN.json +37 -0
  11. package/dist/i18n/authorization/zh-TW.json +37 -0
  12. package/dist/i18n/background/de.json +75 -0
  13. package/dist/i18n/background/en.json +75 -0
  14. package/dist/i18n/background/es.json +75 -0
  15. package/dist/i18n/background/fr.json +75 -0
  16. package/dist/i18n/background/it.json +75 -0
  17. package/dist/i18n/background/ja.json +75 -0
  18. package/dist/i18n/background/ko.json +75 -0
  19. package/dist/i18n/background/zh-CN.json +75 -0
  20. package/dist/i18n/background/zh-TW.json +75 -0
  21. package/dist/i18n/delegate/de.json +49 -0
  22. package/dist/i18n/delegate/en.json +49 -0
  23. package/dist/i18n/delegate/es.json +49 -0
  24. package/dist/i18n/delegate/fr.json +49 -0
  25. package/dist/i18n/delegate/it.json +49 -0
  26. package/dist/i18n/delegate/ja.json +49 -0
  27. package/dist/i18n/delegate/ko.json +49 -0
  28. package/dist/i18n/delegate/zh-CN.json +49 -0
  29. package/dist/i18n/delegate/zh-TW.json +49 -0
  30. package/dist/i18n/files/de.json +41 -0
  31. package/dist/i18n/files/en.json +41 -0
  32. package/dist/i18n/files/es.json +41 -0
  33. package/dist/i18n/files/fr.json +41 -0
  34. package/dist/i18n/files/it.json +41 -0
  35. package/dist/i18n/files/ja.json +41 -0
  36. package/dist/i18n/files/ko.json +41 -0
  37. package/dist/i18n/files/zh-CN.json +41 -0
  38. package/dist/i18n/files/zh-TW.json +41 -0
  39. package/dist/i18n/identity/de.json +27 -0
  40. package/dist/i18n/identity/en.json +27 -0
  41. package/dist/i18n/identity/es.json +27 -0
  42. package/dist/i18n/identity/fr.json +27 -0
  43. package/dist/i18n/identity/it.json +27 -0
  44. package/dist/i18n/identity/ja.json +27 -0
  45. package/dist/i18n/identity/ko.json +27 -0
  46. package/dist/i18n/identity/zh-CN.json +27 -0
  47. package/dist/i18n/identity/zh-TW.json +27 -0
  48. package/dist/i18n/save/de.json +42 -0
  49. package/dist/i18n/save/en.json +42 -0
  50. package/dist/i18n/save/es.json +42 -0
  51. package/dist/i18n/save/fr.json +42 -0
  52. package/dist/i18n/save/it.json +42 -0
  53. package/dist/i18n/save/ja.json +42 -0
  54. package/dist/i18n/save/ko.json +42 -0
  55. package/dist/i18n/save/zh-CN.json +42 -0
  56. package/dist/i18n/save/zh-TW.json +42 -0
  57. package/dist/i18n/shell/de.json +4 -0
  58. package/dist/i18n/shell/en.json +4 -0
  59. package/dist/i18n/shell/es.json +4 -0
  60. package/dist/i18n/shell/fr.json +4 -0
  61. package/dist/i18n/shell/it.json +4 -0
  62. package/dist/i18n/shell/ja.json +4 -0
  63. package/dist/i18n/shell/ko.json +4 -0
  64. package/dist/i18n/shell/zh-CN.json +4 -0
  65. package/dist/i18n/shell/zh-TW.json +4 -0
  66. package/dist/index.js +2627 -0
  67. package/dist/src/authorization/AuthorizationGate.vue.d.ts +22 -0
  68. package/dist/src/authorization/i18n.d.ts +3 -0
  69. package/dist/src/background/BackgroundPanel.vue.d.ts +7 -0
  70. package/dist/src/background/i18n.d.ts +79 -0
  71. package/dist/src/background/picker-provider.d.ts +3 -0
  72. package/dist/src/background/request-key.d.ts +1 -0
  73. package/dist/src/context.d.ts +114 -0
  74. package/dist/src/delegate/BackgroundSavePanel.vue.d.ts +18 -0
  75. package/dist/src/delegate/DelegatePanel.vue.d.ts +7 -0
  76. package/dist/src/delegate/ExecutorSettings.vue.d.ts +13 -0
  77. package/dist/src/delegate/copy.d.ts +101 -0
  78. package/dist/src/delegate/executor-setup.d.ts +16 -0
  79. package/dist/src/delegate/facade.d.ts +8 -0
  80. package/dist/src/delegate/long-running.d.ts +74 -0
  81. package/dist/src/delegate/save-copy.d.ts +126 -0
  82. package/dist/src/delegate/scoped-picker.d.ts +3 -0
  83. package/dist/src/delegate/use-executor-setup.d.ts +4 -0
  84. package/dist/src/files/FileBrowser.vue.d.ts +17 -0
  85. package/dist/src/files/FilesPage.vue.d.ts +7 -0
  86. package/dist/src/files/transfers.d.ts +9 -0
  87. package/dist/src/i18n.d.ts +7 -0
  88. package/dist/src/identity/LoginPage.vue.d.ts +8 -0
  89. package/dist/src/identity/i18n.d.ts +31 -0
  90. package/dist/src/identity/session.d.ts +20 -0
  91. package/dist/src/index.d.ts +24 -0
  92. package/dist/src/nas/NasPicker.vue.d.ts +22 -0
  93. package/dist/src/nas/contract.d.ts +27 -0
  94. package/dist/src/nas/i18n.d.ts +2 -0
  95. package/dist/src/nas/locale.d.ts +45 -0
  96. package/dist/src/nas/provider.d.ts +3 -0
  97. package/dist/src/nas/use-request.d.ts +6 -0
  98. package/dist/src/portal/PortalSettings.vue.d.ts +7 -0
  99. package/dist/src/protocol/codec.d.ts +17 -0
  100. package/dist/src/protocol/v1.d.ts +518 -0
  101. package/dist/src/shell/AppShell.vue.d.ts +26 -0
  102. package/dist/src/shell/i18n.d.ts +7 -0
  103. package/dist/src/shell/pages.d.ts +7 -0
  104. package/dist/src/vue.d.ts +15 -0
  105. package/dist/style.css +1 -0
  106. package/dist/vue.js +2331 -0
  107. package/package.json +64 -4
  108. package/spec/protocol/v1/README.md +112 -0
  109. package/spec/protocol/v1/errors.json +454 -0
  110. package/spec/protocol/v1/schema/delegate.audit.json +11 -0
  111. package/spec/protocol/v1/schema/delegate.create.json +49 -0
  112. package/spec/protocol/v1/schema/delegate.disable.json +11 -0
  113. package/spec/protocol/v1/schema/delegate.enable.json +11 -0
  114. package/spec/protocol/v1/schema/delegate.list.json +11 -0
  115. package/spec/protocol/v1/schema/delegate.revoke.json +23 -0
  116. package/spec/protocol/v1/schema/files.cancelOperation.json +24 -0
  117. package/spec/protocol/v1/schema/files.checkPermission.json +30 -0
  118. package/spec/protocol/v1/schema/files.copy.json +42 -0
  119. package/spec/protocol/v1/schema/files.createFolder.json +38 -0
  120. package/spec/protocol/v1/schema/files.delete.json +36 -0
  121. package/spec/protocol/v1/schema/files.info.json +30 -0
  122. package/spec/protocol/v1/schema/files.list.json +30 -0
  123. package/spec/protocol/v1/schema/files.move.json +42 -0
  124. package/spec/protocol/v1/schema/files.moveFromStaging.json +47 -0
  125. package/spec/protocol/v1/schema/files.operationStatus.json +24 -0
  126. package/spec/protocol/v1/schema/files.read.json +35 -0
  127. package/spec/protocol/v1/schema/files.rename.json +35 -0
  128. package/spec/protocol/v1/schema/files.taskCancel.json +29 -0
  129. package/spec/protocol/v1/schema/files.taskStatus.json +29 -0
  130. package/spec/protocol/v1/schema/files.write.json +46 -0
  131. package/spec/protocol/v1/schema/root.run.json +19 -0
  132. package/spec/protocol/v1/schema/status.json +11 -0
  133. package/spec/protocol/v1/vectors/delegate.jsonl +16 -0
  134. package/spec/protocol/v1/vectors/envelope.jsonl +11 -0
  135. package/spec/protocol/v1/vectors/files.jsonl +10 -0
  136. package/spec/protocol/v1/vectors/status.jsonl +2 -0
package/dist/vue.js ADDED
@@ -0,0 +1,2331 @@
1
+ import { shellCopy as Oe, nasCopy as oe, nasErrorCopy as we, format as ve, saveCopy as Ce, saveError as be, createNasProvider as $e, identityCopy as Re, backgroundCopy as qe, createBackgroundPickerProvider as Le, backgroundErrorCopy as Be, requestKey as _e, delegateCopy as xe, errorCopy as Fe, scopedPicker as Ne, authorizationCopy as Me } from "./index.js";
2
+ import { activePage as mt, authorizationCatalogs as bt, backgroundCatalogs as kt, catalogs as _t, createBackgroundSaveFacade as gt, createFileTransfers as ht, decodeResponse as wt, delegateCatalogs as Ct, encodeRequest as $t, identityCatalogs as xt, nasCatalogs as St, protocolCodes as zt, protocolOps as Vt, protocolSchemas as Pt, saveCatalogs as Ut, shellCatalogs as Dt, shellPages as At, uiLocale as Et, uiLocales as Tt } from "./index.js";
3
+ import { inject as He, ref as p, onBeforeUnmount as se, defineComponent as ae, computed as N, openBlock as t, createBlock as g, unref as e, withCtx as s, createVNode as b, renderSlot as ke, createElementVNode as _, onMounted as ie, createElementBlock as C, toDisplayString as l, createTextVNode as f, createCommentVNode as m, Fragment as j, renderList as te, watch as Se, withModifiers as ce, onUnmounted as ze, nextTick as Ke, resolveDynamicComponent as Je } from "vue";
4
+ import { AppLayout as Xe, PageContent as Ge, PageHeader as Qe, AppSidebar as Ye, Button as z, FilePicker as We, Callout as Q, TreeView as Ze, DataGrid as je, Dialog as Ve, SettingsSection as de, Link as Pe, Form as pe, FormItem as ne, Input as re, FormActions as fe, Select as Ue, Checkbox as ea, Surface as aa } from "@synopackageland/ui";
5
+ import { Timer as la, Info as ta, Folder as ge, File as na, TriangleAlert as sa, ShieldCheck as he } from "@lucide/vue";
6
+ const ua = /* @__PURE__ */ Symbol("executor-setup");
7
+ function ia() {
8
+ return He(ua, {
9
+ async status() {
10
+ return { state: "blocked", reason: "setup-unavailable" };
11
+ },
12
+ async authorize() {
13
+ throw { code: "setup-unavailable" };
14
+ },
15
+ async control() {
16
+ throw { code: "setup-unavailable" };
17
+ }
18
+ });
19
+ }
20
+ function nt(y) {
21
+ const D = p(!1), a = p(!1), $ = p(), u = p("");
22
+ let r = !1, n = 0, i, o;
23
+ function h() {
24
+ clearTimeout(i), clearTimeout(o);
25
+ }
26
+ function v(P = "") {
27
+ n++, h(), $.value = void 0, u.value = P;
28
+ }
29
+ function w(P) {
30
+ if (r) return;
31
+ const q = Date.parse(P.expiresAt) - Date.now();
32
+ if (!Number.isFinite(q) || q <= 0) {
33
+ v("expired");
34
+ return;
35
+ }
36
+ h(), $.value = P, u.value = "", i = setTimeout(() => v("expired"), q);
37
+ const Y = n;
38
+ o = setTimeout(async () => {
39
+ try {
40
+ const X = await y.call("identity.session");
41
+ !r && n === Y && w(X);
42
+ } catch {
43
+ !r && n === Y && v("expired");
44
+ }
45
+ }, Math.min(6e4, q));
46
+ }
47
+ async function U() {
48
+ try {
49
+ const P = await y.call("identity.status");
50
+ if (r) return;
51
+ if (D.value = P.enabled === !0, D.value)
52
+ try {
53
+ w(await y.call("identity.session", { bootstrap: !0 }));
54
+ } catch {
55
+ r || v();
56
+ }
57
+ } catch (P) {
58
+ const q = P?.code;
59
+ D.value = !["unknown_method", "admin_required", "app_privilege_denied", "session_required"].includes(q || ""), D.value && (u.value = "unavailable");
60
+ } finally {
61
+ r || (a.value = !0);
62
+ }
63
+ }
64
+ async function c(P, q) {
65
+ const Y = n;
66
+ try {
67
+ const X = await y.call(P, q);
68
+ if (r || D.value && Y !== n) throw { code: "session_required" };
69
+ return X;
70
+ } catch (X) {
71
+ const F = X?.code;
72
+ throw !r && Y === n && D.value && ["session_required", "session_revalidation_required"].includes(F || "") && v(F === "session_revalidation_required" ? "revalidate" : "expired"), X;
73
+ }
74
+ }
75
+ async function V(P, q, Y) {
76
+ const X = await y.call("identity.login", { account: P, password: q, otp: Y });
77
+ r || (n++, w(X));
78
+ }
79
+ async function S() {
80
+ const P = await y.call("identity.session", { bootstrap: !0 });
81
+ r || (n++, w(P));
82
+ }
83
+ async function E() {
84
+ await y.call("identity.logout"), r || v();
85
+ }
86
+ function H() {
87
+ r = !0, v();
88
+ }
89
+ return { enabled: D, ready: a, subject: $, notice: u, start: U, call: c, login: V, bootstrap: S, logout: E, dispose: H };
90
+ }
91
+ function oa() {
92
+ const y = p(!1), D = p();
93
+ let a = !1, $ = 0, u;
94
+ function r() {
95
+ $++, u?.abort(), u = void 0, y.value = !1, D.value = void 0;
96
+ }
97
+ async function n(i) {
98
+ if (a || y.value) return;
99
+ const o = ++$, h = new AbortController();
100
+ u = h, y.value = !0, D.value = void 0;
101
+ try {
102
+ const v = await i(h.signal);
103
+ return !a && o === $ ? v : void 0;
104
+ } catch (v) {
105
+ !a && o === $ && (D.value = v);
106
+ return;
107
+ } finally {
108
+ !a && o === $ && (y.value = !1, u = void 0);
109
+ }
110
+ }
111
+ return se(() => {
112
+ a = !0, r();
113
+ }), { busy: y, error: D, run: n, cancel: r };
114
+ }
115
+ const ra = { class: "app-page-content" }, da = /* @__PURE__ */ ae({
116
+ __name: "AppShell",
117
+ props: {
118
+ locale: {},
119
+ modelValue: {},
120
+ pages: {},
121
+ description: {}
122
+ },
123
+ emits: ["update:modelValue"],
124
+ setup(y, { emit: D }) {
125
+ const a = y, $ = D, u = N(() => Oe(a.locale)), r = { status: ta, background: la }, n = N(() => [{
126
+ items: a.pages.map((o) => ({ key: o, label: u.value[o], icon: r[o] }))
127
+ }]), i = N(() => u.value[a.modelValue] ?? u.value.status);
128
+ return (o, h) => (t(), g(e(Xe), {
129
+ class: "app-shell",
130
+ "min-height": "0",
131
+ "wide-layout": "window"
132
+ }, {
133
+ sidebar: s(() => [
134
+ b(e(Ye), {
135
+ "model-value": y.modelValue,
136
+ groups: n.value,
137
+ "onUpdate:modelValue": h[0] || (h[0] = (v) => $("update:modelValue", v))
138
+ }, null, 8, ["model-value", "groups"])
139
+ ]),
140
+ default: s(() => [
141
+ b(e(Ge), { class: "app-page" }, {
142
+ default: s(() => [
143
+ b(e(Qe), {
144
+ title: i.value,
145
+ description: y.description
146
+ }, {
147
+ actions: s(() => [
148
+ ke(o.$slots, "actions", {}, void 0, !0)
149
+ ]),
150
+ _: 3
151
+ }, 8, ["title", "description"]),
152
+ _("div", ra, [
153
+ ke(o.$slots, "default", {}, void 0, !0)
154
+ ])
155
+ ]),
156
+ _: 3
157
+ })
158
+ ]),
159
+ _: 3
160
+ }));
161
+ }
162
+ }), ue = (y, D) => {
163
+ const a = y.__vccOpts || y;
164
+ for (const [$, u] of D)
165
+ a[$] = u;
166
+ return a;
167
+ }, st = /* @__PURE__ */ ue(da, [["__scopeId", "data-v-05f63ca5"]]), va = ["aria-busy", "aria-label"], ca = ["aria-label"], pa = {
168
+ key: 0,
169
+ class: "file-toolbar"
170
+ }, fa = {
171
+ key: 1,
172
+ role: "status"
173
+ }, ya = { role: "alert" }, ma = {
174
+ key: 4,
175
+ role: "status"
176
+ }, ba = { class: "file-columns" }, ka = ["aria-label"], _a = { class: "file-content" }, ga = {
177
+ key: 1,
178
+ class: "file-name"
179
+ }, ha = { class: "file-bytes" }, wa = {
180
+ key: 5,
181
+ class: "file-selection",
182
+ role: "status"
183
+ }, Ca = /* @__PURE__ */ ae({
184
+ __name: "FileBrowser",
185
+ props: {
186
+ provider: {},
187
+ locale: {},
188
+ mode: { default: "file" },
189
+ transfers: { type: Boolean, default: !1 }
190
+ },
191
+ emits: ["selected"],
192
+ setup(y, { emit: D }) {
193
+ const a = y, $ = D, u = N(() => oe(a.locale)), r = oa(), { busy: n, error: i } = r, o = p([]), h = p([]), v = p([]), w = p(), U = p(), c = p([]), V = p(), S = p({ key: "name", direction: "asc" }), E = p(0), H = p([]), P = p(!1);
194
+ let q = new AbortController();
195
+ async function Y() {
196
+ const d = w.value;
197
+ !d || d.isDir || !a.provider.download || await r.run(async (k) => (await a.provider.info(d.path, k), a.provider.download(d.path), !0));
198
+ }
199
+ async function X() {
200
+ const d = v.value.at(-1)?.path, k = H.value[0];
201
+ if (!d || !k || !a.provider.upload) return;
202
+ P.value = !1, await r.run(async (G) => (await a.provider.upload(d, k, G), !0)) && (H.value = [], await R(v.value), P.value = !0);
203
+ }
204
+ const F = N(() => [
205
+ { key: "name", label: u.value.nameColumn, sortable: !0 },
206
+ { key: "kind", label: u.value.kindColumn },
207
+ { key: "bytes", label: u.value.sizeColumn, align: "right", sortable: !0 },
208
+ { key: "selection", label: u.value.selectAction }
209
+ ]);
210
+ function L(d) {
211
+ return { id: d.path, label: d.name, icon: ge, data: d };
212
+ }
213
+ function J(d) {
214
+ w.value = d, $("selected", d?.path);
215
+ }
216
+ function K(d, k, x = []) {
217
+ for (const G of d) {
218
+ const Z = [...x, G.data];
219
+ if (G.id === k) return Z;
220
+ const ee = K(G.children ?? [], k, Z);
221
+ if (ee) return ee;
222
+ }
223
+ }
224
+ async function W(d) {
225
+ const k = E.value, x = q.signal;
226
+ try {
227
+ const G = [];
228
+ let Z = 0;
229
+ for (; Z !== void 0; ) {
230
+ const ee = await a.provider.list(d.id, { offset: Z, sortBy: "name", sortDirection: "ASC" }, x);
231
+ if (x.aborted || k !== E.value) return;
232
+ G.push(...ee.entries.filter((me) => me.isDir).map(L)), Z = ee.nextOffset;
233
+ }
234
+ return G;
235
+ } catch (G) {
236
+ !x.aborted && k === E.value && (i.value = G, J());
237
+ return;
238
+ }
239
+ }
240
+ async function R(d, k = !1) {
241
+ if (n.value) return;
242
+ J(), o.value = k ? o.value : [], U.value = k ? U.value : void 0;
243
+ const x = k ? U.value ?? 0 : 0, G = d.at(-1)?.path;
244
+ v.value = d;
245
+ const Z = await r.run((ee) => G ? a.provider.list(G, { offset: x, sortBy: S.value.key, sortDirection: S.value.direction === "asc" ? "ASC" : "DESC" }, ee) : a.provider.shares(x, ee));
246
+ Z && (o.value = k ? [...o.value, ...Z.entries] : Z.entries, U.value = Z.nextOffset, G || (h.value = o.value.filter((ee) => ee.isDir).map(L)));
247
+ }
248
+ function O(d) {
249
+ R([...v.value, d]);
250
+ }
251
+ function T(d) {
252
+ S.value = { key: d?.key === "bytes" ? "size" : "name", direction: d?.direction ?? "asc" }, R(v.value);
253
+ }
254
+ function M() {
255
+ n.value || (E.value++, q.abort(), q = new AbortController(), h.value = [], c.value = [], V.value = void 0, R([]));
256
+ }
257
+ return ie(() => {
258
+ R([]);
259
+ }), se(() => {
260
+ E.value++, q.abort();
261
+ }), (d, k) => (t(), C("section", {
262
+ class: "file-browser",
263
+ "aria-busy": e(n),
264
+ "aria-label": u.value.title
265
+ }, [
266
+ _("p", null, l(u.value.ownPermissions), 1),
267
+ _("nav", {
268
+ class: "file-toolbar",
269
+ "aria-label": u.value.directoryKind
270
+ }, [
271
+ b(e(z), {
272
+ variant: "secondary",
273
+ disabled: e(n),
274
+ onClick: M
275
+ }, {
276
+ default: s(() => [
277
+ f(l(u.value.refresh), 1)
278
+ ]),
279
+ _: 1
280
+ }, 8, ["disabled"]),
281
+ v.value.length ? (t(), g(e(z), {
282
+ key: 0,
283
+ variant: "secondary",
284
+ disabled: e(n),
285
+ onClick: k[0] || (k[0] = (x) => R(v.value.slice(0, -1)))
286
+ }, {
287
+ default: s(() => [
288
+ f(l(u.value.back), 1)
289
+ ]),
290
+ _: 1
291
+ }, 8, ["disabled"])) : m("", !0),
292
+ b(e(z), {
293
+ variant: "secondary",
294
+ disabled: e(n),
295
+ onClick: k[1] || (k[1] = (x) => R([]))
296
+ }, {
297
+ default: s(() => [
298
+ f(l(u.value.roots), 1)
299
+ ]),
300
+ _: 1
301
+ }, 8, ["disabled"]),
302
+ (t(!0), C(j, null, te(v.value, (x, G) => (t(), g(e(z), {
303
+ key: x.path,
304
+ variant: "secondary",
305
+ disabled: e(n),
306
+ onClick: (Z) => R(v.value.slice(0, G + 1))
307
+ }, {
308
+ default: s(() => [
309
+ f(l(x.name), 1)
310
+ ]),
311
+ _: 2
312
+ }, 1032, ["disabled", "onClick"]))), 128))
313
+ ], 8, ca),
314
+ y.transfers && y.provider.upload && v.value.length ? (t(), C("div", pa, [
315
+ b(e(We), {
316
+ modelValue: H.value,
317
+ "onUpdate:modelValue": k[2] || (k[2] = (x) => H.value = x),
318
+ variant: "compact",
319
+ disabled: e(n),
320
+ "max-files": 1,
321
+ "max-size": 16 * 1024 ** 3,
322
+ title: u.value.upload,
323
+ onRejected: k[3] || (k[3] = (x) => i.value = { code: "upload_size_required" })
324
+ }, null, 8, ["modelValue", "disabled", "title"]),
325
+ b(e(z), {
326
+ variant: "primary",
327
+ disabled: e(n) || !H.value.length,
328
+ onClick: X
329
+ }, {
330
+ default: s(() => [
331
+ f(l(u.value.upload), 1)
332
+ ]),
333
+ _: 1
334
+ }, 8, ["disabled"])
335
+ ])) : m("", !0),
336
+ P.value ? (t(), C("p", fa, l(u.value.uploaded), 1)) : m("", !0),
337
+ y.transfers && y.provider.download && w.value && !w.value.isDir && !e(i) ? (t(), g(e(z), {
338
+ key: 2,
339
+ variant: "secondary",
340
+ disabled: e(n),
341
+ onClick: Y
342
+ }, {
343
+ default: s(() => [
344
+ f(l(u.value.download), 1)
345
+ ]),
346
+ _: 1
347
+ }, 8, ["disabled"])) : m("", !0),
348
+ e(i) ? (t(), g(e(Q), {
349
+ key: 3,
350
+ tone: "danger"
351
+ }, {
352
+ default: s(() => [
353
+ _("span", ya, l(e(we)(e(i), u.value)), 1)
354
+ ]),
355
+ _: 1
356
+ })) : m("", !0),
357
+ e(n) ? (t(), C("p", ma, l(u.value.loading), 1)) : m("", !0),
358
+ _("div", ba, [
359
+ _("aside", {
360
+ class: "file-tree",
361
+ "aria-label": u.value.roots
362
+ }, [
363
+ h.value.length ? (t(), g(e(Ze), {
364
+ key: E.value,
365
+ modelValue: V.value,
366
+ "onUpdate:modelValue": k[4] || (k[4] = (x) => V.value = x),
367
+ nodes: h.value,
368
+ "onUpdate:nodes": k[5] || (k[5] = (x) => h.value = x),
369
+ expanded: c.value,
370
+ "onUpdate:expanded": k[6] || (k[6] = (x) => c.value = x),
371
+ "load-children": W,
372
+ "expand-label": (x, G) => e(ve)(G ? u.value.collapse : u.value.expand, x.label),
373
+ onSelect: k[7] || (k[7] = (x) => R(K(h.value, x.id) ?? [x.data]))
374
+ }, null, 8, ["modelValue", "nodes", "expanded", "expand-label"])) : m("", !0)
375
+ ], 8, ka),
376
+ _("div", _a, [
377
+ e(i) ? m("", !0) : (t(), g(e(je), {
378
+ key: 0,
379
+ columns: F.value,
380
+ rows: o.value.map((x) => ({ ...x, kind: x.isDir ? u.value.directoryKind : u.value.fileKind })),
381
+ "row-key": "path",
382
+ footer: !1,
383
+ resizable: !1,
384
+ "local-sort": !1,
385
+ "local-pagination": !1,
386
+ loading: e(n),
387
+ "loading-text": u.value.loading,
388
+ sort: { key: S.value.key === "size" ? "bytes" : S.value.key, direction: S.value.direction },
389
+ labels: { empty: u.value.emptyFolder },
390
+ "onUpdate:sort": T
391
+ }, {
392
+ "cell-name": s(({ row: x }) => [
393
+ x.isDir ? (t(), g(e(z), {
394
+ key: 0,
395
+ variant: "secondary",
396
+ disabled: e(n),
397
+ "aria-label": e(ve)(u.value.open, String(x.name)),
398
+ onClick: (G) => O(o.value.find((Z) => Z.path === x.path))
399
+ }, {
400
+ default: s(() => [
401
+ b(e(ge), {
402
+ size: 16,
403
+ "aria-hidden": "true"
404
+ }),
405
+ f(l(x.name), 1)
406
+ ]),
407
+ _: 2
408
+ }, 1032, ["disabled", "aria-label", "onClick"])) : (t(), C("span", ga, [
409
+ b(e(na), {
410
+ size: 16,
411
+ "aria-hidden": "true"
412
+ }),
413
+ f(l(x.name), 1)
414
+ ]))
415
+ ]),
416
+ "cell-bytes": s(({ row: x }) => [
417
+ _("span", ha, l(x.isDir ? "—" : x.bytes ?? "—"), 1)
418
+ ]),
419
+ "cell-selection": s(({ row: x }) => [
420
+ (y.mode === "folder" ? x.isDir : !x.isDir) ? (t(), g(e(z), {
421
+ key: 0,
422
+ variant: "secondary",
423
+ disabled: e(n),
424
+ "aria-pressed": w.value?.path === x.path,
425
+ "aria-label": e(ve)(u.value.select, String(x.name)),
426
+ onClick: (G) => J(o.value.find((Z) => Z.path === x.path))
427
+ }, {
428
+ default: s(() => [
429
+ f(l(u.value.selectAction), 1)
430
+ ]),
431
+ _: 1
432
+ }, 8, ["disabled", "aria-pressed", "aria-label", "onClick"])) : m("", !0)
433
+ ]),
434
+ _: 1
435
+ }, 8, ["columns", "rows", "loading", "loading-text", "sort", "labels"])),
436
+ U.value !== void 0 && !e(i) ? (t(), g(e(z), {
437
+ key: 1,
438
+ variant: "secondary",
439
+ disabled: e(n),
440
+ onClick: k[8] || (k[8] = (x) => R(v.value, !0))
441
+ }, {
442
+ default: s(() => [
443
+ f(l(u.value.loadMore), 1)
444
+ ]),
445
+ _: 1
446
+ }, 8, ["disabled"])) : m("", !0),
447
+ y.mode === "folder" && v.value.length && !e(i) ? (t(), g(e(z), {
448
+ key: 2,
449
+ variant: "secondary",
450
+ disabled: e(n),
451
+ onClick: k[9] || (k[9] = (x) => J(v.value.at(-1)))
452
+ }, {
453
+ default: s(() => [
454
+ f(l(e(ve)(u.value.select, v.value.at(-1).name)), 1)
455
+ ]),
456
+ _: 1
457
+ }, 8, ["disabled"])) : m("", !0)
458
+ ])
459
+ ]),
460
+ w.value && !e(i) ? (t(), C("p", wa, l(e(ve)(u.value.selected, w.value.path)), 1)) : m("", !0)
461
+ ], 8, va));
462
+ }
463
+ }), De = /* @__PURE__ */ ue(Ca, [["__scopeId", "data-v-f1aee828"]]), $a = {
464
+ key: 0,
465
+ class: "save-consent"
466
+ }, xa = ["aria-busy", "inert"], Sa = /* @__PURE__ */ ae({
467
+ __name: "NasPicker",
468
+ props: {
469
+ open: { type: Boolean },
470
+ locale: {},
471
+ provider: {},
472
+ mode: {},
473
+ title: {},
474
+ description: {},
475
+ destination: {}
476
+ },
477
+ emits: ["update:open", "selected", "authorized"],
478
+ setup(y, { emit: D }) {
479
+ const a = y, $ = D, u = p(), r = N(() => oe(a.locale)), n = N(() => Ce(a.locale)), i = p(!1), o = p();
480
+ let h = 0, v = !1;
481
+ Se(() => a.open, () => {
482
+ h++, u.value = void 0, o.value = void 0;
483
+ }), se(() => {
484
+ v = !0, h++;
485
+ });
486
+ function w() {
487
+ i.value || (u.value = void 0, $("update:open", !1));
488
+ }
489
+ async function U() {
490
+ const c = u.value, V = a.destination, S = h;
491
+ if (!(!c || i.value || !a.open || v || V && a.mode !== "folder")) {
492
+ if (!V) {
493
+ $("selected", c), w();
494
+ return;
495
+ }
496
+ i.value = !0, o.value = void 0;
497
+ try {
498
+ const E = await V.selectDestination({ key: V.key, path: c });
499
+ if (v || S !== h) return;
500
+ if (!E || typeof E.id != "string" || !E.id || typeof E.username != "string" || !E.username || E.path !== c || E.key !== V.key || E.lifetime !== "until-revoked") throw { code: "commit-uncertain" };
501
+ $("authorized", E), i.value = !1, w();
502
+ } catch (E) {
503
+ !v && S === h && (o.value = E);
504
+ } finally {
505
+ v || (i.value = !1);
506
+ }
507
+ }
508
+ }
509
+ return (c, V) => (t(), g(e(Ve), {
510
+ open: y.open,
511
+ title: y.title ?? (y.mode === "folder" ? r.value.choose : r.value.chooseFile),
512
+ description: y.description ?? r.value.ownPermissions,
513
+ "close-label": r.value.close,
514
+ "show-close": !i.value,
515
+ width: "800px",
516
+ onEscapeKeyDown: V[1] || (V[1] = (S) => {
517
+ i.value && S.preventDefault();
518
+ }),
519
+ onInteractOutside: V[2] || (V[2] = (S) => {
520
+ i.value && S.preventDefault();
521
+ }),
522
+ "onUpdate:open": V[3] || (V[3] = (S) => {
523
+ S || w();
524
+ })
525
+ }, {
526
+ footer: s(() => [
527
+ b(e(z), {
528
+ variant: "secondary",
529
+ disabled: i.value,
530
+ onClick: w
531
+ }, {
532
+ default: s(() => [
533
+ f(l(r.value.cancel), 1)
534
+ ]),
535
+ _: 1
536
+ }, 8, ["disabled"]),
537
+ b(e(z), {
538
+ variant: "primary",
539
+ disabled: !u.value || i.value || !!y.destination && y.mode !== "folder",
540
+ onClick: U
541
+ }, {
542
+ default: s(() => [
543
+ f(l(r.value.confirm), 1)
544
+ ]),
545
+ _: 1
546
+ }, 8, ["disabled"])
547
+ ]),
548
+ default: s(() => [
549
+ y.destination ? (t(), C("p", $a, l(n.value.selection), 1)) : m("", !0),
550
+ o.value ? (t(), g(e(Q), {
551
+ key: 1,
552
+ tone: "danger",
553
+ role: "alert",
554
+ class: "save-message"
555
+ }, {
556
+ default: s(() => [
557
+ f(l(e(be)(o.value, n.value)), 1)
558
+ ]),
559
+ _: 1
560
+ })) : m("", !0),
561
+ _("div", {
562
+ class: "nas-picker-content",
563
+ "aria-busy": i.value,
564
+ inert: i.value
565
+ }, [
566
+ y.open ? (t(), g(De, {
567
+ key: 0,
568
+ provider: y.provider,
569
+ locale: y.locale,
570
+ mode: y.mode,
571
+ onSelected: V[0] || (V[0] = (S) => u.value = S)
572
+ }, null, 8, ["provider", "locale", "mode"])) : m("", !0)
573
+ ], 8, xa)
574
+ ]),
575
+ _: 1
576
+ }, 8, ["open", "title", "description", "close-label", "show-close"]));
577
+ }
578
+ }), ye = /* @__PURE__ */ ue(Sa, [["__scopeId", "data-v-535a0e54"]]), za = { role: "alert" }, Va = { class: "files-actions" }, Pa = {
579
+ key: 0,
580
+ class: "files-path",
581
+ role: "status"
582
+ }, Ua = /* @__PURE__ */ ae({
583
+ __name: "FilesPage",
584
+ props: {
585
+ ctx: {}
586
+ },
587
+ setup(y) {
588
+ const D = y, a = p(), $ = p(!1), u = p("folder"), r = p(!1), n = p(""), i = p(0), o = $e(D.ctx);
589
+ let h = !1, v;
590
+ async function w() {
591
+ if (!h) {
592
+ a.value = void 0, $.value = !1, n.value = "", r.value = !1, i.value++;
593
+ try {
594
+ await D.ctx.call("nas.session.status"), h || ($.value = !0);
595
+ } catch (U) {
596
+ !h && U?.code !== "unknown_method" && (a.value = U);
597
+ }
598
+ }
599
+ }
600
+ return ie(() => {
601
+ v = D.ctx.reopen(() => {
602
+ w();
603
+ }), w();
604
+ }), se(() => {
605
+ h = !0, v?.(), o.dispose();
606
+ }), (U, c) => (t(), C(j, null, [
607
+ a.value ? (t(), g(e(Q), {
608
+ key: 0,
609
+ tone: "danger"
610
+ }, {
611
+ default: s(() => [
612
+ _("span", za, l(e(we)(a.value, e(oe)(y.ctx.locale))), 1),
613
+ b(e(z), {
614
+ variant: "secondary",
615
+ onClick: w
616
+ }, {
617
+ default: s(() => [
618
+ f(l(e(oe)(y.ctx.locale).refresh), 1)
619
+ ]),
620
+ _: 1
621
+ })
622
+ ]),
623
+ _: 1
624
+ })) : m("", !0),
625
+ $.value ? (t(), g(e(de), {
626
+ key: 1,
627
+ title: e(oe)(y.ctx.locale).title,
628
+ collapsible: !1
629
+ }, {
630
+ default: s(() => [
631
+ _("div", Va, [
632
+ b(e(z), {
633
+ variant: "secondary",
634
+ onClick: c[0] || (c[0] = (V) => {
635
+ u.value = "folder", r.value = !0;
636
+ })
637
+ }, {
638
+ default: s(() => [
639
+ f(l(e(oe)(y.ctx.locale).choose), 1)
640
+ ]),
641
+ _: 1
642
+ }),
643
+ b(e(z), {
644
+ variant: "secondary",
645
+ onClick: c[1] || (c[1] = (V) => {
646
+ u.value = "file", r.value = !0;
647
+ })
648
+ }, {
649
+ default: s(() => [
650
+ f(l(e(oe)(y.ctx.locale).chooseFile), 1)
651
+ ]),
652
+ _: 1
653
+ })
654
+ ]),
655
+ n.value ? (t(), C("p", Pa, l(n.value), 1)) : m("", !0),
656
+ (t(), g(De, {
657
+ key: i.value,
658
+ provider: e(o),
659
+ locale: y.ctx.locale,
660
+ transfers: ""
661
+ }, null, 8, ["provider", "locale"])),
662
+ b(ye, {
663
+ provider: e(o),
664
+ locale: y.ctx.locale,
665
+ mode: u.value,
666
+ open: r.value,
667
+ "onUpdate:open": c[2] || (c[2] = (V) => r.value = V),
668
+ onSelected: c[3] || (c[3] = (V) => n.value = V)
669
+ }, null, 8, ["provider", "locale", "mode", "open"])
670
+ ]),
671
+ _: 1
672
+ }, 8, ["title"])) : m("", !0)
673
+ ], 64));
674
+ }
675
+ }), ut = /* @__PURE__ */ ue(Ua, [["__scopeId", "data-v-97bc5d15"]]), Da = { key: 0 }, Aa = { key: 0 }, Ea = { key: 3 }, Ta = { role: "alert" }, Ia = 5e3, it = /* @__PURE__ */ ae({
676
+ __name: "PortalSettings",
677
+ props: {
678
+ portal: {}
679
+ },
680
+ setup(y) {
681
+ const D = y, a = D.portal.messages, $ = p(), u = p(""), r = p(!1), n = p("");
682
+ let i = !1;
683
+ function o(w) {
684
+ i || ($.value = w, u.value = w.alias || w.defaultAlias);
685
+ }
686
+ const h = /* @__PURE__ */ Symbol("late");
687
+ async function v(w) {
688
+ if (r.value) return;
689
+ r.value = !0, n.value = "";
690
+ const U = w();
691
+ try {
692
+ const c = await Promise.race([U, new Promise((V) => setTimeout(() => V(h), Ia))]);
693
+ if (c !== h) {
694
+ o(c);
695
+ return;
696
+ }
697
+ U.then(o, () => {
698
+ }), o(await D.portal.status());
699
+ } catch (c) {
700
+ i || (n.value = a[c?.code || ""] || a.portal_unavailable);
701
+ } finally {
702
+ i || (r.value = !1);
703
+ }
704
+ }
705
+ return ie(() => {
706
+ D.portal.status().then(o);
707
+ }), se(() => {
708
+ i = !0;
709
+ }), (w, U) => $.value ? (t(), g(e(de), {
710
+ key: 0,
711
+ title: e(a).title,
712
+ collapsible: !1,
713
+ "aria-busy": r.value
714
+ }, {
715
+ default: s(() => [
716
+ $.value.state === "active" ? (t(), C("p", Da, [
717
+ f(l(e(a).link) + " ", 1),
718
+ b(e(Pe), {
719
+ href: $.value.url,
720
+ external: ""
721
+ }, {
722
+ default: s(() => [
723
+ f(l($.value.url), 1)
724
+ ]),
725
+ _: 1
726
+ }, 8, ["href"])
727
+ ])) : m("", !0),
728
+ $.value.canManage ? (t(), C(j, { key: 1 }, [
729
+ $.value.state !== "active" ? (t(), C("p", Aa, l(e(a).inactive), 1)) : m("", !0),
730
+ b(e(pe), {
731
+ onSubmit: U[2] || (U[2] = ce((c) => v(() => y.portal.apply(u.value)), ["prevent"]))
732
+ }, {
733
+ default: s(() => [
734
+ b(e(ne), {
735
+ label: e(a).alias,
736
+ "label-for": "portal-alias"
737
+ }, {
738
+ default: s(() => [
739
+ b(e(re), {
740
+ id: "portal-alias",
741
+ modelValue: u.value,
742
+ "onUpdate:modelValue": U[0] || (U[0] = (c) => u.value = c),
743
+ maxlength: "64",
744
+ autocomplete: "off",
745
+ disabled: r.value
746
+ }, null, 8, ["modelValue", "disabled"])
747
+ ]),
748
+ _: 1
749
+ }, 8, ["label"]),
750
+ b(e(fe), null, {
751
+ default: s(() => [
752
+ b(e(z), {
753
+ type: "submit",
754
+ variant: "primary",
755
+ disabled: r.value
756
+ }, {
757
+ default: s(() => [
758
+ f(l(e(a).apply), 1)
759
+ ]),
760
+ _: 1
761
+ }, 8, ["disabled"]),
762
+ $.value.state === "active" ? (t(), g(e(z), {
763
+ key: 0,
764
+ variant: "secondary",
765
+ disabled: r.value,
766
+ onClick: U[1] || (U[1] = (c) => v(() => y.portal.disable()))
767
+ }, {
768
+ default: s(() => [
769
+ f(l(e(a).disable), 1)
770
+ ]),
771
+ _: 1
772
+ }, 8, ["disabled"])) : m("", !0)
773
+ ]),
774
+ _: 1
775
+ })
776
+ ]),
777
+ _: 1
778
+ }),
779
+ b(e(z), {
780
+ variant: "secondary",
781
+ onClick: U[3] || (U[3] = (c) => y.portal.openControlPanel())
782
+ }, {
783
+ default: s(() => [
784
+ f(l(e(a).advanced), 1)
785
+ ]),
786
+ _: 1
787
+ })
788
+ ], 64)) : $.value.controlPanel ? (t(), g(e(z), {
789
+ key: 2,
790
+ variant: "secondary",
791
+ onClick: U[4] || (U[4] = (c) => y.portal.openControlPanel())
792
+ }, {
793
+ default: s(() => [
794
+ f(l(e(a).controlPanel), 1)
795
+ ]),
796
+ _: 1
797
+ })) : $.value.state !== "active" ? (t(), C("p", Ea, l(e(a).askAdmin), 1)) : m("", !0),
798
+ n.value ? (t(), g(e(Q), {
799
+ key: 4,
800
+ tone: "danger"
801
+ }, {
802
+ default: s(() => [
803
+ _("span", Ta, l(n.value), 1)
804
+ ]),
805
+ _: 1
806
+ })) : m("", !0)
807
+ ]),
808
+ _: 1
809
+ }, 8, ["title", "aria-busy"])) : m("", !0);
810
+ }
811
+ }), Oa = ["aria-busy"], Ra = {
812
+ key: 1,
813
+ role: "status"
814
+ }, qa = { role: "alert" }, La = { role: "status" }, Ba = /* @__PURE__ */ ae({
815
+ __name: "LoginPage",
816
+ props: {
817
+ session: {},
818
+ locale: {}
819
+ },
820
+ setup(y) {
821
+ const D = y, a = N(() => Re(D.locale)), $ = p(""), u = p(""), r = p(""), n = p(!1), i = p(!1), o = p(""), h = p(), v = N(() => window.location.protocol === "https:");
822
+ let w = !1;
823
+ function U(E) {
824
+ const H = E?.code;
825
+ return a.value.errors[H || ""] || a.value.errors.failed;
826
+ }
827
+ async function c() {
828
+ if (!(i.value || !v.value || !$.value || !u.value || n.value && !r.value)) {
829
+ i.value = !0, o.value = "";
830
+ try {
831
+ await D.session.login($.value, u.value, r.value), u.value = "", r.value = "";
832
+ } catch (E) {
833
+ if (w) return;
834
+ r.value = "", E?.code === "otp_required" ? n.value = !0 : (o.value = U(E), u.value = "", n.value = !1);
835
+ } finally {
836
+ w || (i.value = !1, n.value && (await Ke(), w || h.value?.querySelector("input")?.focus()));
837
+ }
838
+ }
839
+ }
840
+ async function V() {
841
+ if (!i.value) {
842
+ i.value = !0, o.value = "";
843
+ try {
844
+ await D.session.bootstrap();
845
+ } catch (E) {
846
+ w || (o.value = U(E));
847
+ } finally {
848
+ w || (i.value = !1);
849
+ }
850
+ }
851
+ }
852
+ function S() {
853
+ u.value = "", r.value = "", n.value = !1, o.value = "";
854
+ }
855
+ return ze(() => {
856
+ w = !0, u.value = "", r.value = "";
857
+ }), (E, H) => (t(), C("main", {
858
+ class: "identity-login",
859
+ "aria-busy": i.value
860
+ }, [
861
+ b(e(de), {
862
+ title: a.value.title,
863
+ collapsible: !1
864
+ }, {
865
+ default: s(() => [
866
+ _("p", null, l(a.value.intro), 1),
867
+ v.value ? m("", !0) : (t(), g(e(Q), {
868
+ key: 0,
869
+ tone: "warning",
870
+ title: a.value.httpsTitle
871
+ }, {
872
+ default: s(() => [
873
+ f(l(a.value.errors.https_required), 1)
874
+ ]),
875
+ _: 1
876
+ }, 8, ["title"])),
877
+ y.session.notice.value ? (t(), C("p", Ra, l(a.value.notices[y.session.notice.value]), 1)) : m("", !0),
878
+ o.value ? (t(), g(e(Q), {
879
+ key: 2,
880
+ tone: "danger",
881
+ title: a.value.failedTitle
882
+ }, {
883
+ default: s(() => [
884
+ _("span", qa, l(o.value), 1)
885
+ ]),
886
+ _: 1
887
+ }, 8, ["title"])) : m("", !0),
888
+ b(e(pe), {
889
+ onSubmit: ce(c, ["prevent"])
890
+ }, {
891
+ default: s(() => [
892
+ b(e(ne), {
893
+ label: a.value.account
894
+ }, {
895
+ default: s(() => [
896
+ b(e(re), {
897
+ modelValue: $.value,
898
+ "onUpdate:modelValue": H[0] || (H[0] = (P) => $.value = P),
899
+ autocomplete: "username",
900
+ disabled: i.value || n.value || !v.value
901
+ }, null, 8, ["modelValue", "disabled"])
902
+ ]),
903
+ _: 1
904
+ }, 8, ["label"]),
905
+ n.value ? (t(), C(j, { key: 1 }, [
906
+ _("p", La, l(a.value.otpPrompt), 1),
907
+ _("div", {
908
+ ref_key: "otpField",
909
+ ref: h
910
+ }, [
911
+ b(e(ne), {
912
+ label: a.value.otp
913
+ }, {
914
+ default: s(() => [
915
+ b(e(re), {
916
+ modelValue: r.value,
917
+ "onUpdate:modelValue": H[2] || (H[2] = (P) => r.value = P),
918
+ inputmode: "numeric",
919
+ autocomplete: "one-time-code",
920
+ disabled: i.value
921
+ }, null, 8, ["modelValue", "disabled"])
922
+ ]),
923
+ _: 1
924
+ }, 8, ["label"])
925
+ ], 512)
926
+ ], 64)) : (t(), g(e(ne), {
927
+ key: 0,
928
+ label: a.value.password
929
+ }, {
930
+ default: s(() => [
931
+ b(e(re), {
932
+ modelValue: u.value,
933
+ "onUpdate:modelValue": H[1] || (H[1] = (P) => u.value = P),
934
+ type: "password",
935
+ autocomplete: "current-password",
936
+ disabled: i.value || !v.value
937
+ }, null, 8, ["modelValue", "disabled"])
938
+ ]),
939
+ _: 1
940
+ }, 8, ["label"])),
941
+ b(e(fe), null, {
942
+ default: s(() => [
943
+ b(e(z), {
944
+ type: "submit",
945
+ variant: "primary",
946
+ disabled: i.value || !v.value || !$.value || !u.value || n.value && !r.value
947
+ }, {
948
+ default: s(() => [
949
+ f(l(i.value ? a.value.signingIn : n.value ? a.value.verify : a.value.signIn), 1)
950
+ ]),
951
+ _: 1
952
+ }, 8, ["disabled"]),
953
+ n.value ? (t(), g(e(z), {
954
+ key: 0,
955
+ variant: "secondary",
956
+ disabled: i.value,
957
+ onClick: S
958
+ }, {
959
+ default: s(() => [
960
+ f(l(a.value.otherAccount), 1)
961
+ ]),
962
+ _: 1
963
+ }, 8, ["disabled"])) : (t(), g(e(z), {
964
+ key: 1,
965
+ variant: "secondary",
966
+ disabled: i.value || !v.value,
967
+ onClick: V
968
+ }, {
969
+ default: s(() => [
970
+ f(l(a.value.continueDSM), 1)
971
+ ]),
972
+ _: 1
973
+ }, 8, ["disabled"]))
974
+ ]),
975
+ _: 1
976
+ })
977
+ ]),
978
+ _: 1
979
+ })
980
+ ]),
981
+ _: 1
982
+ }, 8, ["title"])
983
+ ], 8, Oa));
984
+ }
985
+ }), ot = /* @__PURE__ */ ue(Ba, [["__scopeId", "data-v-f7afcf5e"]]), Fa = { class: "integration-help" }, Na = { role: "status" }, Ma = { class: "integration-help" }, Ha = { class: "integration-help" }, Ka = { class: "integration-help" }, Ja = { class: "integration-actions" }, Xa = { class: "integration-actions" }, Ga = {
986
+ key: 0,
987
+ role: "status",
988
+ "data-bg-picked": ""
989
+ }, Qa = { class: "integration-actions" }, Ya = { key: 1 }, Wa = {
990
+ key: 2,
991
+ class: "integration-jobs"
992
+ }, Za = ["data-job-state", "data-job-id"], ja = { class: "nas-folder-name" }, el = {
993
+ key: 0,
994
+ class: "integration-help"
995
+ }, al = {
996
+ key: 4,
997
+ class: "integration-help"
998
+ }, ll = ["aria-label"], tl = { class: "integration-help" }, nl = { key: 1 }, sl = {
999
+ key: 2,
1000
+ class: "integration-jobs"
1001
+ }, ul = ["data-schedule-id"], il = { class: "nas-folder-name" }, ol = {
1002
+ key: 0,
1003
+ class: "integration-help"
1004
+ }, rl = {
1005
+ key: 1,
1006
+ class: "integration-help"
1007
+ }, dl = { class: "integration-help" }, vl = { class: "integration-actions" }, cl = { class: "integration-actions" }, pl = { class: "integration-actions" }, fl = /* @__PURE__ */ ae({
1008
+ __name: "BackgroundPanel",
1009
+ props: {
1010
+ ctx: {}
1011
+ },
1012
+ setup(y) {
1013
+ const D = y, a = N(() => qe(D.ctx.locale)), $ = (I, B) => I.replace(/\{(\w+)\}/g, (A, le) => String(B[le] ?? "")), u = p(), r = p([]), n = p(), i = p(!1), o = p(!1), h = p([]), v = p(), w = p(!1), U = p("3600"), c = p(), V = p(), S = p(), E = p(!1), H = p(!1), P = p(), q = p(""), Y = p(""), X = Le(D.ctx);
1014
+ let F, L = !1;
1015
+ const J = (I) => !["queued", "running"].includes(I.state);
1016
+ async function K(I, B) {
1017
+ try {
1018
+ return await D.ctx.call(I, B);
1019
+ } catch (A) {
1020
+ if (L) return;
1021
+ A?.code === "unsupported" ? (i.value = !0, r.value = [], h.value = [], v.value = void 0, c.value = void 0, V.value = void 0, u.value = void 0, S.value = void 0, P.value = void 0, q.value && URL.revokeObjectURL(q.value), q.value = "") : L || (n.value = A);
1022
+ return;
1023
+ }
1024
+ }
1025
+ async function W() {
1026
+ if (!(L || E.value)) {
1027
+ E.value = !0;
1028
+ try {
1029
+ const I = await K("bg.status");
1030
+ if (!I || L) return;
1031
+ if (!I.limits || typeof I.admin != "boolean") {
1032
+ n.value = { code: "unavailable" };
1033
+ return;
1034
+ }
1035
+ i.value = !1, u.value = I;
1036
+ const B = await K("bg.jobs.list");
1037
+ B && !L && (r.value = B.jobs ?? []);
1038
+ const A = await K("bg.schedules.list");
1039
+ A && !L && (h.value = A.schedules ?? []), !L && r.value.every(J) && h.value.every((le) => !le.enabled) && F && (clearInterval(F), F = void 0);
1040
+ } finally {
1041
+ E.value = !1;
1042
+ }
1043
+ }
1044
+ }
1045
+ function R() {
1046
+ F || (F = setInterval(() => {
1047
+ W();
1048
+ }, 3e3));
1049
+ }
1050
+ async function O(I) {
1051
+ if (!o.value) {
1052
+ o.value = !0, n.value = void 0;
1053
+ try {
1054
+ await I(), await W(), (h.value.some((B) => B.enabled) || r.value.some((B) => !J(B))) && R();
1055
+ } finally {
1056
+ L || (o.value = !1);
1057
+ }
1058
+ }
1059
+ }
1060
+ const T = () => O(async () => {
1061
+ if (!S.value) return;
1062
+ await K("bg.jobs.purge", { owner: S.value }) && (S.value = void 0);
1063
+ }), M = N(() => [{ value: "3600", label: a.value.hourly }, { value: "86400", label: a.value.daily }, { value: "604800", label: a.value.weekly }]), d = (I) => {
1064
+ v.value = I, w.value = !1, U.value = "3600";
1065
+ }, k = () => O(async () => {
1066
+ if (!v.value || !w.value) return;
1067
+ await K("bg.schedules.create", { key: _e(), jobId: v.value.id, intervalSeconds: Number(U.value), consent: !0 }) && (v.value = void 0);
1068
+ }), x = (I) => O(() => K("bg.schedules.disable", { id: I })), G = () => O(async () => {
1069
+ if (!c.value) return;
1070
+ await K("bg.schedules.delete", { id: c.value.id }) && (c.value = void 0);
1071
+ }), Z = () => O(async () => {
1072
+ if (!V.value) return;
1073
+ await K("bg.schedules.enable", { id: V.value.id, consent: !0 }) && (V.value = void 0);
1074
+ }), ee = (I) => {
1075
+ const B = new Date(I);
1076
+ return Number.isFinite(B.getTime()) ? B.toLocaleString() : a.value.unknownTime;
1077
+ }, me = (I) => I.copyRetained && I.state === "succeeded" && !I.scheduleId && I.submitter?.user === u.value?.owner?.user && I.submitter?.uid === u.value?.owner?.uid, Ae = (I) => O(() => K("bg.jobs.cancel", { id: I })), Ee = (I) => {
1078
+ const B = I.lastIndexOf("/");
1079
+ P.value = { folder: I.slice(0, B), relative: I.slice(B + 1) };
1080
+ }, Te = () => O(async () => {
1081
+ if (!P.value) return;
1082
+ await K("bg.jobs.submit", { key: _e(), ...P.value }) && (P.value = void 0);
1083
+ });
1084
+ async function Ie(I) {
1085
+ const B = await K("bg.jobs.result", { id: I.id });
1086
+ !B || L || (q.value && URL.revokeObjectURL(q.value), q.value = URL.createObjectURL(new Blob([JSON.stringify(B.result, null, 2)], { type: "application/json" })), Y.value = `${I.name || I.id}.sha256.json`);
1087
+ }
1088
+ return ie(() => {
1089
+ W().then(() => {
1090
+ (h.value.some((I) => I.enabled) || r.value.some((I) => !J(I))) && R();
1091
+ });
1092
+ }), se(() => {
1093
+ L = !0, X.dispose(), F && clearInterval(F), q.value && URL.revokeObjectURL(q.value);
1094
+ }), (I, B) => (t(), g(e(de), {
1095
+ "aria-busy": o.value || E.value,
1096
+ title: a.value.title,
1097
+ collapsible: !1,
1098
+ "data-background-panel": ""
1099
+ }, {
1100
+ default: s(() => [
1101
+ i.value ? (t(), g(e(Q), {
1102
+ key: 0,
1103
+ tone: "warning"
1104
+ }, {
1105
+ default: s(() => [
1106
+ f(l(a.value.unsupported), 1)
1107
+ ]),
1108
+ _: 1
1109
+ })) : (t(), C(j, { key: 1 }, [
1110
+ _("p", Fa, l(a.value.help), 1),
1111
+ n.value ? (t(), g(e(Q), {
1112
+ key: 0,
1113
+ tone: "danger",
1114
+ role: "alert"
1115
+ }, {
1116
+ default: s(() => [
1117
+ f(l(e(Be)(n.value, a.value)), 1)
1118
+ ]),
1119
+ _: 1
1120
+ })) : m("", !0),
1121
+ u.value ? (t(), C(j, { key: 1 }, [
1122
+ _("p", Na, l(u.value.worker?.alive ? $(a.value.workerRunning, { user: u.value.worker.username }) : a.value.workerStopped), 1),
1123
+ _("p", Ma, l($(a.value.limits, { size: u.value.limits.maxInputBytes / 1024, queue: u.value.limits.maxQueued, seconds: u.value.limits.jobTimeoutSeconds })), 1),
1124
+ _("p", Ha, l(u.value.admin ? a.value.adminScope : a.value.ownerScope), 1),
1125
+ _("p", Ka, l($(a.value.ownerLimits, { jobs: u.value.limits.maxOwnerPending, size: u.value.limits.maxOwnerBytes / 1024 })), 1),
1126
+ _("div", Ja, [
1127
+ b(e(z), {
1128
+ variant: "secondary",
1129
+ disabled: o.value,
1130
+ onClick: W
1131
+ }, {
1132
+ default: s(() => [
1133
+ f(l(a.value.refresh), 1)
1134
+ ]),
1135
+ _: 1
1136
+ }, 8, ["disabled"])
1137
+ ]),
1138
+ _("template", null, [
1139
+ _("div", Xa, [
1140
+ b(e(z), {
1141
+ variant: "secondary",
1142
+ disabled: o.value,
1143
+ onClick: B[0] || (B[0] = (A) => H.value = !0)
1144
+ }, {
1145
+ default: s(() => [
1146
+ f(l(a.value.chooseFile), 1)
1147
+ ]),
1148
+ _: 1
1149
+ }, 8, ["disabled"]),
1150
+ b(e(z), {
1151
+ variant: "primary",
1152
+ disabled: o.value || !P.value,
1153
+ onClick: Te
1154
+ }, {
1155
+ default: s(() => [
1156
+ f(l(a.value.submit), 1)
1157
+ ]),
1158
+ _: 1
1159
+ }, 8, ["disabled"])
1160
+ ]),
1161
+ P.value ? (t(), C("p", Ga, l($(a.value.chosen, { path: `${P.value.folder}/${P.value.relative}` })), 1)) : m("", !0),
1162
+ b(ye, {
1163
+ open: H.value,
1164
+ "onUpdate:open": B[1] || (B[1] = (A) => H.value = A),
1165
+ locale: y.ctx.locale,
1166
+ provider: e(X),
1167
+ mode: "file",
1168
+ title: a.value.pickerTitle,
1169
+ description: a.value.pickerConsent,
1170
+ onSelected: Ee
1171
+ }, null, 8, ["open", "locale", "provider", "title", "description"])
1172
+ ]),
1173
+ S.value && u.value.admin ? (t(), g(e(Q), {
1174
+ key: 0,
1175
+ tone: "warning"
1176
+ }, {
1177
+ default: s(() => [
1178
+ _("p", null, l($(a.value.purgeConfirm, { user: S.value.user, uid: S.value.uid })), 1),
1179
+ _("div", Qa, [
1180
+ b(e(z), {
1181
+ variant: "secondary",
1182
+ disabled: o.value,
1183
+ onClick: T
1184
+ }, {
1185
+ default: s(() => [
1186
+ f(l(a.value.confirmPurge), 1)
1187
+ ]),
1188
+ _: 1
1189
+ }, 8, ["disabled"]),
1190
+ b(e(z), {
1191
+ variant: "secondary",
1192
+ disabled: o.value,
1193
+ onClick: B[2] || (B[2] = (A) => S.value = void 0)
1194
+ }, {
1195
+ default: s(() => [
1196
+ f(l(a.value.keepJobs), 1)
1197
+ ]),
1198
+ _: 1
1199
+ }, 8, ["disabled"])
1200
+ ])
1201
+ ]),
1202
+ _: 1
1203
+ })) : m("", !0),
1204
+ r.value.length ? (t(), C("ul", Wa, [
1205
+ (t(!0), C(j, null, te(r.value, (A) => (t(), C("li", {
1206
+ key: A.id,
1207
+ "data-job-state": A.state,
1208
+ "data-job-id": A.id
1209
+ }, [
1210
+ _("span", ja, l(A.name) + " — " + l(a.value[`state_${A.state}`]), 1),
1211
+ u.value.admin && A.submitter ? (t(), C("span", el, l($(a.value.owner, { user: A.submitter.user, uid: A.submitter.uid })), 1)) : m("", !0),
1212
+ u.value.admin && A.submitter ? (t(), g(e(z), {
1213
+ key: 1,
1214
+ variant: "secondary",
1215
+ disabled: o.value,
1216
+ onClick: (le) => S.value = A.submitter
1217
+ }, {
1218
+ default: s(() => [
1219
+ f(l(a.value.purgeOwner), 1)
1220
+ ]),
1221
+ _: 1
1222
+ }, 8, ["disabled", "onClick"])) : m("", !0),
1223
+ J(A) ? m("", !0) : (t(), g(e(z), {
1224
+ key: 2,
1225
+ variant: "secondary",
1226
+ disabled: o.value,
1227
+ onClick: (le) => Ae(A.id)
1228
+ }, {
1229
+ default: s(() => [
1230
+ f(l(a.value.cancel), 1)
1231
+ ]),
1232
+ _: 1
1233
+ }, 8, ["disabled", "onClick"])),
1234
+ me(A) ? (t(), g(e(z), {
1235
+ key: 3,
1236
+ variant: "secondary",
1237
+ disabled: o.value,
1238
+ onClick: (le) => d(A)
1239
+ }, {
1240
+ default: s(() => [
1241
+ f(l(a.value.scheduleCopy), 1)
1242
+ ]),
1243
+ _: 1
1244
+ }, 8, ["disabled", "onClick"])) : m("", !0),
1245
+ A.scheduleId ? (t(), C("span", al, l(a.value.scheduledJob), 1)) : m("", !0),
1246
+ A.state === "succeeded" ? (t(), g(e(z), {
1247
+ key: 5,
1248
+ variant: "secondary",
1249
+ disabled: o.value,
1250
+ onClick: (le) => Ie(A)
1251
+ }, {
1252
+ default: s(() => [
1253
+ f(l(a.value.result), 1)
1254
+ ]),
1255
+ _: 1
1256
+ }, 8, ["disabled", "onClick"])) : m("", !0)
1257
+ ], 8, Za))), 128))
1258
+ ])) : (t(), C("p", Ya, l(a.value.noJobs), 1)),
1259
+ _("section", {
1260
+ "data-bg-schedules": "",
1261
+ class: "bg-schedules",
1262
+ "aria-label": a.value.schedulesTitle
1263
+ }, [
1264
+ _("h3", null, l(a.value.schedulesTitle), 1),
1265
+ _("p", tl, l(a.value.scheduleHelp), 1),
1266
+ v.value ? (t(), g(e(pe), {
1267
+ key: 0,
1268
+ class: "bg-schedule-form",
1269
+ onSubmit: ce(k, ["prevent"])
1270
+ }, {
1271
+ default: s(() => [
1272
+ _("p", null, l($(a.value.scheduleSource, { name: v.value.name })), 1),
1273
+ b(e(ne), {
1274
+ label: a.value.interval
1275
+ }, {
1276
+ default: s(() => [
1277
+ b(e(Ue), {
1278
+ modelValue: U.value,
1279
+ "onUpdate:modelValue": B[3] || (B[3] = (A) => U.value = A),
1280
+ "data-schedule-interval": "",
1281
+ options: M.value,
1282
+ disabled: o.value
1283
+ }, null, 8, ["modelValue", "options", "disabled"])
1284
+ ]),
1285
+ _: 1
1286
+ }, 8, ["label"]),
1287
+ b(e(ea), {
1288
+ modelValue: w.value,
1289
+ "onUpdate:modelValue": B[4] || (B[4] = (A) => w.value = A),
1290
+ "data-schedule-consent": "",
1291
+ disabled: o.value,
1292
+ label: a.value.scheduleConsent
1293
+ }, null, 8, ["modelValue", "disabled", "label"]),
1294
+ b(e(fe), null, {
1295
+ default: s(() => [
1296
+ b(e(z), {
1297
+ type: "submit",
1298
+ variant: "primary",
1299
+ disabled: o.value || !w.value
1300
+ }, {
1301
+ default: s(() => [
1302
+ f(l(a.value.createSchedule), 1)
1303
+ ]),
1304
+ _: 1
1305
+ }, 8, ["disabled"]),
1306
+ b(e(z), {
1307
+ type: "button",
1308
+ variant: "secondary",
1309
+ disabled: o.value,
1310
+ onClick: B[5] || (B[5] = (A) => v.value = void 0)
1311
+ }, {
1312
+ default: s(() => [
1313
+ f(l(a.value.cancel), 1)
1314
+ ]),
1315
+ _: 1
1316
+ }, 8, ["disabled"])
1317
+ ]),
1318
+ _: 1
1319
+ })
1320
+ ]),
1321
+ _: 1
1322
+ })) : m("", !0),
1323
+ h.value.length ? (t(), C("ul", sl, [
1324
+ (t(!0), C(j, null, te(h.value, (A) => (t(), C("li", {
1325
+ key: A.id,
1326
+ "data-schedule-id": A.id
1327
+ }, [
1328
+ _("span", il, l(A.name) + " — " + l(A.enabled ? a.value.scheduleOn : a.value.scheduleOff), 1),
1329
+ u.value.admin ? (t(), C("span", ol, l($(a.value.owner, { user: A.owner.user, uid: A.owner.uid })), 1)) : m("", !0),
1330
+ A.enabled ? (t(), C("span", rl, l($(a.value.nextRun, { time: ee(A.nextAt) })), 1)) : m("", !0),
1331
+ _("span", dl, l($(a.value.missedRuns, { count: A.missed })), 1),
1332
+ A.reason === "worker-changed" ? (t(), g(e(Q), {
1333
+ key: 2,
1334
+ tone: "warning"
1335
+ }, {
1336
+ default: s(() => [
1337
+ f(l(a.value.revisionChanged), 1)
1338
+ ]),
1339
+ _: 1
1340
+ })) : A.reason === "input-unavailable" ? (t(), g(e(Q), {
1341
+ key: 3,
1342
+ tone: "warning"
1343
+ }, {
1344
+ default: s(() => [
1345
+ f(l(a.value.errors["input-unavailable"]), 1)
1346
+ ]),
1347
+ _: 1
1348
+ })) : m("", !0),
1349
+ _("div", vl, [
1350
+ A.enabled ? (t(), g(e(z), {
1351
+ key: 0,
1352
+ variant: "secondary",
1353
+ disabled: o.value,
1354
+ onClick: (le) => x(A.id)
1355
+ }, {
1356
+ default: s(() => [
1357
+ f(l(a.value.disableSchedule), 1)
1358
+ ]),
1359
+ _: 1
1360
+ }, 8, ["disabled", "onClick"])) : u.value.admin ? (t(), g(e(z), {
1361
+ key: 1,
1362
+ variant: "secondary",
1363
+ disabled: o.value,
1364
+ onClick: (le) => V.value = A
1365
+ }, {
1366
+ default: s(() => [
1367
+ f(l(a.value.enableSchedule), 1)
1368
+ ]),
1369
+ _: 1
1370
+ }, 8, ["disabled", "onClick"])) : m("", !0),
1371
+ b(e(z), {
1372
+ variant: "secondary",
1373
+ disabled: o.value,
1374
+ onClick: (le) => c.value = A
1375
+ }, {
1376
+ default: s(() => [
1377
+ f(l(a.value.deleteSchedule), 1)
1378
+ ]),
1379
+ _: 1
1380
+ }, 8, ["disabled", "onClick"])
1381
+ ])
1382
+ ], 8, ul))), 128))
1383
+ ])) : (t(), C("p", nl, l(a.value.noSchedules), 1)),
1384
+ c.value ? (t(), g(e(Q), {
1385
+ key: 3,
1386
+ tone: "warning"
1387
+ }, {
1388
+ default: s(() => [
1389
+ _("p", null, l($(a.value.deleteScheduleConsent, { name: c.value.name })), 1),
1390
+ _("div", cl, [
1391
+ b(e(z), {
1392
+ variant: "danger",
1393
+ disabled: o.value,
1394
+ onClick: G
1395
+ }, {
1396
+ default: s(() => [
1397
+ f(l(a.value.confirmDeleteSchedule), 1)
1398
+ ]),
1399
+ _: 1
1400
+ }, 8, ["disabled"]),
1401
+ b(e(z), {
1402
+ variant: "secondary",
1403
+ disabled: o.value,
1404
+ onClick: B[6] || (B[6] = (A) => c.value = void 0)
1405
+ }, {
1406
+ default: s(() => [
1407
+ f(l(a.value.cancel), 1)
1408
+ ]),
1409
+ _: 1
1410
+ }, 8, ["disabled"])
1411
+ ])
1412
+ ]),
1413
+ _: 1
1414
+ })) : m("", !0),
1415
+ V.value ? (t(), g(e(Q), {
1416
+ key: 4,
1417
+ tone: "warning"
1418
+ }, {
1419
+ default: s(() => [
1420
+ _("p", null, l($(a.value.enableScheduleConsent, { name: V.value.name })), 1),
1421
+ _("div", pl, [
1422
+ b(e(z), {
1423
+ variant: "primary",
1424
+ disabled: o.value,
1425
+ onClick: Z
1426
+ }, {
1427
+ default: s(() => [
1428
+ f(l(a.value.confirmEnableSchedule), 1)
1429
+ ]),
1430
+ _: 1
1431
+ }, 8, ["disabled"]),
1432
+ b(e(z), {
1433
+ variant: "secondary",
1434
+ disabled: o.value,
1435
+ onClick: B[7] || (B[7] = (A) => V.value = void 0)
1436
+ }, {
1437
+ default: s(() => [
1438
+ f(l(a.value.cancel), 1)
1439
+ ]),
1440
+ _: 1
1441
+ }, 8, ["disabled"])
1442
+ ])
1443
+ ]),
1444
+ _: 1
1445
+ })) : m("", !0)
1446
+ ], 8, ll),
1447
+ q.value ? (t(), g(e(Pe), {
1448
+ key: 3,
1449
+ href: q.value,
1450
+ download: Y.value
1451
+ }, {
1452
+ default: s(() => [
1453
+ f(l(a.value.download), 1)
1454
+ ]),
1455
+ _: 1
1456
+ }, 8, ["href", "download"])) : m("", !0)
1457
+ ], 64)) : m("", !0)
1458
+ ], 64))
1459
+ ]),
1460
+ _: 1
1461
+ }, 8, ["aria-busy", "title"]));
1462
+ }
1463
+ }), rt = /* @__PURE__ */ ue(fl, [["__scopeId", "data-v-7954713f"]]), yl = { role: "status" }, ml = { key: 1 }, bl = { key: 2 }, dt = /* @__PURE__ */ ae({
1464
+ __name: "ExecutorSettings",
1465
+ props: {
1466
+ admin: { type: Boolean },
1467
+ locale: {},
1468
+ ctx: {}
1469
+ },
1470
+ emits: ["confirmed"],
1471
+ setup(y, { emit: D }) {
1472
+ const a = y, $ = D, u = ia(), r = N(() => xe(a.locale)), n = p(), i = p(""), o = p(!1), h = p(!1), v = p(), w = p(""), U = p([]), c = N(() => v.value?.scope_mode === "install-selected"), V = N(() => [{ label: r.value.homeScope, value: "home" }, ...U.value]), S = N(() => !c.value || !!w.value && V.value.some((F) => F.value === w.value)), E = N(() => c.value && !v.value?.selection), H = N(() => w.value !== v.value?.selection?.scope);
1473
+ let P = !1;
1474
+ async function q(F) {
1475
+ const L = F ?? await u.status();
1476
+ if (P || (n.value = L, !a.ctx)) return;
1477
+ const J = await a.ctx.call("delegate.status");
1478
+ if (P || (v.value = J, J.scope_mode !== "install-selected")) return;
1479
+ const K = [];
1480
+ let W = 0;
1481
+ for (let R = 0; R < 128; R++) {
1482
+ const O = await a.ctx.call("bg.browse", { offset: W });
1483
+ if (P) return;
1484
+ if (!Array.isArray(O.shares) || !Number.isSafeInteger(O.total) || O.total < 0 || !O.shares.length && W < O.total) throw { code: "EXECUTOR_PROTOCOL" };
1485
+ for (const T of O.shares)
1486
+ T.isdir && T.path === "/" + T.name && !["home", "homes"].includes(T.name.toLowerCase()) && K.push({ label: T.name, value: "shared:" + T.name });
1487
+ if (W += O.shares.length, W >= O.total) break;
1488
+ if (R === 127) throw { code: "EXECUTOR_PROTOCOL" };
1489
+ }
1490
+ U.value = K, w.value = J.selection?.scope ?? J.preselection ?? "";
1491
+ }
1492
+ async function Y() {
1493
+ if (!(!a.admin || o.value)) {
1494
+ o.value = !0, h.value = !1;
1495
+ try {
1496
+ await q();
1497
+ } catch {
1498
+ P || (h.value = !0);
1499
+ } finally {
1500
+ P || (o.value = !1);
1501
+ }
1502
+ }
1503
+ }
1504
+ async function X() {
1505
+ if (!a.admin || o.value || !i.value || !S.value || h.value) return;
1506
+ o.value = !0, h.value = !1;
1507
+ const F = i.value;
1508
+ i.value = "";
1509
+ try {
1510
+ const L = c.value ? await u.authorize(F, w.value) : await u.authorize(F);
1511
+ await q(L), P || $("confirmed");
1512
+ } catch {
1513
+ P || (h.value = !0);
1514
+ } finally {
1515
+ P || (o.value = !1);
1516
+ }
1517
+ }
1518
+ return ie(() => {
1519
+ u.subscribe?.((F) => {
1520
+ P || (n.value = F);
1521
+ }), Y();
1522
+ }), se(() => {
1523
+ P = !0, i.value = "";
1524
+ }), (F, L) => y.admin ? (t(), g(e(de), {
1525
+ key: 0,
1526
+ title: r.value.setupTitle,
1527
+ collapsible: !1,
1528
+ "aria-busy": o.value
1529
+ }, {
1530
+ default: s(() => [
1531
+ _("p", null, l(r.value.setupHelp), 1),
1532
+ h.value ? (t(), g(e(Q), {
1533
+ key: 0,
1534
+ tone: "danger",
1535
+ role: "alert"
1536
+ }, {
1537
+ default: s(() => [
1538
+ f(l(r.value.setupError), 1)
1539
+ ]),
1540
+ _: 1
1541
+ })) : m("", !0),
1542
+ _("p", yl, l(n.value ? n.value.state === "ready" ? E.value ? r.value.scopeNeeds : r.value.ready : n.value.state === "needs-admin-approval" ? r.value.needs : r.value.blocked : r.value.loading), 1),
1543
+ n.value?.reason && (n.value.state === "blocked" || n.value.state === "unsupported") ? (t(), C("p", ml, l(r.value.details) + ": " + l(n.value.reason), 1)) : m("", !0),
1544
+ v.value?.selection ? (t(), C("p", bl, l(r.value.protectedScope) + ": " + l(v.value.selection.root), 1)) : m("", !0),
1545
+ v.value?.mismatch ? (t(), g(e(Q), {
1546
+ key: 3,
1547
+ tone: "warning"
1548
+ }, {
1549
+ default: s(() => [
1550
+ f(l(r.value.scopeMismatch) + " " + l(r.value.preselection) + ": " + l(v.value.preselection) + " · " + l(r.value.protectedScope) + ": " + l(v.value.selection?.root), 1)
1551
+ ]),
1552
+ _: 1
1553
+ })) : m("", !0),
1554
+ n.value?.state === "needs-admin-approval" || n.value?.retry || c.value && n.value?.state === "ready" ? (t(), g(e(pe), {
1555
+ key: 4,
1556
+ onSubmit: ce(X, ["prevent"])
1557
+ }, {
1558
+ default: s(() => [
1559
+ c.value ? (t(), C(j, { key: 0 }, [
1560
+ _("p", null, l(v.value?.selection ? r.value.scopeChangeHelp : r.value.preselectionHelp), 1),
1561
+ b(e(ne), {
1562
+ label: r.value.scopeLabel,
1563
+ "label-for": "delegate-scope"
1564
+ }, {
1565
+ default: s(() => [
1566
+ b(e(Ue), {
1567
+ id: "delegate-scope",
1568
+ modelValue: w.value,
1569
+ "onUpdate:modelValue": L[0] || (L[0] = (J) => w.value = J),
1570
+ options: V.value,
1571
+ disabled: o.value || h.value
1572
+ }, null, 8, ["modelValue", "options", "disabled"])
1573
+ ]),
1574
+ _: 1
1575
+ }, 8, ["label"])
1576
+ ], 64)) : m("", !0),
1577
+ b(e(ne), {
1578
+ label: r.value.password,
1579
+ "label-for": "delegate-password"
1580
+ }, {
1581
+ default: s(() => [
1582
+ b(e(re), {
1583
+ id: "delegate-password",
1584
+ modelValue: i.value,
1585
+ "onUpdate:modelValue": L[1] || (L[1] = (J) => i.value = J),
1586
+ type: "password",
1587
+ autocomplete: "current-password",
1588
+ disabled: o.value || h.value
1589
+ }, null, 8, ["modelValue", "disabled"])
1590
+ ]),
1591
+ _: 1
1592
+ }, 8, ["label"]),
1593
+ b(e(fe), null, {
1594
+ default: s(() => [
1595
+ b(e(z), {
1596
+ type: "submit",
1597
+ variant: "primary",
1598
+ disabled: o.value || h.value || !i.value || !S.value || c.value && !!v.value?.selection && !H.value
1599
+ }, {
1600
+ default: s(() => [
1601
+ f(l(c.value ? v.value?.selection ? r.value.confirmScope : r.value.confirmShare : r.value.authorize), 1)
1602
+ ]),
1603
+ _: 1
1604
+ }, 8, ["disabled"])
1605
+ ]),
1606
+ _: 1
1607
+ })
1608
+ ]),
1609
+ _: 1
1610
+ })) : m("", !0),
1611
+ b(e(z), {
1612
+ variant: "secondary",
1613
+ disabled: o.value,
1614
+ onClick: Y
1615
+ }, {
1616
+ default: s(() => [
1617
+ f(l(r.value.refresh), 1)
1618
+ ]),
1619
+ _: 1
1620
+ }, 8, ["disabled"])
1621
+ ]),
1622
+ _: 1
1623
+ }, 8, ["title", "aria-busy"])) : m("", !0);
1624
+ }
1625
+ }), kl = {
1626
+ key: 1,
1627
+ role: "status"
1628
+ }, _l = {
1629
+ key: 2,
1630
+ role: "status"
1631
+ }, gl = {
1632
+ key: 0,
1633
+ role: "status",
1634
+ class: "destination"
1635
+ }, hl = { class: "section-heading" }, wl = { key: 3 }, Cl = {
1636
+ key: 4,
1637
+ class: "records"
1638
+ }, $l = ["data-job-state"], xl = ["role"], Sl = { key: 5 }, zl = {
1639
+ key: 6,
1640
+ class: "records"
1641
+ }, Vl = /* @__PURE__ */ ae({
1642
+ __name: "DelegatePanel",
1643
+ props: {
1644
+ ctx: {}
1645
+ },
1646
+ setup(y) {
1647
+ const D = y, a = N(() => xe(D.ctx.locale)), $ = $e(D.ctx), u = p(), r = p([]), n = p([]), i = p(!1), o = p(), h = p(""), v = p(!1), w = p(""), U = p(""), c = p("");
1648
+ let V = !1, S, E;
1649
+ Se([U, w, c], () => {
1650
+ E = void 0;
1651
+ }, { flush: "sync" });
1652
+ const H = (M) => ["queued", "running", "waiting_executor"].includes(M.state), P = N(() => n.value.some((M) => M.state === "waiting_executor")), q = ["EXECUTOR_UNAVAILABLE", "EXECUTOR_TIMEOUT"], Y = N(() => P.value && q.includes(o.value?.code ?? "")), X = N(() => u.value && u.value.state !== "ready" && !(P.value && u.value.state === "needs-admin-approval" && q.includes(u.value.reason ?? "")));
1653
+ async function F() {
1654
+ if (V) return;
1655
+ const [M, d, k] = await Promise.allSettled([D.ctx.call("delegate.status"), D.ctx.call("delegate.list"), D.ctx.call("delegate.jobs.list")]);
1656
+ if (!V) {
1657
+ M.status === "fulfilled" && (u.value = M.value), d.status === "fulfilled" && (r.value = (d.value.delegations ?? []).filter((x) => !x.revoked)), k.status === "fulfilled" && (n.value = k.value.jobs ?? []);
1658
+ for (const x of [M, d, k]) if (x.status === "rejected") throw x.reason;
1659
+ }
1660
+ }
1661
+ async function L(M) {
1662
+ if (!(i.value || V)) {
1663
+ i.value = !0, o.value = void 0;
1664
+ try {
1665
+ await M();
1666
+ } catch (d) {
1667
+ V || (o.value = d);
1668
+ } finally {
1669
+ V || (i.value = !1);
1670
+ }
1671
+ }
1672
+ }
1673
+ const J = () => L(F), K = (M) => L(async () => {
1674
+ await D.ctx.call("delegate.revoke", { delegation_id: M }), await F();
1675
+ }), W = (M) => L(async () => {
1676
+ const d = await D.ctx.call("delegate.jobs.cancel", { id: M });
1677
+ V || (h.value = d.revocation_pending ? a.value.pending : ""), await F();
1678
+ }), R = N(() => u.value?.state === "ready" && !!w.value && !!U.value && !!c.value), O = () => L(async () => {
1679
+ R.value && (await D.ctx.call("delegate.jobs.submit", { key: E ?? (E = crypto.randomUUID()), url: U.value, dest: w.value, name: c.value }), V || (U.value = "", c.value = "", w.value = ""), await F());
1680
+ }), T = (M) => {
1681
+ const d = new Date(M);
1682
+ return Number.isNaN(d.getTime()) ? "—" : d.toLocaleString(D.ctx.locale);
1683
+ };
1684
+ return ie(() => {
1685
+ J(), S = setInterval(() => {
1686
+ n.value.some(H) && J();
1687
+ }, 3e3);
1688
+ }), se(() => {
1689
+ V = !0, S && clearInterval(S), $.dispose();
1690
+ }), (M, d) => (t(), g(e(de), {
1691
+ title: a.value.title,
1692
+ collapsible: !1,
1693
+ "aria-busy": i.value,
1694
+ class: "delegate-panel"
1695
+ }, {
1696
+ default: s(() => [
1697
+ _("p", null, l(a.value.help), 1),
1698
+ o.value && !Y.value ? (t(), g(e(Q), {
1699
+ key: 0,
1700
+ tone: "danger",
1701
+ role: "alert"
1702
+ }, {
1703
+ default: s(() => [
1704
+ f(l(e(Fe)(o.value, a.value)), 1)
1705
+ ]),
1706
+ _: 1
1707
+ })) : m("", !0),
1708
+ h.value ? (t(), C("p", kl, l(h.value), 1)) : m("", !0),
1709
+ X.value ? (t(), C("p", _l, l(u.value?.state === "needs-admin-approval" ? a.value.needs : a.value.blocked), 1)) : m("", !0),
1710
+ b(e(pe), {
1711
+ onSubmit: ce(O, ["prevent"])
1712
+ }, {
1713
+ default: s(() => [
1714
+ b(e(ne), {
1715
+ label: a.value.url,
1716
+ "label-for": "delegate-url"
1717
+ }, {
1718
+ default: s(() => [
1719
+ b(e(re), {
1720
+ id: "delegate-url",
1721
+ modelValue: U.value,
1722
+ "onUpdate:modelValue": d[0] || (d[0] = (k) => U.value = k),
1723
+ type: "url",
1724
+ disabled: i.value || u.value?.state !== "ready"
1725
+ }, null, 8, ["modelValue", "disabled"])
1726
+ ]),
1727
+ _: 1
1728
+ }, 8, ["label"]),
1729
+ b(e(ne), {
1730
+ label: a.value.name,
1731
+ "label-for": "delegate-name"
1732
+ }, {
1733
+ default: s(() => [
1734
+ b(e(re), {
1735
+ id: "delegate-name",
1736
+ modelValue: c.value,
1737
+ "onUpdate:modelValue": d[1] || (d[1] = (k) => c.value = k),
1738
+ "data-file-name": "",
1739
+ disabled: i.value || u.value?.state !== "ready"
1740
+ }, null, 8, ["modelValue", "disabled"])
1741
+ ]),
1742
+ _: 1
1743
+ }, 8, ["label"]),
1744
+ _("p", null, l(a.value.size), 1),
1745
+ w.value ? (t(), C("p", gl, l(a.value.destination) + ": " + l(w.value), 1)) : m("", !0),
1746
+ b(e(fe), null, {
1747
+ default: s(() => [
1748
+ b(e(z), {
1749
+ type: "button",
1750
+ variant: "secondary",
1751
+ disabled: i.value || u.value?.state !== "ready",
1752
+ onClick: d[2] || (d[2] = (k) => v.value = !0)
1753
+ }, {
1754
+ default: s(() => [
1755
+ f(l(a.value.choose), 1)
1756
+ ]),
1757
+ _: 1
1758
+ }, 8, ["disabled"]),
1759
+ b(e(z), {
1760
+ type: "submit",
1761
+ variant: "primary",
1762
+ disabled: i.value || !R.value
1763
+ }, {
1764
+ default: s(() => [
1765
+ f(l(a.value.submit), 1)
1766
+ ]),
1767
+ _: 1
1768
+ }, 8, ["disabled"])
1769
+ ]),
1770
+ _: 1
1771
+ })
1772
+ ]),
1773
+ _: 1
1774
+ }),
1775
+ b(ye, {
1776
+ open: v.value,
1777
+ "onUpdate:open": d[3] || (d[3] = (k) => v.value = k),
1778
+ locale: y.ctx.locale,
1779
+ provider: e($),
1780
+ mode: "folder",
1781
+ onSelected: d[4] || (d[4] = (k) => w.value = k)
1782
+ }, null, 8, ["open", "locale", "provider"]),
1783
+ _("div", hl, [
1784
+ _("h3", null, l(a.value.downloads), 1),
1785
+ b(e(z), {
1786
+ variant: "secondary",
1787
+ disabled: i.value,
1788
+ onClick: J
1789
+ }, {
1790
+ default: s(() => [
1791
+ f(l(a.value.refresh), 1)
1792
+ ]),
1793
+ _: 1
1794
+ }, 8, ["disabled"])
1795
+ ]),
1796
+ !n.value.length && !o.value ? (t(), C("p", wl, l(a.value.noJobs), 1)) : (t(), C("ul", Cl, [
1797
+ (t(!0), C(j, null, te(n.value, (k) => (t(), C("li", {
1798
+ key: k.id,
1799
+ "data-job-state": k.state
1800
+ }, [
1801
+ _("span", {
1802
+ role: k.state === "waiting_executor" ? "status" : void 0
1803
+ }, l(k.name) + " · " + l(a.value[k.state]), 9, xl),
1804
+ H(k) ? (t(), g(e(z), {
1805
+ key: 0,
1806
+ variant: "secondary",
1807
+ disabled: i.value,
1808
+ onClick: (x) => W(k.id)
1809
+ }, {
1810
+ default: s(() => [
1811
+ f(l(a.value.cancel), 1)
1812
+ ]),
1813
+ _: 1
1814
+ }, 8, ["disabled", "onClick"])) : m("", !0)
1815
+ ], 8, $l))), 128))
1816
+ ])),
1817
+ _("h3", null, l(a.value.delegations), 1),
1818
+ !r.value.length && !o.value ? (t(), C("p", Sl, l(a.value.noDelegations), 1)) : (t(), C("ul", zl, [
1819
+ (t(!0), C(j, null, te(r.value, (k) => (t(), C("li", {
1820
+ key: k.delegation_id
1821
+ }, [
1822
+ _("div", null, [
1823
+ _("strong", null, l(k.path), 1),
1824
+ _("p", null, l(a.value.expires) + ": " + l(T(k.expires_at)), 1)
1825
+ ]),
1826
+ b(e(z), {
1827
+ variant: "secondary",
1828
+ disabled: i.value,
1829
+ onClick: (x) => K(k.delegation_id)
1830
+ }, {
1831
+ default: s(() => [
1832
+ f(l(a.value.revoke), 1)
1833
+ ]),
1834
+ _: 1
1835
+ }, 8, ["disabled", "onClick"])
1836
+ ]))), 128))
1837
+ ]))
1838
+ ]),
1839
+ _: 1
1840
+ }, 8, ["title", "aria-busy"]));
1841
+ }
1842
+ }), vt = /* @__PURE__ */ ue(Vl, [["__scopeId", "data-v-d79ee942"]]), Pl = {
1843
+ key: 1,
1844
+ role: "status"
1845
+ }, Ul = {
1846
+ key: 2,
1847
+ role: "status"
1848
+ }, Dl = { key: 3 }, Al = {
1849
+ key: 7,
1850
+ role: "status"
1851
+ }, El = { class: "save-actions" }, Tl = { key: 8 }, Il = {
1852
+ key: 10,
1853
+ class: "save-actions"
1854
+ }, Ol = { key: 12 }, Rl = { class: "save-records" }, ql = { class: "save-actions" }, Ll = { key: 14 }, Bl = { class: "save-records" }, Fl = ["data-job-id", "data-save-state"], Nl = { key: 0 }, Ml = { key: 3 }, Hl = /* @__PURE__ */ ae({
1855
+ __name: "BackgroundSavePanel",
1856
+ props: {
1857
+ sdk: {},
1858
+ admin: { type: Boolean },
1859
+ locale: {},
1860
+ picker: {}
1861
+ },
1862
+ emits: ["authorized"],
1863
+ setup(y, { emit: D }) {
1864
+ const a = y, $ = D, u = p(!1), r = p(""), n = N(() => Ce(a.locale)), i = p(), o = p([]), h = p([]), v = p(!1), w = p(), U = p(""), c = p([]), V = N(() => a.picker && (i.value?.selection ? Ne(a.picker.provider, i.value.selection.root) : i.value?.scopeMode === "install-selected" ? void 0 : a.picker.provider));
1865
+ let S = !1, E;
1866
+ const H = (T) => T.state === "copying" && T.code === "CANCEL_REQUESTED", P = (T) => H(T) ? "canceling" : T.state === "committed" && !T.receipt?.path ? "uncertain" : T.state, q = (T) => ["queued", "copying"].includes(T.state) && !H(T);
1867
+ function Y() {
1868
+ i.value = void 0, o.value = [], h.value = [], c.value = [], u.value = !1;
1869
+ }
1870
+ async function X() {
1871
+ const [T, M, d, k] = await Promise.all([a.sdk.status(), a.sdk.list(), a.sdk.operations(), Promise.all((a.picker?.keys ?? []).map((x) => a.sdk.destination(x)))]);
1872
+ if (!S) {
1873
+ if (!T || typeof T.disabled != "boolean" || !Array.isArray(M) || !Array.isArray(d)) throw { code: "unavailable" };
1874
+ (i.value?.selection?.generation !== T.selection?.generation || i.value?.selection?.scope !== T.selection?.scope) && (u.value = !1), i.value = T, o.value = k.length ? M.filter((x) => k.some((G) => G.status === "active" && G.destination?.id === x.id)) : M, h.value = d, c.value = k;
1875
+ }
1876
+ }
1877
+ async function F(T) {
1878
+ if (!(S || v.value)) {
1879
+ v.value = !0, w.value = void 0, U.value = "";
1880
+ try {
1881
+ await T();
1882
+ } catch (M) {
1883
+ S || (Y(), w.value = M);
1884
+ } finally {
1885
+ S || (v.value = !1);
1886
+ }
1887
+ }
1888
+ }
1889
+ const L = () => F(X);
1890
+ function J(T) {
1891
+ $("authorized", T), L();
1892
+ }
1893
+ const K = (T) => F(async () => {
1894
+ if ((await a.sdk.revoke({ delegation_id: T }))?.revoked !== !0) throw { code: "commit-uncertain" };
1895
+ await X(), S || (U.value = n.value.revoked);
1896
+ }), W = (T) => F(async () => {
1897
+ await a.sdk.cancel({ delegation_id: T.delegation_id, job_id: T.job_id }), await X();
1898
+ }), R = () => F(async () => {
1899
+ if (!a.admin || !i.value) return;
1900
+ const T = i.value.disabled;
1901
+ if ((T ? await a.sdk.enable() : await a.sdk.disable())?.disabled !== !T) throw { code: "commit-uncertain" };
1902
+ await X();
1903
+ }), O = (T) => F(async () => {
1904
+ const M = "example-" + Array.from(crypto.getRandomValues(new Uint8Array(16)), (d) => d.toString(16).padStart(2, "0")).join("");
1905
+ await a.sdk.exportExample({ key: T, job_id: M }), await X();
1906
+ });
1907
+ return ie(() => {
1908
+ L(), E = setInterval(() => {
1909
+ h.value.some(q) && L();
1910
+ }, 3e3);
1911
+ }), se(() => {
1912
+ S = !0, E && clearInterval(E);
1913
+ }), (T, M) => (t(), g(e(de), {
1914
+ title: n.value.title,
1915
+ collapsible: !1,
1916
+ "aria-busy": v.value,
1917
+ class: "background-save-panel"
1918
+ }, {
1919
+ default: s(() => [
1920
+ _("p", null, l(n.value.help), 1),
1921
+ w.value ? (t(), g(e(Q), {
1922
+ key: 0,
1923
+ tone: "danger",
1924
+ role: "alert",
1925
+ class: "save-message"
1926
+ }, {
1927
+ default: s(() => [
1928
+ f(l(e(be)(w.value, n.value)), 1)
1929
+ ]),
1930
+ _: 1
1931
+ })) : m("", !0),
1932
+ v.value && !i.value ? (t(), C("p", Pl, l(n.value.loading), 1)) : m("", !0),
1933
+ U.value ? (t(), C("p", Ul, l(U.value), 1)) : m("", !0),
1934
+ i.value?.selection ? (t(), C("p", Dl, [
1935
+ _("strong", null, l(n.value.scope), 1),
1936
+ f(": " + l(i.value.selection.root), 1)
1937
+ ])) : m("", !0),
1938
+ i.value?.mismatch ? (t(), g(e(Q), {
1939
+ key: 4,
1940
+ tone: "warning"
1941
+ }, {
1942
+ default: s(() => [
1943
+ f(l(n.value.scopeMismatch) + " " + l(i.value.preselection) + " → " + l(i.value.selection?.root), 1)
1944
+ ]),
1945
+ _: 1
1946
+ })) : m("", !0),
1947
+ i.value?.scopeMode === "install-selected" && !i.value.selection ? (t(), g(e(Q), {
1948
+ key: 5,
1949
+ tone: "warning"
1950
+ }, {
1951
+ default: s(() => [
1952
+ f(l(n.value.scopeNeeds), 1)
1953
+ ]),
1954
+ _: 1
1955
+ })) : m("", !0),
1956
+ i.value?.disabled ? (t(), g(e(Q), {
1957
+ key: 6,
1958
+ tone: "warning",
1959
+ role: "status",
1960
+ class: "save-message"
1961
+ }, {
1962
+ default: s(() => [
1963
+ f(l(n.value.disabled), 1)
1964
+ ]),
1965
+ _: 1
1966
+ })) : i.value ? (t(), C("p", Al, l(n.value.enabled), 1)) : m("", !0),
1967
+ _("div", El, [
1968
+ b(e(z), {
1969
+ variant: "secondary",
1970
+ disabled: v.value,
1971
+ onClick: L
1972
+ }, {
1973
+ default: s(() => [
1974
+ f(l(n.value.refresh), 1)
1975
+ ]),
1976
+ _: 1
1977
+ }, 8, ["disabled"]),
1978
+ y.admin && i.value ? (t(), g(e(z), {
1979
+ key: 0,
1980
+ variant: i.value.disabled ? "secondary" : "danger",
1981
+ disabled: v.value,
1982
+ onClick: R
1983
+ }, {
1984
+ default: s(() => [
1985
+ f(l(i.value.disabled ? n.value.enable : n.value.disable), 1)
1986
+ ]),
1987
+ _: 1
1988
+ }, 8, ["variant", "disabled"])) : m("", !0)
1989
+ ]),
1990
+ y.admin && i.value ? (t(), C("p", Tl, l(n.value.disableHelp), 1)) : m("", !0),
1991
+ _("h3", null, l(n.value.delegations), 1),
1992
+ c.value.some((d) => d.status === "reselection-required") ? (t(), g(e(Q), {
1993
+ key: 9,
1994
+ tone: "warning"
1995
+ }, {
1996
+ default: s(() => [
1997
+ f(l(n.value.reselect), 1)
1998
+ ]),
1999
+ _: 1
2000
+ })) : m("", !0),
2001
+ y.picker ? (t(), C("div", Il, [
2002
+ (t(!0), C(j, null, te(y.picker.keys, (d) => (t(), g(e(z), {
2003
+ key: d,
2004
+ variant: "secondary",
2005
+ disabled: v.value || !i.value || i.value.disabled || !V.value,
2006
+ onClick: (k) => {
2007
+ r.value = d, u.value = !0;
2008
+ }
2009
+ }, {
2010
+ default: s(() => [
2011
+ f(l(n.value.choose) + " (" + l(d) + ")", 1)
2012
+ ]),
2013
+ _: 2
2014
+ }, 1032, ["disabled", "onClick"]))), 128))
2015
+ ])) : m("", !0),
2016
+ V.value ? (t(), g(ye, {
2017
+ key: i.value?.selection?.scope,
2018
+ open: u.value,
2019
+ "onUpdate:open": M[0] || (M[0] = (d) => u.value = d),
2020
+ provider: V.value,
2021
+ locale: y.locale,
2022
+ mode: "folder",
2023
+ destination: { key: r.value, selectDestination: y.sdk.selectDestination },
2024
+ onAuthorized: J
2025
+ }, null, 8, ["open", "provider", "locale", "destination"])) : m("", !0),
2026
+ i.value && !o.value.length ? (t(), C("p", Ol, l(n.value.empty), 1)) : m("", !0),
2027
+ _("ul", Rl, [
2028
+ (t(!0), C(j, null, te(o.value, (d) => (t(), C("li", {
2029
+ key: d.id
2030
+ }, [
2031
+ _("div", null, [
2032
+ _("strong", null, l(d.path), 1),
2033
+ _("p", null, l(n.value.untilRevoked), 1)
2034
+ ]),
2035
+ b(e(z), {
2036
+ variant: "secondary",
2037
+ disabled: v.value,
2038
+ onClick: (k) => K(d.id)
2039
+ }, {
2040
+ default: s(() => [
2041
+ f(l(n.value.revoke), 1)
2042
+ ]),
2043
+ _: 1
2044
+ }, 8, ["disabled", "onClick"])
2045
+ ]))), 128))
2046
+ ]),
2047
+ c.value.some((d) => d.status === "active") ? (t(), C(j, { key: 13 }, [
2048
+ _("p", null, l(n.value.exampleHelp), 1),
2049
+ _("div", ql, [
2050
+ (t(!0), C(j, null, te(c.value.filter((d) => d.status === "active"), (d) => (t(), g(e(z), {
2051
+ key: d.key,
2052
+ variant: "secondary",
2053
+ disabled: v.value || i.value?.disabled,
2054
+ onClick: (k) => O(d.key)
2055
+ }, {
2056
+ default: s(() => [
2057
+ f(l(n.value.example) + " (" + l(d.key) + ")", 1)
2058
+ ]),
2059
+ _: 2
2060
+ }, 1032, ["disabled", "onClick"]))), 128))
2061
+ ])
2062
+ ], 64)) : m("", !0),
2063
+ _("h3", null, l(n.value.operations), 1),
2064
+ i.value && !h.value.length ? (t(), C("p", Ll, l(n.value.noOperations), 1)) : m("", !0),
2065
+ _("ul", Bl, [
2066
+ (t(!0), C(j, null, te(h.value, (d) => (t(), C("li", {
2067
+ key: d.job_id,
2068
+ "data-job-id": d.job_id,
2069
+ "data-save-state": P(d)
2070
+ }, [
2071
+ _("div", null, [
2072
+ _("strong", null, l(d.name), 1),
2073
+ _("p", null, l(n.value[P(d)]) + " · " + l(d.job_id), 1),
2074
+ P(d) === "committed" ? (t(), C("p", Nl, l(d.receipt?.path), 1)) : m("", !0),
2075
+ P(d) === "uncertain" ? (t(), g(e(Q), {
2076
+ key: 1,
2077
+ tone: "warning",
2078
+ class: "save-message"
2079
+ }, {
2080
+ default: s(() => [
2081
+ f(l(n.value.uncertainHelp), 1)
2082
+ ]),
2083
+ _: 1
2084
+ })) : P(d) === "interrupted" ? (t(), g(e(Q), {
2085
+ key: 2,
2086
+ tone: "warning",
2087
+ class: "save-message"
2088
+ }, {
2089
+ default: s(() => [
2090
+ f(l(n.value.interruptedHelp), 1)
2091
+ ]),
2092
+ _: 1
2093
+ })) : m("", !0),
2094
+ d.code && !H(d) ? (t(), C("p", Ml, l(e(be)({ code: d.code }, n.value)), 1)) : m("", !0)
2095
+ ]),
2096
+ q(d) ? (t(), g(e(z), {
2097
+ key: 0,
2098
+ variant: "secondary",
2099
+ disabled: v.value,
2100
+ onClick: (k) => W(d)
2101
+ }, {
2102
+ default: s(() => [
2103
+ f(l(n.value.cancel), 1)
2104
+ ]),
2105
+ _: 1
2106
+ }, 8, ["disabled", "onClick"])) : m("", !0)
2107
+ ], 8, Fl))), 128))
2108
+ ])
2109
+ ]),
2110
+ _: 1
2111
+ }, 8, ["title", "aria-busy"]));
2112
+ }
2113
+ }), ct = /* @__PURE__ */ ue(Hl, [["__scopeId", "data-v-c4022c90"]]), Kl = {
2114
+ class: "authorization-announcement",
2115
+ role: "status",
2116
+ "aria-live": "polite",
2117
+ "aria-atomic": "true"
2118
+ }, Jl = ["aria-busy", "data-authorization-state"], Xl = {
2119
+ class: "authorization-icon",
2120
+ "aria-hidden": "true"
2121
+ }, Gl = { class: "authorization-title" }, Ql = { class: "authorization-body" }, Yl = { class: "authorization-actions" }, Wl = {
2122
+ key: 1,
2123
+ class: "authorization-authorized"
2124
+ }, Zl = { class: "authorization-ready" }, jl = /* @__PURE__ */ ae({
2125
+ __name: "AuthorizationGate",
2126
+ props: {
2127
+ ctx: {},
2128
+ name: {}
2129
+ },
2130
+ emits: ["ready"],
2131
+ setup(y, { emit: D }) {
2132
+ const a = y, $ = D, u = p(), r = p(), n = p(!1), i = p(!1), o = p(!1);
2133
+ let h = !1, v = 0, w = !1, U;
2134
+ const c = N(() => Me(a.ctx.locale, a.name ?? a.ctx.displayName ?? "")), V = N(() => u.value?.state === "ready"), S = N(() => u.value || r.value), E = N(() => S.value?.state === "authorization_required"), H = N(() => ["helper_untrusted", "cli_untrusted"].includes(S.value?.reason || "")), P = N(() => E.value && !H.value), q = N(() => S.value?.reason === "credential_not_ready" ? "credential" : "unavailable"), Y = N(() => S.value ? E.value ? c.value("title") : S.value.state === "ready" ? c.value("ready") : S.value.state === "not_admin" ? c.value("not_admin.title") : S.value.state === "session_expired" ? c.value("session_expired.title") : c.value(q.value + ".title") : c.value("checking")), X = N(() => E.value ? c.value("purpose") : S.value?.state === "not_admin" ? c.value("not_admin.body") : S.value?.state === "session_expired" ? c.value("session_expired.body") : S.value?.state === "unavailable" ? c.value(q.value + ".body") : c.value("purpose")), F = ["grant_missing", "upgrade_reapproval", "helper_untrusted", "cli_untrusted", "grant_incompatible", "package_identity_changed", "maintenance_task_missing", "maintenance_task_mismatch", "helper_health_rejected", "capability_missing"], L = N(() => F.includes(S.value?.reason || "") ? S.value.reason : "unknown"), J = N(() => H.value ? "next.reinstall" : L.value === "grant_missing" ? "next.install" : L.value === "upgrade_reapproval" || L.value === "grant_incompatible" ? "next.update" : "next.repair");
2135
+ async function K(W) {
2136
+ if (n.value || h) return;
2137
+ const R = ++v;
2138
+ r.value = W === "request" && u.value?.state === "authorization_required" ? u.value : void 0, n.value = !0, i.value = !1, u.value = void 0;
2139
+ try {
2140
+ const O = await a.ctx.authorization?.[W]();
2141
+ if (h || R !== v) return;
2142
+ if (!O || O.command !== "authorization" || O.schema_version !== 1 || !["ready", "authorization_required", "not_admin", "session_expired", "unavailable"].includes(O.state) || O.reason === "upgrade_reapproval" && O.state !== "authorization_required") throw Error("invalid status");
2143
+ u.value = O, O.state === "ready" && $("ready");
2144
+ } catch (O) {
2145
+ !h && R === v && (u.value = O.code === "session_required" ? { command: "authorization", schema_version: 1, state: "session_expired", reason: "session_expired" } : r.value || { command: "authorization", schema_version: 1, state: "unavailable", reason: "service_unavailable" }, i.value = !0);
2146
+ } finally {
2147
+ !h && R === v && (n.value = !1, r.value = void 0, w && (w = !1, K("status")));
2148
+ }
2149
+ }
2150
+ return ie(() => {
2151
+ U = a.ctx.reopen(() => {
2152
+ n.value ? w = !0 : K("status");
2153
+ }), K("status");
2154
+ }), ze(() => {
2155
+ h = !0, v++, typeof U == "function" && U();
2156
+ }), (W, R) => (t(), C(j, null, [
2157
+ _("p", Kl, l(n.value ? c.value("authorizing") : Y.value), 1),
2158
+ V.value ? (t(), C("div", Wl, [
2159
+ _("div", Zl, [
2160
+ b(e(he), {
2161
+ size: 16,
2162
+ "aria-hidden": "true"
2163
+ }),
2164
+ _("span", null, l(c.value("ready")), 1),
2165
+ y.ctx.authorization?.canManage?.() ? (t(), g(e(z), {
2166
+ key: 0,
2167
+ variant: "secondary",
2168
+ disabled: n.value,
2169
+ onClick: R[2] || (R[2] = (O) => o.value = !0)
2170
+ }, {
2171
+ default: s(() => [
2172
+ f(l(c.value("revoke")), 1)
2173
+ ]),
2174
+ _: 1
2175
+ }, 8, ["disabled"])) : m("", !0)
2176
+ ]),
2177
+ ke(W.$slots, "default", {}, void 0, !0)
2178
+ ])) : (t(), C("div", {
2179
+ key: 0,
2180
+ class: "authorization-view",
2181
+ "aria-busy": n.value,
2182
+ "data-authorization-state": u.value?.state || "checking"
2183
+ }, [
2184
+ b(e(aa), {
2185
+ class: "authorization-card",
2186
+ padding: "lg",
2187
+ raised: "",
2188
+ "aria-label": Y.value
2189
+ }, {
2190
+ default: s(() => [
2191
+ _("span", Xl, [
2192
+ (t(), g(Je(S.value?.state === "unavailable" || S.value?.state === "session_expired" ? e(sa) : e(he)), { class: "authorization-icon-glyph" }))
2193
+ ]),
2194
+ _("h1", Gl, l(Y.value), 1),
2195
+ _("p", Ql, l(X.value), 1),
2196
+ E.value ? (t(), g(e(Q), {
2197
+ key: 0,
2198
+ class: "authorization-status",
2199
+ tone: ["grant_missing", "upgrade_reapproval"].includes(L.value) ? "info" : "warning",
2200
+ title: c.value("reason." + L.value)
2201
+ }, {
2202
+ default: s(() => [
2203
+ f(l(c.value(J.value)), 1)
2204
+ ]),
2205
+ _: 1
2206
+ }, 8, ["tone", "title"])) : m("", !0),
2207
+ i.value ? (t(), g(e(Q), {
2208
+ key: 1,
2209
+ class: "authorization-failed",
2210
+ tone: "warning"
2211
+ }, {
2212
+ default: s(() => [
2213
+ f(l(c.value("failed")), 1)
2214
+ ]),
2215
+ _: 1
2216
+ })) : m("", !0),
2217
+ _("div", Yl, [
2218
+ P.value ? (t(), g(e(z), {
2219
+ key: 0,
2220
+ variant: "primary",
2221
+ loading: n.value,
2222
+ disabled: n.value,
2223
+ onClick: R[0] || (R[0] = (O) => K("request"))
2224
+ }, {
2225
+ default: s(() => [
2226
+ f(l(n.value ? c.value("authorizing") : c.value("authorize")), 1)
2227
+ ]),
2228
+ _: 1
2229
+ }, 8, ["loading", "disabled"])) : (t(), g(e(z), {
2230
+ key: 1,
2231
+ variant: "primary",
2232
+ loading: n.value,
2233
+ disabled: n.value,
2234
+ onClick: R[1] || (R[1] = (O) => K("status"))
2235
+ }, {
2236
+ default: s(() => [
2237
+ f(l(n.value ? c.value("checking") : c.value("retry")), 1)
2238
+ ]),
2239
+ _: 1
2240
+ }, 8, ["loading", "disabled"]))
2241
+ ])
2242
+ ]),
2243
+ _: 1
2244
+ }, 8, ["aria-label"])
2245
+ ], 8, Jl)),
2246
+ b(e(Ve), {
2247
+ open: o.value,
2248
+ "onUpdate:open": R[5] || (R[5] = (O) => o.value = O),
2249
+ title: c.value("revoke.title"),
2250
+ description: c.value("revoke.body")
2251
+ }, {
2252
+ footer: s(() => [
2253
+ b(e(z), {
2254
+ variant: "secondary",
2255
+ onClick: R[3] || (R[3] = (O) => o.value = !1)
2256
+ }, {
2257
+ default: s(() => [
2258
+ f(l(c.value("cancel")), 1)
2259
+ ]),
2260
+ _: 1
2261
+ }),
2262
+ b(e(z), {
2263
+ variant: "danger",
2264
+ disabled: n.value,
2265
+ onClick: R[4] || (R[4] = (O) => {
2266
+ o.value = !1, K("revoke");
2267
+ })
2268
+ }, {
2269
+ default: s(() => [
2270
+ f(l(c.value("revoke")), 1)
2271
+ ]),
2272
+ _: 1
2273
+ }, 8, ["disabled"])
2274
+ ]),
2275
+ _: 1
2276
+ }, 8, ["open", "title", "description"])
2277
+ ], 64));
2278
+ }
2279
+ }), pt = /* @__PURE__ */ ue(jl, [["__scopeId", "data-v-c8a34087"]]);
2280
+ export {
2281
+ st as AppShell,
2282
+ pt as AuthorizationGate,
2283
+ rt as BackgroundPanel,
2284
+ ct as BackgroundSavePanel,
2285
+ vt as DelegatePanel,
2286
+ dt as ExecutorSettings,
2287
+ ua as ExecutorSetupKey,
2288
+ De as FileBrowser,
2289
+ ut as FilesPage,
2290
+ ot as LoginPage,
2291
+ ye as NasPicker,
2292
+ it as PortalSettings,
2293
+ mt as activePage,
2294
+ bt as authorizationCatalogs,
2295
+ Me as authorizationCopy,
2296
+ kt as backgroundCatalogs,
2297
+ qe as backgroundCopy,
2298
+ Be as backgroundErrorCopy,
2299
+ _t as catalogs,
2300
+ Le as createBackgroundPickerProvider,
2301
+ gt as createBackgroundSaveFacade,
2302
+ ht as createFileTransfers,
2303
+ $e as createNasProvider,
2304
+ nt as createSession,
2305
+ wt as decodeResponse,
2306
+ Ct as delegateCatalogs,
2307
+ xe as delegateCopy,
2308
+ $t as encodeRequest,
2309
+ Fe as errorCopy,
2310
+ ve as format,
2311
+ xt as identityCatalogs,
2312
+ Re as identityCopy,
2313
+ St as nasCatalogs,
2314
+ oe as nasCopy,
2315
+ we as nasErrorCopy,
2316
+ zt as protocolCodes,
2317
+ Vt as protocolOps,
2318
+ Pt as protocolSchemas,
2319
+ _e as requestKey,
2320
+ Ut as saveCatalogs,
2321
+ Ce as saveCopy,
2322
+ be as saveError,
2323
+ Ne as scopedPicker,
2324
+ Dt as shellCatalogs,
2325
+ Oe as shellCopy,
2326
+ At as shellPages,
2327
+ Et as uiLocale,
2328
+ Tt as uiLocales,
2329
+ ia as useExecutorSetup,
2330
+ oa as useNasRequest
2331
+ };