@lunora/studio 1.0.0-alpha.4 → 1.0.0-alpha.41

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 (187) hide show
  1. package/LICENSE.md +6 -0
  2. package/__assets__/package-og.svg +1 -1
  3. package/dist/index.d.ts +33 -18
  4. package/dist/index.js +29 -29
  5. package/dist/mount.d.ts +1 -1
  6. package/dist/mount.js +3 -2
  7. package/dist/{packem_shared/ApiTab-W3no0KOj.js → packem_chunks/ApiTab.js} +5 -5
  8. package/dist/{packem_shared/AuditPanel-Bq4o_IqT.js → packem_chunks/AuditPanel.js} +29 -41
  9. package/dist/{packem_shared/ExportImportPanel-dxY56TDF.js → packem_chunks/ExportImportPanel.js} +16 -11
  10. package/dist/{packem_shared/FileBrowser-Dhy4zES8.js → packem_chunks/FileBrowser.js} +15 -15
  11. package/dist/{packem_shared/FunctionRunner--fQJRPAD.js → packem_chunks/FunctionRunner.js} +10 -10
  12. package/dist/{packem_shared/FunctionStatsPanel-BjRUA_G3.js → packem_chunks/FunctionStatsPanel.js} +153 -208
  13. package/dist/{packem_shared/HealthPanel-PxclMWmA.js → packem_chunks/HealthPanel.js} +37 -29
  14. package/dist/{packem_shared/InsightsPanel-CWS_C-xW.js → packem_chunks/InsightsPanel.js} +108 -69
  15. package/dist/{packem_shared/LogsPanel-CTW8CFcM.js → packem_chunks/LogsPanel.js} +46 -58
  16. package/dist/{packem_shared/MailPanel-BwkvfIHF.js → packem_chunks/MailPanel.js} +45 -139
  17. package/dist/{packem_shared/MetricsPanel-BLuOhZQ4.js → packem_chunks/MetricsPanel.js} +41 -322
  18. package/dist/{packem_shared/MigrationsPanel-DT3lnwHF.js → packem_chunks/MigrationsPanel.js} +44 -51
  19. package/dist/{packem_shared/PitrPanel-CdErL7EJ.js → packem_chunks/PitrPanel.js} +9 -9
  20. package/dist/{packem_shared/SchemaViewer-LJDcmNIO.js → packem_chunks/SchemaViewer.js} +17 -16
  21. package/dist/{packem_shared/SecurityAdvisorPanel-C_ETsPih.js → packem_chunks/SecurityAdvisorPanel.js} +47 -31
  22. package/dist/packem_chunks/SettingsPanel.js +391 -0
  23. package/dist/{packem_shared/sql-editor-panel-BFRpzj6r.js → packem_chunks/SqlEditorPanel.js} +158 -387
  24. package/dist/{packem_shared/TableEditor-ChfUOZec.js → packem_chunks/TableEditor.js} +10 -68
  25. package/dist/packem_chunks/analytics-panel.js +261 -0
  26. package/dist/packem_chunks/auth-config-panel.js +365 -0
  27. package/dist/packem_chunks/auth-sessions-panel.js +175 -0
  28. package/dist/packem_chunks/containers-panel.js +247 -0
  29. package/dist/packem_chunks/dashboards-panel.js +780 -0
  30. package/dist/packem_chunks/fanout-panel.js +482 -0
  31. package/dist/packem_chunks/flags-panel.js +176 -0
  32. package/dist/packem_chunks/kv-browser.js +1896 -0
  33. package/dist/packem_chunks/log-drains-panel.js +273 -0
  34. package/dist/packem_chunks/organizations-panel.js +3178 -0
  35. package/dist/packem_chunks/payments-panel.js +186 -0
  36. package/dist/packem_chunks/permissions-panel.js +805 -0
  37. package/dist/packem_chunks/queues-panel.js +1075 -0
  38. package/dist/packem_chunks/rls-panel.js +315 -0
  39. package/dist/packem_chunks/schedule-panel.js +831 -0
  40. package/dist/packem_chunks/sparkline.js +79 -0
  41. package/dist/packem_chunks/storage-rules-panel.js +140 -0
  42. package/dist/packem_chunks/subscriptions-panel.js +238 -0
  43. package/dist/packem_chunks/users-panel.js +1731 -0
  44. package/dist/packem_chunks/vector-browser.js +281 -0
  45. package/dist/packem_chunks/workflows-panel.js +562 -0
  46. package/dist/packem_shared/{ADMIN_FUNCTIONS-DmBqMZ-z.js → ADMIN_FUNCTIONS-BHHJi3Gb.js} +7 -0
  47. package/dist/packem_shared/{ApiDocsPanel-C5-yJ1p7.js → ApiDocsPanel-CBma-lnp.js} +2 -2
  48. package/dist/packem_shared/{ApiReferencePanel-1vubqG5s.js → ApiReferencePanel-CQM3pPN7.js} +2 -1
  49. package/dist/packem_shared/{CommandPalette-BtgkBzZI.js → CommandPalette-X2tkbyHk.js} +1 -1
  50. package/dist/packem_shared/{DataBrowser-CtBe1So9.js → DataBrowser-D2ywrdId.js} +198 -247
  51. package/dist/packem_shared/{GlobalDataBrowser-BTEmGrph.js → GlobalDataBrowser-BkTPLzAY.js} +37 -66
  52. package/dist/packem_shared/HomePanel-D1Q9LZgK.js +14 -0
  53. package/dist/packem_shared/{OpenRpcReferencePanel-vbcYbv3V.js → OpenRpcReferencePanel-Dno-hfDb.js} +2 -1
  54. package/dist/packem_shared/{ScheduledJobs-CabfKbyM.js → ScheduledJobs-Ctw4jYtU.js} +163 -60
  55. package/dist/packem_shared/Studio-lJhzDAze.js +16 -0
  56. package/dist/packem_shared/{StudioApp-CHOZA-z-.js → StudioApp-DiMkupvZ.js} +276 -11
  57. package/dist/packem_shared/{advisor-view-CGcfMiPq.js → advisor-view-BX8OhG0w.js} +6 -6
  58. package/dist/packem_shared/alert-CdAET2K_.js +68 -0
  59. package/dist/packem_shared/{app.d-CCmwDEVs.d.ts → app.d-CNLRTrWw.d.ts} +1 -1
  60. package/dist/packem_shared/{bar-chart-CzJAgqkp.js → bar-chart-DSwcWIRy.js} +5 -4
  61. package/dist/packem_shared/browser-storage-BTrX4y3B.js +215 -0
  62. package/dist/packem_shared/{cf-links-2cktDedA.js → cf-links-BZfRdxSE.js} +1 -1
  63. package/dist/packem_shared/{data-grid-B5CaV3wS.js → data-grid-CdXztApG.js} +1 -1
  64. package/dist/packem_shared/data-view-params-Cd6yRVbv.js +96 -0
  65. package/dist/packem_shared/error-alert-CXjqyGw9.js +114 -0
  66. package/dist/packem_shared/{grid-features-CzUfqgsM.js → grid-features-BF-KBDFz.js} +131 -163
  67. package/dist/packem_shared/home-panel-TFcRf9Ui.js +1889 -0
  68. package/dist/packem_shared/{internal-rXJEAhXS.js → internal-CYcbqMjX.js} +44 -3
  69. package/dist/packem_shared/modal-shell-hyaJvIJ6.js +100 -0
  70. package/dist/packem_shared/{reference-view-B4E49Lip.js → reference-view-DUiJcILV.js} +6 -45
  71. package/dist/packem_shared/scroll-area-DLhcy-ml.js +93 -0
  72. package/dist/packem_shared/select-UkNYCT3s.js +273 -0
  73. package/dist/packem_shared/skeleton-CGhL0p20.js +45 -0
  74. package/dist/packem_shared/{sparkline-10dG-_f0.js → sparkline-BnA1kC9X.js} +1 -1
  75. package/dist/packem_shared/studio-Dh9UlaF_.js +4015 -0
  76. package/dist/packem_shared/{table-_RzNvy3R.js → table-DsCa9Qp9.js} +1 -1
  77. package/dist/packem_shared/{table-list-sidebar-Bg7uzbvC.js → table-list-sidebar-UVIXQJdU.js} +1 -1
  78. package/dist/packem_shared/use-admin-query-CfHYWx5n.js +106 -0
  79. package/dist/packem_shared/use-async-submit-DJQiPc-_.js +91 -0
  80. package/dist/standalone/chunk-25AYY4H7.js +2 -0
  81. package/dist/standalone/chunk-2ANAF4ZM.js +1 -0
  82. package/dist/standalone/chunk-2K47A3P6.js +1 -0
  83. package/dist/standalone/chunk-2NGUNNGW.js +1 -0
  84. package/dist/standalone/chunk-3CJW6NWG.js +4 -0
  85. package/dist/standalone/chunk-3OA7PECS.js +6 -0
  86. package/dist/standalone/chunk-3OIHOXVV.js +1 -0
  87. package/dist/standalone/chunk-447TAUFD.js +1 -0
  88. package/dist/standalone/chunk-4QHKBC77.js +1 -0
  89. package/dist/standalone/chunk-5C4TSNE6.js +1 -0
  90. package/dist/standalone/chunk-5OIBXYZM.js +1 -0
  91. package/dist/standalone/chunk-6HSHEMZV.js +76 -0
  92. package/dist/standalone/chunk-6JIZ34MB.js +3 -0
  93. package/dist/standalone/chunk-6VO23MMW.js +4 -0
  94. package/dist/standalone/chunk-7MVSQS7B.js +1 -0
  95. package/dist/standalone/chunk-7TJJXVSE.js +1 -0
  96. package/dist/standalone/chunk-7YXOPTWI.js +1 -0
  97. package/dist/standalone/chunk-AHILM3ZP.js +1 -0
  98. package/dist/standalone/chunk-BGXOXASQ.js +1 -0
  99. package/dist/standalone/chunk-BJGBHGK3.js +1 -0
  100. package/dist/standalone/chunk-BOXSWNXZ.js +1 -0
  101. package/dist/standalone/chunk-BX5MKYOC.js +1 -0
  102. package/dist/standalone/chunk-CKSHCYGC.js +2 -0
  103. package/dist/standalone/chunk-DWDILV2E.js +1 -0
  104. package/dist/standalone/chunk-E75ANNWX.js +19 -0
  105. package/dist/standalone/chunk-EQZQOTJY.js +1 -0
  106. package/dist/standalone/chunk-GTLEWM5Y.js +1 -0
  107. package/dist/standalone/chunk-GTM65MVX.js +1 -0
  108. package/dist/standalone/chunk-GUI5GFFI.js +1 -0
  109. package/dist/standalone/chunk-HN6KJXYQ.js +1 -0
  110. package/dist/standalone/chunk-HV7G6DFP.js +5 -0
  111. package/dist/standalone/chunk-HYDJNCGW.js +1 -0
  112. package/dist/standalone/chunk-HZK5RQHG.js +1 -0
  113. package/dist/standalone/chunk-IN2SYVJB.js +1 -0
  114. package/dist/standalone/chunk-IOANPSJN.js +1 -0
  115. package/dist/standalone/chunk-ISDZPW3V.js +1 -0
  116. package/dist/standalone/chunk-IXDH4GL5.js +1 -0
  117. package/dist/standalone/chunk-J6J54MBP.js +1 -0
  118. package/dist/standalone/chunk-J73VHFCL.js +1 -0
  119. package/dist/standalone/chunk-JHKMUTIF.js +13 -0
  120. package/dist/standalone/chunk-JPRH6DPK.js +1 -0
  121. package/dist/standalone/chunk-JSEXCW5Q.js +1 -0
  122. package/dist/standalone/chunk-KA5YB3VP.js +1 -0
  123. package/dist/standalone/chunk-KBB75WNT.js +1 -0
  124. package/dist/standalone/chunk-KEGAWN6Y.js +1 -0
  125. package/dist/standalone/chunk-KJJ3WM6H.js +4 -0
  126. package/dist/standalone/chunk-KQV4NGH3.js +1 -0
  127. package/dist/standalone/chunk-KSKXW5PX.js +1 -0
  128. package/dist/standalone/chunk-KUH4P5F5.js +1 -0
  129. package/dist/standalone/chunk-KYJPPVGB.js +1 -0
  130. package/dist/standalone/chunk-KZ6INM5M.js +1 -0
  131. package/dist/standalone/chunk-L2TJVSDQ.js +1 -0
  132. package/dist/standalone/chunk-L7SK4ZZD.js +1 -0
  133. package/dist/standalone/chunk-LAK5VSPI.js +1 -0
  134. package/dist/standalone/chunk-LBN7LPVK.js +1 -0
  135. package/dist/standalone/chunk-LNZIB2MD.js +1 -0
  136. package/dist/standalone/chunk-MJWVMKQ4.js +6 -0
  137. package/dist/standalone/chunk-MLZYX5CQ.js +1 -0
  138. package/dist/standalone/chunk-N2X2OO4V.js +1 -0
  139. package/dist/standalone/chunk-NGKITPQP.js +13 -0
  140. package/dist/standalone/chunk-O3NAGRTR.js +1 -0
  141. package/dist/standalone/chunk-OZACQNKG.js +1 -0
  142. package/dist/standalone/chunk-PNDNXS5Z.js +1 -0
  143. package/dist/standalone/chunk-Q7DMUTUE.js +1 -0
  144. package/dist/standalone/chunk-QAFAJBAW.js +1 -0
  145. package/dist/standalone/chunk-QBAT52GB.js +1 -0
  146. package/dist/standalone/chunk-RHZ4M2NZ.js +1 -0
  147. package/dist/standalone/chunk-RRCPZMC2.js +22 -0
  148. package/dist/standalone/chunk-SEU5V7I6.js +1 -0
  149. package/dist/standalone/chunk-TAD43CG5.js +1 -0
  150. package/dist/standalone/chunk-TBMYIZIO.js +1 -0
  151. package/dist/standalone/chunk-TDZ44E5I.js +4 -0
  152. package/dist/standalone/chunk-THNBTMUF.js +1 -0
  153. package/dist/standalone/chunk-TIQISBGK.js +1 -0
  154. package/dist/standalone/chunk-TMYVNQ66.js +1 -0
  155. package/dist/standalone/chunk-TQ36RWOP.js +1 -0
  156. package/dist/standalone/chunk-UGUEC6BC.js +1 -0
  157. package/dist/standalone/chunk-UJB2LEI4.js +4 -0
  158. package/dist/standalone/chunk-UK64ZSUW.js +1 -0
  159. package/dist/standalone/chunk-UKDJ4H7I.js +1 -0
  160. package/dist/standalone/chunk-VLXV72QE.js +1 -0
  161. package/dist/standalone/chunk-VON7JUPG.js +1 -0
  162. package/dist/standalone/chunk-W3JK4YWR.js +1 -0
  163. package/dist/standalone/chunk-W3SHEIAL.js +3 -0
  164. package/dist/standalone/chunk-WI7GWFEG.js +1 -0
  165. package/dist/standalone/chunk-WIHXMNUY.js +1 -0
  166. package/dist/standalone/chunk-WLDVXVI2.js +1 -0
  167. package/dist/standalone/chunk-XLXNLJ4N.js +1 -0
  168. package/dist/standalone/chunk-XNJNSCLM.js +1 -0
  169. package/dist/standalone/chunk-YAECF5LW.js +1 -0
  170. package/dist/standalone/chunk-YBGC4PPD.js +1 -0
  171. package/dist/standalone/chunk-YJAPWSDC.js +4 -0
  172. package/dist/standalone/chunk-ZEJB6DXU.js +8 -0
  173. package/dist/standalone/chunk-ZFNBPAIZ.js +1 -0
  174. package/dist/standalone/chunk-ZHVTQ37P.js +1 -0
  175. package/dist/standalone/chunk-ZIGWVHCS.js +1 -0
  176. package/dist/standalone/chunk-ZPP2KOR4.js +1 -0
  177. package/dist/standalone/chunk-ZPUO7FNI.js +1 -0
  178. package/dist/standalone/studio.js +104 -246
  179. package/dist/styles.css +2 -2
  180. package/package.json +15 -13
  181. package/dist/packem_shared/HomePanel-Cw16stjq.js +0 -1273
  182. package/dist/packem_shared/SettingsPanel-C0uLRf5P.js +0 -176
  183. package/dist/packem_shared/SqlEditorPanel-CguV7otm.js +0 -13
  184. package/dist/packem_shared/Studio-DFWAlcuf.js +0 -33
  185. package/dist/packem_shared/studio-Bj8psK1c.js +0 -10303
  186. package/dist/packem_shared/use-live-admin-Dq6g3daN.js +0 -73
  187. package/dist/packem_shared/use-live-shard-seed-Cuk3dnH0.js +0 -76
@@ -0,0 +1,3178 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { useLunora } from '@lunora/react';
3
+ import { useState } from 'react';
4
+ import { B as Button } from '../packem_shared/button-BhsN2uZH.js';
5
+ import { a as CardContent, C as Card } from '../packem_shared/card-DURq3ElK.js';
6
+ import { E as EmptyState } from '../packem_shared/empty-state-DY_oe0k6.js';
7
+ import { c as TableHead, a as TableHeader, b as TableRow, e as TableCell, d as TableBody, T as Table } from '../packem_shared/table-DsCa9Qp9.js';
8
+ import { a as useClientQuery } from '../packem_shared/use-admin-query-CfHYWx5n.js';
9
+ import { u as useAsyncSubmit, a as useAuthConfig } from '../packem_shared/use-async-submit-DJQiPc-_.js';
10
+ import { useAutoRefresh } from '../packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js';
11
+ import { useT } from '../packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js';
12
+ import { h as formatCell, f as fireAndForget, i as formatTimestamp } from '../packem_shared/internal-CYcbqMjX.js';
13
+ import { I as Input } from '../packem_shared/input-XH4r1Pt1.js';
14
+ import { L as Label } from '../packem_shared/label-D8ykjn5J.js';
15
+ import { M as ModalShell } from '../packem_shared/modal-shell-hyaJvIJ6.js';
16
+ import { T as Textarea } from '../packem_shared/textarea-D3gaCU_-.js';
17
+ import { jsxDEV, Fragment } from 'react/jsx-dev-runtime';
18
+
19
+ const parseJsonObject = (text) => {
20
+ const parsed = JSON.parse(text);
21
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
22
+ throw new TypeError("Expected a JSON object");
23
+ }
24
+ return parsed;
25
+ };
26
+ const parsePermission = (text) => {
27
+ const object = parseJsonObject(text);
28
+ const grant = {};
29
+ for (const [resource, actions] of Object.entries(object)) {
30
+ if (!Array.isArray(actions) || actions.some((action) => typeof action !== "string")) {
31
+ throw new TypeError(`"${resource}" must map to an array of action strings`);
32
+ }
33
+ grant[resource] = actions;
34
+ }
35
+ return grant;
36
+ };
37
+ const jsonInitial = (value) => {
38
+ if (value === void 0 || value === null || value === "") {
39
+ return "";
40
+ }
41
+ if (typeof value === "string") {
42
+ return value;
43
+ }
44
+ return JSON.stringify(value, null, 2);
45
+ };
46
+ const Field = (t0) => {
47
+ const $ = c(6);
48
+ const {
49
+ children,
50
+ htmlFor,
51
+ label
52
+ } = t0;
53
+ let t1;
54
+ if ($[0] !== htmlFor || $[1] !== label) {
55
+ t1 = /* @__PURE__ */ jsxDEV(Label, {
56
+ htmlFor,
57
+ children: label
58
+ }, void 0, false);
59
+ $[0] = htmlFor;
60
+ $[1] = label;
61
+ $[2] = t1;
62
+ } else {
63
+ t1 = $[2];
64
+ }
65
+ let t2;
66
+ if ($[3] !== children || $[4] !== t1) {
67
+ t2 = /* @__PURE__ */ jsxDEV("div", {
68
+ className: "flex flex-col gap-1",
69
+ children: [t1, children]
70
+ }, void 0, true);
71
+ $[3] = children;
72
+ $[4] = t1;
73
+ $[5] = t2;
74
+ } else {
75
+ t2 = $[5];
76
+ }
77
+ return t2;
78
+ };
79
+ const DialogForm = ({
80
+ busy,
81
+ canSubmit,
82
+ children,
83
+ destructive = false,
84
+ error,
85
+ onClose,
86
+ onSubmit,
87
+ submitLabel,
88
+ testId,
89
+ title
90
+ }) => {
91
+ const t = useT();
92
+ return /* @__PURE__ */ jsxDEV(ModalShell, {
93
+ label: title,
94
+ onClose,
95
+ panelTestId: `${testId}-panel`,
96
+ testId: `${testId}-overlay`,
97
+ variant: "dialog",
98
+ children: [/* @__PURE__ */ jsxDEV("h2", {
99
+ className: "text-sm font-semibold text-foreground",
100
+ children: title
101
+ }, void 0, false), children, error !== null && /* @__PURE__ */ jsxDEV("p", {
102
+ className: "text-sm text-destructive",
103
+ "data-testid": `${testId}-error`,
104
+ role: "alert",
105
+ children: error
106
+ }, void 0, false), /* @__PURE__ */ jsxDEV("div", {
107
+ className: "flex justify-end gap-2 pt-1",
108
+ children: [/* @__PURE__ */ jsxDEV(Button, {
109
+ "data-testid": `${testId}-cancel`,
110
+ onClick: onClose,
111
+ size: "sm",
112
+ type: "button",
113
+ variant: "outline",
114
+ children: t("Cancel")
115
+ }, void 0, false), /* @__PURE__ */ jsxDEV(Button, {
116
+ "data-testid": `${testId}-submit`,
117
+ disabled: busy || !canSubmit,
118
+ onClick: onSubmit,
119
+ size: "sm",
120
+ type: "button",
121
+ variant: destructive ? "destructive" : "default",
122
+ children: busy ? t("Saving…") : submitLabel
123
+ }, void 0, false)]
124
+ }, void 0, true)]
125
+ }, void 0, true);
126
+ };
127
+ const OrgFormDialog = (t0) => {
128
+ const $ = c(79);
129
+ const {
130
+ mode,
131
+ onClose,
132
+ onDone,
133
+ org
134
+ } = t0;
135
+ const client = useLunora();
136
+ const t = useT();
137
+ const {
138
+ busy,
139
+ error,
140
+ run
141
+ } = useAsyncSubmit();
142
+ let t1;
143
+ if ($[0] !== org) {
144
+ t1 = org ? formatCell(org.name) : "";
145
+ $[0] = org;
146
+ $[1] = t1;
147
+ } else {
148
+ t1 = $[1];
149
+ }
150
+ const [name, setName] = useState(t1);
151
+ let t2;
152
+ if ($[2] !== org) {
153
+ t2 = org ? formatCell(org.slug) : "";
154
+ $[2] = org;
155
+ $[3] = t2;
156
+ } else {
157
+ t2 = $[3];
158
+ }
159
+ const [slug, setSlug] = useState(t2);
160
+ let t3;
161
+ if ($[4] !== org) {
162
+ t3 = org ? formatCell(org.logo) : "";
163
+ $[4] = org;
164
+ $[5] = t3;
165
+ } else {
166
+ t3 = $[5];
167
+ }
168
+ const [logo, setLogo] = useState(t3);
169
+ const [ownerId, setOwnerId] = useState("");
170
+ let t4;
171
+ if ($[6] !== mode || $[7] !== org?.metadata) {
172
+ t4 = mode === "edit" ? jsonInitial(org?.metadata) : "";
173
+ $[6] = mode;
174
+ $[7] = org?.metadata;
175
+ $[8] = t4;
176
+ } else {
177
+ t4 = $[8];
178
+ }
179
+ const [metadata, setMetadata] = useState(t4);
180
+ let t5;
181
+ if ($[9] !== client || $[10] !== logo || $[11] !== metadata || $[12] !== mode || $[13] !== name || $[14] !== onClose || $[15] !== onDone || $[16] !== org?.id || $[17] !== ownerId || $[18] !== run || $[19] !== slug) {
182
+ t5 = () => {
183
+ run(async () => {
184
+ const parsedMetadata = metadata.trim() === "" ? void 0 : parseJsonObject(metadata);
185
+ if (mode === "create") {
186
+ await client.createAuthOrganization({
187
+ logo: logo.trim() === "" ? void 0 : logo.trim(),
188
+ metadata: parsedMetadata,
189
+ name: name.trim(),
190
+ ownerId: ownerId.trim() === "" ? void 0 : ownerId.trim(),
191
+ slug: slug.trim() === "" ? void 0 : slug.trim()
192
+ });
193
+ } else {
194
+ await client.updateAuthOrganization({
195
+ logo: logo.trim() === "" ? void 0 : logo.trim(),
196
+ metadata: parsedMetadata,
197
+ name: name.trim() === "" ? void 0 : name.trim(),
198
+ organizationId: formatCell(org?.id),
199
+ slug: slug.trim() === "" ? void 0 : slug.trim()
200
+ });
201
+ }
202
+ onDone();
203
+ onClose();
204
+ });
205
+ };
206
+ $[9] = client;
207
+ $[10] = logo;
208
+ $[11] = metadata;
209
+ $[12] = mode;
210
+ $[13] = name;
211
+ $[14] = onClose;
212
+ $[15] = onDone;
213
+ $[16] = org?.id;
214
+ $[17] = ownerId;
215
+ $[18] = run;
216
+ $[19] = slug;
217
+ $[20] = t5;
218
+ } else {
219
+ t5 = $[20];
220
+ }
221
+ const onSubmit = t5;
222
+ let t6;
223
+ if ($[21] !== mode || $[22] !== name) {
224
+ t6 = name.trim() !== "" || mode === "edit";
225
+ $[21] = mode;
226
+ $[22] = name;
227
+ $[23] = t6;
228
+ } else {
229
+ t6 = $[23];
230
+ }
231
+ let t7;
232
+ if ($[24] !== mode || $[25] !== t) {
233
+ t7 = mode === "create" ? t("Create") : t("Save");
234
+ $[24] = mode;
235
+ $[25] = t;
236
+ $[26] = t7;
237
+ } else {
238
+ t7 = $[26];
239
+ }
240
+ let t8;
241
+ if ($[27] !== mode || $[28] !== t) {
242
+ t8 = mode === "create" ? t("New organization") : t("Edit organization");
243
+ $[27] = mode;
244
+ $[28] = t;
245
+ $[29] = t8;
246
+ } else {
247
+ t8 = $[29];
248
+ }
249
+ let t9;
250
+ if ($[30] !== t) {
251
+ t9 = t("name");
252
+ $[30] = t;
253
+ $[31] = t9;
254
+ } else {
255
+ t9 = $[31];
256
+ }
257
+ let t10;
258
+ if ($[32] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
259
+ t10 = (event) => {
260
+ setName(event.target.value);
261
+ };
262
+ $[32] = t10;
263
+ } else {
264
+ t10 = $[32];
265
+ }
266
+ let t11;
267
+ if ($[33] !== name) {
268
+ t11 = /* @__PURE__ */ jsxDEV(Input, {
269
+ "data-testid": "org-form-name",
270
+ id: "org-form-name",
271
+ onChange: t10,
272
+ value: name
273
+ }, void 0, false);
274
+ $[33] = name;
275
+ $[34] = t11;
276
+ } else {
277
+ t11 = $[34];
278
+ }
279
+ let t12;
280
+ if ($[35] !== t11 || $[36] !== t9) {
281
+ t12 = /* @__PURE__ */ jsxDEV(Field, {
282
+ htmlFor: "org-form-name",
283
+ label: t9,
284
+ children: t11
285
+ }, void 0, false);
286
+ $[35] = t11;
287
+ $[36] = t9;
288
+ $[37] = t12;
289
+ } else {
290
+ t12 = $[37];
291
+ }
292
+ let t13;
293
+ if ($[38] !== t) {
294
+ t13 = t("Slug (optional — derived from name)");
295
+ $[38] = t;
296
+ $[39] = t13;
297
+ } else {
298
+ t13 = $[39];
299
+ }
300
+ let t14;
301
+ if ($[40] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
302
+ t14 = (event_0) => {
303
+ setSlug(event_0.target.value);
304
+ };
305
+ $[40] = t14;
306
+ } else {
307
+ t14 = $[40];
308
+ }
309
+ let t15;
310
+ if ($[41] !== slug) {
311
+ t15 = /* @__PURE__ */ jsxDEV(Input, {
312
+ "data-testid": "org-form-slug",
313
+ id: "org-form-slug",
314
+ onChange: t14,
315
+ value: slug
316
+ }, void 0, false);
317
+ $[41] = slug;
318
+ $[42] = t15;
319
+ } else {
320
+ t15 = $[42];
321
+ }
322
+ let t16;
323
+ if ($[43] !== t13 || $[44] !== t15) {
324
+ t16 = /* @__PURE__ */ jsxDEV(Field, {
325
+ htmlFor: "org-form-slug",
326
+ label: t13,
327
+ children: t15
328
+ }, void 0, false);
329
+ $[43] = t13;
330
+ $[44] = t15;
331
+ $[45] = t16;
332
+ } else {
333
+ t16 = $[45];
334
+ }
335
+ let t17;
336
+ if ($[46] !== t) {
337
+ t17 = t("Logo URL (optional)");
338
+ $[46] = t;
339
+ $[47] = t17;
340
+ } else {
341
+ t17 = $[47];
342
+ }
343
+ let t18;
344
+ if ($[48] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
345
+ t18 = (event_1) => {
346
+ setLogo(event_1.target.value);
347
+ };
348
+ $[48] = t18;
349
+ } else {
350
+ t18 = $[48];
351
+ }
352
+ let t19;
353
+ if ($[49] !== logo) {
354
+ t19 = /* @__PURE__ */ jsxDEV(Input, {
355
+ "data-testid": "org-form-logo",
356
+ id: "org-form-logo",
357
+ onChange: t18,
358
+ value: logo
359
+ }, void 0, false);
360
+ $[49] = logo;
361
+ $[50] = t19;
362
+ } else {
363
+ t19 = $[50];
364
+ }
365
+ let t20;
366
+ if ($[51] !== t17 || $[52] !== t19) {
367
+ t20 = /* @__PURE__ */ jsxDEV(Field, {
368
+ htmlFor: "org-form-logo",
369
+ label: t17,
370
+ children: t19
371
+ }, void 0, false);
372
+ $[51] = t17;
373
+ $[52] = t19;
374
+ $[53] = t20;
375
+ } else {
376
+ t20 = $[53];
377
+ }
378
+ let t21;
379
+ if ($[54] !== mode || $[55] !== ownerId || $[56] !== t) {
380
+ t21 = mode === "create" && /* @__PURE__ */ jsxDEV(Field, {
381
+ htmlFor: "org-form-owner",
382
+ label: t("Owner user id (optional)"),
383
+ children: /* @__PURE__ */ jsxDEV(Input, {
384
+ "data-testid": "org-form-owner",
385
+ id: "org-form-owner",
386
+ onChange: (event_2) => {
387
+ setOwnerId(event_2.target.value);
388
+ },
389
+ value: ownerId
390
+ }, void 0, false)
391
+ }, void 0, false);
392
+ $[54] = mode;
393
+ $[55] = ownerId;
394
+ $[56] = t;
395
+ $[57] = t21;
396
+ } else {
397
+ t21 = $[57];
398
+ }
399
+ let t22;
400
+ if ($[58] !== t) {
401
+ t22 = t("Metadata (JSON, optional)");
402
+ $[58] = t;
403
+ $[59] = t22;
404
+ } else {
405
+ t22 = $[59];
406
+ }
407
+ let t23;
408
+ if ($[60] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
409
+ t23 = (event_3) => {
410
+ setMetadata(event_3.target.value);
411
+ };
412
+ $[60] = t23;
413
+ } else {
414
+ t23 = $[60];
415
+ }
416
+ let t24;
417
+ if ($[61] !== metadata) {
418
+ t24 = /* @__PURE__ */ jsxDEV(Textarea, {
419
+ "data-testid": "org-form-metadata",
420
+ id: "org-form-metadata",
421
+ onChange: t23,
422
+ value: metadata
423
+ }, void 0, false);
424
+ $[61] = metadata;
425
+ $[62] = t24;
426
+ } else {
427
+ t24 = $[62];
428
+ }
429
+ let t25;
430
+ if ($[63] !== t22 || $[64] !== t24) {
431
+ t25 = /* @__PURE__ */ jsxDEV(Field, {
432
+ htmlFor: "org-form-metadata",
433
+ label: t22,
434
+ children: t24
435
+ }, void 0, false);
436
+ $[63] = t22;
437
+ $[64] = t24;
438
+ $[65] = t25;
439
+ } else {
440
+ t25 = $[65];
441
+ }
442
+ let t26;
443
+ if ($[66] !== busy || $[67] !== error || $[68] !== onClose || $[69] !== onSubmit || $[70] !== t12 || $[71] !== t16 || $[72] !== t20 || $[73] !== t21 || $[74] !== t25 || $[75] !== t6 || $[76] !== t7 || $[77] !== t8) {
444
+ t26 = /* @__PURE__ */ jsxDEV(DialogForm, {
445
+ busy,
446
+ canSubmit: t6,
447
+ error,
448
+ onClose,
449
+ onSubmit,
450
+ submitLabel: t7,
451
+ testId: "org-form",
452
+ title: t8,
453
+ children: [t12, t16, t20, t21, t25]
454
+ }, void 0, true);
455
+ $[66] = busy;
456
+ $[67] = error;
457
+ $[68] = onClose;
458
+ $[69] = onSubmit;
459
+ $[70] = t12;
460
+ $[71] = t16;
461
+ $[72] = t20;
462
+ $[73] = t21;
463
+ $[74] = t25;
464
+ $[75] = t6;
465
+ $[76] = t7;
466
+ $[77] = t8;
467
+ $[78] = t26;
468
+ } else {
469
+ t26 = $[78];
470
+ }
471
+ return t26;
472
+ };
473
+ const MemberAddDialog = (t0) => {
474
+ const $ = c(40);
475
+ const {
476
+ onClose,
477
+ onDone,
478
+ organizationId
479
+ } = t0;
480
+ const client = useLunora();
481
+ const t = useT();
482
+ const {
483
+ busy,
484
+ error,
485
+ run
486
+ } = useAsyncSubmit();
487
+ const [userId, setUserId] = useState("");
488
+ const [role, setRole] = useState("");
489
+ let t1;
490
+ if ($[0] !== client || $[1] !== onClose || $[2] !== onDone || $[3] !== organizationId || $[4] !== role || $[5] !== run || $[6] !== userId) {
491
+ t1 = () => {
492
+ run(async () => {
493
+ await client.addAuthOrgMember({
494
+ organizationId,
495
+ role: role.trim() === "" ? void 0 : role.trim(),
496
+ userId: userId.trim()
497
+ });
498
+ onDone();
499
+ onClose();
500
+ });
501
+ };
502
+ $[0] = client;
503
+ $[1] = onClose;
504
+ $[2] = onDone;
505
+ $[3] = organizationId;
506
+ $[4] = role;
507
+ $[5] = run;
508
+ $[6] = userId;
509
+ $[7] = t1;
510
+ } else {
511
+ t1 = $[7];
512
+ }
513
+ const onSubmit = t1;
514
+ let t2;
515
+ if ($[8] !== userId) {
516
+ t2 = userId.trim();
517
+ $[8] = userId;
518
+ $[9] = t2;
519
+ } else {
520
+ t2 = $[9];
521
+ }
522
+ const t3 = t2 !== "";
523
+ let t4;
524
+ if ($[10] !== t) {
525
+ t4 = t("Add member");
526
+ $[10] = t;
527
+ $[11] = t4;
528
+ } else {
529
+ t4 = $[11];
530
+ }
531
+ let t5;
532
+ if ($[12] !== t) {
533
+ t5 = t("Add member");
534
+ $[12] = t;
535
+ $[13] = t5;
536
+ } else {
537
+ t5 = $[13];
538
+ }
539
+ let t6;
540
+ if ($[14] !== t) {
541
+ t6 = t("User id");
542
+ $[14] = t;
543
+ $[15] = t6;
544
+ } else {
545
+ t6 = $[15];
546
+ }
547
+ let t7;
548
+ if ($[16] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
549
+ t7 = (event) => {
550
+ setUserId(event.target.value);
551
+ };
552
+ $[16] = t7;
553
+ } else {
554
+ t7 = $[16];
555
+ }
556
+ let t8;
557
+ if ($[17] !== userId) {
558
+ t8 = /* @__PURE__ */ jsxDEV(Input, {
559
+ "data-testid": "org-add-member-user",
560
+ id: "org-add-member-user",
561
+ onChange: t7,
562
+ value: userId
563
+ }, void 0, false);
564
+ $[17] = userId;
565
+ $[18] = t8;
566
+ } else {
567
+ t8 = $[18];
568
+ }
569
+ let t9;
570
+ if ($[19] !== t6 || $[20] !== t8) {
571
+ t9 = /* @__PURE__ */ jsxDEV(Field, {
572
+ htmlFor: "org-add-member-user",
573
+ label: t6,
574
+ children: t8
575
+ }, void 0, false);
576
+ $[19] = t6;
577
+ $[20] = t8;
578
+ $[21] = t9;
579
+ } else {
580
+ t9 = $[21];
581
+ }
582
+ let t10;
583
+ if ($[22] !== t) {
584
+ t10 = t("Role (optional)");
585
+ $[22] = t;
586
+ $[23] = t10;
587
+ } else {
588
+ t10 = $[23];
589
+ }
590
+ let t11;
591
+ if ($[24] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
592
+ t11 = (event_0) => {
593
+ setRole(event_0.target.value);
594
+ };
595
+ $[24] = t11;
596
+ } else {
597
+ t11 = $[24];
598
+ }
599
+ let t12;
600
+ if ($[25] !== role) {
601
+ t12 = /* @__PURE__ */ jsxDEV(Input, {
602
+ "data-testid": "org-add-member-role",
603
+ id: "org-add-member-role",
604
+ onChange: t11,
605
+ value: role
606
+ }, void 0, false);
607
+ $[25] = role;
608
+ $[26] = t12;
609
+ } else {
610
+ t12 = $[26];
611
+ }
612
+ let t13;
613
+ if ($[27] !== t10 || $[28] !== t12) {
614
+ t13 = /* @__PURE__ */ jsxDEV(Field, {
615
+ htmlFor: "org-add-member-role",
616
+ label: t10,
617
+ children: t12
618
+ }, void 0, false);
619
+ $[27] = t10;
620
+ $[28] = t12;
621
+ $[29] = t13;
622
+ } else {
623
+ t13 = $[29];
624
+ }
625
+ let t14;
626
+ if ($[30] !== busy || $[31] !== error || $[32] !== onClose || $[33] !== onSubmit || $[34] !== t13 || $[35] !== t3 || $[36] !== t4 || $[37] !== t5 || $[38] !== t9) {
627
+ t14 = /* @__PURE__ */ jsxDEV(DialogForm, {
628
+ busy,
629
+ canSubmit: t3,
630
+ error,
631
+ onClose,
632
+ onSubmit,
633
+ submitLabel: t4,
634
+ testId: "org-add-member",
635
+ title: t5,
636
+ children: [t9, t13]
637
+ }, void 0, true);
638
+ $[30] = busy;
639
+ $[31] = error;
640
+ $[32] = onClose;
641
+ $[33] = onSubmit;
642
+ $[34] = t13;
643
+ $[35] = t3;
644
+ $[36] = t4;
645
+ $[37] = t5;
646
+ $[38] = t9;
647
+ $[39] = t14;
648
+ } else {
649
+ t14 = $[39];
650
+ }
651
+ return t14;
652
+ };
653
+ const MemberInviteDialog = (t0) => {
654
+ const $ = c(40);
655
+ const {
656
+ onClose,
657
+ onDone,
658
+ organizationId
659
+ } = t0;
660
+ const client = useLunora();
661
+ const t = useT();
662
+ const {
663
+ busy,
664
+ error,
665
+ run
666
+ } = useAsyncSubmit();
667
+ const [email, setEmail] = useState("");
668
+ const [role, setRole] = useState("");
669
+ let t1;
670
+ if ($[0] !== client || $[1] !== email || $[2] !== onClose || $[3] !== onDone || $[4] !== organizationId || $[5] !== role || $[6] !== run) {
671
+ t1 = () => {
672
+ run(async () => {
673
+ await client.inviteAuthOrgMember({
674
+ email: email.trim(),
675
+ organizationId,
676
+ role: role.trim() === "" ? void 0 : role.trim()
677
+ });
678
+ onDone();
679
+ onClose();
680
+ });
681
+ };
682
+ $[0] = client;
683
+ $[1] = email;
684
+ $[2] = onClose;
685
+ $[3] = onDone;
686
+ $[4] = organizationId;
687
+ $[5] = role;
688
+ $[6] = run;
689
+ $[7] = t1;
690
+ } else {
691
+ t1 = $[7];
692
+ }
693
+ const onSubmit = t1;
694
+ let t2;
695
+ if ($[8] !== email) {
696
+ t2 = email.trim();
697
+ $[8] = email;
698
+ $[9] = t2;
699
+ } else {
700
+ t2 = $[9];
701
+ }
702
+ const t3 = t2 !== "";
703
+ let t4;
704
+ if ($[10] !== t) {
705
+ t4 = t("Send invitation");
706
+ $[10] = t;
707
+ $[11] = t4;
708
+ } else {
709
+ t4 = $[11];
710
+ }
711
+ let t5;
712
+ if ($[12] !== t) {
713
+ t5 = t("Invite member");
714
+ $[12] = t;
715
+ $[13] = t5;
716
+ } else {
717
+ t5 = $[13];
718
+ }
719
+ let t6;
720
+ if ($[14] !== t) {
721
+ t6 = t("email");
722
+ $[14] = t;
723
+ $[15] = t6;
724
+ } else {
725
+ t6 = $[15];
726
+ }
727
+ let t7;
728
+ if ($[16] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
729
+ t7 = (event) => {
730
+ setEmail(event.target.value);
731
+ };
732
+ $[16] = t7;
733
+ } else {
734
+ t7 = $[16];
735
+ }
736
+ let t8;
737
+ if ($[17] !== email) {
738
+ t8 = /* @__PURE__ */ jsxDEV(Input, {
739
+ "data-testid": "org-invite-member-email",
740
+ id: "org-invite-member-email",
741
+ onChange: t7,
742
+ type: "email",
743
+ value: email
744
+ }, void 0, false);
745
+ $[17] = email;
746
+ $[18] = t8;
747
+ } else {
748
+ t8 = $[18];
749
+ }
750
+ let t9;
751
+ if ($[19] !== t6 || $[20] !== t8) {
752
+ t9 = /* @__PURE__ */ jsxDEV(Field, {
753
+ htmlFor: "org-invite-member-email",
754
+ label: t6,
755
+ children: t8
756
+ }, void 0, false);
757
+ $[19] = t6;
758
+ $[20] = t8;
759
+ $[21] = t9;
760
+ } else {
761
+ t9 = $[21];
762
+ }
763
+ let t10;
764
+ if ($[22] !== t) {
765
+ t10 = t("Role (optional)");
766
+ $[22] = t;
767
+ $[23] = t10;
768
+ } else {
769
+ t10 = $[23];
770
+ }
771
+ let t11;
772
+ if ($[24] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
773
+ t11 = (event_0) => {
774
+ setRole(event_0.target.value);
775
+ };
776
+ $[24] = t11;
777
+ } else {
778
+ t11 = $[24];
779
+ }
780
+ let t12;
781
+ if ($[25] !== role) {
782
+ t12 = /* @__PURE__ */ jsxDEV(Input, {
783
+ "data-testid": "org-invite-member-role",
784
+ id: "org-invite-member-role",
785
+ onChange: t11,
786
+ value: role
787
+ }, void 0, false);
788
+ $[25] = role;
789
+ $[26] = t12;
790
+ } else {
791
+ t12 = $[26];
792
+ }
793
+ let t13;
794
+ if ($[27] !== t10 || $[28] !== t12) {
795
+ t13 = /* @__PURE__ */ jsxDEV(Field, {
796
+ htmlFor: "org-invite-member-role",
797
+ label: t10,
798
+ children: t12
799
+ }, void 0, false);
800
+ $[27] = t10;
801
+ $[28] = t12;
802
+ $[29] = t13;
803
+ } else {
804
+ t13 = $[29];
805
+ }
806
+ let t14;
807
+ if ($[30] !== busy || $[31] !== error || $[32] !== onClose || $[33] !== onSubmit || $[34] !== t13 || $[35] !== t3 || $[36] !== t4 || $[37] !== t5 || $[38] !== t9) {
808
+ t14 = /* @__PURE__ */ jsxDEV(DialogForm, {
809
+ busy,
810
+ canSubmit: t3,
811
+ error,
812
+ onClose,
813
+ onSubmit,
814
+ submitLabel: t4,
815
+ testId: "org-invite-member",
816
+ title: t5,
817
+ children: [t9, t13]
818
+ }, void 0, true);
819
+ $[30] = busy;
820
+ $[31] = error;
821
+ $[32] = onClose;
822
+ $[33] = onSubmit;
823
+ $[34] = t13;
824
+ $[35] = t3;
825
+ $[36] = t4;
826
+ $[37] = t5;
827
+ $[38] = t9;
828
+ $[39] = t14;
829
+ } else {
830
+ t14 = $[39];
831
+ }
832
+ return t14;
833
+ };
834
+ const MemberRoleDialog = (t0) => {
835
+ const $ = c(32);
836
+ const {
837
+ member,
838
+ onClose,
839
+ onDone
840
+ } = t0;
841
+ const client = useLunora();
842
+ const t = useT();
843
+ const {
844
+ busy,
845
+ error,
846
+ run
847
+ } = useAsyncSubmit();
848
+ let t1;
849
+ if ($[0] !== member.role) {
850
+ t1 = formatCell(member.role);
851
+ $[0] = member.role;
852
+ $[1] = t1;
853
+ } else {
854
+ t1 = $[1];
855
+ }
856
+ const [role, setRole] = useState(t1);
857
+ let t2;
858
+ if ($[2] !== client || $[3] !== member.id || $[4] !== onClose || $[5] !== onDone || $[6] !== role || $[7] !== run) {
859
+ t2 = () => {
860
+ run(async () => {
861
+ await client.setAuthOrgMemberRole({
862
+ memberId: formatCell(member.id),
863
+ role: role.trim()
864
+ });
865
+ onDone();
866
+ onClose();
867
+ });
868
+ };
869
+ $[2] = client;
870
+ $[3] = member.id;
871
+ $[4] = onClose;
872
+ $[5] = onDone;
873
+ $[6] = role;
874
+ $[7] = run;
875
+ $[8] = t2;
876
+ } else {
877
+ t2 = $[8];
878
+ }
879
+ const onSubmit = t2;
880
+ let t3;
881
+ if ($[9] !== role) {
882
+ t3 = role.trim();
883
+ $[9] = role;
884
+ $[10] = t3;
885
+ } else {
886
+ t3 = $[10];
887
+ }
888
+ const t4 = t3 !== "";
889
+ let t5;
890
+ if ($[11] !== t) {
891
+ t5 = t("Save");
892
+ $[11] = t;
893
+ $[12] = t5;
894
+ } else {
895
+ t5 = $[12];
896
+ }
897
+ let t6;
898
+ if ($[13] !== t) {
899
+ t6 = t("Change member role");
900
+ $[13] = t;
901
+ $[14] = t6;
902
+ } else {
903
+ t6 = $[14];
904
+ }
905
+ let t7;
906
+ if ($[15] !== t) {
907
+ t7 = t("Role");
908
+ $[15] = t;
909
+ $[16] = t7;
910
+ } else {
911
+ t7 = $[16];
912
+ }
913
+ let t8;
914
+ if ($[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
915
+ t8 = (event) => {
916
+ setRole(event.target.value);
917
+ };
918
+ $[17] = t8;
919
+ } else {
920
+ t8 = $[17];
921
+ }
922
+ let t9;
923
+ if ($[18] !== role) {
924
+ t9 = /* @__PURE__ */ jsxDEV(Input, {
925
+ "data-testid": "org-member-role-value",
926
+ id: "org-member-role-value",
927
+ onChange: t8,
928
+ value: role
929
+ }, void 0, false);
930
+ $[18] = role;
931
+ $[19] = t9;
932
+ } else {
933
+ t9 = $[19];
934
+ }
935
+ let t10;
936
+ if ($[20] !== t7 || $[21] !== t9) {
937
+ t10 = /* @__PURE__ */ jsxDEV(Field, {
938
+ htmlFor: "org-member-role-value",
939
+ label: t7,
940
+ children: t9
941
+ }, void 0, false);
942
+ $[20] = t7;
943
+ $[21] = t9;
944
+ $[22] = t10;
945
+ } else {
946
+ t10 = $[22];
947
+ }
948
+ let t11;
949
+ if ($[23] !== busy || $[24] !== error || $[25] !== onClose || $[26] !== onSubmit || $[27] !== t10 || $[28] !== t4 || $[29] !== t5 || $[30] !== t6) {
950
+ t11 = /* @__PURE__ */ jsxDEV(DialogForm, {
951
+ busy,
952
+ canSubmit: t4,
953
+ error,
954
+ onClose,
955
+ onSubmit,
956
+ submitLabel: t5,
957
+ testId: "org-member-role",
958
+ title: t6,
959
+ children: t10
960
+ }, void 0, false);
961
+ $[23] = busy;
962
+ $[24] = error;
963
+ $[25] = onClose;
964
+ $[26] = onSubmit;
965
+ $[27] = t10;
966
+ $[28] = t4;
967
+ $[29] = t5;
968
+ $[30] = t6;
969
+ $[31] = t11;
970
+ } else {
971
+ t11 = $[31];
972
+ }
973
+ return t11;
974
+ };
975
+ const TeamFormDialog = (t0) => {
976
+ const $ = c(36);
977
+ const {
978
+ mode,
979
+ onClose,
980
+ onDone,
981
+ organizationId,
982
+ team
983
+ } = t0;
984
+ const client = useLunora();
985
+ const t = useT();
986
+ const {
987
+ busy,
988
+ error,
989
+ run
990
+ } = useAsyncSubmit();
991
+ let t1;
992
+ if ($[0] !== team) {
993
+ t1 = team ? formatCell(team.name) : "";
994
+ $[0] = team;
995
+ $[1] = t1;
996
+ } else {
997
+ t1 = $[1];
998
+ }
999
+ const [name, setName] = useState(t1);
1000
+ let t2;
1001
+ if ($[2] !== client || $[3] !== mode || $[4] !== name || $[5] !== onClose || $[6] !== onDone || $[7] !== organizationId || $[8] !== run || $[9] !== team?.id) {
1002
+ t2 = () => {
1003
+ run(async () => {
1004
+ await (mode === "create" ? client.createAuthOrgTeam({
1005
+ name: name.trim(),
1006
+ organizationId
1007
+ }) : client.updateAuthOrgTeam({
1008
+ name: name.trim(),
1009
+ teamId: formatCell(team?.id)
1010
+ }));
1011
+ onDone();
1012
+ onClose();
1013
+ });
1014
+ };
1015
+ $[2] = client;
1016
+ $[3] = mode;
1017
+ $[4] = name;
1018
+ $[5] = onClose;
1019
+ $[6] = onDone;
1020
+ $[7] = organizationId;
1021
+ $[8] = run;
1022
+ $[9] = team?.id;
1023
+ $[10] = t2;
1024
+ } else {
1025
+ t2 = $[10];
1026
+ }
1027
+ const onSubmit = t2;
1028
+ let t3;
1029
+ if ($[11] !== name) {
1030
+ t3 = name.trim();
1031
+ $[11] = name;
1032
+ $[12] = t3;
1033
+ } else {
1034
+ t3 = $[12];
1035
+ }
1036
+ const t4 = t3 !== "";
1037
+ let t5;
1038
+ if ($[13] !== mode || $[14] !== t) {
1039
+ t5 = mode === "create" ? t("Create") : t("Save");
1040
+ $[13] = mode;
1041
+ $[14] = t;
1042
+ $[15] = t5;
1043
+ } else {
1044
+ t5 = $[15];
1045
+ }
1046
+ let t6;
1047
+ if ($[16] !== mode || $[17] !== t) {
1048
+ t6 = mode === "create" ? t("New team") : t("Rename team");
1049
+ $[16] = mode;
1050
+ $[17] = t;
1051
+ $[18] = t6;
1052
+ } else {
1053
+ t6 = $[18];
1054
+ }
1055
+ let t7;
1056
+ if ($[19] !== t) {
1057
+ t7 = t("name");
1058
+ $[19] = t;
1059
+ $[20] = t7;
1060
+ } else {
1061
+ t7 = $[20];
1062
+ }
1063
+ let t8;
1064
+ if ($[21] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1065
+ t8 = (event) => {
1066
+ setName(event.target.value);
1067
+ };
1068
+ $[21] = t8;
1069
+ } else {
1070
+ t8 = $[21];
1071
+ }
1072
+ let t9;
1073
+ if ($[22] !== name) {
1074
+ t9 = /* @__PURE__ */ jsxDEV(Input, {
1075
+ "data-testid": "org-team-form-name",
1076
+ id: "org-team-form-name",
1077
+ onChange: t8,
1078
+ value: name
1079
+ }, void 0, false);
1080
+ $[22] = name;
1081
+ $[23] = t9;
1082
+ } else {
1083
+ t9 = $[23];
1084
+ }
1085
+ let t10;
1086
+ if ($[24] !== t7 || $[25] !== t9) {
1087
+ t10 = /* @__PURE__ */ jsxDEV(Field, {
1088
+ htmlFor: "org-team-form-name",
1089
+ label: t7,
1090
+ children: t9
1091
+ }, void 0, false);
1092
+ $[24] = t7;
1093
+ $[25] = t9;
1094
+ $[26] = t10;
1095
+ } else {
1096
+ t10 = $[26];
1097
+ }
1098
+ let t11;
1099
+ if ($[27] !== busy || $[28] !== error || $[29] !== onClose || $[30] !== onSubmit || $[31] !== t10 || $[32] !== t4 || $[33] !== t5 || $[34] !== t6) {
1100
+ t11 = /* @__PURE__ */ jsxDEV(DialogForm, {
1101
+ busy,
1102
+ canSubmit: t4,
1103
+ error,
1104
+ onClose,
1105
+ onSubmit,
1106
+ submitLabel: t5,
1107
+ testId: "org-team-form",
1108
+ title: t6,
1109
+ children: t10
1110
+ }, void 0, false);
1111
+ $[27] = busy;
1112
+ $[28] = error;
1113
+ $[29] = onClose;
1114
+ $[30] = onSubmit;
1115
+ $[31] = t10;
1116
+ $[32] = t4;
1117
+ $[33] = t5;
1118
+ $[34] = t6;
1119
+ $[35] = t11;
1120
+ } else {
1121
+ t11 = $[35];
1122
+ }
1123
+ return t11;
1124
+ };
1125
+ const TeamMemberAddDialog = (t0) => {
1126
+ const $ = c(30);
1127
+ const {
1128
+ onClose,
1129
+ onDone,
1130
+ teamId
1131
+ } = t0;
1132
+ const client = useLunora();
1133
+ const t = useT();
1134
+ const {
1135
+ busy,
1136
+ error,
1137
+ run
1138
+ } = useAsyncSubmit();
1139
+ const [userId, setUserId] = useState("");
1140
+ let t1;
1141
+ if ($[0] !== client || $[1] !== onClose || $[2] !== onDone || $[3] !== run || $[4] !== teamId || $[5] !== userId) {
1142
+ t1 = () => {
1143
+ run(async () => {
1144
+ await client.addAuthOrgTeamMember({
1145
+ teamId,
1146
+ userId: userId.trim()
1147
+ });
1148
+ onDone();
1149
+ onClose();
1150
+ });
1151
+ };
1152
+ $[0] = client;
1153
+ $[1] = onClose;
1154
+ $[2] = onDone;
1155
+ $[3] = run;
1156
+ $[4] = teamId;
1157
+ $[5] = userId;
1158
+ $[6] = t1;
1159
+ } else {
1160
+ t1 = $[6];
1161
+ }
1162
+ const onSubmit = t1;
1163
+ let t2;
1164
+ if ($[7] !== userId) {
1165
+ t2 = userId.trim();
1166
+ $[7] = userId;
1167
+ $[8] = t2;
1168
+ } else {
1169
+ t2 = $[8];
1170
+ }
1171
+ const t3 = t2 !== "";
1172
+ let t4;
1173
+ if ($[9] !== t) {
1174
+ t4 = t("Add member");
1175
+ $[9] = t;
1176
+ $[10] = t4;
1177
+ } else {
1178
+ t4 = $[10];
1179
+ }
1180
+ let t5;
1181
+ if ($[11] !== t) {
1182
+ t5 = t("Add team member");
1183
+ $[11] = t;
1184
+ $[12] = t5;
1185
+ } else {
1186
+ t5 = $[12];
1187
+ }
1188
+ let t6;
1189
+ if ($[13] !== t) {
1190
+ t6 = t("User id");
1191
+ $[13] = t;
1192
+ $[14] = t6;
1193
+ } else {
1194
+ t6 = $[14];
1195
+ }
1196
+ let t7;
1197
+ if ($[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1198
+ t7 = (event) => {
1199
+ setUserId(event.target.value);
1200
+ };
1201
+ $[15] = t7;
1202
+ } else {
1203
+ t7 = $[15];
1204
+ }
1205
+ let t8;
1206
+ if ($[16] !== userId) {
1207
+ t8 = /* @__PURE__ */ jsxDEV(Input, {
1208
+ "data-testid": "org-team-add-member-user",
1209
+ id: "org-team-add-member-user",
1210
+ onChange: t7,
1211
+ value: userId
1212
+ }, void 0, false);
1213
+ $[16] = userId;
1214
+ $[17] = t8;
1215
+ } else {
1216
+ t8 = $[17];
1217
+ }
1218
+ let t9;
1219
+ if ($[18] !== t6 || $[19] !== t8) {
1220
+ t9 = /* @__PURE__ */ jsxDEV(Field, {
1221
+ htmlFor: "org-team-add-member-user",
1222
+ label: t6,
1223
+ children: t8
1224
+ }, void 0, false);
1225
+ $[18] = t6;
1226
+ $[19] = t8;
1227
+ $[20] = t9;
1228
+ } else {
1229
+ t9 = $[20];
1230
+ }
1231
+ let t10;
1232
+ if ($[21] !== busy || $[22] !== error || $[23] !== onClose || $[24] !== onSubmit || $[25] !== t3 || $[26] !== t4 || $[27] !== t5 || $[28] !== t9) {
1233
+ t10 = /* @__PURE__ */ jsxDEV(DialogForm, {
1234
+ busy,
1235
+ canSubmit: t3,
1236
+ error,
1237
+ onClose,
1238
+ onSubmit,
1239
+ submitLabel: t4,
1240
+ testId: "org-team-add-member",
1241
+ title: t5,
1242
+ children: t9
1243
+ }, void 0, false);
1244
+ $[21] = busy;
1245
+ $[22] = error;
1246
+ $[23] = onClose;
1247
+ $[24] = onSubmit;
1248
+ $[25] = t3;
1249
+ $[26] = t4;
1250
+ $[27] = t5;
1251
+ $[28] = t9;
1252
+ $[29] = t10;
1253
+ } else {
1254
+ t10 = $[29];
1255
+ }
1256
+ return t10;
1257
+ };
1258
+ const RoleFormDialog = (t0) => {
1259
+ const $ = c(47);
1260
+ const {
1261
+ mode,
1262
+ onClose,
1263
+ onDone,
1264
+ organizationId,
1265
+ role
1266
+ } = t0;
1267
+ const client = useLunora();
1268
+ const t = useT();
1269
+ const {
1270
+ busy,
1271
+ error,
1272
+ run
1273
+ } = useAsyncSubmit();
1274
+ let t1;
1275
+ if ($[0] !== role) {
1276
+ t1 = role ? formatCell(role.role) : "";
1277
+ $[0] = role;
1278
+ $[1] = t1;
1279
+ } else {
1280
+ t1 = $[1];
1281
+ }
1282
+ const [name, setName] = useState(t1);
1283
+ let t2;
1284
+ if ($[2] !== mode || $[3] !== role?.permission) {
1285
+ t2 = mode === "edit" ? jsonInitial(role?.permission) : "";
1286
+ $[2] = mode;
1287
+ $[3] = role?.permission;
1288
+ $[4] = t2;
1289
+ } else {
1290
+ t2 = $[4];
1291
+ }
1292
+ const [permission, setPermission] = useState(t2);
1293
+ let t3;
1294
+ if ($[5] !== client || $[6] !== mode || $[7] !== name || $[8] !== onClose || $[9] !== onDone || $[10] !== organizationId || $[11] !== permission || $[12] !== role?.id || $[13] !== run) {
1295
+ t3 = () => {
1296
+ run(async () => {
1297
+ const grant = parsePermission(permission);
1298
+ await (mode === "create" ? client.createAuthOrgRole({
1299
+ organizationId,
1300
+ permission: grant,
1301
+ role: name.trim()
1302
+ }) : client.updateAuthOrgRole({
1303
+ permission: grant,
1304
+ roleId: formatCell(role?.id)
1305
+ }));
1306
+ onDone();
1307
+ onClose();
1308
+ });
1309
+ };
1310
+ $[5] = client;
1311
+ $[6] = mode;
1312
+ $[7] = name;
1313
+ $[8] = onClose;
1314
+ $[9] = onDone;
1315
+ $[10] = organizationId;
1316
+ $[11] = permission;
1317
+ $[12] = role?.id;
1318
+ $[13] = run;
1319
+ $[14] = t3;
1320
+ } else {
1321
+ t3 = $[14];
1322
+ }
1323
+ const onSubmit = t3;
1324
+ let t4;
1325
+ if ($[15] !== mode || $[16] !== name || $[17] !== permission) {
1326
+ t4 = permission.trim() !== "" && (mode === "edit" || name.trim() !== "");
1327
+ $[15] = mode;
1328
+ $[16] = name;
1329
+ $[17] = permission;
1330
+ $[18] = t4;
1331
+ } else {
1332
+ t4 = $[18];
1333
+ }
1334
+ let t5;
1335
+ if ($[19] !== mode || $[20] !== t) {
1336
+ t5 = mode === "create" ? t("Create") : t("Save");
1337
+ $[19] = mode;
1338
+ $[20] = t;
1339
+ $[21] = t5;
1340
+ } else {
1341
+ t5 = $[21];
1342
+ }
1343
+ let t6;
1344
+ if ($[22] !== mode || $[23] !== t) {
1345
+ t6 = mode === "create" ? t("New role") : t("Edit role");
1346
+ $[22] = mode;
1347
+ $[23] = t;
1348
+ $[24] = t6;
1349
+ } else {
1350
+ t6 = $[24];
1351
+ }
1352
+ let t7;
1353
+ if ($[25] !== mode || $[26] !== name || $[27] !== t) {
1354
+ t7 = mode === "create" && /* @__PURE__ */ jsxDEV(Field, {
1355
+ htmlFor: "org-role-form-name",
1356
+ label: t("Role name"),
1357
+ children: /* @__PURE__ */ jsxDEV(Input, {
1358
+ "data-testid": "org-role-form-name",
1359
+ id: "org-role-form-name",
1360
+ onChange: (event) => {
1361
+ setName(event.target.value);
1362
+ },
1363
+ value: name
1364
+ }, void 0, false)
1365
+ }, void 0, false);
1366
+ $[25] = mode;
1367
+ $[26] = name;
1368
+ $[27] = t;
1369
+ $[28] = t7;
1370
+ } else {
1371
+ t7 = $[28];
1372
+ }
1373
+ let t8;
1374
+ if ($[29] !== t) {
1375
+ t8 = t('Permission (JSON, e.g. {"project":["create","update"]})');
1376
+ $[29] = t;
1377
+ $[30] = t8;
1378
+ } else {
1379
+ t8 = $[30];
1380
+ }
1381
+ let t9;
1382
+ if ($[31] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1383
+ t9 = (event_0) => {
1384
+ setPermission(event_0.target.value);
1385
+ };
1386
+ $[31] = t9;
1387
+ } else {
1388
+ t9 = $[31];
1389
+ }
1390
+ let t10;
1391
+ if ($[32] !== permission) {
1392
+ t10 = /* @__PURE__ */ jsxDEV(Textarea, {
1393
+ "data-testid": "org-role-form-permission",
1394
+ id: "org-role-form-permission",
1395
+ onChange: t9,
1396
+ value: permission
1397
+ }, void 0, false);
1398
+ $[32] = permission;
1399
+ $[33] = t10;
1400
+ } else {
1401
+ t10 = $[33];
1402
+ }
1403
+ let t11;
1404
+ if ($[34] !== t10 || $[35] !== t8) {
1405
+ t11 = /* @__PURE__ */ jsxDEV(Field, {
1406
+ htmlFor: "org-role-form-permission",
1407
+ label: t8,
1408
+ children: t10
1409
+ }, void 0, false);
1410
+ $[34] = t10;
1411
+ $[35] = t8;
1412
+ $[36] = t11;
1413
+ } else {
1414
+ t11 = $[36];
1415
+ }
1416
+ let t12;
1417
+ if ($[37] !== busy || $[38] !== error || $[39] !== onClose || $[40] !== onSubmit || $[41] !== t11 || $[42] !== t4 || $[43] !== t5 || $[44] !== t6 || $[45] !== t7) {
1418
+ t12 = /* @__PURE__ */ jsxDEV(DialogForm, {
1419
+ busy,
1420
+ canSubmit: t4,
1421
+ error,
1422
+ onClose,
1423
+ onSubmit,
1424
+ submitLabel: t5,
1425
+ testId: "org-role-form",
1426
+ title: t6,
1427
+ children: [t7, t11]
1428
+ }, void 0, true);
1429
+ $[37] = busy;
1430
+ $[38] = error;
1431
+ $[39] = onClose;
1432
+ $[40] = onSubmit;
1433
+ $[41] = t11;
1434
+ $[42] = t4;
1435
+ $[43] = t5;
1436
+ $[44] = t6;
1437
+ $[45] = t7;
1438
+ $[46] = t12;
1439
+ } else {
1440
+ t12 = $[46];
1441
+ }
1442
+ return t12;
1443
+ };
1444
+ const ConfirmDialog = (t0) => {
1445
+ const $ = c(18);
1446
+ const {
1447
+ action,
1448
+ message,
1449
+ onClose,
1450
+ onDone,
1451
+ testId,
1452
+ title
1453
+ } = t0;
1454
+ const t = useT();
1455
+ const {
1456
+ busy,
1457
+ error,
1458
+ run
1459
+ } = useAsyncSubmit();
1460
+ let t1;
1461
+ if ($[0] !== action || $[1] !== onClose || $[2] !== onDone || $[3] !== run) {
1462
+ t1 = () => {
1463
+ run(async () => {
1464
+ await action();
1465
+ onDone();
1466
+ onClose();
1467
+ });
1468
+ };
1469
+ $[0] = action;
1470
+ $[1] = onClose;
1471
+ $[2] = onDone;
1472
+ $[3] = run;
1473
+ $[4] = t1;
1474
+ } else {
1475
+ t1 = $[4];
1476
+ }
1477
+ const onSubmit = t1;
1478
+ let t2;
1479
+ if ($[5] !== t) {
1480
+ t2 = t("Delete");
1481
+ $[5] = t;
1482
+ $[6] = t2;
1483
+ } else {
1484
+ t2 = $[6];
1485
+ }
1486
+ let t3;
1487
+ if ($[7] !== message) {
1488
+ t3 = /* @__PURE__ */ jsxDEV("p", {
1489
+ className: "text-sm text-muted-foreground",
1490
+ children: message
1491
+ }, void 0, false);
1492
+ $[7] = message;
1493
+ $[8] = t3;
1494
+ } else {
1495
+ t3 = $[8];
1496
+ }
1497
+ let t4;
1498
+ if ($[9] !== busy || $[10] !== error || $[11] !== onClose || $[12] !== onSubmit || $[13] !== t2 || $[14] !== t3 || $[15] !== testId || $[16] !== title) {
1499
+ t4 = /* @__PURE__ */ jsxDEV(DialogForm, {
1500
+ busy,
1501
+ canSubmit: true,
1502
+ destructive: true,
1503
+ error,
1504
+ onClose,
1505
+ onSubmit,
1506
+ submitLabel: t2,
1507
+ testId,
1508
+ title,
1509
+ children: t3
1510
+ }, void 0, false);
1511
+ $[9] = busy;
1512
+ $[10] = error;
1513
+ $[11] = onClose;
1514
+ $[12] = onSubmit;
1515
+ $[13] = t2;
1516
+ $[14] = t3;
1517
+ $[15] = testId;
1518
+ $[16] = title;
1519
+ $[17] = t4;
1520
+ } else {
1521
+ t4 = $[17];
1522
+ }
1523
+ return t4;
1524
+ };
1525
+
1526
+ const SectionCard = (t0) => {
1527
+ const $ = c(13);
1528
+ const {
1529
+ action,
1530
+ children,
1531
+ heading,
1532
+ testId
1533
+ } = t0;
1534
+ let t1;
1535
+ if ($[0] !== heading) {
1536
+ t1 = /* @__PURE__ */ jsxDEV("span", {
1537
+ className: "font-mono text-[11px] tracking-wide text-muted-foreground uppercase",
1538
+ children: heading
1539
+ }, void 0, false);
1540
+ $[0] = heading;
1541
+ $[1] = t1;
1542
+ } else {
1543
+ t1 = $[1];
1544
+ }
1545
+ let t2;
1546
+ if ($[2] !== action) {
1547
+ t2 = action !== void 0 && /* @__PURE__ */ jsxDEV("div", {
1548
+ className: "flex items-center gap-2",
1549
+ children: action
1550
+ }, void 0, false);
1551
+ $[2] = action;
1552
+ $[3] = t2;
1553
+ } else {
1554
+ t2 = $[3];
1555
+ }
1556
+ let t3;
1557
+ if ($[4] !== t1 || $[5] !== t2) {
1558
+ t3 = /* @__PURE__ */ jsxDEV("header", {
1559
+ className: "flex items-center justify-between gap-2 border-b border-border px-4 py-3",
1560
+ children: [t1, t2]
1561
+ }, void 0, true);
1562
+ $[4] = t1;
1563
+ $[5] = t2;
1564
+ $[6] = t3;
1565
+ } else {
1566
+ t3 = $[6];
1567
+ }
1568
+ let t4;
1569
+ if ($[7] !== children) {
1570
+ t4 = /* @__PURE__ */ jsxDEV(CardContent, {
1571
+ className: "px-0",
1572
+ children
1573
+ }, void 0, false);
1574
+ $[7] = children;
1575
+ $[8] = t4;
1576
+ } else {
1577
+ t4 = $[8];
1578
+ }
1579
+ let t5;
1580
+ if ($[9] !== t3 || $[10] !== t4 || $[11] !== testId) {
1581
+ t5 = /* @__PURE__ */ jsxDEV(Card, {
1582
+ className: "overflow-hidden py-0",
1583
+ "data-testid": testId,
1584
+ children: [t3, t4]
1585
+ }, void 0, true);
1586
+ $[9] = t3;
1587
+ $[10] = t4;
1588
+ $[11] = testId;
1589
+ $[12] = t5;
1590
+ } else {
1591
+ t5 = $[12];
1592
+ }
1593
+ return t5;
1594
+ };
1595
+ const ManagedTable = (t0) => {
1596
+ const $ = c(23);
1597
+ const {
1598
+ columns,
1599
+ rowActions,
1600
+ rowPrefix,
1601
+ rows
1602
+ } = t0;
1603
+ const t = useT();
1604
+ let t1;
1605
+ if ($[0] !== columns) {
1606
+ t1 = columns.map(_temp);
1607
+ $[0] = columns;
1608
+ $[1] = t1;
1609
+ } else {
1610
+ t1 = $[1];
1611
+ }
1612
+ let t2;
1613
+ if ($[2] !== t) {
1614
+ t2 = t("Actions");
1615
+ $[2] = t;
1616
+ $[3] = t2;
1617
+ } else {
1618
+ t2 = $[3];
1619
+ }
1620
+ let t3;
1621
+ if ($[4] !== t2) {
1622
+ t3 = /* @__PURE__ */ jsxDEV(TableHead, {
1623
+ "aria-label": t2
1624
+ }, void 0, false);
1625
+ $[4] = t2;
1626
+ $[5] = t3;
1627
+ } else {
1628
+ t3 = $[5];
1629
+ }
1630
+ let t4;
1631
+ if ($[6] !== t1 || $[7] !== t3) {
1632
+ t4 = /* @__PURE__ */ jsxDEV(TableHeader, {
1633
+ children: /* @__PURE__ */ jsxDEV(TableRow, {
1634
+ children: [t1, t3]
1635
+ }, void 0, true)
1636
+ }, void 0, false);
1637
+ $[6] = t1;
1638
+ $[7] = t3;
1639
+ $[8] = t4;
1640
+ } else {
1641
+ t4 = $[8];
1642
+ }
1643
+ let t5;
1644
+ if ($[9] !== columns || $[10] !== rowActions || $[11] !== rowPrefix || $[12] !== rows) {
1645
+ let t62;
1646
+ if ($[14] !== columns || $[15] !== rowActions || $[16] !== rowPrefix) {
1647
+ t62 = (row) => {
1648
+ const id = formatCell(row.id);
1649
+ return /* @__PURE__ */ jsxDEV(TableRow, {
1650
+ "data-testid": `${rowPrefix}-${id}`,
1651
+ children: [columns.map((column_0) => /* @__PURE__ */ jsxDEV(TableCell, {
1652
+ className: column_0.className,
1653
+ children: column_0.render(row)
1654
+ }, column_0.head, false)), /* @__PURE__ */ jsxDEV(TableCell, {
1655
+ children: /* @__PURE__ */ jsxDEV("div", {
1656
+ className: "flex justify-end gap-1",
1657
+ children: rowActions(row)
1658
+ }, void 0, false)
1659
+ }, void 0, false)]
1660
+ }, id, true);
1661
+ };
1662
+ $[14] = columns;
1663
+ $[15] = rowActions;
1664
+ $[16] = rowPrefix;
1665
+ $[17] = t62;
1666
+ } else {
1667
+ t62 = $[17];
1668
+ }
1669
+ t5 = rows.map(t62);
1670
+ $[9] = columns;
1671
+ $[10] = rowActions;
1672
+ $[11] = rowPrefix;
1673
+ $[12] = rows;
1674
+ $[13] = t5;
1675
+ } else {
1676
+ t5 = $[13];
1677
+ }
1678
+ let t6;
1679
+ if ($[18] !== t5) {
1680
+ t6 = /* @__PURE__ */ jsxDEV(TableBody, {
1681
+ children: t5
1682
+ }, void 0, false);
1683
+ $[18] = t5;
1684
+ $[19] = t6;
1685
+ } else {
1686
+ t6 = $[19];
1687
+ }
1688
+ let t7;
1689
+ if ($[20] !== t4 || $[21] !== t6) {
1690
+ t7 = /* @__PURE__ */ jsxDEV(Table, {
1691
+ children: [t4, t6]
1692
+ }, void 0, true);
1693
+ $[20] = t4;
1694
+ $[21] = t6;
1695
+ $[22] = t7;
1696
+ } else {
1697
+ t7 = $[22];
1698
+ }
1699
+ return t7;
1700
+ };
1701
+ const OrganizationDetail = (t0) => {
1702
+ const $ = c(213);
1703
+ const {
1704
+ organizationId,
1705
+ rolesEnabled,
1706
+ teamsEnabled
1707
+ } = t0;
1708
+ const client = useLunora();
1709
+ const t = useT();
1710
+ const [dialog, setDialog] = useState(null);
1711
+ const [selectedTeam, setSelectedTeam] = useState(null);
1712
+ let t1;
1713
+ if ($[0] !== organizationId) {
1714
+ t1 = ["lunora-auth-org-members", organizationId];
1715
+ $[0] = organizationId;
1716
+ $[1] = t1;
1717
+ } else {
1718
+ t1 = $[1];
1719
+ }
1720
+ let t2;
1721
+ if ($[2] !== client || $[3] !== organizationId) {
1722
+ t2 = () => client.listAuthOrgMembers({
1723
+ limit: 200,
1724
+ organizationId
1725
+ });
1726
+ $[2] = client;
1727
+ $[3] = organizationId;
1728
+ $[4] = t2;
1729
+ } else {
1730
+ t2 = $[4];
1731
+ }
1732
+ const membersQuery = useClientQuery(t1, t2);
1733
+ let t3;
1734
+ if ($[5] !== organizationId) {
1735
+ t3 = ["lunora-auth-org-invitations", organizationId];
1736
+ $[5] = organizationId;
1737
+ $[6] = t3;
1738
+ } else {
1739
+ t3 = $[6];
1740
+ }
1741
+ let t4;
1742
+ if ($[7] !== client || $[8] !== organizationId) {
1743
+ t4 = () => client.listAuthOrgInvitations({
1744
+ limit: 200,
1745
+ organizationId
1746
+ });
1747
+ $[7] = client;
1748
+ $[8] = organizationId;
1749
+ $[9] = t4;
1750
+ } else {
1751
+ t4 = $[9];
1752
+ }
1753
+ const invitationsQuery = useClientQuery(t3, t4);
1754
+ let t5;
1755
+ if ($[10] !== organizationId) {
1756
+ t5 = ["lunora-auth-org-teams", organizationId];
1757
+ $[10] = organizationId;
1758
+ $[11] = t5;
1759
+ } else {
1760
+ t5 = $[11];
1761
+ }
1762
+ let t6;
1763
+ if ($[12] !== client || $[13] !== organizationId) {
1764
+ t6 = () => client.listAuthOrgTeams({
1765
+ limit: 200,
1766
+ organizationId
1767
+ });
1768
+ $[12] = client;
1769
+ $[13] = organizationId;
1770
+ $[14] = t6;
1771
+ } else {
1772
+ t6 = $[14];
1773
+ }
1774
+ let t7;
1775
+ if ($[15] !== teamsEnabled) {
1776
+ t7 = {
1777
+ enabled: teamsEnabled
1778
+ };
1779
+ $[15] = teamsEnabled;
1780
+ $[16] = t7;
1781
+ } else {
1782
+ t7 = $[16];
1783
+ }
1784
+ const teamsQuery = useClientQuery(t5, t6, t7);
1785
+ let t8;
1786
+ if ($[17] !== organizationId) {
1787
+ t8 = ["lunora-auth-org-roles", organizationId];
1788
+ $[17] = organizationId;
1789
+ $[18] = t8;
1790
+ } else {
1791
+ t8 = $[18];
1792
+ }
1793
+ let t9;
1794
+ if ($[19] !== client || $[20] !== organizationId) {
1795
+ t9 = () => client.listAuthOrgRoles({
1796
+ limit: 200,
1797
+ organizationId
1798
+ });
1799
+ $[19] = client;
1800
+ $[20] = organizationId;
1801
+ $[21] = t9;
1802
+ } else {
1803
+ t9 = $[21];
1804
+ }
1805
+ let t10;
1806
+ if ($[22] !== rolesEnabled) {
1807
+ t10 = {
1808
+ enabled: rolesEnabled
1809
+ };
1810
+ $[22] = rolesEnabled;
1811
+ $[23] = t10;
1812
+ } else {
1813
+ t10 = $[23];
1814
+ }
1815
+ const rolesQuery = useClientQuery(t8, t9, t10);
1816
+ let t11;
1817
+ if ($[24] !== selectedTeam) {
1818
+ t11 = ["lunora-auth-org-team-members", selectedTeam];
1819
+ $[24] = selectedTeam;
1820
+ $[25] = t11;
1821
+ } else {
1822
+ t11 = $[25];
1823
+ }
1824
+ let t12;
1825
+ if ($[26] !== client || $[27] !== selectedTeam) {
1826
+ t12 = () => client.listAuthOrgTeamMembers({
1827
+ limit: 200,
1828
+ teamId: selectedTeam ?? ""
1829
+ });
1830
+ $[26] = client;
1831
+ $[27] = selectedTeam;
1832
+ $[28] = t12;
1833
+ } else {
1834
+ t12 = $[28];
1835
+ }
1836
+ const t13 = selectedTeam !== null;
1837
+ let t14;
1838
+ if ($[29] !== t13) {
1839
+ t14 = {
1840
+ enabled: t13
1841
+ };
1842
+ $[29] = t13;
1843
+ $[30] = t14;
1844
+ } else {
1845
+ t14 = $[30];
1846
+ }
1847
+ const teamMembersQuery = useClientQuery(t11, t12, t14);
1848
+ let t15;
1849
+ if ($[31] !== membersQuery.data?.rows) {
1850
+ t15 = membersQuery.data?.rows ?? [];
1851
+ $[31] = membersQuery.data?.rows;
1852
+ $[32] = t15;
1853
+ } else {
1854
+ t15 = $[32];
1855
+ }
1856
+ const members = t15;
1857
+ let t16;
1858
+ if ($[33] !== invitationsQuery.data?.rows) {
1859
+ t16 = invitationsQuery.data?.rows ?? [];
1860
+ $[33] = invitationsQuery.data?.rows;
1861
+ $[34] = t16;
1862
+ } else {
1863
+ t16 = $[34];
1864
+ }
1865
+ const invitations = t16;
1866
+ let t17;
1867
+ if ($[35] !== teamsQuery.data?.rows) {
1868
+ t17 = teamsQuery.data?.rows ?? [];
1869
+ $[35] = teamsQuery.data?.rows;
1870
+ $[36] = t17;
1871
+ } else {
1872
+ t17 = $[36];
1873
+ }
1874
+ const teams = t17;
1875
+ let t18;
1876
+ if ($[37] !== rolesQuery.data?.rows) {
1877
+ t18 = rolesQuery.data?.rows ?? [];
1878
+ $[37] = rolesQuery.data?.rows;
1879
+ $[38] = t18;
1880
+ } else {
1881
+ t18 = $[38];
1882
+ }
1883
+ const roles = t18;
1884
+ let t19;
1885
+ if ($[39] !== selectedTeam || $[40] !== teamMembersQuery) {
1886
+ t19 = selectedTeam === null ? [] : teamMembersQuery.data?.rows ?? [];
1887
+ $[39] = selectedTeam;
1888
+ $[40] = teamMembersQuery;
1889
+ $[41] = t19;
1890
+ } else {
1891
+ t19 = $[41];
1892
+ }
1893
+ const teamMembers = t19;
1894
+ const error = membersQuery.error ?? invitationsQuery.error ?? teamsQuery.error ?? rolesQuery.error ?? teamMembersQuery.error;
1895
+ let t20;
1896
+ if ($[42] !== invitationsQuery || $[43] !== membersQuery || $[44] !== rolesEnabled || $[45] !== rolesQuery || $[46] !== selectedTeam || $[47] !== teamMembersQuery || $[48] !== teamsEnabled || $[49] !== teamsQuery) {
1897
+ t20 = () => {
1898
+ membersQuery.refetch();
1899
+ invitationsQuery.refetch();
1900
+ if (teamsEnabled) {
1901
+ teamsQuery.refetch();
1902
+ }
1903
+ if (rolesEnabled) {
1904
+ rolesQuery.refetch();
1905
+ }
1906
+ if (selectedTeam !== null) {
1907
+ teamMembersQuery.refetch();
1908
+ }
1909
+ };
1910
+ $[42] = invitationsQuery;
1911
+ $[43] = membersQuery;
1912
+ $[44] = rolesEnabled;
1913
+ $[45] = rolesQuery;
1914
+ $[46] = selectedTeam;
1915
+ $[47] = teamMembersQuery;
1916
+ $[48] = teamsEnabled;
1917
+ $[49] = teamsQuery;
1918
+ $[50] = t20;
1919
+ } else {
1920
+ t20 = $[50];
1921
+ }
1922
+ const refetchAll = t20;
1923
+ useAutoRefresh(refetchAll, true);
1924
+ let t21;
1925
+ if ($[51] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1926
+ t21 = () => {
1927
+ setDialog(null);
1928
+ };
1929
+ $[51] = t21;
1930
+ } else {
1931
+ t21 = $[51];
1932
+ }
1933
+ const closeDialog = t21;
1934
+ let t22;
1935
+ if ($[52] !== refetchAll) {
1936
+ t22 = (action) => {
1937
+ fireAndForget((async () => {
1938
+ await action();
1939
+ refetchAll();
1940
+ })());
1941
+ };
1942
+ $[52] = refetchAll;
1943
+ $[53] = t22;
1944
+ } else {
1945
+ t22 = $[53];
1946
+ }
1947
+ const runAction = t22;
1948
+ let t23;
1949
+ if ($[54] !== client || $[55] !== t) {
1950
+ t23 = (row) => {
1951
+ const teamId = formatCell(row.id);
1952
+ setDialog({
1953
+ action: async () => {
1954
+ await client.removeAuthOrgTeam({
1955
+ teamId
1956
+ });
1957
+ setSelectedTeam((current) => current === teamId ? null : current);
1958
+ },
1959
+ kind: "confirm",
1960
+ message: t("Delete this team and its memberships? This cannot be undone."),
1961
+ testId: "org-team-delete",
1962
+ title: t("Delete team")
1963
+ });
1964
+ };
1965
+ $[54] = client;
1966
+ $[55] = t;
1967
+ $[56] = t23;
1968
+ } else {
1969
+ t23 = $[56];
1970
+ }
1971
+ const confirmDeleteTeam = t23;
1972
+ let t24;
1973
+ if ($[57] !== t) {
1974
+ t24 = t("userId");
1975
+ $[57] = t;
1976
+ $[58] = t24;
1977
+ } else {
1978
+ t24 = $[58];
1979
+ }
1980
+ let t25;
1981
+ if ($[59] !== t24) {
1982
+ t25 = {
1983
+ head: t24,
1984
+ render: _temp2
1985
+ };
1986
+ $[59] = t24;
1987
+ $[60] = t25;
1988
+ } else {
1989
+ t25 = $[60];
1990
+ }
1991
+ let t26;
1992
+ if ($[61] !== t) {
1993
+ t26 = t("role");
1994
+ $[61] = t;
1995
+ $[62] = t26;
1996
+ } else {
1997
+ t26 = $[62];
1998
+ }
1999
+ let t27;
2000
+ if ($[63] !== t26) {
2001
+ t27 = {
2002
+ head: t26,
2003
+ render: _temp3
2004
+ };
2005
+ $[63] = t26;
2006
+ $[64] = t27;
2007
+ } else {
2008
+ t27 = $[64];
2009
+ }
2010
+ let t28;
2011
+ if ($[65] !== t25 || $[66] !== t27) {
2012
+ t28 = [t25, t27];
2013
+ $[65] = t25;
2014
+ $[66] = t27;
2015
+ $[67] = t28;
2016
+ } else {
2017
+ t28 = $[67];
2018
+ }
2019
+ const memberColumns = t28;
2020
+ let t29;
2021
+ if ($[68] !== t) {
2022
+ t29 = t("email");
2023
+ $[68] = t;
2024
+ $[69] = t29;
2025
+ } else {
2026
+ t29 = $[69];
2027
+ }
2028
+ let t30;
2029
+ if ($[70] !== t29) {
2030
+ t30 = {
2031
+ head: t29,
2032
+ render: _temp4
2033
+ };
2034
+ $[70] = t29;
2035
+ $[71] = t30;
2036
+ } else {
2037
+ t30 = $[71];
2038
+ }
2039
+ let t31;
2040
+ if ($[72] !== t) {
2041
+ t31 = t("role");
2042
+ $[72] = t;
2043
+ $[73] = t31;
2044
+ } else {
2045
+ t31 = $[73];
2046
+ }
2047
+ let t32;
2048
+ if ($[74] !== t31) {
2049
+ t32 = {
2050
+ head: t31,
2051
+ render: _temp5
2052
+ };
2053
+ $[74] = t31;
2054
+ $[75] = t32;
2055
+ } else {
2056
+ t32 = $[75];
2057
+ }
2058
+ let t33;
2059
+ if ($[76] !== t) {
2060
+ t33 = t("status");
2061
+ $[76] = t;
2062
+ $[77] = t33;
2063
+ } else {
2064
+ t33 = $[77];
2065
+ }
2066
+ let t34;
2067
+ if ($[78] !== t33) {
2068
+ t34 = {
2069
+ head: t33,
2070
+ render: _temp6
2071
+ };
2072
+ $[78] = t33;
2073
+ $[79] = t34;
2074
+ } else {
2075
+ t34 = $[79];
2076
+ }
2077
+ let t35;
2078
+ if ($[80] !== t30 || $[81] !== t32 || $[82] !== t34) {
2079
+ t35 = [t30, t32, t34];
2080
+ $[80] = t30;
2081
+ $[81] = t32;
2082
+ $[82] = t34;
2083
+ $[83] = t35;
2084
+ } else {
2085
+ t35 = $[83];
2086
+ }
2087
+ const invitationColumns = t35;
2088
+ let t36;
2089
+ if ($[84] !== t) {
2090
+ t36 = t("id");
2091
+ $[84] = t;
2092
+ $[85] = t36;
2093
+ } else {
2094
+ t36 = $[85];
2095
+ }
2096
+ let t37;
2097
+ if ($[86] !== t36) {
2098
+ t37 = {
2099
+ className: "font-mono text-xs",
2100
+ head: t36,
2101
+ render: _temp7
2102
+ };
2103
+ $[86] = t36;
2104
+ $[87] = t37;
2105
+ } else {
2106
+ t37 = $[87];
2107
+ }
2108
+ let t38;
2109
+ if ($[88] !== t) {
2110
+ t38 = t("name");
2111
+ $[88] = t;
2112
+ $[89] = t38;
2113
+ } else {
2114
+ t38 = $[89];
2115
+ }
2116
+ let t39;
2117
+ if ($[90] !== t38) {
2118
+ t39 = {
2119
+ head: t38,
2120
+ render: _temp8
2121
+ };
2122
+ $[90] = t38;
2123
+ $[91] = t39;
2124
+ } else {
2125
+ t39 = $[91];
2126
+ }
2127
+ let t40;
2128
+ if ($[92] !== t37 || $[93] !== t39) {
2129
+ t40 = [t37, t39];
2130
+ $[92] = t37;
2131
+ $[93] = t39;
2132
+ $[94] = t40;
2133
+ } else {
2134
+ t40 = $[94];
2135
+ }
2136
+ const teamColumns = t40;
2137
+ let t41;
2138
+ if ($[95] !== t) {
2139
+ t41 = t("userId");
2140
+ $[95] = t;
2141
+ $[96] = t41;
2142
+ } else {
2143
+ t41 = $[96];
2144
+ }
2145
+ let t42;
2146
+ if ($[97] !== t41) {
2147
+ t42 = [{
2148
+ head: t41,
2149
+ render: _temp9
2150
+ }];
2151
+ $[97] = t41;
2152
+ $[98] = t42;
2153
+ } else {
2154
+ t42 = $[98];
2155
+ }
2156
+ const teamMemberColumns = t42;
2157
+ let t43;
2158
+ if ($[99] !== t) {
2159
+ t43 = t("role");
2160
+ $[99] = t;
2161
+ $[100] = t43;
2162
+ } else {
2163
+ t43 = $[100];
2164
+ }
2165
+ let t44;
2166
+ if ($[101] !== t43) {
2167
+ t44 = {
2168
+ head: t43,
2169
+ render: _temp0
2170
+ };
2171
+ $[101] = t43;
2172
+ $[102] = t44;
2173
+ } else {
2174
+ t44 = $[102];
2175
+ }
2176
+ let t45;
2177
+ if ($[103] !== t) {
2178
+ t45 = t("Permission");
2179
+ $[103] = t;
2180
+ $[104] = t45;
2181
+ } else {
2182
+ t45 = $[104];
2183
+ }
2184
+ let t46;
2185
+ if ($[105] !== t45) {
2186
+ t46 = {
2187
+ className: "font-mono text-xs whitespace-pre-wrap",
2188
+ head: t45,
2189
+ render: _temp1
2190
+ };
2191
+ $[105] = t45;
2192
+ $[106] = t46;
2193
+ } else {
2194
+ t46 = $[106];
2195
+ }
2196
+ let t47;
2197
+ if ($[107] !== t44 || $[108] !== t46) {
2198
+ t47 = [t44, t46];
2199
+ $[107] = t44;
2200
+ $[108] = t46;
2201
+ $[109] = t47;
2202
+ } else {
2203
+ t47 = $[109];
2204
+ }
2205
+ const roleColumns = t47;
2206
+ let t48;
2207
+ if ($[110] !== error) {
2208
+ t48 = error !== null && /* @__PURE__ */ jsxDEV("p", {
2209
+ className: "text-sm text-destructive",
2210
+ "data-testid": "org-detail-error",
2211
+ role: "alert",
2212
+ children: error
2213
+ }, void 0, false);
2214
+ $[110] = error;
2215
+ $[111] = t48;
2216
+ } else {
2217
+ t48 = $[111];
2218
+ }
2219
+ let t49;
2220
+ if ($[112] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2221
+ t49 = () => {
2222
+ setDialog({
2223
+ kind: "add-member"
2224
+ });
2225
+ };
2226
+ $[112] = t49;
2227
+ } else {
2228
+ t49 = $[112];
2229
+ }
2230
+ let t50;
2231
+ if ($[113] !== t) {
2232
+ t50 = t("Add member");
2233
+ $[113] = t;
2234
+ $[114] = t50;
2235
+ } else {
2236
+ t50 = $[114];
2237
+ }
2238
+ let t51;
2239
+ if ($[115] !== t50) {
2240
+ t51 = /* @__PURE__ */ jsxDEV(Button, {
2241
+ "data-testid": "org-open-add-member",
2242
+ onClick: t49,
2243
+ size: "xs",
2244
+ type: "button",
2245
+ variant: "outline",
2246
+ children: t50
2247
+ }, void 0, false);
2248
+ $[115] = t50;
2249
+ $[116] = t51;
2250
+ } else {
2251
+ t51 = $[116];
2252
+ }
2253
+ let t52;
2254
+ if ($[117] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2255
+ t52 = () => {
2256
+ setDialog({
2257
+ kind: "invite-member"
2258
+ });
2259
+ };
2260
+ $[117] = t52;
2261
+ } else {
2262
+ t52 = $[117];
2263
+ }
2264
+ let t53;
2265
+ if ($[118] !== t) {
2266
+ t53 = t("Invite member");
2267
+ $[118] = t;
2268
+ $[119] = t53;
2269
+ } else {
2270
+ t53 = $[119];
2271
+ }
2272
+ let t54;
2273
+ if ($[120] !== t53) {
2274
+ t54 = /* @__PURE__ */ jsxDEV(Button, {
2275
+ "data-testid": "org-open-invite-member",
2276
+ onClick: t52,
2277
+ size: "xs",
2278
+ type: "button",
2279
+ variant: "outline",
2280
+ children: t53
2281
+ }, void 0, false);
2282
+ $[120] = t53;
2283
+ $[121] = t54;
2284
+ } else {
2285
+ t54 = $[121];
2286
+ }
2287
+ let t55;
2288
+ if ($[122] !== t51 || $[123] !== t54) {
2289
+ t55 = /* @__PURE__ */ jsxDEV(Fragment, {
2290
+ children: [t51, t54]
2291
+ }, void 0, true);
2292
+ $[122] = t51;
2293
+ $[123] = t54;
2294
+ $[124] = t55;
2295
+ } else {
2296
+ t55 = $[124];
2297
+ }
2298
+ let t56;
2299
+ if ($[125] !== t) {
2300
+ t56 = t("Members");
2301
+ $[125] = t;
2302
+ $[126] = t56;
2303
+ } else {
2304
+ t56 = $[126];
2305
+ }
2306
+ let t57;
2307
+ if ($[127] !== client || $[128] !== memberColumns || $[129] !== members || $[130] !== runAction || $[131] !== t) {
2308
+ t57 = members.length === 0 ? /* @__PURE__ */ jsxDEV("div", {
2309
+ className: "p-3",
2310
+ children: /* @__PURE__ */ jsxDEV(EmptyState, {
2311
+ testId: "org-members-empty",
2312
+ title: t("No members.")
2313
+ }, void 0, false)
2314
+ }, void 0, false) : /* @__PURE__ */ jsxDEV(ManagedTable, {
2315
+ columns: memberColumns,
2316
+ rowActions: (row_10) => /* @__PURE__ */ jsxDEV(Fragment, {
2317
+ children: [/* @__PURE__ */ jsxDEV(Button, {
2318
+ "data-testid": `org-member-role-${formatCell(row_10.id)}`,
2319
+ onClick: () => {
2320
+ setDialog({
2321
+ kind: "member-role",
2322
+ member: row_10
2323
+ });
2324
+ },
2325
+ size: "xs",
2326
+ type: "button",
2327
+ variant: "ghost",
2328
+ children: t("Change role")
2329
+ }, void 0, false), /* @__PURE__ */ jsxDEV(Button, {
2330
+ "data-testid": `org-remove-member-${formatCell(row_10.id)}`,
2331
+ onClick: () => {
2332
+ runAction(() => client.removeAuthOrgMember({
2333
+ memberId: formatCell(row_10.id)
2334
+ }));
2335
+ },
2336
+ size: "xs",
2337
+ type: "button",
2338
+ variant: "ghost",
2339
+ children: t("Remove")
2340
+ }, void 0, false)]
2341
+ }, void 0, true),
2342
+ rowPrefix: "org-member",
2343
+ rows: members
2344
+ }, void 0, false);
2345
+ $[127] = client;
2346
+ $[128] = memberColumns;
2347
+ $[129] = members;
2348
+ $[130] = runAction;
2349
+ $[131] = t;
2350
+ $[132] = t57;
2351
+ } else {
2352
+ t57 = $[132];
2353
+ }
2354
+ let t58;
2355
+ if ($[133] !== t55 || $[134] !== t56 || $[135] !== t57) {
2356
+ t58 = /* @__PURE__ */ jsxDEV(SectionCard, {
2357
+ action: t55,
2358
+ heading: t56,
2359
+ testId: "org-members",
2360
+ children: t57
2361
+ }, void 0, false);
2362
+ $[133] = t55;
2363
+ $[134] = t56;
2364
+ $[135] = t57;
2365
+ $[136] = t58;
2366
+ } else {
2367
+ t58 = $[136];
2368
+ }
2369
+ let t59;
2370
+ if ($[137] !== client || $[138] !== invitationColumns || $[139] !== invitations || $[140] !== runAction || $[141] !== t) {
2371
+ t59 = invitations.length > 0 && /* @__PURE__ */ jsxDEV(SectionCard, {
2372
+ heading: t("Invitations"),
2373
+ testId: "org-invitations",
2374
+ children: /* @__PURE__ */ jsxDEV(ManagedTable, {
2375
+ columns: invitationColumns,
2376
+ rowActions: (row_11) => /* @__PURE__ */ jsxDEV(Button, {
2377
+ "data-testid": `org-cancel-invitation-${formatCell(row_11.id)}`,
2378
+ onClick: () => {
2379
+ runAction(() => client.cancelAuthOrgInvitation({
2380
+ invitationId: formatCell(row_11.id)
2381
+ }));
2382
+ },
2383
+ size: "xs",
2384
+ type: "button",
2385
+ variant: "ghost",
2386
+ children: t("Cancel")
2387
+ }, void 0, false),
2388
+ rowPrefix: "org-invitation",
2389
+ rows: invitations
2390
+ }, void 0, false)
2391
+ }, void 0, false);
2392
+ $[137] = client;
2393
+ $[138] = invitationColumns;
2394
+ $[139] = invitations;
2395
+ $[140] = runAction;
2396
+ $[141] = t;
2397
+ $[142] = t59;
2398
+ } else {
2399
+ t59 = $[142];
2400
+ }
2401
+ let t60;
2402
+ if ($[143] !== confirmDeleteTeam || $[144] !== selectedTeam || $[145] !== t || $[146] !== teamColumns || $[147] !== teams || $[148] !== teamsEnabled) {
2403
+ t60 = teamsEnabled && /* @__PURE__ */ jsxDEV(SectionCard, {
2404
+ action: /* @__PURE__ */ jsxDEV(Button, {
2405
+ "data-testid": "org-open-create-team",
2406
+ onClick: () => {
2407
+ setDialog({
2408
+ kind: "team-create"
2409
+ });
2410
+ },
2411
+ size: "xs",
2412
+ type: "button",
2413
+ variant: "outline",
2414
+ children: t("New team")
2415
+ }, void 0, false),
2416
+ heading: t("Teams"),
2417
+ testId: "org-teams",
2418
+ children: teams.length === 0 ? /* @__PURE__ */ jsxDEV("div", {
2419
+ className: "p-3",
2420
+ children: /* @__PURE__ */ jsxDEV(EmptyState, {
2421
+ testId: "org-teams-empty",
2422
+ title: t("No teams.")
2423
+ }, void 0, false)
2424
+ }, void 0, false) : /* @__PURE__ */ jsxDEV(ManagedTable, {
2425
+ columns: teamColumns,
2426
+ rowActions: (row_12) => /* @__PURE__ */ jsxDEV(Fragment, {
2427
+ children: [/* @__PURE__ */ jsxDEV(Button, {
2428
+ "aria-pressed": selectedTeam === formatCell(row_12.id),
2429
+ "data-testid": `org-team-select-${formatCell(row_12.id)}`,
2430
+ onClick: () => {
2431
+ setSelectedTeam(formatCell(row_12.id));
2432
+ },
2433
+ size: "xs",
2434
+ type: "button",
2435
+ variant: "ghost",
2436
+ children: t("Members")
2437
+ }, void 0, false), /* @__PURE__ */ jsxDEV(Button, {
2438
+ "data-testid": `org-team-rename-${formatCell(row_12.id)}`,
2439
+ onClick: () => {
2440
+ setDialog({
2441
+ kind: "team-rename",
2442
+ team: row_12
2443
+ });
2444
+ },
2445
+ size: "xs",
2446
+ type: "button",
2447
+ variant: "ghost",
2448
+ children: t("Rename")
2449
+ }, void 0, false), /* @__PURE__ */ jsxDEV(Button, {
2450
+ "data-testid": `org-team-delete-${formatCell(row_12.id)}`,
2451
+ onClick: () => {
2452
+ confirmDeleteTeam(row_12);
2453
+ },
2454
+ size: "xs",
2455
+ type: "button",
2456
+ variant: "ghost",
2457
+ children: t("Delete")
2458
+ }, void 0, false)]
2459
+ }, void 0, true),
2460
+ rowPrefix: "org-team",
2461
+ rows: teams
2462
+ }, void 0, false)
2463
+ }, void 0, false);
2464
+ $[143] = confirmDeleteTeam;
2465
+ $[144] = selectedTeam;
2466
+ $[145] = t;
2467
+ $[146] = teamColumns;
2468
+ $[147] = teams;
2469
+ $[148] = teamsEnabled;
2470
+ $[149] = t60;
2471
+ } else {
2472
+ t60 = $[149];
2473
+ }
2474
+ let t61;
2475
+ if ($[150] !== client || $[151] !== runAction || $[152] !== selectedTeam || $[153] !== t || $[154] !== teamMemberColumns || $[155] !== teamMembers || $[156] !== teamsEnabled) {
2476
+ t61 = teamsEnabled && selectedTeam !== null && /* @__PURE__ */ jsxDEV(SectionCard, {
2477
+ action: /* @__PURE__ */ jsxDEV(Button, {
2478
+ "data-testid": "org-open-add-team-member",
2479
+ onClick: () => {
2480
+ setDialog({
2481
+ kind: "team-add-member",
2482
+ teamId: selectedTeam
2483
+ });
2484
+ },
2485
+ size: "xs",
2486
+ type: "button",
2487
+ variant: "outline",
2488
+ children: t("Add member")
2489
+ }, void 0, false),
2490
+ heading: t("Team members"),
2491
+ testId: "org-team-members",
2492
+ children: teamMembers.length === 0 ? /* @__PURE__ */ jsxDEV("div", {
2493
+ className: "p-3",
2494
+ children: /* @__PURE__ */ jsxDEV(EmptyState, {
2495
+ testId: "org-team-members-empty",
2496
+ title: t("No team members.")
2497
+ }, void 0, false)
2498
+ }, void 0, false) : /* @__PURE__ */ jsxDEV(ManagedTable, {
2499
+ columns: teamMemberColumns,
2500
+ rowActions: (row_13) => /* @__PURE__ */ jsxDEV(Button, {
2501
+ "data-testid": `org-team-remove-member-${formatCell(row_13.id)}`,
2502
+ onClick: () => {
2503
+ runAction(() => client.removeAuthOrgTeamMember({
2504
+ teamMemberId: formatCell(row_13.id)
2505
+ }));
2506
+ },
2507
+ size: "xs",
2508
+ type: "button",
2509
+ variant: "ghost",
2510
+ children: t("Remove")
2511
+ }, void 0, false),
2512
+ rowPrefix: "org-team-member",
2513
+ rows: teamMembers
2514
+ }, void 0, false)
2515
+ }, void 0, false);
2516
+ $[150] = client;
2517
+ $[151] = runAction;
2518
+ $[152] = selectedTeam;
2519
+ $[153] = t;
2520
+ $[154] = teamMemberColumns;
2521
+ $[155] = teamMembers;
2522
+ $[156] = teamsEnabled;
2523
+ $[157] = t61;
2524
+ } else {
2525
+ t61 = $[157];
2526
+ }
2527
+ let t62;
2528
+ if ($[158] !== client || $[159] !== roleColumns || $[160] !== roles || $[161] !== rolesEnabled || $[162] !== t) {
2529
+ t62 = rolesEnabled && /* @__PURE__ */ jsxDEV(SectionCard, {
2530
+ action: /* @__PURE__ */ jsxDEV(Button, {
2531
+ "data-testid": "org-open-create-role",
2532
+ onClick: () => {
2533
+ setDialog({
2534
+ kind: "role-create"
2535
+ });
2536
+ },
2537
+ size: "xs",
2538
+ type: "button",
2539
+ variant: "outline",
2540
+ children: t("New role")
2541
+ }, void 0, false),
2542
+ heading: t("Roles"),
2543
+ testId: "org-roles",
2544
+ children: roles.length === 0 ? /* @__PURE__ */ jsxDEV("div", {
2545
+ className: "p-3",
2546
+ children: /* @__PURE__ */ jsxDEV(EmptyState, {
2547
+ testId: "org-roles-empty",
2548
+ title: t("No custom roles.")
2549
+ }, void 0, false)
2550
+ }, void 0, false) : /* @__PURE__ */ jsxDEV(ManagedTable, {
2551
+ columns: roleColumns,
2552
+ rowActions: (row_14) => /* @__PURE__ */ jsxDEV(Fragment, {
2553
+ children: [/* @__PURE__ */ jsxDEV(Button, {
2554
+ "data-testid": `org-role-edit-${formatCell(row_14.id)}`,
2555
+ onClick: () => {
2556
+ setDialog({
2557
+ kind: "role-edit",
2558
+ role: row_14
2559
+ });
2560
+ },
2561
+ size: "xs",
2562
+ type: "button",
2563
+ variant: "ghost",
2564
+ children: t("Edit")
2565
+ }, void 0, false), /* @__PURE__ */ jsxDEV(Button, {
2566
+ "data-testid": `org-role-delete-${formatCell(row_14.id)}`,
2567
+ onClick: () => {
2568
+ setDialog({
2569
+ action: () => client.deleteAuthOrgRole({
2570
+ roleId: formatCell(row_14.id)
2571
+ }),
2572
+ kind: "confirm",
2573
+ message: t("Delete this custom role? Members keeping it will lose its grants."),
2574
+ testId: "org-role-delete",
2575
+ title: t("Delete role")
2576
+ });
2577
+ },
2578
+ size: "xs",
2579
+ type: "button",
2580
+ variant: "ghost",
2581
+ children: t("Delete")
2582
+ }, void 0, false)]
2583
+ }, void 0, true),
2584
+ rowPrefix: "org-role",
2585
+ rows: roles
2586
+ }, void 0, false)
2587
+ }, void 0, false);
2588
+ $[158] = client;
2589
+ $[159] = roleColumns;
2590
+ $[160] = roles;
2591
+ $[161] = rolesEnabled;
2592
+ $[162] = t;
2593
+ $[163] = t62;
2594
+ } else {
2595
+ t62 = $[163];
2596
+ }
2597
+ let t63;
2598
+ if ($[164] !== dialog?.kind || $[165] !== organizationId || $[166] !== refetchAll) {
2599
+ t63 = dialog?.kind === "add-member" && /* @__PURE__ */ jsxDEV(MemberAddDialog, {
2600
+ onClose: closeDialog,
2601
+ onDone: refetchAll,
2602
+ organizationId
2603
+ }, void 0, false);
2604
+ $[164] = dialog?.kind;
2605
+ $[165] = organizationId;
2606
+ $[166] = refetchAll;
2607
+ $[167] = t63;
2608
+ } else {
2609
+ t63 = $[167];
2610
+ }
2611
+ let t64;
2612
+ if ($[168] !== dialog?.kind || $[169] !== organizationId || $[170] !== refetchAll) {
2613
+ t64 = dialog?.kind === "invite-member" && /* @__PURE__ */ jsxDEV(MemberInviteDialog, {
2614
+ onClose: closeDialog,
2615
+ onDone: refetchAll,
2616
+ organizationId
2617
+ }, void 0, false);
2618
+ $[168] = dialog?.kind;
2619
+ $[169] = organizationId;
2620
+ $[170] = refetchAll;
2621
+ $[171] = t64;
2622
+ } else {
2623
+ t64 = $[171];
2624
+ }
2625
+ let t65;
2626
+ if ($[172] !== dialog || $[173] !== refetchAll) {
2627
+ t65 = dialog?.kind === "member-role" && /* @__PURE__ */ jsxDEV(MemberRoleDialog, {
2628
+ member: dialog.member,
2629
+ onClose: closeDialog,
2630
+ onDone: refetchAll
2631
+ }, void 0, false);
2632
+ $[172] = dialog;
2633
+ $[173] = refetchAll;
2634
+ $[174] = t65;
2635
+ } else {
2636
+ t65 = $[174];
2637
+ }
2638
+ let t66;
2639
+ if ($[175] !== dialog?.kind || $[176] !== organizationId || $[177] !== refetchAll) {
2640
+ t66 = dialog?.kind === "team-create" && /* @__PURE__ */ jsxDEV(TeamFormDialog, {
2641
+ mode: "create",
2642
+ onClose: closeDialog,
2643
+ onDone: refetchAll,
2644
+ organizationId
2645
+ }, void 0, false);
2646
+ $[175] = dialog?.kind;
2647
+ $[176] = organizationId;
2648
+ $[177] = refetchAll;
2649
+ $[178] = t66;
2650
+ } else {
2651
+ t66 = $[178];
2652
+ }
2653
+ let t67;
2654
+ if ($[179] !== dialog || $[180] !== organizationId || $[181] !== refetchAll) {
2655
+ t67 = dialog?.kind === "team-rename" && /* @__PURE__ */ jsxDEV(TeamFormDialog, {
2656
+ mode: "edit",
2657
+ onClose: closeDialog,
2658
+ onDone: refetchAll,
2659
+ organizationId,
2660
+ team: dialog.team
2661
+ }, void 0, false);
2662
+ $[179] = dialog;
2663
+ $[180] = organizationId;
2664
+ $[181] = refetchAll;
2665
+ $[182] = t67;
2666
+ } else {
2667
+ t67 = $[182];
2668
+ }
2669
+ let t68;
2670
+ if ($[183] !== dialog || $[184] !== refetchAll) {
2671
+ t68 = dialog?.kind === "team-add-member" && /* @__PURE__ */ jsxDEV(TeamMemberAddDialog, {
2672
+ onClose: closeDialog,
2673
+ onDone: refetchAll,
2674
+ teamId: dialog.teamId
2675
+ }, void 0, false);
2676
+ $[183] = dialog;
2677
+ $[184] = refetchAll;
2678
+ $[185] = t68;
2679
+ } else {
2680
+ t68 = $[185];
2681
+ }
2682
+ let t69;
2683
+ if ($[186] !== dialog?.kind || $[187] !== organizationId || $[188] !== refetchAll) {
2684
+ t69 = dialog?.kind === "role-create" && /* @__PURE__ */ jsxDEV(RoleFormDialog, {
2685
+ mode: "create",
2686
+ onClose: closeDialog,
2687
+ onDone: refetchAll,
2688
+ organizationId
2689
+ }, void 0, false);
2690
+ $[186] = dialog?.kind;
2691
+ $[187] = organizationId;
2692
+ $[188] = refetchAll;
2693
+ $[189] = t69;
2694
+ } else {
2695
+ t69 = $[189];
2696
+ }
2697
+ let t70;
2698
+ if ($[190] !== dialog || $[191] !== organizationId || $[192] !== refetchAll) {
2699
+ t70 = dialog?.kind === "role-edit" && /* @__PURE__ */ jsxDEV(RoleFormDialog, {
2700
+ mode: "edit",
2701
+ onClose: closeDialog,
2702
+ onDone: refetchAll,
2703
+ organizationId,
2704
+ role: dialog.role
2705
+ }, void 0, false);
2706
+ $[190] = dialog;
2707
+ $[191] = organizationId;
2708
+ $[192] = refetchAll;
2709
+ $[193] = t70;
2710
+ } else {
2711
+ t70 = $[193];
2712
+ }
2713
+ let t71;
2714
+ if ($[194] !== dialog || $[195] !== refetchAll) {
2715
+ t71 = dialog?.kind === "confirm" && /* @__PURE__ */ jsxDEV(ConfirmDialog, {
2716
+ action: dialog.action,
2717
+ message: dialog.message,
2718
+ onClose: closeDialog,
2719
+ onDone: refetchAll,
2720
+ testId: dialog.testId,
2721
+ title: dialog.title
2722
+ }, void 0, false);
2723
+ $[194] = dialog;
2724
+ $[195] = refetchAll;
2725
+ $[196] = t71;
2726
+ } else {
2727
+ t71 = $[196];
2728
+ }
2729
+ let t72;
2730
+ if ($[197] !== t48 || $[198] !== t58 || $[199] !== t59 || $[200] !== t60 || $[201] !== t61 || $[202] !== t62 || $[203] !== t63 || $[204] !== t64 || $[205] !== t65 || $[206] !== t66 || $[207] !== t67 || $[208] !== t68 || $[209] !== t69 || $[210] !== t70 || $[211] !== t71) {
2731
+ t72 = /* @__PURE__ */ jsxDEV("div", {
2732
+ className: "flex flex-col gap-4",
2733
+ "data-testid": "org-detail",
2734
+ children: [t48, t58, t59, t60, t61, t62, t63, t64, t65, t66, t67, t68, t69, t70, t71]
2735
+ }, void 0, true);
2736
+ $[197] = t48;
2737
+ $[198] = t58;
2738
+ $[199] = t59;
2739
+ $[200] = t60;
2740
+ $[201] = t61;
2741
+ $[202] = t62;
2742
+ $[203] = t63;
2743
+ $[204] = t64;
2744
+ $[205] = t65;
2745
+ $[206] = t66;
2746
+ $[207] = t67;
2747
+ $[208] = t68;
2748
+ $[209] = t69;
2749
+ $[210] = t70;
2750
+ $[211] = t71;
2751
+ $[212] = t72;
2752
+ } else {
2753
+ t72 = $[212];
2754
+ }
2755
+ return t72;
2756
+ };
2757
+ function _temp(column) {
2758
+ return /* @__PURE__ */ jsxDEV(TableHead, {
2759
+ children: column.head
2760
+ }, column.head, false);
2761
+ }
2762
+ function _temp2(row_0) {
2763
+ return /* @__PURE__ */ jsxDEV("span", {
2764
+ className: "font-mono text-xs",
2765
+ children: formatCell(row_0.userId)
2766
+ }, void 0, false);
2767
+ }
2768
+ function _temp3(row_1) {
2769
+ return formatCell(row_1.role);
2770
+ }
2771
+ function _temp4(row_2) {
2772
+ return formatCell(row_2.email);
2773
+ }
2774
+ function _temp5(row_3) {
2775
+ return formatCell(row_3.role);
2776
+ }
2777
+ function _temp6(row_4) {
2778
+ return formatCell(row_4.status);
2779
+ }
2780
+ function _temp7(row_5) {
2781
+ return formatCell(row_5.id);
2782
+ }
2783
+ function _temp8(row_6) {
2784
+ return formatCell(row_6.name);
2785
+ }
2786
+ function _temp9(row_7) {
2787
+ return /* @__PURE__ */ jsxDEV("span", {
2788
+ className: "font-mono text-xs",
2789
+ children: formatCell(row_7.userId)
2790
+ }, void 0, false);
2791
+ }
2792
+ function _temp0(row_8) {
2793
+ return formatCell(row_8.role);
2794
+ }
2795
+ function _temp1(row_9) {
2796
+ return formatCell(row_9.permission);
2797
+ }
2798
+
2799
+ const OrganizationsPanel = () => {
2800
+ const $ = c(62);
2801
+ const client = useLunora();
2802
+ const t = useT();
2803
+ const {
2804
+ config,
2805
+ ready
2806
+ } = useAuthConfig();
2807
+ const orgEnabled = config.capabilities.organization;
2808
+ const [selected, setSelected] = useState(null);
2809
+ const [dialog, setDialog] = useState(null);
2810
+ let t0;
2811
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2812
+ t0 = ["lunora-auth-orgs"];
2813
+ $[0] = t0;
2814
+ } else {
2815
+ t0 = $[0];
2816
+ }
2817
+ let t1;
2818
+ if ($[1] !== client) {
2819
+ t1 = () => client.listAuthOrganizations({
2820
+ limit: 100
2821
+ });
2822
+ $[1] = client;
2823
+ $[2] = t1;
2824
+ } else {
2825
+ t1 = $[2];
2826
+ }
2827
+ let t2;
2828
+ if ($[3] !== orgEnabled) {
2829
+ t2 = {
2830
+ enabled: orgEnabled
2831
+ };
2832
+ $[3] = orgEnabled;
2833
+ $[4] = t2;
2834
+ } else {
2835
+ t2 = $[4];
2836
+ }
2837
+ const orgsQuery = useClientQuery(t0, t1, t2);
2838
+ const orgs = orgsQuery.data?.rows ?? null;
2839
+ let t3;
2840
+ if ($[5] !== orgsQuery) {
2841
+ t3 = () => {
2842
+ orgsQuery.refetch();
2843
+ };
2844
+ $[5] = orgsQuery;
2845
+ $[6] = t3;
2846
+ } else {
2847
+ t3 = $[6];
2848
+ }
2849
+ useAutoRefresh(t3, orgEnabled);
2850
+ let t4;
2851
+ if ($[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2852
+ t4 = () => {
2853
+ setDialog(null);
2854
+ };
2855
+ $[7] = t4;
2856
+ } else {
2857
+ t4 = $[7];
2858
+ }
2859
+ const closeDialog = t4;
2860
+ let t5;
2861
+ if ($[8] !== orgsQuery) {
2862
+ t5 = () => {
2863
+ orgsQuery.refetch();
2864
+ };
2865
+ $[8] = orgsQuery;
2866
+ $[9] = t5;
2867
+ } else {
2868
+ t5 = $[9];
2869
+ }
2870
+ const refetchOrgs = t5;
2871
+ let t6;
2872
+ if ($[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2873
+ t6 = (id) => {
2874
+ setSelected(id);
2875
+ };
2876
+ $[10] = t6;
2877
+ } else {
2878
+ t6 = $[10];
2879
+ }
2880
+ const onSelectOrg = t6;
2881
+ if (ready && !orgEnabled) {
2882
+ let t72;
2883
+ if ($[11] !== t) {
2884
+ t72 = t("Enable the organization() plugin in your auth config to manage organizations here.");
2885
+ $[11] = t;
2886
+ $[12] = t72;
2887
+ } else {
2888
+ t72 = $[12];
2889
+ }
2890
+ let t82;
2891
+ if ($[13] !== t) {
2892
+ t82 = t("Organizations are not enabled.");
2893
+ $[13] = t;
2894
+ $[14] = t82;
2895
+ } else {
2896
+ t82 = $[14];
2897
+ }
2898
+ let t92;
2899
+ if ($[15] !== t72 || $[16] !== t82) {
2900
+ t92 = /* @__PURE__ */ jsxDEV(EmptyState, {
2901
+ description: t72,
2902
+ testId: "org-disabled",
2903
+ title: t82
2904
+ }, void 0, false);
2905
+ $[15] = t72;
2906
+ $[16] = t82;
2907
+ $[17] = t92;
2908
+ } else {
2909
+ t92 = $[17];
2910
+ }
2911
+ return t92;
2912
+ }
2913
+ let t7;
2914
+ if ($[18] !== t) {
2915
+ t7 = t("Organizations");
2916
+ $[18] = t;
2917
+ $[19] = t7;
2918
+ } else {
2919
+ t7 = $[19];
2920
+ }
2921
+ let t8;
2922
+ if ($[20] !== t7) {
2923
+ t8 = /* @__PURE__ */ jsxDEV("span", {
2924
+ className: "font-mono text-[11px] tracking-wide text-muted-foreground uppercase",
2925
+ children: t7
2926
+ }, void 0, false);
2927
+ $[20] = t7;
2928
+ $[21] = t8;
2929
+ } else {
2930
+ t8 = $[21];
2931
+ }
2932
+ let t9;
2933
+ if ($[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2934
+ t9 = () => {
2935
+ setDialog({
2936
+ kind: "create"
2937
+ });
2938
+ };
2939
+ $[22] = t9;
2940
+ } else {
2941
+ t9 = $[22];
2942
+ }
2943
+ let t10;
2944
+ if ($[23] !== t) {
2945
+ t10 = t("New organization");
2946
+ $[23] = t;
2947
+ $[24] = t10;
2948
+ } else {
2949
+ t10 = $[24];
2950
+ }
2951
+ let t11;
2952
+ if ($[25] !== t10) {
2953
+ t11 = /* @__PURE__ */ jsxDEV(Button, {
2954
+ "data-testid": "org-new",
2955
+ onClick: t9,
2956
+ size: "sm",
2957
+ type: "button",
2958
+ children: t10
2959
+ }, void 0, false);
2960
+ $[25] = t10;
2961
+ $[26] = t11;
2962
+ } else {
2963
+ t11 = $[26];
2964
+ }
2965
+ let t12;
2966
+ if ($[27] !== t11 || $[28] !== t8) {
2967
+ t12 = /* @__PURE__ */ jsxDEV("div", {
2968
+ className: "flex items-center justify-between",
2969
+ children: [t8, t11]
2970
+ }, void 0, true);
2971
+ $[27] = t11;
2972
+ $[28] = t8;
2973
+ $[29] = t12;
2974
+ } else {
2975
+ t12 = $[29];
2976
+ }
2977
+ let t13;
2978
+ if ($[30] !== orgsQuery.error) {
2979
+ t13 = orgsQuery.error !== null && /* @__PURE__ */ jsxDEV("p", {
2980
+ className: "text-sm text-destructive",
2981
+ "data-testid": "org-error",
2982
+ role: "alert",
2983
+ children: orgsQuery.error
2984
+ }, void 0, false);
2985
+ $[30] = orgsQuery.error;
2986
+ $[31] = t13;
2987
+ } else {
2988
+ t13 = $[31];
2989
+ }
2990
+ let t14;
2991
+ if ($[32] !== orgs || $[33] !== t) {
2992
+ t14 = orgs !== null && orgs.length === 0 && /* @__PURE__ */ jsxDEV(EmptyState, {
2993
+ testId: "org-empty",
2994
+ title: t("No organizations.")
2995
+ }, void 0, false);
2996
+ $[32] = orgs;
2997
+ $[33] = t;
2998
+ $[34] = t14;
2999
+ } else {
3000
+ t14 = $[34];
3001
+ }
3002
+ let t15;
3003
+ if ($[35] !== orgs || $[36] !== selected || $[37] !== t) {
3004
+ t15 = orgs !== null && orgs.length > 0 && /* @__PURE__ */ jsxDEV(Card, {
3005
+ className: "overflow-hidden py-0",
3006
+ children: /* @__PURE__ */ jsxDEV(CardContent, {
3007
+ className: "px-0",
3008
+ children: /* @__PURE__ */ jsxDEV(Table, {
3009
+ "data-testid": "org-table",
3010
+ children: [/* @__PURE__ */ jsxDEV(TableHeader, {
3011
+ children: /* @__PURE__ */ jsxDEV(TableRow, {
3012
+ children: [/* @__PURE__ */ jsxDEV(TableHead, {
3013
+ children: t("id")
3014
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
3015
+ children: t("name")
3016
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
3017
+ children: t("slug")
3018
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
3019
+ children: t("created")
3020
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
3021
+ "aria-label": t("Actions")
3022
+ }, void 0, false)]
3023
+ }, void 0, true)
3024
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
3025
+ children: orgs.map((org) => {
3026
+ const id_0 = formatCell(org.id);
3027
+ return /* @__PURE__ */ jsxDEV(TableRow, {
3028
+ "data-testid": `org-row-${id_0}`,
3029
+ children: [/* @__PURE__ */ jsxDEV(TableCell, {
3030
+ className: "font-mono text-xs",
3031
+ children: id_0
3032
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
3033
+ children: formatCell(org.name)
3034
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
3035
+ children: formatCell(org.slug)
3036
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
3037
+ className: "text-muted-foreground tabular-nums",
3038
+ children: formatTimestamp(org.createdAt)
3039
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
3040
+ children: /* @__PURE__ */ jsxDEV("div", {
3041
+ className: "flex justify-end gap-1",
3042
+ children: [/* @__PURE__ */ jsxDEV(Button, {
3043
+ "aria-pressed": selected === id_0,
3044
+ "data-testid": `org-select-${id_0}`,
3045
+ onClick: () => {
3046
+ onSelectOrg(id_0);
3047
+ },
3048
+ size: "xs",
3049
+ type: "button",
3050
+ variant: "ghost",
3051
+ children: t("Manage")
3052
+ }, void 0, false), /* @__PURE__ */ jsxDEV(Button, {
3053
+ "data-testid": `org-edit-${id_0}`,
3054
+ onClick: () => {
3055
+ setDialog({
3056
+ kind: "edit",
3057
+ org
3058
+ });
3059
+ },
3060
+ size: "xs",
3061
+ type: "button",
3062
+ variant: "ghost",
3063
+ children: t("Edit")
3064
+ }, void 0, false), /* @__PURE__ */ jsxDEV(Button, {
3065
+ "data-testid": `org-delete-${id_0}`,
3066
+ onClick: () => {
3067
+ setDialog({
3068
+ kind: "delete",
3069
+ org
3070
+ });
3071
+ },
3072
+ size: "xs",
3073
+ type: "button",
3074
+ variant: "ghost",
3075
+ children: t("Delete")
3076
+ }, void 0, false)]
3077
+ }, void 0, true)
3078
+ }, void 0, false)]
3079
+ }, id_0, true);
3080
+ })
3081
+ }, void 0, false)]
3082
+ }, void 0, true)
3083
+ }, void 0, false)
3084
+ }, void 0, false);
3085
+ $[35] = orgs;
3086
+ $[36] = selected;
3087
+ $[37] = t;
3088
+ $[38] = t15;
3089
+ } else {
3090
+ t15 = $[38];
3091
+ }
3092
+ let t16;
3093
+ if ($[39] !== config.organization || $[40] !== selected) {
3094
+ t16 = selected !== null && /* @__PURE__ */ jsxDEV(OrganizationDetail, {
3095
+ organizationId: selected,
3096
+ rolesEnabled: config.organization.roles,
3097
+ teamsEnabled: config.organization.teams
3098
+ }, void 0, false);
3099
+ $[39] = config.organization;
3100
+ $[40] = selected;
3101
+ $[41] = t16;
3102
+ } else {
3103
+ t16 = $[41];
3104
+ }
3105
+ let t17;
3106
+ if ($[42] !== dialog?.kind || $[43] !== refetchOrgs) {
3107
+ t17 = dialog?.kind === "create" && /* @__PURE__ */ jsxDEV(OrgFormDialog, {
3108
+ mode: "create",
3109
+ onClose: closeDialog,
3110
+ onDone: refetchOrgs
3111
+ }, void 0, false);
3112
+ $[42] = dialog?.kind;
3113
+ $[43] = refetchOrgs;
3114
+ $[44] = t17;
3115
+ } else {
3116
+ t17 = $[44];
3117
+ }
3118
+ let t18;
3119
+ if ($[45] !== dialog || $[46] !== refetchOrgs) {
3120
+ t18 = dialog?.kind === "edit" && /* @__PURE__ */ jsxDEV(OrgFormDialog, {
3121
+ mode: "edit",
3122
+ onClose: closeDialog,
3123
+ onDone: refetchOrgs,
3124
+ org: dialog.org
3125
+ }, void 0, false);
3126
+ $[45] = dialog;
3127
+ $[46] = refetchOrgs;
3128
+ $[47] = t18;
3129
+ } else {
3130
+ t18 = $[47];
3131
+ }
3132
+ let t19;
3133
+ if ($[48] !== client || $[49] !== dialog || $[50] !== refetchOrgs || $[51] !== t) {
3134
+ t19 = dialog?.kind === "delete" && /* @__PURE__ */ jsxDEV(ConfirmDialog, {
3135
+ action: async () => {
3136
+ const id_1 = formatCell(dialog.org.id);
3137
+ await client.deleteAuthOrganization({
3138
+ organizationId: id_1
3139
+ });
3140
+ setSelected((current) => current === id_1 ? null : current);
3141
+ },
3142
+ message: t("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),
3143
+ onClose: closeDialog,
3144
+ onDone: refetchOrgs,
3145
+ testId: "org-delete",
3146
+ title: t("Delete organization")
3147
+ }, void 0, false);
3148
+ $[48] = client;
3149
+ $[49] = dialog;
3150
+ $[50] = refetchOrgs;
3151
+ $[51] = t;
3152
+ $[52] = t19;
3153
+ } else {
3154
+ t19 = $[52];
3155
+ }
3156
+ let t20;
3157
+ if ($[53] !== t12 || $[54] !== t13 || $[55] !== t14 || $[56] !== t15 || $[57] !== t16 || $[58] !== t17 || $[59] !== t18 || $[60] !== t19) {
3158
+ t20 = /* @__PURE__ */ jsxDEV("div", {
3159
+ className: "flex flex-col gap-4",
3160
+ "data-testid": "lunora-organizations",
3161
+ children: [t12, t13, t14, t15, t16, t17, t18, t19]
3162
+ }, void 0, true);
3163
+ $[53] = t12;
3164
+ $[54] = t13;
3165
+ $[55] = t14;
3166
+ $[56] = t15;
3167
+ $[57] = t16;
3168
+ $[58] = t17;
3169
+ $[59] = t18;
3170
+ $[60] = t19;
3171
+ $[61] = t20;
3172
+ } else {
3173
+ t20 = $[61];
3174
+ }
3175
+ return t20;
3176
+ };
3177
+
3178
+ export { OrganizationsPanel };