mada-design-system 0.2.8 → 0.3.0

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