@epam/ai-dial-publish-panel 1.3.0-dev.98 → 1.3.0-rc.0

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 (45) hide show
  1. package/components/PublishAccessRuleEditor/PublishAccessRuleEditor.d.ts +1 -1
  2. package/components/PublishAccessRuleEditor/PublishAccessRuleEditor.d.ts.map +1 -1
  3. package/components/PublishAccessRules/PublishAccessRules.d.ts.map +1 -1
  4. package/components/PublishFoldersTree/PublishFoldersTree.d.ts +1 -1
  5. package/components/PublishFoldersTree/PublishFoldersTree.d.ts.map +1 -1
  6. package/components/PublishHistoryList/PublishHistoryList.d.ts.map +1 -1
  7. package/components/PublishPanel/PublishFooter.d.ts +10 -1
  8. package/components/PublishPanel/PublishFooter.d.ts.map +1 -1
  9. package/components/PublishPanel/PublishPanel.d.ts +26 -9
  10. package/components/PublishPanel/PublishPanel.d.ts.map +1 -1
  11. package/components/PublishPanel/StandalonePublishPanel.d.ts +12 -2
  12. package/components/PublishPanel/StandalonePublishPanel.d.ts.map +1 -1
  13. package/components/SaveToFolderPanel/SaveToFolderPanel.d.ts +5 -0
  14. package/components/SaveToFolderPanel/SaveToFolderPanel.d.ts.map +1 -0
  15. package/components/SaveToFolderPanel/StandaloneSaveToFolderPanel.d.ts +5 -0
  16. package/components/SaveToFolderPanel/StandaloneSaveToFolderPanel.d.ts.map +1 -0
  17. package/components/UnpublishConfirmationDialog/UnpublishConfirmationDialog.d.ts +10 -0
  18. package/components/UnpublishConfirmationDialog/UnpublishConfirmationDialog.d.ts.map +1 -0
  19. package/index.css +2 -2
  20. package/index.d.ts +10 -0
  21. package/index.d.ts.map +1 -1
  22. package/index.js +1036 -602
  23. package/models/folder-destination.d.ts +28 -0
  24. package/models/folder-destination.d.ts.map +1 -0
  25. package/models/publish-access-rule-editor.d.ts +3 -7
  26. package/models/publish-access-rule-editor.d.ts.map +1 -1
  27. package/models/publish-folders-tree.d.ts +19 -10
  28. package/models/publish-folders-tree.d.ts.map +1 -1
  29. package/models/publish-panel-styles.d.ts +2 -6
  30. package/models/publish-panel-styles.d.ts.map +1 -1
  31. package/models/save-to-folder-panel.d.ts +204 -0
  32. package/models/save-to-folder-panel.d.ts.map +1 -0
  33. package/models/unpublish-confirmation-dialog.d.ts +50 -0
  34. package/models/unpublish-confirmation-dialog.d.ts.map +1 -0
  35. package/package.json +5 -5
  36. package/types/publish-panel.d.ts +8 -0
  37. package/types/publish-panel.d.ts.map +1 -0
  38. package/types/save-to-folder.d.ts +15 -0
  39. package/types/save-to-folder.d.ts.map +1 -0
  40. package/utils/folder-destination.d.ts +17 -0
  41. package/utils/folder-destination.d.ts.map +1 -0
  42. package/utils/publish-folder-tree.d.ts +2 -0
  43. package/utils/publish-folder-tree.d.ts.map +1 -1
  44. package/utils/use-publish-folder-view.d.ts +28 -0
  45. package/utils/use-publish-folder-view.d.ts.map +1 -0
package/index.js CHANGED
@@ -1,46 +1,46 @@
1
1
  import { useCallback as e, useEffect as t, useId as n, useMemo as r, useRef as i, useState as a } from "react";
2
- import { ButtonVariant as o, Checkbox as s, DIAL_ICON_SIZE as c, DIAL_KIT_ICON_STROKE as l, DialFileNodeType as u, GhostButton as d, GhostIconButton as f, Highlight as p, Input as m, NeutralButton as h, Notification as g, NotificationType as _, NotificationVariant as v, Search as y, Select as ee, SideDrawer as b, Spinner as x, Tag as S, TagInput as te } from "@epam/ai-dial-ui-kit";
3
- import { ResourceSummary as C, TAG_INPUT_TAG_CLASS_NAME as w, buildCssVars as T, mergeClasses as E } from "@epam/ai-dial-chat-shared";
4
- import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
5
- import { IconFolderPlus as A, IconPlus as j, IconTrashX as ne } from "@tabler/icons-react";
6
- import { DialFileNodeType as re, DialFoldersTree as ie } from "@epam/ai-dial-react-file-manager";
2
+ import { BottomSheet as o, ButtonVariant as s, Checkbox as c, ConfirmationPopupVariant as l, DIAL_ICON_SIZE as u, DIAL_KIT_ICON_STROKE as d, DialFileNodeType as f, ElementSize as p, ErrorText as m, FolderName as h, GhostButton as g, GhostIconButton as _, Highlight as v, Input as ee, LinkButton as y, LiveRegion as b, LiveRegionElement as x, LiveRegionPoliteness as S, NeutralButton as C, Notification as w, NotificationType as T, NotificationVariant as E, PrimaryButton as D, RadioGroup as O, Search as k, Select as A, SideDrawer as j, Spinner as M, Tag as te, TagInput as N } from "@epam/ai-dial-ui-kit";
3
+ import { ConfirmationDialog as P, ResourceSummary as F, TAG_INPUT_TAG_CLASS_NAME as I, buildCssVars as ne, mergeClasses as L, useIsMobile as R } from "@epam/ai-dial-chat-shared";
4
+ import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
5
+ import { IconFolder as re, IconFolderPlus as ie, IconPlus as ae, IconTrashX as oe } from "@tabler/icons-react";
6
+ import { DialFileNodeType as se, DialFoldersTree as H } from "@epam/ai-dial-react-file-manager";
7
7
  //#region src/models/publish.ts
8
- var M = /* @__PURE__ */ function(e) {
8
+ var U = /* @__PURE__ */ function(e) {
9
9
  return e.Equal = "EQUAL", e.Contain = "CONTAIN", e.Regex = "REGEX", e;
10
- }({}), N = /* @__PURE__ */ function(e) {
10
+ }({}), W = /* @__PURE__ */ function(e) {
11
11
  return e.None = "none", e.Info = "info", e.ReplaceWarning = "replaceWarning", e.NoAccess = "noAccess", e.SubmitError = "submitError", e;
12
- }({}), ae = (e) => e.isSubmitting ? {
13
- calloutKind: N.None,
12
+ }({}), G = (e) => e.isSubmitting ? {
13
+ calloutKind: W.None,
14
14
  isSubmitDisabled: !0,
15
15
  isSubmitLoading: !0
16
16
  } : e.hasSelectedFolder ? e.hasWriteAccess ? e.hasSubmitError ? {
17
- calloutKind: N.SubmitError,
17
+ calloutKind: W.SubmitError,
18
18
  isSubmitDisabled: !1,
19
19
  isSubmitLoading: !1
20
20
  } : e.hasExistingPublicationInFolder ? {
21
- calloutKind: N.ReplaceWarning,
21
+ calloutKind: W.ReplaceWarning,
22
22
  isSubmitDisabled: e.allowReplace === !1,
23
23
  isSubmitLoading: !1
24
24
  } : {
25
- calloutKind: N.Info,
25
+ calloutKind: W.Info,
26
26
  isSubmitDisabled: !1,
27
27
  isSubmitLoading: !1
28
28
  } : {
29
- calloutKind: N.NoAccess,
29
+ calloutKind: W.NoAccess,
30
30
  isSubmitDisabled: !0,
31
31
  isSubmitLoading: !1
32
32
  } : {
33
- calloutKind: N.None,
33
+ calloutKind: W.None,
34
34
  isSubmitDisabled: !0,
35
35
  isSubmitLoading: !1
36
- }, P = 1440 * 60 * 1e3, F = (e, t = Date.now(), n) => {
37
- let r = Math.floor((t - e) / P);
36
+ }, ce = 864e5, K = (e, t = Date.now(), n) => {
37
+ let r = Math.floor((t - e) / ce);
38
38
  return r <= 0 ? "Today" : r === 1 ? "Yesterday" : r < 7 ? `${r} days ago` : new Date(e).toLocaleDateString(n, {
39
39
  month: "short",
40
40
  day: "numeric",
41
41
  year: "numeric"
42
42
  });
43
- }, I = (e, t, n) => t.length === 0 ? [...e, {
43
+ }, le = (e, t, n) => t.length === 0 ? [...e, {
44
44
  path: [n],
45
45
  name: n
46
46
  }] : e.map((e) => e.path.join("/") === t.join("/") ? {
@@ -51,476 +51,489 @@ var M = /* @__PURE__ */ function(e) {
51
51
  }]
52
52
  } : {
53
53
  ...e,
54
- children: e.children ? I(e.children, t, n) : e.children
55
- }), L = (e, t, n) => {
54
+ children: e.children ? le(e.children, t, n) : e.children
55
+ }), q = (e, t, n) => {
56
56
  let r = [...t, n].join("/");
57
57
  return t.length === 0 ? e.filter((e) => e.path.join("/") !== r) : e.map((e) => e.path.join("/") === t.join("/") ? {
58
58
  ...e,
59
59
  children: (e.children ?? []).filter((e) => e.path.join("/") !== r)
60
60
  } : {
61
61
  ...e,
62
- children: e.children ? L(e.children, t, n) : e.children
62
+ children: e.children ? q(e.children, t, n) : e.children
63
63
  });
64
- }, R = ({ item: n, history: i, folderItems: o, hasWriteAccess: s = () => !0, defaultAuthor: c = "", onCreateFolder: l, onPublish: u, onPublishSuccess: d, onPublishError: f, onFetchExistingRules: p }) => {
64
+ }, ue = ({ item: n, history: i, folderItems: o, hasWriteAccess: s = () => !0, defaultAuthor: c = "", onCreateFolder: l, onPublish: u, onPublishSuccess: d, onPublishError: f, onFetchExistingRules: p }) => {
65
65
  let [m, h] = a(o);
66
66
  t(() => {
67
67
  h(o);
68
68
  }, [o]);
69
- let [g, _] = a(), [v, y] = a(!1), [ee, b] = a(!1), [x, S] = a([]), [te, C] = a(!1), [w, T] = a(!1), [E, D] = a(c), [O, k] = a(!1), [A, j] = a(!1);
69
+ let [g, _] = a(), [v, ee] = a(!1), [y, b] = a(!1), [x, S] = a([]), [C, w] = a(!1), [T, E] = a(!1), [D, O] = a(c), [k, A] = a(!1), [j, M] = a(!1);
70
70
  t(() => {
71
- A || D(c);
72
- }, [c, A]);
73
- let ne = e((e) => {
74
- j(!0), D(e);
71
+ j || O(c);
72
+ }, [c, j]);
73
+ let te = e((e) => {
74
+ M(!0), O(e);
75
75
  }, []);
76
76
  t(() => {
77
77
  if (g == null) {
78
- S([]), T(!1);
78
+ S([]), E(!1);
79
79
  return;
80
80
  }
81
81
  if (!p) return;
82
82
  let e = !1;
83
- return C(!0), T(!1), p(g).then((t) => {
83
+ return w(!0), E(!1), p(g).then((t) => {
84
84
  e || S(t);
85
85
  }).catch(() => {
86
- e || T(!0);
86
+ e || E(!0);
87
87
  }).finally(() => {
88
- e || C(!1);
88
+ e || w(!1);
89
89
  }), () => {
90
90
  e = !0;
91
91
  };
92
92
  }, [g]);
93
- let re = r(() => {
93
+ let N = r(() => {
94
94
  if (!g) return !1;
95
95
  let e = g.join("/");
96
- return i.some((t) => t.folderPath.join("/") === e ? n.version == null ? !0 : t.version === n.version : !1);
96
+ return i.some((t) => t.folderPath.join("/") === e ? n.version == null || t.version === n.version : !1);
97
97
  }, [
98
98
  i,
99
99
  n.version,
100
100
  g
101
- ]), ie = e(async (e, t) => {
102
- h((n) => I(n, e, t));
101
+ ]), P = e(async (e, t) => {
102
+ h((n) => le(n, e, t));
103
103
  try {
104
104
  await l?.(e, t);
105
105
  } catch {
106
- h((n) => L(n, e, t)), b(!0);
106
+ h((n) => q(n, e, t)), b(!0);
107
107
  }
108
- }, [l]), M = e(async () => {
108
+ }, [l]), F = e(async () => {
109
109
  if (!g) return !1;
110
- y(!0), b(!1);
110
+ ee(!0), b(!1);
111
111
  try {
112
- return await u(n, g, x, E.trim(), O), d?.(n, g), !0;
112
+ return await u(n, g, x, D.trim(), k), d?.(n, g), !0;
113
113
  } catch (e) {
114
114
  return b(!0), f?.(n, g, e), !1;
115
115
  } finally {
116
- y(!1);
116
+ ee(!1);
117
117
  }
118
118
  }, [
119
- E,
119
+ D,
120
120
  n,
121
121
  u,
122
122
  f,
123
123
  d,
124
- O,
124
+ k,
125
125
  x,
126
126
  g
127
- ]), N = e(() => {
128
- h(o), _(void 0), b(!1), S([]), T(!1), D(c), j(!1), k(!1);
127
+ ]), I = e(() => {
128
+ h(o), _(void 0), b(!1), S([]), E(!1), O(c), M(!1), A(!1);
129
129
  }, [c, o]);
130
130
  return {
131
131
  folderItems: m,
132
132
  selectedFolderPath: g,
133
133
  setSelectedFolderPath: _,
134
- handleCreateFolder: ie,
135
- hasExistingPublicationInFolder: re,
136
- hasWriteAccess: g ? s(g) : !0,
134
+ handleCreateFolder: P,
135
+ hasExistingPublicationInFolder: N,
136
+ hasWriteAccess: !g || s(g),
137
137
  isSubmitting: v,
138
- hasSubmitError: ee,
139
- handleSubmit: M,
140
- reset: N,
138
+ hasSubmitError: y,
139
+ handleSubmit: F,
140
+ reset: I,
141
141
  rules: x,
142
142
  setRules: S,
143
- author: E,
144
- setAuthor: ne,
145
- publishCredentials: O,
146
- setPublishCredentials: k,
147
- isRulesLoading: te,
148
- hasRulesLoadError: w
143
+ author: D,
144
+ setAuthor: te,
145
+ publishCredentials: k,
146
+ setPublishCredentials: A,
147
+ isRulesLoading: C,
148
+ hasRulesLoadError: T
149
+ };
150
+ }, J = /* @__PURE__ */ function(e) {
151
+ return e.Main = "main", e.ChangeFolder = "change-folder", e;
152
+ }({}), de = ({ isOpen: e, selectedFolderPath: n, onSelectedFolderPathChange: r }) => {
153
+ let [i, o] = a(J.Main), [s, c] = a();
154
+ return t(() => {
155
+ e && o(J.Main);
156
+ }, [e]), {
157
+ view: i,
158
+ pendingFolderPath: s,
159
+ setPendingFolderPath: c,
160
+ openFolderView: () => {
161
+ c(n), o(J.ChangeFolder);
162
+ },
163
+ backToMain: () => o(J.Main),
164
+ selectFolder: () => {
165
+ s != null && r(s), o(J.Main);
166
+ }
149
167
  };
150
- }, oe = (e, t) => {
168
+ }, Y = (e, t) => {
151
169
  let n = t.trim().toLowerCase();
152
170
  return n ? e.reduce((e, r) => {
153
- let i = r.children ? oe(r.children, t) : void 0;
171
+ let i = r.children ? Y(r.children, t) : void 0;
154
172
  return r.name.toLowerCase().includes(n) ? e.push(r) : i?.length && e.push({
155
173
  ...r,
156
174
  children: i
157
175
  }), e;
158
176
  }, []) : e;
159
- }, z = (e, t) => e.localeCompare(t, void 0, {
177
+ }, X = (e, t) => e.localeCompare(t, void 0, {
160
178
  sensitivity: "base",
161
179
  numeric: !0
162
- }), se = (e) => [...e].sort((e, t) => z(e.name, t.name)).map((e) => e.children ? {
180
+ }), fe = (e) => [...e].sort((e, t) => X(e.name, t.name)).map((e) => e.children ? {
163
181
  ...e,
164
- children: se(e.children)
165
- } : e), B = (e, t, n) => {
182
+ children: fe(e.children)
183
+ } : e), Z = (e, t, n) => {
166
184
  let [r, ...i] = t;
167
185
  if (r == null) return e;
168
186
  let a = [...n, r], o = e.find((e) => e.name === r);
169
187
  return o ? i.length ? e.map((e) => e === o ? {
170
188
  ...e,
171
- children: B(e.children ?? [], i, a)
189
+ children: Z(e.children ?? [], i, a)
172
190
  } : e) : e : [...e, {
173
191
  path: a,
174
192
  name: r,
175
- children: i.length ? B([], i, a) : void 0
193
+ children: i.length ? Z([], i, a) : void 0
176
194
  }];
177
- }, ce = (e, t) => t.reduce((e, t) => t.length ? B(e, t, []) : e, e), V = (e) => e.flatMap((e) => [e.path.join("/"), ...e.children ? V(e.children) : []]), H = (e) => e.join("/"), U = (e) => e.split("/").filter(Boolean), W = (e) => e.map((e) => {
178
- let t = H(e.path);
195
+ }, Q = (e, t) => t.reduce((e, t) => t.length ? Z(e, t, []) : e, e), pe = (e) => e.flatMap((e) => [e.path.join("/"), ...e.children ? pe(e.children) : []]), $ = (e) => e.join("/"), me = (e) => e.split("/").filter(Boolean), he = (e, t) => me(e).at(-1) ?? t, ge = (e) => e.map((e) => {
196
+ let t = $(e.path);
179
197
  return {
180
198
  path: t,
181
199
  name: e.name,
182
200
  folderId: t,
183
- nodeType: u.FOLDER,
184
- items: e.children ? W(e.children) : void 0
201
+ nodeType: f.FOLDER,
202
+ items: e.children ? ge(e.children) : void 0
185
203
  };
186
- }), G = /[/\\:;,={}&"]/, K = (e, t, n) => {
204
+ }), _e = /[/\\:;,={}&"]/, ve = (e, t, n) => {
187
205
  let r = e.trim();
188
- return r ? r.includes("..") || G.test(r) ? n.invalid : t.some((e) => e.toLowerCase() === r.toLowerCase()) ? n.duplicate : null : n.empty;
189
- }, le = (e, t) => {
206
+ return r ? r.includes("..") || _e.test(r) ? n.invalid : t.some((e) => e.toLowerCase() === r.toLowerCase()) ? n.duplicate : null : n.empty;
207
+ }, ye = (e, t) => {
190
208
  let n = new Set(t.map((e) => e.toLowerCase()));
191
209
  if (!n.has(e.toLowerCase())) return e;
192
210
  let r = 2;
193
211
  for (; n.has(`${e} ${r}`.toLowerCase());) r += 1;
194
212
  return `${e} ${r}`;
195
- }, ue = (e, t) => {
213
+ }, be = (e, t) => {
196
214
  if (t.length === 0) return e.map((e) => e.name);
197
- let n = H(t), r = (e) => {
215
+ let n = $(t), r = (e) => {
198
216
  for (let t of e) {
199
- if (H(t.path) === n) return t;
217
+ if ($(t.path) === n) return t;
200
218
  let e = t.children ? r(t.children) : void 0;
201
219
  if (e) return e;
202
220
  }
203
221
  };
204
222
  return (r(e)?.children ?? []).map((e) => e.name);
205
- }, q = {
206
- dialog: "_dialog_jqcm2_5",
207
- error: "_error_jqcm2_14",
208
- selectField: "_selectField_jqcm2_28",
209
- selectFieldOpen: "_selectFieldOpen_jqcm2_40"
210
- }, J = 20, Y = 200, de = 8, fe = (e) => {
223
+ }, xe = {
224
+ sheet: "_sheet_1jbwn_3",
225
+ inline: "_inline_1jbwn_7",
226
+ selectField: "_selectField_1jbwn_21",
227
+ selectFieldOpen: "_selectFieldOpen_1jbwn_33"
228
+ }, Se = 20, Ce = 200, we = 8, Te = (e) => {
211
229
  let t = e.trim();
212
- if (t.length === 0 || t.length > Y) return !1;
230
+ if (t.length === 0 || t.length > Ce) return !1;
213
231
  try {
214
232
  return new RegExp(t) instanceof RegExp;
215
233
  } catch {
216
234
  return !1;
217
235
  }
218
- }, pe = ({ sourceOptions: e, onSave: o, onCancel: s, disabled: c = !1, maxTargets: l = J, labels: u = {}, errorClassName: f = "dial-small-text", styles: g = {} }) => {
219
- let _ = {
220
- ...T({
221
- "--pare-mobile-bg": g.colors?.mobileBackground,
222
- "--pare-bg": g.colors?.background,
223
- "--pare-error-text": g.colors?.errorText,
224
- "--pare-select-border": g.colors?.selectBorder,
225
- "--pare-select-border-hover": g.colors?.selectBorderHover,
226
- "--pare-select-border-open": g.colors?.selectBorderOpen,
227
- "--pare-select-border-focus": g.colors?.selectBorderFocus
236
+ }, Ee = ({ sourceOptions: e, onSave: s, onCancel: c, disabled: l = !1, maxTargets: u = Se, labels: d = {}, styles: f = {} }) => {
237
+ let p = R(), m = {
238
+ ...ne({
239
+ "--pare-mobile-bg": f.colors?.mobileBackground,
240
+ "--pare-bg": f.colors?.background,
241
+ "--pare-select-border": f.colors?.selectBorder,
242
+ "--pare-select-border-hover": f.colors?.selectBorderHover,
243
+ "--pare-select-border-open": f.colors?.selectBorderOpen,
244
+ "--pare-select-border-focus": f.colors?.selectBorderFocus
228
245
  }),
229
- ...g.cssVars
230
- }, { sourceLabel: v = "Source", sourcePlaceholder: y = "Select...", functionLabel: b = "Function", equalOptionLabel: x = "Equal", containOptionLabel: S = "Contain", regexOptionLabel: C = "Regex", targetsLabel: D = "Targets", targetsPlaceholder: A = "Add a target", targetsHintLabel: j = "Press Enter or comma to add a target.", patternLabel: ne = "Pattern", patternPlaceholder: re = "Enter a regular expression", invalidRegexError: ie = "Enter a valid regular expression.", requiredFieldError: N = "This field is required.", targetsRequiredError: ae = "Add at least one target.", saveLabel: P = "Save", cancelLabel: F = "Cancel", dialogAriaLabel: I = "Add access rule" } = u, L = n(), R = n(), oe = n(), z = n(), se = i(null);
246
+ ...f.cssVars
247
+ }, { sourceLabel: h = "Source", sourcePlaceholder: _ = "Select...", functionLabel: y = "Function", equalOptionLabel: b = "Equal", containOptionLabel: x = "Contain", regexOptionLabel: S = "Regex", targetsLabel: w = "Targets", targetsPlaceholder: T = "Add a target", targetsHintLabel: E = "Press Enter or comma to add a target.", patternLabel: D = "Pattern", patternPlaceholder: O = "Enter a regular expression", invalidRegexError: k = "Enter a valid regular expression.", requiredFieldError: j = "This field is required.", targetsRequiredError: M = "Add at least one target.", saveLabel: te = "Save", cancelLabel: P = "Cancel", dialogAriaLabel: F = "Add access rule" } = d, re = n(), ie = n(), ae = n(), oe = n(), se = i(null);
231
248
  t(() => {
232
- se.current?.focus();
233
- }, []);
234
- let [B, ce] = a(), [V, H] = a(), [U, W] = a([]), [G, K] = a(""), [le, ue] = a(!1), [Y, pe] = a(""), [X, me] = a(!1), [Z, he] = a(!1), Q = E(q.selectField, le && q.selectFieldOpen), ge = E(q.selectField, X && q.selectFieldOpen), _e = r(() => e.map((e) => ({
249
+ p || se.current?.focus();
250
+ }, [p]);
251
+ let [H, W] = a(), [G, ce] = a(), [K, le] = a([]), [q, ue] = a(""), [J, de] = a(!1), [Y, X] = a(""), [fe, Z] = a(!1), [Q, pe] = a(!1), $ = L(xe.selectField, J && xe.selectFieldOpen), me = L(xe.selectField, fe && xe.selectFieldOpen), he = r(() => e.map((e) => ({
235
252
  value: e,
236
253
  label: e,
237
- labelNode: Y.trim() ? /* @__PURE__ */ O(p, {
254
+ labelNode: Y.trim() ? /* @__PURE__ */ B(v, {
238
255
  text: e,
239
256
  query: Y,
240
257
  maxLines: 1
241
258
  }) : void 0
242
- })), [e, Y]), ve = r(() => [
259
+ })), [e, Y]), ge = r(() => [
243
260
  {
244
- value: M.Equal,
245
- label: x
261
+ value: U.Equal,
262
+ label: b
246
263
  },
247
264
  {
248
- value: M.Contain,
249
- label: S
265
+ value: U.Contain,
266
+ label: x
250
267
  },
251
268
  {
252
- value: M.Regex,
253
- label: C
269
+ value: U.Regex,
270
+ label: S
254
271
  }
255
272
  ], [
273
+ b,
256
274
  x,
257
- S,
258
- C
259
- ]), ye = V === M.Regex, $ = fe(G), be = B != null && V != null && (ye ? $ : U.length > 0);
260
- return /* @__PURE__ */ k("div", {
275
+ S
276
+ ]), _e = G === U.Regex, ve = Te(q), ye = H != null && G != null && (_e ? ve : K.length > 0), be = (e) => {
277
+ W(Array.isArray(e) ? e[0] : e), de(!1);
278
+ }, Ce = (e) => {
279
+ let t = Array.isArray(e) ? e[0] : e;
280
+ G === U.Regex != (t === U.Regex) && (le([]), ue("")), ce(t), Z(!1);
281
+ }, Ee = (e) => {
282
+ let t = [];
283
+ for (let n of e) {
284
+ let e = n.trim();
285
+ if (!(e.length === 0 || t.includes(e)) && (t.push(e), t.length >= u)) break;
286
+ }
287
+ le(t);
288
+ }, De = () => {
289
+ !ye || H == null || G == null ? pe(!0) : s({
290
+ source: H,
291
+ function: G,
292
+ targets: _e ? [q.trim()] : K
293
+ });
294
+ }, Oe = (q.length > 0 || Q) && !ve, ke = (e) => {
295
+ e.key === "Escape" && (e.stopPropagation(), c());
296
+ }, Ae = /* @__PURE__ */ V(z, { children: [
297
+ /* @__PURE__ */ B(A, {
298
+ id: ie,
299
+ labelProps: { label: h },
300
+ options: he,
301
+ value: H,
302
+ onChange: be,
303
+ placeholder: _,
304
+ searchable: e.length > we,
305
+ searchPlaceholder: _,
306
+ onSearchQueryChange: X,
307
+ disabled: l,
308
+ open: J,
309
+ onOpenChange: de,
310
+ fieldClassName: $,
311
+ invalid: Q && H == null,
312
+ error: Q && H == null ? j : void 0
313
+ }),
314
+ /* @__PURE__ */ B(A, {
315
+ labelProps: { label: y },
316
+ id: ae,
317
+ options: ge,
318
+ value: G,
319
+ onChange: Ce,
320
+ placeholder: y,
321
+ disabled: l,
322
+ open: fe,
323
+ onOpenChange: Z,
324
+ fieldClassName: me,
325
+ invalid: Q && G == null,
326
+ error: Q && G == null ? j : void 0
327
+ }),
328
+ _e ? /* @__PURE__ */ B(ee, {
329
+ id: re,
330
+ labelProps: { label: D },
331
+ placeholder: O,
332
+ value: q,
333
+ onChange: (e) => ue(e ?? ""),
334
+ error: Oe ? k : void 0,
335
+ disabled: l
336
+ }) : /* @__PURE__ */ B(N, {
337
+ id: oe,
338
+ labelProps: { label: w },
339
+ placeholder: T,
340
+ caption: Q && K.length === 0 ? void 0 : E,
341
+ error: Q && K.length === 0 ? M : void 0,
342
+ invalid: Q && K.length === 0,
343
+ value: K,
344
+ onChange: Ee,
345
+ disabled: l,
346
+ tagClassName: I
347
+ }),
348
+ /* @__PURE__ */ V("div", {
349
+ className: "mt-auto flex justify-end gap-2 desktop:mt-2",
350
+ children: [/* @__PURE__ */ B(g, {
351
+ label: P,
352
+ onClick: c,
353
+ disabled: l
354
+ }), /* @__PURE__ */ B(C, {
355
+ label: te,
356
+ onClick: De,
357
+ disabled: l
358
+ })]
359
+ })
360
+ ] });
361
+ return p ? /* @__PURE__ */ B(o, {
362
+ open: !0,
363
+ onClose: c,
364
+ ariaLabel: F,
365
+ style: m,
366
+ className: xe.sheet,
367
+ bodyClassName: "flex flex-col gap-3 p-4",
368
+ children: Ae
369
+ }) : /* @__PURE__ */ B("div", {
261
370
  ref: se,
262
- role: "dialog",
263
- "aria-modal": "true",
264
- "aria-label": I,
371
+ role: "group",
372
+ "aria-label": F,
265
373
  tabIndex: -1,
266
- onKeyDown: (e) => {
267
- e.key === "Escape" && (e.stopPropagation(), s());
268
- },
269
- style: _,
270
- className: E("fixed inset-0 z-[60] flex flex-col gap-3 overflow-y-auto p-4", "desktop:static desktop:z-auto desktop:flex-none desktop:overflow-visible desktop:rounded-lg desktop:p-3", q.dialog),
271
- children: [
272
- /* @__PURE__ */ O(ee, {
273
- id: R,
274
- labelProps: { label: v },
275
- options: _e,
276
- value: B,
277
- onChange: (e) => {
278
- ce(Array.isArray(e) ? e[0] : e), ue(!1);
279
- },
280
- placeholder: y,
281
- searchable: e.length > de,
282
- searchPlaceholder: y,
283
- onSearchQueryChange: pe,
284
- disabled: c,
285
- open: le,
286
- onOpenChange: ue,
287
- fieldClassName: Q,
288
- invalid: Z && B == null,
289
- error: Z && B == null ? N : void 0
290
- }),
291
- /* @__PURE__ */ O(ee, {
292
- labelProps: { label: b },
293
- id: oe,
294
- options: ve,
295
- value: V,
296
- onChange: (e) => {
297
- let t = Array.isArray(e) ? e[0] : e;
298
- V === M.Regex != (t === M.Regex) && (W([]), K("")), H(t), me(!1);
299
- },
300
- placeholder: b,
301
- disabled: c,
302
- open: X,
303
- onOpenChange: me,
304
- fieldClassName: ge,
305
- invalid: Z && V == null,
306
- error: Z && V == null ? N : void 0
307
- }),
308
- ye ? /* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O(m, {
309
- id: `${L}-input`,
310
- labelProps: { label: ne },
311
- placeholder: re,
312
- value: G,
313
- onChange: (e) => K(e ?? ""),
314
- invalid: (G.length > 0 || Z) && !$,
315
- "aria-describedby": (G.length > 0 || Z) && !$ ? L : void 0,
316
- disabled: c
317
- }), (G.length > 0 || Z) && !$ && /* @__PURE__ */ O("span", {
318
- id: L,
319
- role: "alert",
320
- className: E("mt-1 block", f, q.error),
321
- children: ie
322
- })] }) : /* @__PURE__ */ O(te, {
323
- id: z,
324
- labelProps: { label: D },
325
- placeholder: A,
326
- caption: Z && U.length === 0 ? void 0 : j,
327
- error: Z && U.length === 0 ? ae : void 0,
328
- invalid: Z && U.length === 0,
329
- value: U,
330
- onChange: (e) => {
331
- let t = [];
332
- for (let n of e) {
333
- let e = n.trim();
334
- if (!(e.length === 0 || t.includes(e)) && (t.push(e), t.length >= l)) break;
335
- }
336
- W(t);
337
- },
338
- disabled: c,
339
- tagClassName: w
340
- }),
341
- /* @__PURE__ */ k("div", {
342
- className: "mt-auto flex justify-end gap-2 desktop:mt-2",
343
- children: [/* @__PURE__ */ O(d, {
344
- label: F,
345
- onClick: s,
346
- disabled: c
347
- }), /* @__PURE__ */ O(h, {
348
- label: P,
349
- onClick: () => {
350
- if (!be || B == null || V == null) {
351
- he(!0);
352
- return;
353
- }
354
- o({
355
- source: B,
356
- function: V,
357
- targets: ye ? [G.trim()] : U
358
- });
359
- },
360
- disabled: c
361
- })]
362
- })
363
- ]
374
+ onKeyDown: ke,
375
+ style: m,
376
+ className: L("flex flex-none flex-col gap-3 rounded-lg p-3", xe.inline),
377
+ children: Ae
364
378
  });
365
- }, X = {
379
+ }, De = {
366
380
  ruleRow: "_ruleRow_nx0en_1",
367
381
  heading: "_heading_nx0en_5",
368
382
  hint: "_hint_nx0en_9",
369
383
  loading: "_loading_nx0en_13",
370
384
  ruleText: "_ruleText_nx0en_17"
371
- }, me = 20, Z = (e, t) => e === M.Equal ? t.equal : e === M.Contain ? t.contain : t.regex, he = ({ rules: e, onRulesChange: r, sourceOptions: s, folderName: u, disabled: p = !1, isLoading: m = !1, hasLoadError: h = !1, maxRules: y = me, maxTargetsPerRule: ee, labels: b = {}, headingClassName: S = "dial-body-semi-text", hintClassName: te = "dial-small-text", loadingClassName: C = "dial-small-text", ruleTextClassName: w = "dial-small-text", ruleSourceClassName: D = "dial-small-semi-text", styles: A = {} }) => {
372
- let re = {
373
- ...T({
374
- "--par-rule-bg": A.colors?.ruleBackground,
375
- "--par-heading-text": A.colors?.headingText,
376
- "--par-hint-text": A.colors?.hintText,
377
- "--par-loading-text": A.colors?.loadingText,
378
- "--par-rule-text": A.colors?.ruleText
385
+ }, Oe = 20, ke = (e, t) => e === U.Equal ? t.equal : e === U.Contain ? t.contain : t.regex, Ae = ({ rules: e, onRulesChange: r, sourceOptions: o, folderName: c, disabled: l = !1, isLoading: f = !1, hasLoadError: p = !1, maxRules: m = Oe, maxTargetsPerRule: h, labels: v = {}, headingClassName: ee = "dial-body-semi-text", hintClassName: y = "dial-small-text", loadingClassName: S = "dial-small-text", ruleTextClassName: C = "dial-small-text", ruleSourceClassName: D = "dial-small-semi-text", styles: O = {} }) => {
386
+ let k = {
387
+ ...ne({
388
+ "--par-rule-bg": O.colors?.ruleBackground,
389
+ "--par-heading-text": O.colors?.headingText,
390
+ "--par-hint-text": O.colors?.hintText,
391
+ "--par-loading-text": O.colors?.loadingText,
392
+ "--par-rule-text": O.colors?.ruleText
379
393
  }),
380
- ...A.cssVars
381
- }, { heading: ie = "Allow access if all match", folderScopeHint: M = "These rules apply to \"{folder}\". Selecting another folder loads that folder's own rules instead.", noFolderScopeHint: N = "Access rules apply to the destination folder — pick a folder above to set its rules.", rulesWithoutFolderWarning: ae = "These rules have no destination yet. Select a folder above to apply them.", maxRulesReachedLabel: P = "Rule limit reached ({max}). Remove a rule to add another.", addRuleLabel: F = "Add rule", clearAllLabel: I = "Clear all", orSeparatorLabel: L = "Or", removeRuleAriaLabelTemplate: R = "Remove rule for {source}: {targets}", equalFunctionLabel: oe = "Equal", containFunctionLabel: z = "Contain", regexFunctionLabel: se = "Regex", loadingLabel: B = "Loading existing rules…", loadErrorLabel: ce = "Couldn't load existing rules for this folder. You can still add rules manually.", ruleAddedAnnouncement: V = "Rule added.", ruleRemovedAnnouncement: H = "Rule removed.", rulesClearedAnnouncement: U = "All rules cleared.", rulesLoadedAnnouncement: W = "Existing rules loaded for the selected folder.", editorLabels: G } = b, K = n(), [le, ue] = a(!1), [q, J] = a(""), Y = i(null), de = i(m);
394
+ ...O.cssVars
395
+ }, { heading: A = "Allow access if all match", folderScopeHint: j = "These rules apply to \"{folder}\". Selecting another folder loads that folder's own rules instead.", noFolderScopeHint: te = "Access rules apply to the destination folder — pick a folder above to set its rules.", rulesWithoutFolderWarning: N = "These rules have no destination yet. Select a folder above to apply them.", maxRulesReachedLabel: P = "Rule limit reached ({max}). Remove a rule to add another.", addRuleLabel: F = "Add rule", clearAllLabel: I = "Clear all", orSeparatorLabel: R = "Or", removeRuleAriaLabelTemplate: z = "Remove rule for {source}: {targets}", equalFunctionLabel: re = "Equal", containFunctionLabel: ie = "Contain", regexFunctionLabel: se = "Regex", loadingLabel: H = "Loading existing rules…", loadErrorLabel: U = "Couldn't load existing rules for this folder. You can still add rules manually.", ruleAddedAnnouncement: W = "Rule added.", ruleRemovedAnnouncement: G = "Rule removed.", rulesClearedAnnouncement: ce = "All rules cleared.", rulesLoadedAnnouncement: K = "Existing rules loaded for the selected folder.", editorLabels: le } = v, q = n(), [ue, J] = a(!1), [de, Y] = a(""), X = i(null), fe = i(f);
382
396
  t(() => {
383
- de.current && !m && e.length > 0 && J(W), de.current = m;
397
+ fe.current && !f && e.length > 0 && Y(K), fe.current = f;
384
398
  }, [
385
- m,
399
+ f,
386
400
  e,
387
- W
401
+ K
388
402
  ]);
389
- let fe = () => {
390
- Y.current = document.activeElement, ue(!0);
391
- }, he = () => {
392
- ue(!1), Y.current?.focus?.();
393
- }, Q = (t) => {
394
- r([...e, t]), J(V), he();
395
- }, ge = (t) => {
396
- r(e.filter((e, n) => n !== t)), J(H);
397
- }, _e = () => {
398
- r([]), J(U);
399
- }, ve = {
400
- equal: oe,
401
- contain: z,
403
+ let Z = () => {
404
+ X.current = document.activeElement, J(!0);
405
+ }, Q = () => {
406
+ J(!1), X.current?.focus?.();
407
+ }, pe = (t) => {
408
+ r([...e, t]), Y(W), Q();
409
+ }, $ = (t) => {
410
+ r(e.filter((e, n) => n !== t)), Y(G);
411
+ }, me = () => {
412
+ r([]), Y(ce);
413
+ }, he = {
414
+ equal: re,
415
+ contain: ie,
402
416
  regex: se
403
- }, ye = e.length >= y, $ = p || ye, be = u != null && u !== "";
404
- return /* @__PURE__ */ k("div", {
417
+ }, ge = e.length >= m, _e = l || ge, ve = c != null && c !== "";
418
+ return /* @__PURE__ */ V("div", {
405
419
  role: "group",
406
- "aria-labelledby": K,
407
- style: re,
408
- className: E(p && "pointer-events-none opacity-60"),
420
+ "aria-labelledby": q,
421
+ style: k,
422
+ className: L(l && "pointer-events-none opacity-60"),
409
423
  children: [
410
- /* @__PURE__ */ O("span", {
411
- role: "status",
412
- "aria-live": "polite",
413
- className: "sr-only",
414
- children: q
424
+ /* @__PURE__ */ B(b, {
425
+ visuallyHidden: !0,
426
+ as: x.Span,
427
+ children: de
415
428
  }),
416
- /* @__PURE__ */ k("div", {
429
+ /* @__PURE__ */ V("div", {
417
430
  className: "mb-1 flex items-center justify-between gap-2",
418
- children: [/* @__PURE__ */ O("div", {
419
- id: K,
420
- className: E(S, X.heading),
421
- children: ie
422
- }), e.length > 0 && /* @__PURE__ */ O(d, {
423
- variant: o.Primary,
431
+ children: [/* @__PURE__ */ B("div", {
432
+ id: q,
433
+ className: L(ee, De.heading),
434
+ children: A
435
+ }), e.length > 0 && /* @__PURE__ */ B(g, {
436
+ variant: s.Primary,
424
437
  label: I,
425
- onClick: _e,
426
- disabled: p
438
+ onClick: me,
439
+ disabled: l
427
440
  })]
428
441
  }),
429
- /* @__PURE__ */ O("p", {
430
- className: E("mb-2", te, X.hint),
431
- children: be ? M.replace("{folder}", u) : N
442
+ /* @__PURE__ */ B("p", {
443
+ className: L("mb-2", y, De.hint),
444
+ children: ve ? j.replace("{folder}", c) : te
432
445
  }),
433
- e.length > 0 && !be && /* @__PURE__ */ O("div", {
446
+ e.length > 0 && !ve && /* @__PURE__ */ B("div", {
434
447
  className: "mb-2",
435
- children: /* @__PURE__ */ O(g, {
436
- type: _.SectionMessage,
437
- variant: v.Warning,
438
- message: ae
448
+ children: /* @__PURE__ */ B(w, {
449
+ type: T.SectionMessage,
450
+ variant: E.Warning,
451
+ message: N
439
452
  })
440
453
  }),
441
- m && /* @__PURE__ */ k("div", {
442
- className: E("mb-2 flex items-center gap-2", C, X.loading),
443
- children: [/* @__PURE__ */ O(x, {
454
+ f && /* @__PURE__ */ V("div", {
455
+ className: L("mb-2 flex items-center gap-2", S, De.loading),
456
+ children: [/* @__PURE__ */ B(M, {
444
457
  size: 16,
445
- ariaLabel: B
446
- }), /* @__PURE__ */ O("span", { children: B })]
458
+ ariaLabel: H
459
+ }), /* @__PURE__ */ B("span", { children: H })]
447
460
  }),
448
- h && /* @__PURE__ */ O("div", {
461
+ p && /* @__PURE__ */ B("div", {
449
462
  className: "mb-2",
450
- children: /* @__PURE__ */ O(g, {
451
- type: _.SectionMessage,
452
- variant: v.Warning,
453
- message: ce
463
+ children: /* @__PURE__ */ B(w, {
464
+ type: T.SectionMessage,
465
+ variant: E.Warning,
466
+ message: U
454
467
  })
455
468
  }),
456
- e.length > 0 && /* @__PURE__ */ O("ul", {
469
+ e.length > 0 && /* @__PURE__ */ B("ul", {
457
470
  className: "mb-3 flex flex-col gap-2",
458
471
  children: e.map((e, t) => {
459
- let n = e.targets.join(` ${L} `), r = R.replace("{source}", e.source).replace("{targets}", n);
460
- return /* @__PURE__ */ k("li", {
461
- className: E("flex items-center justify-between gap-2 rounded-lg px-3 py-2", X.ruleRow),
462
- children: [/* @__PURE__ */ k("span", {
463
- className: E("truncate", w, X.ruleText),
472
+ let n = e.targets.join(` ${R} `), r = z.replace("{source}", e.source).replace("{targets}", n);
473
+ return /* @__PURE__ */ V("li", {
474
+ className: L("flex items-center justify-between gap-2 rounded-lg px-3 py-2", De.ruleRow),
475
+ children: [/* @__PURE__ */ V("span", {
476
+ className: L("truncate", C, De.ruleText),
464
477
  children: [
465
- /* @__PURE__ */ O("span", {
478
+ /* @__PURE__ */ B("span", {
466
479
  className: D,
467
480
  children: e.source
468
481
  }),
469
482
  " ",
470
- Z(e.function, ve),
483
+ ke(e.function, he),
471
484
  ": ",
472
485
  n
473
486
  ]
474
- }), /* @__PURE__ */ O(f, {
475
- icon: /* @__PURE__ */ O(ne, {
476
- size: c.SM,
487
+ }), /* @__PURE__ */ B(_, {
488
+ icon: /* @__PURE__ */ B(oe, {
489
+ size: u.SM,
477
490
  "aria-hidden": !0,
478
- stroke: l
491
+ stroke: d
479
492
  }),
480
493
  "aria-label": r,
481
- onClick: () => ge(t),
482
- disabled: p
494
+ onClick: () => $(t),
495
+ disabled: l
483
496
  })]
484
497
  }, t);
485
498
  })
486
499
  }),
487
- le && /* @__PURE__ */ O(pe, {
488
- sourceOptions: s,
489
- onSave: Q,
490
- onCancel: he,
491
- disabled: p,
492
- maxTargets: ee,
493
- labels: G,
494
- styles: A.editor
500
+ ue && /* @__PURE__ */ B(Ee, {
501
+ sourceOptions: o,
502
+ onSave: pe,
503
+ onCancel: Q,
504
+ disabled: l,
505
+ maxTargets: h,
506
+ labels: le,
507
+ styles: O.editor
495
508
  }),
496
- /* @__PURE__ */ O("div", {
509
+ /* @__PURE__ */ B("div", {
497
510
  className: "flex flex-wrap items-center gap-2",
498
- children: /* @__PURE__ */ O(d, {
511
+ children: /* @__PURE__ */ B(g, {
499
512
  label: F,
500
- iconBefore: /* @__PURE__ */ O(j, {
501
- size: c.SM,
513
+ iconBefore: /* @__PURE__ */ B(ae, {
514
+ size: u.SM,
502
515
  "aria-hidden": !0,
503
- stroke: l
516
+ stroke: d
504
517
  }),
505
- onClick: fe,
506
- disabled: $
518
+ onClick: Z,
519
+ disabled: _e
507
520
  })
508
521
  }),
509
- ye && /* @__PURE__ */ O("p", {
510
- className: E("mt-2", te, X.hint),
511
- children: P.replace("{max}", String(y))
522
+ ge && /* @__PURE__ */ B("p", {
523
+ className: L("mt-2", y, De.hint),
524
+ children: P.replace("{max}", String(m))
512
525
  })
513
526
  ]
514
527
  });
515
- }, Q = {
528
+ }, je = {
516
529
  currentBadge: "_currentBadge_d0adf_1",
517
530
  sharedCredentialsBadge: "_sharedCredentialsBadge_d0adf_7",
518
531
  version: "_version_d0adf_13",
519
532
  date: "_date_d0adf_17",
520
533
  emptyState: "_emptyState_d0adf_21",
521
534
  stripedRow: "_stripedRow_d0adf_25"
522
- }, ge = ({ entries: e, currentVersion: t, isLoading: n = !1, hasError: r = !1, versionPrefix: i = "Version", currentBadgeLabel: a = "Current", sharedCredentialsLabel: o = "Shared credentials", emptyStateLabel: s = "Not published to this folder yet — this will be the first version here.", loadingLabel: c = "Loading history…", errorLabel: l = "Failed to load publish history.", versionClassName: u = "dial-small-text", dateClassName: d = "dial-small-text", emptyStateClassName: f = "dial-small-text", colors: p }) => {
523
- let m = T({
535
+ }, Me = ({ entries: e, currentVersion: t, isLoading: n = !1, hasError: r = !1, versionPrefix: i = "Version", currentBadgeLabel: a = "Current", sharedCredentialsLabel: o = "Shared credentials", emptyStateLabel: s = "Not published to this folder yet — this will be the first version here.", loadingLabel: c = "Loading history…", errorLabel: l = "Failed to load publish history.", versionClassName: u = "dial-small-text", dateClassName: d = "dial-small-text", emptyStateClassName: f = "dial-small-text", colors: p }) => {
536
+ let m = ne({
524
537
  "--phl-badge-border": p?.currentBadgeBorder,
525
538
  "--phl-badge-bg": p?.currentBadgeBackground,
526
539
  "--phl-badge-text": p?.currentBadgeText,
@@ -531,356 +544,473 @@ var M = /* @__PURE__ */ function(e) {
531
544
  "--phl-date-text": p?.dateText,
532
545
  "--phl-empty-text": p?.emptyStateText,
533
546
  "--phl-striped-bg": p?.stripedBackground
534
- }), h = E(f, Q.emptyState);
535
- return n ? /* @__PURE__ */ O("p", {
536
- style: m,
537
- className: h,
538
- children: c
539
- }) : r ? /* @__PURE__ */ O("p", {
540
- style: m,
541
- className: h,
542
- role: "alert",
543
- children: l
544
- }) : e.length === 0 ? /* @__PURE__ */ O("p", {
545
- style: m,
546
- className: h,
547
- children: s
548
- }) : /* @__PURE__ */ O("ul", {
547
+ }), h = L(f, je.emptyState);
548
+ if (n || r || e.length === 0) {
549
+ let e = s;
550
+ return n ? e = c : r && (e = l), /* @__PURE__ */ B(b, {
551
+ as: x.P,
552
+ style: m,
553
+ className: h,
554
+ children: e
555
+ });
556
+ }
557
+ return /* @__PURE__ */ B("ul", {
549
558
  style: m,
550
- children: e.map((e, n) => /* @__PURE__ */ k("li", {
551
- className: E("flex items-center justify-between gap-2 rounded-lg px-3 py-[11px]", n % 2 == 0 && Q.stripedRow),
552
- children: [/* @__PURE__ */ k("span", {
559
+ children: e.map((e, n) => /* @__PURE__ */ V("li", {
560
+ className: L("flex items-center justify-between gap-2 rounded-lg px-3 py-[11px]", n % 2 == 0 && je.stripedRow),
561
+ children: [/* @__PURE__ */ V("span", {
553
562
  className: "flex min-w-0 items-center gap-2",
554
563
  style: m,
555
564
  children: [
556
- /* @__PURE__ */ k("span", {
557
- className: E(u, Q.version),
565
+ /* @__PURE__ */ V("span", {
566
+ className: L(u, je.version),
558
567
  children: [
559
568
  i,
560
569
  " ",
561
570
  e.version
562
571
  ]
563
572
  }),
564
- e.version === t && /* @__PURE__ */ O(S, {
573
+ e.version === t && /* @__PURE__ */ B(te, {
565
574
  label: a,
566
- className: E("shrink-0 whitespace-nowrap", Q.currentBadge)
575
+ className: L("shrink-0 whitespace-nowrap", je.currentBadge)
567
576
  }),
568
- e.publishCredentials === !0 && /* @__PURE__ */ O(S, {
577
+ e.publishCredentials === !0 && /* @__PURE__ */ B(te, {
569
578
  label: o,
570
- className: E("shrink-0 whitespace-nowrap", Q.sharedCredentialsBadge)
579
+ className: L("shrink-0 whitespace-nowrap", je.sharedCredentialsBadge)
571
580
  })
572
581
  ]
573
- }), /* @__PURE__ */ O("span", {
574
- className: E(d, Q.date),
575
- children: F(e.publishedAt)
582
+ }), /* @__PURE__ */ B("span", {
583
+ className: L(d, je.date),
584
+ children: K(e.publishedAt)
576
585
  })]
577
586
  }, `${e.version}-${n}`))
578
587
  });
579
- }, _e = {
588
+ }, Ne = ":", Pe = (e) => `${Ne}${e}`, Fe = (e) => e?.startsWith(Ne) ? e.slice(1) : void 0, Ie = (e) => [Pe(e.rootKey), ...e.path], Le = (e) => {
589
+ let [t, ...n] = e, r = Fe(t);
590
+ return r == null ? void 0 : {
591
+ rootKey: r,
592
+ path: n
593
+ };
594
+ }, Re = (e, t) => e.map((e) => ({
595
+ ...e,
596
+ path: [t, ...e.path],
597
+ children: e.children ? Re(e.children, t) : void 0
598
+ })), ze = (e) => e.map((e) => {
599
+ let t = Pe(e.key);
600
+ return {
601
+ path: [t],
602
+ name: e.label,
603
+ children: Re(fe(e.items), t)
604
+ };
605
+ }), Be = (e) => e.map((e) => Pe(e.key)), Ve = (e, t) => {
606
+ let n = /* @__PURE__ */ new Set();
607
+ for (let r of e) {
608
+ let e = Pe(r.key);
609
+ for (let i of t(r) ?? []) n.add(i ? `${e}/${i}` : e);
610
+ }
611
+ return n;
612
+ }, He = (e, t) => {
613
+ let n = new Map(e.map((e) => [e.key, /* @__PURE__ */ new Set()]));
614
+ for (let e of t) {
615
+ let [t, ...r] = e.split("/"), i = Fe(t);
616
+ i != null && r.length !== 0 && n.get(i)?.add($(r));
617
+ }
618
+ return n;
619
+ }, Ue = {
580
620
  divider: "_divider_1gs31_1",
581
621
  tree: "_tree_1gs31_17"
582
- }, ve = "data-cancel-creating-folder", ye = ({ items: e, selectedPath: n, onSelectedPathChange: o, onCreateFolder: s, searchQuery: u, disabled: f = !1, createFolderLabel: p = "Create new folder", cancelCreatingFolderLabel: m = "Cancel", addSiblingFolderLabel: h = "Add sibling", addChildFolderLabel: g = "Add child", newFolderDefaultName: _ = "New folder", noResultsLabel: v = "No folders match \"{query}\".", emptyFolderNameError: y = "Folder name cannot be empty.", invalidFolderNameError: ee = "Folder name contains invalid characters.", duplicateFolderNameError: b = "A folder with this name already exists.", rootLabel: x = "Organization", expandedPaths: S, onExpandedPathsChange: te, loadingPaths: C, styles: w = {} }) => {
583
- let D = {
584
- ...T({ "--pft-divider": w.colors?.divider }),
585
- ...w.cssVars
586
- }, [ne, M] = a(() => new Set(n?.map((e, t) => H(n.slice(0, t + 1))) ?? [])), N = S ?? ne, ae = (e) => {
622
+ }, We = "data-cancel-creating-folder", Ge = "", Ke = [], qe = ({ items: e = Ke, selectedPath: n, onSelectedPathChange: o, onCreateFolder: s, roots: c, destination: l, onDestinationChange: f, onCreateDestinationFolder: p, searchQuery: m, disabled: h = !1, createFolderLabel: _ = "Create new folder", cancelCreatingFolderLabel: v = "Cancel", addSiblingFolderLabel: ee = "Add sibling", addChildFolderLabel: y = "Add child", newFolderDefaultName: b = "New folder", noResultsLabel: x = "No folders match \"{query}\".", emptyFolderNameError: S = "Folder name cannot be empty.", invalidFolderNameError: C = "Folder name contains invalid characters.", duplicateFolderNameError: w = "A folder with this name already exists.", rootLabel: T = "Organization", expandedPaths: E, onExpandedPathsChange: D, loadingPaths: O, styles: k = {} }) => {
623
+ let A = {
624
+ ...ne({ "--pft-divider": k.colors?.divider }),
625
+ ...k.cssVars
626
+ }, j = c != null, M = r(() => c ? ze(c) : e, [c, e]), te = i(M);
627
+ t(() => {
628
+ te.current = M;
629
+ }, [M]);
630
+ let N = r(() => c ? Be(c) : [Ge], [c]), P = n;
631
+ j && (P = l ? Ie(l) : void 0);
632
+ let F = (e) => {
633
+ j ? f?.(e ? Le(e) : void 0) : o?.(e);
634
+ }, [I, R] = a(() => new Set(P?.map((e, t) => $(P.slice(0, t + 1))) ?? [])), z = r(() => c ? /* @__PURE__ */ new Set([...I, ...Ve(c, (e) => e.expandedPaths)]) : void 0, [c, I]) ?? E ?? I, re = r(() => c ? Ve(c, (e) => e.loadingPaths) : O, [c, O]), oe = (e) => {
587
635
  let t = new Set(e);
588
- t.delete(""), te ? te(t) : M(t);
589
- }, [P, F] = a(null), [I, L] = a(_), R = i(null), z = i(!1);
636
+ for (let e of N) t.delete(e);
637
+ if (c) {
638
+ R(t);
639
+ let e = He(c, t);
640
+ for (let t of c) t.onExpandedPathsChange?.(e.get(t.key) ?? /* @__PURE__ */ new Set());
641
+ } else D ? D(t) : R(t);
642
+ }, [U, W] = a(null), [G, ce] = a(b), K = i(null), le = i(!1);
590
643
  t(() => {
591
644
  let e = (e) => {
592
- e.target instanceof Element && e.target.closest(`[${ve}]`) && (z.current = !0);
645
+ e.target instanceof Element && e.target.closest(`[${We}]`) && (le.current = !0);
593
646
  };
594
647
  return document.addEventListener("pointerdown", e, !0), () => document.removeEventListener("pointerdown", e, !0);
595
648
  }, []);
596
- let B = u.trim(), ce = P != null, G = r(() => oe(e, u), [e, u]), q = B.length > 0 && G.length === 0, J = !ce && B.length > 0, Y = r(() => se(J ? G : e), [
597
- J,
598
- G,
599
- e
600
- ]), de = r(() => new Set(["", ...V(Y)]), [Y]), fe = r(() => new Set(["", ...J ? de : N]), [
649
+ let q = m.trim(), ue = U != null, J = r(() => Y(M, m), [M, m]), de = q.length > 0 && J.length === 0, X = !ue && q.length > 0, Z = r(() => {
650
+ let e = X ? J : M;
651
+ return j ? e : fe(e);
652
+ }, [
653
+ X,
601
654
  J,
602
- de,
603
- N
604
- ]), pe = r(() => W(Y), [Y]), X = r(() => J && pe.length === 0 ? [] : [{
605
- path: "",
606
- name: x,
607
- folderId: "",
608
- nodeType: re.FOLDER,
609
- items: pe
655
+ M,
656
+ j
657
+ ]), Q = r(() => /* @__PURE__ */ new Set([...N, ...pe(Z)]), [N, Z]), he = r(() => /* @__PURE__ */ new Set([...N, ...X ? Q : z]), [
658
+ N,
659
+ X,
660
+ Q,
661
+ z
662
+ ]), _e = r(() => ge(Z), [Z]), xe = r(() => X && _e.length === 0 ? [] : j ? _e : [{
663
+ path: Ge,
664
+ name: T,
665
+ folderId: Ge,
666
+ nodeType: se.FOLDER,
667
+ items: _e
610
668
  }], [
611
- pe,
612
- x,
613
- J
614
- ]), me = P ? H(P) : null, Z = {
615
- empty: y,
616
- invalid: ee,
617
- duplicate: b
618
- }, he = (t) => le(q && K(B, [], Z) == null ? B : _, ue(e, t)), Q = (e) => {
619
- F(e), L(he(e)), R.current = null, z.current = !1;
620
- let t = H(e);
621
- t && ae(new Set(N).add(t));
622
- }, ge = () => Q(n ?? []), ye = (e) => {
623
- let t = U(e.path), n = [{
669
+ _e,
670
+ T,
671
+ X,
672
+ j
673
+ ]), Se = U ? $(U) : null, Ce = {
674
+ empty: S,
675
+ invalid: C,
676
+ duplicate: w
677
+ }, we = (e) => {
678
+ if (!c) return !0;
679
+ let t = Le(e), n = c.find((e) => e.key === t?.rootKey);
680
+ return n != null && n.canCreateFolders !== !1;
681
+ }, Te = (() => {
682
+ if (!c) return P ?? [];
683
+ if (P && we(P)) return P;
684
+ let e = c.find((e) => e.canCreateFolders !== !1);
685
+ return e ? Ie({
686
+ rootKey: e.key,
687
+ path: []
688
+ }) : void 0;
689
+ })(), Ee = (e) => ye(de && ve(q, [], Ce) == null ? q : b, be(M, e)), De = (e) => {
690
+ W(e), ce(Ee(e)), K.current = null, le.current = !1;
691
+ let t = $(e);
692
+ t && oe(new Set(z).add(t));
693
+ }, Oe = () => {
694
+ Te && De(Te);
695
+ }, ke = (e) => {
696
+ let t = me(e.path);
697
+ if (!we(t)) return [];
698
+ let n = [{
624
699
  key: "add-child",
625
- label: g,
626
- icon: /* @__PURE__ */ O(A, {
627
- size: c.SM,
700
+ label: y,
701
+ icon: /* @__PURE__ */ B(ie, {
702
+ size: u.SM,
628
703
  "aria-hidden": !0,
629
- stroke: l
704
+ stroke: d
630
705
  }),
631
- onClick: () => Q(t)
706
+ onClick: () => De(t)
632
707
  }];
633
- return e.path !== "" && n.push({
708
+ return N.includes(e.path) || n.push({
634
709
  key: "add-sibling",
635
- label: h,
636
- icon: /* @__PURE__ */ O(j, {
637
- size: c.SM,
710
+ label: ee,
711
+ icon: /* @__PURE__ */ B(ae, {
712
+ size: u.SM,
638
713
  "aria-hidden": !0,
639
- stroke: l
714
+ stroke: d
640
715
  }),
641
- onClick: () => Q(t.slice(0, -1))
716
+ onClick: () => De(t.slice(0, -1))
642
717
  }), n;
643
- }, $ = (t) => {
644
- if (!P) return null;
645
- let n = K(t, ue(e, P), Z);
646
- return R.current = n, n;
647
- }, be = (e) => {
648
- if (!P || z.current) return;
649
- let t = e.trim(), n = R.current;
650
- ($(e) ?? n) || (s(P, t), o([...P, t])), F(null);
651
- }, xe = () => F(null);
652
- return /* @__PURE__ */ k("div", {
653
- style: D,
654
- className: E(f && "pointer-events-none opacity-60", w.className),
718
+ }, Ae = (e) => {
719
+ if (!U) return null;
720
+ let t = ve(e, be(te.current, U), Ce);
721
+ return K.current = t, t;
722
+ }, je = (e) => {
723
+ if (!U || le.current) return;
724
+ let t = e.trim(), n = K.current;
725
+ if (!(Ae(e) ?? n)) {
726
+ let e = c ? Le(U) : void 0;
727
+ e ? p?.(e.rootKey, e.path, t) : s?.(U, t), F([...U, t]);
728
+ }
729
+ W(null);
730
+ }, Me = () => W(null);
731
+ return /* @__PURE__ */ V("div", {
732
+ style: A,
733
+ className: L(h && "pointer-events-none opacity-60", k.className),
655
734
  children: [
656
- /* @__PURE__ */ O("div", {
657
- className: E("w-full max-w-full min-w-0", _e.tree),
658
- children: /* @__PURE__ */ O(ie, {
659
- items: X,
735
+ /* @__PURE__ */ B("div", {
736
+ className: L("w-full max-w-full min-w-0", Ue.tree),
737
+ children: /* @__PURE__ */ B(H, {
738
+ items: xe,
660
739
  showFiles: !1,
661
- selectedPath: n == null ? void 0 : H(n),
662
- expandedPaths: fe,
663
- onExpandedPathsChange: ae,
664
- loadingPaths: C,
740
+ selectedPath: P == null ? void 0 : $(P),
741
+ expandedPaths: he,
742
+ onExpandedPathsChange: oe,
743
+ loadingPaths: re,
665
744
  onItemClick: (e) => {
666
- o(n != null && H(n) === e.path ? void 0 : U(e.path));
745
+ let t = P != null && $(P) === e.path;
746
+ F(t ? void 0 : me(e.path));
667
747
  },
668
- getContextMenuItems: ye,
669
- createdFolderPath: me,
670
- newFolderDefaultName: I,
671
- onCreateFolderSave: be,
672
- onCreateFolderCancel: xe,
673
- onRenameValidate: (e) => $(e),
674
- emptyStateTitle: J ? v.replace("{query}", B) : void 0
748
+ getContextMenuItems: ke,
749
+ createdFolderPath: Se,
750
+ newFolderDefaultName: G,
751
+ onCreateFolderSave: je,
752
+ onCreateFolderCancel: Me,
753
+ onRenameValidate: (e) => Ae(e),
754
+ searchQuery: X ? q : void 0,
755
+ emptyStateTitle: X ? x.replace("{query}", q) : void 0
675
756
  })
676
757
  }),
677
- /* @__PURE__ */ O("div", {
678
- className: E("my-2 h-px", _e.divider),
758
+ /* @__PURE__ */ B("div", {
759
+ className: L("my-2 h-px", Ue.divider),
679
760
  "aria-hidden": !0
680
761
  }),
681
- /* @__PURE__ */ k("div", {
762
+ /* @__PURE__ */ V("div", {
682
763
  className: "mb-4 flex flex-wrap items-center gap-2",
683
- children: [/* @__PURE__ */ O(d, {
684
- onClick: ge,
685
- label: p,
686
- iconBefore: /* @__PURE__ */ O(j, {
687
- size: c.SM,
764
+ children: [/* @__PURE__ */ B(g, {
765
+ onClick: Oe,
766
+ label: _,
767
+ iconBefore: /* @__PURE__ */ B(ae, {
768
+ size: u.SM,
688
769
  "aria-hidden": !0,
689
- stroke: l
770
+ stroke: d
690
771
  }),
691
- disabled: f || ce
692
- }), ce && /* @__PURE__ */ O(d, {
693
- label: m,
694
- onClick: xe,
695
- disabled: f,
696
- [ve]: ""
772
+ disabled: h || ue || !Te
773
+ }), ue && /* @__PURE__ */ B(g, {
774
+ label: v,
775
+ onClick: Me,
776
+ disabled: h,
777
+ [We]: ""
697
778
  })]
698
779
  })
699
780
  ]
700
781
  });
701
- }, $ = { panel: "dial-publish-panel-panel" }, be = {
702
- summaryTitle: "_summaryTitle_tf20a_1",
703
- sectionHeading: "_sectionHeading_tf20a_5"
704
- }, xe = 200, Se = ({ resource: e, renderSummary: t, folderItems: i, selectedFolderPath: o, onSelectedFolderPathChange: c, onCreateFolder: l, expandedPaths: u, onExpandedPathsChange: d, loadingPaths: f, hasExistingPublicationInFolder: p, hasWriteAccess: h, isSubmitting: v, hasSubmitError: ee = !1, allowReplace: b = !0, author: x, onAuthorChange: S, publishCredentials: te = !1, onPublishCredentialsChange: w, rules: D, onRulesChange: A, ruleSourceOptions: j, isRulesLoading: ne = !1, hasRulesLoadError: re = !1, labels: ie = {}, summaryTitleClassName: M = "dial-body-semi-text", headingClassName: P = "dial-body-semi-text", styles: F = {} }) => {
705
- let { colors: I, folderTree: L, accessRules: R } = F, oe = {
706
- ...T({
707
- "--pp-summary-title-text": I?.summaryTitleText,
708
- "--pp-heading-text": I?.headingText
782
+ }, Je = { panel: "dial-publish-panel-panel" }, Ye = {
783
+ summaryTitle: "_summaryTitle_zj3gd_1",
784
+ sectionHeading: "_sectionHeading_zj3gd_5",
785
+ destination: "_destination_zj3gd_9"
786
+ }, Xe = 200, Ze = ({ view: e = J.Main, onChangeFolderClick: o, resource: s, renderSummary: l, folderItems: f, selectedFolderPath: m, pendingFolderPath: _, onPendingFolderPathChange: v, onCreateFolder: y, expandedPaths: b, onExpandedPathsChange: x, loadingPaths: S, hasExistingPublicationInFolder: C, hasWriteAccess: E, isSubmitting: D, hasSubmitError: O = !1, allowReplace: A = !0, author: j, onAuthorChange: M, publishCredentials: te = !1, onPublishCredentialsChange: N, rules: P, onRulesChange: I, ruleSourceOptions: R, isRulesLoading: z = !1, hasRulesLoadError: ie = !1, labels: ae = {}, summaryTitleClassName: oe = "dial-body-semi-text", headingClassName: se = "dial-body-semi-text", destinationClassName: H = "dial-small-semi-text", calloutFolderNameClassName: U = "dial-small-paragraph-semi-text", styles: ce = {} }) => {
787
+ let { colors: K, folderTree: le, accessRules: q } = ce, ue = {
788
+ ...ne({
789
+ "--pp-summary-title-text": K?.summaryTitleText,
790
+ "--pp-heading-text": K?.headingText,
791
+ "--pp-destination-text": K?.destinationText
709
792
  }),
710
- ...F.cssVars
711
- }, z = {
712
- border: I?.summaryBorder,
713
- background: I?.summaryBackground,
714
- versionTagBorder: I?.summaryVersionTagBorder,
715
- versionTagBackground: I?.summaryVersionTagBackground,
716
- versionTagText: I?.summaryVersionTagText
717
- }, { folderLabel: se = "Publish to folder", replaceWarning: B = "Version {version} is already published in {folder}. Publishing will replace it.", noAccessError: ce = "You don't have permission to publish to {folder}. Pick another, or ask an owner for access.", submitError: V = "Publishing failed. Please try again.", folderEmptyStateLabel: H, addSiblingFolderLabel: U, addChildFolderLabel: W, cancelCreatingFolderLabel: G, createFolderEmptyNameError: K, createFolderInvalidNameError: le, createFolderDuplicateNameError: ue, rootFolderLabel: q = "Organization", summaryVersionLabel: J, accessRulesLabels: Y, searchPlaceholder: de, clearSearchAriaLabel: fe, authorLabel: pe = "Author", authorPlaceholder: X = "Author name", authorHint: me = "Shown as the publication’s author. Defaults to you — replace it to credit a team instead.", credentialsLabel: Z = "Publish with my credentials", credentialsHint: Q = "Members will use this without signing in themselves. Your credential itself is never shown to them." } = ie, [ge, _e] = a(""), ve = n(), Se = (e) => {
718
- _e(e ?? "");
719
- }, we = o != null, Ee = r(() => ae({
720
- hasSelectedFolder: we,
721
- hasExistingPublicationInFolder: p,
722
- hasWriteAccess: h,
723
- isSubmitting: v,
724
- hasSubmitError: ee,
725
- allowReplace: b
793
+ ...ce.cssVars
794
+ }, de = {
795
+ border: K?.summaryBorder,
796
+ background: K?.summaryBackground
797
+ }, { folderLabel: Y = "Publish to folder", destinationAriaLabel: X = "Destination folder", noFolderSelectedLabel: fe = "No folder selected", changeFolderLabel: Z = "Change", chooseFolderLabel: Q = "Choose", replaceWarning: pe = "Version {version} is already published in {folder}. Publishing will replace it.", noAccessError: $ = "You don't have permission to publish to {folder}. Pick another, or ask an owner for access.", submitError: me = "Publishing failed. Please try again.", folderEmptyStateLabel: he, addSiblingFolderLabel: ge, addChildFolderLabel: _e, cancelCreatingFolderLabel: ve, createFolderEmptyNameError: ye, createFolderInvalidNameError: be, createFolderDuplicateNameError: xe, rootFolderLabel: Se = "Organization", accessRulesLabels: Ce, searchPlaceholder: we, clearSearchAriaLabel: Te, authorLabel: Ee = "Author", authorPlaceholder: De = "Author name", authorHint: Oe = "Shown as the publication’s author. Defaults to you — replace it to credit a team instead.", credentialsLabel: ke = "Publish with my credentials", credentialsHint: je = "Members will use this without signing in themselves. Your credential itself is never shown to them." } = ae, [Me, Ne] = a(""), Pe = n(), Fe = i(null), Ie = i(null), Le = (e) => {
798
+ Ne(e ?? "");
799
+ }, Re = i(e);
800
+ t(() => {
801
+ Re.current !== e && (Re.current = e, e === J.ChangeFolder ? Ie.current?.focus({ preventScroll: !0 }) : Fe.current?.focus({ preventScroll: !0 }));
802
+ }, [e]);
803
+ let ze = m != null, Be = r(() => G({
804
+ hasSelectedFolder: ze,
805
+ hasExistingPublicationInFolder: C,
806
+ hasWriteAccess: E,
807
+ isSubmitting: D,
808
+ hasSubmitError: O,
809
+ allowReplace: A
726
810
  }), [
727
- we,
728
- p,
729
- h,
730
- v,
731
- ee,
732
- b
733
- ]), De = we ? o[o.length - 1] ?? q : "", Oe = t ? t() : /* @__PURE__ */ O("span", {
734
- className: E("truncate", M, be.summaryTitle),
735
- children: e?.title
811
+ ze,
812
+ C,
813
+ E,
814
+ D,
815
+ O,
816
+ A
817
+ ]), Ve = ze ? m[m.length - 1] ?? Se : "", He = l ? l() : /* @__PURE__ */ B("span", {
818
+ className: L("truncate", oe, Ye.summaryTitle),
819
+ children: s?.title
736
820
  });
737
- return /* @__PURE__ */ k("div", {
738
- className: E("flex flex-col gap-5", $.panel),
739
- style: oe,
740
- children: [e?.type == null ? /* @__PURE__ */ O(C, {
741
- colors: z,
742
- children: Oe
743
- }) : /* @__PURE__ */ O(C, {
821
+ if (e === J.ChangeFolder) return /* @__PURE__ */ V("div", {
822
+ ref: Ie,
823
+ tabIndex: -1,
824
+ role: "group",
825
+ "aria-label": Y,
826
+ className: L("flex flex-col gap-3 outline-none", Je.panel),
827
+ style: ue,
828
+ children: [/* @__PURE__ */ B("div", {
829
+ role: "search",
830
+ children: /* @__PURE__ */ B(k, {
831
+ value: Me,
832
+ onChange: Le,
833
+ placeholder: we,
834
+ clearLabel: Te,
835
+ "aria-label": we
836
+ })
837
+ }), /* @__PURE__ */ B(qe, {
838
+ items: f,
839
+ selectedPath: _,
840
+ onSelectedPathChange: v,
841
+ onCreateFolder: y,
842
+ expandedPaths: b,
843
+ onExpandedPathsChange: x,
844
+ loadingPaths: S,
845
+ searchQuery: Me,
846
+ disabled: D,
847
+ noResultsLabel: he,
848
+ addSiblingFolderLabel: ge,
849
+ addChildFolderLabel: _e,
850
+ cancelCreatingFolderLabel: ve,
851
+ emptyFolderNameError: ye,
852
+ invalidFolderNameError: be,
853
+ duplicateFolderNameError: xe,
854
+ rootLabel: Se,
855
+ styles: le
856
+ })]
857
+ });
858
+ let Ue = L(H, Ye.destination);
859
+ return /* @__PURE__ */ V("div", {
860
+ className: L("flex flex-col gap-5", Je.panel),
861
+ style: ue,
862
+ children: [s?.type == null ? /* @__PURE__ */ B(F, {
863
+ colors: de,
864
+ children: He
865
+ }) : /* @__PURE__ */ B(F, {
744
866
  item: {
745
- type: e.type,
746
- name: e.title,
747
- version: e.version ?? "",
748
- iconUrl: e.iconUrl
867
+ type: s.type,
868
+ name: s.title,
869
+ version: s.version ?? "",
870
+ iconUrl: s.iconUrl
749
871
  },
750
- versionLabel: J,
751
- colors: z
752
- }), /* @__PURE__ */ k("div", { children: [
753
- /* @__PURE__ */ O("div", {
754
- className: E("mb-2", P, be.sectionHeading),
755
- children: se
872
+ hasVersionTag: !1,
873
+ colors: de
874
+ }), /* @__PURE__ */ V("section", { children: [
875
+ /* @__PURE__ */ B("h2", {
876
+ className: L("mb-2", se, Ye.sectionHeading),
877
+ children: Y
756
878
  }),
757
- /* @__PURE__ */ O("div", {
758
- role: "search",
759
- className: "mb-3",
760
- children: /* @__PURE__ */ O(y, {
761
- value: ge,
762
- onChange: Se,
763
- placeholder: de,
764
- clearLabel: fe,
765
- "aria-label": de
766
- })
767
- }),
768
- /* @__PURE__ */ O(ye, {
769
- items: i,
770
- selectedPath: o,
771
- onSelectedPathChange: c,
772
- onCreateFolder: l,
773
- expandedPaths: u,
774
- onExpandedPathsChange: d,
775
- loadingPaths: f,
776
- searchQuery: ge,
777
- disabled: v,
778
- noResultsLabel: H,
779
- addSiblingFolderLabel: U,
780
- addChildFolderLabel: W,
781
- cancelCreatingFolderLabel: G,
782
- emptyFolderNameError: K,
783
- invalidFolderNameError: le,
784
- duplicateFolderNameError: ue,
785
- rootLabel: q,
786
- styles: L
879
+ /* @__PURE__ */ V("div", {
880
+ className: "flex min-w-0 items-center gap-2",
881
+ children: [/* @__PURE__ */ B("div", {
882
+ role: "group",
883
+ "aria-label": X,
884
+ className: "min-w-0 flex-1",
885
+ children: ze ? /* @__PURE__ */ B(h, {
886
+ name: [Se, ...m].join(" / "),
887
+ nameClassName: Ue
888
+ }) : /* @__PURE__ */ B("span", {
889
+ className: L("block truncate", Ue),
890
+ children: fe
891
+ })
892
+ }), /* @__PURE__ */ B(g, {
893
+ ref: Fe,
894
+ size: p.Small,
895
+ label: ze ? Z : Q,
896
+ iconBefore: /* @__PURE__ */ B(re, {
897
+ size: u.SM,
898
+ stroke: d,
899
+ "aria-hidden": !0
900
+ }),
901
+ disabled: D,
902
+ onClick: o
903
+ })]
787
904
  }),
788
- Ee.calloutKind !== N.None && Ee.calloutKind !== N.Info && /* @__PURE__ */ O("div", {
905
+ Be.calloutKind !== W.None && Be.calloutKind !== W.Info && /* @__PURE__ */ B("div", {
789
906
  className: "mt-3",
790
- children: /* @__PURE__ */ O(g, {
791
- type: _.SectionMessage,
792
- variant: Ce(Ee.calloutKind),
793
- message: Te(Ee.calloutKind, {
794
- replaceWarning: B,
795
- noAccessError: ce,
796
- submitError: V,
797
- folderName: De,
798
- version: e?.version
907
+ children: /* @__PURE__ */ B(w, {
908
+ type: T.SectionMessage,
909
+ variant: Qe(Be.calloutKind),
910
+ message: et(Be.calloutKind, {
911
+ replaceWarning: pe,
912
+ noAccessError: $,
913
+ submitError: me,
914
+ folderName: Ve,
915
+ version: s?.version,
916
+ folderNameClassName: U
799
917
  })
800
918
  })
801
919
  }),
802
- /* @__PURE__ */ O("div", {
920
+ /* @__PURE__ */ B("div", {
803
921
  className: "mt-4",
804
- children: /* @__PURE__ */ O(m, {
805
- id: ve,
806
- labelProps: { label: pe },
807
- placeholder: X,
808
- caption: me,
809
- value: x,
810
- onChange: (e) => S(e ?? ""),
811
- maxLength: xe,
812
- disabled: v
922
+ children: /* @__PURE__ */ B(ee, {
923
+ id: Pe,
924
+ labelProps: { label: Ee },
925
+ placeholder: De,
926
+ caption: Oe,
927
+ value: j,
928
+ onChange: (e) => M(e ?? ""),
929
+ maxLength: Xe,
930
+ disabled: D
813
931
  })
814
932
  }),
815
- w != null && /* @__PURE__ */ O("div", {
933
+ N != null && /* @__PURE__ */ B("div", {
816
934
  className: "mt-4",
817
- children: /* @__PURE__ */ O(s, {
818
- labelProps: { label: Z },
819
- caption: Q,
935
+ children: /* @__PURE__ */ B(c, {
936
+ labelProps: { label: ke },
937
+ caption: je,
820
938
  isSelected: te,
821
- onChange: w,
822
- disabled: v
939
+ onChange: N,
940
+ disabled: D
823
941
  })
824
942
  }),
825
- /* @__PURE__ */ O("div", {
943
+ /* @__PURE__ */ B("div", {
826
944
  className: "mt-4",
827
- children: /* @__PURE__ */ O(he, {
828
- rules: D,
829
- onRulesChange: A,
830
- sourceOptions: j,
831
- folderName: we ? De : void 0,
832
- disabled: v,
833
- isLoading: ne,
834
- hasLoadError: re,
835
- labels: Y,
836
- styles: R
945
+ children: /* @__PURE__ */ B(Ae, {
946
+ rules: P,
947
+ onRulesChange: I,
948
+ sourceOptions: R,
949
+ folderName: ze ? Ve : void 0,
950
+ disabled: D,
951
+ isLoading: z,
952
+ hasLoadError: ie,
953
+ labels: Ce,
954
+ styles: q
837
955
  })
838
956
  })
839
957
  ] })]
840
958
  });
841
- }, Ce = (e) => e === N.ReplaceWarning ? v.Warning : v.Error, we = (e, t) => {
842
- let [n, r, ...i] = e.split("{folder}");
843
- return r === void 0 || i.length > 0 ? e : /* @__PURE__ */ k(D, { children: [
844
- n,
845
- /* @__PURE__ */ O("strong", {
846
- className: "font-semibold",
959
+ }, Qe = (e) => e === W.ReplaceWarning ? E.Warning : E.Error, $e = (e, t, n) => {
960
+ let [r, i, ...a] = e.split("{folder}");
961
+ return i === void 0 || a.length > 0 ? e : /* @__PURE__ */ V(z, { children: [
962
+ r,
963
+ /* @__PURE__ */ B("strong", {
964
+ className: n,
847
965
  children: t
848
966
  }),
849
- r
967
+ i
850
968
  ] });
851
- }, Te = (e, t) => e === N.ReplaceWarning ? we(t.replaceWarning.replace("{version}", t.version ?? ""), t.folderName) : e === N.NoAccess ? we(t.noAccessError, t.folderName) : t.submitError, Ee = { footer: "_footer_dks1v_1" }, De = ({ version: e, hasExistingPublicationInFolder: t, allowReplace: n = !0, isSubmitDisabled: r, isSubmitLoading: i, onCancel: a, onSubmit: o, labels: s = {}, colors: l }) => {
852
- let u = T({ "--pf-border": l?.border }), { cancelLabel: f = "Cancel", publishDefaultLabel: p = "Publish", updateLabel: m = "Update version {version}", publishingInProgressLabel: g = "Publishing…" } = s, _ = i ? g : n && t && e != null ? m.replace("{version}", e) : p;
853
- return /* @__PURE__ */ k("div", {
854
- style: u,
855
- className: E("flex items-center justify-end gap-2 border-t px-4 py-4 rtl:flex-row-reverse rtl:justify-start desktop:px-3.5", Ee.footer),
856
- children: [/* @__PURE__ */ O(d, {
857
- label: f,
969
+ }, et = (e, t) => e === W.ReplaceWarning ? $e(t.replaceWarning.replace("{version}", t.version ?? ""), t.folderName, t.folderNameClassName) : e === W.NoAccess ? $e(t.noAccessError, t.folderName, t.folderNameClassName) : t.submitError, tt = { footer: "_footer_dks1v_1" }, nt = ({ version: e, hasExistingPublicationInFolder: t, allowReplace: n = !0, isSubmitDisabled: r, isSubmitLoading: i, onCancel: a, onSubmit: o, view: s = J.Main, onSelectFolder: c, isSelectFolderDisabled: l = !1, labels: d = {}, colors: f }) => {
970
+ let p = ne({ "--pf-border": f?.border }), { cancelLabel: m = "Cancel", publishDefaultLabel: h = "Publish", updateLabel: _ = "Update version {version}", publishingInProgressLabel: v = "Publishing…", selectFolderLabel: ee = "Select" } = d, y = s === J.ChangeFolder, b = i ? v : n && t && e != null ? _.replace("{version}", e) : h;
971
+ return /* @__PURE__ */ V("div", {
972
+ style: p,
973
+ className: L("flex items-center justify-end gap-2 border-t px-4 py-4 rtl:flex-row-reverse rtl:justify-start desktop:px-3.5", tt.footer),
974
+ children: [/* @__PURE__ */ B(g, {
975
+ label: m,
858
976
  className: "mobile:flex-1",
859
977
  disabled: i,
860
978
  onClick: a
861
- }), /* @__PURE__ */ O(h, {
862
- label: _,
979
+ }), y ? /* @__PURE__ */ B(C, {
980
+ label: ee,
981
+ className: "mobile:flex-1",
982
+ disabled: l,
983
+ onClick: c
984
+ }) : /* @__PURE__ */ B(C, {
985
+ label: b,
863
986
  className: "mobile:flex-1",
864
987
  disabled: r,
865
- iconBefore: i ? /* @__PURE__ */ O(x, { size: c.SM }) : void 0,
988
+ iconBefore: i ? /* @__PURE__ */ B("span", {
989
+ "aria-hidden": !0,
990
+ children: /* @__PURE__ */ B(M, { size: u.SM })
991
+ }) : void 0,
866
992
  onClick: o
867
993
  })]
868
994
  });
869
- }, Oe = {
995
+ }, rt = {
870
996
  backdrop: "_backdrop_16jmd_6",
871
997
  panel: "_panel_16jmd_10",
872
998
  divider: "_divider_16jmd_15",
873
999
  content: "_content_16jmd_19",
874
1000
  title: "_title_16jmd_24"
875
- }, ke = ({ isOpen: e, resource: n, renderSummary: i, folderItems: o, selectedFolderPath: s, onSelectedFolderPathChange: c, onCreateFolder: l, expandedPaths: u, onExpandedPathsChange: d, loadingPaths: f, hasExistingPublicationInFolder: p, hasWriteAccess: m, isSubmitting: h, hasSubmitError: g = !1, allowReplace: _ = !0, author: v, onAuthorChange: y, rules: ee, onRulesChange: x, ruleSourceOptions: S, isRulesLoading: te = !1, hasRulesLoadError: C = !1, onClose: w, returnFocusRef: D, onSubmit: A, panelLabels: j, panelStyles: ne, footerLabels: re, labels: ie = {}, titleClassName: M = "dial-body-semi-text", colors: N }) => {
876
- let P = T({
877
- "--spp-backdrop-bg": N?.backdropBackground,
878
- "--spp-panel-bg": N?.panelBackground,
879
- "--spp-panel-border": N?.panelBorder,
880
- "--spp-divider-border": N?.dividerBorder,
881
- "--spp-scrollbar-thumb": N?.scrollbarThumb,
882
- "--spp-title-text": N?.titleText
883
- }), [F, I] = a(null), { title: L = "Publish", ariaLabel: R = "Publish", closeAriaLabel: oe = "Close" } = ie, z = r(() => ae({
1001
+ }, it = ({ isOpen: e, resource: n, renderSummary: i, folderItems: o, selectedFolderPath: s, onSelectedFolderPathChange: c, onCreateFolder: l, expandedPaths: u, onExpandedPathsChange: d, loadingPaths: f, hasExistingPublicationInFolder: p, hasWriteAccess: m, isSubmitting: h, hasSubmitError: g = !1, allowReplace: _ = !0, author: v, onAuthorChange: ee, rules: y, onRulesChange: b, ruleSourceOptions: x, isRulesLoading: S = !1, hasRulesLoadError: C = !1, onClose: w, returnFocusRef: T, onSubmit: E, panelLabels: D, panelStyles: O, panelSummaryTitleClassName: k, panelHeadingClassName: A, panelCalloutFolderNameClassName: M, footerLabels: te, labels: N = {}, titleClassName: P = "dial-body-semi-text", colors: F }) => {
1002
+ let I = ne({
1003
+ "--spp-backdrop-bg": F?.backdropBackground,
1004
+ "--spp-panel-bg": F?.panelBackground,
1005
+ "--spp-panel-border": F?.panelBorder,
1006
+ "--spp-divider-border": F?.dividerBorder,
1007
+ "--spp-scrollbar-thumb": F?.scrollbarThumb,
1008
+ "--spp-title-text": F?.titleText
1009
+ }), [R, z] = a(null), { title: re = "Publish", changeFolderTitle: ie = "Change folder", backAriaLabel: ae = "Back", ariaLabel: oe = "Publish", closeAriaLabel: se = "Close" } = N, H = de({
1010
+ isOpen: e,
1011
+ selectedFolderPath: s,
1012
+ onSelectedFolderPathChange: c
1013
+ }), U = H.view === J.ChangeFolder, W = r(() => G({
884
1014
  hasSelectedFolder: s != null,
885
1015
  hasExistingPublicationInFolder: p,
886
1016
  hasWriteAccess: m,
@@ -896,7 +1026,7 @@ var M = /* @__PURE__ */ function(e) {
896
1026
  _
897
1027
  ]);
898
1028
  return t(() => {
899
- let t = F?.closest("[role=\"dialog\"]");
1029
+ let t = R?.closest("[role=\"dialog\"]");
900
1030
  if (!e || !t) return;
901
1031
  let n = () => t.focus({ preventScroll: !0 });
902
1032
  n();
@@ -906,41 +1036,47 @@ var M = /* @__PURE__ */ function(e) {
906
1036
  document.addEventListener("focusin", r);
907
1037
  let i = requestAnimationFrame(() => {
908
1038
  document.removeEventListener("focusin", r);
909
- }), a = D?.current;
1039
+ }), a = T?.current;
910
1040
  return () => {
911
1041
  cancelAnimationFrame(i), document.removeEventListener("focusin", r), a?.isConnected && a.focus({ preventScroll: !0 });
912
1042
  };
913
1043
  }, [
914
1044
  e,
915
- F,
916
- D
917
- ]), /* @__PURE__ */ k(b, {
1045
+ R,
1046
+ T
1047
+ ]), /* @__PURE__ */ V(j, {
918
1048
  open: e,
919
1049
  onClose: w,
920
- header: /* @__PURE__ */ O("span", {
921
- className: E("block truncate text-center", M, Oe.title),
922
- children: L
1050
+ header: /* @__PURE__ */ B("span", {
1051
+ className: L("block truncate text-center", P, rt.title),
1052
+ children: U ? ie : re
923
1053
  }),
924
- ariaLabel: R,
925
- closeAriaLabel: oe,
1054
+ ariaLabel: oe,
1055
+ onBack: U ? H.backToMain : void 0,
1056
+ backAriaLabel: ae,
1057
+ backDisabled: h,
1058
+ closeAriaLabel: se,
926
1059
  closeDisabled: h,
927
- style: P,
928
- overlayStyle: P,
929
- className: Oe.panel,
930
- overlayClassName: Oe.backdrop,
931
- headerClassName: E("px-[22px]", Oe.divider),
1060
+ style: I,
1061
+ overlayStyle: I,
1062
+ className: L(rt.panel, "tablet:w-[540px]! tablet:max-w-[calc(100%-32px)]!"),
1063
+ overlayClassName: rt.backdrop,
1064
+ headerClassName: L("px-[22px]", rt.divider),
932
1065
  bodyClassName: "flex flex-col overflow-hidden",
933
- children: [/* @__PURE__ */ O("div", {
934
- ref: I,
935
- className: E("min-h-0 flex-1 overflow-y-auto", Oe.content),
936
- children: /* @__PURE__ */ O("div", {
1066
+ children: [/* @__PURE__ */ B("div", {
1067
+ ref: z,
1068
+ className: L("min-h-0 flex-1 overflow-y-auto", rt.content),
1069
+ children: /* @__PURE__ */ B("div", {
937
1070
  className: "p-[22px]",
938
- children: /* @__PURE__ */ O(Se, {
1071
+ children: /* @__PURE__ */ B(Ze, {
939
1072
  resource: n,
940
1073
  renderSummary: i,
1074
+ view: H.view,
1075
+ onChangeFolderClick: H.openFolderView,
941
1076
  folderItems: o,
942
1077
  selectedFolderPath: s,
943
- onSelectedFolderPathChange: c,
1078
+ pendingFolderPath: H.pendingFolderPath,
1079
+ onPendingFolderPathChange: H.setPendingFolderPath,
944
1080
  onCreateFolder: l,
945
1081
  expandedPaths: u,
946
1082
  onExpandedPathsChange: d,
@@ -951,27 +1087,325 @@ var M = /* @__PURE__ */ function(e) {
951
1087
  hasSubmitError: g,
952
1088
  allowReplace: _,
953
1089
  author: v,
954
- onAuthorChange: y,
955
- rules: ee,
956
- onRulesChange: x,
957
- ruleSourceOptions: S,
958
- isRulesLoading: te,
1090
+ onAuthorChange: ee,
1091
+ rules: y,
1092
+ onRulesChange: b,
1093
+ ruleSourceOptions: x,
1094
+ isRulesLoading: S,
959
1095
  hasRulesLoadError: C,
960
- labels: j,
961
- styles: ne
1096
+ labels: D,
1097
+ styles: O,
1098
+ summaryTitleClassName: k,
1099
+ headingClassName: A,
1100
+ calloutFolderNameClassName: M
962
1101
  })
963
1102
  })
964
- }), /* @__PURE__ */ O(De, {
1103
+ }), /* @__PURE__ */ B(nt, {
965
1104
  version: n?.version,
966
1105
  hasExistingPublicationInFolder: p,
967
1106
  allowReplace: _,
968
- isSubmitDisabled: z.isSubmitDisabled,
969
- isSubmitLoading: z.isSubmitLoading,
970
- onCancel: w,
971
- onSubmit: A,
972
- labels: re
1107
+ isSubmitDisabled: W.isSubmitDisabled,
1108
+ isSubmitLoading: W.isSubmitLoading,
1109
+ onCancel: U ? H.backToMain : w,
1110
+ onSubmit: E,
1111
+ view: H.view,
1112
+ onSelectFolder: H.selectFolder,
1113
+ isSelectFolderDisabled: H.pendingFolderPath == null,
1114
+ labels: te
1115
+ })]
1116
+ });
1117
+ }, at = { option: "_option_skygm_1" }, ot = (e, t) => `Unpublish "${e}" from "${t}"?`, st = (e) => `Choose which folder to unpublish "${e}" from.`, ct = ({ isOpen: e, name: t, folders: n, selectedFolder: r, onSelectedFolderChange: i, isLoading: a = !1, labels: o, optionClassName: s = "dial-small-text", colors: c, onConfirm: u, onClose: d }) => {
1118
+ let { title: f = "Unpublish?", confirmLabel: p = "Unpublish", cancelLabel: m = "Cancel", rootFolderLabel: h = "Organization", folderGroupAriaLabel: g = "Published folders", loadingStatusLabel: _ = "Requesting unpublish…", confirmMessage: v = ot, selectFolderMessage: ee = st } = o ?? {}, y = n.length > 1;
1119
+ return /* @__PURE__ */ B(P, {
1120
+ open: e,
1121
+ title: f,
1122
+ confirmLabel: p,
1123
+ cancelLabel: m,
1124
+ variant: l.Danger,
1125
+ isLoading: a,
1126
+ isConfirmDisabled: y && r == null,
1127
+ loadingStatusLabel: _,
1128
+ message: /* @__PURE__ */ B("span", {
1129
+ className: "wrap-break-word",
1130
+ children: y ? ee(t) : v(t, he(n[0] ?? "", h))
1131
+ }),
1132
+ onConfirm: u,
1133
+ onClose: d,
1134
+ children: y && /* @__PURE__ */ B("div", {
1135
+ className: "mt-3",
1136
+ style: ne({ "--ucd-option-text": c?.optionText }),
1137
+ children: /* @__PURE__ */ B(O, {
1138
+ ariaLabel: g,
1139
+ value: r ?? void 0,
1140
+ onChange: i,
1141
+ disabled: a,
1142
+ items: n.map((e) => ({
1143
+ value: e,
1144
+ label: he(e, h)
1145
+ })),
1146
+ radioClassName: L(s, at.option)
1147
+ })
1148
+ })
1149
+ });
1150
+ }, lt = /* @__PURE__ */ function(e) {
1151
+ return e.Keep = "keep", e.New = "new", e;
1152
+ }({}), ut = /* @__PURE__ */ function(e) {
1153
+ return e.Main = "main", e.ChangeFolder = "change-folder", e;
1154
+ }({}), dt = {
1155
+ heading: "_heading_vk731_1",
1156
+ destination: "_destination_vk731_5"
1157
+ }, ft = ({ view: e, resource: t, roots: i, destination: o, onCreateFolder: s, onChangeFolderClick: c, changeFolderButtonRef: l, pendingDestination: f, onPendingDestinationChange: _, version: v, accessRules: x, isSubmitting: C = !1, submitError: w, foldersError: T, onRetryFolders: E, panelLabels: D = {}, panelStyles: A = {}, headingClassName: j = "dial-body-semi-text", destinationClassName: M = "dial-small-semi-text" }) => {
1158
+ let { saveToFolderHeading: te = "Save to folder", changeFolderLabel: N = "Change", destinationAriaLabel: P = "Destination folder", versionHeading: I = "Version", keepVersionLabel: R = "Keep version {version}", saveAsNewVersionLabel: z = "Save as new version", newVersionLabel: ie = "Version", newVersionPlaceholder: ae = "Enter new version", searchPlaceholder: oe = "Search folders", clearSearchAriaLabel: se = "Clear search", folderEmptyStateLabel: H, createFolderLabel: U, cancelCreatingFolderLabel: W, addSiblingFolderLabel: G, addChildFolderLabel: ce, createFolderEmptyNameError: K, createFolderInvalidNameError: le, createFolderDuplicateNameError: q, retryLabel: ue = "Retry" } = D, { colors: J, folderTree: de } = A, Y = {
1159
+ ...ne({
1160
+ "--stf-heading-text": J?.headingText,
1161
+ "--stf-destination-text": J?.destinationText
1162
+ }),
1163
+ ...A.cssVars
1164
+ }, X = {
1165
+ border: J?.summaryBorder,
1166
+ background: J?.summaryBackground
1167
+ }, [fe, Z] = a(""), Q = n(), pe = r(() => [i.find((e) => e.key === o.rootKey)?.label ?? o.rootKey, ...o.path], [i, o]), $ = i.find((e) => e.key === f?.rootKey), me = f ? f.path[f.path.length - 1] ?? $?.label : void 0, he = L(j, dt.heading);
1168
+ if (e === ut.ChangeFolder) return /* @__PURE__ */ V("div", {
1169
+ className: "flex flex-col gap-3",
1170
+ style: Y,
1171
+ children: [
1172
+ /* @__PURE__ */ B("div", {
1173
+ role: "search",
1174
+ children: /* @__PURE__ */ B(k, {
1175
+ value: fe,
1176
+ onChange: (e) => Z(e ?? ""),
1177
+ placeholder: oe,
1178
+ clearLabel: se,
1179
+ "aria-label": oe
1180
+ })
1181
+ }),
1182
+ /* @__PURE__ */ B(b, {
1183
+ politeness: S.Assertive,
1184
+ children: T && /* @__PURE__ */ V("div", {
1185
+ className: "flex flex-wrap items-center gap-2",
1186
+ children: [/* @__PURE__ */ B(m, { text: T }), E && /* @__PURE__ */ B(y, {
1187
+ label: ue,
1188
+ onClick: E
1189
+ })]
1190
+ })
1191
+ }),
1192
+ /* @__PURE__ */ B(qe, {
1193
+ roots: i,
1194
+ destination: f,
1195
+ onDestinationChange: _,
1196
+ onCreateDestinationFolder: s,
1197
+ searchQuery: fe,
1198
+ disabled: C,
1199
+ noResultsLabel: H,
1200
+ createFolderLabel: U,
1201
+ cancelCreatingFolderLabel: W,
1202
+ addSiblingFolderLabel: G,
1203
+ addChildFolderLabel: ce,
1204
+ emptyFolderNameError: K,
1205
+ invalidFolderNameError: le,
1206
+ duplicateFolderNameError: q,
1207
+ styles: de
1208
+ }),
1209
+ x && $?.hasAccessRules && /* @__PURE__ */ B("div", {
1210
+ className: "mt-1",
1211
+ children: /* @__PURE__ */ B(Ae, {
1212
+ rules: x.rules,
1213
+ onRulesChange: x.onRulesChange,
1214
+ sourceOptions: x.sourceOptions,
1215
+ folderName: me,
1216
+ disabled: C,
1217
+ isLoading: x.isLoading,
1218
+ hasLoadError: x.hasLoadError,
1219
+ labels: x.labels,
1220
+ styles: x.styles
1221
+ })
1222
+ })
1223
+ ]
1224
+ });
1225
+ let ge = v ? [{
1226
+ value: lt.Keep,
1227
+ label: R.replace("{version}", v.currentVersion)
1228
+ }, {
1229
+ value: lt.New,
1230
+ label: z,
1231
+ content: /* @__PURE__ */ B(ee, {
1232
+ id: Q,
1233
+ value: v.newVersion,
1234
+ onChange: (e) => v.onNewVersionChange(e ?? ""),
1235
+ onBlur: v.onNewVersionBlur,
1236
+ labelProps: {
1237
+ label: ie,
1238
+ required: !0
1239
+ },
1240
+ placeholder: ae,
1241
+ error: v.newVersionError,
1242
+ invalid: !!v.newVersionError,
1243
+ disabled: C
1244
+ })
1245
+ }] : [];
1246
+ return /* @__PURE__ */ V("div", {
1247
+ className: "flex flex-col gap-5",
1248
+ style: Y,
1249
+ children: [
1250
+ t.type == null ? /* @__PURE__ */ B(F, {
1251
+ colors: X,
1252
+ children: /* @__PURE__ */ B("span", {
1253
+ className: L("truncate", he),
1254
+ children: t.title
1255
+ })
1256
+ }) : /* @__PURE__ */ B(F, {
1257
+ item: {
1258
+ type: t.type,
1259
+ name: t.title,
1260
+ version: t.version ?? "",
1261
+ iconUrl: t.iconUrl
1262
+ },
1263
+ hasVersionTag: !1,
1264
+ colors: X
1265
+ }),
1266
+ /* @__PURE__ */ V("section", {
1267
+ className: "flex flex-col gap-2",
1268
+ children: [/* @__PURE__ */ B("h2", {
1269
+ className: he,
1270
+ children: te
1271
+ }), /* @__PURE__ */ V("div", {
1272
+ className: "flex min-w-0 items-center gap-2",
1273
+ children: [/* @__PURE__ */ B("div", {
1274
+ role: "group",
1275
+ "aria-label": P,
1276
+ className: "min-w-0 flex-1",
1277
+ children: /* @__PURE__ */ B(h, {
1278
+ name: pe.join(" / "),
1279
+ nameClassName: L(M, dt.destination)
1280
+ })
1281
+ }), /* @__PURE__ */ B(g, {
1282
+ ref: l,
1283
+ size: p.Small,
1284
+ label: N,
1285
+ iconBefore: /* @__PURE__ */ B(re, {
1286
+ size: u.SM,
1287
+ stroke: d,
1288
+ "aria-hidden": !0
1289
+ }),
1290
+ disabled: C,
1291
+ onClick: c
1292
+ })]
1293
+ })]
1294
+ }),
1295
+ v && /* @__PURE__ */ V("section", {
1296
+ className: "flex flex-col gap-2",
1297
+ children: [/* @__PURE__ */ B("h2", {
1298
+ className: he,
1299
+ children: I
1300
+ }), /* @__PURE__ */ B(O, {
1301
+ ariaLabel: I,
1302
+ value: v.versionMode,
1303
+ onChange: (e) => v.onVersionModeChange(e),
1304
+ items: ge,
1305
+ disabled: C
1306
+ })]
1307
+ }),
1308
+ /* @__PURE__ */ B(b, {
1309
+ politeness: S.Assertive,
1310
+ children: w && /* @__PURE__ */ B(m, { text: w })
1311
+ })
1312
+ ]
1313
+ });
1314
+ }, pt = {
1315
+ backdrop: "_backdrop_1ie8s_6",
1316
+ panel: "_panel_1ie8s_10",
1317
+ divider: "_divider_1ie8s_15",
1318
+ footer: "_footer_1ie8s_19",
1319
+ content: "_content_1ie8s_23",
1320
+ title: "_title_1ie8s_28"
1321
+ }, mt = ({ isOpen: e, onClose: n, onSubmit: r, isSubmitDisabled: o = !1, returnFocusRef: s, labels: c = {}, colors: l, titleClassName: d = "dial-body-semi-text", destination: f, onDestinationChange: p, isSubmitting: m = !1, onPendingDestinationChange: h, ..._ }) => {
1322
+ let { title: v = "Save", changeFolderTitle: ee = "Change folder", closeAriaLabel: y = "Close", backAriaLabel: b = "Back", cancelLabel: x = "Cancel", saveLabel: S = "Save", savingLabel: w = "Saving…", selectLabel: T = "Select" } = c, E = ne({
1323
+ "--sstf-backdrop-bg": l?.backdropBackground,
1324
+ "--sstf-panel-bg": l?.panelBackground,
1325
+ "--sstf-panel-border": l?.panelBorder,
1326
+ "--sstf-divider-border": l?.dividerBorder,
1327
+ "--sstf-scrollbar-thumb": l?.scrollbarThumb,
1328
+ "--sstf-title-text": l?.titleText
1329
+ }), [O, k] = a(ut.Main), [A, te] = a(f), N = i(null), P = i(null);
1330
+ t(() => {
1331
+ e && k(ut.Main);
1332
+ }, [e]);
1333
+ let F = i(O);
1334
+ t(() => {
1335
+ F.current !== O && (F.current = O, O === ut.ChangeFolder ? N.current?.focus({ preventScroll: !0 }) : P.current?.focus({ preventScroll: !0 }));
1336
+ }, [O]);
1337
+ let I = i(e);
1338
+ t(() => {
1339
+ let t = I.current;
1340
+ I.current = e, t && !e && s?.current?.isConnected && s.current.focus({ preventScroll: !0 });
1341
+ }, [e, s]);
1342
+ let R = O === ut.ChangeFolder, z = (e) => {
1343
+ te(e), h?.(e);
1344
+ }, re = () => {
1345
+ z(f), k(ut.ChangeFolder);
1346
+ }, ie = () => {
1347
+ h?.(f), k(ut.Main);
1348
+ }, ae = () => {
1349
+ A && p(A), k(ut.Main);
1350
+ };
1351
+ return /* @__PURE__ */ V(j, {
1352
+ open: e,
1353
+ onClose: n,
1354
+ header: /* @__PURE__ */ B("span", {
1355
+ ref: N,
1356
+ tabIndex: -1,
1357
+ className: L("block truncate outline-none", d, pt.title),
1358
+ children: R ? ee : v
1359
+ }),
1360
+ ariaLabel: v,
1361
+ onBack: R ? ie : void 0,
1362
+ backAriaLabel: b,
1363
+ backDisabled: m,
1364
+ closeAriaLabel: y,
1365
+ closeDisabled: m,
1366
+ style: E,
1367
+ overlayStyle: E,
1368
+ className: L(pt.panel, "tablet:w-[540px]! tablet:max-w-[calc(100%-32px)]!"),
1369
+ overlayClassName: pt.backdrop,
1370
+ headerClassName: L("px-[22px]", pt.divider),
1371
+ bodyClassName: "flex flex-col overflow-hidden",
1372
+ children: [/* @__PURE__ */ B("div", {
1373
+ className: L("min-h-0 flex-1 overflow-y-auto p-[22px]", pt.content),
1374
+ children: /* @__PURE__ */ B(ft, {
1375
+ ..._,
1376
+ view: O,
1377
+ destination: f,
1378
+ onDestinationChange: p,
1379
+ isSubmitting: m,
1380
+ onChangeFolderClick: re,
1381
+ changeFolderButtonRef: P,
1382
+ pendingDestination: A,
1383
+ onPendingDestinationChange: z
1384
+ })
1385
+ }), /* @__PURE__ */ V("div", {
1386
+ className: L("flex items-center justify-end gap-2 border-t px-4 py-4 desktop:px-3.5", pt.footer),
1387
+ children: [/* @__PURE__ */ B(g, {
1388
+ label: x,
1389
+ className: "mobile:flex-1",
1390
+ disabled: m,
1391
+ onClick: R ? ie : n
1392
+ }), R ? /* @__PURE__ */ B(C, {
1393
+ label: T,
1394
+ className: "mobile:flex-1",
1395
+ disabled: A == null,
1396
+ onClick: ae
1397
+ }) : /* @__PURE__ */ B(D, {
1398
+ label: m ? w : S,
1399
+ className: "mobile:flex-1",
1400
+ disabled: o || m,
1401
+ iconBefore: m ? /* @__PURE__ */ B("span", {
1402
+ "aria-hidden": !0,
1403
+ children: /* @__PURE__ */ B(M, { size: u.SM })
1404
+ }) : void 0,
1405
+ onClick: r
1406
+ })]
973
1407
  })]
974
1408
  });
975
1409
  };
976
1410
  //#endregion
977
- export { $ as PUBLISH_PANEL_CLASS, M as PublicationRuleFunction, pe as PublishAccessRuleEditor, he as PublishAccessRules, N as PublishCalloutKind, ye as PublishFoldersTree, De as PublishFooter, ge as PublishHistoryList, Se as PublishPanel, ke as StandalonePublishPanel, V as collectFolderKeys, ae as derivePublishState, oe as filterFolderTree, F as formatPublishedDate, U as fromFolderPathKey, ue as getSiblingFolderNames, le as getUniqueFolderName, ce as mergeFolderPaths, se as sortFolderTree, W as toDialFileTree, H as toFolderPathKey, R as usePublishFlow, K as validateFolderName };
1411
+ export { Je as PUBLISH_PANEL_CLASS, U as PublicationRuleFunction, Ee as PublishAccessRuleEditor, Ae as PublishAccessRules, W as PublishCalloutKind, qe as PublishFoldersTree, nt as PublishFooter, Me as PublishHistoryList, Ze as PublishPanel, J as PublishPanelView, ft as SaveToFolderPanel, ut as SaveToFolderView, lt as SaveVersionMode, it as StandalonePublishPanel, mt as StandaloneSaveToFolderPanel, ct as UnpublishConfirmationDialog, pe as collectFolderKeys, G as derivePublishState, Y as filterFolderTree, K as formatPublishedDate, me as fromFolderPathKey, be as getSiblingFolderNames, ye as getUniqueFolderName, Q as mergeFolderPaths, fe as sortFolderTree, ge as toDialFileTree, $ as toFolderPathKey, ue as usePublishFlow, de as usePublishFolderView, ve as validateFolderName };