mada-design-system 0.9.1 → 1.0.1

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 (1013) hide show
  1. package/eslint.config.cjs +43 -0
  2. package/index.cjs.js +1 -1
  3. package/index.cjs10.js +1 -3
  4. package/index.cjs100.js +1 -1
  5. package/index.cjs101.js +1 -1
  6. package/index.cjs102.js +1 -1
  7. package/index.cjs103.js +1 -1
  8. package/index.cjs104.js +1 -1
  9. package/index.cjs105.js +1 -1
  10. package/index.cjs106.js +1 -1
  11. package/index.cjs107.js +1 -1
  12. package/index.cjs108.js +1 -1
  13. package/index.cjs109.js +1 -1
  14. package/index.cjs11.js +1 -1
  15. package/index.cjs110.js +1 -1
  16. package/index.cjs111.js +1 -1
  17. package/index.cjs112.js +1 -5
  18. package/index.cjs113.js +1 -1
  19. package/index.cjs114.js +5 -1
  20. package/index.cjs115.js +1 -1
  21. package/index.cjs116.js +1 -1
  22. package/index.cjs117.js +1 -1
  23. package/index.cjs118.js +1 -1
  24. package/index.cjs119.js +1 -1
  25. package/index.cjs12.js +1 -1
  26. package/index.cjs120.js +1 -1
  27. package/index.cjs121.js +1 -1
  28. package/index.cjs122.js +1 -1
  29. package/index.cjs123.js +1 -1
  30. package/index.cjs124.js +1 -1
  31. package/index.cjs125.js +1 -4
  32. package/index.cjs126.js +1 -1
  33. package/index.cjs127.js +1 -2
  34. package/index.cjs128.js +1 -1
  35. package/index.cjs129.js +1 -2
  36. package/index.cjs13.js +1 -1
  37. package/index.cjs130.js +1 -1
  38. package/index.cjs131.js +1 -1
  39. package/index.cjs132.js +1 -1
  40. package/index.cjs133.js +1 -1
  41. package/index.cjs134.js +1 -1
  42. package/index.cjs135.js +1 -1
  43. package/index.cjs136.js +1 -1
  44. package/index.cjs137.js +1 -20
  45. package/index.cjs138.js +1 -1
  46. package/index.cjs139.js +1 -1
  47. package/index.cjs14.js +3 -1
  48. package/index.cjs140.js +1 -1
  49. package/index.cjs141.js +20 -1
  50. package/index.cjs142.js +1 -1
  51. package/index.cjs143.js +1 -1
  52. package/index.cjs144.js +1 -1
  53. package/index.cjs145.js +1 -1
  54. package/index.cjs146.js +1 -1
  55. package/index.cjs147.js +1 -1
  56. package/index.cjs148.js +1 -1
  57. package/index.cjs149.js +1 -1
  58. package/index.cjs15.js +1 -1
  59. package/index.cjs150.js +1 -1
  60. package/index.cjs151.js +1 -1
  61. package/index.cjs152.js +1 -1
  62. package/index.cjs153.js +1 -1
  63. package/index.cjs154.js +1 -1
  64. package/index.cjs155.js +1 -1
  65. package/index.cjs156.js +1 -1
  66. package/index.cjs157.js +1 -1
  67. package/index.cjs158.js +1 -1
  68. package/index.cjs159.js +1 -1
  69. package/index.cjs16.js +1 -1
  70. package/index.cjs160.js +1 -1
  71. package/index.cjs161.js +1 -1
  72. package/index.cjs162.js +1 -1
  73. package/index.cjs163.js +1 -1
  74. package/index.cjs164.js +1 -1
  75. package/index.cjs165.js +1 -1
  76. package/index.cjs166.js +1 -1
  77. package/index.cjs167.js +1 -1
  78. package/index.cjs168.js +1 -1
  79. package/index.cjs169.js +1 -1
  80. package/index.cjs17.js +1 -1
  81. package/index.cjs170.js +1 -1
  82. package/index.cjs171.js +1 -1
  83. package/index.cjs172.js +1 -1
  84. package/index.cjs173.js +1 -1
  85. package/index.cjs174.js +1 -1
  86. package/index.cjs175.js +1 -1
  87. package/index.cjs176.js +1 -1
  88. package/index.cjs177.js +1 -1
  89. package/index.cjs178.js +1 -1
  90. package/index.cjs179.js +1 -1
  91. package/index.cjs18.js +1 -1
  92. package/index.cjs180.js +1 -1
  93. package/index.cjs181.js +1 -1
  94. package/index.cjs182.js +1 -1
  95. package/index.cjs183.js +1 -1
  96. package/index.cjs184.js +1 -1
  97. package/index.cjs185.js +1 -1
  98. package/index.cjs186.js +2 -1
  99. package/index.cjs187.js +1 -1
  100. package/index.cjs188.js +1 -1
  101. package/index.cjs189.js +1 -1
  102. package/index.cjs19.js +1 -1
  103. package/index.cjs190.js +1 -1
  104. package/index.cjs191.js +1 -1
  105. package/index.cjs192.js +1 -1
  106. package/index.cjs193.js +1 -1
  107. package/index.cjs194.js +1 -1
  108. package/index.cjs195.js +1 -1
  109. package/index.cjs196.js +1 -1
  110. package/index.cjs197.js +1 -1
  111. package/index.cjs198.js +1 -1
  112. package/index.cjs199.js +1 -1
  113. package/index.cjs20.js +1 -1
  114. package/index.cjs200.js +1 -1
  115. package/index.cjs201.js +1 -1
  116. package/index.cjs202.js +1 -1
  117. package/index.cjs203.js +1 -1
  118. package/index.cjs204.js +1 -1
  119. package/index.cjs205.js +1 -4
  120. package/index.cjs206.js +1 -1
  121. package/index.cjs207.js +1 -1
  122. package/index.cjs208.js +1 -1
  123. package/index.cjs209.js +1 -1
  124. package/index.cjs21.js +1 -1
  125. package/index.cjs210.js +1 -1
  126. package/index.cjs211.js +1 -3
  127. package/index.cjs212.js +1 -1
  128. package/index.cjs213.js +1 -1
  129. package/index.cjs214.js +1 -1
  130. package/index.cjs215.js +1 -1
  131. package/index.cjs216.js +1 -1
  132. package/index.cjs217.js +1 -1
  133. package/index.cjs218.js +1 -1
  134. package/index.cjs219.js +1 -1
  135. package/index.cjs22.js +1 -1
  136. package/index.cjs220.js +1 -1
  137. package/index.cjs221.js +1 -1
  138. package/index.cjs222.js +1 -1
  139. package/index.cjs223.js +1 -1
  140. package/index.cjs224.js +1 -1
  141. package/index.cjs225.js +1 -1
  142. package/index.cjs226.js +1 -1
  143. package/index.cjs227.js +1 -1
  144. package/index.cjs228.js +1 -1
  145. package/index.cjs229.js +1 -1
  146. package/index.cjs23.js +1 -1
  147. package/index.cjs230.js +1 -1
  148. package/index.cjs231.js +1 -1
  149. package/index.cjs232.js +1 -1
  150. package/index.cjs233.js +1 -1
  151. package/index.cjs234.js +1 -1
  152. package/index.cjs235.js +1 -1
  153. package/index.cjs236.js +1 -1
  154. package/index.cjs237.js +1 -1
  155. package/index.cjs238.js +1 -1
  156. package/index.cjs239.js +1 -1
  157. package/index.cjs24.js +1 -1
  158. package/index.cjs240.js +1 -1
  159. package/index.cjs241.js +1 -1
  160. package/index.cjs242.js +1 -1
  161. package/index.cjs243.js +1 -1
  162. package/index.cjs244.js +1 -1
  163. package/index.cjs245.js +1 -1
  164. package/index.cjs246.js +1 -1
  165. package/index.cjs247.js +1 -1
  166. package/index.cjs248.js +1 -1
  167. package/index.cjs249.js +1 -1
  168. package/index.cjs25.js +1 -1
  169. package/index.cjs250.js +1 -1
  170. package/index.cjs251.js +1 -1
  171. package/index.cjs252.js +1 -1
  172. package/index.cjs253.js +1 -1
  173. package/index.cjs254.js +1 -1
  174. package/index.cjs255.js +1 -1
  175. package/index.cjs256.js +1 -1
  176. package/index.cjs257.js +1 -1
  177. package/index.cjs258.js +1 -1
  178. package/index.cjs259.js +1 -1
  179. package/index.cjs26.js +1 -9
  180. package/index.cjs260.js +1 -1
  181. package/index.cjs261.js +1 -1
  182. package/index.cjs262.js +1 -1
  183. package/index.cjs263.js +1 -1
  184. package/index.cjs264.js +1 -1
  185. package/index.cjs265.js +1 -1
  186. package/index.cjs266.js +1 -1
  187. package/index.cjs267.js +1 -1
  188. package/index.cjs268.js +1 -1
  189. package/index.cjs269.js +1 -1
  190. package/index.cjs27.js +1 -1
  191. package/index.cjs270.js +1 -1
  192. package/index.cjs271.js +1 -1
  193. package/index.cjs272.js +1 -1
  194. package/index.cjs273.js +1 -1
  195. package/index.cjs274.js +1 -1
  196. package/index.cjs275.js +1 -1
  197. package/index.cjs276.js +1 -1
  198. package/index.cjs277.js +1 -1
  199. package/index.cjs278.js +1 -1
  200. package/index.cjs279.js +1 -1
  201. package/index.cjs28.js +1 -1
  202. package/index.cjs280.js +1 -1
  203. package/index.cjs281.js +1 -1
  204. package/index.cjs282.js +1 -1
  205. package/index.cjs283.js +1 -1
  206. package/index.cjs284.js +1 -1
  207. package/index.cjs285.js +1 -1
  208. package/index.cjs286.js +1 -1
  209. package/index.cjs287.js +1 -1
  210. package/index.cjs288.js +1 -1
  211. package/index.cjs289.js +1 -1
  212. package/index.cjs29.js +1 -1
  213. package/index.cjs290.js +1 -1
  214. package/index.cjs291.js +1 -1
  215. package/index.cjs292.js +1 -1
  216. package/index.cjs293.js +1 -1
  217. package/index.cjs294.js +1 -2
  218. package/index.cjs295.js +1 -1
  219. package/index.cjs296.js +1 -1
  220. package/index.cjs297.js +1 -1
  221. package/index.cjs298.js +1 -1
  222. package/index.cjs299.js +1 -1
  223. package/index.cjs3.js +1 -1
  224. package/index.cjs30.js +1 -1
  225. package/index.cjs300.js +1 -1
  226. package/index.cjs301.js +1 -1
  227. package/index.cjs302.js +1 -1
  228. package/index.cjs303.js +1 -1
  229. package/index.cjs304.js +1 -1
  230. package/index.cjs305.js +1 -1
  231. package/index.cjs306.js +1 -1
  232. package/index.cjs307.js +1 -1
  233. package/index.cjs308.js +1 -1
  234. package/index.cjs309.js +1 -1
  235. package/index.cjs31.js +9 -1
  236. package/index.cjs310.js +1 -2
  237. package/index.cjs311.js +1 -1
  238. package/index.cjs312.js +1 -1
  239. package/index.cjs313.js +1 -1
  240. package/index.cjs314.js +1 -1
  241. package/index.cjs315.js +1 -1
  242. package/index.cjs316.js +1 -1
  243. package/index.cjs317.js +1 -1
  244. package/index.cjs318.js +1 -1
  245. package/index.cjs319.js +1 -1
  246. package/index.cjs32.js +1 -1
  247. package/index.cjs320.js +1 -1
  248. package/index.cjs321.js +1 -1
  249. package/index.cjs322.js +1 -1
  250. package/index.cjs323.js +1 -1
  251. package/index.cjs324.js +1 -1
  252. package/index.cjs325.js +1 -1
  253. package/index.cjs326.js +1 -1
  254. package/index.cjs327.js +1 -1
  255. package/index.cjs328.js +1 -1
  256. package/index.cjs329.js +1 -1
  257. package/index.cjs33.js +1 -1
  258. package/index.cjs330.js +1 -1
  259. package/index.cjs331.js +1 -1
  260. package/index.cjs332.js +1 -1
  261. package/index.cjs333.js +1 -1
  262. package/index.cjs334.js +1 -1
  263. package/index.cjs335.js +1 -1
  264. package/index.cjs336.js +1 -1
  265. package/index.cjs337.js +1 -1
  266. package/index.cjs338.js +1 -1
  267. package/index.cjs339.js +1 -1
  268. package/index.cjs34.js +1 -1
  269. package/index.cjs340.js +1 -1
  270. package/index.cjs341.js +1 -1
  271. package/index.cjs342.js +1 -1
  272. package/index.cjs343.js +1 -1
  273. package/index.cjs344.js +1 -1
  274. package/index.cjs345.js +1 -1
  275. package/index.cjs346.js +1 -1
  276. package/index.cjs347.js +1 -1
  277. package/index.cjs348.js +1 -1
  278. package/index.cjs349.js +1 -1
  279. package/index.cjs35.js +1 -1
  280. package/index.cjs350.js +1 -1
  281. package/index.cjs351.js +1 -1
  282. package/index.cjs352.js +1 -1
  283. package/index.cjs353.js +1 -1
  284. package/index.cjs354.js +1 -1
  285. package/index.cjs355.js +1 -1
  286. package/index.cjs356.js +1 -1
  287. package/index.cjs357.js +1 -1
  288. package/index.cjs358.js +1 -1
  289. package/index.cjs359.js +1 -1
  290. package/index.cjs36.js +1 -1
  291. package/index.cjs360.js +1 -1
  292. package/index.cjs361.js +1 -1
  293. package/index.cjs362.js +1 -1
  294. package/index.cjs363.js +1 -1
  295. package/index.cjs364.js +1 -1
  296. package/index.cjs365.js +1 -1
  297. package/index.cjs366.js +1 -1
  298. package/index.cjs367.js +1 -15
  299. package/index.cjs368.js +1 -1
  300. package/index.cjs369.js +1 -1
  301. package/index.cjs37.js +1 -5
  302. package/index.cjs370.js +1 -1
  303. package/index.cjs371.js +1 -1
  304. package/index.cjs372.js +1 -1
  305. package/index.cjs373.js +1 -1
  306. package/index.cjs374.js +1 -1
  307. package/index.cjs375.js +1 -1
  308. package/index.cjs376.js +1 -1
  309. package/index.cjs377.js +1 -1
  310. package/index.cjs378.js +1 -1
  311. package/index.cjs379.js +1 -1
  312. package/index.cjs38.js +1 -1
  313. package/index.cjs380.js +1 -1
  314. package/index.cjs381.js +1 -1
  315. package/index.cjs382.js +1 -1
  316. package/index.cjs383.js +1 -1
  317. package/index.cjs384.js +1 -3
  318. package/index.cjs385.js +1 -1
  319. package/index.cjs386.js +1 -1
  320. package/index.cjs387.js +1 -1
  321. package/index.cjs388.js +1 -1
  322. package/index.cjs389.js +1 -1
  323. package/index.cjs39.js +1 -1
  324. package/index.cjs390.js +1 -1
  325. package/index.cjs391.js +1 -1
  326. package/index.cjs392.js +1 -1
  327. package/index.cjs393.js +1 -1
  328. package/index.cjs394.js +1 -1
  329. package/index.cjs395.js +1 -1
  330. package/index.cjs396.js +1 -1
  331. package/index.cjs397.js +1 -1
  332. package/index.cjs398.js +1 -1
  333. package/index.cjs399.js +1 -1
  334. package/index.cjs4.js +1 -1
  335. package/index.cjs40.js +1 -1
  336. package/index.cjs400.js +1 -1
  337. package/index.cjs401.js +1 -1
  338. package/index.cjs402.js +1 -1
  339. package/index.cjs403.js +1 -1
  340. package/index.cjs404.js +1 -1
  341. package/index.cjs405.js +1 -1
  342. package/index.cjs406.js +1 -1
  343. package/index.cjs407.js +1 -1
  344. package/index.cjs408.js +1 -1
  345. package/index.cjs409.js +1 -1
  346. package/index.cjs41.js +1 -1
  347. package/index.cjs410.js +1 -1
  348. package/index.cjs411.js +1 -1
  349. package/index.cjs412.js +1 -1
  350. package/index.cjs413.js +1 -1
  351. package/index.cjs414.js +1 -1
  352. package/index.cjs415.js +1 -1
  353. package/index.cjs416.js +1 -1
  354. package/index.cjs417.js +1 -1
  355. package/index.cjs418.js +1 -1
  356. package/index.cjs419.js +1 -1
  357. package/index.cjs42.js +5 -1
  358. package/index.cjs420.js +1 -1
  359. package/index.cjs421.js +1 -1
  360. package/index.cjs422.js +1 -1
  361. package/index.cjs423.js +1 -1
  362. package/index.cjs43.js +1 -6
  363. package/index.cjs44.js +1 -1
  364. package/index.cjs45.js +1 -1
  365. package/index.cjs46.js +1 -1
  366. package/index.cjs47.js +1 -1
  367. package/index.cjs48.js +6 -1
  368. package/index.cjs49.js +1 -9
  369. package/index.cjs5.js +1 -1
  370. package/index.cjs50.js +1 -1
  371. package/index.cjs51.js +1 -7
  372. package/index.cjs52.js +1 -1
  373. package/index.cjs53.js +1 -1
  374. package/index.cjs54.js +9 -1
  375. package/index.cjs55.js +1 -1
  376. package/index.cjs56.js +7 -1
  377. package/index.cjs57.js +1 -1
  378. package/index.cjs58.js +1 -1
  379. package/index.cjs59.js +1 -3
  380. package/index.cjs6.js +1 -1
  381. package/index.cjs60.js +1 -1
  382. package/index.cjs61.js +1 -1
  383. package/index.cjs62.js +1 -1
  384. package/index.cjs63.js +1 -7
  385. package/index.cjs64.js +3 -1
  386. package/index.cjs65.js +1 -1
  387. package/index.cjs66.js +1 -6
  388. package/index.cjs67.js +1 -1
  389. package/index.cjs68.js +7 -1
  390. package/index.cjs69.js +1 -1
  391. package/index.cjs7.js +1 -1
  392. package/index.cjs70.js +1 -1
  393. package/index.cjs71.js +6 -1
  394. package/index.cjs72.js +1 -11
  395. package/index.cjs73.js +1 -1
  396. package/index.cjs74.js +1 -1
  397. package/index.cjs75.js +1 -5
  398. package/index.cjs76.js +1 -11
  399. package/index.cjs77.js +11 -1
  400. package/index.cjs78.js +1 -33
  401. package/index.cjs79.js +1 -1
  402. package/index.cjs8.js +1 -1
  403. package/index.cjs80.js +5 -1
  404. package/index.cjs81.js +11 -1
  405. package/index.cjs82.js +1 -1
  406. package/index.cjs83.js +33 -1
  407. package/index.cjs84.js +1 -1
  408. package/index.cjs85.js +1 -1
  409. package/index.cjs86.js +1 -1
  410. package/index.cjs87.js +1 -1
  411. package/index.cjs88.js +1 -1
  412. package/index.cjs89.js +1 -1
  413. package/index.cjs9.js +1 -1
  414. package/index.cjs90.js +1 -1
  415. package/index.cjs91.js +1 -1
  416. package/index.cjs92.js +1 -1
  417. package/index.cjs93.js +1 -1
  418. package/index.cjs94.js +1 -1
  419. package/index.cjs95.js +1 -1
  420. package/index.cjs96.js +1 -1
  421. package/index.cjs97.js +1 -1
  422. package/index.cjs98.js +1 -1
  423. package/index.cjs99.js +1 -1
  424. package/index.es.d.ts +409 -182
  425. package/index.es.js +442 -426
  426. package/index.es10.js +42 -195
  427. package/index.es100.js +5 -28
  428. package/index.es101.js +7 -11
  429. package/index.es102.js +29 -128
  430. package/index.es103.js +28 -128
  431. package/index.es104.js +128 -11
  432. package/index.es105.js +128 -88
  433. package/index.es106.js +11 -24
  434. package/index.es107.js +87 -17
  435. package/index.es108.js +27 -18
  436. package/index.es109.js +6 -13
  437. package/index.es11.js +136 -155
  438. package/index.es110.js +16 -1707
  439. package/index.es111.js +25 -35
  440. package/index.es112.js +1624 -2515
  441. package/index.es113.js +32 -321
  442. package/index.es114.js +2596 -11
  443. package/index.es115.js +321 -10
  444. package/index.es116.js +5 -5
  445. package/index.es117.js +10 -7
  446. package/index.es118.js +10 -32
  447. package/index.es119.js +8 -2
  448. package/index.es12.js +230 -20
  449. package/index.es120.js +32 -10
  450. package/index.es121.js +2 -11
  451. package/index.es122.js +5 -5
  452. package/index.es123.js +5 -5
  453. package/index.es124.js +5 -5
  454. package/index.es125.js +9 -2567
  455. package/index.es126.js +12 -142
  456. package/index.es127.js +14 -117
  457. package/index.es128.js +227 -135
  458. package/index.es129.js +18 -222
  459. package/index.es13.js +54 -154
  460. package/index.es130.js +18 -515
  461. package/index.es131.js +1 -1
  462. package/index.es132.js +1989 -11
  463. package/index.es133.js +11 -21
  464. package/index.es134.js +6 -11
  465. package/index.es135.js +56 -10
  466. package/index.es136.js +6 -11
  467. package/index.es137.js +13 -203
  468. package/index.es138.js +5 -5
  469. package/index.es139.js +10 -4
  470. package/index.es14.js +190 -37
  471. package/index.es140.js +5 -5
  472. package/index.es141.js +188 -55
  473. package/index.es142.js +4 -10
  474. package/index.es143.js +5 -5
  475. package/index.es144.js +11 -19
  476. package/index.es145.js +11 -7
  477. package/index.es146.js +10 -87
  478. package/index.es147.js +5 -5
  479. package/index.es148.js +7 -11
  480. package/index.es149.js +86 -10
  481. package/index.es15.js +160 -3
  482. package/index.es150.js +5 -5
  483. package/index.es151.js +5 -5
  484. package/index.es152.js +5 -5
  485. package/index.es153.js +5 -5
  486. package/index.es154.js +11 -2
  487. package/index.es155.js +11 -2
  488. package/index.es156.js +2 -2
  489. package/index.es157.js +2 -2
  490. package/index.es158.js +2 -2
  491. package/index.es159.js +2 -2
  492. package/index.es16.js +19 -185
  493. package/index.es160.js +2 -11
  494. package/index.es161.js +2 -11
  495. package/index.es162.js +5 -5
  496. package/index.es163.js +5 -5
  497. package/index.es164.js +11 -3
  498. package/index.es165.js +5 -5
  499. package/index.es166.js +1 -1
  500. package/index.es167.js +1 -1
  501. package/index.es168.js +5 -5
  502. package/index.es169.js +11 -2
  503. package/index.es17.js +153 -47
  504. package/index.es170.js +2 -2
  505. package/index.es171.js +2 -11
  506. package/index.es172.js +4 -4
  507. package/index.es173.js +5 -5
  508. package/index.es174.js +5 -5
  509. package/index.es175.js +11 -22
  510. package/index.es176.js +22 -11
  511. package/index.es177.js +11 -22
  512. package/index.es178.js +1 -1
  513. package/index.es179.js +1 -1
  514. package/index.es18.js +40 -69
  515. package/index.es180.js +16 -11
  516. package/index.es181.js +12 -11
  517. package/index.es182.js +4 -4
  518. package/index.es183.js +5 -5
  519. package/index.es184.js +1 -1
  520. package/index.es185.js +11 -2338
  521. package/index.es186.js +154 -2149
  522. package/index.es187.js +6 -11
  523. package/index.es188.js +2380 -443
  524. package/index.es189.js +11 -139
  525. package/index.es19.js +3 -54
  526. package/index.es190.js +7 -6
  527. package/index.es191.js +508 -3
  528. package/index.es192.js +2 -482
  529. package/index.es193.js +31 -6
  530. package/index.es194.js +11 -30
  531. package/index.es195.js +233 -12
  532. package/index.es196.js +51 -36
  533. package/index.es197.js +74 -224
  534. package/index.es198.js +2 -54
  535. package/index.es199.js +477 -16
  536. package/index.es20.js +184 -21
  537. package/index.es200.js +46 -31
  538. package/index.es201.js +12 -1221
  539. package/index.es202.js +33 -14
  540. package/index.es203.js +1202 -8
  541. package/index.es204.js +39 -2
  542. package/index.es205.js +12 -2261
  543. package/index.es206.js +7 -49
  544. package/index.es207.js +5 -10
  545. package/index.es208.js +5 -12
  546. package/index.es209.js +18 -13
  547. package/index.es21.js +52 -128
  548. package/index.es210.js +6 -106
  549. package/index.es211.js +6 -25
  550. package/index.es212.js +7 -51
  551. package/index.es213.js +13 -370
  552. package/index.es214.js +15 -61
  553. package/index.es215.js +9 -48
  554. package/index.es216.js +7 -6
  555. package/index.es217.js +11 -5
  556. package/index.es218.js +15 -47
  557. package/index.es219.js +6 -22
  558. package/index.es22.js +68 -79
  559. package/index.es220.js +15 -6
  560. package/index.es221.js +5 -9
  561. package/index.es222.js +9 -11
  562. package/index.es223.js +6 -16
  563. package/index.es224.js +5 -230
  564. package/index.es225.js +6 -24
  565. package/index.es226.js +580 -11
  566. package/index.es227.js +49 -278
  567. package/index.es228.js +17 -261
  568. package/index.es229.js +8 -16
  569. package/index.es23.js +52 -242
  570. package/index.es230.js +6 -14
  571. package/index.es231.js +7 -20
  572. package/index.es232.js +5 -7
  573. package/index.es233.js +7 -5
  574. package/index.es234.js +10 -5
  575. package/index.es235.js +6 -5
  576. package/index.es236.js +8 -7
  577. package/index.es237.js +12 -5
  578. package/index.es238.js +5 -5
  579. package/index.es239.js +10 -7
  580. package/index.es24.js +24 -20
  581. package/index.es240.js +8 -13
  582. package/index.es241.js +10 -15
  583. package/index.es242.js +14 -8
  584. package/index.es243.js +4 -5
  585. package/index.es244.js +5 -4
  586. package/index.es245.js +4 -514
  587. package/index.es246.js +12 -50
  588. package/index.es247.js +10 -18
  589. package/index.es248.js +9 -5
  590. package/index.es249.js +11 -8
  591. package/index.es25.js +128 -32
  592. package/index.es250.js +11 -6
  593. package/index.es251.js +38 -5
  594. package/index.es252.js +65 -7
  595. package/index.es253.js +9 -9
  596. package/index.es254.js +8 -5
  597. package/index.es255.js +7 -8
  598. package/index.es256.js +10 -12
  599. package/index.es257.js +7 -9
  600. package/index.es258.js +7 -8
  601. package/index.es259.js +6 -10
  602. package/index.es26.js +77 -47
  603. package/index.es260.js +15 -14
  604. package/index.es261.js +98 -5
  605. package/index.es262.js +31 -39
  606. package/index.es263.js +9 -65
  607. package/index.es264.js +141 -10
  608. package/index.es265.js +117 -9
  609. package/index.es266.js +98 -8
  610. package/index.es267.js +31 -8
  611. package/index.es268.js +9 -16
  612. package/index.es269.js +135 -92
  613. package/index.es27.js +242 -19
  614. package/index.es270.js +112 -26
  615. package/index.es271.js +68 -9
  616. package/index.es272.js +26 -136
  617. package/index.es273.js +9 -117
  618. package/index.es274.js +146 -61
  619. package/index.es275.js +103 -26
  620. package/index.es276.js +13 -9
  621. package/index.es277.js +23 -151
  622. package/index.es278.js +11 -108
  623. package/index.es279.js +39 -2
  624. package/index.es28.js +250 -107
  625. package/index.es280.js +1999 -57
  626. package/index.es281.js +6 -56
  627. package/index.es282.js +71 -12
  628. package/index.es283.js +22 -22
  629. package/index.es284.js +52 -11
  630. package/index.es285.js +4 -38
  631. package/index.es286.js +4 -1999
  632. package/index.es287.js +15 -6
  633. package/index.es288.js +5 -71
  634. package/index.es289.js +8 -24
  635. package/index.es29.js +138 -307
  636. package/index.es290.js +16 -3
  637. package/index.es291.js +5 -2
  638. package/index.es292.js +5 -2
  639. package/index.es293.js +5 -7
  640. package/index.es294.js +5 -326
  641. package/index.es295.js +4 -50
  642. package/index.es296.js +5 -30
  643. package/index.es297.js +7 -34
  644. package/index.es298.js +25 -53
  645. package/index.es299.js +7 -119
  646. package/index.es3.js +4 -4
  647. package/index.es30.js +34 -37
  648. package/index.es300.js +4 -8
  649. package/index.es301.js +7 -163
  650. package/index.es302.js +6 -310
  651. package/index.es303.js +4 -126
  652. package/index.es304.js +6 -180
  653. package/index.es305.js +4 -25
  654. package/index.es306.js +8 -61
  655. package/index.es307.js +6 -5
  656. package/index.es308.js +5 -36
  657. package/index.es309.js +4 -25
  658. package/index.es31.js +46 -93
  659. package/index.es310.js +7 -186
  660. package/index.es311.js +40 -138
  661. package/index.es312.js +4 -4
  662. package/index.es313.js +8 -57
  663. package/index.es314.js +13 -27
  664. package/index.es315.js +7 -46
  665. package/index.es316.js +10 -66
  666. package/index.es317.js +10 -37
  667. package/index.es318.js +7 -17
  668. package/index.es319.js +13 -67
  669. package/index.es32.js +17 -119
  670. package/index.es320.js +24 -68
  671. package/index.es321.js +20 -69
  672. package/index.es322.js +52 -67
  673. package/index.es323.js +72 -44
  674. package/index.es324.js +9 -46
  675. package/index.es325.js +19 -57
  676. package/index.es326.js +15 -47
  677. package/index.es327.js +19 -42
  678. package/index.es328.js +6 -71
  679. package/index.es329.js +5 -71
  680. package/index.es33.js +102 -65
  681. package/index.es330.js +23 -96
  682. package/index.es331.js +16 -47
  683. package/index.es332.js +6 -46
  684. package/index.es333.js +4 -46
  685. package/index.es334.js +4 -30
  686. package/index.es335.js +4 -29
  687. package/index.es336.js +4 -29
  688. package/index.es337.js +3 -30
  689. package/index.es338.js +6 -29
  690. package/index.es339.js +7 -29
  691. package/index.es34.js +308 -53
  692. package/index.es340.js +6 -19
  693. package/index.es341.js +5 -45
  694. package/index.es342.js +3 -45
  695. package/index.es343.js +3 -19
  696. package/index.es344.js +3 -19
  697. package/index.es345.js +3 -6
  698. package/index.es346.js +4 -15
  699. package/index.es347.js +3 -28
  700. package/index.es348.js +3 -14
  701. package/index.es349.js +4 -2
  702. package/index.es35.js +116 -71
  703. package/index.es350.js +58 -7
  704. package/index.es351.js +67 -2
  705. package/index.es352.js +6 -97
  706. package/index.es353.js +4 -25
  707. package/index.es354.js +22 -37
  708. package/index.es355.js +17 -2
  709. package/index.es356.js +7 -68
  710. package/index.es357.js +10 -84
  711. package/index.es358.js +9 -46
  712. package/index.es359.js +21 -8
  713. package/index.es36.js +94 -1207
  714. package/index.es360.js +10 -4
  715. package/index.es361.js +9 -51
  716. package/index.es362.js +10 -38
  717. package/index.es363.js +5 -3
  718. package/index.es364.js +6 -2
  719. package/index.es365.js +15 -58
  720. package/index.es366.js +9 -16
  721. package/index.es367.js +17 -242
  722. package/index.es368.js +14 -72
  723. package/index.es369.js +12 -4
  724. package/index.es37.js +121 -61
  725. package/index.es370.js +4 -57
  726. package/index.es371.js +57 -11
  727. package/index.es372.js +30 -6
  728. package/index.es373.js +45 -34
  729. package/index.es374.js +66 -26
  730. package/index.es375.js +37 -290
  731. package/index.es376.js +16 -88
  732. package/index.es377.js +73 -3
  733. package/index.es378.js +72 -7
  734. package/index.es379.js +74 -15
  735. package/index.es38.js +67 -47
  736. package/index.es380.js +73 -145
  737. package/index.es381.js +44 -9
  738. package/index.es382.js +46 -7
  739. package/index.es383.js +56 -348
  740. package/index.es384.js +48 -94
  741. package/index.es385.js +46 -9
  742. package/index.es386.js +78 -3
  743. package/index.es387.js +77 -205
  744. package/index.es388.js +101 -118
  745. package/index.es389.js +46 -6
  746. package/index.es39.js +52 -15
  747. package/index.es390.js +46 -7
  748. package/index.es391.js +45 -114
  749. package/index.es392.js +30 -6
  750. package/index.es393.js +29 -7
  751. package/index.es394.js +28 -14
  752. package/index.es395.js +28 -17
  753. package/index.es396.js +25 -96
  754. package/index.es397.js +30 -47
  755. package/index.es398.js +20 -2
  756. package/index.es399.js +41 -40
  757. package/index.es4.js +5 -6
  758. package/index.es40.js +1199 -234
  759. package/index.es400.js +44 -50
  760. package/index.es401.js +20 -2
  761. package/index.es402.js +20 -2
  762. package/index.es403.js +6 -23
  763. package/index.es404.js +14 -4
  764. package/index.es405.js +12 -20
  765. package/index.es406.js +25 -28
  766. package/index.es407.js +98 -6
  767. package/index.es408.js +25 -6
  768. package/index.es409.js +39 -3
  769. package/index.es41.js +75 -17
  770. package/index.es410.js +8 -3
  771. package/index.es411.js +18 -17
  772. package/index.es412.js +14 -64
  773. package/index.es413.js +5 -15
  774. package/index.es414.js +6 -15
  775. package/index.es415.js +29 -3
  776. package/index.es416.js +13 -5
  777. package/index.es417.js +26 -17
  778. package/index.es418.js +6 -17
  779. package/index.es419.js +5 -17
  780. package/index.es42.js +59 -112
  781. package/index.es420.js +13 -17
  782. package/index.es421.js +20 -17
  783. package/index.es422.js +101 -17
  784. package/index.es423.js +47 -17
  785. package/index.es43.js +38 -277
  786. package/index.es44.js +18 -88
  787. package/index.es45.js +245 -14
  788. package/index.es46.js +17 -306
  789. package/index.es47.js +112 -247
  790. package/index.es48.js +282 -152
  791. package/index.es49.js +82 -85
  792. package/index.es5.js +5 -6
  793. package/index.es50.js +14 -174
  794. package/index.es51.js +292 -193
  795. package/index.es52.js +244 -44
  796. package/index.es53.js +157 -78
  797. package/index.es54.js +84 -37
  798. package/index.es55.js +169 -32
  799. package/index.es56.js +158 -54
  800. package/index.es57.js +46 -81
  801. package/index.es58.js +77 -263
  802. package/index.es59.js +40 -30
  803. package/index.es6.js +31 -42
  804. package/index.es60.js +38 -34
  805. package/index.es61.js +57 -35
  806. package/index.es62.js +82 -123
  807. package/index.es63.js +255 -46
  808. package/index.es64.js +29 -24
  809. package/index.es65.js +34 -71
  810. package/index.es66.js +37 -136
  811. package/index.es67.js +128 -16
  812. package/index.es68.js +49 -127
  813. package/index.es69.js +25 -420
  814. package/index.es7.js +47 -130
  815. package/index.es70.js +72 -6
  816. package/index.es71.js +144 -11
  817. package/index.es72.js +14 -34
  818. package/index.es73.js +123 -74
  819. package/index.es74.js +411 -120
  820. package/index.es75.js +6 -75
  821. package/index.es76.js +12 -101
  822. package/index.es77.js +38 -35
  823. package/index.es78.js +83 -72
  824. package/index.es79.js +130 -32
  825. package/index.es8.js +8 -232
  826. package/index.es80.js +72 -19
  827. package/index.es81.js +97 -89
  828. package/index.es82.js +34 -51
  829. package/index.es83.js +75 -15
  830. package/index.es84.js +39 -21
  831. package/index.es85.js +21 -8
  832. package/index.es86.js +90 -84
  833. package/index.es87.js +50 -6
  834. package/index.es88.js +15 -4
  835. package/index.es89.js +20 -77
  836. package/index.es9.js +15 -56
  837. package/index.es90.js +8 -32
  838. package/index.es91.js +87 -48
  839. package/index.es92.js +7 -8
  840. package/index.es93.js +4 -16
  841. package/index.es94.js +80 -43
  842. package/index.es95.js +11 -4
  843. package/index.es96.js +12 -115
  844. package/index.es97.js +44 -4
  845. package/index.es98.js +4 -7
  846. package/index.es99.js +108 -29
  847. package/package.json +20 -26
  848. package/style.css +1 -1
  849. package/tailwind.config.cjs +10 -10
  850. package/tailwind.config.js +10 -10
  851. package/.eslintrc.cjs +0 -24
  852. package/index.cjs2.js +0 -1
  853. package/index.cjs424.js +0 -1
  854. package/index.cjs425.js +0 -1
  855. package/index.cjs426.js +0 -1
  856. package/index.cjs427.js +0 -1
  857. package/index.cjs428.js +0 -1
  858. package/index.cjs429.js +0 -1
  859. package/index.cjs430.js +0 -1
  860. package/index.cjs431.js +0 -1
  861. package/index.cjs432.js +0 -1
  862. package/index.cjs433.js +0 -1
  863. package/index.cjs434.js +0 -1
  864. package/index.cjs435.js +0 -1
  865. package/index.cjs436.js +0 -1
  866. package/index.cjs437.js +0 -1
  867. package/index.cjs438.js +0 -1
  868. package/index.cjs439.js +0 -1
  869. package/index.cjs440.js +0 -1
  870. package/index.cjs441.js +0 -1
  871. package/index.cjs442.js +0 -1
  872. package/index.cjs443.js +0 -1
  873. package/index.cjs444.js +0 -1
  874. package/index.cjs445.js +0 -1
  875. package/index.cjs446.js +0 -1
  876. package/index.cjs447.js +0 -1
  877. package/index.cjs448.js +0 -1
  878. package/index.cjs449.js +0 -1
  879. package/index.cjs450.js +0 -1
  880. package/index.cjs451.js +0 -1
  881. package/index.cjs452.js +0 -1
  882. package/index.cjs453.js +0 -1
  883. package/index.cjs454.js +0 -1
  884. package/index.cjs455.js +0 -1
  885. package/index.cjs456.js +0 -1
  886. package/index.cjs457.js +0 -1
  887. package/index.cjs458.js +0 -1
  888. package/index.cjs459.js +0 -1
  889. package/index.cjs460.js +0 -1
  890. package/index.cjs461.js +0 -1
  891. package/index.cjs462.js +0 -1
  892. package/index.cjs463.js +0 -1
  893. package/index.cjs464.js +0 -1
  894. package/index.cjs465.js +0 -1
  895. package/index.cjs466.js +0 -1
  896. package/index.cjs467.js +0 -1
  897. package/index.cjs468.js +0 -1
  898. package/index.cjs469.js +0 -2
  899. package/index.cjs470.js +0 -1
  900. package/index.cjs471.js +0 -1
  901. package/index.cjs472.js +0 -1
  902. package/index.cjs473.js +0 -1
  903. package/index.cjs474.js +0 -1
  904. package/index.cjs475.js +0 -1
  905. package/index.cjs476.js +0 -1
  906. package/index.cjs477.js +0 -1
  907. package/index.cjs478.js +0 -1
  908. package/index.cjs479.js +0 -74
  909. package/index.cjs480.js +0 -1
  910. package/index.cjs481.js +0 -1
  911. package/index.cjs482.js +0 -1
  912. package/index.cjs483.js +0 -1
  913. package/index.cjs484.js +0 -1
  914. package/index.cjs485.js +0 -1
  915. package/index.cjs486.js +0 -1
  916. package/index.cjs487.js +0 -1
  917. package/index.cjs488.js +0 -1
  918. package/index.cjs489.js +0 -1
  919. package/index.cjs490.js +0 -1
  920. package/index.cjs491.js +0 -1
  921. package/index.cjs492.js +0 -1
  922. package/index.cjs493.js +0 -1
  923. package/index.cjs494.js +0 -1
  924. package/index.cjs495.js +0 -1
  925. package/index.cjs496.js +0 -1
  926. package/index.cjs497.js +0 -1
  927. package/index.cjs498.js +0 -1
  928. package/index.cjs499.js +0 -1
  929. package/index.cjs500.js +0 -1
  930. package/index.cjs501.js +0 -1
  931. package/index.cjs502.js +0 -1
  932. package/index.cjs503.js +0 -1
  933. package/index.es2.js +0 -4
  934. package/index.es424.js +0 -15
  935. package/index.es425.js +0 -145
  936. package/index.es426.js +0 -45
  937. package/index.es427.js +0 -5
  938. package/index.es428.js +0 -43
  939. package/index.es429.js +0 -10
  940. package/index.es430.js +0 -78
  941. package/index.es431.js +0 -57
  942. package/index.es432.js +0 -10
  943. package/index.es433.js +0 -78
  944. package/index.es434.js +0 -26
  945. package/index.es435.js +0 -64
  946. package/index.es436.js +0 -7
  947. package/index.es437.js +0 -61
  948. package/index.es438.js +0 -15
  949. package/index.es439.js +0 -6
  950. package/index.es440.js +0 -12
  951. package/index.es441.js +0 -57
  952. package/index.es442.js +0 -7
  953. package/index.es443.js +0 -7
  954. package/index.es444.js +0 -9
  955. package/index.es445.js +0 -338
  956. package/index.es446.js +0 -21
  957. package/index.es447.js +0 -6
  958. package/index.es448.js +0 -8
  959. package/index.es449.js +0 -5
  960. package/index.es450.js +0 -74
  961. package/index.es451.js +0 -6
  962. package/index.es452.js +0 -18
  963. package/index.es453.js +0 -9
  964. package/index.es454.js +0 -32
  965. package/index.es455.js +0 -12
  966. package/index.es456.js +0 -10
  967. package/index.es457.js +0 -9
  968. package/index.es458.js +0 -4
  969. package/index.es459.js +0 -4
  970. package/index.es460.js +0 -4
  971. package/index.es461.js +0 -69
  972. package/index.es462.js +0 -68
  973. package/index.es463.js +0 -11
  974. package/index.es464.js +0 -13
  975. package/index.es465.js +0 -6
  976. package/index.es466.js +0 -6
  977. package/index.es467.js +0 -48
  978. package/index.es468.js +0 -27
  979. package/index.es469.js +0 -80
  980. package/index.es470.js +0 -261
  981. package/index.es471.js +0 -34
  982. package/index.es472.js +0 -8
  983. package/index.es473.js +0 -134
  984. package/index.es474.js +0 -17
  985. package/index.es475.js +0 -9
  986. package/index.es476.js +0 -8
  987. package/index.es477.js +0 -6
  988. package/index.es478.js +0 -4
  989. package/index.es479.js +0 -253
  990. package/index.es480.js +0 -10
  991. package/index.es481.js +0 -5
  992. package/index.es482.js +0 -4
  993. package/index.es483.js +0 -176
  994. package/index.es484.js +0 -4
  995. package/index.es485.js +0 -4
  996. package/index.es486.js +0 -4
  997. package/index.es487.js +0 -4
  998. package/index.es488.js +0 -4
  999. package/index.es489.js +0 -10
  1000. package/index.es490.js +0 -9
  1001. package/index.es491.js +0 -22
  1002. package/index.es492.js +0 -53
  1003. package/index.es493.js +0 -251
  1004. package/index.es494.js +0 -45
  1005. package/index.es495.js +0 -18
  1006. package/index.es496.js +0 -12
  1007. package/index.es497.js +0 -50
  1008. package/index.es498.js +0 -28
  1009. package/index.es499.js +0 -131
  1010. package/index.es500.js +0 -114
  1011. package/index.es501.js +0 -75
  1012. package/index.es502.js +0 -11
  1013. package/index.es503.js +0 -9
package/index.es188.js CHANGED
@@ -1,473 +1,2410 @@
1
- var W = Symbol.for("immer-nothing"), R = Symbol.for("immer-draftable"), u = Symbol.for("immer-state"), Q = process.env.NODE_ENV !== "production" ? [
2
- // All error codes, starting by 0:
3
- function(e) {
4
- return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
1
+ import { jwtDecode as Te } from "./index.es200.js";
2
+ var Pe = {
3
+ debug: () => {
5
4
  },
6
- function(e) {
7
- return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`;
5
+ info: () => {
8
6
  },
9
- "This object has been frozen and should not be mutated",
10
- function(e) {
11
- return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + e;
7
+ warn: () => {
12
8
  },
13
- "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
14
- "Immer forbids circular references",
15
- "The first or second argument to `produce` must be a function",
16
- "The third argument to `produce` must be a function or undefined",
17
- "First argument to `createDraft` must be a plain object, an array, or an immerable object",
18
- "First argument to `finishDraft` must be a draft returned by `createDraft`",
19
- function(e) {
20
- return `'current' expects a draft, got: ${e}`;
21
- },
22
- "Object.defineProperty() cannot be used on an Immer draft",
23
- "Object.setPrototypeOf() cannot be used on an Immer draft",
24
- "Immer only supports deleting array indices",
25
- "Immer only supports setting array indices and the 'length' property",
26
- function(e) {
27
- return `'original' expects a draft, got: ${e}`;
28
- }
29
- // Note: if more errors are added, the errorOffset in Patches.ts should be increased
30
- // See Patches.ts for additional errors
31
- ] : [];
32
- function f(e, ...t) {
33
- if (process.env.NODE_ENV !== "production") {
34
- const r = Q[e], n = typeof r == "function" ? r.apply(null, t) : r;
35
- throw new Error(`[Immer] ${n}`);
36
- }
37
- throw new Error(
38
- `[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`
39
- );
40
- }
41
- var m = Object.getPrototypeOf;
42
- function h(e) {
43
- return !!e && !!e[u];
44
- }
45
- function _(e) {
46
- var t;
47
- return e ? U(e) || Array.isArray(e) || !!e[R] || !!((t = e.constructor) != null && t[R]) || O(e) || D(e) : !1;
48
- }
49
- var Y = Object.prototype.constructor.toString();
50
- function U(e) {
51
- if (!e || typeof e != "object")
52
- return !1;
53
- const t = m(e);
54
- if (t === null)
55
- return !0;
56
- const r = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
57
- return r === Object ? !0 : typeof r == "function" && Function.toString.call(r) === Y;
58
- }
59
- function b(e, t) {
60
- z(e) === 0 ? Reflect.ownKeys(e).forEach((r) => {
61
- t(r, e[r], e);
62
- }) : e.forEach((r, n) => t(n, r, e));
63
- }
64
- function z(e) {
65
- const t = e[u];
66
- return t ? t.type_ : Array.isArray(e) ? 1 : O(e) ? 2 : D(e) ? 3 : 0;
67
- }
68
- function A(e, t) {
69
- return z(e) === 2 ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
70
- }
71
- function B(e, t, r) {
72
- const n = z(e);
73
- n === 2 ? e.set(t, r) : n === 3 ? e.add(r) : e[t] = r;
74
- }
75
- function Z(e, t) {
76
- return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
77
- }
78
- function O(e) {
79
- return e instanceof Map;
80
- }
81
- function D(e) {
82
- return e instanceof Set;
83
- }
84
- function d(e) {
85
- return e.copy_ || e.base_;
86
- }
87
- function N(e, t) {
88
- if (O(e))
89
- return new Map(e);
90
- if (D(e))
91
- return new Set(e);
92
- if (Array.isArray(e))
93
- return Array.prototype.slice.call(e);
94
- const r = U(e);
95
- if (t === !0 || t === "class_only" && !r) {
96
- const n = Object.getOwnPropertyDescriptors(e);
97
- delete n[u];
98
- let i = Reflect.ownKeys(n);
99
- for (let o = 0; o < i.length; o++) {
100
- const s = i[o], c = n[s];
101
- c.writable === !1 && (c.writable = !0, c.configurable = !0), (c.get || c.set) && (n[s] = {
102
- configurable: !0,
103
- writable: !0,
104
- // could live with !!desc.set as well here...
105
- enumerable: c.enumerable,
106
- value: e[s]
107
- });
9
+ error: () => {
10
+ }
11
+ }, b, k, D = /* @__PURE__ */ ((e) => (e[e.NONE = 0] = "NONE", e[e.ERROR = 1] = "ERROR", e[e.WARN = 2] = "WARN", e[e.INFO = 3] = "INFO", e[e.DEBUG = 4] = "DEBUG", e))(D || {});
12
+ ((e) => {
13
+ function t() {
14
+ b = 3, k = Pe;
15
+ }
16
+ e.reset = t;
17
+ function s(r) {
18
+ if (!(0 <= r && r <= 4))
19
+ throw new Error("Invalid log level");
20
+ b = r;
21
+ }
22
+ e.setLevel = s;
23
+ function i(r) {
24
+ k = r;
25
+ }
26
+ e.setLogger = i;
27
+ })(D || (D = {}));
28
+ var g = class y {
29
+ constructor(t) {
30
+ this._name = t;
31
+ }
32
+ /* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */
33
+ debug(...t) {
34
+ b >= 4 && k.debug(y._format(this._name, this._method), ...t);
35
+ }
36
+ info(...t) {
37
+ b >= 3 && k.info(y._format(this._name, this._method), ...t);
38
+ }
39
+ warn(...t) {
40
+ b >= 2 && k.warn(y._format(this._name, this._method), ...t);
41
+ }
42
+ error(...t) {
43
+ b >= 1 && k.error(y._format(this._name, this._method), ...t);
44
+ }
45
+ /* eslint-enable @typescript-eslint/no-unsafe-enum-comparison */
46
+ throw(t) {
47
+ throw this.error(t), t;
48
+ }
49
+ create(t) {
50
+ const s = Object.create(this);
51
+ return s._method = t, s.debug("begin"), s;
52
+ }
53
+ static createStatic(t, s) {
54
+ const i = new y(`${t}.${s}`);
55
+ return i.debug("begin"), i;
56
+ }
57
+ static _format(t, s) {
58
+ const i = `[${t}]`;
59
+ return s ? `${i} ${s}:` : i;
60
+ }
61
+ /* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */
62
+ // helpers for static class methods
63
+ static debug(t, ...s) {
64
+ b >= 4 && k.debug(y._format(t), ...s);
65
+ }
66
+ static info(t, ...s) {
67
+ b >= 3 && k.info(y._format(t), ...s);
68
+ }
69
+ static warn(t, ...s) {
70
+ b >= 2 && k.warn(y._format(t), ...s);
71
+ }
72
+ static error(t, ...s) {
73
+ b >= 1 && k.error(y._format(t), ...s);
74
+ }
75
+ /* eslint-enable @typescript-eslint/no-unsafe-enum-comparison */
76
+ };
77
+ D.reset();
78
+ var H = class {
79
+ // IMPORTANT: doesn't validate the token
80
+ static decode(e) {
81
+ try {
82
+ return Te(e);
83
+ } catch (t) {
84
+ throw g.error("JwtUtils.decode", t), t;
108
85
  }
109
- return Object.create(m(e), n);
110
- } else {
111
- const n = m(e);
112
- if (n !== null && r)
113
- return { ...e };
114
- const i = Object.create(n);
115
- return Object.assign(i, e);
116
- }
117
- }
118
- function T(e, t = !1) {
119
- return S(e) || h(e) || !_(e) || (z(e) > 1 && (e.set = e.add = e.clear = e.delete = L), Object.freeze(e), t && Object.entries(e).forEach(([r, n]) => T(n, !0))), e;
120
- }
121
- function L() {
122
- f(2);
123
- }
124
- function S(e) {
125
- return Object.isFrozen(e);
126
- }
127
- var V = {};
128
- function y(e) {
129
- const t = V[e];
130
- return t || f(0, e), t;
131
- }
132
- var p;
133
- function G() {
134
- return p;
135
- }
136
- function ee(e, t) {
137
- return {
138
- drafts_: [],
139
- parent_: e,
140
- immer_: t,
141
- // Whenever the modified draft contains a draft from another scope, we
142
- // need to prevent auto-freezing so the unowned draft can be finalized.
143
- canAutoFreeze_: !0,
144
- unfinalizedDrafts_: 0
145
- };
146
- }
147
- function x(e, t) {
148
- t && (y("Patches"), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
149
- }
150
- function v(e) {
151
- C(e), e.drafts_.forEach(te), e.drafts_ = null;
152
- }
153
- function C(e) {
154
- e === p && (p = e.parent_);
155
- }
156
- function j(e) {
157
- return p = ee(p, e);
158
- }
159
- function te(e) {
160
- const t = e[u];
161
- t.type_ === 0 || t.type_ === 1 ? t.revoke_() : t.revoked_ = !0;
162
- }
163
- function $(e, t) {
164
- t.unfinalizedDrafts_ = t.drafts_.length;
165
- const r = t.drafts_[0];
166
- return e !== void 0 && e !== r ? (r[u].modified_ && (v(t), f(4)), _(e) && (e = w(t, e), t.parent_ || g(t, e)), t.patches_ && y("Patches").generateReplacementPatches_(
167
- r[u].base_,
168
- e,
169
- t.patches_,
170
- t.inversePatches_
171
- )) : e = w(t, r, []), v(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== W ? e : void 0;
172
- }
173
- function w(e, t, r) {
174
- if (S(t))
175
- return t;
176
- const n = t[u];
177
- if (!n)
178
- return b(
179
- t,
180
- (i, o) => K(e, n, t, i, o, r)
181
- ), t;
182
- if (n.scope_ !== e)
183
- return t;
184
- if (!n.modified_)
185
- return g(e, n.base_, !0), n.base_;
186
- if (!n.finalized_) {
187
- n.finalized_ = !0, n.scope_.unfinalizedDrafts_--;
188
- const i = n.copy_;
189
- let o = i, s = !1;
190
- n.type_ === 3 && (o = new Set(i), i.clear(), s = !0), b(
191
- o,
192
- (c, l) => K(e, n, i, c, l, r, s)
193
- ), g(e, i, !1), r && e.patches_ && y("Patches").generatePatches_(
194
- n,
195
- r,
196
- e.patches_,
197
- e.inversePatches_
86
+ }
87
+ static async generateSignedJwt(e, t, s) {
88
+ const i = _.encodeBase64Url(new TextEncoder().encode(JSON.stringify(e))), r = _.encodeBase64Url(new TextEncoder().encode(JSON.stringify(t))), o = `${i}.${r}`, n = await window.crypto.subtle.sign(
89
+ {
90
+ name: "ECDSA",
91
+ hash: { name: "SHA-256" }
92
+ },
93
+ s,
94
+ new TextEncoder().encode(o)
95
+ ), a = _.encodeBase64Url(new Uint8Array(n));
96
+ return `${o}.${a}`;
97
+ }
98
+ static async generateSignedJwtWithHmac(e, t, s) {
99
+ const i = _.encodeBase64Url(new TextEncoder().encode(JSON.stringify(e))), r = _.encodeBase64Url(new TextEncoder().encode(JSON.stringify(t))), o = `${i}.${r}`, n = await window.crypto.subtle.sign(
100
+ "HMAC",
101
+ s,
102
+ new TextEncoder().encode(o)
103
+ ), a = _.encodeBase64Url(new Uint8Array(n));
104
+ return `${o}.${a}`;
105
+ }
106
+ }, Re = "10000000-1000-4000-8000-100000000000", K = (e) => btoa([...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")), ie = class m {
107
+ static _randomWord() {
108
+ const t = new Uint32Array(1);
109
+ return crypto.getRandomValues(t), t[0];
110
+ }
111
+ /**
112
+ * Generates RFC4122 version 4 guid
113
+ */
114
+ static generateUUIDv4() {
115
+ return Re.replace(
116
+ /[018]/g,
117
+ (s) => (+s ^ m._randomWord() & 15 >> +s / 4).toString(16)
118
+ ).replace(/-/g, "");
119
+ }
120
+ /**
121
+ * PKCE: Generate a code verifier
122
+ */
123
+ static generateCodeVerifier() {
124
+ return m.generateUUIDv4() + m.generateUUIDv4() + m.generateUUIDv4();
125
+ }
126
+ /**
127
+ * PKCE: Generate a code challenge
128
+ */
129
+ static async generateCodeChallenge(t) {
130
+ if (!crypto.subtle)
131
+ throw new Error("Crypto.subtle is available only in secure contexts (HTTPS).");
132
+ try {
133
+ const i = new TextEncoder().encode(t), r = await crypto.subtle.digest("SHA-256", i);
134
+ return K(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
135
+ } catch (s) {
136
+ throw g.error("CryptoUtils.generateCodeChallenge", s), s;
137
+ }
138
+ }
139
+ /**
140
+ * Generates a base64-encoded string for a basic auth header
141
+ */
142
+ static generateBasicAuth(t, s) {
143
+ const r = new TextEncoder().encode([t, s].join(":"));
144
+ return K(r);
145
+ }
146
+ /**
147
+ * Generates a hash of a string using a given algorithm
148
+ * @param alg
149
+ * @param message
150
+ */
151
+ static async hash(t, s) {
152
+ const i = new TextEncoder().encode(s), r = await crypto.subtle.digest(t, i);
153
+ return new Uint8Array(r);
154
+ }
155
+ /**
156
+ * Generates a rfc7638 compliant jwk thumbprint
157
+ * @param jwk
158
+ */
159
+ static async customCalculateJwkThumbprint(t) {
160
+ let s;
161
+ switch (t.kty) {
162
+ case "RSA":
163
+ s = {
164
+ e: t.e,
165
+ kty: t.kty,
166
+ n: t.n
167
+ };
168
+ break;
169
+ case "EC":
170
+ s = {
171
+ crv: t.crv,
172
+ kty: t.kty,
173
+ x: t.x,
174
+ y: t.y
175
+ };
176
+ break;
177
+ case "OKP":
178
+ s = {
179
+ crv: t.crv,
180
+ kty: t.kty,
181
+ x: t.x
182
+ };
183
+ break;
184
+ case "oct":
185
+ s = {
186
+ crv: t.k,
187
+ kty: t.kty
188
+ };
189
+ break;
190
+ default:
191
+ throw new Error("Unknown jwk type");
192
+ }
193
+ const i = await m.hash("SHA-256", JSON.stringify(s));
194
+ return m.encodeBase64Url(i);
195
+ }
196
+ static async generateDPoPProof({
197
+ url: t,
198
+ accessToken: s,
199
+ httpMethod: i,
200
+ keyPair: r,
201
+ nonce: o
202
+ }) {
203
+ let n, a;
204
+ const c = {
205
+ jti: window.crypto.randomUUID(),
206
+ htm: i ?? "GET",
207
+ htu: t,
208
+ iat: Math.floor(Date.now() / 1e3)
209
+ };
210
+ s && (n = await m.hash("SHA-256", s), a = m.encodeBase64Url(n), c.ath = a), o && (c.nonce = o);
211
+ try {
212
+ const l = await crypto.subtle.exportKey("jwk", r.publicKey), d = {
213
+ alg: "ES256",
214
+ typ: "dpop+jwt",
215
+ jwk: {
216
+ crv: l.crv,
217
+ kty: l.kty,
218
+ x: l.x,
219
+ y: l.y
220
+ }
221
+ };
222
+ return await H.generateSignedJwt(d, c, r.privateKey);
223
+ } catch (l) {
224
+ throw l instanceof TypeError ? new Error(`Error exporting dpop public key: ${l.message}`) : l;
225
+ }
226
+ }
227
+ static async generateDPoPJkt(t) {
228
+ try {
229
+ const s = await crypto.subtle.exportKey("jwk", t.publicKey);
230
+ return await m.customCalculateJwkThumbprint(s);
231
+ } catch (s) {
232
+ throw s instanceof TypeError ? new Error(`Could not retrieve dpop keys from storage: ${s.message}`) : s;
233
+ }
234
+ }
235
+ static async generateDPoPKeys() {
236
+ return await window.crypto.subtle.generateKey(
237
+ {
238
+ name: "ECDSA",
239
+ namedCurve: "P-256"
240
+ },
241
+ !1,
242
+ ["sign", "verify"]
198
243
  );
199
244
  }
200
- return n.copy_;
201
- }
202
- function K(e, t, r, n, i, o, s) {
203
- if (process.env.NODE_ENV !== "production" && i === r && f(5), h(i)) {
204
- const c = o && t && t.type_ !== 3 && // Set objects are atomic since they have no keys.
205
- !A(t.assigned_, n) ? o.concat(n) : void 0, l = w(e, i, c);
206
- if (B(r, n, l), h(l))
207
- e.canAutoFreeze_ = !1;
208
- else
245
+ /**
246
+ * Generates a client assertion JWT for client_secret_jwt authentication
247
+ * @param client_id The client identifier
248
+ * @param client_secret The client secret
249
+ * @param audience The token endpoint URL (audience)
250
+ * @param algorithm The HMAC algorithm to use (HS256, HS384, HS512). Defaults to HS256
251
+ */
252
+ static async generateClientAssertionJwt(t, s, i, r = "HS256") {
253
+ const o = Math.floor(Date.now() / 1e3), n = {
254
+ alg: r,
255
+ typ: "JWT"
256
+ }, a = {
257
+ iss: t,
258
+ sub: t,
259
+ aud: i,
260
+ jti: m.generateUUIDv4(),
261
+ exp: o + 300,
262
+ // 5 minutes
263
+ iat: o
264
+ }, l = {
265
+ HS256: "SHA-256",
266
+ HS384: "SHA-384",
267
+ HS512: "SHA-512"
268
+ }[r];
269
+ if (!l)
270
+ throw new Error(`Unsupported algorithm: ${r}. Supported algorithms are: HS256, HS384, HS512`);
271
+ const d = new TextEncoder(), h = await crypto.subtle.importKey(
272
+ "raw",
273
+ d.encode(s),
274
+ { name: "HMAC", hash: l },
275
+ !1,
276
+ ["sign"]
277
+ );
278
+ return await H.generateSignedJwtWithHmac(n, a, h);
279
+ }
280
+ };
281
+ ie.encodeBase64Url = (e) => K(e).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
282
+ var _ = ie, I = class {
283
+ constructor(e) {
284
+ this._name = e, this._callbacks = [], this._logger = new g(`Event('${this._name}')`);
285
+ }
286
+ addHandler(e) {
287
+ return this._callbacks.push(e), () => this.removeHandler(e);
288
+ }
289
+ removeHandler(e) {
290
+ const t = this._callbacks.lastIndexOf(e);
291
+ t >= 0 && this._callbacks.splice(t, 1);
292
+ }
293
+ async raise(...e) {
294
+ this._logger.debug("raise:", ...e);
295
+ for (const t of this._callbacks)
296
+ await t(...e);
297
+ }
298
+ }, Z = class {
299
+ /**
300
+ * Populates a map of window features with a placement centered in front of
301
+ * the current window. If no explicit width is given, a default value is
302
+ * binned into [800, 720, 600, 480, 360] based on the current window's width.
303
+ */
304
+ static center({ ...e }) {
305
+ var t, s, i;
306
+ return e.width == null && (e.width = (t = [800, 720, 600, 480].find((r) => r <= window.outerWidth / 1.618)) != null ? t : 360), (s = e.left) != null || (e.left = Math.max(0, Math.round(window.screenX + (window.outerWidth - e.width) / 2))), e.height != null && ((i = e.top) != null || (e.top = Math.max(0, Math.round(window.screenY + (window.outerHeight - e.height) / 2)))), e;
307
+ }
308
+ static serialize(e) {
309
+ return Object.entries(e).filter(([, t]) => t != null).map(([t, s]) => `${t}=${typeof s != "boolean" ? s : s ? "yes" : "no"}`).join(",");
310
+ }
311
+ }, T = class j extends I {
312
+ constructor() {
313
+ super(...arguments), this._logger = new g(`Timer('${this._name}')`), this._timerHandle = null, this._expiration = 0, this._callback = () => {
314
+ const t = this._expiration - j.getEpochTime();
315
+ this._logger.debug("timer completes in", t), this._expiration <= j.getEpochTime() && (this.cancel(), super.raise());
316
+ };
317
+ }
318
+ // get the time
319
+ static getEpochTime() {
320
+ return Math.floor(Date.now() / 1e3);
321
+ }
322
+ init(t) {
323
+ const s = this._logger.create("init");
324
+ t = Math.max(Math.floor(t), 1);
325
+ const i = j.getEpochTime() + t;
326
+ if (this.expiration === i && this._timerHandle) {
327
+ s.debug("skipping since already initialized for expiration at", this.expiration);
209
328
  return;
210
- } else
211
- s && r.add(i);
212
- if (_(i) && !S(i)) {
213
- if (!e.immer_.autoFreeze_ && e.unfinalizedDrafts_ < 1)
329
+ }
330
+ this.cancel(), s.debug("using duration", t), this._expiration = i;
331
+ const r = Math.min(t, 5);
332
+ this._timerHandle = setInterval(this._callback, r * 1e3);
333
+ }
334
+ get expiration() {
335
+ return this._expiration;
336
+ }
337
+ cancel() {
338
+ this._logger.create("cancel"), this._timerHandle && (clearInterval(this._timerHandle), this._timerHandle = null);
339
+ }
340
+ }, L = class {
341
+ static readParams(e, t = "query") {
342
+ if (!e) throw new TypeError("Invalid URL");
343
+ const i = new URL(e, "http://127.0.0.1")[t === "fragment" ? "hash" : "search"];
344
+ return new URLSearchParams(i.slice(1));
345
+ }
346
+ }, N = ";", q = class extends Error {
347
+ constructor(e, t) {
348
+ var s, i, r;
349
+ if (super(e.error_description || e.error || ""), this.form = t, this.name = "ErrorResponse", !e.error)
350
+ throw g.error("ErrorResponse", "No error passed"), new Error("No error passed");
351
+ this.error = e.error, this.error_description = (s = e.error_description) != null ? s : null, this.error_uri = (i = e.error_uri) != null ? i : null, this.state = e.userState, this.session_state = (r = e.session_state) != null ? r : null, this.url_state = e.url_state;
352
+ }
353
+ }, G = class extends Error {
354
+ constructor(e) {
355
+ super(e), this.name = "ErrorTimeout";
356
+ }
357
+ }, Ie = class {
358
+ constructor(e) {
359
+ this._logger = new g("AccessTokenEvents"), this._expiringTimer = new T("Access token expiring"), this._expiredTimer = new T("Access token expired"), this._expiringNotificationTimeInSeconds = e.expiringNotificationTimeInSeconds;
360
+ }
361
+ async load(e) {
362
+ const t = this._logger.create("load");
363
+ if (e.access_token && e.expires_in !== void 0) {
364
+ const s = e.expires_in;
365
+ if (t.debug("access token present, remaining duration:", s), s > 0) {
366
+ let r = s - this._expiringNotificationTimeInSeconds;
367
+ r <= 0 && (r = 1), t.debug("registering expiring timer, raising in", r, "seconds"), this._expiringTimer.init(r);
368
+ } else
369
+ t.debug("canceling existing expiring timer because we're past expiration."), this._expiringTimer.cancel();
370
+ const i = s + 1;
371
+ t.debug("registering expired timer, raising in", i, "seconds"), this._expiredTimer.init(i);
372
+ } else
373
+ this._expiringTimer.cancel(), this._expiredTimer.cancel();
374
+ }
375
+ async unload() {
376
+ this._logger.debug("unload: canceling existing access token timers"), this._expiringTimer.cancel(), this._expiredTimer.cancel();
377
+ }
378
+ /**
379
+ * Add callback: Raised prior to the access token expiring.
380
+ */
381
+ addAccessTokenExpiring(e) {
382
+ return this._expiringTimer.addHandler(e);
383
+ }
384
+ /**
385
+ * Remove callback: Raised prior to the access token expiring.
386
+ */
387
+ removeAccessTokenExpiring(e) {
388
+ this._expiringTimer.removeHandler(e);
389
+ }
390
+ /**
391
+ * Add callback: Raised after the access token has expired.
392
+ */
393
+ addAccessTokenExpired(e) {
394
+ return this._expiredTimer.addHandler(e);
395
+ }
396
+ /**
397
+ * Remove callback: Raised after the access token has expired.
398
+ */
399
+ removeAccessTokenExpired(e) {
400
+ this._expiredTimer.removeHandler(e);
401
+ }
402
+ }, Ce = class {
403
+ constructor(e, t, s, i, r) {
404
+ this._callback = e, this._client_id = t, this._intervalInSeconds = i, this._stopOnError = r, this._logger = new g("CheckSessionIFrame"), this._timer = null, this._session_state = null, this._message = (n) => {
405
+ n.origin === this._frame_origin && n.source === this._frame.contentWindow && (n.data === "error" ? (this._logger.error("error message from check session op iframe"), this._stopOnError && this.stop()) : n.data === "changed" ? (this._logger.debug("changed message from check session op iframe"), this.stop(), this._callback()) : this._logger.debug(n.data + " message from check session op iframe"));
406
+ };
407
+ const o = new URL(s);
408
+ this._frame_origin = o.origin, this._frame = window.document.createElement("iframe"), this._frame.style.visibility = "hidden", this._frame.style.position = "fixed", this._frame.style.left = "-1000px", this._frame.style.top = "0", this._frame.width = "0", this._frame.height = "0", this._frame.src = o.href;
409
+ }
410
+ load() {
411
+ return new Promise((e) => {
412
+ this._frame.onload = () => {
413
+ e();
414
+ }, window.document.body.appendChild(this._frame), window.addEventListener("message", this._message, !1);
415
+ });
416
+ }
417
+ start(e) {
418
+ if (this._session_state === e)
214
419
  return;
215
- w(e, i), (!t || !t.scope_.parent_) && typeof n != "symbol" && Object.prototype.propertyIsEnumerable.call(r, n) && g(e, i);
216
- }
217
- }
218
- function g(e, t, r = !1) {
219
- !e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && T(t, r);
220
- }
221
- function re(e, t) {
222
- const r = Array.isArray(e), n = {
223
- type_: r ? 1 : 0,
224
- // Track which produce call this is associated with.
225
- scope_: t ? t.scope_ : G(),
226
- // True for both shallow and deep changes.
227
- modified_: !1,
228
- // Used during finalization.
229
- finalized_: !1,
230
- // Track which properties have been assigned (true) or deleted (false).
231
- assigned_: {},
232
- // The parent draft state.
233
- parent_: t,
234
- // The base state.
235
- base_: e,
236
- // The base proxy.
237
- draft_: null,
238
- // set below
239
- // The base copy with any updated values.
240
- copy_: null,
241
- // Called by the `produce` function.
242
- revoke_: null,
243
- isManual_: !1
244
- };
245
- let i = n, o = M;
246
- r && (i = [n], o = P);
247
- const { revoke: s, proxy: c } = Proxy.revocable(i, o);
248
- return n.draft_ = c, n.revoke_ = s, c;
249
- }
250
- var M = {
251
- get(e, t) {
252
- if (t === u)
253
- return e;
254
- const r = d(e);
255
- if (!A(r, t))
256
- return ne(e, r, t);
257
- const n = r[t];
258
- return e.finalized_ || !_(n) ? n : n === F(e.base_, t) ? (E(e), e.copy_[t] = k(n, e)) : n;
259
- },
260
- has(e, t) {
261
- return t in d(e);
262
- },
263
- ownKeys(e) {
264
- return Reflect.ownKeys(d(e));
265
- },
266
- set(e, t, r) {
267
- const n = H(d(e), t);
268
- if (n != null && n.set)
269
- return n.set.call(e.draft_, r), !0;
270
- if (!e.modified_) {
271
- const i = F(d(e), t), o = i == null ? void 0 : i[u];
272
- if (o && o.base_ === r)
273
- return e.copy_[t] = r, e.assigned_[t] = !1, !0;
274
- if (Z(r, i) && (r !== void 0 || A(e.base_, t)))
275
- return !0;
276
- E(e), I(e);
277
- }
278
- return e.copy_[t] === r && // special case: handle new props with value 'undefined'
279
- (r !== void 0 || t in e.copy_) || // special case: NaN
280
- Number.isNaN(r) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = r, e.assigned_[t] = !0), !0;
281
- },
282
- deleteProperty(e, t) {
283
- return F(e.base_, t) !== void 0 || t in e.base_ ? (e.assigned_[t] = !1, E(e), I(e)) : delete e.assigned_[t], e.copy_ && delete e.copy_[t], !0;
284
- },
285
- // Note: We never coerce `desc.value` into an Immer draft, because we can't make
286
- // the same guarantee in ES5 mode.
287
- getOwnPropertyDescriptor(e, t) {
288
- const r = d(e), n = Reflect.getOwnPropertyDescriptor(r, t);
289
- return n && {
290
- writable: !0,
291
- configurable: e.type_ !== 1 || t !== "length",
292
- enumerable: n.enumerable,
293
- value: r[t]
420
+ this._logger.create("start"), this.stop(), this._session_state = e;
421
+ const t = () => {
422
+ !this._frame.contentWindow || !this._session_state || this._frame.contentWindow.postMessage(this._client_id + " " + this._session_state, this._frame_origin);
294
423
  };
295
- },
296
- defineProperty() {
297
- f(11);
298
- },
299
- getPrototypeOf(e) {
300
- return m(e.base_);
301
- },
302
- setPrototypeOf() {
303
- f(12);
304
- }
305
- }, P = {};
306
- b(M, (e, t) => {
307
- P[e] = function() {
308
- return arguments[0] = arguments[0][0], t.apply(this, arguments);
309
- };
310
- });
311
- P.deleteProperty = function(e, t) {
312
- return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && f(13), P.set.call(this, e, t, void 0);
313
- };
314
- P.set = function(e, t, r) {
315
- return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && f(14), M.set.call(this, e[0], t, r, e[0]);
424
+ t(), this._timer = setInterval(t, this._intervalInSeconds * 1e3);
425
+ }
426
+ stop() {
427
+ this._logger.create("stop"), this._session_state = null, this._timer && (clearInterval(this._timer), this._timer = null);
428
+ }
429
+ }, re = class {
430
+ constructor() {
431
+ this._logger = new g("InMemoryWebStorage"), this._data = {};
432
+ }
433
+ clear() {
434
+ this._logger.create("clear"), this._data = {};
435
+ }
436
+ getItem(e) {
437
+ return this._logger.create(`getItem('${e}')`), this._data[e];
438
+ }
439
+ setItem(e, t) {
440
+ this._logger.create(`setItem('${e}')`), this._data[e] = t;
441
+ }
442
+ removeItem(e) {
443
+ this._logger.create(`removeItem('${e}')`), delete this._data[e];
444
+ }
445
+ get length() {
446
+ return Object.getOwnPropertyNames(this._data).length;
447
+ }
448
+ key(e) {
449
+ return Object.getOwnPropertyNames(this._data)[e];
450
+ }
451
+ }, F = class extends Error {
452
+ constructor(e, t) {
453
+ super(t), this.name = "ErrorDPoPNonce", this.nonce = e;
454
+ }
455
+ }, Q = class {
456
+ constructor(e = [], t = null, s = {}) {
457
+ this._jwtHandler = t, this._extraHeaders = s, this._logger = new g("JsonService"), this._contentTypes = [], this._contentTypes.push(...e, "application/json"), t && this._contentTypes.push("application/jwt");
458
+ }
459
+ async fetchWithTimeout(e, t = {}) {
460
+ const { timeoutInSeconds: s, ...i } = t;
461
+ if (!s)
462
+ return await fetch(e, i);
463
+ const r = new AbortController(), o = setTimeout(() => r.abort(), s * 1e3);
464
+ try {
465
+ return await fetch(e, {
466
+ ...t,
467
+ signal: r.signal
468
+ });
469
+ } catch (n) {
470
+ throw n instanceof DOMException && n.name === "AbortError" ? new G("Network timed out") : n;
471
+ } finally {
472
+ clearTimeout(o);
473
+ }
474
+ }
475
+ async getJson(e, {
476
+ token: t,
477
+ credentials: s,
478
+ timeoutInSeconds: i
479
+ } = {}) {
480
+ const r = this._logger.create("getJson"), o = {
481
+ Accept: this._contentTypes.join(", ")
482
+ };
483
+ t && (r.debug("token passed, setting Authorization header"), o.Authorization = "Bearer " + t), this._appendExtraHeaders(o);
484
+ let n;
485
+ try {
486
+ r.debug("url:", e), n = await this.fetchWithTimeout(e, { method: "GET", headers: o, timeoutInSeconds: i, credentials: s });
487
+ } catch (l) {
488
+ throw r.error("Network Error"), l;
489
+ }
490
+ r.debug("HTTP response received, status", n.status);
491
+ const a = n.headers.get("Content-Type");
492
+ if (a && !this._contentTypes.find((l) => a.startsWith(l)) && r.throw(new Error(`Invalid response Content-Type: ${a ?? "undefined"}, from URL: ${e}`)), n.ok && this._jwtHandler && (a != null && a.startsWith("application/jwt")))
493
+ return await this._jwtHandler(await n.text());
494
+ let c;
495
+ try {
496
+ c = await n.json();
497
+ } catch (l) {
498
+ throw r.error("Error parsing JSON response", l), n.ok ? l : new Error(`${n.statusText} (${n.status})`);
499
+ }
500
+ if (!n.ok)
501
+ throw r.error("Error from server:", c), c.error ? new q(c) : new Error(`${n.statusText} (${n.status}): ${JSON.stringify(c)}`);
502
+ return c;
503
+ }
504
+ async postForm(e, {
505
+ body: t,
506
+ basicAuth: s,
507
+ timeoutInSeconds: i,
508
+ initCredentials: r,
509
+ extraHeaders: o
510
+ }) {
511
+ const n = this._logger.create("postForm"), a = {
512
+ Accept: this._contentTypes.join(", "),
513
+ "Content-Type": "application/x-www-form-urlencoded",
514
+ ...o
515
+ };
516
+ s !== void 0 && (a.Authorization = "Basic " + s), this._appendExtraHeaders(a);
517
+ let c;
518
+ try {
519
+ n.debug("url:", e), c = await this.fetchWithTimeout(e, { method: "POST", headers: a, body: t, timeoutInSeconds: i, credentials: r });
520
+ } catch (u) {
521
+ throw n.error("Network error"), u;
522
+ }
523
+ n.debug("HTTP response received, status", c.status);
524
+ const l = c.headers.get("Content-Type");
525
+ if (l && !this._contentTypes.find((u) => l.startsWith(u)))
526
+ throw new Error(`Invalid response Content-Type: ${l ?? "undefined"}, from URL: ${e}`);
527
+ const d = await c.text();
528
+ let h = {};
529
+ if (d)
530
+ try {
531
+ h = JSON.parse(d);
532
+ } catch (u) {
533
+ throw n.error("Error parsing JSON response", u), c.ok ? u : new Error(`${c.statusText} (${c.status})`);
534
+ }
535
+ if (!c.ok) {
536
+ if (n.error("Error from server:", h), c.headers.has("dpop-nonce")) {
537
+ const u = c.headers.get("dpop-nonce");
538
+ throw new F(u, `${JSON.stringify(h)}`);
539
+ }
540
+ throw h.error ? new q(h, t) : new Error(`${c.statusText} (${c.status}): ${JSON.stringify(h)}`);
541
+ }
542
+ return h;
543
+ }
544
+ _appendExtraHeaders(e) {
545
+ const t = this._logger.create("appendExtraHeaders"), s = Object.keys(this._extraHeaders), i = [
546
+ "accept",
547
+ "content-type"
548
+ ], r = [
549
+ "authorization"
550
+ ];
551
+ s.length !== 0 && s.forEach((o) => {
552
+ if (i.includes(o.toLocaleLowerCase())) {
553
+ t.warn("Protected header could not be set", o, i);
554
+ return;
555
+ }
556
+ if (r.includes(o.toLocaleLowerCase()) && Object.keys(e).includes(o)) {
557
+ t.warn("Header could not be overridden", o, r);
558
+ return;
559
+ }
560
+ const n = typeof this._extraHeaders[o] == "function" ? this._extraHeaders[o]() : this._extraHeaders[o];
561
+ n && n !== "" && (e[o] = n);
562
+ });
563
+ }
564
+ }, xe = class {
565
+ constructor(e) {
566
+ this._settings = e, this._logger = new g("MetadataService"), this._signingKeys = null, this._metadata = null, this._metadataUrl = this._settings.metadataUrl, this._jsonService = new Q(
567
+ ["application/jwk-set+json"],
568
+ null,
569
+ this._settings.extraHeaders
570
+ ), this._settings.signingKeys && (this._logger.debug("using signingKeys from settings"), this._signingKeys = this._settings.signingKeys), this._settings.metadata && (this._logger.debug("using metadata from settings"), this._metadata = this._settings.metadata), this._settings.fetchRequestCredentials && (this._logger.debug("using fetchRequestCredentials from settings"), this._fetchRequestCredentials = this._settings.fetchRequestCredentials);
571
+ }
572
+ resetSigningKeys() {
573
+ this._signingKeys = null;
574
+ }
575
+ async getMetadata() {
576
+ const e = this._logger.create("getMetadata");
577
+ if (this._metadata)
578
+ return e.debug("using cached values"), this._metadata;
579
+ if (!this._metadataUrl)
580
+ throw e.throw(new Error("No authority or metadataUrl configured on settings")), null;
581
+ e.debug("getting metadata from", this._metadataUrl);
582
+ const t = await this._jsonService.getJson(this._metadataUrl, { credentials: this._fetchRequestCredentials, timeoutInSeconds: this._settings.requestTimeoutInSeconds });
583
+ return e.debug("merging remote JSON with seed metadata"), this._metadata = Object.assign({}, t, this._settings.metadataSeed), this._metadata;
584
+ }
585
+ getIssuer() {
586
+ return this._getMetadataProperty("issuer");
587
+ }
588
+ getAuthorizationEndpoint() {
589
+ return this._getMetadataProperty("authorization_endpoint");
590
+ }
591
+ getUserInfoEndpoint() {
592
+ return this._getMetadataProperty("userinfo_endpoint");
593
+ }
594
+ getTokenEndpoint(e = !0) {
595
+ return this._getMetadataProperty("token_endpoint", e);
596
+ }
597
+ getCheckSessionIframe() {
598
+ return this._getMetadataProperty("check_session_iframe", !0);
599
+ }
600
+ getEndSessionEndpoint() {
601
+ return this._getMetadataProperty("end_session_endpoint", !0);
602
+ }
603
+ getRevocationEndpoint(e = !0) {
604
+ return this._getMetadataProperty("revocation_endpoint", e);
605
+ }
606
+ getKeysEndpoint(e = !0) {
607
+ return this._getMetadataProperty("jwks_uri", e);
608
+ }
609
+ async _getMetadataProperty(e, t = !1) {
610
+ const s = this._logger.create(`_getMetadataProperty('${e}')`), i = await this.getMetadata();
611
+ if (s.debug("resolved"), i[e] === void 0) {
612
+ if (t === !0) {
613
+ s.warn("Metadata does not contain optional property");
614
+ return;
615
+ }
616
+ s.throw(new Error("Metadata does not contain property " + e));
617
+ }
618
+ return i[e];
619
+ }
620
+ async getSigningKeys() {
621
+ const e = this._logger.create("getSigningKeys");
622
+ if (this._signingKeys)
623
+ return e.debug("returning signingKeys from cache"), this._signingKeys;
624
+ const t = await this.getKeysEndpoint(!1);
625
+ e.debug("got jwks_uri", t);
626
+ const s = await this._jsonService.getJson(t, { timeoutInSeconds: this._settings.requestTimeoutInSeconds });
627
+ if (e.debug("got key set", s), !Array.isArray(s.keys))
628
+ throw e.throw(new Error("Missing keys on keyset")), null;
629
+ return this._signingKeys = s.keys, this._signingKeys;
630
+ }
631
+ }, ne = class {
632
+ constructor({
633
+ prefix: e = "oidc.",
634
+ store: t = localStorage
635
+ } = {}) {
636
+ this._logger = new g("WebStorageStateStore"), this._store = t, this._prefix = e;
637
+ }
638
+ async set(e, t) {
639
+ this._logger.create(`set('${e}')`), e = this._prefix + e, await this._store.setItem(e, t);
640
+ }
641
+ async get(e) {
642
+ return this._logger.create(`get('${e}')`), e = this._prefix + e, await this._store.getItem(e);
643
+ }
644
+ async remove(e) {
645
+ this._logger.create(`remove('${e}')`), e = this._prefix + e;
646
+ const t = await this._store.getItem(e);
647
+ return await this._store.removeItem(e), t;
648
+ }
649
+ async getAllKeys() {
650
+ this._logger.create("getAllKeys");
651
+ const e = await this._store.length, t = [];
652
+ for (let s = 0; s < e; s++) {
653
+ const i = await this._store.key(s);
654
+ i && i.indexOf(this._prefix) === 0 && t.push(i.substr(this._prefix.length));
655
+ }
656
+ return t;
657
+ }
658
+ }, Ue = "code", Ae = "openid", Oe = "client_secret_post", qe = 900, z = class {
659
+ constructor({
660
+ // metadata related
661
+ authority: e,
662
+ metadataUrl: t,
663
+ metadata: s,
664
+ signingKeys: i,
665
+ metadataSeed: r,
666
+ // client related
667
+ client_id: o,
668
+ client_secret: n,
669
+ response_type: a = Ue,
670
+ scope: c = Ae,
671
+ redirect_uri: l,
672
+ post_logout_redirect_uri: d,
673
+ client_authentication: h = Oe,
674
+ token_endpoint_auth_signing_alg: u = "HS256",
675
+ // optional protocol
676
+ prompt: w,
677
+ display: C,
678
+ max_age: x,
679
+ ui_locales: U,
680
+ acr_values: A,
681
+ resource: P,
682
+ response_mode: O,
683
+ // behavior flags
684
+ filterProtocolClaims: R = !0,
685
+ loadUserInfo: S = !1,
686
+ requestTimeoutInSeconds: p,
687
+ staleStateAgeInSeconds: E = qe,
688
+ mergeClaimsStrategy: v = { array: "replace" },
689
+ disablePKCE: f = !1,
690
+ // other behavior
691
+ stateStore: M,
692
+ revokeTokenAdditionalContentTypes: fe,
693
+ fetchRequestCredentials: X,
694
+ refreshTokenAllowedScope: me,
695
+ // extra
696
+ extraQueryParams: Se = {},
697
+ extraTokenParams: ve = {},
698
+ extraHeaders: ye = {},
699
+ dpop: be,
700
+ omitScopeWhenRequesting: ke = !1
701
+ }) {
702
+ var Y;
703
+ if (this.authority = e, t ? this.metadataUrl = t : (this.metadataUrl = e, e && (this.metadataUrl.endsWith("/") || (this.metadataUrl += "/"), this.metadataUrl += ".well-known/openid-configuration")), this.metadata = s, this.metadataSeed = r, this.signingKeys = i, this.client_id = o, this.client_secret = n, this.response_type = a, this.scope = c, this.redirect_uri = l, this.post_logout_redirect_uri = d, this.client_authentication = h, this.token_endpoint_auth_signing_alg = u, this.prompt = w, this.display = C, this.max_age = x, this.ui_locales = U, this.acr_values = A, this.resource = P, this.response_mode = O, this.filterProtocolClaims = R ?? !0, this.loadUserInfo = !!S, this.staleStateAgeInSeconds = E, this.mergeClaimsStrategy = v, this.omitScopeWhenRequesting = ke, this.disablePKCE = !!f, this.revokeTokenAdditionalContentTypes = fe, this.fetchRequestCredentials = X || "same-origin", this.requestTimeoutInSeconds = p, M)
704
+ this.stateStore = M;
705
+ else {
706
+ const Ee = typeof window < "u" ? window.localStorage : new re();
707
+ this.stateStore = new ne({ store: Ee });
708
+ }
709
+ if (this.refreshTokenAllowedScope = me, this.extraQueryParams = Se, this.extraTokenParams = ve, this.extraHeaders = ye, this.dpop = be, this.dpop && !((Y = this.dpop) != null && Y.store))
710
+ throw new Error("A DPoPStore is required when dpop is enabled");
711
+ }
712
+ }, Ne = class {
713
+ constructor(e, t) {
714
+ this._settings = e, this._metadataService = t, this._logger = new g("UserInfoService"), this._getClaimsFromJwt = async (s) => {
715
+ const i = this._logger.create("_getClaimsFromJwt");
716
+ try {
717
+ const r = H.decode(s);
718
+ return i.debug("JWT decoding successful"), r;
719
+ } catch (r) {
720
+ throw i.error("Error parsing JWT response"), r;
721
+ }
722
+ }, this._jsonService = new Q(
723
+ void 0,
724
+ this._getClaimsFromJwt,
725
+ this._settings.extraHeaders
726
+ );
727
+ }
728
+ async getClaims(e) {
729
+ const t = this._logger.create("getClaims");
730
+ e || this._logger.throw(new Error("No token passed"));
731
+ const s = await this._metadataService.getUserInfoEndpoint();
732
+ t.debug("got userinfo url", s);
733
+ const i = await this._jsonService.getJson(s, {
734
+ token: e,
735
+ credentials: this._settings.fetchRequestCredentials,
736
+ timeoutInSeconds: this._settings.requestTimeoutInSeconds
737
+ });
738
+ return t.debug("got claims", i), i;
739
+ }
740
+ }, oe = class {
741
+ constructor(e, t) {
742
+ this._settings = e, this._metadataService = t, this._logger = new g("TokenClient"), this._jsonService = new Q(
743
+ this._settings.revokeTokenAdditionalContentTypes,
744
+ null,
745
+ this._settings.extraHeaders
746
+ );
747
+ }
748
+ /**
749
+ * Exchange code.
750
+ *
751
+ * @see https://www.rfc-editor.org/rfc/rfc6749#section-4.1.3
752
+ */
753
+ async exchangeCode({
754
+ grant_type: e = "authorization_code",
755
+ redirect_uri: t = this._settings.redirect_uri,
756
+ client_id: s = this._settings.client_id,
757
+ client_secret: i = this._settings.client_secret,
758
+ extraHeaders: r,
759
+ ...o
760
+ }) {
761
+ const n = this._logger.create("exchangeCode");
762
+ s || n.throw(new Error("A client_id is required")), t || n.throw(new Error("A redirect_uri is required")), o.code || n.throw(new Error("A code is required"));
763
+ const a = new URLSearchParams({ grant_type: e, redirect_uri: t });
764
+ for (const [h, u] of Object.entries(o))
765
+ u != null && a.set(h, u);
766
+ if ((this._settings.client_authentication === "client_secret_basic" || this._settings.client_authentication === "client_secret_jwt") && i == null)
767
+ throw n.throw(new Error("A client_secret is required")), null;
768
+ let c;
769
+ const l = await this._metadataService.getTokenEndpoint(!1);
770
+ switch (this._settings.client_authentication) {
771
+ case "client_secret_basic":
772
+ c = _.generateBasicAuth(s, i);
773
+ break;
774
+ case "client_secret_post":
775
+ a.append("client_id", s), i && a.append("client_secret", i);
776
+ break;
777
+ case "client_secret_jwt": {
778
+ const h = await _.generateClientAssertionJwt(s, i, l, this._settings.token_endpoint_auth_signing_alg);
779
+ a.append("client_id", s), a.append("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), a.append("client_assertion", h);
780
+ break;
781
+ }
782
+ }
783
+ n.debug("got token endpoint");
784
+ const d = await this._jsonService.postForm(l, {
785
+ body: a,
786
+ basicAuth: c,
787
+ timeoutInSeconds: this._settings.requestTimeoutInSeconds,
788
+ initCredentials: this._settings.fetchRequestCredentials,
789
+ extraHeaders: r
790
+ });
791
+ return n.debug("got response"), d;
792
+ }
793
+ /**
794
+ * Exchange credentials.
795
+ *
796
+ * @see https://www.rfc-editor.org/rfc/rfc6749#section-4.3.2
797
+ */
798
+ async exchangeCredentials({
799
+ grant_type: e = "password",
800
+ client_id: t = this._settings.client_id,
801
+ client_secret: s = this._settings.client_secret,
802
+ scope: i = this._settings.scope,
803
+ ...r
804
+ }) {
805
+ const o = this._logger.create("exchangeCredentials");
806
+ t || o.throw(new Error("A client_id is required"));
807
+ const n = new URLSearchParams({ grant_type: e });
808
+ this._settings.omitScopeWhenRequesting || n.set("scope", i);
809
+ for (const [d, h] of Object.entries(r))
810
+ h != null && n.set(d, h);
811
+ if ((this._settings.client_authentication === "client_secret_basic" || this._settings.client_authentication === "client_secret_jwt") && s == null)
812
+ throw o.throw(new Error("A client_secret is required")), null;
813
+ let a;
814
+ const c = await this._metadataService.getTokenEndpoint(!1);
815
+ switch (this._settings.client_authentication) {
816
+ case "client_secret_basic":
817
+ a = _.generateBasicAuth(t, s);
818
+ break;
819
+ case "client_secret_post":
820
+ n.append("client_id", t), s && n.append("client_secret", s);
821
+ break;
822
+ case "client_secret_jwt": {
823
+ const d = await _.generateClientAssertionJwt(t, s, c, this._settings.token_endpoint_auth_signing_alg);
824
+ n.append("client_id", t), n.append("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.append("client_assertion", d);
825
+ break;
826
+ }
827
+ }
828
+ o.debug("got token endpoint");
829
+ const l = await this._jsonService.postForm(c, { body: n, basicAuth: a, timeoutInSeconds: this._settings.requestTimeoutInSeconds, initCredentials: this._settings.fetchRequestCredentials });
830
+ return o.debug("got response"), l;
831
+ }
832
+ /**
833
+ * Exchange a refresh token.
834
+ *
835
+ * @see https://www.rfc-editor.org/rfc/rfc6749#section-6
836
+ */
837
+ async exchangeRefreshToken({
838
+ grant_type: e = "refresh_token",
839
+ client_id: t = this._settings.client_id,
840
+ client_secret: s = this._settings.client_secret,
841
+ timeoutInSeconds: i,
842
+ extraHeaders: r,
843
+ ...o
844
+ }) {
845
+ const n = this._logger.create("exchangeRefreshToken");
846
+ t || n.throw(new Error("A client_id is required")), o.refresh_token || n.throw(new Error("A refresh_token is required"));
847
+ const a = new URLSearchParams({ grant_type: e });
848
+ for (const [h, u] of Object.entries(o))
849
+ Array.isArray(u) ? u.forEach((w) => a.append(h, w)) : u != null && a.set(h, u);
850
+ if ((this._settings.client_authentication === "client_secret_basic" || this._settings.client_authentication === "client_secret_jwt") && s == null)
851
+ throw n.throw(new Error("A client_secret is required")), null;
852
+ let c;
853
+ const l = await this._metadataService.getTokenEndpoint(!1);
854
+ switch (this._settings.client_authentication) {
855
+ case "client_secret_basic":
856
+ c = _.generateBasicAuth(t, s);
857
+ break;
858
+ case "client_secret_post":
859
+ a.append("client_id", t), s && a.append("client_secret", s);
860
+ break;
861
+ case "client_secret_jwt": {
862
+ const h = await _.generateClientAssertionJwt(t, s, l, this._settings.token_endpoint_auth_signing_alg);
863
+ a.append("client_id", t), a.append("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), a.append("client_assertion", h);
864
+ break;
865
+ }
866
+ }
867
+ n.debug("got token endpoint");
868
+ const d = await this._jsonService.postForm(l, { body: a, basicAuth: c, timeoutInSeconds: i, initCredentials: this._settings.fetchRequestCredentials, extraHeaders: r });
869
+ return n.debug("got response"), d;
870
+ }
871
+ /**
872
+ * Revoke an access or refresh token.
873
+ *
874
+ * @see https://datatracker.ietf.org/doc/html/rfc7009#section-2.1
875
+ */
876
+ async revoke(e) {
877
+ var t;
878
+ const s = this._logger.create("revoke");
879
+ e.token || s.throw(new Error("A token is required"));
880
+ const i = await this._metadataService.getRevocationEndpoint(!1);
881
+ s.debug(`got revocation endpoint, revoking ${(t = e.token_type_hint) != null ? t : "default token type"}`);
882
+ const r = new URLSearchParams();
883
+ for (const [o, n] of Object.entries(e))
884
+ n != null && r.set(o, n);
885
+ r.set("client_id", this._settings.client_id), this._settings.client_secret && r.set("client_secret", this._settings.client_secret), await this._jsonService.postForm(i, { body: r, timeoutInSeconds: this._settings.requestTimeoutInSeconds }), s.debug("got response");
886
+ }
887
+ }, Me = class {
888
+ constructor(e, t, s) {
889
+ this._settings = e, this._metadataService = t, this._claimsService = s, this._logger = new g("ResponseValidator"), this._userInfoService = new Ne(this._settings, this._metadataService), this._tokenClient = new oe(this._settings, this._metadataService);
890
+ }
891
+ async validateSigninResponse(e, t, s) {
892
+ const i = this._logger.create("validateSigninResponse");
893
+ this._processSigninState(e, t), i.debug("state processed"), await this._processCode(e, t, s), i.debug("code processed"), e.isOpenId && this._validateIdTokenAttributes(e), i.debug("tokens validated"), await this._processClaims(e, t == null ? void 0 : t.skipUserInfo, e.isOpenId), i.debug("claims processed");
894
+ }
895
+ async validateCredentialsResponse(e, t) {
896
+ const s = this._logger.create("validateCredentialsResponse"), i = e.isOpenId && !!e.id_token;
897
+ i && this._validateIdTokenAttributes(e), s.debug("tokens validated"), await this._processClaims(e, t, i), s.debug("claims processed");
898
+ }
899
+ async validateRefreshResponse(e, t) {
900
+ var s, i;
901
+ const r = this._logger.create("validateRefreshResponse");
902
+ e.userState = t.data, (s = e.session_state) != null || (e.session_state = t.session_state), (i = e.scope) != null || (e.scope = t.scope), e.isOpenId && e.id_token && (this._validateIdTokenAttributes(e, t.id_token), r.debug("ID Token validated")), e.id_token || (e.id_token = t.id_token, e.profile = t.profile);
903
+ const o = e.isOpenId && !!e.id_token;
904
+ await this._processClaims(e, !1, o), r.debug("claims processed");
905
+ }
906
+ validateSignoutResponse(e, t) {
907
+ const s = this._logger.create("validateSignoutResponse");
908
+ if (t.id !== e.state && s.throw(new Error("State does not match")), s.debug("state validated"), e.userState = t.data, e.error)
909
+ throw s.warn("Response was error", e.error), new q(e);
910
+ }
911
+ _processSigninState(e, t) {
912
+ var s;
913
+ const i = this._logger.create("_processSigninState");
914
+ if (t.id !== e.state && i.throw(new Error("State does not match")), t.client_id || i.throw(new Error("No client_id on state")), t.authority || i.throw(new Error("No authority on state")), this._settings.authority !== t.authority && i.throw(new Error("authority mismatch on settings vs. signin state")), this._settings.client_id && this._settings.client_id !== t.client_id && i.throw(new Error("client_id mismatch on settings vs. signin state")), i.debug("state validated"), e.userState = t.data, e.url_state = t.url_state, (s = e.scope) != null || (e.scope = t.scope), e.error)
915
+ throw i.warn("Response was error", e.error), new q(e);
916
+ t.code_verifier && !e.code && i.throw(new Error("Expected code in response"));
917
+ }
918
+ async _processClaims(e, t = !1, s = !0) {
919
+ const i = this._logger.create("_processClaims");
920
+ if (e.profile = this._claimsService.filterProtocolClaims(e.profile), t || !this._settings.loadUserInfo || !e.access_token) {
921
+ i.debug("not loading user info");
922
+ return;
923
+ }
924
+ i.debug("loading user info");
925
+ const r = await this._userInfoService.getClaims(e.access_token);
926
+ i.debug("user info claims received from user info endpoint"), s && r.sub !== e.profile.sub && i.throw(new Error("subject from UserInfo response does not match subject in ID Token")), e.profile = this._claimsService.mergeClaims(e.profile, this._claimsService.filterProtocolClaims(r)), i.debug("user info claims received, updated profile:", e.profile);
927
+ }
928
+ async _processCode(e, t, s) {
929
+ const i = this._logger.create("_processCode");
930
+ if (e.code) {
931
+ i.debug("Validating code");
932
+ const r = await this._tokenClient.exchangeCode({
933
+ client_id: t.client_id,
934
+ client_secret: t.client_secret,
935
+ code: e.code,
936
+ redirect_uri: t.redirect_uri,
937
+ code_verifier: t.code_verifier,
938
+ extraHeaders: s,
939
+ ...t.extraTokenParams
940
+ });
941
+ Object.assign(e, r);
942
+ } else
943
+ i.debug("No code to process");
944
+ }
945
+ _validateIdTokenAttributes(e, t) {
946
+ var s;
947
+ const i = this._logger.create("_validateIdTokenAttributes");
948
+ i.debug("decoding ID Token JWT");
949
+ const r = H.decode((s = e.id_token) != null ? s : "");
950
+ if (r.sub || i.throw(new Error("ID Token is missing a subject claim")), t) {
951
+ const o = H.decode(t);
952
+ r.sub !== o.sub && i.throw(new Error("sub in id_token does not match current sub")), r.auth_time && r.auth_time !== o.auth_time && i.throw(new Error("auth_time in id_token does not match original auth_time")), r.azp && r.azp !== o.azp && i.throw(new Error("azp in id_token does not match original azp")), !r.azp && o.azp && i.throw(new Error("azp not in id_token, but present in original id_token"));
953
+ }
954
+ e.profile = r;
955
+ }
956
+ }, $ = class B {
957
+ constructor(t) {
958
+ this.id = t.id || _.generateUUIDv4(), this.data = t.data, t.created && t.created > 0 ? this.created = t.created : this.created = T.getEpochTime(), this.request_type = t.request_type, this.url_state = t.url_state;
959
+ }
960
+ toStorageString() {
961
+ return new g("State").create("toStorageString"), JSON.stringify({
962
+ id: this.id,
963
+ data: this.data,
964
+ created: this.created,
965
+ request_type: this.request_type,
966
+ url_state: this.url_state
967
+ });
968
+ }
969
+ static fromStorageString(t) {
970
+ return g.createStatic("State", "fromStorageString"), Promise.resolve(new B(JSON.parse(t)));
971
+ }
972
+ static async clearStaleState(t, s) {
973
+ const i = g.createStatic("State", "clearStaleState"), r = T.getEpochTime() - s, o = await t.getAllKeys();
974
+ i.debug("got keys", o);
975
+ for (let n = 0; n < o.length; n++) {
976
+ const a = o[n], c = await t.get(a);
977
+ let l = !1;
978
+ if (c)
979
+ try {
980
+ const d = await B.fromStorageString(c);
981
+ i.debug("got item from key:", a, d.created), d.created <= r && (l = !0);
982
+ } catch (d) {
983
+ i.error("Error parsing state for key:", a, d), l = !0;
984
+ }
985
+ else
986
+ i.debug("no item in storage for key:", a), l = !0;
987
+ l && (i.debug("removed item for key:", a), t.remove(a));
988
+ }
989
+ }
990
+ }, ae = class V extends $ {
991
+ constructor(t) {
992
+ super(t), this.code_verifier = t.code_verifier, this.code_challenge = t.code_challenge, this.authority = t.authority, this.client_id = t.client_id, this.redirect_uri = t.redirect_uri, this.scope = t.scope, this.client_secret = t.client_secret, this.extraTokenParams = t.extraTokenParams, this.response_mode = t.response_mode, this.skipUserInfo = t.skipUserInfo;
993
+ }
994
+ static async create(t) {
995
+ const s = t.code_verifier === !0 ? _.generateCodeVerifier() : t.code_verifier || void 0, i = s ? await _.generateCodeChallenge(s) : void 0;
996
+ return new V({
997
+ ...t,
998
+ code_verifier: s,
999
+ code_challenge: i
1000
+ });
1001
+ }
1002
+ toStorageString() {
1003
+ return new g("SigninState").create("toStorageString"), JSON.stringify({
1004
+ id: this.id,
1005
+ data: this.data,
1006
+ created: this.created,
1007
+ request_type: this.request_type,
1008
+ url_state: this.url_state,
1009
+ code_verifier: this.code_verifier,
1010
+ authority: this.authority,
1011
+ client_id: this.client_id,
1012
+ redirect_uri: this.redirect_uri,
1013
+ scope: this.scope,
1014
+ client_secret: this.client_secret,
1015
+ extraTokenParams: this.extraTokenParams,
1016
+ response_mode: this.response_mode,
1017
+ skipUserInfo: this.skipUserInfo
1018
+ });
1019
+ }
1020
+ static fromStorageString(t) {
1021
+ g.createStatic("SigninState", "fromStorageString");
1022
+ const s = JSON.parse(t);
1023
+ return V.create(s);
1024
+ }
1025
+ }, ce = class le {
1026
+ constructor(t) {
1027
+ this.url = t.url, this.state = t.state;
1028
+ }
1029
+ static async create({
1030
+ // mandatory
1031
+ url: t,
1032
+ authority: s,
1033
+ client_id: i,
1034
+ redirect_uri: r,
1035
+ response_type: o,
1036
+ scope: n,
1037
+ // optional
1038
+ state_data: a,
1039
+ response_mode: c,
1040
+ request_type: l,
1041
+ client_secret: d,
1042
+ nonce: h,
1043
+ url_state: u,
1044
+ resource: w,
1045
+ skipUserInfo: C,
1046
+ extraQueryParams: x,
1047
+ extraTokenParams: U,
1048
+ disablePKCE: A,
1049
+ dpopJkt: P,
1050
+ omitScopeWhenRequesting: O,
1051
+ ...R
1052
+ }) {
1053
+ if (!t)
1054
+ throw this._logger.error("create: No url passed"), new Error("url");
1055
+ if (!i)
1056
+ throw this._logger.error("create: No client_id passed"), new Error("client_id");
1057
+ if (!r)
1058
+ throw this._logger.error("create: No redirect_uri passed"), new Error("redirect_uri");
1059
+ if (!o)
1060
+ throw this._logger.error("create: No response_type passed"), new Error("response_type");
1061
+ if (!n)
1062
+ throw this._logger.error("create: No scope passed"), new Error("scope");
1063
+ if (!s)
1064
+ throw this._logger.error("create: No authority passed"), new Error("authority");
1065
+ const S = await ae.create({
1066
+ data: a,
1067
+ request_type: l,
1068
+ url_state: u,
1069
+ code_verifier: !A,
1070
+ client_id: i,
1071
+ authority: s,
1072
+ redirect_uri: r,
1073
+ response_mode: c,
1074
+ client_secret: d,
1075
+ scope: n,
1076
+ extraTokenParams: U,
1077
+ skipUserInfo: C
1078
+ }), p = new URL(t);
1079
+ p.searchParams.append("client_id", i), p.searchParams.append("redirect_uri", r), p.searchParams.append("response_type", o), O || p.searchParams.append("scope", n), h && p.searchParams.append("nonce", h), P && p.searchParams.append("dpop_jkt", P);
1080
+ let E = S.id;
1081
+ u && (E = `${E}${N}${u}`), p.searchParams.append("state", E), S.code_challenge && (p.searchParams.append("code_challenge", S.code_challenge), p.searchParams.append("code_challenge_method", "S256")), w && (Array.isArray(w) ? w : [w]).forEach((f) => p.searchParams.append("resource", f));
1082
+ for (const [v, f] of Object.entries({ response_mode: c, ...R, ...x }))
1083
+ f != null && p.searchParams.append(v, f.toString());
1084
+ return new le({
1085
+ url: p.href,
1086
+ state: S
1087
+ });
1088
+ }
316
1089
  };
317
- function F(e, t) {
318
- const r = e[u];
319
- return (r ? d(r) : e)[t];
320
- }
321
- function ne(e, t, r) {
322
- var i;
323
- const n = H(t, r);
324
- return n ? "value" in n ? n.value : (
325
- // This is a very special case, if the prop is a getter defined by the
326
- // prototype, we should invoke it with the draft as context!
327
- (i = n.get) == null ? void 0 : i.call(e.draft_)
328
- ) : void 0;
329
- }
330
- function H(e, t) {
331
- if (!(t in e))
332
- return;
333
- let r = m(e);
334
- for (; r; ) {
335
- const n = Object.getOwnPropertyDescriptor(r, t);
336
- if (n)
337
- return n;
338
- r = m(r);
339
- }
340
- }
341
- function I(e) {
342
- e.modified_ || (e.modified_ = !0, e.parent_ && I(e.parent_));
343
- }
344
- function E(e) {
345
- e.copy_ || (e.copy_ = N(
346
- e.base_,
347
- e.scope_.immer_.useStrictShallowCopy_
348
- ));
349
- }
350
- var ie = class {
1090
+ ce._logger = new g("SigninRequest");
1091
+ var He = ce, je = "openid", J = class {
1092
+ constructor(e) {
1093
+ if (this.access_token = "", this.token_type = "", this.profile = {}, this.state = e.get("state"), this.session_state = e.get("session_state"), this.state) {
1094
+ const t = decodeURIComponent(this.state).split(N);
1095
+ this.state = t[0], t.length > 1 && (this.url_state = t.slice(1).join(N));
1096
+ }
1097
+ this.error = e.get("error"), this.error_description = e.get("error_description"), this.error_uri = e.get("error_uri"), this.code = e.get("code");
1098
+ }
1099
+ get expires_in() {
1100
+ if (this.expires_at !== void 0)
1101
+ return this.expires_at - T.getEpochTime();
1102
+ }
1103
+ set expires_in(e) {
1104
+ typeof e == "string" && (e = Number(e)), e !== void 0 && e >= 0 && (this.expires_at = Math.floor(e) + T.getEpochTime());
1105
+ }
1106
+ get isOpenId() {
1107
+ var e;
1108
+ return ((e = this.scope) == null ? void 0 : e.split(" ").includes(je)) || !!this.id_token;
1109
+ }
1110
+ }, De = class {
1111
+ constructor({
1112
+ url: e,
1113
+ state_data: t,
1114
+ id_token_hint: s,
1115
+ post_logout_redirect_uri: i,
1116
+ extraQueryParams: r,
1117
+ request_type: o,
1118
+ client_id: n,
1119
+ url_state: a
1120
+ }) {
1121
+ if (this._logger = new g("SignoutRequest"), !e)
1122
+ throw this._logger.error("ctor: No url passed"), new Error("url");
1123
+ const c = new URL(e);
1124
+ if (s && c.searchParams.append("id_token_hint", s), n && c.searchParams.append("client_id", n), i && (c.searchParams.append("post_logout_redirect_uri", i), t || a)) {
1125
+ this.state = new $({ data: t, request_type: o, url_state: a });
1126
+ let l = this.state.id;
1127
+ a && (l = `${l}${N}${a}`), c.searchParams.append("state", l);
1128
+ }
1129
+ for (const [l, d] of Object.entries({ ...r }))
1130
+ d != null && c.searchParams.append(l, d.toString());
1131
+ this.url = c.href;
1132
+ }
1133
+ }, $e = class {
1134
+ constructor(e) {
1135
+ if (this.state = e.get("state"), this.state) {
1136
+ const t = decodeURIComponent(this.state).split(N);
1137
+ this.state = t[0], t.length > 1 && (this.url_state = t.slice(1).join(N));
1138
+ }
1139
+ this.error = e.get("error"), this.error_description = e.get("error_description"), this.error_uri = e.get("error_uri");
1140
+ }
1141
+ }, Je = [
1142
+ "nbf",
1143
+ "jti",
1144
+ "auth_time",
1145
+ "nonce",
1146
+ "acr",
1147
+ "amr",
1148
+ "azp",
1149
+ "at_hash"
1150
+ // https://openid.net/specs/openid-connect-core-1_0.html#CodeIDToken
1151
+ ], We = ["sub", "iss", "aud", "exp", "iat"], Ke = class {
1152
+ constructor(e) {
1153
+ this._settings = e, this._logger = new g("ClaimsService");
1154
+ }
1155
+ filterProtocolClaims(e) {
1156
+ const t = { ...e };
1157
+ if (this._settings.filterProtocolClaims) {
1158
+ let s;
1159
+ Array.isArray(this._settings.filterProtocolClaims) ? s = this._settings.filterProtocolClaims : s = Je;
1160
+ for (const i of s)
1161
+ We.includes(i) || delete t[i];
1162
+ }
1163
+ return t;
1164
+ }
1165
+ mergeClaims(e, t) {
1166
+ const s = { ...e };
1167
+ for (const [i, r] of Object.entries(t))
1168
+ if (s[i] !== r)
1169
+ if (Array.isArray(s[i]) || Array.isArray(r))
1170
+ if (this._settings.mergeClaimsStrategy.array == "replace")
1171
+ s[i] = r;
1172
+ else {
1173
+ const o = Array.isArray(s[i]) ? s[i] : [s[i]];
1174
+ for (const n of Array.isArray(r) ? r : [r])
1175
+ o.includes(n) || o.push(n);
1176
+ s[i] = o;
1177
+ }
1178
+ else typeof s[i] == "object" && typeof r == "object" ? s[i] = this.mergeClaims(s[i], r) : s[i] = r;
1179
+ return s;
1180
+ }
1181
+ }, de = class {
1182
+ constructor(e, t) {
1183
+ this.keys = e, this.nonce = t;
1184
+ }
1185
+ }, Le = class {
1186
+ constructor(e, t) {
1187
+ this._logger = new g("OidcClient"), this.settings = e instanceof z ? e : new z(e), this.metadataService = t ?? new xe(this.settings), this._claimsService = new Ke(this.settings), this._validator = new Me(this.settings, this.metadataService, this._claimsService), this._tokenClient = new oe(this.settings, this.metadataService);
1188
+ }
1189
+ async createSigninRequest({
1190
+ state: e,
1191
+ request: t,
1192
+ request_uri: s,
1193
+ request_type: i,
1194
+ id_token_hint: r,
1195
+ login_hint: o,
1196
+ skipUserInfo: n,
1197
+ nonce: a,
1198
+ url_state: c,
1199
+ response_type: l = this.settings.response_type,
1200
+ scope: d = this.settings.scope,
1201
+ redirect_uri: h = this.settings.redirect_uri,
1202
+ prompt: u = this.settings.prompt,
1203
+ display: w = this.settings.display,
1204
+ max_age: C = this.settings.max_age,
1205
+ ui_locales: x = this.settings.ui_locales,
1206
+ acr_values: U = this.settings.acr_values,
1207
+ resource: A = this.settings.resource,
1208
+ response_mode: P = this.settings.response_mode,
1209
+ extraQueryParams: O = this.settings.extraQueryParams,
1210
+ extraTokenParams: R = this.settings.extraTokenParams,
1211
+ dpopJkt: S,
1212
+ omitScopeWhenRequesting: p = this.settings.omitScopeWhenRequesting
1213
+ }) {
1214
+ const E = this._logger.create("createSigninRequest");
1215
+ if (l !== "code")
1216
+ throw new Error("Only the Authorization Code flow (with PKCE) is supported");
1217
+ const v = await this.metadataService.getAuthorizationEndpoint();
1218
+ E.debug("Received authorization endpoint", v);
1219
+ const f = await He.create({
1220
+ url: v,
1221
+ authority: this.settings.authority,
1222
+ client_id: this.settings.client_id,
1223
+ redirect_uri: h,
1224
+ response_type: l,
1225
+ scope: d,
1226
+ state_data: e,
1227
+ url_state: c,
1228
+ prompt: u,
1229
+ display: w,
1230
+ max_age: C,
1231
+ ui_locales: x,
1232
+ id_token_hint: r,
1233
+ login_hint: o,
1234
+ acr_values: U,
1235
+ dpopJkt: S,
1236
+ resource: A,
1237
+ request: t,
1238
+ request_uri: s,
1239
+ extraQueryParams: O,
1240
+ extraTokenParams: R,
1241
+ request_type: i,
1242
+ response_mode: P,
1243
+ client_secret: this.settings.client_secret,
1244
+ skipUserInfo: n,
1245
+ nonce: a,
1246
+ disablePKCE: this.settings.disablePKCE,
1247
+ omitScopeWhenRequesting: p
1248
+ });
1249
+ await this.clearStaleState();
1250
+ const M = f.state;
1251
+ return await this.settings.stateStore.set(M.id, M.toStorageString()), f;
1252
+ }
1253
+ async readSigninResponseState(e, t = !1) {
1254
+ const s = this._logger.create("readSigninResponseState"), i = new J(L.readParams(e, this.settings.response_mode));
1255
+ if (!i.state)
1256
+ throw s.throw(new Error("No state in response")), null;
1257
+ const r = await this.settings.stateStore[t ? "remove" : "get"](i.state);
1258
+ if (!r)
1259
+ throw s.throw(new Error("No matching state found in storage")), null;
1260
+ return { state: await ae.fromStorageString(r), response: i };
1261
+ }
1262
+ async processSigninResponse(e, t, s = !0) {
1263
+ const i = this._logger.create("processSigninResponse"), { state: r, response: o } = await this.readSigninResponseState(e, s);
1264
+ if (i.debug("received state from storage; validating response"), this.settings.dpop && this.settings.dpop.store) {
1265
+ const n = await this.getDpopProof(this.settings.dpop.store);
1266
+ t = { ...t, DPoP: n };
1267
+ }
1268
+ try {
1269
+ await this._validator.validateSigninResponse(o, r, t);
1270
+ } catch (n) {
1271
+ if (n instanceof F && this.settings.dpop) {
1272
+ const a = await this.getDpopProof(this.settings.dpop.store, n.nonce);
1273
+ t.DPoP = a, await this._validator.validateSigninResponse(o, r, t);
1274
+ } else
1275
+ throw n;
1276
+ }
1277
+ return o;
1278
+ }
1279
+ async getDpopProof(e, t) {
1280
+ let s, i;
1281
+ return (await e.getAllKeys()).includes(this.settings.client_id) ? (i = await e.get(this.settings.client_id), i.nonce !== t && t && (i.nonce = t, await e.set(this.settings.client_id, i))) : (s = await _.generateDPoPKeys(), i = new de(s, t), await e.set(this.settings.client_id, i)), await _.generateDPoPProof({
1282
+ url: await this.metadataService.getTokenEndpoint(!1),
1283
+ httpMethod: "POST",
1284
+ keyPair: i.keys,
1285
+ nonce: i.nonce
1286
+ });
1287
+ }
1288
+ async processResourceOwnerPasswordCredentials({
1289
+ username: e,
1290
+ password: t,
1291
+ skipUserInfo: s = !1,
1292
+ extraTokenParams: i = {}
1293
+ }) {
1294
+ const r = await this._tokenClient.exchangeCredentials({ username: e, password: t, ...i }), o = new J(new URLSearchParams());
1295
+ return Object.assign(o, r), await this._validator.validateCredentialsResponse(o, s), o;
1296
+ }
1297
+ async useRefreshToken({
1298
+ state: e,
1299
+ redirect_uri: t,
1300
+ resource: s,
1301
+ timeoutInSeconds: i,
1302
+ extraHeaders: r,
1303
+ extraTokenParams: o
1304
+ }) {
1305
+ var n;
1306
+ const a = this._logger.create("useRefreshToken");
1307
+ let c;
1308
+ if (this.settings.refreshTokenAllowedScope === void 0)
1309
+ c = e.scope;
1310
+ else {
1311
+ const h = this.settings.refreshTokenAllowedScope.split(" ");
1312
+ c = (((n = e.scope) == null ? void 0 : n.split(" ")) || []).filter((w) => h.includes(w)).join(" ");
1313
+ }
1314
+ if (this.settings.dpop && this.settings.dpop.store) {
1315
+ const h = await this.getDpopProof(this.settings.dpop.store);
1316
+ r = { ...r, DPoP: h };
1317
+ }
1318
+ let l;
1319
+ try {
1320
+ l = await this._tokenClient.exchangeRefreshToken({
1321
+ refresh_token: e.refresh_token,
1322
+ // provide the (possible filtered) scope list
1323
+ scope: c,
1324
+ redirect_uri: t,
1325
+ resource: s,
1326
+ timeoutInSeconds: i,
1327
+ extraHeaders: r,
1328
+ ...o
1329
+ });
1330
+ } catch (h) {
1331
+ if (h instanceof F && this.settings.dpop)
1332
+ r.DPoP = await this.getDpopProof(this.settings.dpop.store, h.nonce), l = await this._tokenClient.exchangeRefreshToken({
1333
+ refresh_token: e.refresh_token,
1334
+ // provide the (possible filtered) scope list
1335
+ scope: c,
1336
+ redirect_uri: t,
1337
+ resource: s,
1338
+ timeoutInSeconds: i,
1339
+ extraHeaders: r,
1340
+ ...o
1341
+ });
1342
+ else
1343
+ throw h;
1344
+ }
1345
+ const d = new J(new URLSearchParams());
1346
+ return Object.assign(d, l), a.debug("validating response", d), await this._validator.validateRefreshResponse(d, {
1347
+ ...e,
1348
+ // override the scope in the state handed over to the validator
1349
+ // so it can set the granted scope to the requested scope in case none is included in the response
1350
+ scope: c
1351
+ }), d;
1352
+ }
1353
+ async createSignoutRequest({
1354
+ state: e,
1355
+ id_token_hint: t,
1356
+ client_id: s,
1357
+ request_type: i,
1358
+ url_state: r,
1359
+ post_logout_redirect_uri: o = this.settings.post_logout_redirect_uri,
1360
+ extraQueryParams: n = this.settings.extraQueryParams
1361
+ } = {}) {
1362
+ const a = this._logger.create("createSignoutRequest"), c = await this.metadataService.getEndSessionEndpoint();
1363
+ if (!c)
1364
+ throw a.throw(new Error("No end session endpoint")), null;
1365
+ a.debug("Received end session endpoint", c), !s && o && !t && (s = this.settings.client_id);
1366
+ const l = new De({
1367
+ url: c,
1368
+ id_token_hint: t,
1369
+ client_id: s,
1370
+ post_logout_redirect_uri: o,
1371
+ state_data: e,
1372
+ extraQueryParams: n,
1373
+ request_type: i,
1374
+ url_state: r
1375
+ });
1376
+ await this.clearStaleState();
1377
+ const d = l.state;
1378
+ return d && (a.debug("Signout request has state to persist"), await this.settings.stateStore.set(d.id, d.toStorageString())), l;
1379
+ }
1380
+ async readSignoutResponseState(e, t = !1) {
1381
+ const s = this._logger.create("readSignoutResponseState"), i = new $e(L.readParams(e, this.settings.response_mode));
1382
+ if (!i.state) {
1383
+ if (s.debug("No state in response"), i.error)
1384
+ throw s.warn("Response was error:", i.error), new q(i);
1385
+ return { state: void 0, response: i };
1386
+ }
1387
+ const r = await this.settings.stateStore[t ? "remove" : "get"](i.state);
1388
+ if (!r)
1389
+ throw s.throw(new Error("No matching state found in storage")), null;
1390
+ return { state: await $.fromStorageString(r), response: i };
1391
+ }
1392
+ async processSignoutResponse(e) {
1393
+ const t = this._logger.create("processSignoutResponse"), { state: s, response: i } = await this.readSignoutResponseState(e, !0);
1394
+ return s ? (t.debug("Received state from storage; validating response"), this._validator.validateSignoutResponse(i, s)) : t.debug("No state from storage; skipping response validation"), i;
1395
+ }
1396
+ clearStaleState() {
1397
+ return this._logger.create("clearStaleState"), $.clearStaleState(this.settings.stateStore, this.settings.staleStateAgeInSeconds);
1398
+ }
1399
+ async revokeToken(e, t) {
1400
+ return this._logger.create("revokeToken"), await this._tokenClient.revoke({
1401
+ token: e,
1402
+ token_type_hint: t
1403
+ });
1404
+ }
1405
+ }, Fe = class {
351
1406
  constructor(e) {
352
- this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.produce = (t, r, n) => {
353
- if (typeof t == "function" && typeof r != "function") {
354
- const o = r;
355
- r = t;
356
- const s = this;
357
- return function(l = o, ...q) {
358
- return s.produce(l, (J) => r.call(this, J, ...q));
1407
+ this._userManager = e, this._logger = new g("SessionMonitor"), this._start = async (t) => {
1408
+ const s = t.session_state;
1409
+ if (!s)
1410
+ return;
1411
+ const i = this._logger.create("_start");
1412
+ if (t.profile ? (this._sub = t.profile.sub, i.debug("session_state", s, ", sub", this._sub)) : (this._sub = void 0, i.debug("session_state", s, ", anonymous user")), this._checkSessionIFrame) {
1413
+ this._checkSessionIFrame.start(s);
1414
+ return;
1415
+ }
1416
+ try {
1417
+ const r = await this._userManager.metadataService.getCheckSessionIframe();
1418
+ if (r) {
1419
+ i.debug("initializing check session iframe");
1420
+ const o = this._userManager.settings.client_id, n = this._userManager.settings.checkSessionIntervalInSeconds, a = this._userManager.settings.stopCheckSessionOnError, c = new Ce(this._callback, o, r, n, a);
1421
+ await c.load(), this._checkSessionIFrame = c, c.start(s);
1422
+ } else
1423
+ i.warn("no check session iframe found in the metadata");
1424
+ } catch (r) {
1425
+ i.error("Error from getCheckSessionIframe:", r instanceof Error ? r.message : r);
1426
+ }
1427
+ }, this._stop = () => {
1428
+ const t = this._logger.create("_stop");
1429
+ if (this._sub = void 0, this._checkSessionIFrame && this._checkSessionIFrame.stop(), this._userManager.settings.monitorAnonymousSession) {
1430
+ const s = setInterval(async () => {
1431
+ clearInterval(s);
1432
+ try {
1433
+ const i = await this._userManager.querySessionStatus();
1434
+ if (i) {
1435
+ const r = {
1436
+ session_state: i.session_state,
1437
+ profile: i.sub ? {
1438
+ sub: i.sub
1439
+ } : null
1440
+ };
1441
+ this._start(r);
1442
+ }
1443
+ } catch (i) {
1444
+ t.error("error from querySessionStatus", i instanceof Error ? i.message : i);
1445
+ }
1446
+ }, 1e3);
1447
+ }
1448
+ }, this._callback = async () => {
1449
+ const t = this._logger.create("_callback");
1450
+ try {
1451
+ const s = await this._userManager.querySessionStatus();
1452
+ let i = !0;
1453
+ s && this._checkSessionIFrame ? s.sub === this._sub ? (i = !1, this._checkSessionIFrame.start(s.session_state), t.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state", s.session_state), await this._userManager.events._raiseUserSessionChanged()) : t.debug("different subject signed into OP", s.sub) : t.debug("subject no longer signed into OP"), i ? this._sub ? await this._userManager.events._raiseUserSignedOut() : await this._userManager.events._raiseUserSignedIn() : t.debug("no change in session detected, no event to raise");
1454
+ } catch (s) {
1455
+ this._sub && (t.debug("Error calling queryCurrentSigninSession; raising signed out event", s), await this._userManager.events._raiseUserSignedOut());
1456
+ }
1457
+ }, e || this._logger.throw(new Error("No user manager passed")), this._userManager.events.addUserLoaded(this._start), this._userManager.events.addUserUnloaded(this._stop), this._init().catch((t) => {
1458
+ this._logger.error(t);
1459
+ });
1460
+ }
1461
+ async _init() {
1462
+ this._logger.create("_init");
1463
+ const e = await this._userManager.getUser();
1464
+ if (e)
1465
+ this._start(e);
1466
+ else if (this._userManager.settings.monitorAnonymousSession) {
1467
+ const t = await this._userManager.querySessionStatus();
1468
+ if (t) {
1469
+ const s = {
1470
+ session_state: t.session_state,
1471
+ profile: t.sub ? {
1472
+ sub: t.sub
1473
+ } : null
359
1474
  };
1475
+ this._start(s);
360
1476
  }
361
- typeof r != "function" && f(6), n !== void 0 && typeof n != "function" && f(7);
362
- let i;
363
- if (_(t)) {
364
- const o = j(this), s = k(t, void 0);
365
- let c = !0;
366
- try {
367
- i = r(s), c = !1;
368
- } finally {
369
- c ? v(o) : C(o);
1477
+ }
1478
+ }
1479
+ }, W = class he {
1480
+ constructor(t) {
1481
+ var s;
1482
+ this.id_token = t.id_token, this.session_state = (s = t.session_state) != null ? s : null, this.access_token = t.access_token, this.refresh_token = t.refresh_token, this.token_type = t.token_type, this.scope = t.scope, this.profile = t.profile, this.expires_at = t.expires_at, this.state = t.userState, this.url_state = t.url_state;
1483
+ }
1484
+ /** Computed number of seconds the access token has remaining. */
1485
+ get expires_in() {
1486
+ if (this.expires_at !== void 0)
1487
+ return this.expires_at - T.getEpochTime();
1488
+ }
1489
+ set expires_in(t) {
1490
+ t !== void 0 && (this.expires_at = Math.floor(t) + T.getEpochTime());
1491
+ }
1492
+ /** Computed value indicating if the access token is expired. */
1493
+ get expired() {
1494
+ const t = this.expires_in;
1495
+ if (t !== void 0)
1496
+ return t <= 0;
1497
+ }
1498
+ /** Array representing the parsed values from the `scope`. */
1499
+ get scopes() {
1500
+ var t, s;
1501
+ return (s = (t = this.scope) == null ? void 0 : t.split(" ")) != null ? s : [];
1502
+ }
1503
+ toStorageString() {
1504
+ return new g("User").create("toStorageString"), JSON.stringify({
1505
+ id_token: this.id_token,
1506
+ session_state: this.session_state,
1507
+ access_token: this.access_token,
1508
+ refresh_token: this.refresh_token,
1509
+ token_type: this.token_type,
1510
+ scope: this.scope,
1511
+ profile: this.profile,
1512
+ expires_at: this.expires_at
1513
+ });
1514
+ }
1515
+ static fromStorageString(t) {
1516
+ return g.createStatic("User", "fromStorageString"), new he(JSON.parse(t));
1517
+ }
1518
+ }, ee = "oidc-client", ge = class {
1519
+ constructor() {
1520
+ this._abort = new I("Window navigation aborted"), this._disposeHandlers = /* @__PURE__ */ new Set(), this._window = null;
1521
+ }
1522
+ async navigate(e) {
1523
+ const t = this._logger.create("navigate");
1524
+ if (!this._window)
1525
+ throw new Error("Attempted to navigate on a disposed window");
1526
+ t.debug("setting URL in window"), this._window.location.replace(e.url);
1527
+ const { url: s, keepOpen: i } = await new Promise((r, o) => {
1528
+ const n = (c) => {
1529
+ var l;
1530
+ const d = c.data, h = (l = e.scriptOrigin) != null ? l : window.location.origin;
1531
+ if (!(c.origin !== h || (d == null ? void 0 : d.source) !== ee)) {
1532
+ try {
1533
+ const u = L.readParams(d.url, e.response_mode).get("state");
1534
+ if (u || t.warn("no state found in response url"), c.source !== this._window && u !== e.state)
1535
+ return;
1536
+ } catch {
1537
+ this._dispose(), o(new Error("Invalid response from window"));
1538
+ }
1539
+ r(d);
370
1540
  }
371
- return x(o, n), $(i, o);
372
- } else if (!t || typeof t != "object") {
373
- if (i = r(t), i === void 0 && (i = t), i === W && (i = void 0), this.autoFreeze_ && T(i, !0), n) {
374
- const o = [], s = [];
375
- y("Patches").generateReplacementPatches_(t, i, o, s), n(o, s);
1541
+ };
1542
+ window.addEventListener("message", n, !1), this._disposeHandlers.add(() => window.removeEventListener("message", n, !1));
1543
+ const a = new BroadcastChannel(`oidc-client-popup-${e.state}`);
1544
+ a.addEventListener("message", n, !1), this._disposeHandlers.add(() => a.close()), this._disposeHandlers.add(this._abort.addHandler((c) => {
1545
+ this._dispose(), o(c);
1546
+ }));
1547
+ });
1548
+ return t.debug("got response from window"), this._dispose(), i || this.close(), { url: s };
1549
+ }
1550
+ _dispose() {
1551
+ this._logger.create("_dispose");
1552
+ for (const e of this._disposeHandlers)
1553
+ e();
1554
+ this._disposeHandlers.clear();
1555
+ }
1556
+ static _notifyParent(e, t, s = !1, i = window.location.origin) {
1557
+ const r = {
1558
+ source: ee,
1559
+ url: t,
1560
+ keepOpen: s
1561
+ }, o = new g("_notifyParent");
1562
+ if (e)
1563
+ o.debug("With parent. Using parent.postMessage."), e.postMessage(r, i);
1564
+ else {
1565
+ o.debug("No parent. Using BroadcastChannel.");
1566
+ const n = new URL(t).searchParams.get("state");
1567
+ if (!n)
1568
+ throw new Error("No parent and no state in URL. Can't complete notification.");
1569
+ const a = new BroadcastChannel(`oidc-client-popup-${n}`);
1570
+ a.postMessage(r), a.close();
1571
+ }
1572
+ }
1573
+ }, ue = {
1574
+ location: !1,
1575
+ toolbar: !1,
1576
+ height: 640,
1577
+ closePopupWindowAfterInSeconds: -1
1578
+ }, _e = "_blank", ze = 60, Be = 2, pe = 10, Ve = class extends z {
1579
+ constructor(e) {
1580
+ const {
1581
+ popup_redirect_uri: t = e.redirect_uri,
1582
+ popup_post_logout_redirect_uri: s = e.post_logout_redirect_uri,
1583
+ popupWindowFeatures: i = ue,
1584
+ popupWindowTarget: r = _e,
1585
+ redirectMethod: o = "assign",
1586
+ redirectTarget: n = "self",
1587
+ iframeNotifyParentOrigin: a = e.iframeNotifyParentOrigin,
1588
+ iframeScriptOrigin: c = e.iframeScriptOrigin,
1589
+ requestTimeoutInSeconds: l,
1590
+ silent_redirect_uri: d = e.redirect_uri,
1591
+ silentRequestTimeoutInSeconds: h,
1592
+ automaticSilentRenew: u = !0,
1593
+ validateSubOnSilentRenew: w = !0,
1594
+ includeIdTokenInSilentRenew: C = !1,
1595
+ monitorSession: x = !1,
1596
+ monitorAnonymousSession: U = !1,
1597
+ checkSessionIntervalInSeconds: A = Be,
1598
+ query_status_response_type: P = "code",
1599
+ stopCheckSessionOnError: O = !0,
1600
+ revokeTokenTypes: R = ["access_token", "refresh_token"],
1601
+ revokeTokensOnSignout: S = !1,
1602
+ includeIdTokenInSilentSignout: p = !1,
1603
+ accessTokenExpiringNotificationTimeInSeconds: E = ze,
1604
+ userStore: v
1605
+ } = e;
1606
+ if (super(e), this.popup_redirect_uri = t, this.popup_post_logout_redirect_uri = s, this.popupWindowFeatures = i, this.popupWindowTarget = r, this.redirectMethod = o, this.redirectTarget = n, this.iframeNotifyParentOrigin = a, this.iframeScriptOrigin = c, this.silent_redirect_uri = d, this.silentRequestTimeoutInSeconds = h || l || pe, this.automaticSilentRenew = u, this.validateSubOnSilentRenew = w, this.includeIdTokenInSilentRenew = C, this.monitorSession = x, this.monitorAnonymousSession = U, this.checkSessionIntervalInSeconds = A, this.stopCheckSessionOnError = O, this.query_status_response_type = P, this.revokeTokenTypes = R, this.revokeTokensOnSignout = S, this.includeIdTokenInSilentSignout = p, this.accessTokenExpiringNotificationTimeInSeconds = E, v)
1607
+ this.userStore = v;
1608
+ else {
1609
+ const f = typeof window < "u" ? window.sessionStorage : new re();
1610
+ this.userStore = new ne({ store: f });
1611
+ }
1612
+ }
1613
+ }, te = class we extends ge {
1614
+ constructor({
1615
+ silentRequestTimeoutInSeconds: t = pe
1616
+ }) {
1617
+ super(), this._logger = new g("IFrameWindow"), this._timeoutInSeconds = t, this._frame = we.createHiddenIframe(), this._window = this._frame.contentWindow;
1618
+ }
1619
+ static createHiddenIframe() {
1620
+ const t = window.document.createElement("iframe");
1621
+ return t.style.visibility = "hidden", t.style.position = "fixed", t.style.left = "-1000px", t.style.top = "0", t.width = "0", t.height = "0", window.document.body.appendChild(t), t;
1622
+ }
1623
+ async navigate(t) {
1624
+ this._logger.debug("navigate: Using timeout of:", this._timeoutInSeconds);
1625
+ const s = setTimeout(() => void this._abort.raise(new G("IFrame timed out without a response")), this._timeoutInSeconds * 1e3);
1626
+ return this._disposeHandlers.add(() => clearTimeout(s)), await super.navigate(t);
1627
+ }
1628
+ close() {
1629
+ var t;
1630
+ this._frame && (this._frame.parentNode && (this._frame.addEventListener("load", (s) => {
1631
+ var i;
1632
+ const r = s.target;
1633
+ (i = r.parentNode) == null || i.removeChild(r), this._abort.raise(new Error("IFrame removed from DOM"));
1634
+ }, !0), (t = this._frame.contentWindow) == null || t.location.replace("about:blank")), this._frame = null), this._window = null;
1635
+ }
1636
+ static notifyParent(t, s) {
1637
+ return super._notifyParent(window.parent, t, !1, s);
1638
+ }
1639
+ }, Ge = class {
1640
+ constructor(e) {
1641
+ this._settings = e, this._logger = new g("IFrameNavigator");
1642
+ }
1643
+ async prepare({
1644
+ silentRequestTimeoutInSeconds: e = this._settings.silentRequestTimeoutInSeconds
1645
+ }) {
1646
+ return new te({ silentRequestTimeoutInSeconds: e });
1647
+ }
1648
+ async callback(e) {
1649
+ this._logger.create("callback"), te.notifyParent(e, this._settings.iframeNotifyParentOrigin);
1650
+ }
1651
+ }, Qe = 500, Xe = 1e3, se = class extends ge {
1652
+ constructor({
1653
+ popupWindowTarget: e = _e,
1654
+ popupWindowFeatures: t = {},
1655
+ popupSignal: s,
1656
+ popupAbortOnClose: i
1657
+ }) {
1658
+ super(), this._logger = new g("PopupWindow");
1659
+ const r = Z.center({ ...ue, ...t });
1660
+ this._window = window.open(void 0, e, Z.serialize(r)), this.abortOnClose = !!i, s && s.addEventListener("abort", () => {
1661
+ var o;
1662
+ this._abort.raise(new Error((o = s.reason) != null ? o : "Popup aborted"));
1663
+ }), t.closePopupWindowAfterInSeconds && t.closePopupWindowAfterInSeconds > 0 && setTimeout(() => {
1664
+ if (!this._window || typeof this._window.closed != "boolean" || this._window.closed) {
1665
+ this._abort.raise(new Error("Popup blocked by user"));
1666
+ return;
1667
+ }
1668
+ this.close();
1669
+ }, t.closePopupWindowAfterInSeconds * Xe);
1670
+ }
1671
+ async navigate(e) {
1672
+ var t;
1673
+ (t = this._window) == null || t.focus();
1674
+ const s = setInterval(() => {
1675
+ (!this._window || this._window.closed) && (this._logger.debug("Popup closed by user or isolated by redirect"), i(), this._disposeHandlers.delete(i), this.abortOnClose && this._abort.raise(new Error("Popup closed by user")));
1676
+ }, Qe), i = () => clearInterval(s);
1677
+ return this._disposeHandlers.add(i), await super.navigate(e);
1678
+ }
1679
+ close() {
1680
+ this._window && (this._window.closed || (this._window.close(), this._abort.raise(new Error("Popup closed")))), this._window = null;
1681
+ }
1682
+ static notifyOpener(e, t) {
1683
+ super._notifyParent(window.opener, e, t), !t && !window.opener && window.close();
1684
+ }
1685
+ }, Ye = class {
1686
+ constructor(e) {
1687
+ this._settings = e, this._logger = new g("PopupNavigator");
1688
+ }
1689
+ async prepare({
1690
+ popupWindowFeatures: e = this._settings.popupWindowFeatures,
1691
+ popupWindowTarget: t = this._settings.popupWindowTarget,
1692
+ popupSignal: s,
1693
+ popupAbortOnClose: i
1694
+ }) {
1695
+ return new se({
1696
+ popupWindowFeatures: e,
1697
+ popupWindowTarget: t,
1698
+ popupSignal: s,
1699
+ popupAbortOnClose: i
1700
+ });
1701
+ }
1702
+ async callback(e, { keepOpen: t = !1 }) {
1703
+ this._logger.create("callback"), se.notifyOpener(e, t);
1704
+ }
1705
+ }, Ze = class {
1706
+ constructor(e) {
1707
+ this._settings = e, this._logger = new g("RedirectNavigator");
1708
+ }
1709
+ async prepare({
1710
+ redirectMethod: e = this._settings.redirectMethod,
1711
+ redirectTarget: t = this._settings.redirectTarget
1712
+ }) {
1713
+ var s;
1714
+ this._logger.create("prepare");
1715
+ let i = window.self;
1716
+ t === "top" && (i = (s = window.top) != null ? s : window.self);
1717
+ const r = i.location[e].bind(i.location);
1718
+ let o;
1719
+ return {
1720
+ navigate: async (n) => (this._logger.create("navigate"), await new Promise((c, l) => {
1721
+ o = l, window.addEventListener("pageshow", () => c(window.location.href)), r(n.url);
1722
+ })),
1723
+ close: () => {
1724
+ this._logger.create("close"), o == null || o(new Error("Redirect aborted")), i.stop();
1725
+ }
1726
+ };
1727
+ }
1728
+ async callback() {
1729
+ }
1730
+ }, et = class extends Ie {
1731
+ constructor(e) {
1732
+ super({ expiringNotificationTimeInSeconds: e.accessTokenExpiringNotificationTimeInSeconds }), this._logger = new g("UserManagerEvents"), this._userLoaded = new I("User loaded"), this._userUnloaded = new I("User unloaded"), this._silentRenewError = new I("Silent renew error"), this._userSignedIn = new I("User signed in"), this._userSignedOut = new I("User signed out"), this._userSessionChanged = new I("User session changed");
1733
+ }
1734
+ async load(e, t = !0) {
1735
+ await super.load(e), t && await this._userLoaded.raise(e);
1736
+ }
1737
+ async unload() {
1738
+ await super.unload(), await this._userUnloaded.raise();
1739
+ }
1740
+ /**
1741
+ * Add callback: Raised when a user session has been established (or re-established).
1742
+ */
1743
+ addUserLoaded(e) {
1744
+ return this._userLoaded.addHandler(e);
1745
+ }
1746
+ /**
1747
+ * Remove callback: Raised when a user session has been established (or re-established).
1748
+ */
1749
+ removeUserLoaded(e) {
1750
+ return this._userLoaded.removeHandler(e);
1751
+ }
1752
+ /**
1753
+ * Add callback: Raised when a user session has been terminated.
1754
+ */
1755
+ addUserUnloaded(e) {
1756
+ return this._userUnloaded.addHandler(e);
1757
+ }
1758
+ /**
1759
+ * Remove callback: Raised when a user session has been terminated.
1760
+ */
1761
+ removeUserUnloaded(e) {
1762
+ return this._userUnloaded.removeHandler(e);
1763
+ }
1764
+ /**
1765
+ * Add callback: Raised when the automatic silent renew has failed.
1766
+ */
1767
+ addSilentRenewError(e) {
1768
+ return this._silentRenewError.addHandler(e);
1769
+ }
1770
+ /**
1771
+ * Remove callback: Raised when the automatic silent renew has failed.
1772
+ */
1773
+ removeSilentRenewError(e) {
1774
+ return this._silentRenewError.removeHandler(e);
1775
+ }
1776
+ /**
1777
+ * @internal
1778
+ */
1779
+ async _raiseSilentRenewError(e) {
1780
+ await this._silentRenewError.raise(e);
1781
+ }
1782
+ /**
1783
+ * Add callback: Raised when the user is signed in (when `monitorSession` is set).
1784
+ * @see {@link UserManagerSettings.monitorSession}
1785
+ */
1786
+ addUserSignedIn(e) {
1787
+ return this._userSignedIn.addHandler(e);
1788
+ }
1789
+ /**
1790
+ * Remove callback: Raised when the user is signed in (when `monitorSession` is set).
1791
+ */
1792
+ removeUserSignedIn(e) {
1793
+ this._userSignedIn.removeHandler(e);
1794
+ }
1795
+ /**
1796
+ * @internal
1797
+ */
1798
+ async _raiseUserSignedIn() {
1799
+ await this._userSignedIn.raise();
1800
+ }
1801
+ /**
1802
+ * Add callback: Raised when the user's sign-in status at the OP has changed (when `monitorSession` is set).
1803
+ * @see {@link UserManagerSettings.monitorSession}
1804
+ */
1805
+ addUserSignedOut(e) {
1806
+ return this._userSignedOut.addHandler(e);
1807
+ }
1808
+ /**
1809
+ * Remove callback: Raised when the user's sign-in status at the OP has changed (when `monitorSession` is set).
1810
+ */
1811
+ removeUserSignedOut(e) {
1812
+ this._userSignedOut.removeHandler(e);
1813
+ }
1814
+ /**
1815
+ * @internal
1816
+ */
1817
+ async _raiseUserSignedOut() {
1818
+ await this._userSignedOut.raise();
1819
+ }
1820
+ /**
1821
+ * Add callback: Raised when the user session changed (when `monitorSession` is set).
1822
+ * @see {@link UserManagerSettings.monitorSession}
1823
+ */
1824
+ addUserSessionChanged(e) {
1825
+ return this._userSessionChanged.addHandler(e);
1826
+ }
1827
+ /**
1828
+ * Remove callback: Raised when the user session changed (when `monitorSession` is set).
1829
+ */
1830
+ removeUserSessionChanged(e) {
1831
+ this._userSessionChanged.removeHandler(e);
1832
+ }
1833
+ /**
1834
+ * @internal
1835
+ */
1836
+ async _raiseUserSessionChanged() {
1837
+ await this._userSessionChanged.raise();
1838
+ }
1839
+ }, tt = class {
1840
+ constructor(e) {
1841
+ this._userManager = e, this._logger = new g("SilentRenewService"), this._isStarted = !1, this._retryTimer = new T("Retry Silent Renew"), this._tokenExpiring = async () => {
1842
+ const t = this._logger.create("_tokenExpiring");
1843
+ try {
1844
+ await this._userManager.signinSilent(), t.debug("silent token renewal successful");
1845
+ } catch (s) {
1846
+ if (s instanceof G) {
1847
+ t.warn("ErrorTimeout from signinSilent:", s, "retry in 5s"), this._retryTimer.init(5);
1848
+ return;
376
1849
  }
377
- return i;
378
- } else
379
- f(1, t);
380
- }, this.produceWithPatches = (t, r) => {
381
- if (typeof t == "function")
382
- return (s, ...c) => this.produceWithPatches(s, (l) => t(l, ...c));
383
- let n, i;
384
- return [this.produce(t, r, (s, c) => {
385
- n = s, i = c;
386
- }), n, i];
387
- }, typeof (e == null ? void 0 : e.autoFreeze) == "boolean" && this.setAutoFreeze(e.autoFreeze), typeof (e == null ? void 0 : e.useStrictShallowCopy) == "boolean" && this.setUseStrictShallowCopy(e.useStrictShallowCopy);
388
- }
389
- createDraft(e) {
390
- _(e) || f(8), h(e) && (e = oe(e));
391
- const t = j(this), r = k(e, void 0);
392
- return r[u].isManual_ = !0, C(t), r;
393
- }
394
- finishDraft(e, t) {
395
- const r = e && e[u];
396
- (!r || !r.isManual_) && f(9);
397
- const { scope_: n } = r;
398
- return x(n, t), $(void 0, n);
399
- }
400
- /**
401
- * Pass true to automatically freeze all copies created by Immer.
1850
+ t.error("Error from signinSilent:", s), await this._userManager.events._raiseSilentRenewError(s);
1851
+ }
1852
+ };
1853
+ }
1854
+ async start() {
1855
+ const e = this._logger.create("start");
1856
+ if (!this._isStarted) {
1857
+ this._isStarted = !0, this._userManager.events.addAccessTokenExpiring(this._tokenExpiring), this._retryTimer.addHandler(this._tokenExpiring);
1858
+ try {
1859
+ await this._userManager.getUser();
1860
+ } catch (t) {
1861
+ e.error("getUser error", t);
1862
+ }
1863
+ }
1864
+ }
1865
+ stop() {
1866
+ this._isStarted && (this._retryTimer.cancel(), this._retryTimer.removeHandler(this._tokenExpiring), this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring), this._isStarted = !1);
1867
+ }
1868
+ }, st = class {
1869
+ constructor(e) {
1870
+ this.refresh_token = e.refresh_token, this.id_token = e.id_token, this.session_state = e.session_state, this.scope = e.scope, this.profile = e.profile, this.data = e.state;
1871
+ }
1872
+ }, rt = class {
1873
+ constructor(e, t, s, i) {
1874
+ this._logger = new g("UserManager"), this.settings = new Ve(e), this._client = new Le(e), this._redirectNavigator = t ?? new Ze(this.settings), this._popupNavigator = s ?? new Ye(this.settings), this._iframeNavigator = i ?? new Ge(this.settings), this._events = new et(this.settings), this._silentRenewService = new tt(this), this.settings.automaticSilentRenew && this.startSilentRenew(), this._sessionMonitor = null, this.settings.monitorSession && (this._sessionMonitor = new Fe(this));
1875
+ }
1876
+ /**
1877
+ * Get object used to register for events raised by the `UserManager`.
1878
+ */
1879
+ get events() {
1880
+ return this._events;
1881
+ }
1882
+ /**
1883
+ * Get object used to access the metadata configuration of the identity provider.
1884
+ */
1885
+ get metadataService() {
1886
+ return this._client.metadataService;
1887
+ }
1888
+ /**
1889
+ * Load the `User` object for the currently authenticated user.
402
1890
  *
403
- * By default, auto-freezing is enabled.
1891
+ * @param raiseEvent - If `true`, the `UserLoaded` event will be raised. Defaults to false.
1892
+ * @returns A promise
404
1893
  */
405
- setAutoFreeze(e) {
406
- this.autoFreeze_ = e;
1894
+ async getUser(e = !1) {
1895
+ const t = this._logger.create("getUser"), s = await this._loadUser();
1896
+ return s ? (t.info("user loaded"), await this._events.load(s, e), s) : (t.info("user not found in storage"), null);
407
1897
  }
408
1898
  /**
409
- * Pass true to enable strict shallow copy.
1899
+ * Remove from any storage the currently authenticated user.
410
1900
  *
411
- * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
1901
+ * @returns A promise
412
1902
  */
413
- setUseStrictShallowCopy(e) {
414
- this.useStrictShallowCopy_ = e;
1903
+ async removeUser() {
1904
+ const e = this._logger.create("removeUser");
1905
+ await this.storeUser(null), e.info("user removed from storage"), await this._events.unload();
415
1906
  }
416
- applyPatches(e, t) {
1907
+ /**
1908
+ * Trigger a redirect of the current window to the authorization endpoint.
1909
+ *
1910
+ * @returns A promise
1911
+ *
1912
+ * @throws `Error` In cases of wrong authentication.
1913
+ */
1914
+ async signinRedirect(e = {}) {
1915
+ var t;
1916
+ this._logger.create("signinRedirect");
1917
+ const {
1918
+ redirectMethod: s,
1919
+ ...i
1920
+ } = e;
417
1921
  let r;
418
- for (r = t.length - 1; r >= 0; r--) {
419
- const i = t[r];
420
- if (i.path.length === 0 && i.op === "replace") {
421
- e = i.value;
1922
+ (t = this.settings.dpop) != null && t.bind_authorization_code && (r = await this.generateDPoPJkt(this.settings.dpop));
1923
+ const o = await this._redirectNavigator.prepare({ redirectMethod: s });
1924
+ await this._signinStart({
1925
+ request_type: "si:r",
1926
+ dpopJkt: r,
1927
+ ...i
1928
+ }, o);
1929
+ }
1930
+ /**
1931
+ * Process the response (callback) from the authorization endpoint.
1932
+ * It is recommended to use {@link UserManager.signinCallback} instead.
1933
+ *
1934
+ * @returns A promise containing the authenticated `User`.
1935
+ *
1936
+ * @see {@link UserManager.signinCallback}
1937
+ */
1938
+ async signinRedirectCallback(e = window.location.href) {
1939
+ const t = this._logger.create("signinRedirectCallback"), s = await this._signinEnd(e);
1940
+ return s.profile && s.profile.sub ? t.info("success, signed in subject", s.profile.sub) : t.info("no subject"), s;
1941
+ }
1942
+ /**
1943
+ * Trigger the signin with user/password.
1944
+ *
1945
+ * @returns A promise containing the authenticated `User`.
1946
+ * @throws {@link ErrorResponse} In cases of wrong authentication.
1947
+ */
1948
+ async signinResourceOwnerCredentials({
1949
+ username: e,
1950
+ password: t,
1951
+ skipUserInfo: s = !1
1952
+ }) {
1953
+ const i = this._logger.create("signinResourceOwnerCredential"), r = await this._client.processResourceOwnerPasswordCredentials({
1954
+ username: e,
1955
+ password: t,
1956
+ skipUserInfo: s,
1957
+ extraTokenParams: this.settings.extraTokenParams
1958
+ });
1959
+ i.debug("got signin response");
1960
+ const o = await this._buildUser(r);
1961
+ return o.profile && o.profile.sub ? i.info("success, signed in subject", o.profile.sub) : i.info("no subject"), o;
1962
+ }
1963
+ /**
1964
+ * Trigger a request (via a popup window) to the authorization endpoint.
1965
+ *
1966
+ * @returns A promise containing the authenticated `User`.
1967
+ * @throws `Error` In cases of wrong authentication.
1968
+ */
1969
+ async signinPopup(e = {}) {
1970
+ var t;
1971
+ const s = this._logger.create("signinPopup");
1972
+ let i;
1973
+ (t = this.settings.dpop) != null && t.bind_authorization_code && (i = await this.generateDPoPJkt(this.settings.dpop));
1974
+ const {
1975
+ popupWindowFeatures: r,
1976
+ popupWindowTarget: o,
1977
+ popupSignal: n,
1978
+ popupAbortOnClose: a,
1979
+ ...c
1980
+ } = e, l = this.settings.popup_redirect_uri;
1981
+ l || s.throw(new Error("No popup_redirect_uri configured"));
1982
+ const d = await this._popupNavigator.prepare({ popupWindowFeatures: r, popupWindowTarget: o, popupSignal: n, popupAbortOnClose: a }), h = await this._signin({
1983
+ request_type: "si:p",
1984
+ redirect_uri: l,
1985
+ display: "popup",
1986
+ dpopJkt: i,
1987
+ ...c
1988
+ }, d);
1989
+ return h && (h.profile && h.profile.sub ? s.info("success, signed in subject", h.profile.sub) : s.info("no subject")), h;
1990
+ }
1991
+ /**
1992
+ * Notify the opening window of response (callback) from the authorization endpoint.
1993
+ * It is recommended to use {@link UserManager.signinCallback} instead.
1994
+ *
1995
+ * @returns A promise
1996
+ *
1997
+ * @see {@link UserManager.signinCallback}
1998
+ */
1999
+ async signinPopupCallback(e = window.location.href, t = !1) {
2000
+ const s = this._logger.create("signinPopupCallback");
2001
+ await this._popupNavigator.callback(e, { keepOpen: t }), s.info("success");
2002
+ }
2003
+ /**
2004
+ * Trigger a silent request (via refresh token or an iframe) to the authorization endpoint.
2005
+ *
2006
+ * @returns A promise that contains the authenticated `User`.
2007
+ */
2008
+ async signinSilent(e = {}) {
2009
+ var t, s;
2010
+ const i = this._logger.create("signinSilent"), {
2011
+ silentRequestTimeoutInSeconds: r,
2012
+ ...o
2013
+ } = e;
2014
+ let n = await this._loadUser();
2015
+ if (!e.forceIframeAuth && (n != null && n.refresh_token)) {
2016
+ i.debug("using refresh token");
2017
+ const h = new st(n);
2018
+ return await this._useRefreshToken({
2019
+ state: h,
2020
+ redirect_uri: o.redirect_uri,
2021
+ resource: o.resource,
2022
+ extraTokenParams: o.extraTokenParams,
2023
+ timeoutInSeconds: r
2024
+ });
2025
+ }
2026
+ let a;
2027
+ (t = this.settings.dpop) != null && t.bind_authorization_code && (a = await this.generateDPoPJkt(this.settings.dpop));
2028
+ const c = this.settings.silent_redirect_uri;
2029
+ c || i.throw(new Error("No silent_redirect_uri configured"));
2030
+ let l;
2031
+ n && this.settings.validateSubOnSilentRenew && (i.debug("subject prior to silent renew:", n.profile.sub), l = n.profile.sub);
2032
+ const d = await this._iframeNavigator.prepare({ silentRequestTimeoutInSeconds: r });
2033
+ return n = await this._signin({
2034
+ request_type: "si:s",
2035
+ redirect_uri: c,
2036
+ prompt: "none",
2037
+ id_token_hint: this.settings.includeIdTokenInSilentRenew ? n == null ? void 0 : n.id_token : void 0,
2038
+ dpopJkt: a,
2039
+ ...o
2040
+ }, d, l), n && ((s = n.profile) != null && s.sub ? i.info("success, signed in subject", n.profile.sub) : i.info("no subject")), n;
2041
+ }
2042
+ async _useRefreshToken(e) {
2043
+ const t = await this._client.useRefreshToken({
2044
+ timeoutInSeconds: this.settings.silentRequestTimeoutInSeconds,
2045
+ ...e
2046
+ }), s = new W({ ...e.state, ...t });
2047
+ return await this.storeUser(s), await this._events.load(s), s;
2048
+ }
2049
+ /**
2050
+ *
2051
+ * Notify the parent window of response (callback) from the authorization endpoint.
2052
+ * It is recommended to use {@link UserManager.signinCallback} instead.
2053
+ *
2054
+ * @returns A promise
2055
+ *
2056
+ * @see {@link UserManager.signinCallback}
2057
+ */
2058
+ async signinSilentCallback(e = window.location.href) {
2059
+ const t = this._logger.create("signinSilentCallback");
2060
+ await this._iframeNavigator.callback(e), t.info("success");
2061
+ }
2062
+ /**
2063
+ * Process any response (callback) from the authorization endpoint, by dispatching the request_type
2064
+ * and executing one of the following functions:
2065
+ * - {@link UserManager.signinRedirectCallback}
2066
+ * - {@link UserManager.signinPopupCallback}
2067
+ * - {@link UserManager.signinSilentCallback}
2068
+ *
2069
+ * @throws `Error` If request_type is unknown or signin cannot be processed.
2070
+ */
2071
+ async signinCallback(e = window.location.href) {
2072
+ const { state: t } = await this._client.readSigninResponseState(e);
2073
+ switch (t.request_type) {
2074
+ case "si:r":
2075
+ return await this.signinRedirectCallback(e);
2076
+ case "si:p":
2077
+ await this.signinPopupCallback(e);
422
2078
  break;
2079
+ case "si:s":
2080
+ await this.signinSilentCallback(e);
2081
+ break;
2082
+ default:
2083
+ throw new Error("invalid response_type in state");
2084
+ }
2085
+ }
2086
+ /**
2087
+ * Process any response (callback) from the end session endpoint, by dispatching the request_type
2088
+ * and executing one of the following functions:
2089
+ * - {@link UserManager.signoutRedirectCallback}
2090
+ * - {@link UserManager.signoutPopupCallback}
2091
+ * - {@link UserManager.signoutSilentCallback}
2092
+ *
2093
+ * @throws `Error` If request_type is unknown or signout cannot be processed.
2094
+ */
2095
+ async signoutCallback(e = window.location.href, t = !1) {
2096
+ const { state: s } = await this._client.readSignoutResponseState(e);
2097
+ if (s)
2098
+ switch (s.request_type) {
2099
+ case "so:r":
2100
+ return await this.signoutRedirectCallback(e);
2101
+ case "so:p":
2102
+ await this.signoutPopupCallback(e, t);
2103
+ break;
2104
+ case "so:s":
2105
+ await this.signoutSilentCallback(e);
2106
+ break;
2107
+ default:
2108
+ throw new Error("invalid response_type in state");
423
2109
  }
2110
+ }
2111
+ /**
2112
+ * Query OP for user's current signin status.
2113
+ *
2114
+ * @returns A promise object with session_state and subject identifier.
2115
+ */
2116
+ async querySessionStatus(e = {}) {
2117
+ const t = this._logger.create("querySessionStatus"), {
2118
+ silentRequestTimeoutInSeconds: s,
2119
+ ...i
2120
+ } = e, r = this.settings.silent_redirect_uri;
2121
+ r || t.throw(new Error("No silent_redirect_uri configured"));
2122
+ const o = await this._loadUser(), n = await this._iframeNavigator.prepare({ silentRequestTimeoutInSeconds: s }), a = await this._signinStart({
2123
+ request_type: "si:s",
2124
+ // this acts like a signin silent
2125
+ redirect_uri: r,
2126
+ prompt: "none",
2127
+ id_token_hint: this.settings.includeIdTokenInSilentRenew ? o == null ? void 0 : o.id_token : void 0,
2128
+ response_type: this.settings.query_status_response_type,
2129
+ scope: "openid",
2130
+ skipUserInfo: !0,
2131
+ ...i
2132
+ }, n);
2133
+ try {
2134
+ const c = {}, l = await this._client.processSigninResponse(a.url, c);
2135
+ return t.debug("got signin response"), l.session_state && l.profile.sub ? (t.info("success for subject", l.profile.sub), {
2136
+ session_state: l.session_state,
2137
+ sub: l.profile.sub
2138
+ }) : (t.info("success, user not authenticated"), null);
2139
+ } catch (c) {
2140
+ if (this.settings.monitorAnonymousSession && c instanceof q)
2141
+ switch (c.error) {
2142
+ case "login_required":
2143
+ case "consent_required":
2144
+ case "interaction_required":
2145
+ case "account_selection_required":
2146
+ return t.info("success for anonymous user"), {
2147
+ session_state: c.session_state
2148
+ };
2149
+ }
2150
+ throw c;
424
2151
  }
425
- r > -1 && (t = t.slice(r + 1));
426
- const n = y("Patches").applyPatches_;
427
- return h(e) ? n(e, t) : this.produce(
428
- e,
429
- (i) => n(i, t)
430
- );
2152
+ }
2153
+ async _signin(e, t, s) {
2154
+ const i = await this._signinStart(e, t);
2155
+ return await this._signinEnd(i.url, s);
2156
+ }
2157
+ async _signinStart(e, t) {
2158
+ const s = this._logger.create("_signinStart");
2159
+ try {
2160
+ const i = await this._client.createSigninRequest(e);
2161
+ return s.debug("got signin request"), await t.navigate({
2162
+ url: i.url,
2163
+ state: i.state.id,
2164
+ response_mode: i.state.response_mode,
2165
+ scriptOrigin: this.settings.iframeScriptOrigin
2166
+ });
2167
+ } catch (i) {
2168
+ throw s.debug("error after preparing navigator, closing navigator window"), t.close(), i;
2169
+ }
2170
+ }
2171
+ async _signinEnd(e, t) {
2172
+ const s = this._logger.create("_signinEnd"), i = {}, r = await this._client.processSigninResponse(e, i);
2173
+ return s.debug("got signin response"), await this._buildUser(r, t);
2174
+ }
2175
+ async _buildUser(e, t) {
2176
+ const s = this._logger.create("_buildUser"), i = new W(e);
2177
+ if (t) {
2178
+ if (t !== i.profile.sub)
2179
+ throw s.debug("current user does not match user returned from signin. sub from signin:", i.profile.sub), new q({ ...e, error: "login_required" });
2180
+ s.debug("current user matches user returned from signin");
2181
+ }
2182
+ return await this.storeUser(i), s.debug("user stored"), await this._events.load(i), i;
2183
+ }
2184
+ /**
2185
+ * Trigger a redirect of the current window to the end session endpoint.
2186
+ *
2187
+ * @returns A promise
2188
+ */
2189
+ async signoutRedirect(e = {}) {
2190
+ const t = this._logger.create("signoutRedirect"), {
2191
+ redirectMethod: s,
2192
+ ...i
2193
+ } = e, r = await this._redirectNavigator.prepare({ redirectMethod: s });
2194
+ await this._signoutStart({
2195
+ request_type: "so:r",
2196
+ post_logout_redirect_uri: this.settings.post_logout_redirect_uri,
2197
+ ...i
2198
+ }, r), t.info("success");
2199
+ }
2200
+ /**
2201
+ * Process response (callback) from the end session endpoint.
2202
+ * It is recommended to use {@link UserManager.signoutCallback} instead.
2203
+ *
2204
+ * @returns A promise containing signout response
2205
+ *
2206
+ * @see {@link UserManager.signoutCallback}
2207
+ */
2208
+ async signoutRedirectCallback(e = window.location.href) {
2209
+ const t = this._logger.create("signoutRedirectCallback"), s = await this._signoutEnd(e);
2210
+ return t.info("success"), s;
2211
+ }
2212
+ /**
2213
+ * Trigger a redirect of a popup window to the end session endpoint.
2214
+ *
2215
+ * @returns A promise
2216
+ */
2217
+ async signoutPopup(e = {}) {
2218
+ const t = this._logger.create("signoutPopup"), {
2219
+ popupWindowFeatures: s,
2220
+ popupWindowTarget: i,
2221
+ popupSignal: r,
2222
+ ...o
2223
+ } = e, n = this.settings.popup_post_logout_redirect_uri, a = await this._popupNavigator.prepare({ popupWindowFeatures: s, popupWindowTarget: i, popupSignal: r });
2224
+ await this._signout({
2225
+ request_type: "so:p",
2226
+ post_logout_redirect_uri: n,
2227
+ // we're putting a dummy entry in here because we
2228
+ // need a unique id from the state for notification
2229
+ // to the parent window, which is necessary if we
2230
+ // plan to return back to the client after signout
2231
+ // and so we can close the popup after signout
2232
+ state: n == null ? void 0 : {},
2233
+ ...o
2234
+ }, a), t.info("success");
2235
+ }
2236
+ /**
2237
+ * Process response (callback) from the end session endpoint from a popup window.
2238
+ * It is recommended to use {@link UserManager.signoutCallback} instead.
2239
+ *
2240
+ * @returns A promise
2241
+ *
2242
+ * @see {@link UserManager.signoutCallback}
2243
+ */
2244
+ async signoutPopupCallback(e = window.location.href, t = !1) {
2245
+ const s = this._logger.create("signoutPopupCallback");
2246
+ await this._popupNavigator.callback(e, { keepOpen: t }), s.info("success");
2247
+ }
2248
+ async _signout(e, t) {
2249
+ const s = await this._signoutStart(e, t);
2250
+ return await this._signoutEnd(s.url);
2251
+ }
2252
+ async _signoutStart(e = {}, t) {
2253
+ var s;
2254
+ const i = this._logger.create("_signoutStart");
2255
+ try {
2256
+ const r = await this._loadUser();
2257
+ i.debug("loaded current user from storage"), this.settings.revokeTokensOnSignout && await this._revokeInternal(r);
2258
+ const o = e.id_token_hint || r && r.id_token;
2259
+ o && (i.debug("setting id_token_hint in signout request"), e.id_token_hint = o), await this.removeUser(), i.debug("user removed, creating signout request");
2260
+ const n = await this._client.createSignoutRequest(e);
2261
+ return i.debug("got signout request"), await t.navigate({
2262
+ url: n.url,
2263
+ state: (s = n.state) == null ? void 0 : s.id,
2264
+ scriptOrigin: this.settings.iframeScriptOrigin
2265
+ });
2266
+ } catch (r) {
2267
+ throw i.debug("error after preparing navigator, closing navigator window"), t.close(), r;
2268
+ }
2269
+ }
2270
+ async _signoutEnd(e) {
2271
+ const t = this._logger.create("_signoutEnd"), s = await this._client.processSignoutResponse(e);
2272
+ return t.debug("got signout response"), s;
2273
+ }
2274
+ /**
2275
+ * Trigger a silent request (via an iframe) to the end session endpoint.
2276
+ *
2277
+ * @returns A promise
2278
+ */
2279
+ async signoutSilent(e = {}) {
2280
+ var t;
2281
+ const s = this._logger.create("signoutSilent"), {
2282
+ silentRequestTimeoutInSeconds: i,
2283
+ ...r
2284
+ } = e, o = this.settings.includeIdTokenInSilentSignout ? (t = await this._loadUser()) == null ? void 0 : t.id_token : void 0, n = this.settings.popup_post_logout_redirect_uri, a = await this._iframeNavigator.prepare({ silentRequestTimeoutInSeconds: i });
2285
+ await this._signout({
2286
+ request_type: "so:s",
2287
+ post_logout_redirect_uri: n,
2288
+ id_token_hint: o,
2289
+ ...r
2290
+ }, a), s.info("success");
2291
+ }
2292
+ /**
2293
+ * Notify the parent window of response (callback) from the end session endpoint.
2294
+ * It is recommended to use {@link UserManager.signoutCallback} instead.
2295
+ *
2296
+ * @returns A promise
2297
+ *
2298
+ * @see {@link UserManager.signoutCallback}
2299
+ */
2300
+ async signoutSilentCallback(e = window.location.href) {
2301
+ const t = this._logger.create("signoutSilentCallback");
2302
+ await this._iframeNavigator.callback(e), t.info("success");
2303
+ }
2304
+ async revokeTokens(e) {
2305
+ const t = await this._loadUser();
2306
+ await this._revokeInternal(t, e);
2307
+ }
2308
+ async _revokeInternal(e, t = this.settings.revokeTokenTypes) {
2309
+ const s = this._logger.create("_revokeInternal");
2310
+ if (!e) return;
2311
+ const i = t.filter((r) => typeof e[r] == "string");
2312
+ if (!i.length) {
2313
+ s.debug("no need to revoke due to no token(s)");
2314
+ return;
2315
+ }
2316
+ for (const r of i)
2317
+ await this._client.revokeToken(
2318
+ e[r],
2319
+ r
2320
+ ), s.info(`${r} revoked successfully`), r !== "access_token" && (e[r] = null);
2321
+ await this.storeUser(e), s.debug("user stored"), await this._events.load(e);
2322
+ }
2323
+ /**
2324
+ * Enables silent renew for the `UserManager`.
2325
+ */
2326
+ startSilentRenew() {
2327
+ this._logger.create("startSilentRenew"), this._silentRenewService.start();
2328
+ }
2329
+ /**
2330
+ * Disables silent renew for the `UserManager`.
2331
+ */
2332
+ stopSilentRenew() {
2333
+ this._silentRenewService.stop();
2334
+ }
2335
+ get _userStoreKey() {
2336
+ return `user:${this.settings.authority}:${this.settings.client_id}`;
2337
+ }
2338
+ async _loadUser() {
2339
+ const e = this._logger.create("_loadUser"), t = await this.settings.userStore.get(this._userStoreKey);
2340
+ return t ? (e.debug("user storageString loaded"), W.fromStorageString(t)) : (e.debug("no user storageString"), null);
2341
+ }
2342
+ async storeUser(e) {
2343
+ const t = this._logger.create("storeUser");
2344
+ if (e) {
2345
+ t.debug("storing user");
2346
+ const s = e.toStorageString();
2347
+ await this.settings.userStore.set(this._userStoreKey, s);
2348
+ } else
2349
+ this._logger.debug("removing user"), await this.settings.userStore.remove(this._userStoreKey), this.settings.dpop && await this.settings.dpop.store.remove(this.settings.client_id);
2350
+ }
2351
+ /**
2352
+ * Removes stale state entries in storage for incomplete authorize requests.
2353
+ */
2354
+ async clearStaleState() {
2355
+ await this._client.clearStaleState();
2356
+ }
2357
+ /**
2358
+ * Dynamically generates a DPoP proof for a given user, URL and optional Http method.
2359
+ * This method is useful when you need to make a request to a resource server
2360
+ * with fetch or similar, and you need to include a DPoP proof in a DPoP header.
2361
+ * @param url - The URL to generate the DPoP proof for
2362
+ * @param user - The user to generate the DPoP proof for
2363
+ * @param httpMethod - Optional, defaults to "GET"
2364
+ * @param nonce - Optional nonce provided by the resource server
2365
+ *
2366
+ * @returns A promise containing the DPoP proof or undefined if DPoP is not enabled/no user is found.
2367
+ */
2368
+ async dpopProof(e, t, s, i) {
2369
+ var r, o;
2370
+ const n = await ((o = (r = this.settings.dpop) == null ? void 0 : r.store) == null ? void 0 : o.get(this.settings.client_id));
2371
+ if (n)
2372
+ return await _.generateDPoPProof({
2373
+ url: e,
2374
+ accessToken: t == null ? void 0 : t.access_token,
2375
+ httpMethod: s,
2376
+ keyPair: n.keys,
2377
+ nonce: i
2378
+ });
2379
+ }
2380
+ async generateDPoPJkt(e) {
2381
+ let t = await e.store.get(this.settings.client_id);
2382
+ if (!t) {
2383
+ const s = await _.generateDPoPKeys();
2384
+ t = new de(s), await e.store.set(this.settings.client_id, t);
2385
+ }
2386
+ return await _.generateDPoPJkt(t.keys);
431
2387
  }
432
2388
  };
433
- function k(e, t) {
434
- const r = O(e) ? y("MapSet").proxyMap_(e, t) : D(e) ? y("MapSet").proxySet_(e, t) : re(e, t);
435
- return (t ? t.scope_ : G()).drafts_.push(r), r;
436
- }
437
- function oe(e) {
438
- return h(e) || f(10, e), X(e);
439
- }
440
- function X(e) {
441
- if (!_(e) || S(e))
442
- return e;
443
- const t = e[u];
444
- let r;
445
- if (t) {
446
- if (!t.modified_)
447
- return t.base_;
448
- t.finalized_ = !0, r = N(e, t.scope_.immer_.useStrictShallowCopy_);
449
- } else
450
- r = N(e, !0);
451
- return b(r, (n, i) => {
452
- B(r, n, X(i));
453
- }), t && (t.finalized_ = !1), r;
454
- }
455
- var a = new ie(), se = a.produce;
456
- a.produceWithPatches.bind(
457
- a
458
- );
459
- a.setAutoFreeze.bind(a);
460
- a.setUseStrictShallowCopy.bind(a);
461
- a.applyPatches.bind(a);
462
- a.createDraft.bind(a);
463
- a.finishDraft.bind(a);
464
2389
  export {
465
- ie as Immer,
466
- oe as current,
467
- T as freeze,
468
- R as immerable,
469
- h as isDraft,
470
- _ as isDraftable,
471
- W as nothing,
472
- se as produce
2390
+ Ie as AccessTokenEvents,
2391
+ Ce as CheckSessionIFrame,
2392
+ de as DPoPState,
2393
+ q as ErrorResponse,
2394
+ G as ErrorTimeout,
2395
+ re as InMemoryWebStorage,
2396
+ D as Log,
2397
+ g as Logger,
2398
+ xe as MetadataService,
2399
+ Le as OidcClient,
2400
+ z as OidcClientSettingsStore,
2401
+ Fe as SessionMonitor,
2402
+ J as SigninResponse,
2403
+ ae as SigninState,
2404
+ $e as SignoutResponse,
2405
+ $ as State,
2406
+ W as User,
2407
+ rt as UserManager,
2408
+ Ve as UserManagerSettingsStore,
2409
+ ne as WebStorageStateStore
473
2410
  };