@lunora/studio 1.0.0-alpha.3 → 1.0.0-alpha.30

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 (174) hide show
  1. package/__assets__/package-og.svg +1 -1
  2. package/dist/index.d.ts +29 -18
  3. package/dist/index.js +29 -29
  4. package/dist/mount.d.ts +1 -1
  5. package/dist/mount.js +1 -1
  6. package/dist/{packem_shared/ApiTab-W3no0KOj.js → packem_chunks/ApiTab.js} +5 -5
  7. package/dist/{packem_shared/AuditPanel-Bq4o_IqT.js → packem_chunks/AuditPanel.js} +24 -36
  8. package/dist/{packem_shared/ExportImportPanel-dxY56TDF.js → packem_chunks/ExportImportPanel.js} +13 -9
  9. package/dist/{packem_shared/FileBrowser-Dhy4zES8.js → packem_chunks/FileBrowser.js} +15 -15
  10. package/dist/{packem_shared/FunctionRunner--fQJRPAD.js → packem_chunks/FunctionRunner.js} +10 -10
  11. package/dist/{packem_shared/FunctionStatsPanel-BjRUA_G3.js → packem_chunks/FunctionStatsPanel.js} +147 -204
  12. package/dist/{packem_shared/HealthPanel-PxclMWmA.js → packem_chunks/HealthPanel.js} +37 -29
  13. package/dist/{packem_shared/InsightsPanel-CWS_C-xW.js → packem_chunks/InsightsPanel.js} +107 -69
  14. package/dist/{packem_shared/LogsPanel-CTW8CFcM.js → packem_chunks/LogsPanel.js} +41 -53
  15. package/dist/{packem_shared/MailPanel-BwkvfIHF.js → packem_chunks/MailPanel.js} +37 -44
  16. package/dist/{packem_shared/MetricsPanel-BLuOhZQ4.js → packem_chunks/MetricsPanel.js} +41 -322
  17. package/dist/{packem_shared/MigrationsPanel-DT3lnwHF.js → packem_chunks/MigrationsPanel.js} +39 -46
  18. package/dist/{packem_shared/PitrPanel-CdErL7EJ.js → packem_chunks/PitrPanel.js} +9 -9
  19. package/dist/{packem_shared/SchemaViewer-LJDcmNIO.js → packem_chunks/SchemaViewer.js} +15 -15
  20. package/dist/{packem_shared/SecurityAdvisorPanel-C_ETsPih.js → packem_chunks/SecurityAdvisorPanel.js} +44 -31
  21. package/dist/packem_chunks/SettingsPanel.js +390 -0
  22. package/dist/{packem_shared/sql-editor-panel-BFRpzj6r.js → packem_chunks/SqlEditorPanel.js} +12 -252
  23. package/dist/{packem_shared/TableEditor-ChfUOZec.js → packem_chunks/TableEditor.js} +10 -68
  24. package/dist/packem_chunks/analytics-panel.js +261 -0
  25. package/dist/packem_chunks/auth-config-panel.js +179 -0
  26. package/dist/packem_chunks/auth-sessions-panel.js +175 -0
  27. package/dist/packem_chunks/dashboards-panel.js +779 -0
  28. package/dist/packem_chunks/fanout-panel.js +481 -0
  29. package/dist/packem_chunks/flags-panel.js +176 -0
  30. package/dist/packem_chunks/kv-browser.js +1896 -0
  31. package/dist/packem_chunks/log-drains-panel.js +273 -0
  32. package/dist/packem_chunks/organizations-panel.js +670 -0
  33. package/dist/packem_chunks/payments-panel.js +185 -0
  34. package/dist/packem_chunks/permissions-panel.js +804 -0
  35. package/dist/packem_chunks/queues-panel.js +147 -0
  36. package/dist/packem_chunks/rls-panel.js +313 -0
  37. package/dist/packem_chunks/schedule-panel.js +831 -0
  38. package/dist/packem_chunks/sparkline.js +79 -0
  39. package/dist/packem_chunks/storage-rules-panel.js +138 -0
  40. package/dist/packem_chunks/subscriptions-panel.js +236 -0
  41. package/dist/packem_chunks/users-panel.js +1265 -0
  42. package/dist/packem_chunks/vector-browser.js +281 -0
  43. package/dist/packem_chunks/workflows-panel.js +562 -0
  44. package/dist/packem_shared/{ADMIN_FUNCTIONS-DmBqMZ-z.js → ADMIN_FUNCTIONS-CdaxLGkE.js} +3 -0
  45. package/dist/packem_shared/{ApiDocsPanel-C5-yJ1p7.js → ApiDocsPanel-B6u_wnz-.js} +2 -2
  46. package/dist/packem_shared/{ApiReferencePanel-1vubqG5s.js → ApiReferencePanel-Drz4UO0a.js} +2 -1
  47. package/dist/packem_shared/{CommandPalette-BtgkBzZI.js → CommandPalette-B5BertvU.js} +1 -1
  48. package/dist/packem_shared/{DataBrowser-CtBe1So9.js → DataBrowser-ANTHLWWh.js} +198 -247
  49. package/dist/packem_shared/{GlobalDataBrowser-BTEmGrph.js → GlobalDataBrowser-CjgTG_wa.js} +37 -66
  50. package/dist/packem_shared/HomePanel-c2FodE9t.js +14 -0
  51. package/dist/packem_shared/{OpenRpcReferencePanel-vbcYbv3V.js → OpenRpcReferencePanel-CspFdbUT.js} +2 -1
  52. package/dist/packem_shared/{ScheduledJobs-CabfKbyM.js → ScheduledJobs-BEJXtsBn.js} +163 -60
  53. package/dist/packem_shared/Studio-CVTtA_sB.js +16 -0
  54. package/dist/packem_shared/{StudioApp-CHOZA-z-.js → StudioApp-BSYV2fz6.js} +277 -3
  55. package/dist/packem_shared/{advisor-view-CGcfMiPq.js → advisor-view-DzqyvUU3.js} +1 -1
  56. package/dist/packem_shared/{app.d-CCmwDEVs.d.ts → app.d-B6MyY_al.d.ts} +1 -1
  57. package/dist/packem_shared/{bar-chart-CzJAgqkp.js → bar-chart-Bb__F5-u.js} +1 -1
  58. package/dist/packem_shared/browser-storage-d03UsV7v.js +249 -0
  59. package/dist/packem_shared/{cf-links-2cktDedA.js → cf-links-BZfRdxSE.js} +1 -1
  60. package/dist/packem_shared/{data-grid-B5CaV3wS.js → data-grid-Dsg6nRjo.js} +1 -1
  61. package/dist/packem_shared/data-view-params-Cd6yRVbv.js +96 -0
  62. package/dist/packem_shared/{grid-features-CzUfqgsM.js → grid-features-D7nNzBYm.js} +4 -99
  63. package/dist/packem_shared/{HomePanel-Cw16stjq.js → home-panel-aOR_drVv.js} +833 -469
  64. package/dist/packem_shared/{internal-rXJEAhXS.js → internal-FcNZ3beb.js} +1 -1
  65. package/dist/packem_shared/modal-shell-hyaJvIJ6.js +100 -0
  66. package/dist/packem_shared/{reference-view-B4E49Lip.js → reference-view-Doy1XlQq.js} +4 -44
  67. package/dist/packem_shared/select-UkNYCT3s.js +273 -0
  68. package/dist/packem_shared/skeleton-CGhL0p20.js +45 -0
  69. package/dist/packem_shared/{sparkline-10dG-_f0.js → sparkline-KgMPHS4u.js} +1 -1
  70. package/dist/packem_shared/studio-dMTJ-kRR.js +3987 -0
  71. package/dist/packem_shared/{table-_RzNvy3R.js → table-DsCa9Qp9.js} +1 -1
  72. package/dist/packem_shared/{table-list-sidebar-Bg7uzbvC.js → table-list-sidebar-VMo0ftxD.js} +1 -1
  73. package/dist/packem_shared/use-admin-query-BViPA3US.js +105 -0
  74. package/dist/packem_shared/use-auth-capabilities-BHkoBnbZ.js +32 -0
  75. package/dist/standalone/chunk-2DS7JLWL.js +13 -0
  76. package/dist/standalone/chunk-2K47A3P6.js +1 -0
  77. package/dist/standalone/chunk-2NGUNNGW.js +1 -0
  78. package/dist/standalone/chunk-2PDQ4KZ6.js +1 -0
  79. package/dist/standalone/chunk-3BP4BTLR.js +4 -0
  80. package/dist/standalone/chunk-3OA7PECS.js +6 -0
  81. package/dist/standalone/chunk-4QHKBC77.js +1 -0
  82. package/dist/standalone/chunk-57LYXHXH.js +1 -0
  83. package/dist/standalone/chunk-5NSZVXCS.js +1 -0
  84. package/dist/standalone/chunk-5OIBXYZM.js +1 -0
  85. package/dist/standalone/chunk-63XKJQTQ.js +1 -0
  86. package/dist/standalone/chunk-6RC6L33K.js +4 -0
  87. package/dist/standalone/chunk-6VTGE3WJ.js +1 -0
  88. package/dist/standalone/chunk-7PBZKXYA.js +1 -0
  89. package/dist/standalone/chunk-7POIIWC5.js +3 -0
  90. package/dist/standalone/chunk-7RYIQKZA.js +1 -0
  91. package/dist/standalone/chunk-7TJJXVSE.js +1 -0
  92. package/dist/standalone/chunk-AB6QGMBF.js +1 -0
  93. package/dist/standalone/chunk-AHILM3ZP.js +1 -0
  94. package/dist/standalone/chunk-AQGOX5DK.js +1 -0
  95. package/dist/standalone/chunk-ASLGNHAX.js +1 -0
  96. package/dist/standalone/chunk-BHTPZS7L.js +4 -0
  97. package/dist/standalone/chunk-BJGBHGK3.js +1 -0
  98. package/dist/standalone/chunk-D7HKX4DI.js +1 -0
  99. package/dist/standalone/chunk-DGWTR4G7.js +1 -0
  100. package/dist/standalone/chunk-DSX53PBM.js +1 -0
  101. package/dist/standalone/chunk-DV2MNASX.js +1 -0
  102. package/dist/standalone/chunk-DWDILV2E.js +1 -0
  103. package/dist/standalone/chunk-E7AVZZKO.js +1 -0
  104. package/dist/standalone/chunk-EGJX34WM.js +1 -0
  105. package/dist/standalone/chunk-FCR3HKFV.js +1 -0
  106. package/dist/standalone/chunk-FKO3HO6I.js +4 -0
  107. package/dist/standalone/chunk-FQKNJSRA.js +76 -0
  108. package/dist/standalone/chunk-G2TFEWEQ.js +4 -0
  109. package/dist/standalone/chunk-GABMIICA.js +1 -0
  110. package/dist/standalone/chunk-GTM65MVX.js +1 -0
  111. package/dist/standalone/chunk-GZXPPJVK.js +1 -0
  112. package/dist/standalone/chunk-HFBRE65A.js +1 -0
  113. package/dist/standalone/chunk-HFMQNUBC.js +1 -0
  114. package/dist/standalone/chunk-HG7Q5B3H.js +1 -0
  115. package/dist/standalone/chunk-HTQL7AXU.js +1 -0
  116. package/dist/standalone/chunk-HV7G6DFP.js +5 -0
  117. package/dist/standalone/chunk-ITLLHEVG.js +1 -0
  118. package/dist/standalone/chunk-J6J54MBP.js +1 -0
  119. package/dist/standalone/chunk-JSEXCW5Q.js +1 -0
  120. package/dist/standalone/chunk-KEGAWN6Y.js +1 -0
  121. package/dist/standalone/chunk-KG3QTFWE.js +1 -0
  122. package/dist/standalone/chunk-KGS7KM4A.js +2 -0
  123. package/dist/standalone/chunk-KODWGUAB.js +1 -0
  124. package/dist/standalone/chunk-KZ6INM5M.js +1 -0
  125. package/dist/standalone/chunk-MGFEVTRI.js +1 -0
  126. package/dist/standalone/chunk-N2QDG3MW.js +1 -0
  127. package/dist/standalone/chunk-N4JI6VQD.js +1 -0
  128. package/dist/standalone/chunk-NNISYDNI.js +1 -0
  129. package/dist/standalone/chunk-O4PXDNR3.js +1 -0
  130. package/dist/standalone/chunk-O77VNUFD.js +1 -0
  131. package/dist/standalone/chunk-OD2POGPJ.js +1 -0
  132. package/dist/standalone/chunk-OXCK3ZUG.js +1 -0
  133. package/dist/standalone/chunk-P7DSVO4U.js +1 -0
  134. package/dist/standalone/chunk-PKAM3N5C.js +1 -0
  135. package/dist/standalone/chunk-QGXGBHQO.js +1 -0
  136. package/dist/standalone/chunk-QHA3TAEJ.js +1 -0
  137. package/dist/standalone/chunk-QQWC62X7.js +1 -0
  138. package/dist/standalone/chunk-RMYA7NAH.js +1 -0
  139. package/dist/standalone/chunk-RRCPZMC2.js +22 -0
  140. package/dist/standalone/chunk-S53RUBW5.js +1 -0
  141. package/dist/standalone/chunk-SB4GT6PK.js +1 -0
  142. package/dist/standalone/chunk-SEU5V7I6.js +1 -0
  143. package/dist/standalone/chunk-SHIOUDOT.js +1 -0
  144. package/dist/standalone/chunk-SIDRSX7Y.js +1 -0
  145. package/dist/standalone/chunk-SVR644RF.js +1 -0
  146. package/dist/standalone/chunk-TAD43CG5.js +1 -0
  147. package/dist/standalone/chunk-TBMYIZIO.js +1 -0
  148. package/dist/standalone/chunk-TICVNLPM.js +1 -0
  149. package/dist/standalone/chunk-TQ36RWOP.js +1 -0
  150. package/dist/standalone/chunk-UGMRUEBU.js +1 -0
  151. package/dist/standalone/chunk-UII66UVF.js +1 -0
  152. package/dist/standalone/chunk-VJPQUBN6.js +8 -0
  153. package/dist/standalone/chunk-VLXV72QE.js +1 -0
  154. package/dist/standalone/chunk-VMJKJWG6.js +1 -0
  155. package/dist/standalone/chunk-VPDPN5RR.js +2 -0
  156. package/dist/standalone/chunk-VSEGZA3J.js +1 -0
  157. package/dist/standalone/chunk-VXBZQIGY.js +4 -0
  158. package/dist/standalone/chunk-W7PCVQTE.js +1 -0
  159. package/dist/standalone/chunk-XLILSHPE.js +1 -0
  160. package/dist/standalone/chunk-XURNGQSS.js +1 -0
  161. package/dist/standalone/chunk-YJGANMU7.js +18 -0
  162. package/dist/standalone/chunk-YQQJ4N6U.js +1 -0
  163. package/dist/standalone/chunk-ZH7UES4T.js +2 -0
  164. package/dist/standalone/chunk-ZPUO7FNI.js +1 -0
  165. package/dist/standalone/chunk-ZQCVDXDL.js +1 -0
  166. package/dist/standalone/studio.js +104 -246
  167. package/dist/styles.css +1 -1
  168. package/package.json +13 -12
  169. package/dist/packem_shared/SettingsPanel-C0uLRf5P.js +0 -176
  170. package/dist/packem_shared/SqlEditorPanel-CguV7otm.js +0 -13
  171. package/dist/packem_shared/Studio-DFWAlcuf.js +0 -33
  172. package/dist/packem_shared/studio-Bj8psK1c.js +0 -10303
  173. package/dist/packem_shared/use-live-admin-Dq6g3daN.js +0 -73
  174. package/dist/packem_shared/use-live-shard-seed-Cuk3dnH0.js +0 -76
@@ -0,0 +1,670 @@
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 { C as Card, a as CardContent } from '../packem_shared/card-DURq3ElK.js';
6
+ import { E as EmptyState } from '../packem_shared/empty-state-DY_oe0k6.js';
7
+ import { T as Table, a as TableHeader, b as TableRow, c as TableHead, d as TableBody, e as TableCell } from '../packem_shared/table-DsCa9Qp9.js';
8
+ import { a as useClientQuery } from '../packem_shared/use-admin-query-BViPA3US.js';
9
+ import { u as useAuthCapabilities } from '../packem_shared/use-auth-capabilities-BHkoBnbZ.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 { d as formatCell, g as formatTimestamp, f as fireAndForget } from '../packem_shared/internal-FcNZ3beb.js';
13
+ import { jsxDEV } from 'react/jsx-dev-runtime';
14
+
15
+ const OrgRowTable = (t0) => {
16
+ const $ = c(35);
17
+ const {
18
+ actionLabel,
19
+ actionPrefix,
20
+ columns,
21
+ heading,
22
+ onAction,
23
+ rowPrefix,
24
+ rows,
25
+ testId
26
+ } = t0;
27
+ const t = useT();
28
+ let t1;
29
+ if ($[0] !== heading) {
30
+ t1 = /* @__PURE__ */ jsxDEV("header", {
31
+ className: "border-b border-border px-4 py-3",
32
+ children: /* @__PURE__ */ jsxDEV("span", {
33
+ className: "font-mono text-[11px] tracking-wide text-muted-foreground uppercase",
34
+ children: heading
35
+ }, void 0, false)
36
+ }, void 0, false);
37
+ $[0] = heading;
38
+ $[1] = t1;
39
+ } else {
40
+ t1 = $[1];
41
+ }
42
+ let t2;
43
+ if ($[2] !== columns) {
44
+ t2 = columns.map(_temp);
45
+ $[2] = columns;
46
+ $[3] = t2;
47
+ } else {
48
+ t2 = $[3];
49
+ }
50
+ let t3;
51
+ if ($[4] !== t) {
52
+ t3 = t("Actions");
53
+ $[4] = t;
54
+ $[5] = t3;
55
+ } else {
56
+ t3 = $[5];
57
+ }
58
+ let t4;
59
+ if ($[6] !== t3) {
60
+ t4 = /* @__PURE__ */ jsxDEV(TableHead, {
61
+ "aria-label": t3
62
+ }, void 0, false);
63
+ $[6] = t3;
64
+ $[7] = t4;
65
+ } else {
66
+ t4 = $[7];
67
+ }
68
+ let t5;
69
+ if ($[8] !== t2 || $[9] !== t4) {
70
+ t5 = /* @__PURE__ */ jsxDEV(TableHeader, {
71
+ children: /* @__PURE__ */ jsxDEV(TableRow, {
72
+ children: [t2, t4]
73
+ }, void 0, true)
74
+ }, void 0, false);
75
+ $[8] = t2;
76
+ $[9] = t4;
77
+ $[10] = t5;
78
+ } else {
79
+ t5 = $[10];
80
+ }
81
+ let t6;
82
+ if ($[11] !== actionLabel || $[12] !== actionPrefix || $[13] !== columns || $[14] !== onAction || $[15] !== rowPrefix || $[16] !== rows) {
83
+ let t72;
84
+ if ($[18] !== actionLabel || $[19] !== actionPrefix || $[20] !== columns || $[21] !== onAction || $[22] !== rowPrefix) {
85
+ t72 = (row) => {
86
+ const id = formatCell(row.id);
87
+ return /* @__PURE__ */ jsxDEV(TableRow, {
88
+ "data-testid": `${rowPrefix}-${id}`,
89
+ children: [columns.map((column_0) => /* @__PURE__ */ jsxDEV(TableCell, {
90
+ children: column_0.render(row)
91
+ }, column_0.head, false)), /* @__PURE__ */ jsxDEV(TableCell, {
92
+ children: /* @__PURE__ */ jsxDEV(Button, {
93
+ "data-testid": `${actionPrefix}-${id}`,
94
+ onClick: () => {
95
+ onAction(id);
96
+ },
97
+ size: "xs",
98
+ type: "button",
99
+ variant: "ghost",
100
+ children: actionLabel
101
+ }, void 0, false)
102
+ }, void 0, false)]
103
+ }, id, true);
104
+ };
105
+ $[18] = actionLabel;
106
+ $[19] = actionPrefix;
107
+ $[20] = columns;
108
+ $[21] = onAction;
109
+ $[22] = rowPrefix;
110
+ $[23] = t72;
111
+ } else {
112
+ t72 = $[23];
113
+ }
114
+ t6 = rows.map(t72);
115
+ $[11] = actionLabel;
116
+ $[12] = actionPrefix;
117
+ $[13] = columns;
118
+ $[14] = onAction;
119
+ $[15] = rowPrefix;
120
+ $[16] = rows;
121
+ $[17] = t6;
122
+ } else {
123
+ t6 = $[17];
124
+ }
125
+ let t7;
126
+ if ($[24] !== t6) {
127
+ t7 = /* @__PURE__ */ jsxDEV(TableBody, {
128
+ children: t6
129
+ }, void 0, false);
130
+ $[24] = t6;
131
+ $[25] = t7;
132
+ } else {
133
+ t7 = $[25];
134
+ }
135
+ let t8;
136
+ if ($[26] !== t5 || $[27] !== t7) {
137
+ t8 = /* @__PURE__ */ jsxDEV(CardContent, {
138
+ className: "px-0",
139
+ children: /* @__PURE__ */ jsxDEV(Table, {
140
+ children: [t5, t7]
141
+ }, void 0, true)
142
+ }, void 0, false);
143
+ $[26] = t5;
144
+ $[27] = t7;
145
+ $[28] = t8;
146
+ } else {
147
+ t8 = $[28];
148
+ }
149
+ let t9;
150
+ if ($[29] !== t1 || $[30] !== t8) {
151
+ t9 = /* @__PURE__ */ jsxDEV(Card, {
152
+ className: "overflow-hidden py-0",
153
+ children: [t1, t8]
154
+ }, void 0, true);
155
+ $[29] = t1;
156
+ $[30] = t8;
157
+ $[31] = t9;
158
+ } else {
159
+ t9 = $[31];
160
+ }
161
+ let t10;
162
+ if ($[32] !== t9 || $[33] !== testId) {
163
+ t10 = /* @__PURE__ */ jsxDEV("div", {
164
+ className: "flex flex-col gap-2",
165
+ "data-testid": testId,
166
+ children: t9
167
+ }, void 0, false);
168
+ $[32] = t9;
169
+ $[33] = testId;
170
+ $[34] = t10;
171
+ } else {
172
+ t10 = $[34];
173
+ }
174
+ return t10;
175
+ };
176
+ const OrganizationsPanel = () => {
177
+ const $ = c(95);
178
+ const client = useLunora();
179
+ const t = useT();
180
+ const {
181
+ capabilities,
182
+ ready
183
+ } = useAuthCapabilities();
184
+ const [selected, setSelected] = useState(null);
185
+ let t0;
186
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
187
+ t0 = ["lunora-auth-orgs"];
188
+ $[0] = t0;
189
+ } else {
190
+ t0 = $[0];
191
+ }
192
+ let t1;
193
+ if ($[1] !== client) {
194
+ t1 = () => client.listAuthOrganizations({
195
+ limit: 100
196
+ });
197
+ $[1] = client;
198
+ $[2] = t1;
199
+ } else {
200
+ t1 = $[2];
201
+ }
202
+ let t2;
203
+ if ($[3] !== capabilities.organization) {
204
+ t2 = {
205
+ enabled: capabilities.organization
206
+ };
207
+ $[3] = capabilities.organization;
208
+ $[4] = t2;
209
+ } else {
210
+ t2 = $[4];
211
+ }
212
+ const orgsQuery = useClientQuery(t0, t1, t2);
213
+ const orgs = orgsQuery.data?.rows ?? null;
214
+ let t3;
215
+ if ($[5] !== selected) {
216
+ t3 = ["lunora-auth-org-members", selected];
217
+ $[5] = selected;
218
+ $[6] = t3;
219
+ } else {
220
+ t3 = $[6];
221
+ }
222
+ let t4;
223
+ if ($[7] !== client || $[8] !== selected) {
224
+ t4 = () => client.listAuthOrgMembers({
225
+ limit: 200,
226
+ organizationId: selected ?? ""
227
+ });
228
+ $[7] = client;
229
+ $[8] = selected;
230
+ $[9] = t4;
231
+ } else {
232
+ t4 = $[9];
233
+ }
234
+ const t5 = selected !== null;
235
+ let t6;
236
+ if ($[10] !== t5) {
237
+ t6 = {
238
+ enabled: t5
239
+ };
240
+ $[10] = t5;
241
+ $[11] = t6;
242
+ } else {
243
+ t6 = $[11];
244
+ }
245
+ const membersQuery = useClientQuery(t3, t4, t6);
246
+ let t7;
247
+ if ($[12] !== selected) {
248
+ t7 = ["lunora-auth-org-invitations", selected];
249
+ $[12] = selected;
250
+ $[13] = t7;
251
+ } else {
252
+ t7 = $[13];
253
+ }
254
+ let t8;
255
+ if ($[14] !== client || $[15] !== selected) {
256
+ t8 = () => client.listAuthOrgInvitations({
257
+ limit: 200,
258
+ organizationId: selected ?? ""
259
+ });
260
+ $[14] = client;
261
+ $[15] = selected;
262
+ $[16] = t8;
263
+ } else {
264
+ t8 = $[16];
265
+ }
266
+ const t9 = selected !== null;
267
+ let t10;
268
+ if ($[17] !== t9) {
269
+ t10 = {
270
+ enabled: t9
271
+ };
272
+ $[17] = t9;
273
+ $[18] = t10;
274
+ } else {
275
+ t10 = $[18];
276
+ }
277
+ const invitationsQuery = useClientQuery(t7, t8, t10);
278
+ const members = selected === null ? null : membersQuery.data?.rows ?? null;
279
+ const invitations = selected === null ? null : invitationsQuery.data?.rows ?? null;
280
+ const error = orgsQuery.error ?? membersQuery.error ?? invitationsQuery.error;
281
+ let t11;
282
+ if ($[19] !== invitationsQuery || $[20] !== membersQuery || $[21] !== orgsQuery || $[22] !== selected) {
283
+ t11 = () => {
284
+ orgsQuery.refetch();
285
+ if (selected !== null) {
286
+ membersQuery.refetch();
287
+ invitationsQuery.refetch();
288
+ }
289
+ };
290
+ $[19] = invitationsQuery;
291
+ $[20] = membersQuery;
292
+ $[21] = orgsQuery;
293
+ $[22] = selected;
294
+ $[23] = t11;
295
+ } else {
296
+ t11 = $[23];
297
+ }
298
+ useAutoRefresh(t11, capabilities.organization);
299
+ let t12;
300
+ if ($[24] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
301
+ t12 = (id) => {
302
+ setSelected(id);
303
+ };
304
+ $[24] = t12;
305
+ } else {
306
+ t12 = $[24];
307
+ }
308
+ const onSelectOrg = t12;
309
+ let t13;
310
+ if ($[25] !== invitationsQuery || $[26] !== membersQuery) {
311
+ t13 = (action) => {
312
+ fireAndForget((async () => {
313
+ await action();
314
+ membersQuery.refetch();
315
+ invitationsQuery.refetch();
316
+ })());
317
+ };
318
+ $[25] = invitationsQuery;
319
+ $[26] = membersQuery;
320
+ $[27] = t13;
321
+ } else {
322
+ t13 = $[27];
323
+ }
324
+ const runOrgAction = t13;
325
+ let t14;
326
+ if ($[28] !== client || $[29] !== runOrgAction) {
327
+ t14 = (memberId) => {
328
+ runOrgAction(() => client.removeAuthOrgMember({
329
+ memberId
330
+ }));
331
+ };
332
+ $[28] = client;
333
+ $[29] = runOrgAction;
334
+ $[30] = t14;
335
+ } else {
336
+ t14 = $[30];
337
+ }
338
+ const onRemoveMember = t14;
339
+ let t15;
340
+ if ($[31] !== client || $[32] !== runOrgAction) {
341
+ t15 = (invitationId) => {
342
+ runOrgAction(() => client.cancelAuthOrgInvitation({
343
+ invitationId
344
+ }));
345
+ };
346
+ $[31] = client;
347
+ $[32] = runOrgAction;
348
+ $[33] = t15;
349
+ } else {
350
+ t15 = $[33];
351
+ }
352
+ const onCancelInvitation = t15;
353
+ let t16;
354
+ if ($[34] !== t) {
355
+ t16 = t("userId");
356
+ $[34] = t;
357
+ $[35] = t16;
358
+ } else {
359
+ t16 = $[35];
360
+ }
361
+ let t17;
362
+ if ($[36] !== t16) {
363
+ t17 = {
364
+ head: t16,
365
+ render: _temp2
366
+ };
367
+ $[36] = t16;
368
+ $[37] = t17;
369
+ } else {
370
+ t17 = $[37];
371
+ }
372
+ let t18;
373
+ if ($[38] !== t) {
374
+ t18 = t("role");
375
+ $[38] = t;
376
+ $[39] = t18;
377
+ } else {
378
+ t18 = $[39];
379
+ }
380
+ let t19;
381
+ if ($[40] !== t18) {
382
+ t19 = {
383
+ head: t18,
384
+ render: _temp3
385
+ };
386
+ $[40] = t18;
387
+ $[41] = t19;
388
+ } else {
389
+ t19 = $[41];
390
+ }
391
+ let t20;
392
+ if ($[42] !== t17 || $[43] !== t19) {
393
+ t20 = [t17, t19];
394
+ $[42] = t17;
395
+ $[43] = t19;
396
+ $[44] = t20;
397
+ } else {
398
+ t20 = $[44];
399
+ }
400
+ const memberColumns = t20;
401
+ let t21;
402
+ if ($[45] !== t) {
403
+ t21 = t("email");
404
+ $[45] = t;
405
+ $[46] = t21;
406
+ } else {
407
+ t21 = $[46];
408
+ }
409
+ let t22;
410
+ if ($[47] !== t21) {
411
+ t22 = {
412
+ head: t21,
413
+ render: _temp4
414
+ };
415
+ $[47] = t21;
416
+ $[48] = t22;
417
+ } else {
418
+ t22 = $[48];
419
+ }
420
+ let t23;
421
+ if ($[49] !== t) {
422
+ t23 = t("role");
423
+ $[49] = t;
424
+ $[50] = t23;
425
+ } else {
426
+ t23 = $[50];
427
+ }
428
+ let t24;
429
+ if ($[51] !== t23) {
430
+ t24 = {
431
+ head: t23,
432
+ render: _temp5
433
+ };
434
+ $[51] = t23;
435
+ $[52] = t24;
436
+ } else {
437
+ t24 = $[52];
438
+ }
439
+ let t25;
440
+ if ($[53] !== t) {
441
+ t25 = t("status");
442
+ $[53] = t;
443
+ $[54] = t25;
444
+ } else {
445
+ t25 = $[54];
446
+ }
447
+ let t26;
448
+ if ($[55] !== t25) {
449
+ t26 = {
450
+ head: t25,
451
+ render: _temp6
452
+ };
453
+ $[55] = t25;
454
+ $[56] = t26;
455
+ } else {
456
+ t26 = $[56];
457
+ }
458
+ let t27;
459
+ if ($[57] !== t22 || $[58] !== t24 || $[59] !== t26) {
460
+ t27 = [t22, t24, t26];
461
+ $[57] = t22;
462
+ $[58] = t24;
463
+ $[59] = t26;
464
+ $[60] = t27;
465
+ } else {
466
+ t27 = $[60];
467
+ }
468
+ const invitationColumns = t27;
469
+ if (ready && !capabilities.organization) {
470
+ let t282;
471
+ if ($[61] !== t) {
472
+ t282 = t("Enable the organization() plugin in your auth config to manage organizations here.");
473
+ $[61] = t;
474
+ $[62] = t282;
475
+ } else {
476
+ t282 = $[62];
477
+ }
478
+ let t292;
479
+ if ($[63] !== t) {
480
+ t292 = t("Organizations are not enabled.");
481
+ $[63] = t;
482
+ $[64] = t292;
483
+ } else {
484
+ t292 = $[64];
485
+ }
486
+ let t302;
487
+ if ($[65] !== t282 || $[66] !== t292) {
488
+ t302 = /* @__PURE__ */ jsxDEV(EmptyState, {
489
+ description: t282,
490
+ testId: "org-disabled",
491
+ title: t292
492
+ }, void 0, false);
493
+ $[65] = t282;
494
+ $[66] = t292;
495
+ $[67] = t302;
496
+ } else {
497
+ t302 = $[67];
498
+ }
499
+ return t302;
500
+ }
501
+ let t28;
502
+ if ($[68] !== error) {
503
+ t28 = error !== null && /* @__PURE__ */ jsxDEV("p", {
504
+ className: "text-sm text-destructive",
505
+ "data-testid": "org-error",
506
+ role: "alert",
507
+ children: error
508
+ }, void 0, false);
509
+ $[68] = error;
510
+ $[69] = t28;
511
+ } else {
512
+ t28 = $[69];
513
+ }
514
+ let t29;
515
+ if ($[70] !== orgs || $[71] !== t) {
516
+ t29 = orgs !== null && orgs.length === 0 && /* @__PURE__ */ jsxDEV(EmptyState, {
517
+ testId: "org-empty",
518
+ title: t("No organizations.")
519
+ }, void 0, false);
520
+ $[70] = orgs;
521
+ $[71] = t;
522
+ $[72] = t29;
523
+ } else {
524
+ t29 = $[72];
525
+ }
526
+ let t30;
527
+ if ($[73] !== orgs || $[74] !== selected || $[75] !== t) {
528
+ t30 = orgs !== null && orgs.length > 0 && /* @__PURE__ */ jsxDEV(Card, {
529
+ className: "overflow-hidden py-0",
530
+ children: /* @__PURE__ */ jsxDEV(CardContent, {
531
+ className: "px-0",
532
+ children: /* @__PURE__ */ jsxDEV(Table, {
533
+ "data-testid": "org-table",
534
+ children: [/* @__PURE__ */ jsxDEV(TableHeader, {
535
+ children: /* @__PURE__ */ jsxDEV(TableRow, {
536
+ children: [/* @__PURE__ */ jsxDEV(TableHead, {
537
+ children: t("id")
538
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
539
+ children: t("name")
540
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
541
+ children: t("slug")
542
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
543
+ children: t("created")
544
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
545
+ "aria-label": t("Actions")
546
+ }, void 0, false)]
547
+ }, void 0, true)
548
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
549
+ children: orgs.map((org) => {
550
+ const id_0 = formatCell(org.id);
551
+ return /* @__PURE__ */ jsxDEV(TableRow, {
552
+ "data-testid": `org-row-${id_0}`,
553
+ children: [/* @__PURE__ */ jsxDEV(TableCell, {
554
+ className: "font-mono text-xs",
555
+ children: id_0
556
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
557
+ children: formatCell(org.name)
558
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
559
+ children: formatCell(org.slug)
560
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
561
+ className: "text-muted-foreground tabular-nums",
562
+ children: formatTimestamp(org.createdAt)
563
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
564
+ children: /* @__PURE__ */ jsxDEV(Button, {
565
+ "aria-pressed": selected === id_0,
566
+ "data-testid": `org-select-${id_0}`,
567
+ onClick: () => {
568
+ onSelectOrg(id_0);
569
+ },
570
+ size: "xs",
571
+ type: "button",
572
+ variant: "ghost",
573
+ children: t("Members")
574
+ }, void 0, false)
575
+ }, void 0, false)]
576
+ }, id_0, true);
577
+ })
578
+ }, void 0, false)]
579
+ }, void 0, true)
580
+ }, void 0, false)
581
+ }, void 0, false);
582
+ $[73] = orgs;
583
+ $[74] = selected;
584
+ $[75] = t;
585
+ $[76] = t30;
586
+ } else {
587
+ t30 = $[76];
588
+ }
589
+ let t31;
590
+ if ($[77] !== memberColumns || $[78] !== members || $[79] !== onRemoveMember || $[80] !== selected || $[81] !== t) {
591
+ t31 = selected !== null && members !== null && /* @__PURE__ */ jsxDEV(OrgRowTable, {
592
+ actionLabel: t("Remove"),
593
+ actionPrefix: "org-remove-member",
594
+ columns: memberColumns,
595
+ heading: t("Members"),
596
+ onAction: onRemoveMember,
597
+ rowPrefix: "org-member",
598
+ rows: members,
599
+ testId: "org-members"
600
+ }, void 0, false);
601
+ $[77] = memberColumns;
602
+ $[78] = members;
603
+ $[79] = onRemoveMember;
604
+ $[80] = selected;
605
+ $[81] = t;
606
+ $[82] = t31;
607
+ } else {
608
+ t31 = $[82];
609
+ }
610
+ let t32;
611
+ if ($[83] !== invitationColumns || $[84] !== invitations || $[85] !== onCancelInvitation || $[86] !== selected || $[87] !== t) {
612
+ t32 = selected !== null && invitations !== null && invitations.length > 0 && /* @__PURE__ */ jsxDEV(OrgRowTable, {
613
+ actionLabel: t("Cancel"),
614
+ actionPrefix: "org-cancel-invitation",
615
+ columns: invitationColumns,
616
+ heading: t("Invitations"),
617
+ onAction: onCancelInvitation,
618
+ rowPrefix: "org-invitation",
619
+ rows: invitations,
620
+ testId: "org-invitations"
621
+ }, void 0, false);
622
+ $[83] = invitationColumns;
623
+ $[84] = invitations;
624
+ $[85] = onCancelInvitation;
625
+ $[86] = selected;
626
+ $[87] = t;
627
+ $[88] = t32;
628
+ } else {
629
+ t32 = $[88];
630
+ }
631
+ let t33;
632
+ if ($[89] !== t28 || $[90] !== t29 || $[91] !== t30 || $[92] !== t31 || $[93] !== t32) {
633
+ t33 = /* @__PURE__ */ jsxDEV("div", {
634
+ className: "flex flex-col gap-4",
635
+ "data-testid": "lunora-organizations",
636
+ children: [t28, t29, t30, t31, t32]
637
+ }, void 0, true);
638
+ $[89] = t28;
639
+ $[90] = t29;
640
+ $[91] = t30;
641
+ $[92] = t31;
642
+ $[93] = t32;
643
+ $[94] = t33;
644
+ } else {
645
+ t33 = $[94];
646
+ }
647
+ return t33;
648
+ };
649
+ function _temp(column) {
650
+ return /* @__PURE__ */ jsxDEV(TableHead, {
651
+ children: column.head
652
+ }, column.head, false);
653
+ }
654
+ function _temp2(row) {
655
+ return formatCell(row.userId);
656
+ }
657
+ function _temp3(row_0) {
658
+ return formatCell(row_0.role);
659
+ }
660
+ function _temp4(row_1) {
661
+ return formatCell(row_1.email);
662
+ }
663
+ function _temp5(row_2) {
664
+ return formatCell(row_2.role);
665
+ }
666
+ function _temp6(row_3) {
667
+ return formatCell(row_3.status);
668
+ }
669
+
670
+ export { OrganizationsPanel };