mada-design-system 0.2.2 → 0.2.3

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