@ynput/ayon-frontend-shared 0.6.0 → 0.6.2

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 (89) hide show
  1. package/dist/ContextMenu.es.js +34 -16
  2. package/dist/DetailsPanel.es.js +461 -467
  3. package/dist/Feed.es.js +179 -50
  4. package/dist/ListTable.es.js +32 -35
  5. package/dist/NewEntity.es.js +1256 -11
  6. package/dist/ProjectTreeTable.es.js +4451 -2965
  7. package/dist/SimpleTable.es.js +8 -7
  8. package/dist/Slicer.es.js +451 -147
  9. package/dist/Views.es.js +918 -310
  10. package/dist/chunks/Actions.es.js +9 -4
  11. package/dist/chunks/ColumnDropIndicator.es.js +174 -328
  12. package/dist/chunks/ColumnDropIndicator.styled.es.js +281 -0
  13. package/dist/chunks/ColumnHeaderMenuUI.es.js +52 -0
  14. package/dist/chunks/ContextMenuContextInstance.es.js +12 -0
  15. package/dist/chunks/DeleteEntitiesConfirmDialog.es.js +229 -0
  16. package/dist/chunks/DeleteEntitiesContextInstance.es.js +827 -0
  17. package/dist/chunks/EmptyPlaceholder.es.js +4 -4
  18. package/dist/chunks/EntityPath.es.js +58 -53
  19. package/dist/chunks/EntityPickerDialog.es.js +24 -20
  20. package/dist/chunks/EntityTooltip.es.js +20 -13
  21. package/dist/chunks/EntityUpdatesContext.es.js +38 -96
  22. package/dist/chunks/Feed.es.js +1495 -1439
  23. package/dist/chunks/FilterErrorActions.es.js +25 -229
  24. package/dist/chunks/Menu.es.js +21 -17
  25. package/dist/chunks/MenuContext.es.js +14 -65
  26. package/dist/chunks/MenuItem.es.js +34 -24
  27. package/dist/chunks/MetaWidget.es.js +2835 -4301
  28. package/dist/chunks/NewEntityContextInstance.es.js +11 -0
  29. package/dist/chunks/PlayableIcon.es.js +1532 -1594
  30. package/dist/chunks/ProjectContext.es.js +102 -66
  31. package/dist/chunks/RepresentationsList.es.js +1 -1
  32. package/dist/chunks/ReviewablesSelector.es.js +457 -458
  33. package/dist/chunks/SimpleForm.es.js +9 -9
  34. package/dist/chunks/SimpleTable.es.js +15 -13
  35. package/dist/chunks/Slicer.es.js +486 -470
  36. package/dist/chunks/TableSettingsFallback.es.js +25 -13
  37. package/dist/chunks/ThumbnailSimple.es.js +150 -261
  38. package/dist/chunks/VersionUploadContextInstance.es.js +12 -0
  39. package/dist/chunks/VideoPlayer.es.js +24 -28
  40. package/dist/chunks/Watchers.es.js +384 -389
  41. package/dist/chunks/entityDefinitions.es.js +2 -350
  42. package/dist/chunks/extractVersionFromFilename.es.js +28 -0
  43. package/dist/chunks/getBundleMode.es.js +61 -16
  44. package/dist/chunks/getUris.es.js +737 -712
  45. package/dist/chunks/searchTerms.es.js +59 -57
  46. package/dist/chunks/useAttributeEnums.es.js +4 -4
  47. package/dist/chunks/useCreateContextMenu.es.js +66 -90
  48. package/dist/chunks/useHierarchySelection.es.js +24 -0
  49. package/dist/chunks/useLoadModule.es.js +74 -0
  50. package/dist/chunks/useQueryArgumentChangeLoading.es.js +11 -0
  51. package/dist/chunks/versionUploadHelpers.es.js +16 -42
  52. package/dist/chunks/viewUpdateHelper.es.js +67 -50
  53. package/dist/components.es.js +1425 -999
  54. package/dist/context.es.js +791 -80
  55. package/dist/hooks.es.js +115 -120
  56. package/dist/index.es.js +19 -23
  57. package/dist/types/Actions.d.ts +14 -14
  58. package/dist/types/ContextMenu.d.ts +18 -15
  59. package/dist/types/DetailsPanel.d.ts +109 -16
  60. package/dist/types/EntityPickerDialog.d.ts +14 -14
  61. package/dist/types/Feed.d.ts +18 -15
  62. package/dist/types/ListTable.d.ts +14 -14
  63. package/dist/types/NewEntity.d.ts +23 -17
  64. package/dist/types/ProjectTreeTable.d.ts +29 -122
  65. package/dist/types/RepresentationsList.d.ts +14 -14
  66. package/dist/types/SimpleTable.d.ts +18 -15
  67. package/dist/types/Slicer.d.ts +17 -14
  68. package/dist/types/Views.d.ts +17 -14
  69. package/dist/types/api.d.ts +139 -127
  70. package/dist/types/components.d.ts +20 -15
  71. package/dist/types/context.d.ts +63 -23
  72. package/dist/types/hooks.d.ts +14 -14
  73. package/dist/types/index.d.ts +14 -14
  74. package/dist/types/util.d.ts +21 -14
  75. package/dist/util.es.js +77 -75
  76. package/package.json +1 -1
  77. package/dist/chunks/DeleteEntitiesContext.es.js +0 -748
  78. package/dist/chunks/DetailsPanelContext.es.js +0 -155
  79. package/dist/chunks/GlobalContext.es.js +0 -52
  80. package/dist/chunks/NewEntityContext.es.js +0 -1242
  81. package/dist/chunks/ProjectFoldersContext.es.js +0 -134
  82. package/dist/chunks/ProjectFoldersContextInstance.es.js +0 -7
  83. package/dist/chunks/VersionUploadContext.es.js +0 -232
  84. package/dist/chunks/ViewsContext.es.js +0 -878
  85. package/dist/chunks/uriUtils.es.js +0 -48
  86. package/dist/chunks/useColumnDragRestriction.es.js +0 -158
  87. package/dist/chunks/useLocalStorage.es.js +0 -355
  88. package/dist/chunks/useSessionStorage.es.js +0 -61
  89. /package/dist/{useCreateContextMenu.css → ContextMenuContextInstance.css} +0 -0
@@ -1,91 +1,802 @@
1
- import { u as r, a as n } from "./chunks/useLocalStorage.es.js";
2
- import { P as S, R as f, b as M, p as g, c as D, d as F } from "./chunks/useLocalStorage.es.js";
3
- import { D as U, g as j, s as w, u as E, a as T } from "./chunks/DetailsPanelContext.es.js";
4
- import { jsx as u } from "react/jsx-runtime";
5
- import { useContext as d, useEffect as i } from "react";
6
- import { S as o } from "./chunks/DeleteEntitiesContext.es.js";
7
- import { A as R, a as h, D as O, P as L, b as _, c as G, d as I, T as N, e as q, i as W, u as V, f as Y, g as z, h as B, j as H, k as J, l as K, m as Q } from "./chunks/DeleteEntitiesContext.es.js";
1
+ import { jsx as j, jsxs as pe } from "react/jsx-runtime";
2
+ import { useState as b, useEffect as B, useCallback as E, useRef as fe, useMemo as T } from "react";
3
+ import { registerRemotes as ge } from "@module-federation/enhanced/runtime";
4
+ import { ay as me, bi as he } from "./chunks/searchTerms.es.js";
5
+ import { cQ as ye, c2 as Pe, cg as ve, bp as be, cS as we, cB as Ce, bJ as Se, cY as Ie, dl as ke, cI as Le } from "./chunks/getUris.es.js";
6
+ import "primereact/confirmdialog";
7
+ import { d as re, z as xe, a as ie, q as Ee, A as De, B as Fe, G as je, H as Te, I as Me, J as Oe, K as Re, L as Ae, N as Ue, O as Ne, Q as Be, U as Ge, V as _e, W as $e } from "./chunks/DeleteEntitiesContextInstance.es.js";
8
+ import { E as Ft, M as jt, X as Tt, P as Mt, Y as Ot, Z as Rt, T as At, _ as Ut, $ as Nt, g as Bt, a0 as Gt, m as _t, c as $t, a1 as Qt, t as Wt, a2 as qt, a3 as zt, a4 as Vt, a5 as Ht, a6 as Yt, v as Jt, u as Kt, n as Xt, a7 as Zt, x as en, y as tn, b as nn, a8 as on, a9 as sn, aa as rn, ab as an, ac as ln, ad as cn } from "./chunks/DeleteEntitiesContextInstance.es.js";
9
+ import "lodash";
10
+ import { toast as G } from "react-toastify";
11
+ import { v4 as K } from "uuid";
12
+ import { g as Qe, p as We, b as qe } from "./chunks/getBundleMode.es.js";
13
+ import { u as ae } from "./chunks/useLoadModule.es.js";
14
+ import { P as un, T as pn } from "./chunks/ProjectContext.es.js";
8
15
  import "react-dom";
9
- import { a as Z, M as $, U as ee, b as te, u as oe, c as se } from "./chunks/MenuContext.es.js";
10
- import { G as re, u as ne } from "./chunks/GlobalContext.es.js";
11
- import { P as de, u as ie, a as le } from "./chunks/ProjectContext.es.js";
12
- import { P as pe, u as ce } from "./chunks/ProjectFoldersContext.es.js";
13
- import { E as me, F as Ce, g as be, a as ve, u as ke, b as Se } from "./chunks/EntityUpdatesContext.es.js";
14
- const l = (e) => {
15
- const { setPowerpackDialog: t } = n();
16
- return i(() => {
17
- t({ addon: "planner", feature: "subtasks" }), e?.onNotFound?.();
18
- }, [t, e.onNotFound]), null;
19
- }, C = ({ children: e }) => {
20
- const [t, { outdated: s, isLoading: a }] = r({
16
+ import { p as ze, c as Ve, d as He, e as Ye, b as oe } from "./chunks/DeleteEntitiesConfirmDialog.es.js";
17
+ import { a as gn } from "./chunks/DeleteEntitiesConfirmDialog.es.js";
18
+ import { M as hn } from "./chunks/MenuContext.es.js";
19
+ import { u as Je } from "./chunks/useQueryArgumentChangeLoading.es.js";
20
+ import { E as Pn, F as vn } from "./chunks/EntityUpdatesContext.es.js";
21
+ const mt = ({ children: f, skip: i }) => {
22
+ const { data: s = [], isLoading: e } = ye(void 0, {
23
+ skip: i
24
+ }), {
25
+ siteInfo: r,
26
+ isLoading: { siteInfo: c }
27
+ } = re(), [d, h] = b(!1);
28
+ return B(() => {
29
+ if (e || c || d) return;
30
+ if (!s.length) {
31
+ h(!0);
32
+ return;
33
+ }
34
+ const y = [];
35
+ s.forEach((g) => {
36
+ const { addonName: p, addonVersion: l, modules: n = {} } = g;
37
+ Object.entries(n).forEach(([u, m]) => {
38
+ y.push({
39
+ remote: u,
40
+ addon: p,
41
+ version: l,
42
+ modules: m
43
+ });
44
+ });
45
+ }), ge(
46
+ y.map((g) => ({
47
+ name: g.remote,
48
+ alias: g.remote,
49
+ entry: `/addons/${g.addon || g.remote}/${g.version}/frontend/modules/${g.remote}/remoteEntry.js?server=${r?.releaseInfo?.version || r?.releaseInfo}-${r?.releaseInfo?.buildDate}-${(/* @__PURE__ */ new Date()).getTime()}`,
50
+ type: "module"
51
+ }))
52
+ ), h(!0);
53
+ }, [s, e, c, d]), /* @__PURE__ */ j(
54
+ xe.Provider,
55
+ {
56
+ value: {
57
+ isLoading: e,
58
+ modules: s,
59
+ remotesInitialized: d
60
+ },
61
+ children: f
62
+ }
63
+ );
64
+ }, Ke = {
65
+ planner: {
66
+ label: "Planner",
67
+ icon: "calendar_month",
68
+ features: {
69
+ subtasks: {
70
+ label: "Subtasks",
71
+ description: "Divide complex tasks into smaller, actionable items for more granular tracking and clearer responsibility.",
72
+ bullet: "Granular task breakdown with subtasks"
73
+ },
74
+ integratedPlanning: {
75
+ label: "Integrated Planning",
76
+ description: "Bridge high-level phase estimation and detailed task scheduling to map out production timelines before assigning artists.",
77
+ bullet: "High-level and granular planning in one place"
78
+ },
79
+ studioOversight: {
80
+ label: "Studio Oversight",
81
+ description: "Toggle between a bird's-eye view of all studio projects and project-specific deep-dive views to spot scheduling overlaps.",
82
+ bullet: "Cross-project scheduling and conflict detection"
83
+ },
84
+ sandboxScenarios: {
85
+ label: "Sandbox Scenarios",
86
+ description: 'Experiment with "what-if" scheduling strategies in private scenarios, then set your best version to "Live" with one click.',
87
+ bullet: 'Risk-free "what-if" scheduling experiments'
88
+ },
89
+ trackBasedTimelines: {
90
+ label: "Track-Based Timelines",
91
+ description: "Manage complex timelines using familiar lane-based organization—similar to video editing—for episodes, departments, or assets.",
92
+ bullet: "Familiar lane-based timeline organization"
93
+ },
94
+ dataPortability: {
95
+ label: "Data Portability",
96
+ description: "Export schedules to CSV or ICS to keep your team synced across spreadsheets, calendars, and other platforms.",
97
+ bullet: "CSV and ICS export for universal sync"
98
+ }
99
+ },
100
+ featureOrder: [
101
+ "subtasks",
102
+ "integratedPlanning",
103
+ "studioOversight",
104
+ "sandboxScenarios",
105
+ "trackBasedTimelines",
106
+ "dataPortability"
107
+ ]
108
+ }
109
+ }, ht = ({
110
+ children: f,
111
+ defaultTab: i = "feed",
112
+ hasLicense: s,
113
+ debug: e = {},
114
+ ...r
115
+ }) => {
116
+ const c = r.user, d = Qe(c), h = "isGuest" in e ? e.isGuest : c?.data?.isGuest, { powerLicense: y, setPowerpackDialog: g } = ie(), p = "hasLicense" in e ? e.hasLicense : !!y || s, [l, n] = b({}), [u, m] = b([]), [S, v] = b([]), x = E(
117
+ (C) => l[C] ? l[C] : !1,
118
+ [l]
119
+ ), D = E(
120
+ (C, N) => {
121
+ const R = { ...l };
122
+ R[C] = N, n(R);
123
+ },
124
+ [l]
125
+ ), [o, a] = Ee(Te, {}), w = E(
126
+ (C) => {
127
+ const N = o[C];
128
+ return De(N) ? N : i;
129
+ },
130
+ [o, i]
131
+ ), [P, I] = b(null), M = E((C) => {
132
+ I(C);
133
+ }, []), F = E(() => {
134
+ I(null), P && U([]);
135
+ }, []);
136
+ B(() => {
137
+ F();
138
+ }, [r.useLocation().pathname]);
139
+ const [t, k] = b(null), L = E((C) => {
140
+ k(C);
141
+ }, []), O = E(() => {
142
+ k(null);
143
+ }, []), [A, _] = b(null), [H, U] = b([]), { uriType: Y, uri: le, entity: $, getUriEntities: ce } = Fe(), [Q] = r.useSearchParams(), W = Q.get("project"), q = Q.get("type"), z = Q.get("id"), X = Q.get("activity");
144
+ B(() => {
145
+ if (!(!W && !q && !z)) {
146
+ if (Y === "entity" && $ && $.entityType !== "product") {
147
+ ce().then((C) => {
148
+ if (C.length === 0) return;
149
+ const N = C.find((ue) => ue.uri === le), R = N?.entities?.[0];
150
+ if (!N || !R) return;
151
+ const te = R?.projectName || $.projectName || "", ne = R.representationId || R.versionId || R.productId || R.taskId || R.folderId;
152
+ if (!te || !ne) return;
153
+ const de = {
154
+ entityType: $.entityType,
155
+ entities: [
156
+ {
157
+ id: ne,
158
+ projectName: te
159
+ }
160
+ ],
161
+ source: "uri"
162
+ };
163
+ _(de);
164
+ }).catch((C) => {
165
+ console.warn("Failed to get URI entities:", C);
166
+ });
167
+ return;
168
+ }
169
+ W && q && z && (_({
170
+ entityType: q,
171
+ entities: [
172
+ {
173
+ id: z,
174
+ projectName: W
175
+ }
176
+ ],
177
+ source: "url"
178
+ }), X && (U([X]), a({
179
+ ...o,
180
+ overview: "feed"
181
+ })));
182
+ }
183
+ }, [W, q, z]);
184
+ const V = {
185
+ // open state for the panel by scope
186
+ panelOpenByScope: l,
187
+ getOpenForScope: x,
188
+ setPanelOpen: D,
189
+ setPanelOpenByScope: n,
190
+ // tab preferences
191
+ tabsByScope: o,
192
+ getTabForScope: w,
193
+ // slide out state
194
+ slideOut: P,
195
+ openSlideOut: M,
196
+ closeSlideOut: F,
197
+ // highlighted activities
198
+ highlightedActivities: H,
199
+ setHighlightedActivities: U,
200
+ // PiP state
201
+ pip: t,
202
+ openPip: L,
203
+ closePip: O,
204
+ // entities state
205
+ entities: A,
206
+ setEntities: _,
207
+ feedAnnotations: u,
208
+ setFeedAnnotations: m,
209
+ feedFrameLinks: S,
210
+ setFeedFrameLinks: v,
211
+ bundleMode: d,
212
+ isGuest: h,
213
+ hasLicense: p,
214
+ onPowerFeature: g,
215
+ ...r
216
+ }, J = fe(V), Z = J.current, ee = Object.keys(V);
217
+ return (ee.length !== Object.keys(Z).length || ee.some((C) => Z[C] !== V[C])) && (J.current = V), /* @__PURE__ */ j(je.Provider, { value: J.current, children: f });
218
+ }, Xe = (f) => {
219
+ const { setPowerpackDialog: i } = ie();
220
+ return B(() => {
221
+ i({ addon: "planner", feature: "subtasks" }), f?.onNotFound?.();
222
+ }, [i, f.onNotFound]), null;
223
+ }, yt = ({ children: f }) => {
224
+ const [i, { outdated: s, isLoading: e }] = ae({
21
225
  addon: "planner",
22
226
  remote: "planner",
23
227
  module: "SubtasksManager",
24
- fallback: l
228
+ fallback: Xe
229
+ });
230
+ return /* @__PURE__ */ j(
231
+ Me.Provider,
232
+ {
233
+ value: { SubtasksManager: i, requiredVersion: s?.required, isLoading: e },
234
+ children: f
235
+ }
236
+ );
237
+ }, Pt = ({ children: f }) => {
238
+ const [i, s] = b(!1), [e, r] = b(null), [c, d] = b(null), h = () => {
239
+ s(!0), r(null);
240
+ }, y = () => {
241
+ s(!1), r(null);
242
+ }, g = (n, u = null) => {
243
+ s((m) => !m), n && !i ? (r(n), d(u)) : (r(null), d(null));
244
+ }, p = (n, u = null) => {
245
+ r(n), d(u);
246
+ }, l = () => {
247
+ r(null), d(null);
248
+ };
249
+ return /* @__PURE__ */ j(
250
+ Oe.Provider,
251
+ {
252
+ value: {
253
+ isPanelOpen: i,
254
+ selectedSetting: e,
255
+ highlightedSetting: c,
256
+ setHighlightedSetting: d,
257
+ openPanel: h,
258
+ closePanel: y,
259
+ togglePanel: g,
260
+ selectSetting: p,
261
+ backToMainMenu: l
262
+ },
263
+ children: f
264
+ }
265
+ );
266
+ };
267
+ function vt({ children: f }) {
268
+ const i = window.location.protocol === "https:" || window.location.hostname === "localhost", s = "documentPictureInPicture" in window && i, [e, r] = b(null), [c, d] = b(null), h = E(() => {
269
+ d(null), e != null && (e.close(), r(null));
270
+ }, [e, c]), y = E(
271
+ async (p, l) => {
272
+ if (!s) {
273
+ d(K());
274
+ return;
275
+ }
276
+ if (e != null) {
277
+ console.log("pipWindow is already open"), d(K());
278
+ return;
279
+ }
280
+ const n = await window.documentPictureInPicture.requestWindow({
281
+ width: p,
282
+ height: l
283
+ });
284
+ n.addEventListener("pagehide", () => {
285
+ r(null), d(null);
286
+ }), r(n), d(K());
287
+ },
288
+ [e, c]
289
+ );
290
+ B(() => {
291
+ [...document.styleSheets].forEach((p) => {
292
+ try {
293
+ const l = [...p.cssRules].map((m) => m.cssText).join(""), n = document.createElement("style");
294
+ n.textContent = l, e?.document.head.appendChild(n);
295
+ const u = document.createElement("style");
296
+ u.textContent = `
297
+ html, body, .pipRoot {
298
+ height: 100%;
299
+ margin: 0;
300
+ padding: 0;
301
+ overflow: hidden;
302
+ }`, e?.document.head.appendChild(u);
303
+ } catch {
304
+ const n = document.createElement("link");
305
+ if (p.href == null)
306
+ return;
307
+ n.rel = "stylesheet", n.type = p.type, n.media = p.media.toString(), n.href = p.href, e?.document.head.appendChild(n);
308
+ }
309
+ });
310
+ }, [e]);
311
+ const g = T(() => ({
312
+ isSupported: s,
313
+ pipWindow: e,
314
+ pipId: c,
315
+ requestPipWindow: y,
316
+ closePipWindow: h
317
+ }), [h, s, e, y]);
318
+ return /* @__PURE__ */ j(Re.Provider, { value: g, children: f });
319
+ }
320
+ const bt = ({
321
+ children: f,
322
+ projectName: i,
323
+ // utils
324
+ toast: s,
325
+ ...e
326
+ }) => {
327
+ const { data: r } = Pe(
328
+ { projectName: i },
329
+ { skip: !i }
330
+ ), { user: c } = re();
331
+ return /* @__PURE__ */ j(
332
+ Ae.Provider,
333
+ {
334
+ value: {
335
+ ...e,
336
+ projectName: i,
337
+ project: r,
338
+ user: c,
339
+ toast: s
340
+ },
341
+ children: f
342
+ }
343
+ );
344
+ }, wt = ({ children: f, ...i }) => /* @__PURE__ */ j(Ue.Provider, { value: { ...i }, children: f }), Ct = ({
345
+ children: f,
346
+ debug: i
347
+ }) => {
348
+ const [s, e] = b(null), [r, c] = b(null), d = (o) => o !== null && typeof o == "object" && "addon" in o, h = E((o) => {
349
+ o === null ? (e(null), c(null)) : d(o) ? (e(null), c(o)) : (c(null), e(o));
350
+ }, []), y = (o) => o ? ze[o] : null, g = (o) => {
351
+ if (!o) return null;
352
+ const a = Ke[o.addon];
353
+ return a ? { ...a, selectedFeature: o.feature } : null;
354
+ }, [p, l] = b(!1), [n, u] = b(!0), m = async () => !1, [S, { isLoaded: v, isLoading: x }] = ae({
355
+ addon: "powerpack",
356
+ remote: "license",
357
+ module: "checkPowerLicense",
358
+ fallback: m
25
359
  });
26
- return /* @__PURE__ */ u(
27
- o.Provider,
360
+ B(() => {
361
+ (async () => {
362
+ if (i?.powerLicense !== void 0)
363
+ console.warn("Using debug power license:", i.powerLicense), l(i.powerLicense), u(!1);
364
+ else if (v || !x) {
365
+ try {
366
+ const a = await S();
367
+ l(a);
368
+ } catch (a) {
369
+ console.error("Error checking power license:", a), l(!1);
370
+ } finally {
371
+ u(!1);
372
+ }
373
+ u(!1);
374
+ }
375
+ })();
376
+ }, [i, v, x, S]);
377
+ const D = T(
378
+ () => ({
379
+ powerLicense: p,
380
+ isLoading: n,
381
+ selectedPowerPack: s,
382
+ selectedAddon: r,
383
+ setPowerpackDialog: h,
384
+ powerpackDialog: y(s),
385
+ addonDialog: g(r)
386
+ }),
387
+ [p, s, r, h, n]
388
+ );
389
+ return /* @__PURE__ */ j(Ne.Provider, { value: D, children: f });
390
+ }, St = ({ children: f, skip: i = !1 }) => {
391
+ const {
392
+ data: s = {},
393
+ isLoading: e,
394
+ error: r
395
+ } = ve({ full: !0 }, { skip: i }), { data: c, isLoading: d, error: h } = be(), {
396
+ data: y = [],
397
+ isLoading: g,
398
+ error: p
399
+ } = we({}, { skip: i }), l = T(() => y.filter((S) => S.active), [y]), {
400
+ data: n,
401
+ isLoading: u,
402
+ error: m
403
+ } = Ce(void 0, { skip: !c?.name });
404
+ return /* @__PURE__ */ j(
405
+ Be.Provider,
28
406
  {
29
- value: { SubtasksManager: t, requiredVersion: s?.required, isLoading: a },
30
- children: e
407
+ value: {
408
+ siteInfo: s,
409
+ attributes: s?.attributes || [],
410
+ user: c,
411
+ cloudInfo: n,
412
+ projects: {
413
+ all: y,
414
+ active: l
415
+ },
416
+ isLoading: {
417
+ siteInfo: e,
418
+ user: d,
419
+ cloudInfo: u,
420
+ projects: g
421
+ },
422
+ error: {
423
+ siteInfo: r,
424
+ user: h,
425
+ cloudInfo: m,
426
+ projects: p
427
+ }
428
+ },
429
+ children: f
430
+ }
431
+ );
432
+ }, It = ({
433
+ projectName: f,
434
+ children: i
435
+ }) => {
436
+ const {
437
+ data: { folders: s = [] } = {},
438
+ isLoading: e,
439
+ isFetching: r,
440
+ isSuccess: c,
441
+ isUninitialized: d,
442
+ error: h,
443
+ refetch: y
444
+ } = Se({ projectName: f, attrib: !0 }), g = Je({ projectName: f }, r || e), p = T(() => {
445
+ const o = /* @__PURE__ */ new Map();
446
+ for (const a of s)
447
+ o.set(a.id, a);
448
+ return o;
449
+ }, [s]), l = T(() => (o) => p.get(o), [p]), n = T(
450
+ () => (o, a, w = {}) => {
451
+ if (!a.length) return {};
452
+ const P = {}, I = new Set(a), M = /* @__PURE__ */ new Set();
453
+ let F = o;
454
+ for (; I.size > 0 && F && !M.has(F); ) {
455
+ M.add(F);
456
+ const t = p.get(F);
457
+ if (!t) break;
458
+ const k = t.attrib || {};
459
+ for (const L of Array.from(I))
460
+ t.ownAttrib?.includes(L) && L in k && (P[L] = Object.entries(k).find(
461
+ ([O]) => O === L
462
+ )?.[1], I.delete(L));
463
+ F = t.parentId;
464
+ }
465
+ for (const t of Array.from(I))
466
+ t in w && (P[t] = w[t], I.delete(t));
467
+ for (const t of I)
468
+ P[t] = null;
469
+ return P;
470
+ },
471
+ [p]
472
+ ), u = T(
473
+ () => (o) => {
474
+ const a = [], w = /* @__PURE__ */ new Set();
475
+ let P = o;
476
+ for (; P && !w.has(P); ) {
477
+ w.add(P);
478
+ const I = p.get(P);
479
+ if (!I?.parentId) break;
480
+ a.push(I.parentId), P = I.parentId;
481
+ }
482
+ return a;
483
+ },
484
+ [p]
485
+ ), m = T(
486
+ () => (o) => {
487
+ const a = new Set(o);
488
+ return o.filter((w) => !u(w).some((P) => a.has(P)));
489
+ },
490
+ [u]
491
+ ), S = T(() => {
492
+ const o = /* @__PURE__ */ new Map();
493
+ for (const a of s) {
494
+ if (!a.parentId) continue;
495
+ const w = o.get(a.parentId);
496
+ w ? w.push(a.id) : o.set(a.parentId, [a.id]);
31
497
  }
498
+ return o;
499
+ }, [s]), v = T(
500
+ () => (o, a = !1) => {
501
+ const w = a ? [...o] : [], P = [...o];
502
+ for (; P.length > 0; ) {
503
+ const I = P.shift();
504
+ for (const M of S.get(I) || [])
505
+ w.push(M), P.push(M);
506
+ }
507
+ return w;
508
+ },
509
+ [S]
510
+ ), x = () => y().unwrap(), D = T(
511
+ () => ({
512
+ folders: s,
513
+ getFolderById: l,
514
+ findNonInheritedValues: n,
515
+ getParentFolderIds: u,
516
+ getFolderIdsWithoutChildren: m,
517
+ getChildFolderIds: v,
518
+ isLoading: g,
519
+ // first time and when args change
520
+ isFetching: r,
521
+ // any background fetching
522
+ isSuccess: c,
523
+ isUninitialized: d,
524
+ error: h,
525
+ refetch: x
526
+ }),
527
+ [
528
+ s,
529
+ l,
530
+ n,
531
+ u,
532
+ m,
533
+ v,
534
+ g,
535
+ r,
536
+ c,
537
+ d,
538
+ h,
539
+ x
540
+ ]
32
541
  );
33
- }, b = () => {
34
- const e = d(o);
35
- if (!e)
36
- throw new Error("useSubtasksModulesContext must be used within a SubtasksModulesProvider");
37
- return e;
542
+ return /* @__PURE__ */ j(Ge.Provider, { value: D, children: i });
543
+ }, kt = "uri", Lt = ({ children: f }) => {
544
+ const i = location.pathname, [s, e] = b(""), r = ["projects", "settings", "dashboard/tasks"];
545
+ B(() => {
546
+ r.some((u) => i.startsWith(`/${u}`)) || e("");
547
+ }, [i, e]);
548
+ const { type: c, entity: d, settings: h } = We(s), y = E(
549
+ ({ projectName: n, folderPath: u, taskName: m, productName: S, versionName: v }) => {
550
+ const x = qe({ projectName: n, folderPath: u, taskName: m, productName: S, versionName: v });
551
+ e(x);
552
+ },
553
+ [e]
554
+ ), [g] = Ie(), p = E(async () => {
555
+ if (c !== "entity" || !s) return [];
556
+ try {
557
+ const n = await g({ resolveRequestModel: { uris: [s] } }).unwrap();
558
+ return console.log("Resolved entity from URI:", n), n;
559
+ } catch (n) {
560
+ return console.warn("Failed to resolve URI:", n), [];
561
+ }
562
+ }, [g, s, c]), l = {
563
+ uri: s,
564
+ uriType: c,
565
+ entity: d,
566
+ settings: h,
567
+ setUri: e,
568
+ setEntityUri: y,
569
+ getUriEntities: p
570
+ };
571
+ return /* @__PURE__ */ j(_e.Provider, { value: l, children: f });
572
+ }, se = [
573
+ "representation",
574
+ "version",
575
+ "workfile",
576
+ "product",
577
+ "task",
578
+ "folder"
579
+ ], Ze = "delete-folder-with-children", xt = ({ children: f }) => {
580
+ const [i] = ke(), [s] = Le(), [e, r] = b(null), [c, d] = b(null), h = E(
581
+ (l) => new Promise((n) => d({ payload: l, resolve: n })),
582
+ []
583
+ ), y = E(
584
+ async (l, n) => {
585
+ if (!l || l.length === 0) {
586
+ G.error("No entities selected");
587
+ return;
588
+ }
589
+ const u = /* @__PURE__ */ new Set(), m = l.filter((t) => !t?.id || u.has(t.id) ? !1 : (u.add(t.id), !0));
590
+ if (m.length === 0) {
591
+ G.error("No entities found");
592
+ return;
593
+ }
594
+ const S = new Set(m.map((t) => t.id)), v = m.filter((t) => t.entityType === "folder" && t.parentId ? !S.has(t.parentId) : (t.entityType === "task" || t.entityType === "product") && t.folderId ? !S.has(t.folderId) : !0), x = async (t, k) => {
595
+ if (t.length === 0) return;
596
+ const L = /* @__PURE__ */ new Map();
597
+ for (const O of t) {
598
+ const A = L.get(O.projectName) || [];
599
+ A.push(O), L.set(O.projectName, A);
600
+ }
601
+ await Promise.all(
602
+ Array.from(L.entries()).map(([O, A]) => {
603
+ const H = [...A].sort(
604
+ (U, Y) => se.indexOf(U.entityType) - se.indexOf(Y.entityType)
605
+ ).map((U) => ({
606
+ type: "delete",
607
+ entityType: U.entityType,
608
+ entityId: U.id,
609
+ force: k
610
+ }));
611
+ return i({
612
+ operationsRequestModel: { operations: H },
613
+ projectName: O
614
+ }).unwrap();
615
+ })
616
+ );
617
+ }, D = async () => {
618
+ try {
619
+ await x(v, !1), n?.onSuccess?.();
620
+ } catch (t) {
621
+ throw { message: he(t) || "Failed to delete entities", ...t };
622
+ }
623
+ }, o = () => x(
624
+ v.filter((t) => t.entityType === "folder" || t.entityType === "task"),
625
+ !0
626
+ ), a = v.filter((t) => t.entityType === "folder");
627
+ let w = [];
628
+ if (a.length > 0) {
629
+ const t = /* @__PURE__ */ new Map();
630
+ for (const k of a) {
631
+ const L = t.get(k.projectName) || [];
632
+ L.push(k), t.set(k.projectName, L);
633
+ }
634
+ try {
635
+ w = (await Promise.all(
636
+ Array.from(t.entries()).map(
637
+ ([L, O]) => s({
638
+ projectName: L,
639
+ folderIds: O.map((A) => A.id)
640
+ }).unwrap()
641
+ )
642
+ )).flat();
643
+ } catch (k) {
644
+ console.warn("Failed to fetch folder delete info, falling back to local data", k);
645
+ }
646
+ }
647
+ const P = Ve(a, w), I = v.filter((t) => t.entityType === "product").length;
648
+ I > 0 && P.push(
649
+ I > 1 ? "Deleting these products also deletes all their versions" : "Deleting this product also deletes all its versions"
650
+ );
651
+ const M = He(v), F = v.length === 1 ? v[0] : void 0;
652
+ r({
653
+ payload: {
654
+ entityLabel: M,
655
+ childrenDetails: P,
656
+ expectedCounts: Ye(v, w),
657
+ expectedName: F && (F.label || F.name || F.id)
658
+ },
659
+ accept: D,
660
+ recover: async (t) => me(t).includes(Ze) ? await h({
661
+ entityLabel: M,
662
+ message: `Are you really sure you want to delete ${M} and all of its dependencies? This cannot be undone. (NOT RECOMMENDED)`,
663
+ childrenDetails: [],
664
+ expectedCounts: {},
665
+ deleteLabel: "Force delete"
666
+ }) ? (await o(), n?.onSuccess?.(), "recovered") : "cancelled" : "unhandled"
667
+ });
668
+ },
669
+ [i, s, h]
670
+ ), g = E(async () => {
671
+ if (!e) return;
672
+ const { payload: l, accept: n, recover: u } = e;
673
+ r(null);
674
+ const m = l.entityLabel, S = G.loading(`Deleting ${m}...`, { autoClose: !1 }), v = () => G.update(S, {
675
+ render: `${m} deleted`,
676
+ type: "success",
677
+ autoClose: 5e3,
678
+ isLoading: !1
679
+ });
680
+ try {
681
+ await n(), v();
682
+ } catch (x) {
683
+ let D = x;
684
+ try {
685
+ const a = await u(x);
686
+ if (a === "recovered") return v();
687
+ if (a === "cancelled")
688
+ return G.update(S, {
689
+ render: `${m} was not deleted`,
690
+ type: "info",
691
+ autoClose: 5e3,
692
+ isLoading: !1
693
+ });
694
+ } catch (a) {
695
+ D = a;
696
+ }
697
+ const o = typeof D == "string" ? D : D?.message || D?.error || `Error deleting ${m}`;
698
+ G.update(S, {
699
+ render: o,
700
+ type: "error",
701
+ autoClose: 5e3,
702
+ isLoading: !1
703
+ });
704
+ }
705
+ }, [e]), p = T(() => ({ deleteEntities: y }), [y]);
706
+ return /* @__PURE__ */ pe($e.Provider, { value: p, children: [
707
+ f,
708
+ e && /* @__PURE__ */ j(
709
+ oe,
710
+ {
711
+ payload: e.payload,
712
+ onConfirm: g,
713
+ onCancel: () => r(null)
714
+ }
715
+ ),
716
+ c && /* @__PURE__ */ j(
717
+ oe,
718
+ {
719
+ payload: c.payload,
720
+ onConfirm: () => {
721
+ d(null), c.resolve(!0);
722
+ },
723
+ onCancel: () => {
724
+ d(null), c.resolve(!1);
725
+ }
726
+ }
727
+ )
728
+ ] });
38
729
  };
39
730
  export {
40
- R as AddonProjectProvider,
41
- h as AddonProvider,
42
- O as DeleteEntitiesProvider,
43
- U as DetailsPanelProvider,
44
- me as EntityUpdatesProvider,
45
- Ce as FORCE_AUTO_SYNC,
46
- re as GlobalProvider,
47
- Z as MenuContext,
48
- $ as MenuProvider,
49
- L as PiPProvider,
50
- _ as PiPWrapper,
51
- S as PowerpackProvider,
52
- de as ProjectContextProvider,
53
- pe as ProjectFoldersContextProvider,
54
- f as RemoteModulesProvider,
55
- G as SettingsPanelProvider,
56
- I as SocketProvider,
57
- C as SubtasksModulesProvider,
58
- N as ThumbnailUploadContext,
59
- q as ThumbnailUploadProvider,
60
- ee as URIProvider,
61
- te as URL_PARAM_ID,
62
- M as addonConfigs,
63
- j as getActivityFrameLink,
64
- be as getAutoSyncForTopic,
65
- ve as getUpdateType,
66
- W as isDeletableEntityType,
67
- g as powerpackFeatureOrder,
68
- D as powerpackFeatures,
69
- w as setDetailsPanelTabForScope,
70
- V as useAddonContext,
71
- Y as useAddonProjectContext,
72
- ke as useAutoSyncSettings,
73
- z as useDeleteEntitiesContext,
74
- B as useDeleteEntitiesContextOptional,
75
- E as useDetailsPanelContext,
76
- ne as useGlobalContext,
77
- oe as useMenuContext,
78
- ie as useOptionalProjectContext,
79
- H as usePiPWindow,
80
- n as usePowerpack,
81
- le as useProjectContext,
82
- ce as useProjectFoldersContext,
83
- F as useRemoteModules,
84
- T as useScopedDetailsPanel,
85
- J as useSettingsPanel,
86
- K as useSocketContext,
87
- b as useSubtasksModulesContext,
88
- Se as useSyncUpdates,
89
- Q as useThumbnailUploadContext,
90
- se as useURIContext
731
+ Ue as AddonContext,
732
+ Ae as AddonProjectContext,
733
+ bt as AddonProjectProvider,
734
+ wt as AddonProvider,
735
+ $e as DeleteEntitiesContext,
736
+ xt as DeleteEntitiesProvider,
737
+ je as DetailsPanelContext,
738
+ ht as DetailsPanelProvider,
739
+ Ft as EntityUpdatesContext,
740
+ Pn as EntityUpdatesProvider,
741
+ vn as FORCE_AUTO_SYNC,
742
+ Be as GlobalContext,
743
+ St as GlobalProvider,
744
+ jt as MenuContext,
745
+ hn as MenuProvider,
746
+ Re as PiPContext,
747
+ vt as PiPProvider,
748
+ Tt as PiPWrapper,
749
+ Ne as PowerpackContext,
750
+ Ct as PowerpackProvider,
751
+ Mt as ProjectContext,
752
+ un as ProjectContextProvider,
753
+ Ge as ProjectFoldersContext,
754
+ It as ProjectFoldersContextProvider,
755
+ xe as RemoteModulesContext,
756
+ mt as RemoteModulesProvider,
757
+ Oe as SettingsPanelContext,
758
+ Pt as SettingsPanelProvider,
759
+ Ot as SocketContext,
760
+ Rt as SocketProvider,
761
+ Me as SubtasksModulesContext,
762
+ yt as SubtasksModulesProvider,
763
+ Te as TABS_BY_SCOPE_KEY,
764
+ At as ThumbnailUploadContext,
765
+ pn as ThumbnailUploadProvider,
766
+ _e as URIContext,
767
+ Lt as URIProvider,
768
+ kt as URL_PARAM_ID,
769
+ Ke as addonConfigs,
770
+ Ut as getActivityFrameLink,
771
+ Nt as getAutoSyncForTopic,
772
+ Bt as getUpdateType,
773
+ Gt as isDeletableEntityType,
774
+ De as isDetailsPanelTab,
775
+ _t as matchesProject,
776
+ $t as matchesTopic,
777
+ gn as powerpackFeatureOrder,
778
+ ze as powerpackFeatures,
779
+ Qt as setDetailsPanelTabForScope,
780
+ Wt as toggleSyncAll,
781
+ qt as useAddonContext,
782
+ zt as useAddonProjectContext,
783
+ Vt as useAutoSyncSettings,
784
+ Ht as useDeleteEntitiesContext,
785
+ Yt as useDeleteEntitiesContextOptional,
786
+ Jt as useDetailsPanelContext,
787
+ re as useGlobalContext,
788
+ Kt as useMenuContext,
789
+ Xt as useOptionalProjectContext,
790
+ Zt as usePiPWindow,
791
+ ie as usePowerpack,
792
+ en as useProjectContext,
793
+ tn as useProjectFoldersContext,
794
+ nn as useRemoteModules,
795
+ on as useScopedDetailsPanel,
796
+ sn as useSettingsPanel,
797
+ rn as useSocketContext,
798
+ an as useSubtasksModulesContext,
799
+ ln as useSyncUpdates,
800
+ cn as useThumbnailUploadContext,
801
+ Fe as useURIContext
91
802
  };