@mcp-use/inspector 20.0.0-beta.13 → 20.0.0-beta.15

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 (145) hide show
  1. package/README.md +4 -4
  2. package/dist/cdn/inspector.js +76858 -9272
  3. package/dist/cli.js +69 -24
  4. package/dist/server/asset-urls.d.ts +1 -4
  5. package/dist/server/asset-urls.d.ts.map +1 -1
  6. package/dist/server/asset-urls.js +3 -7
  7. package/dist/server/cdn-shell.d.ts.map +1 -1
  8. package/dist/server/cdn-shell.js +3 -3
  9. package/dist/server/{chunk-H6ZCIKBS.js → chunk-JZT7N2BJ.js} +10 -15
  10. package/dist/server/{chunk-YAYRN4DW.js → chunk-WNQGHIZ3.js} +61 -15
  11. package/dist/server/{chunk-QQP554HG.js → chunk-XKCUJ6ZJ.js} +1 -1
  12. package/dist/server/{chunk-2XQWLYOZ.js → chunk-ZPGABKXL.js} +1 -1
  13. package/dist/server/cli.js +3 -3
  14. package/dist/server/index.js +4 -4
  15. package/dist/server/middleware.js +4 -4
  16. package/dist/server/version.js +1 -1
  17. package/dist/web/assets/index-Bqfsh_Rp.js +643 -0
  18. package/dist/web/index.html +2 -10
  19. package/package.json +2 -2
  20. package/dist/cdn/AnimatePresence-D1bZ5_-l.js +0 -394
  21. package/dist/cdn/ChatTab-CokP5UlL.js +0 -6811
  22. package/dist/cdn/CheckboxIndicator-BjF73mGX.js +0 -252
  23. package/dist/cdn/ConnectionSettingsForm-CXCKdMZh.js +0 -929
  24. package/dist/cdn/ConnectionSettingsTab-Ag4WD55h.js +0 -151
  25. package/dist/cdn/ElicitationTab-PEmEDvC5.js +0 -655
  26. package/dist/cdn/FormContext-NtUiZclE.js +0 -135
  27. package/dist/cdn/InspectorContext-BBKCdfmK.js +0 -123
  28. package/dist/cdn/JSONDisplay-BJqMz7Ny.js +0 -324
  29. package/dist/cdn/ListTabHeader-DzmTtN1e.js +0 -89
  30. package/dist/cdn/MCPAppsDebugControls-C01DPDJv.js +0 -2174
  31. package/dist/cdn/ManufactOAuthCallback-ChbbjFIT.js +0 -31
  32. package/dist/cdn/MarkdownRenderer-CrG5JHAZ.js +0 -3610
  33. package/dist/cdn/McpAppsViewPanel-07_iHrne.js +0 -56
  34. package/dist/cdn/NotificationsTab-B7uebqMV.js +0 -290
  35. package/dist/cdn/OAuthCallback-Cku-R2uM.js +0 -58
  36. package/dist/cdn/PromptsTab-98ugje_q.js +0 -902
  37. package/dist/cdn/ResourcesTab-CxHilZjd.js +0 -566
  38. package/dist/cdn/SamplingTab-gOUjg7bt.js +0 -659
  39. package/dist/cdn/ServerMetadataTab-BM3VhSLf.js +0 -244
  40. package/dist/cdn/StatusIcon-Q3n3YRtE.js +0 -65
  41. package/dist/cdn/ToolsTab-Dm6n5OxE.js +0 -2045
  42. package/dist/cdn/ViewPreview-CCKWd8Qt.js +0 -238
  43. package/dist/cdn/WidgetDebugContext-B6yoOVVV.js +0 -314
  44. package/dist/cdn/WidgetWrapper-BlbQAh_X.js +0 -12
  45. package/dist/cdn/basePath-B8HuhIMu.js +0 -25
  46. package/dist/cdn/bell-GrTZcnD2.js +0 -10
  47. package/dist/cdn/browser-DG2Z8392.js +0 -42
  48. package/dist/cdn/brush-CelVvMGp.js +0 -17
  49. package/dist/cdn/button-CB4uOoUV.js +0 -2509
  50. package/dist/cdn/card-BA-DQk-G.js +0 -41
  51. package/dist/cdn/cfWorker-Bxcs9rNe.js +0 -10799
  52. package/dist/cdn/checkbox-kwVa4gRX.js +0 -20
  53. package/dist/cdn/chunk-QUQL4437-XnDcYQEx.js +0 -1508
  54. package/dist/cdn/clock-YMF8Gtw5.js +0 -12
  55. package/dist/cdn/code-C8sN2OGR.js +0 -10
  56. package/dist/cdn/createLucideIcon-BONxC1L5.js +0 -213
  57. package/dist/cdn/dialog-CJGnC5Ag.js +0 -1028
  58. package/dist/cdn/dist-C-AJLM5q.js +0 -2307
  59. package/dist/cdn/dist-CTJnCYmk.js +0 -616
  60. package/dist/cdn/external-link-Bo4lQxr1.js +0 -17
  61. package/dist/cdn/eye-pSGG7nvf.js +0 -29
  62. package/dist/cdn/folder-open-aM8CPtBO.js +0 -7
  63. package/dist/cdn/hash-DDs2vE1k.js +0 -33
  64. package/dist/cdn/history-BfUFpL1d.js +0 -17
  65. package/dist/cdn/index-browser-CCygKh3z.js +0 -1853
  66. package/dist/cdn/info-BMkB68mB.js +0 -19
  67. package/dist/cdn/input-BCpgLXU1.js +0 -9654
  68. package/dist/cdn/inspector-settings-layout-0VDsjeqb.js +0 -4
  69. package/dist/cdn/label-A0UGV8FE.js +0 -60
  70. package/dist/cdn/loader-circle-BKRHJEB7.js +0 -7
  71. package/dist/cdn/manufact-auth-BQMHhbLV.js +0 -423
  72. package/dist/cdn/maximize-2-DdrB_spi.js +0 -21
  73. package/dist/cdn/maximize-hSOCz133.js +0 -21
  74. package/dist/cdn/message-square-D3tKB3uJ.js +0 -7
  75. package/dist/cdn/not-found-BajFyZpp.js +0 -32
  76. package/dist/cdn/play-B1leulYf.js +0 -7
  77. package/dist/cdn/providerMeta-CjGU4rID.js +0 -436
  78. package/dist/cdn/react-BIs9pQ3H.js +0 -926
  79. package/dist/cdn/react-BiVEwoxA.js +0 -5421
  80. package/dist/cdn/refresh-cw-CyvXrS91.js +0 -21
  81. package/dist/cdn/save-CmdEPUAm.js +0 -34
  82. package/dist/cdn/schemaHelpers-DTV38jGq.js +0 -16
  83. package/dist/cdn/select-CCFHjOGk.js +0 -2595
  84. package/dist/cdn/servers-Dd0Vcp81.js +0 -30
  85. package/dist/cdn/shared-CJVHJhag.js +0 -1700
  86. package/dist/cdn/sheet-oyq1mIyg.js +0 -2078
  87. package/dist/cdn/sparkles-CxeZpVtX.js +0 -23
  88. package/dist/cdn/spinner-Be1GlSGX.js +0 -15
  89. package/dist/cdn/square-check-big-C_4wbfwF.js +0 -10
  90. package/dist/cdn/switch-DHXEA_N5.js +0 -665
  91. package/dist/cdn/tabs-subtle-Dubd6Kj8.js +0 -788
  92. package/dist/cdn/telemetry-DyrOzsAR.js +0 -208
  93. package/dist/cdn/textarea-CwmI8_uI.js +0 -14
  94. package/dist/cdn/trash-2-BhumJAFE.js +0 -25
  95. package/dist/cdn/useAriaLabelledBy-Cra6w3YY.js +0 -30
  96. package/dist/cdn/useCompositeItem-Dhnm-7el.js +0 -26
  97. package/dist/cdn/useConfig-BTDwEhra.js +0 -235
  98. package/dist/cdn/useSavedRequests-mSIsDd4c.js +0 -51
  99. package/dist/cdn/useViewHostProps-C5NRGTzJ.js +0 -364
  100. package/dist/cdn/wrench-DvK20LUT.js +0 -7
  101. package/dist/cdn/x-EilKPiCX.js +0 -10
  102. package/dist/cdn/zap-0Wr9QO7N.js +0 -10
  103. package/dist/web/assets/AnimatePresence-FfDQQNFJ.js +0 -9
  104. package/dist/web/assets/ChatTab-BEfFVccY.js +0 -18
  105. package/dist/web/assets/ConnectionSettingsTab-Bb_6a0Iv.js +0 -1
  106. package/dist/web/assets/ElicitationTab-BP4GKiyX.js +0 -1
  107. package/dist/web/assets/FormContext-sV-yByKz.js +0 -1
  108. package/dist/web/assets/ListTabHeader-CrGae306.js +0 -1
  109. package/dist/web/assets/MCPAppsDebugControls-BIyFdqol.js +0 -34
  110. package/dist/web/assets/ManufactOAuthCallback-C7FmBqhm.js +0 -1
  111. package/dist/web/assets/MarkdownRenderer-Dh79xxF3.js +0 -47
  112. package/dist/web/assets/McpAppsViewPanel-eC3j1-Vq.js +0 -1
  113. package/dist/web/assets/NotificationsTab-BiZcGnsE.js +0 -1
  114. package/dist/web/assets/OAuthCallback-0QMKMr_h.js +0 -1
  115. package/dist/web/assets/PromptsTab-DP25ApgP.js +0 -15
  116. package/dist/web/assets/ResourcesTab-CptaN3NT.js +0 -2
  117. package/dist/web/assets/SamplingTab-BcdnfiwQ.js +0 -1
  118. package/dist/web/assets/ServerMetadataTab-DfM-a-Kp.js +0 -1
  119. package/dist/web/assets/ToolsTab-hSGwy5-P.js +0 -8
  120. package/dist/web/assets/ViewPreview-r5Me72Dm.js +0 -1
  121. package/dist/web/assets/WidgetWrapper-cv_BM1bY.js +0 -1
  122. package/dist/web/assets/brush-DX0UZ_pI.js +0 -1
  123. package/dist/web/assets/button-C8Xa2k4x.js +0 -1
  124. package/dist/web/assets/checkbox-CiCqaf9B.js +0 -1
  125. package/dist/web/assets/code-B14rVdNt.js +0 -1
  126. package/dist/web/assets/createLucideIcon-BEHeJH0M.js +0 -1
  127. package/dist/web/assets/dist-igO5zKmw.js +0 -21
  128. package/dist/web/assets/index-lCF-0iyi.js +0 -499
  129. package/dist/web/assets/input-C0OQCUZy.js +0 -1
  130. package/dist/web/assets/inspector-settings-layout-yjKRJDai.js +0 -1
  131. package/dist/web/assets/label-CI7JWQOo.js +0 -1
  132. package/dist/web/assets/maximize-2-Br1WQzT2.js +0 -1
  133. package/dist/web/assets/maximize-CJNgRe6S.js +0 -1
  134. package/dist/web/assets/react-CU_d2d5K.js +0 -1
  135. package/dist/web/assets/refresh-cw-B5iaAZKn.js +0 -1
  136. package/dist/web/assets/save-TM6fvNrt.js +0 -1
  137. package/dist/web/assets/schemaHelpers-DLNTQr_6.js +0 -1
  138. package/dist/web/assets/select-D6jzbLJn.js +0 -1
  139. package/dist/web/assets/shared-ChslWC1c.js +0 -1
  140. package/dist/web/assets/sparkles-BGYTDThM.js +0 -1
  141. package/dist/web/assets/tabs-subtle-BqKfSXAk.js +0 -1
  142. package/dist/web/assets/textarea-CRTXuRmE.js +0 -1
  143. package/dist/web/assets/useConfig-BoaEj10z.js +0 -1
  144. package/dist/web/assets/useViewHostProps-BUcH84Z-.js +0 -1
  145. package/dist/web/assets/zap-BDWHCVHU.js +0 -1
@@ -1,4 +0,0 @@
1
- //#region src/client/lib/inspector-settings-layout.ts
2
- var e = "mx-auto w-full min-w-0 max-w-5xl space-y-6 px-5 pt-6 pb-6";
3
- //#endregion
4
- export { e as t };
@@ -1,60 +0,0 @@
1
- import { s as e, t } from "./react-BIs9pQ3H.js";
2
- import { n } from "./createLucideIcon-BONxC1L5.js";
3
- import { U as r, _ as i } from "./button-CB4uOoUV.js";
4
- //#region ../../node_modules/.pnpm/@base-ui+utils@0.3.1_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/utils/useControlled.mjs
5
- var a = /* @__PURE__ */ e(t(), 1);
6
- function o({ controlled: e, default: t, name: n, state: r = "value" }) {
7
- let { current: o } = a.useRef(e !== void 0), [c, l] = a.useState(t), u = o ? e : c;
8
- if (process.env.NODE_ENV !== "production") {
9
- a.useEffect(() => {
10
- o !== (e !== void 0) && i([
11
- `A component is changing the ${o ? "" : "un"}controlled ${r} state of ${n} to be ${o ? "un" : ""}controlled.`,
12
- "Elements should not switch from uncontrolled to controlled (or vice versa).",
13
- `Decide between using a controlled or uncontrolled ${n} element for the lifetime of the component.`,
14
- "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.",
15
- "More info: https://fb.me/react-controlled-components"
16
- ].join("\n"));
17
- }, [
18
- r,
19
- n,
20
- e
21
- ]);
22
- let { current: c } = a.useRef(t);
23
- a.useEffect(() => {
24
- !o && s(c) !== s(t) && i([`A component is changing the default ${r} state of an uncontrolled ${n} after being initialized. To suppress this warning opt to use a controlled ${n}.`].join("\n"));
25
- }, [t]);
26
- }
27
- return [u, a.useCallback((e) => {
28
- o || l(e);
29
- }, [])];
30
- }
31
- function s(e) {
32
- let t = 0, n = /* @__PURE__ */ new WeakMap();
33
- try {
34
- return JSON.stringify(e, function(e, r) {
35
- if (!(e === "_owner" && this != null && typeof this == "object" && "$$typeof" in this)) {
36
- if (typeof r == "bigint") return `__bigint__:${r}`;
37
- if (typeof r == "object" && r) {
38
- let e = n.get(r);
39
- if (e !== void 0) return `__object__:${e}`;
40
- n.set(r, t), t += 1;
41
- }
42
- return r;
43
- }
44
- }) ?? `__top__:${typeof e}`;
45
- } catch {
46
- return "__unserializable__";
47
- }
48
- }
49
- //#endregion
50
- //#region src/client/components/ui/label.tsx
51
- var c = n();
52
- function l({ className: e, ...t }) {
53
- return /* @__PURE__ */ (0, c.jsx)("label", {
54
- "data-slot": "label",
55
- className: r("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", e),
56
- ...t
57
- });
58
- }
59
- //#endregion
60
- export { o as n, l as t };
@@ -1,7 +0,0 @@
1
- import { t as e } from "./createLucideIcon-BONxC1L5.js";
2
- var t = e("loader-circle", [["path", {
3
- d: "M21 12a9 9 0 1 1-6.219-8.56",
4
- key: "13zald"
5
- }]]);
6
- //#endregion
7
- export { t };
@@ -1,423 +0,0 @@
1
- import { s as e, t } from "./react-BIs9pQ3H.js";
2
- import { n } from "./basePath-B8HuhIMu.js";
3
- //#region src/client/auth/manufact-auth.ts
4
- var r = /* @__PURE__ */ e(t(), 1), i = "openid profile email offline_access", a = "mcp-inspector:manufact-auth", o = "manufact:session-changed", s = {
5
- loaded: !0,
6
- authorizing: !1,
7
- accessToken: null,
8
- user: null,
9
- mode: null
10
- }, c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), f = null, p = !1;
11
- typeof window < "u" && window.addEventListener("message", (e) => {
12
- if (e.data?.type !== "manufact:invalidate-oauth-client") return;
13
- for (let e of c.keys()) h()?.removeItem(x(e, "client"));
14
- let t = f;
15
- !t || p || (p = !0, U(t, { isRetry: !0 }).finally(() => {
16
- p = !1;
17
- }));
18
- });
19
- function m(e) {
20
- let t = c.get(e);
21
- if (t) return t;
22
- let n = {
23
- ...s,
24
- loaded: !1
25
- };
26
- return c.set(e, n), n;
27
- }
28
- function h() {
29
- return typeof window > "u" ? null : window.localStorage;
30
- }
31
- function g(e) {
32
- return new URL(e).origin;
33
- }
34
- function _(e, t) {
35
- let n = new URL(e), r = new URL(t), i = new Set(["localhost", "127.0.0.1"]);
36
- return i.has(n.hostname) && i.has(r.hostname) ? n.origin === r.origin : (n.hostname === "manufact.com" || n.hostname.endsWith(".manufact.com")) && (r.hostname === "manufact.com" || r.hostname.endsWith(".manufact.com"));
37
- }
38
- function v(e) {
39
- let t = window.__MANUFACT_LOGIN_URL__;
40
- if (t) return new URL(t).origin;
41
- let n = new URL(e);
42
- return n.hostname === "localhost" || n.hostname === "127.0.0.1" ? `${n.protocol}//${n.hostname}:3000` : `${n.protocol}//manufact.com`;
43
- }
44
- function y(e) {
45
- return `${v(e)}/login`;
46
- }
47
- function b(e) {
48
- return `${v(e)}/auth/embedded-sign-out`;
49
- }
50
- function x(e, t) {
51
- return `${a}:${t}:${e}`;
52
- }
53
- function S(e) {
54
- return h()?.getItem(x(e, "skip-session")) === "1";
55
- }
56
- function C(e, t) {
57
- let n = x(e, "skip-session");
58
- t ? h()?.setItem(n, "1") : h()?.removeItem(n);
59
- }
60
- function w(e) {
61
- return `${a}:state:${e}`;
62
- }
63
- function T(e) {
64
- let t = h()?.getItem(e);
65
- if (!t) return null;
66
- try {
67
- return JSON.parse(t);
68
- } catch {
69
- return h()?.removeItem(e), null;
70
- }
71
- }
72
- function E(e, t) {
73
- h()?.setItem(e, JSON.stringify(t));
74
- }
75
- function D(e, t) {
76
- c.set(e, {
77
- ...c.get(e) ?? s,
78
- ...t
79
- }), l.forEach((e) => e()), window.dispatchEvent(new CustomEvent(o));
80
- }
81
- function O(e) {
82
- let t = "";
83
- return e.forEach((e) => {
84
- t += String.fromCharCode(e);
85
- }), btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
86
- }
87
- function k(e = 32) {
88
- let t = new Uint8Array(e);
89
- return crypto.getRandomValues(t), O(t);
90
- }
91
- async function A(e) {
92
- let t = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(e));
93
- return O(new Uint8Array(t));
94
- }
95
- async function j(e) {
96
- let t = await fetch(`${e}/api/auth/.well-known/openid-configuration`);
97
- if (!t.ok) throw Error("Manufact OAuth discovery failed");
98
- return await t.json();
99
- }
100
- function M() {
101
- return `${window.location.origin}${n()}/auth/callback`;
102
- }
103
- function N(e) {
104
- return e === "localhost" || e === "127.0.0.1";
105
- }
106
- function P(e) {
107
- try {
108
- let t = new URL(e).hostname, n = typeof window < "u" ? new URL(window.location.href).hostname : "";
109
- return N(t) && N(n);
110
- } catch {
111
- return !1;
112
- }
113
- }
114
- async function F(e, t, n) {
115
- let r = new URL(`${e}/api/auth/oauth2/authorize`);
116
- r.searchParams.set("response_type", "code"), r.searchParams.set("client_id", t), r.searchParams.set("redirect_uri", n), r.searchParams.set("scope", i), r.searchParams.set("code_challenge", await A(k(32))), r.searchParams.set("code_challenge_method", "S256"), r.searchParams.set("state", "client-probe"), r.searchParams.set("prompt", "none");
117
- try {
118
- let e = await fetch(r.toString(), {
119
- method: "GET",
120
- redirect: "manual",
121
- credentials: "include"
122
- }), t = e.headers.get("location") ?? "";
123
- return t.includes("/auth/error") && t.includes("invalid_client") ? !1 : e.status >= 300 && e.status < 400 || e.type === "opaqueredirect" ? !!t && !t.includes("/auth/error") : !0;
124
- } catch {
125
- return !1;
126
- }
127
- }
128
- async function I(e, t) {
129
- let n = M(), r = x(e, "client"), a = T(r), o = P(e);
130
- if (!o && a?.client_id && a.redirect_uri === n) {
131
- if (await F(e, a.client_id, n)) return a;
132
- h()?.removeItem(r);
133
- } else o && a?.client_id && h()?.removeItem(r);
134
- if (!t.registration_endpoint) throw Error("Manufact OAuth registration is unavailable");
135
- let s = await fetch(t.registration_endpoint, {
136
- method: "POST",
137
- headers: { "Content-Type": "application/json" },
138
- body: JSON.stringify({
139
- client_name: "mcp-use Inspector",
140
- redirect_uris: [n],
141
- grant_types: ["authorization_code", "refresh_token"],
142
- response_types: ["code"],
143
- token_endpoint_auth_method: "none",
144
- scope: i
145
- })
146
- });
147
- if (!s.ok) throw Error("Could not register Inspector with Manufact");
148
- let c = await s.json();
149
- if (!c.client_id) throw Error("Manufact returned no OAuth client ID");
150
- let l = {
151
- ...c,
152
- redirect_uri: n
153
- };
154
- return E(r, l), l;
155
- }
156
- async function L(e, t) {
157
- let n = await fetch(e, {
158
- method: "POST",
159
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
160
- body: new URLSearchParams(t)
161
- }), r = await n.json().catch(() => ({}));
162
- if (!n.ok || !r.access_token) throw Error(r.error_description ?? "Manufact token exchange failed");
163
- return {
164
- access_token: r.access_token,
165
- refresh_token: r.refresh_token,
166
- token_type: r.token_type,
167
- expires_at: Date.now() + (r.expires_in ?? 3600) * 1e3
168
- };
169
- }
170
- async function R(e, t) {
171
- if (!t.refresh_token) return null;
172
- let n = d.get(e);
173
- if (n) return n;
174
- let r = (async () => {
175
- try {
176
- let n = await j(e), r = T(x(e, "client"));
177
- if (!r?.client_id) return null;
178
- let i = await L(n.token_endpoint, {
179
- grant_type: "refresh_token",
180
- refresh_token: t.refresh_token,
181
- client_id: r.client_id
182
- }), a = {
183
- ...i,
184
- refresh_token: i.refresh_token ?? t.refresh_token
185
- };
186
- return E(x(e, "tokens"), a), a;
187
- } catch {
188
- return h()?.removeItem(x(e, "tokens")), null;
189
- } finally {
190
- d.delete(e);
191
- }
192
- })();
193
- return d.set(e, r), r;
194
- }
195
- async function z(e) {
196
- let t = T(x(e, "tokens"));
197
- return t?.access_token ? t.expires_at > Date.now() + 3e4 ? t : R(e, t) : null;
198
- }
199
- async function B(e, t) {
200
- let n = await j(e);
201
- if (!n.userinfo_endpoint) return null;
202
- let r = await fetch(n.userinfo_endpoint, { headers: { Authorization: `Bearer ${t}` } });
203
- if (!r.ok) return null;
204
- let i = await r.json();
205
- return i.sub ? {
206
- id: i.sub,
207
- name: i.name,
208
- email: i.email,
209
- image: i.picture
210
- } : null;
211
- }
212
- async function V(e) {
213
- try {
214
- let t = await fetch(`${e}/api/auth/get-session`, { credentials: "include" });
215
- return t.ok ? (await t.json())?.user ?? null : null;
216
- } catch {
217
- return null;
218
- }
219
- }
220
- async function H(e) {
221
- let t = u.get(e);
222
- if (t) return t;
223
- c.set(e, {
224
- ...c.get(e) ?? s,
225
- loaded: !1
226
- });
227
- let n = (async () => {
228
- try {
229
- let t = _(typeof window < "u" ? window.location.href : e, e), n = S(e), r = await z(e), i = r ? await B(e, r.access_token) : null;
230
- if (i && r) {
231
- C(e, !1), D(e, {
232
- loaded: !0,
233
- accessToken: r.access_token,
234
- user: i,
235
- mode: "oauth"
236
- });
237
- return;
238
- }
239
- r && !i && h()?.removeItem(x(e, "tokens"));
240
- let a = t && !n ? await V(e) : null;
241
- if (a) {
242
- D(e, {
243
- loaded: !0,
244
- accessToken: null,
245
- user: a,
246
- mode: "session"
247
- });
248
- return;
249
- }
250
- D(e, {
251
- loaded: !0,
252
- accessToken: null,
253
- user: null,
254
- mode: null
255
- });
256
- } catch {
257
- D(e, {
258
- loaded: !0,
259
- accessToken: null,
260
- user: null,
261
- mode: null
262
- });
263
- }
264
- })().finally(() => u.delete(e));
265
- return u.set(e, n), n;
266
- }
267
- async function U(e, t) {
268
- let n = g(e);
269
- f = e, C(n, !1);
270
- let r = window.open("", "manufact-oauth", "width=600,height=700,resizable=yes,scrollbars=yes");
271
- if (!r) throw Error("Allow popups to sign in with Manufact");
272
- if (D(n, { authorizing: !0 }), _(window.location.href, n)) {
273
- r.location.href = y(n);
274
- let e = window.setInterval(async () => {
275
- if (r.closed) {
276
- window.clearInterval(e), D(n, { authorizing: !1 });
277
- return;
278
- }
279
- let t = await V(n);
280
- t && (window.clearInterval(e), r.close(), D(n, {
281
- loaded: !0,
282
- authorizing: !1,
283
- accessToken: null,
284
- user: t,
285
- mode: "session"
286
- }));
287
- }, 1e3);
288
- return;
289
- }
290
- try {
291
- let e = await j(n), t = await I(n, e), a = k(64), o = k(), s = M();
292
- E(w(o), {
293
- authOrigin: n,
294
- clientId: t.client_id,
295
- redirectUri: s,
296
- codeVerifier: a,
297
- expiresAt: Date.now() + 600 * 1e3
298
- });
299
- let c = new URL(e.authorization_endpoint);
300
- c.searchParams.set("response_type", "code"), c.searchParams.set("client_id", t.client_id), c.searchParams.set("redirect_uri", s), c.searchParams.set("scope", i), c.searchParams.set("state", o), c.searchParams.set("code_challenge", await A(a)), c.searchParams.set("code_challenge_method", "S256"), c.searchParams.set("prompt", "consent"), r.location.href = c.toString();
301
- let l = window.setInterval(() => {
302
- r.closed && (window.clearInterval(l), H(n).finally(() => D(n, { authorizing: !1 })));
303
- }, 500);
304
- } catch (e) {
305
- throw r.close(), D(n, { authorizing: !1 }), e;
306
- }
307
- }
308
- async function W(e = new URL(window.location.href)) {
309
- let t = e.searchParams.get("state"), n = e.searchParams.get("code"), r = e.searchParams.get("error_description") ?? e.searchParams.get("error");
310
- if (r) throw Error(r);
311
- if (!t || !n) throw Error("Missing OAuth code or state");
312
- let i = w(t), a = T(i);
313
- if (h()?.removeItem(i), !a || a.expiresAt < Date.now()) throw Error("OAuth state is invalid or expired");
314
- let o = await L((await j(a.authOrigin)).token_endpoint, {
315
- grant_type: "authorization_code",
316
- code: n,
317
- redirect_uri: a.redirectUri,
318
- client_id: a.clientId,
319
- code_verifier: a.codeVerifier
320
- });
321
- E(x(a.authOrigin, "tokens"), o), C(a.authOrigin, !1);
322
- let s = await B(a.authOrigin, o.access_token);
323
- D(a.authOrigin, {
324
- loaded: !0,
325
- authorizing: !1,
326
- accessToken: o.access_token,
327
- user: s,
328
- mode: "oauth"
329
- }), window.opener?.postMessage({
330
- type: "manufact:oauth-complete",
331
- authOrigin: a.authOrigin
332
- }, window.location.origin);
333
- }
334
- function G(e) {
335
- let t = g(e);
336
- h()?.removeItem(x(t, "tokens")), D(t, {
337
- loaded: !0,
338
- authorizing: !1,
339
- accessToken: null,
340
- user: null,
341
- mode: null
342
- });
343
- }
344
- async function K(e) {
345
- let t = T(x(e, "tokens")), n = T(x(e, "client")), r = t?.refresh_token ?? t?.access_token;
346
- if (!n?.client_id || !r) return null;
347
- try {
348
- let i = (await j(e)).revocation_endpoint ?? `${e}/api/auth/oauth2/revoke`;
349
- return (await fetch(i, {
350
- method: "POST",
351
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
352
- body: new URLSearchParams({
353
- client_id: n.client_id,
354
- token: r,
355
- token_type_hint: t?.refresh_token ? "refresh_token" : "access_token"
356
- })
357
- })).status;
358
- } catch {
359
- return -1;
360
- }
361
- }
362
- async function q(e) {
363
- let t = v(e), n = window.open(b(e), "manufact-sign-out", "width=420,height=320");
364
- return n ? new Promise((r) => {
365
- let i = !1, a = (e) => {
366
- i || (i = !0, window.clearTimeout(o), window.clearInterval(c), window.removeEventListener("message", s), r(e));
367
- }, o = window.setTimeout(() => {
368
- a({
369
- attempted: !0,
370
- signOutOk: !1,
371
- signOutStatus: null
372
- });
373
- }, 3e4), s = (e) => {
374
- e.origin === t && e.data?.type === "manufact:sign-out-complete" && a({
375
- attempted: !0,
376
- signOutOk: !0,
377
- signOutStatus: 200
378
- });
379
- }, c = window.setInterval(() => {
380
- n.closed && V(e).then((e) => {
381
- a({
382
- attempted: !0,
383
- signOutOk: !e,
384
- signOutStatus: e ? 401 : 200
385
- });
386
- });
387
- }, 500);
388
- window.addEventListener("message", s);
389
- }) : {
390
- attempted: !0,
391
- signOutOk: !1,
392
- signOutStatus: null
393
- };
394
- }
395
- async function J(e, t) {
396
- let n = g(e), r = !!T(x(n, "tokens"))?.access_token;
397
- t === "oauth" || r ? (await K(n), C(n, !0)) : t === "session" && (await q(n), C(n, !1)), G(e);
398
- }
399
- function Y(e) {
400
- let t = e ? g(e) : null, n = (0, r.useSyncExternalStore)((0, r.useCallback)((e) => (l.add(e), () => l.delete(e)), []), (0, r.useCallback)(() => t ? m(t) : s, [t]), () => s);
401
- return (0, r.useEffect)(() => {
402
- if (!t) return;
403
- H(t);
404
- let e = (e) => {
405
- e.origin === window.location.origin && e.data?.type === "manufact:oauth-complete" && e.data.authOrigin === t && H(t).finally(() => D(t, { authorizing: !1 }));
406
- }, n = (e) => {
407
- e.key !== x(t, "tokens") || !e.newValue || H(t).finally(() => D(t, { authorizing: !1 }));
408
- };
409
- return window.addEventListener("message", e), window.addEventListener("storage", n), () => {
410
- window.removeEventListener("message", e), window.removeEventListener("storage", n);
411
- };
412
- }, [t]), {
413
- ...n,
414
- authorize: (0, r.useCallback)(async () => {
415
- e && await U(e);
416
- }, [e]),
417
- logout: (0, r.useCallback)(async () => {
418
- e && await J(e, n.mode);
419
- }, [e, n.mode])
420
- };
421
- }
422
- //#endregion
423
- export { Y as n, W as t };
@@ -1,21 +0,0 @@
1
- import { t as e } from "./createLucideIcon-BONxC1L5.js";
2
- var t = e("maximize-2", [
3
- ["path", {
4
- d: "M15 3h6v6",
5
- key: "1q9fwt"
6
- }],
7
- ["path", {
8
- d: "m21 3-7 7",
9
- key: "1l2asr"
10
- }],
11
- ["path", {
12
- d: "m3 21 7-7",
13
- key: "tjx5ai"
14
- }],
15
- ["path", {
16
- d: "M9 21H3v-6",
17
- key: "wtvkvv"
18
- }]
19
- ]);
20
- //#endregion
21
- export { t };
@@ -1,21 +0,0 @@
1
- import { t as e } from "./createLucideIcon-BONxC1L5.js";
2
- var t = e("maximize", [
3
- ["path", {
4
- d: "M8 3H5a2 2 0 0 0-2 2v3",
5
- key: "1dcmit"
6
- }],
7
- ["path", {
8
- d: "M21 8V5a2 2 0 0 0-2-2h-3",
9
- key: "1e4gt3"
10
- }],
11
- ["path", {
12
- d: "M3 16v3a2 2 0 0 0 2 2h3",
13
- key: "wsl5sc"
14
- }],
15
- ["path", {
16
- d: "M16 21h3a2 2 0 0 0 2-2v-3",
17
- key: "18trek"
18
- }]
19
- ]);
20
- //#endregion
21
- export { t };
@@ -1,7 +0,0 @@
1
- import { t as e } from "./createLucideIcon-BONxC1L5.js";
2
- var t = e("message-square", [["path", {
3
- d: "M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",
4
- key: "18887p"
5
- }]]);
6
- //#endregion
7
- export { t };
@@ -1,32 +0,0 @@
1
- import { n as e } from "./createLucideIcon-BONxC1L5.js";
2
- import { U as t } from "./button-CB4uOoUV.js";
3
- //#region src/client/components/ui/not-found.tsx
4
- var n = e();
5
- function r({ message: e, className: r = "", vertical: i, noBorder: a }) {
6
- return /* @__PURE__ */ (0, n.jsx)("div", {
7
- className: t(`mt-2 rounded-md p-6 ${r}`, !a && "border"),
8
- children: /* @__PURE__ */ (0, n.jsxs)("p", {
9
- className: t("text-sm text-muted-foreground flex items-center gap-4", i && "flex-col"),
10
- children: [/* @__PURE__ */ (0, n.jsxs)("svg", {
11
- viewBox: "-6 -6 512 512",
12
- xmlns: "http://www.w3.org/2000/svg",
13
- className: "size-14 shrink-0 stroke-black dark:stroke-white",
14
- fill: "none",
15
- strokeWidth: "4.8",
16
- strokeLinecap: "round",
17
- strokeLinejoin: "round",
18
- children: [
19
- /* @__PURE__ */ (0, n.jsx)("path", { d: "M105.933 0C164.437 0.000116002 211.865 47.607 211.865 106.333C211.865 131.829 210.493 158.403 221.068 181.602L228.975 198.947C243.584 230.997 269.265 256.7 301.303 271.336L316.155 278.121C340.142 289.079 367.694 287.335 394.066 287.335C452.571 287.335 499.999 334.942 499.999 393.668C499.999 452.394 452.571 500.001 394.066 500.001C335.562 500.001 288.134 452.394 288.134 393.668C288.134 368.974 289.24 343.275 278.992 320.807L270.586 302.38C255.948 270.29 230.214 244.565 198.118 229.939L180.164 221.758C157.282 211.331 131.078 212.666 105.933 212.666C47.4278 212.666 4.86252e-05 165.059 0 106.333C0 47.607 47.4278 0 105.933 0Z" }),
20
- /* @__PURE__ */ (0, n.jsx)("circle", {
21
- cx: "100.426",
22
- cy: "399.575",
23
- r: "100.426"
24
- }),
25
- /* @__PURE__ */ (0, n.jsx)("path", { d: "M500 100.426C500 155.889 455.037 200.851 399.574 200.851C344.11 200.851 299.148 155.889 299.148 100.426C299.148 44.962 344.11 0 399.574 0C455.037 0 500 44.962 500 100.426Z" })
26
- ]
27
- }), e]
28
- })
29
- });
30
- }
31
- //#endregion
32
- export { r as t };
@@ -1,7 +0,0 @@
1
- import { t as e } from "./createLucideIcon-BONxC1L5.js";
2
- var t = e("play", [["path", {
3
- d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",
4
- key: "10ikf1"
5
- }]]);
6
- //#endregion
7
- export { t };