zudoku 0.3.0-dev.2 → 0.3.0-dev.21

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 (228) hide show
  1. package/dist/app/App.js +11 -8
  2. package/dist/app/App.js.map +1 -1
  3. package/dist/config/config.d.ts +8 -15
  4. package/dist/lib/authentication/authentication.d.ts +2 -2
  5. package/dist/lib/authentication/hook.d.ts +1 -0
  6. package/dist/lib/authentication/hook.js +1 -0
  7. package/dist/lib/authentication/hook.js.map +1 -1
  8. package/dist/lib/authentication/providers/auth0.js +1 -0
  9. package/dist/lib/authentication/providers/auth0.js.map +1 -1
  10. package/dist/lib/authentication/providers/clerk.js +2 -0
  11. package/dist/lib/authentication/providers/clerk.js.map +1 -1
  12. package/dist/lib/authentication/providers/openid.js +2 -0
  13. package/dist/lib/authentication/providers/openid.js.map +1 -1
  14. package/dist/lib/authentication/state.d.ts +1 -0
  15. package/dist/lib/authentication/state.js +1 -0
  16. package/dist/lib/authentication/state.js.map +1 -1
  17. package/dist/lib/components/DevPortal.d.ts +2 -20
  18. package/dist/lib/components/DevPortal.js +13 -9
  19. package/dist/lib/components/DevPortal.js.map +1 -1
  20. package/dist/lib/components/Header.js +4 -4
  21. package/dist/lib/components/Header.js.map +1 -1
  22. package/dist/lib/components/Heading.d.ts +9 -4
  23. package/dist/lib/components/Heading.js +17 -2
  24. package/dist/lib/components/Heading.js.map +1 -1
  25. package/dist/lib/components/Layout.js +1 -1
  26. package/dist/lib/components/Layout.js.map +1 -1
  27. package/dist/lib/components/SyntaxHighlight.js +5 -1
  28. package/dist/lib/components/SyntaxHighlight.js.map +1 -1
  29. package/dist/lib/components/context/DevPortalProvider.d.ts +1 -1
  30. package/dist/lib/components/context/DevPortalProvider.js +2 -2
  31. package/dist/lib/components/context/DevPortalProvider.js.map +1 -1
  32. package/dist/lib/components/index.d.ts +2 -0
  33. package/dist/lib/components/index.js +2 -0
  34. package/dist/lib/components/index.js.map +1 -1
  35. package/dist/lib/core/DevPortalContext.d.ts +33 -3
  36. package/dist/lib/core/DevPortalContext.js +8 -4
  37. package/dist/lib/core/DevPortalContext.js.map +1 -1
  38. package/dist/lib/core/plugins.d.ts +7 -4
  39. package/dist/lib/core/plugins.js +1 -0
  40. package/dist/lib/core/plugins.js.map +1 -1
  41. package/dist/lib/oas/graphql/index.js +1 -1
  42. package/dist/lib/oas/graphql/index.js.map +1 -1
  43. package/dist/lib/oas/parser/index.js +3 -1
  44. package/dist/lib/oas/parser/index.js.map +1 -1
  45. package/dist/lib/plugins/api-keys/CreateApiKey.d.ts +4 -0
  46. package/dist/lib/plugins/{api-key → api-keys}/CreateApiKey.js +1 -1
  47. package/dist/lib/plugins/api-keys/CreateApiKey.js.map +1 -0
  48. package/dist/lib/plugins/api-keys/SettingsApiKeys.d.ts +4 -0
  49. package/dist/lib/plugins/api-keys/SettingsApiKeys.js +38 -0
  50. package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -0
  51. package/dist/lib/plugins/api-keys/index.js +94 -0
  52. package/dist/lib/plugins/api-keys/index.js.map +1 -0
  53. package/dist/lib/plugins/markdown/MdxPage.d.ts +3 -2
  54. package/dist/lib/plugins/markdown/MdxPage.js +5 -4
  55. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  56. package/dist/lib/plugins/markdown/generateRoutes.d.ts +2 -2
  57. package/dist/lib/plugins/markdown/generateRoutes.js +2 -2
  58. package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -1
  59. package/dist/lib/plugins/markdown/index.d.ts +4 -1
  60. package/dist/lib/plugins/markdown/index.js +2 -2
  61. package/dist/lib/plugins/markdown/index.js.map +1 -1
  62. package/dist/lib/plugins/openapi/OperationList.js +4 -3
  63. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  64. package/dist/lib/plugins/openapi/OperationListItem.js +8 -4
  65. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  66. package/dist/lib/plugins/openapi/ParameterList.js +1 -1
  67. package/dist/lib/plugins/openapi/ParameterList.js.map +1 -1
  68. package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
  69. package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
  70. package/dist/lib/plugins/openapi/{MakeRequest.d.ts → PlaygroundDialogWrapper.d.ts} +1 -1
  71. package/dist/lib/plugins/openapi/{MakeRequest.js → PlaygroundDialogWrapper.js} +4 -4
  72. package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js.map +1 -0
  73. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +1 -9
  74. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
  75. package/dist/lib/plugins/openapi/ResponsesSidecarBox.js +1 -1
  76. package/dist/lib/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
  77. package/dist/lib/plugins/openapi/SchemaListView.js +4 -26
  78. package/dist/lib/plugins/openapi/SchemaListView.js.map +1 -1
  79. package/dist/lib/plugins/openapi/SchemaListViewItem.d.ts +7 -0
  80. package/dist/lib/plugins/openapi/SchemaListViewItem.js +16 -0
  81. package/dist/lib/plugins/openapi/SchemaListViewItem.js.map +1 -0
  82. package/dist/lib/plugins/openapi/SchemaListViewItemGroup.d.ts +8 -0
  83. package/dist/lib/plugins/openapi/SchemaListViewItemGroup.js +17 -0
  84. package/dist/lib/plugins/openapi/SchemaListViewItemGroup.js.map +1 -0
  85. package/dist/lib/plugins/openapi/Sidecar.js +10 -8
  86. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  87. package/dist/lib/plugins/openapi/{Select.d.ts → SimpleSelect.d.ts} +3 -2
  88. package/dist/lib/plugins/openapi/SimpleSelect.js +5 -0
  89. package/dist/lib/plugins/openapi/SimpleSelect.js.map +1 -0
  90. package/dist/lib/plugins/openapi/index.js +8 -0
  91. package/dist/lib/plugins/openapi/index.js.map +1 -1
  92. package/dist/lib/plugins/openapi/playground/Headers.d.ts +2 -3
  93. package/dist/lib/plugins/openapi/playground/Headers.js +16 -6
  94. package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -1
  95. package/dist/lib/plugins/openapi/playground/Playground.d.ts +4 -3
  96. package/dist/lib/plugins/openapi/playground/Playground.js +8 -12
  97. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
  98. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.d.ts +3 -0
  99. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +10 -0
  100. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -0
  101. package/dist/lib/plugins/openapi/util/prose.d.ts +1 -0
  102. package/dist/lib/plugins/openapi/util/prose.js +4 -0
  103. package/dist/lib/plugins/openapi/util/prose.js.map +1 -0
  104. package/dist/lib/plugins/openapi/worker/worker.js +25 -1
  105. package/dist/lib/plugins/openapi/worker/worker.js.map +1 -1
  106. package/dist/lib/ui/button-variants.d.ts +1 -1
  107. package/dist/lib/util/MdxComponents.js +1 -1
  108. package/dist/lib/util/MdxComponents.js.map +1 -1
  109. package/dist/lib/util/objectEntries.d.ts +4 -0
  110. package/dist/lib/util/objectEntries.js +2 -0
  111. package/dist/lib/util/objectEntries.js.map +1 -0
  112. package/dist/lib/util/renderIf.d.ts +1 -0
  113. package/dist/lib/util/renderIf.js +2 -0
  114. package/dist/lib/util/renderIf.js.map +1 -0
  115. package/dist/vite/build.js +4 -1
  116. package/dist/vite/build.js.map +1 -1
  117. package/dist/vite/config.d.ts +7 -7
  118. package/dist/vite/config.js +34 -40
  119. package/dist/vite/config.js.map +1 -1
  120. package/dist/vite/config.test.js +7 -4
  121. package/dist/vite/config.test.js.map +1 -1
  122. package/dist/vite/dev-server.js +4 -4
  123. package/dist/vite/dev-server.js.map +1 -1
  124. package/dist/vite/plugin-api-keys.js +4 -4
  125. package/dist/vite/plugin-api-keys.js.map +1 -1
  126. package/dist/vite/plugin-api.js +5 -5
  127. package/dist/vite/plugin-api.js.map +1 -1
  128. package/dist/vite/plugin-auth.js +2 -2
  129. package/dist/vite/plugin-auth.js.map +1 -1
  130. package/dist/vite/plugin-config.d.ts +1 -1
  131. package/dist/vite/plugin-config.js +7 -6
  132. package/dist/vite/plugin-config.js.map +1 -1
  133. package/dist/vite/plugin-docs.js +2 -2
  134. package/dist/vite/plugin-docs.js.map +1 -1
  135. package/dist/vite/plugin-docs.test.js +1 -1
  136. package/dist/vite/plugin-docs.test.js.map +1 -1
  137. package/dist/vite/plugin-redirect.js +4 -4
  138. package/dist/vite/plugin-redirect.js.map +1 -1
  139. package/lib/DevPortalProvider-CRKuwoXc.js +4123 -0
  140. package/lib/Markdown-5LmPZyLV.js +8620 -0
  141. package/lib/MdxComponents-DYD_QPVF.js +3017 -0
  142. package/lib/Select-DR3PiqjV.js +4569 -0
  143. package/lib/Spinner-DjQ2eBxC.js +181 -0
  144. package/lib/assets/{worker-BCcpCNJ7.js → worker-DGvzLstc.js} +9843 -9800
  145. package/lib/hook-FCY9-FHO.js +24 -0
  146. package/lib/index-By9bEW57.js +411 -0
  147. package/lib/{index-DNx3xWa2.js → index-PyGcnQFX.js} +13 -12
  148. package/lib/loglevel-CA34MiFn.js +152 -0
  149. package/lib/prism-csharp.min-Yizuc34Y.js +34 -0
  150. package/lib/prism-objectivec.min-BXSWqpJJ.js +1 -0
  151. package/lib/{state-oycsxkHz.js → state-Ds_OxRHP.js} +19 -18
  152. package/lib/util-voKLTRDG.js +740 -0
  153. package/lib/zudoku.auth-auth0.js +2 -1
  154. package/lib/zudoku.auth-clerk.js +10 -8
  155. package/lib/zudoku.auth-openid.js +442 -588
  156. package/lib/zudoku.components.js +283 -292
  157. package/lib/zudoku.openapi-worker.js +12 -12
  158. package/lib/zudoku.plugin-api-keys.js +292 -0
  159. package/lib/zudoku.plugin-markdown.js +255 -0
  160. package/lib/zudoku.plugin-openapi.js +6240 -0
  161. package/lib/zudoku.plugin-redirect.js +10 -0
  162. package/package.json +17 -5
  163. package/src/app/App.tsx +12 -8
  164. package/src/lib/authentication/authentication.ts +2 -5
  165. package/src/lib/authentication/hook.ts +1 -0
  166. package/src/lib/authentication/providers/auth0.tsx +1 -0
  167. package/src/lib/authentication/providers/clerk.tsx +2 -0
  168. package/src/lib/authentication/providers/openid.tsx +2 -0
  169. package/src/lib/authentication/state.ts +2 -0
  170. package/src/lib/components/DevPortal.tsx +12 -28
  171. package/src/lib/components/Header.tsx +25 -22
  172. package/src/lib/components/Heading.tsx +26 -7
  173. package/src/lib/components/Layout.tsx +2 -2
  174. package/src/lib/components/SyntaxHighlight.tsx +5 -1
  175. package/src/lib/components/context/DevPortalProvider.ts +2 -2
  176. package/src/lib/components/index.ts +3 -0
  177. package/src/lib/core/DevPortalContext.ts +42 -12
  178. package/src/lib/core/plugins.ts +10 -5
  179. package/src/lib/oas/graphql/index.ts +2 -2
  180. package/src/lib/oas/parser/index.ts +3 -1
  181. package/src/lib/plugins/{api-key → api-keys}/CreateApiKey.tsx +2 -8
  182. package/src/lib/plugins/{api-key → api-keys}/SettingsApiKeys.tsx +21 -14
  183. package/src/lib/plugins/{api-key → api-keys}/index.tsx +67 -18
  184. package/src/lib/plugins/markdown/MdxPage.tsx +50 -33
  185. package/src/lib/plugins/markdown/generateRoutes.tsx +12 -2
  186. package/src/lib/plugins/markdown/index.tsx +8 -1
  187. package/src/lib/plugins/openapi/OperationList.tsx +9 -3
  188. package/src/lib/plugins/openapi/OperationListItem.tsx +66 -41
  189. package/src/lib/plugins/openapi/ParameterList.tsx +1 -1
  190. package/src/lib/plugins/openapi/ParameterListItem.tsx +3 -4
  191. package/src/lib/plugins/openapi/{MakeRequest.tsx → PlaygroundDialogWrapper.tsx} +3 -3
  192. package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +2 -16
  193. package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +3 -1
  194. package/src/lib/plugins/openapi/SchemaListView.tsx +15 -182
  195. package/src/lib/plugins/openapi/SchemaListViewItem.tsx +110 -0
  196. package/src/lib/plugins/openapi/SchemaListViewItemGroup.tsx +63 -0
  197. package/src/lib/plugins/openapi/Sidecar.tsx +15 -10
  198. package/src/lib/plugins/openapi/{Select.tsx → SimpleSelect.tsx} +5 -2
  199. package/src/lib/plugins/openapi/index.tsx +17 -4
  200. package/src/lib/plugins/openapi/playground/Headers.tsx +60 -33
  201. package/src/lib/plugins/openapi/playground/Playground.tsx +158 -193
  202. package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +34 -0
  203. package/src/lib/plugins/openapi/util/prose.ts +7 -0
  204. package/src/lib/plugins/openapi/worker/worker.ts +27 -1
  205. package/src/lib/util/MdxComponents.tsx +1 -1
  206. package/src/lib/util/objectEntries.ts +5 -0
  207. package/src/lib/util/renderIf.ts +4 -0
  208. package/dist/lib/plugins/api-key/CreateApiKey.d.ts +0 -5
  209. package/dist/lib/plugins/api-key/CreateApiKey.js.map +0 -1
  210. package/dist/lib/plugins/api-key/SettingsApiKeys.d.ts +0 -5
  211. package/dist/lib/plugins/api-key/SettingsApiKeys.js +0 -38
  212. package/dist/lib/plugins/api-key/SettingsApiKeys.js.map +0 -1
  213. package/dist/lib/plugins/api-key/index.js +0 -62
  214. package/dist/lib/plugins/api-key/index.js.map +0 -1
  215. package/dist/lib/plugins/index.d.ts +0 -4
  216. package/dist/lib/plugins/index.js +0 -5
  217. package/dist/lib/plugins/index.js.map +0 -1
  218. package/dist/lib/plugins/openapi/MakeRequest.js.map +0 -1
  219. package/dist/lib/plugins/openapi/Select.js +0 -5
  220. package/dist/lib/plugins/openapi/Select.js.map +0 -1
  221. package/dist/vite/common.d.ts +0 -1
  222. package/dist/vite/common.js +0 -5
  223. package/dist/vite/common.js.map +0 -1
  224. package/lib/Spinner-7LezPqGn.js +0 -8393
  225. package/lib/clerk-Wslx_mPo.js +0 -19685
  226. package/lib/zudoku.plugins.js +0 -19857
  227. package/src/lib/plugins/index.ts +0 -4
  228. /package/dist/lib/plugins/{api-key → api-keys}/index.d.ts +0 -0
@@ -1,162 +1,14 @@
1
- var Re = Object.defineProperty;
2
- var xe = (e, t, n) => t in e ? Re(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var S = (e, t, n) => xe(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { a as Pe, j as T } from "./index-DNx3xWa2.js";
5
- import { c as Le, g as Ue } from "./_commonjsHelpers-BkfeUUK-.js";
6
- import { useRef as Ce, useState as je, useEffect as ze } from "react";
7
- import { u as re } from "./state-oycsxkHz.js";
8
- var he = { exports: {} };
9
- (function(e) {
10
- (function(t, n) {
11
- e.exports ? e.exports = n() : t.log = n();
12
- })(Le, function() {
13
- var t = function() {
14
- }, n = "undefined", o = typeof window !== n && typeof window.navigator !== n && /Trident\/|MSIE /.test(window.navigator.userAgent), s = [
15
- "trace",
16
- "debug",
17
- "info",
18
- "warn",
19
- "error"
20
- ], r = {}, i = null;
21
- function d(u, f) {
22
- var c = u[f];
23
- if (typeof c.bind == "function")
24
- return c.bind(u);
25
- try {
26
- return Function.prototype.bind.call(c, u);
27
- } catch {
28
- return function() {
29
- return Function.prototype.apply.apply(c, [u, arguments]);
30
- };
31
- }
32
- }
33
- function g() {
34
- console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
35
- }
36
- function m(u) {
37
- return u === "debug" && (u = "log"), typeof console === n ? !1 : u === "trace" && o ? g : console[u] !== void 0 ? d(console, u) : console.log !== void 0 ? d(console, "log") : t;
38
- }
39
- function _() {
40
- for (var u = this.getLevel(), f = 0; f < s.length; f++) {
41
- var c = s[f];
42
- this[c] = f < u ? t : this.methodFactory(c, u, this.name);
43
- }
44
- if (this.log = this.debug, typeof console === n && u < this.levels.SILENT)
45
- return "No console available for logging";
46
- }
47
- function y(u) {
48
- return function() {
49
- typeof console !== n && (_.call(this), this[u].apply(this, arguments));
50
- };
51
- }
52
- function h(u, f, c) {
53
- return m(u) || y.apply(this, arguments);
54
- }
55
- function L(u, f) {
56
- var c = this, J, $, x, b = "loglevel";
57
- typeof u == "string" ? b += ":" + u : typeof u == "symbol" && (b = void 0);
58
- function ke(l) {
59
- var p = (s[l] || "silent").toUpperCase();
60
- if (!(typeof window === n || !b)) {
61
- try {
62
- window.localStorage[b] = p;
63
- return;
64
- } catch {
65
- }
66
- try {
67
- window.document.cookie = encodeURIComponent(b) + "=" + p + ";";
68
- } catch {
69
- }
70
- }
71
- }
72
- function ee() {
73
- var l;
74
- if (!(typeof window === n || !b)) {
75
- try {
76
- l = window.localStorage[b];
77
- } catch {
78
- }
79
- if (typeof l === n)
80
- try {
81
- var p = window.document.cookie, O = encodeURIComponent(b), ne = p.indexOf(O + "=");
82
- ne !== -1 && (l = /^([^;]+)/.exec(
83
- p.slice(ne + O.length + 1)
84
- )[1]);
85
- } catch {
86
- }
87
- return c.levels[l] === void 0 && (l = void 0), l;
88
- }
89
- }
90
- function Te() {
91
- if (!(typeof window === n || !b)) {
92
- try {
93
- window.localStorage.removeItem(b);
94
- } catch {
95
- }
96
- try {
97
- window.document.cookie = encodeURIComponent(b) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
98
- } catch {
99
- }
100
- }
101
- }
102
- function U(l) {
103
- var p = l;
104
- if (typeof p == "string" && c.levels[p.toUpperCase()] !== void 0 && (p = c.levels[p.toUpperCase()]), typeof p == "number" && p >= 0 && p <= c.levels.SILENT)
105
- return p;
106
- throw new TypeError("log.setLevel() called with invalid level: " + l);
107
- }
108
- c.name = u, c.levels = {
109
- TRACE: 0,
110
- DEBUG: 1,
111
- INFO: 2,
112
- WARN: 3,
113
- ERROR: 4,
114
- SILENT: 5
115
- }, c.methodFactory = f || h, c.getLevel = function() {
116
- return x ?? $ ?? J;
117
- }, c.setLevel = function(l, p) {
118
- return x = U(l), p !== !1 && ke(x), _.call(c);
119
- }, c.setDefaultLevel = function(l) {
120
- $ = U(l), ee() || c.setLevel(l, !1);
121
- }, c.resetLevel = function() {
122
- x = null, Te(), _.call(c);
123
- }, c.enableAll = function(l) {
124
- c.setLevel(c.levels.TRACE, l);
125
- }, c.disableAll = function(l) {
126
- c.setLevel(c.levels.SILENT, l);
127
- }, c.rebuild = function() {
128
- if (i !== c && (J = U(i.getLevel())), _.call(c), i === c)
129
- for (var l in r)
130
- r[l].rebuild();
131
- }, J = U(
132
- i ? i.getLevel() : "WARN"
133
- );
134
- var te = ee();
135
- te != null && (x = U(te)), _.call(c);
136
- }
137
- i = new L(), i.getLogger = function(f) {
138
- if (typeof f != "symbol" && typeof f != "string" || f === "")
139
- throw new TypeError("You must supply a name when creating a logger.");
140
- var c = r[f];
141
- return c || (c = r[f] = new L(
142
- f,
143
- i.methodFactory
144
- )), c;
145
- };
146
- var R = typeof window !== n ? window.log : void 0;
147
- return i.noConflict = function() {
148
- return typeof window !== n && window.log === i && (window.log = R), i;
149
- }, i.getLoggers = function() {
150
- return r;
151
- }, i.default = i, i;
152
- });
153
- })(he);
154
- var Je = he.exports;
155
- const oe = /* @__PURE__ */ Ue(Je);
156
- let M;
157
- var I, de;
158
- (typeof navigator > "u" || !((de = (I = navigator.userAgent) == null ? void 0 : I.startsWith) != null && de.call(I, "Mozilla/5.0 "))) && (M = "oauth4webapi/v2.11.1");
159
- function q(e, t) {
1
+ var ue = Object.defineProperty;
2
+ var he = (e, t, n) => t in e ? ue(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var w = (e, t, n) => he(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { a as de, j as g } from "./index-PyGcnQFX.js";
5
+ import { l as I } from "./loglevel-CA34MiFn.js";
6
+ import { useRef as fe, useState as le, useEffect as pe } from "react";
7
+ import { u as M } from "./state-Ds_OxRHP.js";
8
+ let z;
9
+ var v, Z;
10
+ (typeof navigator > "u" || !((Z = (v = navigator.userAgent) == null ? void 0 : v.startsWith) != null && Z.call(v, "Mozilla/5.0 "))) && (z = "oauth4webapi/v2.11.1");
11
+ function O(e, t) {
160
12
  if (e == null)
161
13
  return !1;
162
14
  try {
@@ -165,32 +17,32 @@ function q(e, t) {
165
17
  return !1;
166
18
  }
167
19
  }
168
- const K = Symbol(), Oe = Symbol(), V = Symbol(), Ie = new TextEncoder(), Ne = new TextDecoder();
169
- function A(e) {
170
- return typeof e == "string" ? Ie.encode(e) : Ne.decode(e);
20
+ const P = Symbol(), we = Symbol(), K = Symbol(), me = new TextEncoder(), ye = new TextDecoder();
21
+ function _(e) {
22
+ return typeof e == "string" ? me.encode(e) : ye.decode(e);
171
23
  }
172
- const ie = 32768;
173
- function Ke(e) {
24
+ const B = 32768;
25
+ function ge(e) {
174
26
  e instanceof ArrayBuffer && (e = new Uint8Array(e));
175
27
  const t = [];
176
- for (let n = 0; n < e.byteLength; n += ie)
177
- t.push(String.fromCharCode.apply(null, e.subarray(n, n + ie)));
28
+ for (let n = 0; n < e.byteLength; n += B)
29
+ t.push(String.fromCharCode.apply(null, e.subarray(n, n + B)));
178
30
  return btoa(t.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
179
31
  }
180
- function We(e) {
32
+ function _e(e) {
181
33
  try {
182
34
  const t = atob(e.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "")), n = new Uint8Array(t.length);
183
- for (let o = 0; o < t.length; o++)
184
- n[o] = t.charCodeAt(o);
35
+ for (let r = 0; r < t.length; r++)
36
+ n[r] = t.charCodeAt(r);
185
37
  return n;
186
38
  } catch (t) {
187
- throw new a("The input to be decoded is not correctly encoded.", { cause: t });
39
+ throw new o("The input to be decoded is not correctly encoded.", { cause: t });
188
40
  }
189
41
  }
190
- function k(e) {
191
- return typeof e == "string" ? We(e) : Ke(e);
42
+ function y(e) {
43
+ return typeof e == "string" ? _e(e) : ge(e);
192
44
  }
193
- class De {
45
+ class be {
194
46
  constructor(t) {
195
47
  this.cache = /* @__PURE__ */ new Map(), this._cache = /* @__PURE__ */ new Map(), this.maxSize = t;
196
48
  }
@@ -214,54 +66,54 @@ class De {
214
66
  this.cache.set(t, n), this.cache.size >= this.maxSize && (this._cache = this.cache, this.cache = /* @__PURE__ */ new Map());
215
67
  }
216
68
  }
217
- class v extends Error {
69
+ class f extends Error {
218
70
  constructor(t) {
219
71
  var n;
220
72
  super(t ?? "operation not supported"), this.name = this.constructor.name, (n = Error.captureStackTrace) == null || n.call(Error, this, this.constructor);
221
73
  }
222
74
  }
223
- class He extends Error {
75
+ class Se extends Error {
224
76
  constructor(t, n) {
225
- var o;
226
- super(t, n), this.name = this.constructor.name, (o = Error.captureStackTrace) == null || o.call(Error, this, this.constructor);
77
+ var r;
78
+ super(t, n), this.name = this.constructor.name, (r = Error.captureStackTrace) == null || r.call(Error, this, this.constructor);
227
79
  }
228
80
  }
229
- const a = He, fe = new De(100);
230
- function pe(e) {
81
+ const o = Se, Q = new be(100);
82
+ function X(e) {
231
83
  return e instanceof CryptoKey;
232
84
  }
233
- function we(e) {
234
- return pe(e) && e.type === "private";
85
+ function ee(e) {
86
+ return X(e) && e.type === "private";
235
87
  }
236
- function $e(e) {
237
- return pe(e) && e.type === "public";
88
+ function ke(e) {
89
+ return X(e) && e.type === "public";
238
90
  }
239
- function Y(e) {
91
+ function N(e) {
240
92
  try {
241
93
  const t = e.headers.get("dpop-nonce");
242
- t && fe.set(new URL(e.url).origin, t);
94
+ t && Q.set(new URL(e.url).origin, t);
243
95
  } catch {
244
96
  }
245
97
  return e;
246
98
  }
247
- function C(e) {
99
+ function E(e) {
248
100
  return !(e === null || typeof e != "object" || Array.isArray(e));
249
101
  }
250
- function W(e) {
251
- q(e, Headers) && (e = Object.fromEntries(e.entries()));
102
+ function x(e) {
103
+ O(e, Headers) && (e = Object.fromEntries(e.entries()));
252
104
  const t = new Headers(e);
253
- if (M && !t.has("user-agent") && t.set("user-agent", M), t.has("authorization"))
105
+ if (z && !t.has("user-agent") && t.set("user-agent", z), t.has("authorization"))
254
106
  throw new TypeError('"options.headers" must not include the "authorization" header name');
255
107
  if (t.has("dpop"))
256
108
  throw new TypeError('"options.headers" must not include the "dpop" header name');
257
109
  return t;
258
110
  }
259
- function Z(e) {
111
+ function W(e) {
260
112
  if (typeof e == "function" && (e = e()), !(e instanceof AbortSignal))
261
113
  throw new TypeError('"options.signal" must return or be an instance of AbortSignal');
262
114
  return e;
263
115
  }
264
- async function Fe(e, t) {
116
+ async function Ee(e, t) {
265
117
  if (!(e instanceof URL))
266
118
  throw new TypeError('"issuerIdentifier" must be an instance of URL');
267
119
  if (e.protocol !== "https:" && e.protocol !== "http:")
@@ -278,70 +130,70 @@ async function Fe(e, t) {
278
130
  default:
279
131
  throw new TypeError('"options.algorithm" must be "oidc" (default), or "oauth2"');
280
132
  }
281
- const o = W(t == null ? void 0 : t.headers);
282
- return o.set("accept", "application/json"), ((t == null ? void 0 : t[V]) || fetch)(n.href, {
283
- headers: Object.fromEntries(o.entries()),
133
+ const r = x(t == null ? void 0 : t.headers);
134
+ return r.set("accept", "application/json"), ((t == null ? void 0 : t[K]) || fetch)(n.href, {
135
+ headers: Object.fromEntries(r.entries()),
284
136
  method: "GET",
285
137
  redirect: "manual",
286
- signal: t != null && t.signal ? Z(t.signal) : null
287
- }).then(Y);
138
+ signal: t != null && t.signal ? W(t.signal) : null
139
+ }).then(N);
288
140
  }
289
- function w(e) {
141
+ function h(e) {
290
142
  return typeof e == "string" && e.length !== 0;
291
143
  }
292
- async function Me(e, t) {
144
+ async function Te(e, t) {
293
145
  if (!(e instanceof URL))
294
146
  throw new TypeError('"expectedIssuer" must be an instance of URL');
295
- if (!q(t, Response))
147
+ if (!O(t, Response))
296
148
  throw new TypeError('"response" must be an instance of Response');
297
149
  if (t.status !== 200)
298
- throw new a('"response" is not a conform Authorization Server Metadata response');
299
- X(t);
150
+ throw new o('"response" is not a conform Authorization Server Metadata response');
151
+ H(t);
300
152
  let n;
301
153
  try {
302
154
  n = await t.json();
303
- } catch (o) {
304
- throw new a('failed to parse "response" body as JSON', { cause: o });
155
+ } catch (r) {
156
+ throw new o('failed to parse "response" body as JSON', { cause: r });
305
157
  }
306
- if (!C(n))
307
- throw new a('"response" body must be a top level object');
308
- if (!w(n.issuer))
309
- throw new a('"response" body "issuer" property must be a non-empty string');
158
+ if (!E(n))
159
+ throw new o('"response" body must be a top level object');
160
+ if (!h(n.issuer))
161
+ throw new o('"response" body "issuer" property must be a non-empty string');
310
162
  if (new URL(n.issuer).href !== e.href)
311
- throw new a('"response" body "issuer" does not match "expectedIssuer"');
163
+ throw new o('"response" body "issuer" does not match "expectedIssuer"');
312
164
  return n;
313
165
  }
314
- function D() {
315
- return k(crypto.getRandomValues(new Uint8Array(32)));
166
+ function j() {
167
+ return y(crypto.getRandomValues(new Uint8Array(32)));
316
168
  }
317
- function Be() {
318
- return D();
169
+ function Ae() {
170
+ return j();
319
171
  }
320
- function Ge() {
321
- return D();
172
+ function ve() {
173
+ return j();
322
174
  }
323
- async function qe(e) {
324
- if (!w(e))
175
+ async function Re(e) {
176
+ if (!h(e))
325
177
  throw new TypeError('"codeVerifier" must be a non-empty string');
326
- return k(await crypto.subtle.digest("SHA-256", A(e)));
178
+ return y(await crypto.subtle.digest("SHA-256", _(e)));
327
179
  }
328
- function Ve(e) {
180
+ function Pe(e) {
329
181
  if (e instanceof CryptoKey)
330
182
  return { key: e };
331
183
  if (!((e == null ? void 0 : e.key) instanceof CryptoKey))
332
184
  return {};
333
- if (e.kid !== void 0 && !w(e.kid))
185
+ if (e.kid !== void 0 && !h(e.kid))
334
186
  throw new TypeError('"kid" must be a non-empty string');
335
187
  return { key: e.key, kid: e.kid };
336
188
  }
337
- function se(e) {
189
+ function F(e) {
338
190
  return encodeURIComponent(e).replace(/%20/g, "+");
339
191
  }
340
- function Ye(e, t) {
341
- const n = se(e), o = se(t);
342
- return `Basic ${btoa(`${n}:${o}`)}`;
192
+ function xe(e, t) {
193
+ const n = F(e), r = F(t);
194
+ return `Basic ${btoa(`${n}:${r}`)}`;
343
195
  }
344
- function Ze(e) {
196
+ function je(e) {
345
197
  switch (e.algorithm.hash.name) {
346
198
  case "SHA-256":
347
199
  return "PS256";
@@ -350,10 +202,10 @@ function Ze(e) {
350
202
  case "SHA-512":
351
203
  return "PS512";
352
204
  default:
353
- throw new v("unsupported RsaHashedKeyAlgorithm hash name");
205
+ throw new f("unsupported RsaHashedKeyAlgorithm hash name");
354
206
  }
355
207
  }
356
- function Qe(e) {
208
+ function Ue(e) {
357
209
  switch (e.algorithm.hash.name) {
358
210
  case "SHA-256":
359
211
  return "RS256";
@@ -362,10 +214,10 @@ function Qe(e) {
362
214
  case "SHA-512":
363
215
  return "RS512";
364
216
  default:
365
- throw new v("unsupported RsaHashedKeyAlgorithm hash name");
217
+ throw new f("unsupported RsaHashedKeyAlgorithm hash name");
366
218
  }
367
219
  }
368
- function Xe(e) {
220
+ function Ce(e) {
369
221
  switch (e.algorithm.namedCurve) {
370
222
  case "P-256":
371
223
  return "ES256";
@@ -374,39 +226,39 @@ function Xe(e) {
374
226
  case "P-521":
375
227
  return "ES512";
376
228
  default:
377
- throw new v("unsupported EcKeyAlgorithm namedCurve");
229
+ throw new f("unsupported EcKeyAlgorithm namedCurve");
378
230
  }
379
231
  }
380
- function ge(e) {
232
+ function te(e) {
381
233
  switch (e.algorithm.name) {
382
234
  case "RSA-PSS":
383
- return Ze(e);
235
+ return je(e);
384
236
  case "RSASSA-PKCS1-v1_5":
385
- return Qe(e);
237
+ return Ue(e);
386
238
  case "ECDSA":
387
- return Xe(e);
239
+ return Ce(e);
388
240
  case "Ed25519":
389
241
  case "Ed448":
390
242
  return "EdDSA";
391
243
  default:
392
- throw new v("unsupported CryptoKey algorithm name");
244
+ throw new f("unsupported CryptoKey algorithm name");
393
245
  }
394
246
  }
395
- function H(e) {
396
- const t = e == null ? void 0 : e[K];
247
+ function U(e) {
248
+ const t = e == null ? void 0 : e[P];
397
249
  return typeof t == "number" && Number.isFinite(t) ? t : 0;
398
250
  }
399
- function et(e) {
400
- const t = e == null ? void 0 : e[Oe];
251
+ function ze(e) {
252
+ const t = e == null ? void 0 : e[we];
401
253
  return typeof t == "number" && Number.isFinite(t) && Math.sign(t) !== -1 ? t : 30;
402
254
  }
403
- function Q() {
255
+ function D() {
404
256
  return Math.floor(Date.now() / 1e3);
405
257
  }
406
- function tt(e, t) {
407
- const n = Q() + H(t);
258
+ function Je(e, t) {
259
+ const n = D() + U(t);
408
260
  return {
409
- jti: D(),
261
+ jti: j(),
410
262
  aud: [e.issuer, e.token_endpoint],
411
263
  exp: n + 60,
412
264
  iat: n,
@@ -415,240 +267,240 @@ function tt(e, t) {
415
267
  sub: t.client_id
416
268
  };
417
269
  }
418
- async function nt(e, t, n, o) {
419
- return me({
420
- alg: ge(n),
421
- kid: o
422
- }, tt(e, t), n);
270
+ async function Le(e, t, n, r) {
271
+ return ne({
272
+ alg: te(n),
273
+ kid: r
274
+ }, Je(e, t), n);
423
275
  }
424
- function j(e) {
276
+ function T(e) {
425
277
  if (typeof e != "object" || e === null)
426
278
  throw new TypeError('"as" must be an object');
427
- if (!w(e.issuer))
279
+ if (!h(e.issuer))
428
280
  throw new TypeError('"as.issuer" property must be a non-empty string');
429
281
  return !0;
430
282
  }
431
- function z(e) {
283
+ function A(e) {
432
284
  if (typeof e != "object" || e === null)
433
285
  throw new TypeError('"client" must be an object');
434
- if (!w(e.client_id))
286
+ if (!h(e.client_id))
435
287
  throw new TypeError('"client.client_id" property must be a non-empty string');
436
288
  return !0;
437
289
  }
438
- function ae(e) {
439
- if (!w(e))
290
+ function q(e) {
291
+ if (!h(e))
440
292
  throw new TypeError('"client.client_secret" property must be a non-empty string');
441
293
  return e;
442
294
  }
443
- function F(e, t) {
295
+ function C(e, t) {
444
296
  if (t !== void 0)
445
297
  throw new TypeError(`"options.clientPrivateKey" property must not be provided when ${e} client authentication method is used.`);
446
298
  }
447
- function ce(e, t) {
299
+ function V(e, t) {
448
300
  if (t !== void 0)
449
301
  throw new TypeError(`"client.client_secret" property must not be provided when ${e} client authentication method is used.`);
450
302
  }
451
- async function rt(e, t, n, o, s) {
303
+ async function Oe(e, t, n, r, a) {
452
304
  switch (n.delete("client_secret"), n.delete("client_assertion_type"), n.delete("client_assertion"), t.token_endpoint_auth_method) {
453
305
  case void 0:
454
306
  case "client_secret_basic": {
455
- F("client_secret_basic", s), o.set("authorization", Ye(t.client_id, ae(t.client_secret)));
307
+ C("client_secret_basic", a), r.set("authorization", xe(t.client_id, q(t.client_secret)));
456
308
  break;
457
309
  }
458
310
  case "client_secret_post": {
459
- F("client_secret_post", s), n.set("client_id", t.client_id), n.set("client_secret", ae(t.client_secret));
311
+ C("client_secret_post", a), n.set("client_id", t.client_id), n.set("client_secret", q(t.client_secret));
460
312
  break;
461
313
  }
462
314
  case "private_key_jwt": {
463
- if (ce("private_key_jwt", t.client_secret), s === void 0)
315
+ if (V("private_key_jwt", t.client_secret), a === void 0)
464
316
  throw new TypeError('"options.clientPrivateKey" must be provided when "client.token_endpoint_auth_method" is "private_key_jwt"');
465
- const { key: r, kid: i } = Ve(s);
466
- if (!we(r))
317
+ const { key: i, kid: s } = Pe(a);
318
+ if (!ee(i))
467
319
  throw new TypeError('"options.clientPrivateKey.key" must be a private CryptoKey');
468
- n.set("client_id", t.client_id), n.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.set("client_assertion", await nt(e, t, r, i));
320
+ n.set("client_id", t.client_id), n.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.set("client_assertion", await Le(e, t, i, s));
469
321
  break;
470
322
  }
471
323
  case "tls_client_auth":
472
324
  case "self_signed_tls_client_auth":
473
325
  case "none": {
474
- ce(t.token_endpoint_auth_method, t.client_secret), F(t.token_endpoint_auth_method, s), n.set("client_id", t.client_id);
326
+ V(t.token_endpoint_auth_method, t.client_secret), C(t.token_endpoint_auth_method, a), n.set("client_id", t.client_id);
475
327
  break;
476
328
  }
477
329
  default:
478
- throw new v("unsupported client token_endpoint_auth_method");
330
+ throw new f("unsupported client token_endpoint_auth_method");
479
331
  }
480
332
  }
481
- async function me(e, t, n) {
333
+ async function ne(e, t, n) {
482
334
  if (!n.usages.includes("sign"))
483
335
  throw new TypeError('CryptoKey instances used for signing assertions must include "sign" in their "usages"');
484
- const o = `${k(A(JSON.stringify(e)))}.${k(A(JSON.stringify(t)))}`, s = k(await crypto.subtle.sign(Se(n), n, A(o)));
485
- return `${o}.${s}`;
336
+ const r = `${y(_(JSON.stringify(e)))}.${y(_(JSON.stringify(t)))}`, a = y(await crypto.subtle.sign(oe(n), n, _(r)));
337
+ return `${r}.${a}`;
486
338
  }
487
- async function ot(e, t, n, o, s, r) {
488
- const { privateKey: i, publicKey: d, nonce: g = fe.get(n.origin) } = t;
489
- if (!we(i))
339
+ async function Ke(e, t, n, r, a, i) {
340
+ const { privateKey: s, publicKey: c, nonce: d = Q.get(n.origin) } = t;
341
+ if (!ee(s))
490
342
  throw new TypeError('"DPoP.privateKey" must be a private CryptoKey');
491
- if (!$e(d))
343
+ if (!ke(c))
492
344
  throw new TypeError('"DPoP.publicKey" must be a public CryptoKey');
493
- if (g !== void 0 && !w(g))
345
+ if (d !== void 0 && !h(d))
494
346
  throw new TypeError('"DPoP.nonce" must be a non-empty string or undefined');
495
- if (!d.extractable)
347
+ if (!c.extractable)
496
348
  throw new TypeError('"DPoP.publicKey.extractable" must be true');
497
- const m = Q() + s, _ = await me({
498
- alg: ge(i),
349
+ const l = D() + a, S = await ne({
350
+ alg: te(s),
499
351
  typ: "dpop+jwt",
500
- jwk: await st(d)
352
+ jwk: await We(c)
501
353
  }, {
502
- iat: m,
503
- jti: D(),
504
- htm: o,
505
- nonce: g,
354
+ iat: l,
355
+ jti: j(),
356
+ htm: r,
357
+ nonce: d,
506
358
  htu: `${n.origin}${n.pathname}`,
507
- ath: r ? k(await crypto.subtle.digest("SHA-256", A(r))) : void 0
508
- }, i);
509
- e.set("dpop", _);
359
+ ath: i ? y(await crypto.subtle.digest("SHA-256", _(i))) : void 0
360
+ }, s);
361
+ e.set("dpop", S);
510
362
  }
511
- let N;
512
- async function it(e) {
513
- const { kty: t, e: n, n: o, x: s, y: r, crv: i } = await crypto.subtle.exportKey("jwk", e), d = { kty: t, e: n, n: o, x: s, y: r, crv: i };
514
- return N.set(e, d), d;
363
+ let R;
364
+ async function Ne(e) {
365
+ const { kty: t, e: n, n: r, x: a, y: i, crv: s } = await crypto.subtle.exportKey("jwk", e), c = { kty: t, e: n, n: r, x: a, y: i, crv: s };
366
+ return R.set(e, c), c;
515
367
  }
516
- async function st(e) {
517
- return N || (N = /* @__PURE__ */ new WeakMap()), N.get(e) || it(e);
368
+ async function We(e) {
369
+ return R || (R = /* @__PURE__ */ new WeakMap()), R.get(e) || Ne(e);
518
370
  }
519
- function at(e, t, n) {
371
+ function De(e, t, n) {
520
372
  if (typeof e != "string")
521
373
  throw new TypeError(`"as.${t}" must be a string`);
522
374
  return new URL(e);
523
375
  }
524
- function ye(e, t, n) {
525
- return at(e[t], t);
376
+ function re(e, t, n) {
377
+ return De(e[t], t);
526
378
  }
527
- function B(e) {
379
+ function J(e) {
528
380
  const t = e;
529
381
  return typeof t != "object" || Array.isArray(t) || t === null ? !1 : t.error !== void 0;
530
382
  }
531
- async function ct(e, t, n, o, s, r) {
532
- if (!w(e))
383
+ async function He(e, t, n, r, a, i) {
384
+ if (!h(e))
533
385
  throw new TypeError('"accessToken" must be a non-empty string');
534
386
  if (!(n instanceof URL))
535
387
  throw new TypeError('"url" must be an instance of URL');
536
- return o = W(o), (r == null ? void 0 : r.DPoP) === void 0 ? o.set("authorization", `Bearer ${e}`) : (await ot(o, r.DPoP, n, "GET", H({ [K]: r == null ? void 0 : r[K] }), e), o.set("authorization", `DPoP ${e}`)), ((r == null ? void 0 : r[V]) || fetch)(n.href, {
537
- body: s,
538
- headers: Object.fromEntries(o.entries()),
388
+ return r = x(r), (i == null ? void 0 : i.DPoP) === void 0 ? r.set("authorization", `Bearer ${e}`) : (await Ke(r, i.DPoP, n, "GET", U({ [P]: i == null ? void 0 : i[P] }), e), r.set("authorization", `DPoP ${e}`)), ((i == null ? void 0 : i[K]) || fetch)(n.href, {
389
+ body: a,
390
+ headers: Object.fromEntries(r.entries()),
539
391
  method: t,
540
392
  redirect: "manual",
541
- signal: r != null && r.signal ? Z(r.signal) : null
542
- }).then(Y);
543
- }
544
- async function ut(e, t, n, o) {
545
- j(e), z(t);
546
- const s = ye(e, "userinfo_endpoint"), r = W(o == null ? void 0 : o.headers);
547
- return t.userinfo_signed_response_alg ? r.set("accept", "application/jwt") : (r.set("accept", "application/json"), r.append("accept", "application/jwt")), ct(n, "GET", s, r, null, {
548
- ...o,
549
- [K]: H(t)
393
+ signal: i != null && i.signal ? W(i.signal) : null
394
+ }).then(N);
395
+ }
396
+ async function $e(e, t, n, r) {
397
+ T(e), A(t);
398
+ const a = re(e, "userinfo_endpoint"), i = x(r == null ? void 0 : r.headers);
399
+ return t.userinfo_signed_response_alg ? i.set("accept", "application/jwt") : (i.set("accept", "application/json"), i.append("accept", "application/jwt")), He(n, "GET", a, i, null, {
400
+ ...r,
401
+ [P]: U(t)
550
402
  });
551
403
  }
552
- async function lt(e, t, n, o, s, r, i) {
553
- return await rt(e, t, s, r, i == null ? void 0 : i.clientPrivateKey), r.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"), ((i == null ? void 0 : i[V]) || fetch)(o.href, {
554
- body: s,
555
- headers: Object.fromEntries(r.entries()),
404
+ async function Ie(e, t, n, r, a, i, s) {
405
+ return await Oe(e, t, a, i, s == null ? void 0 : s.clientPrivateKey), i.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"), ((s == null ? void 0 : s[K]) || fetch)(r.href, {
406
+ body: a,
407
+ headers: Object.fromEntries(i.entries()),
556
408
  method: n,
557
409
  redirect: "manual",
558
- signal: i != null && i.signal ? Z(i.signal) : null
559
- }).then(Y);
410
+ signal: s != null && s.signal ? W(s.signal) : null
411
+ }).then(N);
560
412
  }
561
- async function _e(e, t, n, o, s) {
562
- const r = ye(e, "token_endpoint");
563
- o.set("grant_type", n);
564
- const i = W(s == null ? void 0 : s.headers);
565
- return i.set("accept", "application/json"), lt(e, t, "POST", r, o, i, s);
413
+ async function ie(e, t, n, r, a) {
414
+ const i = re(e, "token_endpoint");
415
+ r.set("grant_type", n);
416
+ const s = x(a == null ? void 0 : a.headers);
417
+ return s.set("accept", "application/json"), Ie(e, t, "POST", i, r, s, a);
566
418
  }
567
- async function dt(e, t, n, o) {
568
- if (j(e), z(t), !w(n))
419
+ async function Me(e, t, n, r) {
420
+ if (T(e), A(t), !h(n))
569
421
  throw new TypeError('"refreshToken" must be a non-empty string');
570
- const s = new URLSearchParams(o == null ? void 0 : o.additionalParameters);
571
- return s.set("refresh_token", n), _e(e, t, "refresh_token", s, o);
422
+ const a = new URLSearchParams(r == null ? void 0 : r.additionalParameters);
423
+ return a.set("refresh_token", n), ie(e, t, "refresh_token", a, r);
572
424
  }
573
- const ht = /* @__PURE__ */ new WeakMap();
574
- async function be(e, t, n, o = !1, s = !1) {
575
- if (j(e), z(t), !q(n, Response))
425
+ const Be = /* @__PURE__ */ new WeakMap();
426
+ async function se(e, t, n, r = !1, a = !1) {
427
+ if (T(e), A(t), !O(n, Response))
576
428
  throw new TypeError('"response" must be an instance of Response');
577
429
  if (n.status !== 200) {
578
- let i;
579
- if (i = await vt(n))
580
- return i;
581
- throw new a('"response" is not a conform Token Endpoint response');
430
+ let s;
431
+ if (s = await et(n))
432
+ return s;
433
+ throw new o('"response" is not a conform Token Endpoint response');
582
434
  }
583
- X(n);
584
- let r;
435
+ H(n);
436
+ let i;
585
437
  try {
586
- r = await n.json();
587
- } catch (i) {
588
- throw new a('failed to parse "response" body as JSON', { cause: i });
589
- }
590
- if (!C(r))
591
- throw new a('"response" body must be a top level object');
592
- if (!w(r.access_token))
593
- throw new a('"response" body "access_token" property must be a non-empty string');
594
- if (!w(r.token_type))
595
- throw new a('"response" body "token_type" property must be a non-empty string');
596
- if (r.token_type = r.token_type.toLowerCase(), r.token_type !== "dpop" && r.token_type !== "bearer")
597
- throw new v("unsupported `token_type` value");
598
- if (r.expires_in !== void 0 && (typeof r.expires_in != "number" || r.expires_in <= 0))
599
- throw new a('"response" body "expires_in" property must be a positive number');
600
- if (!s && r.refresh_token !== void 0 && !w(r.refresh_token))
601
- throw new a('"response" body "refresh_token" property must be a non-empty string');
602
- if (r.scope !== void 0 && typeof r.scope != "string")
603
- throw new a('"response" body "scope" property must be a string');
604
- if (!o) {
605
- if (r.id_token !== void 0 && !w(r.id_token))
606
- throw new a('"response" body "id_token" property must be a non-empty string');
607
- if (r.id_token) {
608
- const { claims: i } = await Et(r.id_token, kt.bind(void 0, t.id_token_signed_response_alg, e.id_token_signing_alg_values_supported), Ee, H(t), et(t)).then(_t.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(wt.bind(void 0, e.issuer)).then(pt.bind(void 0, t.client_id));
609
- if (Array.isArray(i.aud) && i.aud.length !== 1 && i.azp !== t.client_id)
610
- throw new a('unexpected ID Token "azp" (authorized party) claim value');
611
- if (i.auth_time !== void 0 && (!Number.isFinite(i.auth_time) || Math.sign(i.auth_time) !== 1))
612
- throw new a('ID Token "auth_time" (authentication time) must be a positive number');
613
- ht.set(r, i);
438
+ i = await n.json();
439
+ } catch (s) {
440
+ throw new o('failed to parse "response" body as JSON', { cause: s });
441
+ }
442
+ if (!E(i))
443
+ throw new o('"response" body must be a top level object');
444
+ if (!h(i.access_token))
445
+ throw new o('"response" body "access_token" property must be a non-empty string');
446
+ if (!h(i.token_type))
447
+ throw new o('"response" body "token_type" property must be a non-empty string');
448
+ if (i.token_type = i.token_type.toLowerCase(), i.token_type !== "dpop" && i.token_type !== "bearer")
449
+ throw new f("unsupported `token_type` value");
450
+ if (i.expires_in !== void 0 && (typeof i.expires_in != "number" || i.expires_in <= 0))
451
+ throw new o('"response" body "expires_in" property must be a positive number');
452
+ if (!a && i.refresh_token !== void 0 && !h(i.refresh_token))
453
+ throw new o('"response" body "refresh_token" property must be a non-empty string');
454
+ if (i.scope !== void 0 && typeof i.scope != "string")
455
+ throw new o('"response" body "scope" property must be a string');
456
+ if (!r) {
457
+ if (i.id_token !== void 0 && !h(i.id_token))
458
+ throw new o('"response" body "id_token" property must be a non-empty string');
459
+ if (i.id_token) {
460
+ const { claims: s } = await nt(i.id_token, rt.bind(void 0, t.id_token_signed_response_alg, e.id_token_signing_alg_values_supported), ce, U(t), ze(t)).then(Qe.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(Ve.bind(void 0, e.issuer)).then(qe.bind(void 0, t.client_id));
461
+ if (Array.isArray(s.aud) && s.aud.length !== 1 && s.azp !== t.client_id)
462
+ throw new o('unexpected ID Token "azp" (authorized party) claim value');
463
+ if (s.auth_time !== void 0 && (!Number.isFinite(s.auth_time) || Math.sign(s.auth_time) !== 1))
464
+ throw new o('ID Token "auth_time" (authentication time) must be a positive number');
465
+ Be.set(i, s);
614
466
  }
615
467
  }
616
- return r;
468
+ return i;
617
469
  }
618
- async function ft(e, t, n) {
619
- return be(e, t, n);
470
+ async function Fe(e, t, n) {
471
+ return se(e, t, n);
620
472
  }
621
- function pt(e, t) {
473
+ function qe(e, t) {
622
474
  if (Array.isArray(t.claims.aud)) {
623
475
  if (!t.claims.aud.includes(e))
624
- throw new a('unexpected JWT "aud" (audience) claim value');
476
+ throw new o('unexpected JWT "aud" (audience) claim value');
625
477
  } else if (t.claims.aud !== e)
626
- throw new a('unexpected JWT "aud" (audience) claim value');
478
+ throw new o('unexpected JWT "aud" (audience) claim value');
627
479
  return t;
628
480
  }
629
- function wt(e, t) {
481
+ function Ve(e, t) {
630
482
  if (t.claims.iss !== e)
631
- throw new a('unexpected JWT "iss" (issuer) claim value');
483
+ throw new o('unexpected JWT "iss" (issuer) claim value');
632
484
  return t;
633
485
  }
634
- const ve = /* @__PURE__ */ new WeakSet();
635
- function gt(e) {
636
- return ve.add(e), e;
486
+ const ae = /* @__PURE__ */ new WeakSet();
487
+ function Ge(e) {
488
+ return ae.add(e), e;
637
489
  }
638
- async function mt(e, t, n, o, s, r) {
639
- if (j(e), z(t), !ve.has(n))
490
+ async function Ye(e, t, n, r, a, i) {
491
+ if (T(e), A(t), !ae.has(n))
640
492
  throw new TypeError('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()');
641
- if (!w(o))
493
+ if (!h(r))
642
494
  throw new TypeError('"redirectUri" must be a non-empty string');
643
- if (!w(s))
495
+ if (!h(a))
644
496
  throw new TypeError('"codeVerifier" must be a non-empty string');
645
- const i = E(n, "code");
646
- if (!i)
647
- throw new a('no authorization code in "callbackParameters"');
648
- const d = new URLSearchParams(r == null ? void 0 : r.additionalParameters);
649
- return d.set("redirect_uri", o), d.set("code_verifier", s), d.set("code", i), _e(e, t, "authorization_code", d, r);
497
+ const s = m(n, "code");
498
+ if (!s)
499
+ throw new o('no authorization code in "callbackParameters"');
500
+ const c = new URLSearchParams(i == null ? void 0 : i.additionalParameters);
501
+ return c.set("redirect_uri", r), c.set("code_verifier", a), c.set("code", s), ie(e, t, "authorization_code", c, i);
650
502
  }
651
- const yt = {
503
+ const Ze = {
652
504
  aud: "audience",
653
505
  c_hash: "code hash",
654
506
  client_id: "client id",
@@ -664,43 +516,43 @@ const yt = {
664
516
  htu: "http uri",
665
517
  cnf: "confirmation"
666
518
  };
667
- function _t(e, t) {
519
+ function Qe(e, t) {
668
520
  for (const n of e)
669
521
  if (t.claims[n] === void 0)
670
- throw new a(`JWT "${n}" (${yt[n]}) claim missing`);
522
+ throw new o(`JWT "${n}" (${Ze[n]}) claim missing`);
671
523
  return t;
672
524
  }
673
- async function bt(e, t, n) {
674
- const o = await be(e, t, n, !0);
675
- if (B(o))
676
- return o;
677
- if (o.id_token !== void 0) {
678
- if (typeof o.id_token == "string" && o.id_token.length)
679
- throw new a("Unexpected ID Token returned, use processAuthorizationCodeOpenIDResponse() for OpenID Connect callback processing");
680
- delete o.id_token;
525
+ async function Xe(e, t, n) {
526
+ const r = await se(e, t, n, !0);
527
+ if (J(r))
528
+ return r;
529
+ if (r.id_token !== void 0) {
530
+ if (typeof r.id_token == "string" && r.id_token.length)
531
+ throw new o("Unexpected ID Token returned, use processAuthorizationCodeOpenIDResponse() for OpenID Connect callback processing");
532
+ delete r.id_token;
681
533
  }
682
- return o;
534
+ return r;
683
535
  }
684
- function X(e) {
536
+ function H(e) {
685
537
  if (e.bodyUsed)
686
538
  throw new TypeError('"response" body has been used already');
687
539
  }
688
- async function vt(e) {
540
+ async function et(e) {
689
541
  if (e.status > 399 && e.status < 500) {
690
- X(e);
542
+ H(e);
691
543
  try {
692
544
  const t = await e.json();
693
- if (C(t) && typeof t.error == "string" && t.error.length)
545
+ if (E(t) && typeof t.error == "string" && t.error.length)
694
546
  return t.error_description !== void 0 && typeof t.error_description != "string" && delete t.error_description, t.error_uri !== void 0 && typeof t.error_uri != "string" && delete t.error_uri, t.algs !== void 0 && typeof t.algs != "string" && delete t.algs, t.scope !== void 0 && typeof t.scope != "string" && delete t.scope, t;
695
547
  } catch {
696
548
  }
697
549
  }
698
550
  }
699
- function ue(e) {
551
+ function G(e) {
700
552
  if (typeof e.modulusLength != "number" || e.modulusLength < 2048)
701
- throw new a(`${e.name} modulusLength must be at least 2048 bits`);
553
+ throw new o(`${e.name} modulusLength must be at least 2048 bits`);
702
554
  }
703
- function St(e) {
555
+ function tt(e) {
704
556
  switch (e) {
705
557
  case "P-256":
706
558
  return "SHA-256";
@@ -709,18 +561,18 @@ function St(e) {
709
561
  case "P-521":
710
562
  return "SHA-512";
711
563
  default:
712
- throw new v();
564
+ throw new f();
713
565
  }
714
566
  }
715
- function Se(e) {
567
+ function oe(e) {
716
568
  switch (e.algorithm.name) {
717
569
  case "ECDSA":
718
570
  return {
719
571
  name: e.algorithm.name,
720
- hash: St(e.algorithm.namedCurve)
572
+ hash: tt(e.algorithm.namedCurve)
721
573
  };
722
574
  case "RSA-PSS":
723
- switch (ue(e.algorithm), e.algorithm.hash.name) {
575
+ switch (G(e.algorithm), e.algorithm.hash.name) {
724
576
  case "SHA-256":
725
577
  case "SHA-384":
726
578
  case "SHA-512":
@@ -729,228 +581,229 @@ function Se(e) {
729
581
  saltLength: parseInt(e.algorithm.hash.name.slice(-3), 10) >> 3
730
582
  };
731
583
  default:
732
- throw new v();
584
+ throw new f();
733
585
  }
734
586
  case "RSASSA-PKCS1-v1_5":
735
- return ue(e.algorithm), e.algorithm.name;
587
+ return G(e.algorithm), e.algorithm.name;
736
588
  case "Ed448":
737
589
  case "Ed25519":
738
590
  return e.algorithm.name;
739
591
  }
740
- throw new v();
741
- }
742
- const Ee = Symbol();
743
- async function Et(e, t, n, o, s) {
744
- const { 0: r, 1: i, 2: d, length: g } = e.split(".");
745
- if (g === 5)
746
- throw new v("JWE structure JWTs are not supported");
747
- if (g !== 3)
748
- throw new a("Invalid JWT");
749
- let m;
592
+ throw new f();
593
+ }
594
+ const ce = Symbol();
595
+ async function nt(e, t, n, r, a) {
596
+ const { 0: i, 1: s, 2: c, length: d } = e.split(".");
597
+ if (d === 5)
598
+ throw new f("JWE structure JWTs are not supported");
599
+ if (d !== 3)
600
+ throw new o("Invalid JWT");
601
+ let l;
750
602
  try {
751
- m = JSON.parse(A(k(r)));
752
- } catch (R) {
753
- throw new a("failed to parse JWT Header body as base64url encoded JSON", { cause: R });
754
- }
755
- if (!C(m))
756
- throw new a("JWT Header must be a top level object");
757
- if (t(m), m.crit !== void 0)
758
- throw new a('unexpected JWT "crit" header parameter');
759
- const _ = k(d);
760
- let y;
761
- if (n !== Ee) {
762
- y = await n(m);
763
- const R = `${r}.${i}`;
764
- if (!await crypto.subtle.verify(Se(y), y, _, A(R)))
765
- throw new a("JWT signature verification failed");
766
- }
767
- let h;
603
+ l = JSON.parse(_(y(i)));
604
+ } catch (k) {
605
+ throw new o("failed to parse JWT Header body as base64url encoded JSON", { cause: k });
606
+ }
607
+ if (!E(l))
608
+ throw new o("JWT Header must be a top level object");
609
+ if (t(l), l.crit !== void 0)
610
+ throw new o('unexpected JWT "crit" header parameter');
611
+ const S = y(c);
612
+ let p;
613
+ if (n !== ce) {
614
+ p = await n(l);
615
+ const k = `${i}.${s}`;
616
+ if (!await crypto.subtle.verify(oe(p), p, S, _(k)))
617
+ throw new o("JWT signature verification failed");
618
+ }
619
+ let u;
768
620
  try {
769
- h = JSON.parse(A(k(i)));
770
- } catch (R) {
771
- throw new a("failed to parse JWT Payload body as base64url encoded JSON", { cause: R });
772
- }
773
- if (!C(h))
774
- throw new a("JWT Payload must be a top level object");
775
- const L = Q() + o;
776
- if (h.exp !== void 0) {
777
- if (typeof h.exp != "number")
778
- throw new a('unexpected JWT "exp" (expiration time) claim type');
779
- if (h.exp <= L - s)
780
- throw new a('unexpected JWT "exp" (expiration time) claim value, timestamp is <= now()');
781
- }
782
- if (h.iat !== void 0 && typeof h.iat != "number")
783
- throw new a('unexpected JWT "iat" (issued at) claim type');
784
- if (h.iss !== void 0 && typeof h.iss != "string")
785
- throw new a('unexpected JWT "iss" (issuer) claim type');
786
- if (h.nbf !== void 0) {
787
- if (typeof h.nbf != "number")
788
- throw new a('unexpected JWT "nbf" (not before) claim type');
789
- if (h.nbf > L + s)
790
- throw new a('unexpected JWT "nbf" (not before) claim value, timestamp is > now()');
791
- }
792
- if (h.aud !== void 0 && typeof h.aud != "string" && !Array.isArray(h.aud))
793
- throw new a('unexpected JWT "aud" (audience) claim type');
794
- return { header: m, claims: h, signature: _, key: y };
795
- }
796
- function kt(e, t, n) {
621
+ u = JSON.parse(_(y(s)));
622
+ } catch (k) {
623
+ throw new o("failed to parse JWT Payload body as base64url encoded JSON", { cause: k });
624
+ }
625
+ if (!E(u))
626
+ throw new o("JWT Payload must be a top level object");
627
+ const $ = D() + r;
628
+ if (u.exp !== void 0) {
629
+ if (typeof u.exp != "number")
630
+ throw new o('unexpected JWT "exp" (expiration time) claim type');
631
+ if (u.exp <= $ - a)
632
+ throw new o('unexpected JWT "exp" (expiration time) claim value, timestamp is <= now()');
633
+ }
634
+ if (u.iat !== void 0 && typeof u.iat != "number")
635
+ throw new o('unexpected JWT "iat" (issued at) claim type');
636
+ if (u.iss !== void 0 && typeof u.iss != "string")
637
+ throw new o('unexpected JWT "iss" (issuer) claim type');
638
+ if (u.nbf !== void 0) {
639
+ if (typeof u.nbf != "number")
640
+ throw new o('unexpected JWT "nbf" (not before) claim type');
641
+ if (u.nbf > $ + a)
642
+ throw new o('unexpected JWT "nbf" (not before) claim value, timestamp is > now()');
643
+ }
644
+ if (u.aud !== void 0 && typeof u.aud != "string" && !Array.isArray(u.aud))
645
+ throw new o('unexpected JWT "aud" (audience) claim type');
646
+ return { header: l, claims: u, signature: S, key: p };
647
+ }
648
+ function rt(e, t, n) {
797
649
  if (e !== void 0) {
798
650
  if (n.alg !== e)
799
- throw new a('unexpected JWT "alg" header parameter');
651
+ throw new o('unexpected JWT "alg" header parameter');
800
652
  return;
801
653
  }
802
654
  if (Array.isArray(t)) {
803
655
  if (!t.includes(n.alg))
804
- throw new a('unexpected JWT "alg" header parameter');
656
+ throw new o('unexpected JWT "alg" header parameter');
805
657
  return;
806
658
  }
807
659
  if (n.alg !== "RS256")
808
- throw new a('unexpected JWT "alg" header parameter');
660
+ throw new o('unexpected JWT "alg" header parameter');
809
661
  }
810
- function E(e, t) {
811
- const { 0: n, length: o } = e.getAll(t);
812
- if (o > 1)
813
- throw new a(`"${t}" parameter must be provided only once`);
662
+ function m(e, t) {
663
+ const { 0: n, length: r } = e.getAll(t);
664
+ if (r > 1)
665
+ throw new o(`"${t}" parameter must be provided only once`);
814
666
  return n;
815
667
  }
816
- const Tt = Symbol(), At = Symbol();
817
- function Rt(e, t, n, o) {
818
- if (j(e), z(t), n instanceof URL && (n = n.searchParams), !(n instanceof URLSearchParams))
668
+ const it = Symbol(), st = Symbol();
669
+ function at(e, t, n, r) {
670
+ if (T(e), A(t), n instanceof URL && (n = n.searchParams), !(n instanceof URLSearchParams))
819
671
  throw new TypeError('"parameters" must be an instance of URLSearchParams, or URL');
820
- if (E(n, "response"))
821
- throw new a('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()');
822
- const s = E(n, "iss"), r = E(n, "state");
823
- if (!s && e.authorization_response_iss_parameter_supported)
824
- throw new a('response parameter "iss" (issuer) missing');
825
- if (s && s !== e.issuer)
826
- throw new a('unexpected "iss" (issuer) response parameter value');
827
- switch (o) {
672
+ if (m(n, "response"))
673
+ throw new o('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()');
674
+ const a = m(n, "iss"), i = m(n, "state");
675
+ if (!a && e.authorization_response_iss_parameter_supported)
676
+ throw new o('response parameter "iss" (issuer) missing');
677
+ if (a && a !== e.issuer)
678
+ throw new o('unexpected "iss" (issuer) response parameter value');
679
+ switch (r) {
828
680
  case void 0:
829
- case At:
830
- if (r !== void 0)
831
- throw new a('unexpected "state" response parameter encountered');
681
+ case st:
682
+ if (i !== void 0)
683
+ throw new o('unexpected "state" response parameter encountered');
832
684
  break;
833
- case Tt:
685
+ case it:
834
686
  break;
835
687
  default:
836
- if (!w(o))
837
- throw new a('"expectedState" must be a non-empty string');
838
- if (r === void 0)
839
- throw new a('response parameter "state" missing');
840
- if (r !== o)
841
- throw new a('unexpected "state" response parameter value');
842
- }
843
- const i = E(n, "error");
844
- if (i)
688
+ if (!h(r))
689
+ throw new o('"expectedState" must be a non-empty string');
690
+ if (i === void 0)
691
+ throw new o('response parameter "state" missing');
692
+ if (i !== r)
693
+ throw new o('unexpected "state" response parameter value');
694
+ }
695
+ const s = m(n, "error");
696
+ if (s)
845
697
  return {
846
- error: i,
847
- error_description: E(n, "error_description"),
848
- error_uri: E(n, "error_uri")
698
+ error: s,
699
+ error_description: m(n, "error_description"),
700
+ error_uri: m(n, "error_uri")
849
701
  };
850
- const d = E(n, "id_token"), g = E(n, "token");
851
- if (d !== void 0 || g !== void 0)
852
- throw new v("implicit and hybrid flows are not supported");
853
- return gt(new URLSearchParams(n));
702
+ const c = m(n, "id_token"), d = m(n, "token");
703
+ if (c !== void 0 || d !== void 0)
704
+ throw new f("implicit and hybrid flows are not supported");
705
+ return Ge(new URLSearchParams(n));
854
706
  }
855
- class P extends Error {
707
+ class b extends Error {
856
708
  }
857
- class G extends P {
858
- constructor(t, n, o) {
859
- super(t, o), this.error = n;
709
+ class L extends b {
710
+ constructor(t, n, r) {
711
+ super(t, r), this.error = n;
860
712
  }
861
713
  }
862
- function xt({
714
+ function ot({
863
715
  handleCallback: e
864
716
  }) {
865
- const t = Ce(!1), [n, o] = je(void 0), s = Pe();
866
- return ze(() => {
717
+ const t = fe(!1), [n, r] = le(void 0), a = de();
718
+ return pe(() => {
867
719
  t.current || (t.current = !0, e().then(() => {
868
- s("/");
869
- }).catch((r) => {
870
- o(r);
720
+ a("/");
721
+ }).catch((i) => {
722
+ r(i);
871
723
  }));
872
- }, []), n ? n instanceof G ? /* @__PURE__ */ T.jsxs("div", { children: [
873
- /* @__PURE__ */ T.jsx("h2", { children: "Error" }),
874
- /* @__PURE__ */ T.jsxs("pre", { children: [
724
+ }, []), n ? n instanceof L ? /* @__PURE__ */ g.jsxs("div", { children: [
725
+ /* @__PURE__ */ g.jsx("h2", { children: "Error" }),
726
+ /* @__PURE__ */ g.jsxs("pre", { children: [
875
727
  n.error.error,
876
728
  n.error.error_description,
877
729
  n.error.error_uri
878
730
  ] })
879
- ] }) : /* @__PURE__ */ T.jsxs("div", { children: [
880
- /* @__PURE__ */ T.jsx("h2", { children: "Error" }),
881
- /* @__PURE__ */ T.jsxs("pre", { children: [
731
+ ] }) : /* @__PURE__ */ g.jsxs("div", { children: [
732
+ /* @__PURE__ */ g.jsx("h2", { children: "Error" }),
733
+ /* @__PURE__ */ g.jsxs("pre", { children: [
882
734
  n.message,
883
735
  n.stack
884
736
  ] })
885
- ] }) : /* @__PURE__ */ T.jsx("div", { children: "Loading..." });
737
+ ] }) : /* @__PURE__ */ g.jsx("div", { children: "Loading..." });
886
738
  }
887
- const le = "code-verifier";
888
- class Pt {
739
+ const Y = "code-verifier";
740
+ class ct {
889
741
  constructor({
890
742
  issuer: t,
891
743
  authorizationEndpoint: n,
892
- tokenEndpoint: o,
893
- clientId: s
744
+ tokenEndpoint: r,
745
+ clientId: a
894
746
  }) {
895
- S(this, "client");
896
- S(this, "issuer");
897
- S(this, "authorizationEndpoint");
898
- S(this, "tokenEndpoint");
899
- S(this, "authorizationServer");
900
- S(this, "tokens");
901
- S(this, "callbackUrlPath", "/oauth/callback");
902
- S(this, "logoutRedirectUrlPath", "/");
903
- S(this, "handleCallback", async () => {
904
- const t = new URL(window.location.href), n = t.searchParams.get("state"), o = localStorage.getItem(le);
905
- if (!o)
906
- throw new P(
747
+ w(this, "client");
748
+ w(this, "issuer");
749
+ w(this, "authorizationEndpoint");
750
+ w(this, "tokenEndpoint");
751
+ w(this, "authorizationServer");
752
+ w(this, "tokens");
753
+ w(this, "callbackUrlPath", "/oauth/callback");
754
+ w(this, "logoutRedirectUrlPath", "/");
755
+ w(this, "handleCallback", async () => {
756
+ const t = new URL(window.location.href), n = t.searchParams.get("state"), r = localStorage.getItem(Y);
757
+ if (!r)
758
+ throw new b(
907
759
  "Code verifier not found. Invalid auth state."
908
760
  );
909
- const s = await this.getAuthServer(), r = Rt(
910
- s,
761
+ const a = await this.getAuthServer(), i = at(
762
+ a,
911
763
  this.client,
912
764
  t.searchParams,
913
765
  n ?? void 0
914
766
  );
915
- if (B(r))
916
- throw oe.error("Error validating OAuth response", r), new G(
767
+ if (J(i))
768
+ throw I.error("Error validating OAuth response", i), new L(
917
769
  "Error validating OAuth response",
918
- r
770
+ i
919
771
  );
920
- const i = new URL(t);
921
- i.pathname = this.callbackUrlPath, i.search = "";
922
- const d = await mt(
923
- s,
772
+ const s = new URL(t);
773
+ s.pathname = this.callbackUrlPath, s.search = "";
774
+ const c = await Ye(
775
+ a,
924
776
  this.client,
925
- r,
926
- i.toString(),
927
- o
928
- ), g = await bt(
929
- s,
777
+ i,
778
+ s.toString(),
779
+ r
780
+ ), d = await Xe(
781
+ a,
930
782
  this.client,
931
- d
783
+ c
932
784
  );
933
- this.setTokensFromResponse(g);
934
- const m = await this.getAccessToken(), y = await (await ut(
935
- s,
785
+ this.setTokensFromResponse(d);
786
+ const l = await this.getAccessToken(), p = await (await $e(
787
+ a,
936
788
  this.client,
937
- m
938
- )).json(), h = {
939
- sub: y.sub,
940
- email: y.email,
941
- name: y.name,
942
- emailVerified: y.email_verified ?? !1,
943
- pictureUrl: y.picture
789
+ l
790
+ )).json(), u = {
791
+ sub: p.sub,
792
+ email: p.email,
793
+ name: p.name,
794
+ emailVerified: p.email_verified ?? !1,
795
+ pictureUrl: p.picture
944
796
  };
945
- re.setState({
797
+ M.setState({
946
798
  isAuthenticated: !0,
947
- profile: h
799
+ isPending: !1,
800
+ profile: u
948
801
  });
949
802
  });
950
803
  this.client = {
951
- client_id: s,
804
+ client_id: a,
952
805
  token_endpoint_auth_method: "none"
953
- }, this.issuer = t, this.authorizationEndpoint = n, this.tokenEndpoint = o;
806
+ }, this.issuer = t, this.authorizationEndpoint = n, this.tokenEndpoint = r;
954
807
  }
955
808
  async getAuthServer() {
956
809
  if (!this.authorizationServer)
@@ -962,8 +815,8 @@ class Pt {
962
815
  code_challenge_methods_supported: []
963
816
  };
964
817
  else {
965
- const t = new URL(this.issuer), n = await Fe(t);
966
- this.authorizationServer = await Me(
818
+ const t = new URL(this.issuer), n = await Ee(t);
819
+ this.authorizationServer = await Te(
967
820
  t,
968
821
  n
969
822
  );
@@ -975,10 +828,10 @@ class Pt {
975
828
  * @param response
976
829
  */
977
830
  setTokensFromResponse(t) {
978
- if (B(t))
979
- throw oe.error("Bad Token Response", t), new G("Bad Token Response", t);
831
+ if (J(t))
832
+ throw I.error("Bad Token Response", t), new L("Bad Token Response", t);
980
833
  if (!t.expires_in)
981
- throw new P("No expires_in in response");
834
+ throw new b("No expires_in in response");
982
835
  this.tokens = {
983
836
  accessToken: t.access_token,
984
837
  refreshToken: t.refresh_token,
@@ -989,70 +842,71 @@ class Pt {
989
842
  async initialize() {
990
843
  }
991
844
  async login() {
992
- var d;
845
+ var c;
993
846
  const t = "S256", n = await this.getAuthServer();
994
847
  if (!n.authorization_endpoint)
995
- throw new P("No authorization endpoint");
996
- const o = Be(), s = await qe(o);
997
- localStorage.setItem(le, o);
998
- const r = new URL(
848
+ throw new b("No authorization endpoint");
849
+ const r = Ae(), a = await Re(r);
850
+ localStorage.setItem(Y, r);
851
+ const i = new URL(
999
852
  n.authorization_endpoint
1000
- ), i = new URL(window.location.href);
1001
- if (i.pathname = this.callbackUrlPath, i.search = "", r.searchParams.set("client_id", this.client.client_id), r.searchParams.set("redirect_uri", i.toString()), r.searchParams.set("response_type", "code"), r.searchParams.set("scope", "openid+profile+email"), r.searchParams.set("code_challenge", s), r.searchParams.set(
853
+ ), s = new URL(window.location.href);
854
+ if (s.pathname = this.callbackUrlPath, s.search = "", i.searchParams.set("client_id", this.client.client_id), i.searchParams.set("redirect_uri", s.toString()), i.searchParams.set("response_type", "code"), i.searchParams.set("scope", "openid+profile+email"), i.searchParams.set("code_challenge", a), i.searchParams.set(
1002
855
  "code_challenge_method",
1003
856
  t
1004
- ), ((d = n.code_challenge_methods_supported) == null ? void 0 : d.includes("S256")) !== !0) {
1005
- const g = Ge();
1006
- r.searchParams.set("state", g);
857
+ ), ((c = n.code_challenge_methods_supported) == null ? void 0 : c.includes("S256")) !== !0) {
858
+ const d = ve();
859
+ i.searchParams.set("state", d);
1007
860
  }
1008
- location.href = r.href;
861
+ location.href = i.href;
1009
862
  }
1010
863
  async getAccessToken() {
1011
864
  const t = await this.getAuthServer();
1012
865
  if (!this.tokens)
1013
- throw new P("User is not authenticated");
866
+ throw new b("User is not authenticated");
1014
867
  if (this.tokens.expiresOn < /* @__PURE__ */ new Date()) {
1015
868
  if (!this.tokens.refreshToken)
1016
- throw new P(
869
+ throw new b(
1017
870
  "Token expired and no refresh token available"
1018
871
  );
1019
- const n = await dt(
872
+ const n = await Me(
1020
873
  t,
1021
874
  this.client,
1022
875
  this.tokens.refreshToken
1023
- ), o = await ft(
876
+ ), r = await Fe(
1024
877
  t,
1025
878
  this.client,
1026
879
  n
1027
880
  );
1028
- this.setTokensFromResponse(o);
881
+ this.setTokensFromResponse(r);
1029
882
  }
1030
883
  return this.tokens.accessToken;
1031
884
  }
1032
885
  async logout() {
1033
- re.setState({
886
+ M.setState({
1034
887
  isAuthenticated: !1,
888
+ isPending: !1,
1035
889
  profile: void 0
1036
890
  });
1037
891
  const t = await this.getAuthServer(), n = new URL(window.location.href);
1038
892
  n.pathname = this.logoutRedirectUrlPath;
1039
- let o;
1040
- t.end_session_endpoint ? (o = new URL(t.end_session_endpoint), o.searchParams.set(
893
+ let r;
894
+ t.end_session_endpoint ? (r = new URL(t.end_session_endpoint), r.searchParams.set(
1041
895
  "post_logout_redirect_uri",
1042
896
  n.toString()
1043
- )) : o = n;
897
+ )) : r = n;
1044
898
  }
1045
899
  getRoutes() {
1046
900
  return [
1047
901
  {
1048
902
  path: this.callbackUrlPath,
1049
- element: /* @__PURE__ */ T.jsx(xt, { handleCallback: this.handleCallback })
903
+ element: /* @__PURE__ */ g.jsx(ot, { handleCallback: this.handleCallback })
1050
904
  }
1051
905
  ];
1052
906
  }
1053
907
  }
1054
- const Jt = (e) => new Pt(e);
908
+ const wt = (e) => new ct(e);
1055
909
  export {
1056
- Pt as OpenIDAuthenticationProvider,
1057
- Jt as default
910
+ ct as OpenIDAuthenticationProvider,
911
+ wt as default
1058
912
  };