zudoku 0.3.0-dev.7 → 0.3.0-dev.70

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