@gen-epix/ui-client-common 4.6.1 → 4.7.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 (123) hide show
  1. package/README.md +2 -2
  2. package/dist/_chunks/Breadcrumbs.js +4 -4
  3. package/dist/_chunks/CrudPage.js +166 -166
  4. package/dist/_chunks/CrudPage.js.map +1 -1
  5. package/dist/_chunks/Notifications.js +16 -16
  6. package/dist/_chunks/QueryClientProvider.js +1 -1
  7. package/dist/_chunks/QueryClientProvider.js.map +1 -1
  8. package/dist/_chunks/QueryClientService.js +73 -72
  9. package/dist/_chunks/QueryClientService.js.map +1 -1
  10. package/dist/_chunks/Table.js +853 -744
  11. package/dist/_chunks/Table.js.map +1 -1
  12. package/dist/_chunks/TableUtil.js +38 -38
  13. package/dist/_chunks/TableUtil.js.map +1 -1
  14. package/dist/_chunks/UserInvitationsAdminPage.js +131 -131
  15. package/dist/_chunks/UserInvitationsAdminPage.js.map +1 -1
  16. package/dist/_chunks/_baseFlatten.js +12 -12
  17. package/dist/_chunks/_baseFlatten.js.map +1 -1
  18. package/dist/_chunks/_baseIteratee.js +78 -78
  19. package/dist/_chunks/_baseIteratee.js.map +1 -1
  20. package/dist/_chunks/decorate.js +1 -1
  21. package/dist/_chunks/decorateParam.js +1 -1
  22. package/dist/_chunks/middleware.js +66 -70
  23. package/dist/_chunks/middleware.js.map +1 -1
  24. package/dist/_chunks/omit.js +98 -98
  25. package/dist/_chunks/omit.js.map +1 -1
  26. package/dist/_chunks/query.js +108 -92
  27. package/dist/_chunks/query.js.map +1 -1
  28. package/dist/_chunks/react.js +1 -1
  29. package/dist/_chunks/react.js.map +1 -1
  30. package/dist/_chunks/tableStore.js +61 -58
  31. package/dist/_chunks/tableStore.js.map +1 -1
  32. package/dist/_chunks/useColumnsMenu.js +73 -71
  33. package/dist/_chunks/useColumnsMenu.js.map +1 -1
  34. package/dist/_chunks/useMutation.js +2 -2
  35. package/dist/_chunks/useMutation.js.map +1 -1
  36. package/dist/_chunks/useQueryMemo.js +15 -16
  37. package/dist/_chunks/useQueryMemo.js.map +1 -1
  38. package/dist/_chunks/vanilla.js +1 -1
  39. package/dist/_chunks/vanilla.js.map +1 -1
  40. package/dist/_chunks/yup.js +2 -2
  41. package/dist/_chunks/yup.js.map +1 -1
  42. package/dist/classes/services/AuthenticationService/index.js +8 -8
  43. package/dist/classes/services/AuthenticationService/index.js.map +1 -1
  44. package/dist/classes/services/AuthorizationService/index.js +4 -4
  45. package/dist/classes/services/AuthorizationService/index.js.map +1 -1
  46. package/dist/classes/services/BreadcrumbService/index.js +4 -4
  47. package/dist/classes/services/BreadcrumbService/index.js.map +1 -1
  48. package/dist/classes/services/EmotionCacheService/index.js.map +1 -1
  49. package/dist/classes/services/InactivityService/index.js +30 -30
  50. package/dist/classes/services/InactivityService/index.js.map +1 -1
  51. package/dist/classes/services/LogService/index.js +15 -15
  52. package/dist/classes/services/LogService/index.js.map +1 -1
  53. package/dist/classes/services/PageEventBusService/index.js.map +1 -1
  54. package/dist/components/app/App/index.js +26 -24
  55. package/dist/components/app/App/index.js.map +1 -1
  56. package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js +18 -18
  57. package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js.map +1 -1
  58. package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js +18 -18
  59. package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js.map +1 -1
  60. package/dist/components/app/AuthenticationWrapper/index.js +15 -15
  61. package/dist/components/app/AuthorizationWrapper/index.js +16 -16
  62. package/dist/components/app/AuthorizationWrapper/index.js.map +1 -1
  63. package/dist/components/app/RouterRoot/index.js +33 -33
  64. package/dist/components/app/RouterRoot/index.js.map +1 -1
  65. package/dist/components/epi/EpiContactDetailsDialog/index.js +4 -4
  66. package/dist/components/epi/EpiContactDetailsDialog/index.js.map +1 -1
  67. package/dist/components/ui/ApplicationBar/index.js +234 -234
  68. package/dist/components/ui/ApplicationBar/index.js.map +1 -1
  69. package/dist/components/ui/GenericErrorMessage/index.js +13 -13
  70. package/dist/components/ui/LicensesDialog/index.js +6 -6
  71. package/dist/components/ui/OrganizationSwitcherDialog/index.js +11 -11
  72. package/dist/components/ui/OutagesDialog/index.js +4 -4
  73. package/dist/components/ui/OutagesDialog/index.js.map +1 -1
  74. package/dist/components/ui/PageContainer/index.js +5 -5
  75. package/dist/components/ui/PageContainer/index.js.map +1 -1
  76. package/dist/components/ui/ResponseHandler/index.js +4 -4
  77. package/dist/components/ui/SortableList/SortableList.d.ts +5 -3
  78. package/dist/components/ui/Table/Table.d.ts +5 -2
  79. package/dist/components/ui/Table/TableColumnsEditorDialog.d.ts +13 -2
  80. package/dist/components/ui/Table/index.d.ts +1 -0
  81. package/dist/components/ui/Table/index.js +1 -1
  82. package/dist/components/ui/UserFeedbackDialog/index.js +15 -15
  83. package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js +12 -12
  84. package/dist/dataHooks/useIdentifierIssuerQuery/index.js +11 -11
  85. package/dist/dataHooks/useInviteUserConstraintsQuery/index.js +5 -5
  86. package/dist/dataHooks/useInviteUserConstraintsQuery/index.js.map +1 -1
  87. package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js +15 -15
  88. package/dist/dataHooks/useOrganizationsQuery/index.js +7 -7
  89. package/dist/dataHooks/useUsersQuery/index.js +10 -10
  90. package/dist/hooks/useCreateMutation/index.js +14 -14
  91. package/dist/hooks/useCreateMutation/index.js.map +1 -1
  92. package/dist/hooks/useDeleteMutation/index.js +17 -17
  93. package/dist/hooks/useDeleteMutation/index.js.map +1 -1
  94. package/dist/hooks/useEditMutation/index.js +22 -22
  95. package/dist/hooks/useEditMutation/index.js.map +1 -1
  96. package/dist/hooks/useInitializeTableStore/index.js +6 -6
  97. package/dist/hooks/useInitializeTableStore/index.js.map +1 -1
  98. package/dist/locale/en.json +13 -5
  99. package/dist/locale/nl.json +13 -5
  100. package/dist/pages/AcceptInvitationPage/index.js +10 -10
  101. package/dist/pages/AdminPage/index.js +19 -19
  102. package/dist/pages/ChooseIdentityProviderPage/index.js +5 -5
  103. package/dist/pages/ErrorPage/index.js +4 -4
  104. package/dist/pages/IdentifierIssuersAdminPage/index.js +7 -7
  105. package/dist/pages/IdentifierIssuersAdminPage/index.js.map +1 -1
  106. package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js +16 -16
  107. package/dist/pages/OrganizationContactsAdminPage/index.js +10 -10
  108. package/dist/pages/OrganizationContactsAdminPage/index.js.map +1 -1
  109. package/dist/pages/OrganizationSitesAdminPage/index.js +12 -12
  110. package/dist/pages/OrganizationSitesAdminPage/index.js.map +1 -1
  111. package/dist/pages/OrganizationsAdminPage/index.js +20 -20
  112. package/dist/pages/OrganizationsAdminPage/index.js.map +1 -1
  113. package/dist/pages/OutagesAdminPage/index.js +11 -11
  114. package/dist/pages/OutagesAdminPage/index.js.map +1 -1
  115. package/dist/pages/RouterErrorPage/index.js +4 -4
  116. package/dist/pages/UsersAdminPage/index.js +34 -34
  117. package/dist/pages/UsersAdminPage/index.js.map +1 -1
  118. package/dist/setup/setup.js +4 -4
  119. package/dist/setup/setup.js.map +1 -1
  120. package/dist/stores/oidcStore/oidcStore.d.ts +1 -1
  121. package/dist/utils/StandardConfigUtil/index.js +2 -2
  122. package/dist/utils/StandardConfigUtil/index.js.map +1 -1
  123. package/package.json +33 -33
@@ -1,6 +1,6 @@
1
- import { t as e } from "./TableUtil.js";
2
- import { t } from "./react.js";
3
- import { l as n, t as r } from "./tableStore.js";
1
+ import { l as e, t } from "./tableStore.js";
2
+ import { t as n } from "./react.js";
3
+ import { t as r } from "./TableUtil.js";
4
4
  import i, { useCallback as a, useMemo as o } from "react";
5
5
  import { jsx as s } from "react/jsx-runtime";
6
6
  import { useTranslation as c } from "react-i18next";
@@ -9,13 +9,14 @@ import u from "@mui/icons-material/CheckBoxOutlined";
9
9
  import d from "@mui/icons-material/CheckBoxOutlineBlankOutlined";
10
10
  import f from "@mui/icons-material/ToggleOffOutlined";
11
11
  import p from "@mui/icons-material/ToggleOnOutlined";
12
- // ../../node_modules/.pnpm/zustand@5.0.16_@types+react@19.3.0_immer@11.2.9_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/vanilla/shallow.mjs
13
- var m = (e) => Symbol.iterator in e, h = (e) => "entries" in e, g = (e, t) => {
12
+ import m from "@mui/icons-material/EditOutlined";
13
+ // ../../node_modules/.pnpm/zustand@5.1.0_@types+react@19.3.0_immer@11.2.10_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/vanilla/shallow.mjs
14
+ var h = (e) => Symbol.iterator in e, g = (e) => "entries" in e, _ = (e, t) => {
14
15
  let n = e instanceof Map ? e : new Map(e.entries()), r = t instanceof Map ? t : new Map(t.entries());
15
16
  if (n.size !== r.size) return !1;
16
17
  for (let [e, t] of n) if (!r.has(e) || !Object.is(t, r.get(e))) return !1;
17
18
  return !0;
18
- }, _ = (e, t) => {
19
+ }, v = (e, t) => {
19
20
  let n = e[Symbol.iterator](), r = t[Symbol.iterator](), i = n.next(), a = r.next();
20
21
  for (; !i.done && !a.done;) {
21
22
  if (!Object.is(i.value, a.value)) return !1;
@@ -23,135 +24,136 @@ var m = (e) => Symbol.iterator in e, h = (e) => "entries" in e, g = (e, t) => {
23
24
  }
24
25
  return !!i.done && !!a.done;
25
26
  };
26
- function v(e, t) {
27
- return Object.is(e, t) ? !0 : typeof e != "object" || !e || typeof t != "object" || !t || Object.getPrototypeOf(e) !== Object.getPrototypeOf(t) ? !1 : m(e) && m(t) ? h(e) && h(t) ? g(e, t) : _(e, t) : g({ entries: () => Object.entries(e) }, { entries: () => Object.entries(t) });
27
+ function y(e, t) {
28
+ return Object.is(e, t) ? !0 : typeof e != "object" || !e || typeof t != "object" || !t || Object.getPrototypeOf(e) !== Object.getPrototypeOf(t) ? !1 : h(e) && h(t) ? g(e) && g(t) ? _(e, t) : v(e, t) : _({ entries: () => Object.entries(e) }, { entries: () => Object.entries(t) });
28
29
  }
29
- // ../../node_modules/.pnpm/zustand@5.0.16_@types+react@19.3.0_immer@11.2.9_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/react/shallow.mjs
30
- function y(e) {
30
+ // ../../node_modules/.pnpm/zustand@5.1.0_@types+react@19.3.0_immer@11.2.10_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/react/shallow.mjs
31
+ function b(e) {
31
32
  let t = i.useRef(void 0);
32
33
  return (n) => {
33
34
  let r = e(n);
34
- return v(t.current, r) ? t.current : t.current = r;
35
+ return y(t.current, r) ? t.current : t.current = r;
35
36
  };
36
37
  }
37
38
  // src/hooks/useColumnsMenu/useColumnsMenu.tsx
38
- var b = ({ hasCellData: i }) => {
39
- let m = r(), h = t(m, y((e) => e.emitEvent)), g = t(m, y((e) => e.columns)), _ = t(m, y((e) => e.dataContext)), v = t(m, y((e) => e.getCurrentColumnVisualSettings().filter((e) => e.isVisible).map((e) => e.id))), b = t(m, y((e) => e.columnDimensions)), x = t(m, y((e) => e.isCondensed)), S = t(m, y((e) => e.sortedData)), { t: C } = c(), w = o(() => g.some((e) => e.cellColorGetter), [g]), T = a(() => {
40
- h("openColumnsEditorDialog", i);
41
- }, [h, i]), E = a((e) => {
42
- let t = n(v, (t) => t.includes(e) ? t.filter((t) => t !== e) : (t.push(e), t));
43
- h("columnVisibilityChange", t);
44
- }, [h, v]), D = a((e) => {
45
- let t = e.every((e) => v.includes(e)), r = n(v, (n) => t ? n.filter((t) => !e.includes(t)) : (e.forEach((e) => {
46
- n.includes(e) || n.push(e);
47
- }), n));
48
- h("columnVisibilityChange", r);
49
- }, [h, v]), O = a(() => {
50
- h("columnVisibilityChange", e.getColumnIdsWithData({
51
- dataContext: _,
39
+ var x = ({ hasCellData: i }) => {
40
+ let h = t(), g = n(h, b((e) => e.emitEvent)), _ = n(h, b((e) => e.columns)), v = n(h, b((e) => e.dataContext)), y = n(h, b((e) => e.getCurrentColumnVisualSettings().filter((e) => e.isVisible).map((e) => e.id))), x = n(h, b((e) => e.columnDimensions)), S = n(h, b((e) => e.isCondensed)), C = n(h, b((e) => e.sortedData)), { t: w } = c(), T = o(() => _.some((e) => e.cellColorGetter), [_]), E = a(() => {
41
+ g("openColumnsEditorDialog", i);
42
+ }, [g, i]), D = a((t) => {
43
+ let n = e(y, (e) => e.includes(t) ? e.filter((e) => e !== t) : (e.push(t), e));
44
+ g("columnVisibilityChange", n);
45
+ }, [g, y]), O = a((t) => {
46
+ let n = t.every((e) => y.includes(e)), r = e(y, (e) => n ? e.filter((e) => !t.includes(e)) : (t.forEach((t) => {
47
+ e.includes(t) || e.push(t);
48
+ }), e));
49
+ g("columnVisibilityChange", r);
50
+ }, [g, y]), k = a(() => {
51
+ g("columnVisibilityChange", r.getColumnIdsWithData({
52
+ dataContext: v,
52
53
  hasCellData: i,
53
- sortedData: S,
54
- tableColumns: g,
55
- visibleColumnIds: v
54
+ sortedData: C,
55
+ tableColumns: _,
56
+ visibleColumnIds: y
56
57
  }));
57
58
  }, [
58
- h,
59
- i,
60
- S,
61
59
  g,
62
- v,
63
- _
64
- ]), k = a(() => {
65
- h("condensedChange", !x);
66
- }, [h, x]);
60
+ i,
61
+ C,
62
+ _,
63
+ y,
64
+ v
65
+ ]), A = a(() => {
66
+ g("condensedChange", !S);
67
+ }, [g, S]);
67
68
  return o(() => {
68
69
  let e = [
69
- w ? {
70
+ T ? {
70
71
  autoCloseDisabled: !0,
71
- callback: () => k(),
72
- checked: x ? "true" : "false",
72
+ callback: () => A(),
73
+ checked: S ? "true" : "false",
73
74
  divider: !0,
74
- label: C`Condensed`,
75
- rightIcon: s(x ? p : f, {})
75
+ label: w`Condensed`,
76
+ rightIcon: s(S ? p : f, {})
76
77
  } : void 0,
77
78
  {
78
- callback: () => T(),
79
+ callback: () => E(),
79
80
  divider: !0,
80
- label: C`Change order / visibility`
81
+ label: w`Column editor`,
82
+ leftIcon: /* @__PURE__ */ s(m, { sx: { fontSize: "1.5rem" } })
81
83
  },
82
84
  {
83
85
  autoCloseDisabled: !0,
84
- callback: () => h("reset"),
85
- label: C`Reset`
86
+ callback: () => g("reset"),
87
+ label: w`Reset`
86
88
  },
87
89
  {
88
90
  autoCloseDisabled: !0,
89
91
  callback: () => {
90
- h("columnVisibilityChange", [...g.map((e) => e.id)]);
92
+ g("columnVisibilityChange", [..._.map((e) => e.id)]);
91
93
  },
92
- label: C`Show all`
94
+ label: w`Show all`
93
95
  },
94
96
  {
95
97
  autoCloseDisabled: !0,
96
98
  callback: () => {
97
- h("columnVisibilityChange", [...g.filter((e) => e.frozen).map((e) => e.id)]);
99
+ g("columnVisibilityChange", [..._.filter((e) => e.frozen).map((e) => e.id)]);
98
100
  },
99
- label: C`Hide all`
101
+ label: w`Hide all`
100
102
  },
101
103
  {
102
104
  autoCloseDisabled: !0,
103
- callback: () => O(),
105
+ callback: () => k(),
104
106
  divider: !0,
105
- label: C`Hide columns without data`
107
+ label: w`Hide columns without data`
106
108
  }
107
109
  ].filter((e) => e);
108
- return b ? b.forEach((t) => {
109
- let n = t.columnIds.every((e) => v.includes(e)), r = t.columnIds.some((e) => v.includes(e));
110
+ return x ? x.forEach((t) => {
111
+ let n = t.columnIds.every((e) => y.includes(e)), r = t.columnIds.some((e) => y.includes(e));
110
112
  e.push({
111
113
  autoCloseDisabled: !0,
112
- callback: () => D(t.columnIds),
114
+ callback: () => O(t.columnIds),
113
115
  checked: n ? "true" : r ? "mixed" : "false",
114
116
  items: t.columnIds.map((e) => {
115
- let t = v.includes(e);
117
+ let t = y.includes(e);
116
118
  return {
117
119
  autoCloseDisabled: !0,
118
- callback: () => E(e),
120
+ callback: () => D(e),
119
121
  checked: t ? "true" : "false",
120
- label: g.find((t) => t.id === e)?.headerName ?? "",
122
+ label: _.find((t) => t.id === e)?.headerName ?? "",
121
123
  rightIcon: s(t ? u : d, {})
122
124
  };
123
125
  }),
124
126
  label: t.label,
125
127
  rightIcon: s(n ? u : r ? l : d, {})
126
128
  });
127
- }) : g.filter((e) => !e.frozen).forEach((t) => {
128
- let n = v.includes(t.id);
129
+ }) : _.filter((e) => !e.frozen).forEach((t) => {
130
+ let n = y.includes(t.id);
129
131
  e.push({
130
132
  autoCloseDisabled: !0,
131
- callback: () => E(t.id),
133
+ callback: () => D(t.id),
132
134
  checked: n ? "true" : "false",
133
135
  label: t.headerName,
134
136
  rightIcon: s(n ? u : d, {})
135
137
  });
136
138
  }), {
137
139
  items: e,
138
- label: C`Columns`
140
+ label: w`Columns`
139
141
  };
140
142
  }, [
141
- x,
142
- w,
143
- C,
144
- b,
145
- k,
143
+ S,
146
144
  T,
147
- h,
145
+ w,
146
+ x,
147
+ A,
148
+ E,
148
149
  g,
150
+ _,
151
+ k,
152
+ y,
149
153
  O,
150
- v,
151
- D,
152
- E
154
+ D
153
155
  ]);
154
156
  };
155
- export { y as n, b as t };
157
+ export { b as n, x as t };
156
158
 
157
159
  //# sourceMappingURL=useColumnsMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useColumnsMenu.js","names":["TableUtil","produce","useTableStoreContext","React","IndeterminateCheckBoxIcon","CheckBoxOutlinedIcon","CheckBoxOutlineBlankOutlinedIcon","ToggleOffOutlinedIcon","ToggleOnOutlinedIcon","isIterable","obj","hasIterableEntries","value","compareEntries","mapA","valueA","mapB","valueB","key","compareIterables","iteratorA","iteratorB","nextA","nextB","shallow","useShallow","prev","next","selector","state","useColumnsMenu","tableStore","emitTableEvent","useStore","tableColumns","dataContext","visibleColumnIds","c","columnDimensions","isCondensed","sortedData","useTranslation","isCondensingSupported","useMemo","onColumnsEditorMenuItemClick","useCallback","hasCellData","toggleItem","newVisibleColumnIds","draft","columnId","toggleDimension","areAllVisible","dimensionColumnIds","onHideColumnsWithoutDataClick","onIsCondensedMenuItemClick","items","jsx","x","columnDimension","areSomeVisible","checked","column","t"],"sources":["../../../../node_modules/.pnpm/zustand@5.0.16_@types+react@19.3.0_immer@11.2.9_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/vanilla/shallow.mjs","../../../../node_modules/.pnpm/zustand@5.0.16_@types+react@19.3.0_immer@11.2.9_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/react/shallow.mjs","../../src/hooks/useColumnsMenu/useColumnsMenu.tsx"],"sourcesContent":["const isIterable = (obj) => Symbol.iterator in obj;\nconst hasIterableEntries = (value) => (\n // HACK: avoid checking entries type\n \"entries\" in value\n);\nconst compareEntries = (valueA, valueB) => {\n const mapA = valueA instanceof Map ? valueA : new Map(valueA.entries());\n const mapB = valueB instanceof Map ? valueB : new Map(valueB.entries());\n if (mapA.size !== mapB.size) {\n return false;\n }\n for (const [key, value] of mapA) {\n if (!mapB.has(key) || !Object.is(value, mapB.get(key))) {\n return false;\n }\n }\n return true;\n};\nconst compareIterables = (valueA, valueB) => {\n const iteratorA = valueA[Symbol.iterator]();\n const iteratorB = valueB[Symbol.iterator]();\n let nextA = iteratorA.next();\n let nextB = iteratorB.next();\n while (!nextA.done && !nextB.done) {\n if (!Object.is(nextA.value, nextB.value)) {\n return false;\n }\n nextA = iteratorA.next();\n nextB = iteratorB.next();\n }\n return !!nextA.done && !!nextB.done;\n};\nfunction shallow(valueA, valueB) {\n if (Object.is(valueA, valueB)) {\n return true;\n }\n if (typeof valueA !== \"object\" || valueA === null || typeof valueB !== \"object\" || valueB === null) {\n return false;\n }\n if (Object.getPrototypeOf(valueA) !== Object.getPrototypeOf(valueB)) {\n return false;\n }\n if (isIterable(valueA) && isIterable(valueB)) {\n if (hasIterableEntries(valueA) && hasIterableEntries(valueB)) {\n return compareEntries(valueA, valueB);\n }\n return compareIterables(valueA, valueB);\n }\n return compareEntries(\n { entries: () => Object.entries(valueA) },\n { entries: () => Object.entries(valueB) }\n );\n}\n\nexport { shallow };\n","import React from 'react';\nimport { shallow } from 'zustand/vanilla/shallow';\n\nfunction useShallow(selector) {\n const prev = React.useRef(void 0);\n return (state) => {\n const next = selector(state);\n return shallow(prev.current, next) ? prev.current : prev.current = next;\n };\n}\n\nexport { useShallow };\n","import { produce } from 'immer';\nimport { useStore } from 'zustand';\nimport { useShallow } from 'zustand/shallow';\nimport CheckBoxOutlinedIcon from '@mui/icons-material/CheckBoxOutlined';\nimport CheckBoxOutlineBlankOutlinedIcon from '@mui/icons-material/CheckBoxOutlineBlankOutlined';\nimport ToggleOffOutlinedIcon from '@mui/icons-material/ToggleOffOutlined';\nimport ToggleOnOutlinedIcon from '@mui/icons-material/ToggleOnOutlined';\nimport IndeterminateCheckBoxIcon from '@mui/icons-material/IndeterminateCheckBox';\nimport {\n useCallback,\n useMemo,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport type { MenuItemData } from '@gen-epix/ui-core-components/models/nested-menu.models';\n\nimport type { HasCellDataFn } from '../../models/table.models';\nimport { useTableStoreContext } from '../../stores/tableStore';\nimport { TableUtil } from '../../utils/TableUtil';\n\n\nexport type UseColumnsMenuProps<TRowData, TDataContext = null> = {\n readonly hasCellData?: HasCellDataFn<TRowData, TDataContext>;\n};\n\nexport const useColumnsMenu = <TRowData, TDataContext = null>({ hasCellData }: UseColumnsMenuProps<TRowData, TDataContext>): MenuItemData => {\n const tableStore = useTableStoreContext<TRowData, TDataContext>();\n const emitTableEvent = useStore(tableStore, useShallow((state) => state.emitEvent));\n const tableColumns = useStore(tableStore, useShallow((state) => state.columns));\n const dataContext = useStore(tableStore, useShallow((state) => state.dataContext));\n const visibleColumnIds = useStore(tableStore, useShallow((state) => state.getCurrentColumnVisualSettings().filter(c => c.isVisible).map(c => c.id)));\n const columnDimensions = useStore(tableStore, useShallow((state) => state.columnDimensions));\n const isCondensed = useStore(tableStore, useShallow((state) => state.isCondensed));\n const sortedData = useStore(tableStore, useShallow((state) => state.sortedData));\n const { t } = useTranslation();\n\n const isCondensingSupported = useMemo(() => {\n return tableColumns.some(c => c.cellColorGetter);\n }, [tableColumns]);\n\n const onColumnsEditorMenuItemClick = useCallback(() => {\n emitTableEvent('openColumnsEditorDialog', hasCellData);\n }, [emitTableEvent, hasCellData]);\n\n const toggleItem = useCallback((columnId: string): void => {\n const newVisibleColumnIds = produce(visibleColumnIds, (draft) => {\n if (draft.includes(columnId)) {\n return draft.filter(c => c !== columnId);\n }\n draft.push(columnId);\n return draft;\n });\n emitTableEvent('columnVisibilityChange', newVisibleColumnIds);\n }, [emitTableEvent, visibleColumnIds]);\n\n const toggleDimension = useCallback((dimensionColumnIds: string[]): void => {\n const areAllVisible = dimensionColumnIds.every(columnId => visibleColumnIds.includes(columnId));\n const newVisibleColumnIds = produce(visibleColumnIds, (draft) => {\n if (areAllVisible) {\n return draft.filter(c => !dimensionColumnIds.includes(c));\n }\n dimensionColumnIds.forEach((columnId) => {\n if (!draft.includes(columnId)) {\n draft.push(columnId);\n }\n });\n return draft;\n });\n emitTableEvent('columnVisibilityChange', newVisibleColumnIds);\n }, [emitTableEvent, visibleColumnIds]);\n\n const onHideColumnsWithoutDataClick = useCallback(() => {\n emitTableEvent('columnVisibilityChange', TableUtil.getColumnIdsWithData<TRowData, TDataContext>({\n dataContext,\n hasCellData,\n sortedData,\n tableColumns,\n visibleColumnIds,\n }));\n\n }, [emitTableEvent, hasCellData, sortedData, tableColumns, visibleColumnIds, dataContext]);\n\n const onIsCondensedMenuItemClick = useCallback(() => {\n emitTableEvent('condensedChange', !isCondensed);\n }, [emitTableEvent, isCondensed]);\n\n const menuItemData: MenuItemData = useMemo(() => {\n const items: MenuItemData[] = [\n isCondensingSupported ? {\n autoCloseDisabled: true,\n callback: () => onIsCondensedMenuItemClick(),\n checked: isCondensed ? 'true' : 'false',\n divider: true,\n label: t`Condensed`,\n rightIcon: isCondensed ? <ToggleOnOutlinedIcon /> : <ToggleOffOutlinedIcon />,\n } : undefined,\n {\n callback: () => onColumnsEditorMenuItemClick(),\n divider: true,\n label: t`Change order / visibility`,\n },\n {\n autoCloseDisabled: true,\n callback: () => emitTableEvent('reset'),\n label: t`Reset`,\n },\n {\n autoCloseDisabled: true,\n callback: () => {\n emitTableEvent('columnVisibilityChange', [...tableColumns.map(c => c.id)]);\n },\n label: t`Show all`,\n },\n {\n autoCloseDisabled: true,\n callback: () => {\n emitTableEvent('columnVisibilityChange', [...tableColumns.filter(c => c.frozen).map(c => c.id)]);\n },\n label: t`Hide all`,\n },\n {\n autoCloseDisabled: true,\n callback: () => onHideColumnsWithoutDataClick(),\n divider: true,\n label: t`Hide columns without data`,\n },\n ].filter(x => x) as MenuItemData[];\n\n if (columnDimensions) {\n columnDimensions.forEach((columnDimension) => {\n const areAllVisible = columnDimension.columnIds.every(columnId => visibleColumnIds.includes(columnId));\n const areSomeVisible = columnDimension.columnIds.some(columnId => visibleColumnIds.includes(columnId));\n items.push({\n autoCloseDisabled: true,\n callback: () => toggleDimension(columnDimension.columnIds),\n // eslint-disable-next-line no-nested-ternary\n checked: areAllVisible ? 'true' : areSomeVisible ? 'mixed' : 'false',\n items: columnDimension.columnIds.map((columnId) => {\n const checked = visibleColumnIds.includes(columnId);\n return {\n autoCloseDisabled: true,\n callback: () => toggleItem(columnId),\n checked: checked ? 'true' : 'false',\n label: tableColumns.find(c => c.id === columnId)?.headerName ?? '',\n rightIcon: checked ? <CheckBoxOutlinedIcon /> : <CheckBoxOutlineBlankOutlinedIcon />,\n };\n }),\n label: columnDimension.label,\n // eslint-disable-next-line no-nested-ternary\n rightIcon: areAllVisible ? <CheckBoxOutlinedIcon /> : areSomeVisible ? <IndeterminateCheckBoxIcon /> : <CheckBoxOutlineBlankOutlinedIcon />,\n });\n });\n } else {\n tableColumns.filter(c => !c.frozen).forEach((column) => {\n const checked = visibleColumnIds.includes(column.id);\n items.push({\n autoCloseDisabled: true,\n callback: () => toggleItem(column.id),\n checked: checked ? 'true' : 'false',\n label: column.headerName,\n rightIcon: checked ? <CheckBoxOutlinedIcon /> : <CheckBoxOutlineBlankOutlinedIcon />,\n });\n });\n }\n\n return {\n items,\n label: t`Columns`,\n };\n }, [isCondensed, isCondensingSupported, t, columnDimensions, onIsCondensedMenuItemClick, onColumnsEditorMenuItemClick, emitTableEvent, tableColumns, onHideColumnsWithoutDataClick, visibleColumnIds, toggleDimension, toggleItem]);\n\n return menuItemData;\n};\n"],"ignoreList":[0,1],"mappings":";;;;;;;;;;;;AAAA,IAAMS,KAAc,MAAQ,OAAO,YAAYC,GACzCC,KAAsB,MAE1B,aAAaC,GAETC,KAAkB,GAAQ,MAAW;CACzC,IAAMC,IAAOC,aAAkB,MAAMA,IAAS,IAAI,IAAIA,EAAO,QAAQ,CAAC,GAChEC,IAAOC,aAAkB,MAAMA,IAAS,IAAI,IAAIA,EAAO,QAAQ,CAAC;CACtE,IAAIH,EAAK,SAASE,EAAK,MACrB,OAAO;CAET,KAAK,IAAM,CAACE,GAAKN,MAAUE,GACzB,IAAI,CAACE,EAAK,IAAIE,CAAG,KAAK,CAAC,OAAO,GAAGN,GAAOI,EAAK,IAAIE,CAAG,CAAC,GACnD,OAAO;CAGX,OAAO;AACT,GACMC,KAAoB,GAAQ,MAAW;CAC3C,IAAMC,IAAYL,EAAO,OAAO,SAAS,CAAC,GACpCM,IAAYJ,EAAO,OAAO,SAAS,CAAC,GACtCK,IAAQF,EAAU,KAAK,GACvBG,IAAQF,EAAU,KAAK;CAC3B,OAAO,CAACC,EAAM,QAAQ,CAACC,EAAM,OAAM;EACjC,IAAI,CAAC,OAAO,GAAGD,EAAM,OAAOC,EAAM,KAAK,GACrC,OAAO;EAGT,AADA,IAAQH,EAAU,KAAK,GACvB,IAAQC,EAAU,KAAK;CACzB;CACA,OAAO,CAAC,CAACC,EAAM,QAAQ,CAAC,CAACC,EAAM;AACjC;AACA,SAASC,EAAQ,GAAQ,GAAQ;CAgB/B,OAfI,OAAO,GAAGT,GAAQE,CAAM,IACnB,KAEL,OAAOF,KAAW,aAAYA,KAAmB,OAAOE,KAAW,aAAYA,KAG/E,OAAO,eAAeF,CAAM,MAAM,OAAO,eAAeE,CAAM,IACzD,KAELR,EAAWM,CAAM,KAAKN,EAAWQ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AW;GACtD,IAAMwB,IAAUzB,EAAiB,SAAS0B,EAAO,EAAE;GACnD,EAAM,KAAK;IACT,mBAAmB;IACnB,gBAAgBf,EAAWe,EAAO,EAAE;IACpC,SAASD,IAAU,SAAS;IAC5B,OAAOC,EAAO;IACd,WAAqBL,EAAVI,IAAWxD,IAA2BC,GAA5B,CAAuB,CAAuC;GACrF,CAAC;EACH,CAAC,GAGI;GACL;GACA,OAAO,CAAC;EACV;CACF,GAAG;EAACiC;EAAaG;EAAuBqB;EAAGzB;EAAkBiB;EAA4BX;EAA8BZ;EAAgBE;EAAcoB;EAA+BlB;EAAkBe;EAAiBJ;CAAU,CAE1N;AACT"}
1
+ {"version":3,"file":"useColumnsMenu.js","names":["produce","useStore","TableUtil","React","IndeterminateCheckBoxIcon","CheckBoxOutlinedIcon","CheckBoxOutlineBlankOutlinedIcon","ToggleOffOutlinedIcon","ToggleOnOutlinedIcon","EditOutlinedIcon","isIterable","obj","hasIterableEntries","value","compareEntries","mapA","valueA","mapB","valueB","key","compareIterables","iteratorA","iteratorB","nextA","nextB","shallow","useShallow","prev","next","selector","state","useColumnsMenu","tableStore","useTableStoreContext","emitTableEvent","tableColumns","dataContext","visibleColumnIds","c","columnDimensions","isCondensed","sortedData","useTranslation","isCondensingSupported","useMemo","onColumnsEditorMenuItemClick","useCallback","hasCellData","toggleItem","newVisibleColumnIds","draft","columnId","toggleDimension","areAllVisible","dimensionColumnIds","onHideColumnsWithoutDataClick","onIsCondensedMenuItemClick","items","jsx","x","columnDimension","areSomeVisible","checked","column","t"],"sources":["../../../../node_modules/.pnpm/zustand@5.1.0_@types+react@19.3.0_immer@11.2.10_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/vanilla/shallow.mjs","../../../../node_modules/.pnpm/zustand@5.1.0_@types+react@19.3.0_immer@11.2.10_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/react/shallow.mjs","../../src/hooks/useColumnsMenu/useColumnsMenu.tsx"],"sourcesContent":["const isIterable = (obj) => Symbol.iterator in obj;\nconst hasIterableEntries = (value) => (\n // HACK: avoid checking entries type\n \"entries\" in value\n);\nconst compareEntries = (valueA, valueB) => {\n const mapA = valueA instanceof Map ? valueA : new Map(valueA.entries());\n const mapB = valueB instanceof Map ? valueB : new Map(valueB.entries());\n if (mapA.size !== mapB.size) {\n return false;\n }\n for (const [key, value] of mapA) {\n if (!mapB.has(key) || !Object.is(value, mapB.get(key))) {\n return false;\n }\n }\n return true;\n};\nconst compareIterables = (valueA, valueB) => {\n const iteratorA = valueA[Symbol.iterator]();\n const iteratorB = valueB[Symbol.iterator]();\n let nextA = iteratorA.next();\n let nextB = iteratorB.next();\n while (!nextA.done && !nextB.done) {\n if (!Object.is(nextA.value, nextB.value)) {\n return false;\n }\n nextA = iteratorA.next();\n nextB = iteratorB.next();\n }\n return !!nextA.done && !!nextB.done;\n};\nfunction shallow(valueA, valueB) {\n if (Object.is(valueA, valueB)) {\n return true;\n }\n if (typeof valueA !== \"object\" || valueA === null || typeof valueB !== \"object\" || valueB === null) {\n return false;\n }\n if (Object.getPrototypeOf(valueA) !== Object.getPrototypeOf(valueB)) {\n return false;\n }\n if (isIterable(valueA) && isIterable(valueB)) {\n if (hasIterableEntries(valueA) && hasIterableEntries(valueB)) {\n return compareEntries(valueA, valueB);\n }\n return compareIterables(valueA, valueB);\n }\n return compareEntries(\n { entries: () => Object.entries(valueA) },\n { entries: () => Object.entries(valueB) }\n );\n}\n\nexport { shallow };\n","import React from 'react';\nimport { shallow } from 'zustand/vanilla/shallow';\n\nfunction useShallow(selector) {\n const prev = React.useRef(void 0);\n return (state) => {\n const next = selector(state);\n return shallow(prev.current, next) ? prev.current : prev.current = next;\n };\n}\n\nexport { useShallow };\n","import { produce } from 'immer';\nimport { useStore } from 'zustand';\nimport { useShallow } from 'zustand/shallow';\nimport CheckBoxOutlinedIcon from '@mui/icons-material/CheckBoxOutlined';\nimport CheckBoxOutlineBlankOutlinedIcon from '@mui/icons-material/CheckBoxOutlineBlankOutlined';\nimport ToggleOffOutlinedIcon from '@mui/icons-material/ToggleOffOutlined';\nimport ToggleOnOutlinedIcon from '@mui/icons-material/ToggleOnOutlined';\nimport IndeterminateCheckBoxIcon from '@mui/icons-material/IndeterminateCheckBox';\nimport EditOutlinedIcon from '@mui/icons-material/EditOutlined';\nimport {\n useCallback,\n useMemo,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport type { MenuItemData } from '@gen-epix/ui-core-components/models/nested-menu.models';\n\nimport type { HasCellDataFn } from '../../models/table.models';\nimport { useTableStoreContext } from '../../stores/tableStore';\nimport { TableUtil } from '../../utils/TableUtil';\n\n\nexport type UseColumnsMenuProps<TRowData, TDataContext = null> = {\n readonly hasCellData?: HasCellDataFn<TRowData, TDataContext>;\n};\n\nexport const useColumnsMenu = <TRowData, TDataContext = null>({ hasCellData }: UseColumnsMenuProps<TRowData, TDataContext>): MenuItemData => {\n const tableStore = useTableStoreContext<TRowData, TDataContext>();\n const emitTableEvent = useStore(tableStore, useShallow((state) => state.emitEvent));\n const tableColumns = useStore(tableStore, useShallow((state) => state.columns));\n const dataContext = useStore(tableStore, useShallow((state) => state.dataContext));\n const visibleColumnIds = useStore(tableStore, useShallow((state) => state.getCurrentColumnVisualSettings().filter(c => c.isVisible).map(c => c.id)));\n const columnDimensions = useStore(tableStore, useShallow((state) => state.columnDimensions));\n const isCondensed = useStore(tableStore, useShallow((state) => state.isCondensed));\n const sortedData = useStore(tableStore, useShallow((state) => state.sortedData));\n const { t } = useTranslation();\n\n const isCondensingSupported = useMemo(() => {\n return tableColumns.some(c => c.cellColorGetter);\n }, [tableColumns]);\n\n const onColumnsEditorMenuItemClick = useCallback(() => {\n emitTableEvent('openColumnsEditorDialog', hasCellData);\n }, [emitTableEvent, hasCellData]);\n\n const toggleItem = useCallback((columnId: string): void => {\n const newVisibleColumnIds = produce(visibleColumnIds, (draft) => {\n if (draft.includes(columnId)) {\n return draft.filter(c => c !== columnId);\n }\n draft.push(columnId);\n return draft;\n });\n emitTableEvent('columnVisibilityChange', newVisibleColumnIds);\n }, [emitTableEvent, visibleColumnIds]);\n\n const toggleDimension = useCallback((dimensionColumnIds: string[]): void => {\n const areAllVisible = dimensionColumnIds.every(columnId => visibleColumnIds.includes(columnId));\n const newVisibleColumnIds = produce(visibleColumnIds, (draft) => {\n if (areAllVisible) {\n return draft.filter(c => !dimensionColumnIds.includes(c));\n }\n dimensionColumnIds.forEach((columnId) => {\n if (!draft.includes(columnId)) {\n draft.push(columnId);\n }\n });\n return draft;\n });\n emitTableEvent('columnVisibilityChange', newVisibleColumnIds);\n }, [emitTableEvent, visibleColumnIds]);\n\n const onHideColumnsWithoutDataClick = useCallback(() => {\n emitTableEvent('columnVisibilityChange', TableUtil.getColumnIdsWithData<TRowData, TDataContext>({\n dataContext,\n hasCellData,\n sortedData,\n tableColumns,\n visibleColumnIds,\n }));\n\n }, [emitTableEvent, hasCellData, sortedData, tableColumns, visibleColumnIds, dataContext]);\n\n const onIsCondensedMenuItemClick = useCallback(() => {\n emitTableEvent('condensedChange', !isCondensed);\n }, [emitTableEvent, isCondensed]);\n\n const menuItemData: MenuItemData = useMemo(() => {\n const items: MenuItemData[] = [\n isCondensingSupported ? {\n autoCloseDisabled: true,\n callback: () => onIsCondensedMenuItemClick(),\n checked: isCondensed ? 'true' : 'false',\n divider: true,\n label: t`Condensed`,\n rightIcon: isCondensed ? <ToggleOnOutlinedIcon /> : <ToggleOffOutlinedIcon />,\n } : undefined,\n {\n callback: () => onColumnsEditorMenuItemClick(),\n divider: true,\n label: t`Column editor`,\n leftIcon: <EditOutlinedIcon sx={{ fontSize: '1.5rem' }} />,\n },\n {\n autoCloseDisabled: true,\n callback: () => emitTableEvent('reset'),\n label: t`Reset`,\n },\n {\n autoCloseDisabled: true,\n callback: () => {\n emitTableEvent('columnVisibilityChange', [...tableColumns.map(c => c.id)]);\n },\n label: t`Show all`,\n },\n {\n autoCloseDisabled: true,\n callback: () => {\n emitTableEvent('columnVisibilityChange', [...tableColumns.filter(c => c.frozen).map(c => c.id)]);\n },\n label: t`Hide all`,\n },\n {\n autoCloseDisabled: true,\n callback: () => onHideColumnsWithoutDataClick(),\n divider: true,\n label: t`Hide columns without data`,\n },\n ].filter(x => x) as MenuItemData[];\n\n if (columnDimensions) {\n columnDimensions.forEach((columnDimension) => {\n const areAllVisible = columnDimension.columnIds.every(columnId => visibleColumnIds.includes(columnId));\n const areSomeVisible = columnDimension.columnIds.some(columnId => visibleColumnIds.includes(columnId));\n items.push({\n autoCloseDisabled: true,\n callback: () => toggleDimension(columnDimension.columnIds),\n // eslint-disable-next-line no-nested-ternary\n checked: areAllVisible ? 'true' : areSomeVisible ? 'mixed' : 'false',\n items: columnDimension.columnIds.map((columnId) => {\n const checked = visibleColumnIds.includes(columnId);\n return {\n autoCloseDisabled: true,\n callback: () => toggleItem(columnId),\n checked: checked ? 'true' : 'false',\n label: tableColumns.find(c => c.id === columnId)?.headerName ?? '',\n rightIcon: checked ? <CheckBoxOutlinedIcon /> : <CheckBoxOutlineBlankOutlinedIcon />,\n };\n }),\n label: columnDimension.label,\n // eslint-disable-next-line no-nested-ternary\n rightIcon: areAllVisible ? <CheckBoxOutlinedIcon /> : areSomeVisible ? <IndeterminateCheckBoxIcon /> : <CheckBoxOutlineBlankOutlinedIcon />,\n });\n });\n } else {\n tableColumns.filter(c => !c.frozen).forEach((column) => {\n const checked = visibleColumnIds.includes(column.id);\n items.push({\n autoCloseDisabled: true,\n callback: () => toggleItem(column.id),\n checked: checked ? 'true' : 'false',\n label: column.headerName,\n rightIcon: checked ? <CheckBoxOutlinedIcon /> : <CheckBoxOutlineBlankOutlinedIcon />,\n });\n });\n }\n\n return {\n items,\n label: t`Columns`,\n };\n }, [isCondensed, isCondensingSupported, t, columnDimensions, onIsCondensedMenuItemClick, onColumnsEditorMenuItemClick, emitTableEvent, tableColumns, onHideColumnsWithoutDataClick, visibleColumnIds, toggleDimension, toggleItem]);\n\n return menuItemData;\n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AiB,SAAS0B,EAAO,EAAE;GACnD,EAAM,KAAK;IACT,mBAAmB;IACnB,gBAAgBf,EAAWe,EAAO,EAAE;IACpC,SAASD,IAAU,SAAS;IAC5B,OAAOC,EAAO;IACd,WAAqBL,EAAVI,IAAWzD,IAA2BC,GAA5B,CAAuB,CAAuC;GACrF,CAAC;EACH,CAAC,GAGI;GACL;GACA,OAAO,CAAC;EACV;CACF,GAAG;EAACkC;EAAaG;EAAuBqB;EAAGzB;EAAkBiB;EAA4BX;EAA8BX;EAAgBC;EAAcoB;EAA+BlB;EAAkBe;EAAiBJ;CAAU,CAE1N;AACT"}
@@ -2,7 +2,7 @@ import { n as e } from "./QueryClientProvider.js";
2
2
  import { b as t, c as n, d as r, g as i, o as a, x as o } from "./query.js";
3
3
  import { n as s } from "./QueryClientService.js";
4
4
  import * as c from "react";
5
- // ../../node_modules/.pnpm/@tanstack+query-core@5.105.0/node_modules/@tanstack/query-core/build/modern/mutationObserver.js
5
+ // ../../node_modules/.pnpm/@tanstack+query-core@5.107.1/node_modules/@tanstack/query-core/build/modern/mutationObserver.js
6
6
  var l = class extends n {
7
7
  #e;
8
8
  #t = void 0;
@@ -91,7 +91,7 @@ var l = class extends n {
91
91
  });
92
92
  }
93
93
  };
94
- // ../../node_modules/.pnpm/@tanstack+react-query@5.105.0_@types+react@19.3.0_react@19.3.1/node_modules/@tanstack/react-query/build/modern/useMutation.js
94
+ // ../../node_modules/.pnpm/@tanstack+react-query@5.107.1_@types+react@19.3.0_react@19.3.1/node_modules/@tanstack/react-query/build/modern/useMutation.js
95
95
  function u(t, n) {
96
96
  let r = e(n), [s] = c.useState(() => new l(r, t));
97
97
  c.useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"useMutation.js","names":["React","useQueryClient","shallowEqualObjects","Subscribable","hashKey","noop","notifyManager","shouldThrowError","getDefaultState","React$1","MutationObserver","#client","client","options","#updateResult","prevOptions","#currentMutation","#notify","action","#currentResult","#mutateOptions","variables","state","mutateOptions","onMutateResult","context","useMutation","queryClient","observer","result","onStoreChange","mutate","args"],"sources":["../../../../node_modules/.pnpm/@tanstack+query-core@5.105.0/node_modules/@tanstack/query-core/build/modern/mutationObserver.js","../../../../node_modules/.pnpm/@tanstack+react-query@5.105.0_@types+react@19.3.0_react@19.3.1/node_modules/@tanstack/react-query/build/modern/useMutation.js"],"sourcesContent":["import { hashKey, shallowEqualObjects } from \"./utils.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { getDefaultState } from \"./mutation.js\";\n//#region src/mutationObserver.ts\n/**\n* Observes a single mutation and derives a `MutationObserverResult` from it.\n* A framework hook like `useMutation` creates one `MutationObserver` per hook\n* call, keeps it stable across re-renders, calls `setOptions` when the options\n* passed to the hook change, subscribes to it to re-render on updates, and\n* reads `getCurrentResult()` for the value to return. Calling `mutate()`\n* builds a new underlying `Mutation` in the `MutationCache` and executes it.\n* @example\n* ```ts\n* const observer = new MutationObserver(queryClient, {\n* mutationFn: (variables: { title: string }) => addPost(variables),\n* })\n* ```\n*/\nvar MutationObserver = class extends Subscribable {\n\t#client;\n\t#currentResult = void 0;\n\t#currentMutation;\n\t#mutateOptions;\n\tconstructor(client, options) {\n\t\tsuper();\n\t\tthis.#client = client;\n\t\tthis.setOptions(options);\n\t\tthis.bindMethods();\n\t\tthis.#updateResult();\n\t}\n\t/**\n\t* Binds the methods of the result (`mutate` and `reset`) to the observer, so they keep working when\n\t* destructured from it.\n\t*/\n\tbindMethods() {\n\t\tthis.mutate = this.mutate.bind(this);\n\t\tthis.reset = this.reset.bind(this);\n\t}\n\t/**\n\t* Updates the observer's options.\n\t*\n\t* If the new `mutationKey` differs from the previous one (and both were\n\t* defined), the observer is reset, detaching it from the mutation it was\n\t* observing. Otherwise, if the currently observed mutation is still\n\t* `pending`, its options are updated in place as well.\n\t* @param options - The new mutation observer options. They are defaulted with {@link\n\t* QueryClient#defaultMutationOptions} before being applied.\n\t* @example\n\t* ```ts\n\t* observer.setOptions({\n\t* mutationFn: (variables: { title: string }) => addPost(variables),\n\t* onSuccess: (data) => console.log(data),\n\t* })\n\t* ```\n\t*/\n\tsetOptions(options) {\n\t\tconst prevOptions = this.options;\n\t\tthis.options = this.#client.defaultMutationOptions(options);\n\t\tif (!shallowEqualObjects(this.options, prevOptions)) this.#client.getMutationCache().notify({\n\t\t\ttype: \"observerOptionsUpdated\",\n\t\t\tmutation: this.#currentMutation,\n\t\t\tobserver: this\n\t\t});\n\t\tif (prevOptions?.mutationKey && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) this.reset();\n\t\telse if (this.#currentMutation?.state.status === \"pending\") this.#currentMutation.setOptions(this.options);\n\t}\n\tonSubscribe() {\n\t\tif (this.listeners.size === 1 && this.#currentMutation) {\n\t\t\tthis.#currentMutation.addObserver(this);\n\t\t\tthis.#updateResult();\n\t\t}\n\t}\n\tonUnsubscribe() {\n\t\tif (!this.hasListeners()) this.#currentMutation?.removeObserver(this);\n\t}\n\t/**\n\t* Updates the observer's result when the observed mutation changes, and notifies its listeners.\n\t* @internal\n\t* @param action - The action that updated the observed mutation, passed on to the observer's\n\t* callbacks.\n\t*/\n\tonMutationUpdate(action) {\n\t\tthis.#updateResult();\n\t\tthis.#notify(action);\n\t}\n\t/**\n\t* Returns the observer's current result, derived from the observed\n\t* mutation's state (or the default, `idle` state if no mutation has been\n\t* built yet, e.g. before the first `mutate()` call or after `reset()`).\n\t* @returns The observer's latest result.\n\t*/\n\tgetCurrentResult() {\n\t\treturn this.#currentResult;\n\t}\n\t/**\n\t* Detaches the observer from the mutation it is currently observing (if\n\t* any) and resets the observed result back to its default, `idle` state.\n\t*\n\t* This does not cancel an in-flight mutation; the mutation itself keeps\n\t* running to completion and its own callbacks still fire, but this\n\t* observer stops reflecting its state and a subsequent `mutate()` call\n\t* will build a brand new mutation.\n\t* @see {@link MutationObserver#mutate}\n\t* @example\n\t* ```ts\n\t* observer.reset()\n\t* ```\n\t*/\n\treset() {\n\t\tthis.#currentMutation?.removeObserver(this);\n\t\tthis.#currentMutation = void 0;\n\t\tthis.#updateResult();\n\t\tthis.#notify();\n\t}\n\t/**\n\t* Builds a new `Mutation` in the `MutationCache` using the observer's\n\t* current options, detaches this observer from any previously observed\n\t* mutation, attaches it to the new one, and executes it with the given\n\t* variables.\n\t*\n\t* The optional per-call `options` (`onSuccess`/`onError`/`onSettled`) are\n\t* invoked once the mutation settles, in addition to any callbacks defined\n\t* on the observer's own options.\n\t* @param variables - The variables passed to the `mutationFn`.\n\t* @param options - Per-call `onSuccess`, `onError`, and `onSettled` callbacks.\n\t* @returns A promise that resolves with the mutation's data, or rejects with its error.\n\t* @example\n\t* ```ts\n\t* await observer.mutate(\n\t* { title: 'New post' },\n\t* { onSuccess: (data) => console.log(data) },\n\t* )\n\t* ```\n\t*/\n\tmutate(variables, options) {\n\t\tthis.#mutateOptions = options;\n\t\tthis.#currentMutation?.removeObserver(this);\n\t\tthis.#currentMutation = this.#client.getMutationCache().build(this.#client, this.options);\n\t\tthis.#currentMutation.addObserver(this);\n\t\treturn this.#currentMutation.execute(variables);\n\t}\n\t#updateResult() {\n\t\tconst state = this.#currentMutation?.state ?? getDefaultState();\n\t\tthis.#currentResult = {\n\t\t\t...state,\n\t\t\tisPending: state.status === \"pending\",\n\t\t\tisSuccess: state.status === \"success\",\n\t\t\tisError: state.status === \"error\",\n\t\t\tisIdle: state.status === \"idle\",\n\t\t\tmutate: this.mutate,\n\t\t\treset: this.reset\n\t\t};\n\t}\n\t#notify(action) {\n\t\tnotifyManager.batch(() => {\n\t\t\tconst mutateOptions = this.#mutateOptions;\n\t\t\tif (mutateOptions && this.hasListeners()) {\n\t\t\t\tconst variables = this.#currentResult.variables;\n\t\t\t\tconst onMutateResult = this.#currentResult.context;\n\t\t\t\tconst context = {\n\t\t\t\t\tclient: this.#client,\n\t\t\t\t\tmeta: this.options.meta,\n\t\t\t\t\tmutationKey: this.options.mutationKey\n\t\t\t\t};\n\t\t\t\tif (action?.type === \"success\") {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tmutateOptions.onSuccess?.(action.data, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tmutateOptions.onSettled?.(action.data, null, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t} else if (action?.type === \"error\") {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tmutateOptions.onError?.(action.error, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tmutateOptions.onSettled?.(void 0, action.error, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.listeners.forEach((listener) => {\n\t\t\t\tlistener(this.#currentResult);\n\t\t\t});\n\t\t});\n\t}\n};\n//#endregion\nexport { MutationObserver };\n\n//# sourceMappingURL=mutationObserver.js.map","\"use client\";\nimport { useQueryClient } from \"./QueryClientProvider.js\";\nimport * as React from \"react\";\nimport { MutationObserver, noop, notifyManager, shouldThrowError } from \"@tanstack/query-core\";\n//#region src/useMutation.ts\n/**\n* Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.\n* `useMutation` is the hook for that.\n* @param options - The {@link UseMutationOptions} to use — everything you can pass to `useMutation`.\n* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n* be used.\n* @returns `mutate`/`mutateAsync` also accept per-call `onSuccess`/`onError`/`onSettled` callbacks as a second\n* argument, useful for triggering call-site side effects (e.g. navigation) without coupling them to the shared\n* mutation definition. Hook-level callbacks (passed to `options`) fire for every mutation; per-call callbacks\n* fire only for the latest call you've made, and only while the component is still mounted — unmounting before\n* the mutation settles removes the subscription and prevents them from firing.\n* @throws {Error} The mutation error, when `throwOnError` is `true` or returns `true` for it, so that it is\n* thrown to the nearest error boundary.\n* @see {@link mutationOptions} to share these options across multiple `useMutation` call sites, or to look\n* the mutation up elsewhere via its `mutationKey` (e.g. with `useMutationState`).\n* @example\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodo() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* return (\n* <button\n* onClick={() =>\n* addMutation.mutate('Item', {\n* onError: (error) => console.error('Failed to add item:', error),\n* })\n* }\n* >\n* Add\n* </button>\n* )\n* }\n* ```\n* @example\n* Rendering the mutation's own state, rather than just firing it off:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodo() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* return (\n* <div>\n* {addMutation.isPending ? (\n* 'Adding todo...'\n* ) : (\n* <>\n* {addMutation.isError ? (\n* <div>An error occurred: {addMutation.error.message}</div>\n* ) : null}\n* <button onClick={() => addMutation.mutate('Item')}>Add</button>\n* </>\n* )}\n* </div>\n* )\n* }\n* ```\n* @example\n* Optimistic update via `onMutate`, rolling back on `onError`:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodo() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onMutate: async (newTodo) => {\n* await queryClient.cancelQueries({ queryKey: ['todos'] })\n* const previousTodos = queryClient.getQueryData<Array<string>>(['todos'])\n*\n* queryClient.setQueryData<Array<string>>(['todos'], (old) => [\n* ...(old ?? []),\n* newTodo,\n* ])\n*\n* // Passed to `onError` as `onMutateResult` if the mutation fails.\n* return { previousTodos }\n* },\n* onError: (_err, _newTodo, onMutateResult) => {\n* queryClient.setQueryData(['todos'], onMutateResult?.previousTodos)\n* },\n* onSettled: () => {\n* queryClient.invalidateQueries({ queryKey: ['todos'] })\n* },\n* })\n*\n* return (\n* <button onClick={() => addMutation.mutate('Item')}>Add</button>\n* )\n* }\n* ```\n* @example\n* Callbacks passed per call to `mutate` only fire for the last call — `mutateAsync` gives you a\n* promise per call instead, so you can wait for all of them when they succeed:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodos() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* async function handleAddAll(todos: Array<string>) {\n* try {\n* await Promise.all(todos.map((todo) => addMutation.mutateAsync(todo)))\n* } catch (error) {\n* console.error('Failed to add todos:', error)\n* }\n* }\n*\n* return (\n* <button onClick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>\n* Add all\n* </button>\n* )\n* }\n* ```\n* @example\n* If some of the mutations above can fail independently of the others, and you want to know which ones\n* did — rather than losing that information the moment the first one rejects — swap `Promise.all` for\n* `Promise.allSettled`:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodos() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* async function handleAddAll(todos: Array<string>) {\n* const addResults = await Promise.allSettled(\n* todos.map((todo) => addMutation.mutateAsync(todo)),\n* )\n*\n* addResults.forEach((addResult, index) => {\n* if (addResult.status === 'rejected') {\n* console.error(`Failed to add \"${todos[index]}\":`, addResult.reason)\n* }\n* })\n* }\n*\n* return (\n* <button onClick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>\n* Add all\n* </button>\n* )\n* }\n* ```\n*/\nfunction useMutation(options, queryClient) {\n\tconst client = useQueryClient(queryClient);\n\tconst [observer] = React.useState(() => new MutationObserver(client, options));\n\tReact.useEffect(() => {\n\t\tobserver.setOptions(options);\n\t}, [observer, options]);\n\tconst result = React.useSyncExternalStore(React.useCallback((onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer]), () => observer.getCurrentResult(), () => observer.getCurrentResult());\n\tconst mutate = React.useCallback((...args) => {\n\t\tobserver.mutate(args[0], args[1]).catch(noop);\n\t}, [observer]);\n\tif (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) throw result.error;\n\treturn {\n\t\t...result,\n\t\tmutate,\n\t\tmutateAsync: result.mutate\n\t};\n}\n//#endregion\nexport { useMutation };\n\n//# sourceMappingURL=useMutation.js.map"],"ignoreList":[0,1],"mappings":";;;;;AAmBA,IAAIU,IAAmB,cAAcP,EAAa;CACjD;CACA,KAAiB,KAAK;CACtB;CACA;CACA,YAAY,GAAQ,GAAS;EAK5B,AAJA,MAAM,GACN,KAAKQ,KAAUC,GACf,KAAK,WAAWC,CAAO,GACvB,KAAK,YAAY,GACjB,KAAKC,GAAc;CACpB;CAKA,cAAc;EAEb,AADA,KAAK,SAAS,KAAK,OAAO,KAAK,IAAI,GACnC,KAAK,QAAQ,KAAK,MAAM,KAAK,IAAI;CAClC;CAkBA,WAAW,GAAS;EACnB,IAAMC,IAAc,KAAK;EAOzB,AANA,KAAK,UAAU,KAAKJ,GAAQ,uBAAuBE,CAAO,GACrDX,EAAoB,KAAK,SAASa,CAAW,KAAG,KAAKJ,GAAQ,iBAAiB,CAAC,CAAC,OAAO;GAC3F,MAAM;GACN,UAAU,KAAKK;GACf,UAAU;EACX,CAAC,GACGD,GAAa,eAAe,KAAK,QAAQ,eAAeX,EAAQW,EAAY,WAAW,MAAMX,EAAQ,KAAK,QAAQ,WAAW,IAAG,KAAK,MAAM,IACtI,KAAKY,IAAkB,MAAM,WAAW,aAAW,KAAKA,GAAiB,W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EAAO;CAClG,OAAO;EACN,GAAGA;EACH;EACA,aAAaA,EAAO;CACrB;AACD"}
1
+ {"version":3,"file":"useMutation.js","names":["React","useQueryClient","shallowEqualObjects","Subscribable","hashKey","noop","notifyManager","shouldThrowError","getDefaultState","React$1","MutationObserver","#client","client","options","#updateResult","prevOptions","#currentMutation","#notify","action","#currentResult","#mutateOptions","variables","state","mutateOptions","onMutateResult","context","useMutation","queryClient","observer","result","onStoreChange","mutate","args"],"sources":["../../../../node_modules/.pnpm/@tanstack+query-core@5.107.1/node_modules/@tanstack/query-core/build/modern/mutationObserver.js","../../../../node_modules/.pnpm/@tanstack+react-query@5.107.1_@types+react@19.3.0_react@19.3.1/node_modules/@tanstack/react-query/build/modern/useMutation.js"],"sourcesContent":["import { hashKey, shallowEqualObjects } from \"./utils.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { getDefaultState } from \"./mutation.js\";\n// src/mutationObserver.ts\n/**\n* Observes a single mutation and derives a `MutationObserverResult` from it.\n* A framework hook like `useMutation` creates one `MutationObserver` per hook\n* call, keeps it stable across re-renders, calls `setOptions` when the options\n* passed to the hook change, subscribes to it to re-render on updates, and\n* reads `getCurrentResult()` for the value to return. Calling `mutate()`\n* builds a new underlying `Mutation` in the `MutationCache` and executes it.\n* @example\n* ```ts\n* const observer = new MutationObserver(queryClient, {\n* mutationFn: (variables: { title: string }) => addPost(variables),\n* })\n* ```\n*/\nvar MutationObserver = class extends Subscribable {\n\t#client;\n\t#currentResult = void 0;\n\t#currentMutation;\n\t#mutateOptions;\n\tconstructor(client, options) {\n\t\tsuper();\n\t\tthis.#client = client;\n\t\tthis.setOptions(options);\n\t\tthis.bindMethods();\n\t\tthis.#updateResult();\n\t}\n\t/**\n\t* Binds the methods of the result (`mutate` and `reset`) to the observer, so they keep working when\n\t* destructured from it.\n\t*/\n\tbindMethods() {\n\t\tthis.mutate = this.mutate.bind(this);\n\t\tthis.reset = this.reset.bind(this);\n\t}\n\t/**\n\t* Updates the observer's options.\n\t*\n\t* If the new `mutationKey` differs from the previous one (and both were\n\t* defined), the observer is reset, detaching it from the mutation it was\n\t* observing. Otherwise, if the currently observed mutation is still\n\t* `pending`, its options are updated in place as well.\n\t* @param options - The new mutation observer options. They are defaulted with {@link\n\t* QueryClient#defaultMutationOptions} before being applied.\n\t* @example\n\t* ```ts\n\t* observer.setOptions({\n\t* mutationFn: (variables: { title: string }) => addPost(variables),\n\t* onSuccess: (data) => console.log(data),\n\t* })\n\t* ```\n\t*/\n\tsetOptions(options) {\n\t\tconst prevOptions = this.options;\n\t\tthis.options = this.#client.defaultMutationOptions(options);\n\t\tif (!shallowEqualObjects(this.options, prevOptions)) this.#client.getMutationCache().notify({\n\t\t\ttype: \"observerOptionsUpdated\",\n\t\t\tmutation: this.#currentMutation,\n\t\t\tobserver: this\n\t\t});\n\t\tif (prevOptions?.mutationKey && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) this.reset();\n\t\telse if (this.#currentMutation?.state.status === \"pending\") this.#currentMutation.setOptions(this.options);\n\t}\n\tonSubscribe() {\n\t\tif (this.listeners.size === 1 && this.#currentMutation) {\n\t\t\tthis.#currentMutation.addObserver(this);\n\t\t\tthis.#updateResult();\n\t\t}\n\t}\n\tonUnsubscribe() {\n\t\tif (!this.hasListeners()) this.#currentMutation?.removeObserver(this);\n\t}\n\t/**\n\t* Updates the observer's result when the observed mutation changes, and notifies its listeners.\n\t* @internal\n\t* @param action - The action that updated the observed mutation, passed on to the observer's\n\t* callbacks.\n\t*/\n\tonMutationUpdate(action) {\n\t\tthis.#updateResult();\n\t\tthis.#notify(action);\n\t}\n\t/**\n\t* Returns the observer's current result, derived from the observed\n\t* mutation's state (or the default, `idle` state if no mutation has been\n\t* built yet, e.g. before the first `mutate()` call or after `reset()`).\n\t* @returns The observer's latest result.\n\t*/\n\tgetCurrentResult() {\n\t\treturn this.#currentResult;\n\t}\n\t/**\n\t* Detaches the observer from the mutation it is currently observing (if\n\t* any) and resets the observed result back to its default, `idle` state.\n\t*\n\t* This does not cancel an in-flight mutation; the mutation itself keeps\n\t* running to completion and its own callbacks still fire, but this\n\t* observer stops reflecting its state and a subsequent `mutate()` call\n\t* will build a brand new mutation.\n\t* @see {@link MutationObserver#mutate}\n\t* @example\n\t* ```ts\n\t* observer.reset()\n\t* ```\n\t*/\n\treset() {\n\t\tthis.#currentMutation?.removeObserver(this);\n\t\tthis.#currentMutation = void 0;\n\t\tthis.#updateResult();\n\t\tthis.#notify();\n\t}\n\t/**\n\t* Builds a new `Mutation` in the `MutationCache` using the observer's\n\t* current options, detaches this observer from any previously observed\n\t* mutation, attaches it to the new one, and executes it with the given\n\t* variables.\n\t*\n\t* The optional per-call `options` (`onSuccess`/`onError`/`onSettled`) are\n\t* invoked once the mutation settles, in addition to any callbacks defined\n\t* on the observer's own options.\n\t* @param variables - The variables passed to the `mutationFn`.\n\t* @param options - Per-call `onSuccess`, `onError`, and `onSettled` callbacks.\n\t* @returns A promise that resolves with the mutation's data, or rejects with its error.\n\t* @example\n\t* ```ts\n\t* await observer.mutate(\n\t* { title: 'New post' },\n\t* { onSuccess: (data) => console.log(data) },\n\t* )\n\t* ```\n\t*/\n\tmutate(variables, options) {\n\t\tthis.#mutateOptions = options;\n\t\tthis.#currentMutation?.removeObserver(this);\n\t\tthis.#currentMutation = this.#client.getMutationCache().build(this.#client, this.options);\n\t\tthis.#currentMutation.addObserver(this);\n\t\treturn this.#currentMutation.execute(variables);\n\t}\n\t#updateResult() {\n\t\tconst state = this.#currentMutation?.state ?? getDefaultState();\n\t\tthis.#currentResult = {\n\t\t\t...state,\n\t\t\tisPending: state.status === \"pending\",\n\t\t\tisSuccess: state.status === \"success\",\n\t\t\tisError: state.status === \"error\",\n\t\t\tisIdle: state.status === \"idle\",\n\t\t\tmutate: this.mutate,\n\t\t\treset: this.reset\n\t\t};\n\t}\n\t#notify(action) {\n\t\tnotifyManager.batch(() => {\n\t\t\tconst mutateOptions = this.#mutateOptions;\n\t\t\tif (mutateOptions && this.hasListeners()) {\n\t\t\t\tconst variables = this.#currentResult.variables;\n\t\t\t\tconst onMutateResult = this.#currentResult.context;\n\t\t\t\tconst context = {\n\t\t\t\t\tclient: this.#client,\n\t\t\t\t\tmeta: this.options.meta,\n\t\t\t\t\tmutationKey: this.options.mutationKey\n\t\t\t\t};\n\t\t\t\tif (action?.type === \"success\") {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tmutateOptions.onSuccess?.(action.data, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tmutateOptions.onSettled?.(action.data, null, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t} else if (action?.type === \"error\") {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tmutateOptions.onError?.(action.error, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tmutateOptions.onSettled?.(void 0, action.error, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.listeners.forEach((listener) => {\n\t\t\t\tlistener(this.#currentResult);\n\t\t\t});\n\t\t});\n\t}\n};\nexport { MutationObserver };\n\n//# sourceMappingURL=mutationObserver.js.map","\"use client\";\nimport { useQueryClient } from \"./QueryClientProvider.js\";\nimport * as React from \"react\";\nimport { MutationObserver, noop, notifyManager, shouldThrowError } from \"@tanstack/query-core\";\n// src/useMutation.ts\n/**\n* Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.\n* `useMutation` is the hook for that.\n* @param options - The {@link UseMutationOptions} to use — everything you can pass to `useMutation`.\n* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n* be used.\n* @returns `mutate`/`mutateAsync` also accept per-call `onSuccess`/`onError`/`onSettled` callbacks as a second\n* argument, useful for triggering call-site side effects (e.g. navigation) without coupling them to the shared\n* mutation definition. Hook-level callbacks (passed to `options`) fire for every mutation; per-call callbacks\n* fire only for the latest call you've made, and only while the component is still mounted — unmounting before\n* the mutation settles removes the subscription and prevents them from firing.\n* @throws {Error} The mutation error, when `throwOnError` is `true` or returns `true` for it, so that it is\n* thrown to the nearest error boundary.\n* @see {@link mutationOptions} to share these options across multiple `useMutation` call sites, or to look\n* the mutation up elsewhere via its `mutationKey` (e.g. with `useMutationState`).\n* @example\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodo() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* return (\n* <button\n* onClick={() =>\n* addMutation.mutate('Item', {\n* onError: (error) => console.error('Failed to add item:', error),\n* })\n* }\n* >\n* Add\n* </button>\n* )\n* }\n* ```\n* @example\n* Rendering the mutation's own state, rather than just firing it off:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodo() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* return (\n* <div>\n* {addMutation.isPending ? (\n* 'Adding todo...'\n* ) : (\n* <>\n* {addMutation.isError ? (\n* <div>An error occurred: {addMutation.error.message}</div>\n* ) : null}\n* <button onClick={() => addMutation.mutate('Item')}>Add</button>\n* </>\n* )}\n* </div>\n* )\n* }\n* ```\n* @example\n* Optimistic update via `onMutate`, rolling back on `onError`:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodo() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onMutate: async (newTodo) => {\n* await queryClient.cancelQueries({ queryKey: ['todos'] })\n* const previousTodos = queryClient.getQueryData<Array<string>>(['todos'])\n*\n* queryClient.setQueryData<Array<string>>(['todos'], (old) => [\n* ...(old ?? []),\n* newTodo,\n* ])\n*\n* // Passed to `onError` as `onMutateResult` if the mutation fails.\n* return { previousTodos }\n* },\n* onError: (_err, _newTodo, onMutateResult) => {\n* queryClient.setQueryData(['todos'], onMutateResult?.previousTodos)\n* },\n* onSettled: () => {\n* queryClient.invalidateQueries({ queryKey: ['todos'] })\n* },\n* })\n*\n* return (\n* <button onClick={() => addMutation.mutate('Item')}>Add</button>\n* )\n* }\n* ```\n* @example\n* Callbacks passed per call to `mutate` only fire for the last call — `mutateAsync` gives you a\n* promise per call instead, so you can wait for all of them when they succeed:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodos() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* async function handleAddAll(todos: Array<string>) {\n* try {\n* await Promise.all(todos.map((todo) => addMutation.mutateAsync(todo)))\n* } catch (error) {\n* console.error('Failed to add todos:', error)\n* }\n* }\n*\n* return (\n* <button onClick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>\n* Add all\n* </button>\n* )\n* }\n* ```\n* @example\n* If some of the mutations above can fail independently of the others, and you want to know which ones\n* did — rather than losing that information the moment the first one rejects — swap `Promise.all` for\n* `Promise.allSettled`:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodos() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* async function handleAddAll(todos: Array<string>) {\n* const addResults = await Promise.allSettled(\n* todos.map((todo) => addMutation.mutateAsync(todo)),\n* )\n*\n* addResults.forEach((addResult, index) => {\n* if (addResult.status === 'rejected') {\n* console.error(`Failed to add \"${todos[index]}\":`, addResult.reason)\n* }\n* })\n* }\n*\n* return (\n* <button onClick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>\n* Add all\n* </button>\n* )\n* }\n* ```\n*/\nfunction useMutation(options, queryClient) {\n\tconst client = useQueryClient(queryClient);\n\tconst [observer] = React.useState(() => new MutationObserver(client, options));\n\tReact.useEffect(() => {\n\t\tobserver.setOptions(options);\n\t}, [observer, options]);\n\tconst result = React.useSyncExternalStore(React.useCallback((onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer]), () => observer.getCurrentResult(), () => observer.getCurrentResult());\n\tconst mutate = React.useCallback((...args) => {\n\t\tobserver.mutate(args[0], args[1]).catch(noop);\n\t}, [observer]);\n\tif (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) throw result.error;\n\treturn {\n\t\t...result,\n\t\tmutate,\n\t\tmutateAsync: result.mutate\n\t};\n}\nexport { useMutation };\n\n//# sourceMappingURL=useMutation.js.map"],"ignoreList":[0,1],"mappings":";;;;;AAmBA,IAAIU,IAAmB,cAAcP,EAAa;CACjD;CACA,KAAiB,KAAK;CACtB;CACA;CACA,YAAY,GAAQ,GAAS;EAK5B,AAJA,MAAM,GACN,KAAKQ,KAAUC,GACf,KAAK,WAAWC,CAAO,GACvB,KAAK,YAAY,GACjB,KAAKC,GAAc;CACpB;CAKA,cAAc;EAEb,AADA,KAAK,SAAS,KAAK,OAAO,KAAK,IAAI,GACnC,KAAK,QAAQ,KAAK,MAAM,KAAK,IAAI;CAClC;CAkBA,WAAW,GAAS;EACnB,IAAMC,IAAc,KAAK;EAOzB,AANA,KAAK,UAAU,KAAKJ,GAAQ,uBAAuBE,CAAO,GACrDX,EAAoB,KAAK,SAASa,CAAW,KAAG,KAAKJ,GAAQ,iBAAiB,CAAC,CAAC,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AAM,aAAa,GAAGgC,MAAS;EAC7C,EAAS,OAAOA,EAAK,IAAIA,EAAK,EAAE,CAAC,CAAC,MAAM3B,CAAI;CAC7C,GAAG,CAACuB,CAAQ,CAAC;CACb,IAAIC,EAAO,SAAStB,EAAiBqB,EAAS,QAAQ,cAAc,CAACC,EAAO,KAAK,CAAC,GAAG,MAAMA,EAAO;CAClG,OAAO;EACN,GAAGA;EACH;EACA,aAAaA,EAAO;CACrB;AACD"}
@@ -3,7 +3,7 @@ import { C as t, b as n, c as r, g as i, l as a, n as o, o as s, p as c, s as l,
3
3
  import * as m from "react";
4
4
  import { useMemo as h } from "react";
5
5
  import "react/jsx-runtime";
6
- // ../../node_modules/.pnpm/@tanstack+query-core@5.105.0/node_modules/@tanstack/query-core/build/modern/queryObserver.js
6
+ // ../../node_modules/.pnpm/@tanstack+query-core@5.107.1/node_modules/@tanstack/query-core/build/modern/queryObserver.js
7
7
  var g = class extends r {
8
8
  #e;
9
9
  #t = void 0;
@@ -149,7 +149,7 @@ var g = class extends r {
149
149
  this.#o = e;
150
150
  }
151
151
  } else m === void 0 && (this.#o = null);
152
- this.#o && (h = this.#o, m = this.#c, g = Date.now(), _ = "error", f = !1);
152
+ this.#o && (h = this.#o, m = this.#c, g = i?.error === h ? i.errorUpdatedAt : Date.now(), _ = "error", f = !1);
153
153
  let S = d.fetchStatus === "fetching", C = _ === "pending", w = _ === "error", T = C && S, E = m !== void 0;
154
154
  return {
155
155
  status: _,
@@ -186,12 +186,9 @@ var g = class extends r {
186
186
  let r = (() => {
187
187
  if (!e) return !0;
188
188
  let { notifyOnChangeProps: t } = this.options, n = typeof t == "function" ? t() : t;
189
- if (n === "all" || !n && !this.#p.size) return !0;
190
- let r = new Set(n ?? this.#p);
191
- return this.options.throwOnError && r.add("error"), Object.keys(this.#r).some((t) => {
192
- let n = t;
193
- return this.#r[n] !== e[n] && r.has(n);
194
- });
189
+ if (n === "all" || !n && !this.#p.size || this.options.throwOnError && this.#r.error !== e.error) return !0;
190
+ for (let t of n ?? this.#p) if (this.#r[t] !== e[t]) return !0;
191
+ return !1;
195
192
  })();
196
193
  s.batch(() => {
197
194
  r && this.listeners.forEach((e) => {
@@ -231,10 +228,10 @@ function b(e, t, n, r) {
231
228
  function x(e, t) {
232
229
  return p(t.enabled, e) !== !1 && e.isStaleByTime(p(t.staleTime, e));
233
230
  }
234
- // ../../node_modules/.pnpm/@tanstack+react-query@5.105.0_@types+react@19.3.0_react@19.3.1/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js
231
+ // ../../node_modules/.pnpm/@tanstack+react-query@5.107.1_@types+react@19.3.0_react@19.3.1/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js
235
232
  var S = m.createContext(!1), C = () => m.useContext(S);
236
233
  S.Provider;
237
- // ../../node_modules/.pnpm/@tanstack+react-query@5.105.0_@types+react@19.3.0_react@19.3.1/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js
234
+ // ../../node_modules/.pnpm/@tanstack+react-query@5.107.1_@types+react@19.3.0_react@19.3.1/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js
238
235
  function w() {
239
236
  let e = !1;
240
237
  return {
@@ -262,20 +259,22 @@ var T = m.createContext(w()), E = () => m.useContext(T), D = (e, t, n) => {
262
259
  }, j = (e, t) => e?.suspense && t.isPending, M = (e, t, n) => t.fetchOptimistic(e).catch(() => {
263
260
  n.clearReset();
264
261
  });
265
- // ../../node_modules/.pnpm/@tanstack+react-query@5.105.0_@types+react@19.3.0_react@19.3.1/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
262
+ // ../../node_modules/.pnpm/@tanstack+react-query@5.107.1_@types+react@19.3.0_react@19.3.1/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
266
263
  function N(t, n, r) {
267
264
  if (process.env.NODE_ENV !== "production" && (typeof t != "object" || Array.isArray(t))) throw Error("Bad argument type. Starting with v5, only the \"Object\" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object");
268
265
  let a = C(), o = E(), c = e(r), l = c.defaultQueryOptions(t), u = c.getQueryCache().get(l.queryHash);
269
266
  process.env.NODE_ENV !== "production" && (l.queryFn || console.error(`[${l.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));
270
267
  let d = t.subscribed !== !1;
271
268
  l._optimisticResults = a ? "isRestoring" : d ? "optimistic" : void 0, A(l), D(l, o, u), O(o);
272
- let [f] = m.useState(() => new n(c, l)), p = f.getOptimisticResult(l), h = !a && d;
269
+ let [f] = m.useState(() => new n(c, l)), p = f.getOptimisticResult(l);
270
+ m.useEffect(() => {
271
+ f.setOptions(l);
272
+ }, [l, f]);
273
+ let h = !a && d;
273
274
  if (m.useSyncExternalStore(m.useCallback((e) => {
274
275
  let t = h ? f.subscribe(s.batchCalls(e)) : i;
275
276
  return f.updateResult(), t;
276
- }, [f, h]), () => f.getCurrentResult(), () => f.getCurrentResult()), m.useEffect(() => {
277
- f.setOptions(l);
278
- }, [l, f]), j(l, p)) throw M(l, f, o);
277
+ }, [f, h]), () => f.getCurrentResult(), () => f.getCurrentResult()), j(l, p)) throw M(l, f, o);
279
278
  if (k({
280
279
  result: p,
281
280
  errorResetBoundary: o,
@@ -285,7 +284,7 @@ function N(t, n, r) {
285
284
  })) throw p.error;
286
285
  return l.notifyOnChangeProps ? p : f.trackResult(p);
287
286
  }
288
- // ../../node_modules/.pnpm/@tanstack+react-query@5.105.0_@types+react@19.3.0_react@19.3.1/node_modules/@tanstack/react-query/build/modern/useQuery.js
287
+ // ../../node_modules/.pnpm/@tanstack+react-query@5.107.1_@types+react@19.3.0_react@19.3.1/node_modules/@tanstack/react-query/build/modern/useQuery.js
289
288
  function P(e, t) {
290
289
  return N(e, g, t);
291
290
  }