@mhmo91/schmancy 0.9.13 → 0.9.15

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 (479) hide show
  1. package/custom-elements.json +194 -0
  2. package/dist/agent/schmancy.agent.js +107 -1
  3. package/dist/agent/schmancy.agent.js.map +1 -1
  4. package/dist/agent/schmancy.manifest.json +148 -0
  5. package/dist/{animation-Bcwh107v.cjs.map → animation-CQRdLgzX.cjs.map} +1 -1
  6. package/dist/{animation-CXKSuUoE.js.map → animation-hXFClrIn.js.map} +1 -1
  7. package/dist/{area-CApZWjqs.cjs → area-DBjAhgjP.cjs} +2 -2
  8. package/dist/area-DBjAhgjP.cjs.map +1 -0
  9. package/dist/{area-D_p1YBgP.js → area-Dr4I9R2p.js} +23 -35
  10. package/dist/area-Dr4I9R2p.js.map +1 -0
  11. package/dist/area.cjs +1 -1
  12. package/dist/area.js +3 -2
  13. package/dist/{audio-DUVz7Ars.cjs → audio-Dvr-RBzE.cjs} +1 -1
  14. package/dist/{audio-DUVz7Ars.cjs.map → audio-Dvr-RBzE.cjs.map} +1 -1
  15. package/dist/{audio-C7TzWI8M.js → audio-ql6nvY0y.js} +1 -1
  16. package/dist/{audio-C7TzWI8M.js.map → audio-ql6nvY0y.js.map} +1 -1
  17. package/dist/audio.cjs +1 -1
  18. package/dist/audio.js +2 -2
  19. package/dist/{autocomplete-DAK35swc.js → autocomplete-CgWUCUU-.js} +3 -3
  20. package/dist/{autocomplete-DAK35swc.js.map → autocomplete-CgWUCUU-.js.map} +1 -1
  21. package/dist/{autocomplete-DlCqS1gW.cjs → autocomplete-EM0jE7X2.cjs} +1 -1
  22. package/dist/{autocomplete-DlCqS1gW.cjs.map → autocomplete-EM0jE7X2.cjs.map} +1 -1
  23. package/dist/autocomplete.cjs +1 -1
  24. package/dist/autocomplete.js +1 -1
  25. package/dist/badge.cjs +1 -1
  26. package/dist/badge.js +1 -1
  27. package/dist/{boat-C57YTPbb.cjs → boat-BjYJI1HS.cjs} +1 -1
  28. package/dist/{boat-C57YTPbb.cjs.map → boat-BjYJI1HS.cjs.map} +1 -1
  29. package/dist/{boat-Dms45k4o.js → boat-Dw8TmOzN.js} +4 -4
  30. package/dist/{boat-Dms45k4o.js.map → boat-Dw8TmOzN.js.map} +1 -1
  31. package/dist/boat.cjs +1 -1
  32. package/dist/boat.js +1 -1
  33. package/dist/breadcrumb.cjs +1 -1
  34. package/dist/breadcrumb.js +1 -1
  35. package/dist/{busy-BfN1p1n8.cjs → busy-BmiumJpB.cjs} +1 -1
  36. package/dist/{busy-BfN1p1n8.cjs.map → busy-BmiumJpB.cjs.map} +1 -1
  37. package/dist/{busy-IKS9obYj.js → busy-D2hP3fOy.js} +1 -1
  38. package/dist/{busy-IKS9obYj.js.map → busy-D2hP3fOy.js.map} +1 -1
  39. package/dist/busy.cjs +1 -1
  40. package/dist/busy.js +1 -1
  41. package/dist/button.cjs +1 -1
  42. package/dist/button.js +4 -4
  43. package/dist/{card-ZObyqkFF.cjs → card-BslSqOsf.cjs} +1 -1
  44. package/dist/{card-ZObyqkFF.cjs.map → card-BslSqOsf.cjs.map} +1 -1
  45. package/dist/{card-DQNBal9V.js → card-CEdgK9nb.js} +2 -2
  46. package/dist/{card-DQNBal9V.js.map → card-CEdgK9nb.js.map} +1 -1
  47. package/dist/card.cjs +1 -1
  48. package/dist/card.js +1 -1
  49. package/dist/charts.cjs +1 -1
  50. package/dist/charts.js +1 -1
  51. package/dist/{checkbox-COhTJ1x5.js → checkbox-Br84TiCs.js} +2 -2
  52. package/dist/{checkbox-COhTJ1x5.js.map → checkbox-Br84TiCs.js.map} +1 -1
  53. package/dist/{checkbox-CiAtIrqB.cjs → checkbox-DtcFMgZL.cjs} +1 -1
  54. package/dist/{checkbox-CiAtIrqB.cjs.map → checkbox-DtcFMgZL.cjs.map} +1 -1
  55. package/dist/checkbox.cjs +1 -1
  56. package/dist/checkbox.js +1 -1
  57. package/dist/{chips-B5o3vNQF.js → chips-BNYOweGm.js} +5 -5
  58. package/dist/{chips-B5o3vNQF.js.map → chips-BNYOweGm.js.map} +1 -1
  59. package/dist/{chips-D2xmsC36.cjs → chips-DoCu5YQb.cjs} +1 -1
  60. package/dist/{chips-D2xmsC36.cjs.map → chips-DoCu5YQb.cjs.map} +1 -1
  61. package/dist/chips.cjs +1 -1
  62. package/dist/chips.js +2 -2
  63. package/dist/{chunk-C_1VqBVD.js → chunk-BM5alsTp.js} +9 -2
  64. package/dist/chunk-CncqDLb2.cjs +1 -0
  65. package/dist/{code-highlight-SkMMTkIJ.js → code-highlight-BgExKEto.js} +1 -1
  66. package/dist/{code-highlight-SkMMTkIJ.js.map → code-highlight-BgExKEto.js.map} +1 -1
  67. package/dist/{code-highlight-BToHh8T6.cjs → code-highlight-zSYcSfCz.cjs} +1 -1
  68. package/dist/{code-highlight-BToHh8T6.cjs.map → code-highlight-zSYcSfCz.cjs.map} +1 -1
  69. package/dist/code-highlight.cjs +1 -1
  70. package/dist/code-highlight.js +1 -1
  71. package/dist/{components-Ca7OTgbQ.js → components-DjKNS9R_.js} +1 -1
  72. package/dist/{components-Ca7OTgbQ.js.map → components-DjKNS9R_.js.map} +1 -1
  73. package/dist/{components-B-XYvUWn.cjs → components-TJT8-tva.cjs} +1 -1
  74. package/dist/{components-B-XYvUWn.cjs.map → components-TJT8-tva.cjs.map} +1 -1
  75. package/dist/components.cjs +1 -1
  76. package/dist/components.js +1 -1
  77. package/dist/connectivity.cjs +1 -1
  78. package/dist/connectivity.js +2 -2
  79. package/dist/content-drawer.cjs +1 -1
  80. package/dist/content-drawer.js +1 -1
  81. package/dist/context-CAYQh-mx.cjs +1 -0
  82. package/dist/{context-C6GwmNJJ.cjs.map → context-CAYQh-mx.cjs.map} +1 -1
  83. package/dist/context-D8Q66KPe.js +3 -0
  84. package/dist/{context-oBTPHrbc.js.map → context-D8Q66KPe.js.map} +1 -1
  85. package/dist/{cursor-glow-C2YRrB8Z.js → cursor-glow-BydlDInj.js} +1 -1
  86. package/dist/{cursor-glow-C2YRrB8Z.js.map → cursor-glow-BydlDInj.js.map} +1 -1
  87. package/dist/{cursor-glow-82y5h3E4.cjs → cursor-glow-Duw9jHmh.cjs} +1 -1
  88. package/dist/{cursor-glow-82y5h3E4.cjs.map → cursor-glow-Duw9jHmh.cjs.map} +1 -1
  89. package/dist/{date-range-BTA9nKbw.cjs → date-range-CIWYm3eS.cjs} +1 -1
  90. package/dist/{date-range-BTA9nKbw.cjs.map → date-range-CIWYm3eS.cjs.map} +1 -1
  91. package/dist/{date-range-inline-LLC3Y0mi.cjs → date-range-inline-B9Dp2z6C.cjs} +1 -1
  92. package/dist/{date-range-inline-LLC3Y0mi.cjs.map → date-range-inline-B9Dp2z6C.cjs.map} +1 -1
  93. package/dist/{date-range-inline-B_g1YXu3.js.map → date-range-inline-CpKG6qt2.js.map} +1 -1
  94. package/dist/date-range-inline.cjs +1 -1
  95. package/dist/date-range-inline.js +1 -1
  96. package/dist/{date-range-DUWpF0Qw.js → date-range-sGkC0KF3.js} +4 -4
  97. package/dist/{date-range-DUWpF0Qw.js.map → date-range-sGkC0KF3.js.map} +1 -1
  98. package/dist/date-range.cjs +1 -1
  99. package/dist/date-range.js +1 -1
  100. package/dist/{delay-Co89XWry.cjs → delay-Bu4WMQlV.cjs} +1 -1
  101. package/dist/{delay-Co89XWry.cjs.map → delay-Bu4WMQlV.cjs.map} +1 -1
  102. package/dist/{delay-CtDrlf1Q.js → delay-DwX65fSc.js} +4 -4
  103. package/dist/{delay-CtDrlf1Q.js.map → delay-DwX65fSc.js.map} +1 -1
  104. package/dist/delay.cjs +1 -1
  105. package/dist/delay.js +1 -1
  106. package/dist/{details-CyXyVdb2.cjs → details-B8p62xmR.cjs} +1 -1
  107. package/dist/{details-CyXyVdb2.cjs.map → details-B8p62xmR.cjs.map} +1 -1
  108. package/dist/{details-B1Ax7WiP.js → details-CCW52lzz.js} +5 -5
  109. package/dist/{details-B1Ax7WiP.js.map → details-CCW52lzz.js.map} +1 -1
  110. package/dist/details.cjs +1 -1
  111. package/dist/details.js +1 -1
  112. package/dist/{dialog-service-DXLGSshF.cjs → dialog-service-CzDO08Gy.cjs} +1 -1
  113. package/dist/{dialog-service-DXLGSshF.cjs.map → dialog-service-CzDO08Gy.cjs.map} +1 -1
  114. package/dist/{dialog-service-CCFGpU7a.js → dialog-service-DH-tjPuE.js} +2 -2
  115. package/dist/{dialog-service-CCFGpU7a.js.map → dialog-service-DH-tjPuE.js.map} +1 -1
  116. package/dist/dialog.cjs +1 -1
  117. package/dist/dialog.js +5 -5
  118. package/dist/directives.cjs +1 -1
  119. package/dist/directives.js +5 -5
  120. package/dist/discovery.cjs +1 -1
  121. package/dist/{divider-DuwCrKQu.js → divider-CbEWg3G_.js} +1 -1
  122. package/dist/{divider-DuwCrKQu.js.map → divider-CbEWg3G_.js.map} +1 -1
  123. package/dist/{divider-xcvHqVBc.cjs → divider-JyyFw_3J.cjs} +1 -1
  124. package/dist/{divider-xcvHqVBc.cjs.map → divider-JyyFw_3J.cjs.map} +1 -1
  125. package/dist/divider.cjs +1 -1
  126. package/dist/divider.js +1 -1
  127. package/dist/dropdown.cjs +1 -1
  128. package/dist/dropdown.js +2 -2
  129. package/dist/{expand-DUgOh1af.cjs → expand-BmwIPNjq.cjs} +1 -1
  130. package/dist/{expand-DUgOh1af.cjs.map → expand-BmwIPNjq.cjs.map} +1 -1
  131. package/dist/{expand-X0C1W279.js → expand-bFa_qVDT.js} +4 -4
  132. package/dist/{expand-X0C1W279.js.map → expand-bFa_qVDT.js.map} +1 -1
  133. package/dist/expand.cjs +1 -1
  134. package/dist/expand.js +1 -1
  135. package/dist/{extra-BqfYIC_q.cjs → extra-BUgyMgjl.cjs} +1 -1
  136. package/dist/{extra-BqfYIC_q.cjs.map → extra-BUgyMgjl.cjs.map} +1 -1
  137. package/dist/{extra-BTyq-5Z6.js → extra-HwbaUnCD.js} +1 -1
  138. package/dist/{extra-BTyq-5Z6.js.map → extra-HwbaUnCD.js.map} +1 -1
  139. package/dist/extra.cjs +1 -1
  140. package/dist/extra.js +1 -1
  141. package/dist/float-BQwhfibw.cjs +1 -0
  142. package/dist/{float-yZoLnUg0.cjs.map → float-BQwhfibw.cjs.map} +1 -1
  143. package/dist/{float-BgGeLER6.js → float-D5ezUurt.js} +1 -1
  144. package/dist/{float-BgGeLER6.js.map → float-D5ezUurt.js.map} +1 -1
  145. package/dist/float.cjs +1 -1
  146. package/dist/float.js +1 -1
  147. package/dist/{flow-BPDtbhLe.js.map → flow-BGkHnOnd.js.map} +1 -1
  148. package/dist/{flow-Dn9AZktE.cjs.map → flow-ClAJ6Qby.cjs.map} +1 -1
  149. package/dist/{form-C1qS9uvS.js.map → form-rCZqoAoK.js.map} +1 -1
  150. package/dist/{form-CzD0JLxM.cjs → form-wI58M85H.cjs} +1 -1
  151. package/dist/{form-CzD0JLxM.cjs.map → form-wI58M85H.cjs.map} +1 -1
  152. package/dist/form.cjs +1 -1
  153. package/dist/form.js +1 -1
  154. package/dist/handover/agent-runtime-followups.md +247 -0
  155. package/dist/handover/agent-runtime-v1.md +109 -0
  156. package/dist/{hashContent-BUqULUiZ.js.map → hashContent-B2IntJQf.js.map} +1 -1
  157. package/dist/{hashContent-CI39BY-_.cjs.map → hashContent-CahnEuut.cjs.map} +1 -1
  158. package/dist/{icons-BLFEJFDG.cjs → icons-B6V3nZ4-.cjs} +1 -1
  159. package/dist/{icons-BLFEJFDG.cjs.map → icons-B6V3nZ4-.cjs.map} +1 -1
  160. package/dist/{icons-BDcb8dNb.js → icons-C5-DIjet.js} +2 -2
  161. package/dist/{icons-BDcb8dNb.js.map → icons-C5-DIjet.js.map} +1 -1
  162. package/dist/icons.cjs +1 -1
  163. package/dist/icons.js +1 -1
  164. package/dist/{iframe-qCW0HzwB.js → iframe-BXBsuLwt.js} +1 -1
  165. package/dist/{iframe-qCW0HzwB.js.map → iframe-BXBsuLwt.js.map} +1 -1
  166. package/dist/{iframe-CrDpQkhj.cjs → iframe-C7sHg7RC.cjs} +1 -1
  167. package/dist/{iframe-CrDpQkhj.cjs.map → iframe-C7sHg7RC.cjs.map} +1 -1
  168. package/dist/iframe.cjs +1 -1
  169. package/dist/iframe.js +1 -1
  170. package/dist/index.cjs +1 -1
  171. package/dist/index.js +53 -52
  172. package/dist/{input-C1MIZaKq.cjs → input-BGNZlfL8.cjs} +1 -1
  173. package/dist/{input-C1MIZaKq.cjs.map → input-BGNZlfL8.cjs.map} +1 -1
  174. package/dist/{input-Dv-HtkM9.js.map → input-Bc3bVISm.js.map} +1 -1
  175. package/dist/{input-chip-CyvjhQSw.js → input-chip-CiG61y-N.js} +1 -1
  176. package/dist/{input-chip-CyvjhQSw.js.map → input-chip-CiG61y-N.js.map} +1 -1
  177. package/dist/{input-chip-DnfthOSY.cjs → input-chip-p24lkYtY.cjs} +1 -1
  178. package/dist/{input-chip-DnfthOSY.cjs.map → input-chip-p24lkYtY.cjs.map} +1 -1
  179. package/dist/input.cjs +1 -1
  180. package/dist/input.js +1 -1
  181. package/dist/{intersection-C0JuW_7U.js.map → intersection-BrXp4YTO.js.map} +1 -1
  182. package/dist/{intersection-MvbRovUz.cjs → intersection-DqBqnpgh.cjs} +1 -1
  183. package/dist/{intersection-MvbRovUz.cjs.map → intersection-DqBqnpgh.cjs.map} +1 -1
  184. package/dist/json.cjs +1 -1
  185. package/dist/json.js +2 -2
  186. package/dist/kbd.cjs +1 -1
  187. package/dist/kbd.js +1 -1
  188. package/dist/{layout-D0cR3hT1.cjs → layout-B0_IXfov.cjs} +1 -1
  189. package/dist/{layout-D0cR3hT1.cjs.map → layout-B0_IXfov.cjs.map} +1 -1
  190. package/dist/{layout-PZCF3kwl.cjs → layout-CTfRXQoz.cjs} +1 -1
  191. package/dist/{layout-PZCF3kwl.cjs.map → layout-CTfRXQoz.cjs.map} +1 -1
  192. package/dist/{layout-Y5qo3er8.js → layout-Cqghi_rx.js} +2 -2
  193. package/dist/{layout-Y5qo3er8.js.map → layout-Cqghi_rx.js.map} +1 -1
  194. package/dist/{layout-BE2ld1IY.js → layout-fjM1DWlF.js} +1 -1
  195. package/dist/{layout-BE2ld1IY.js.map → layout-fjM1DWlF.js.map} +1 -1
  196. package/dist/layout.cjs +1 -1
  197. package/dist/layout.js +2 -2
  198. package/dist/lazy-BDNnH_r7.cjs +1 -0
  199. package/dist/lazy-BDNnH_r7.cjs.map +1 -0
  200. package/dist/lazy-D6R5N5v4.js +13 -0
  201. package/dist/lazy-D6R5N5v4.js.map +1 -0
  202. package/dist/{lightbox-Ce8nMldr.cjs → lightbox-BWKTzA03.cjs} +1 -1
  203. package/dist/{lightbox-Ce8nMldr.cjs.map → lightbox-BWKTzA03.cjs.map} +1 -1
  204. package/dist/{lightbox-C_pqYF6q.js → lightbox-CnCTvqSu.js} +3 -3
  205. package/dist/{lightbox-C_pqYF6q.js.map → lightbox-CnCTvqSu.js.map} +1 -1
  206. package/dist/lightbox.cjs +1 -1
  207. package/dist/lightbox.js +1 -1
  208. package/dist/{list-DcnTGee0.js → list-BpjKUOzM.js} +2 -2
  209. package/dist/{list-DcnTGee0.js.map → list-BpjKUOzM.js.map} +1 -1
  210. package/dist/{list-CLc_OQ5k.cjs → list-CMWHu6cV.cjs} +1 -1
  211. package/dist/{list-CLc_OQ5k.cjs.map → list-CMWHu6cV.cjs.map} +1 -1
  212. package/dist/list.cjs +1 -1
  213. package/dist/list.js +1 -1
  214. package/dist/{litElement.mixin-Mi8bar6B.js → litElement.mixin-BnNYZ24e.js} +1 -1
  215. package/dist/{litElement.mixin-Mi8bar6B.js.map → litElement.mixin-BnNYZ24e.js.map} +1 -1
  216. package/dist/{litElement.mixin-DeT3kAOS.cjs → litElement.mixin-CtQOmwq6.cjs} +1 -1
  217. package/dist/{litElement.mixin-DeT3kAOS.cjs.map → litElement.mixin-CtQOmwq6.cjs.map} +1 -1
  218. package/dist/{magnetic-Dj52WplI.js → magnetic-BhXebqF3.js} +2 -2
  219. package/dist/{magnetic-Dj52WplI.js.map → magnetic-BhXebqF3.js.map} +1 -1
  220. package/dist/{magnetic-aBBnj_vk.cjs → magnetic-CVXEkYTA.cjs} +1 -1
  221. package/dist/{magnetic-aBBnj_vk.cjs.map → magnetic-CVXEkYTA.cjs.map} +1 -1
  222. package/dist/{mailbox-BrLZPj2o.js → mailbox-CHIpxS3W.js} +5 -5
  223. package/dist/{mailbox-BrLZPj2o.js.map → mailbox-CHIpxS3W.js.map} +1 -1
  224. package/dist/{mailbox-CE5sTDsQ.cjs → mailbox-Tg1CROVz.cjs} +1 -1
  225. package/dist/{mailbox-CE5sTDsQ.cjs.map → mailbox-Tg1CROVz.cjs.map} +1 -1
  226. package/dist/mailbox.cjs +1 -1
  227. package/dist/mailbox.js +1 -1
  228. package/dist/{map-SNb-3q5h.js → map-YY1Q4FWO.js} +1 -1
  229. package/dist/{map-SNb-3q5h.js.map → map-YY1Q4FWO.js.map} +1 -1
  230. package/dist/{map-CKzhM6uY.cjs → map-Z_dsu-dv.cjs} +1 -1
  231. package/dist/{map-CKzhM6uY.cjs.map → map-Z_dsu-dv.cjs.map} +1 -1
  232. package/dist/map.cjs +1 -1
  233. package/dist/map.js +1 -1
  234. package/dist/{menu-VErqs9NG.js → menu-BIBUgS1T.js} +2 -2
  235. package/dist/{menu-VErqs9NG.js.map → menu-BIBUgS1T.js.map} +1 -1
  236. package/dist/{menu-BnGjBrdD.cjs → menu-DS8Iz4fJ.cjs} +1 -1
  237. package/dist/{menu-BnGjBrdD.cjs.map → menu-DS8Iz4fJ.cjs.map} +1 -1
  238. package/dist/menu.cjs +1 -1
  239. package/dist/menu.js +1 -1
  240. package/dist/mixins.cjs +1 -1
  241. package/dist/mixins.js +2 -2
  242. package/dist/nav-drawer.cjs +1 -1
  243. package/dist/nav-drawer.js +1 -1
  244. package/dist/navigation-bar.cjs +1 -1
  245. package/dist/navigation-bar.js +1 -1
  246. package/dist/navigation-rail.cjs +1 -1
  247. package/dist/navigation-rail.js +1 -1
  248. package/dist/{notification-B_Fkxv7d.js → notification-ChAvNXf3.js} +3 -3
  249. package/dist/{notification-B_Fkxv7d.js.map → notification-ChAvNXf3.js.map} +1 -1
  250. package/dist/{notification-DE5dFf8G.cjs → notification-DPUkuifB.cjs} +1 -1
  251. package/dist/{notification-DE5dFf8G.cjs.map → notification-DPUkuifB.cjs.map} +1 -1
  252. package/dist/notification.cjs +1 -1
  253. package/dist/notification.js +1 -1
  254. package/dist/{option-DuAlGv27.js → option-Ci7C8xxh.js} +1 -1
  255. package/dist/{option-DuAlGv27.js.map → option-Ci7C8xxh.js.map} +1 -1
  256. package/dist/{option-BmbP5ulK.cjs → option-OIp0joyN.cjs} +1 -1
  257. package/dist/{option-BmbP5ulK.cjs.map → option-OIp0joyN.cjs.map} +1 -1
  258. package/dist/option.cjs +1 -1
  259. package/dist/option.js +1 -1
  260. package/dist/{overlay-stack-J_eJCUTX.cjs.map → overlay-stack-7bs4ZNnh.cjs.map} +1 -1
  261. package/dist/{overlay-stack-BJt_r6aZ.js.map → overlay-stack-DXPYHPhk.js.map} +1 -1
  262. package/dist/overlay.cjs +130 -0
  263. package/dist/overlay.cjs.map +1 -0
  264. package/dist/overlay.js +570 -0
  265. package/dist/overlay.js.map +1 -0
  266. package/dist/page.cjs +1 -1
  267. package/dist/page.js +4 -4
  268. package/dist/{progress-Bt9gUiGP.cjs → progress-32Cad1NX.cjs} +1 -1
  269. package/dist/{progress-Bt9gUiGP.cjs.map → progress-32Cad1NX.cjs.map} +1 -1
  270. package/dist/{progress-BnXr7aAs.js → progress-DGkwPgDX.js} +1 -1
  271. package/dist/{progress-BnXr7aAs.js.map → progress-DGkwPgDX.js.map} +1 -1
  272. package/dist/progress.cjs +1 -1
  273. package/dist/progress.js +1 -1
  274. package/dist/{provide-Disc6_zz.js → provide-BuzyBLGj.js} +1 -1
  275. package/dist/{provide-Disc6_zz.js.map → provide-BuzyBLGj.js.map} +1 -1
  276. package/dist/{provide-CnXCF-UP.cjs → provide-MvHcXKzT.cjs} +1 -1
  277. package/dist/{provide-CnXCF-UP.cjs.map → provide-MvHcXKzT.cjs.map} +1 -1
  278. package/dist/qr-scanner.cjs +1 -1
  279. package/dist/qr-scanner.js +1 -1
  280. package/dist/{radio-group-BgZgHMoA.js → radio-group-B72sYGnS.js} +1 -1
  281. package/dist/{radio-group-BgZgHMoA.js.map → radio-group-B72sYGnS.js.map} +1 -1
  282. package/dist/{radio-group-DkBFgq_3.cjs → radio-group-B7DuNxUq.cjs} +1 -1
  283. package/dist/{radio-group-DkBFgq_3.cjs.map → radio-group-B7DuNxUq.cjs.map} +1 -1
  284. package/dist/radio-group.cjs +1 -1
  285. package/dist/radio-group.js +1 -1
  286. package/dist/range.cjs +1 -1
  287. package/dist/range.js +1 -1
  288. package/dist/{reduced-motion-DR32yKEO.cjs → reduced-motion-9RjNnhIg.cjs} +1 -1
  289. package/dist/{reduced-motion-DR32yKEO.cjs.map → reduced-motion-9RjNnhIg.cjs.map} +1 -1
  290. package/dist/{reduced-motion-B83yZbcO.js.map → reduced-motion-BZTLqAyl.js.map} +1 -1
  291. package/dist/{rxjs-utils-CN9fv8Xq.js → rxjs-utils-CKTnEKUH.js} +1 -1
  292. package/dist/{rxjs-utils-CN9fv8Xq.js.map → rxjs-utils-CKTnEKUH.js.map} +1 -1
  293. package/dist/{rxjs-utils-Vn6DCKgL.cjs → rxjs-utils-DJbZRjp3.cjs} +1 -1
  294. package/dist/{rxjs-utils-Vn6DCKgL.cjs.map → rxjs-utils-DJbZRjp3.cjs.map} +1 -1
  295. package/dist/rxjs-utils.cjs +1 -1
  296. package/dist/rxjs-utils.js +1 -1
  297. package/dist/{scroll-57rkTHm8.js → scroll-CdmXRXh2.js} +1 -1
  298. package/dist/{scroll-57rkTHm8.js.map → scroll-CdmXRXh2.js.map} +1 -1
  299. package/dist/{scroll-hWt0b1gK.cjs → scroll-V1rAZ9fK.cjs} +1 -1
  300. package/dist/{scroll-hWt0b1gK.cjs.map → scroll-V1rAZ9fK.cjs.map} +1 -1
  301. package/dist/{search-BlGJ6uJv.js.map → search-CvUZRLF1.js.map} +1 -1
  302. package/dist/{search-C8eAOzBm.cjs.map → search-CwMav5QB.cjs.map} +1 -1
  303. package/dist/{select-BDonPD5a.cjs → select-DFxoBgEf.cjs} +1 -1
  304. package/dist/{select-BDonPD5a.cjs.map → select-DFxoBgEf.cjs.map} +1 -1
  305. package/dist/{select-CkOAwmxC.js → select-wFDKDLQI.js} +2 -2
  306. package/dist/{select-CkOAwmxC.js.map → select-wFDKDLQI.js.map} +1 -1
  307. package/dist/select.cjs +1 -1
  308. package/dist/select.js +1 -1
  309. package/dist/{sheet-Bv2mPHWk.cjs → sheet-DdlZhnDG.cjs} +2 -2
  310. package/dist/{sheet-Bv2mPHWk.cjs.map → sheet-DdlZhnDG.cjs.map} +1 -1
  311. package/dist/{sheet-NUgEmozP.js → sheet-LFVo5iN4.js} +4 -4
  312. package/dist/{sheet-NUgEmozP.js.map → sheet-LFVo5iN4.js.map} +1 -1
  313. package/dist/sheet.cjs +1 -1
  314. package/dist/sheet.js +2 -2
  315. package/dist/{sheet.service-BKmnlkpZ.cjs → sheet.service-BfNDB0K0.cjs} +1 -1
  316. package/dist/{sheet.service-BKmnlkpZ.cjs.map → sheet.service-BfNDB0K0.cjs.map} +1 -1
  317. package/dist/{sheet.service-CanLo8ko.js → sheet.service-DQE7-_wq.js} +3 -3
  318. package/dist/{sheet.service-CanLo8ko.js.map → sheet.service-DQE7-_wq.js.map} +1 -1
  319. package/dist/skeleton.cjs +1 -1
  320. package/dist/skeleton.js +1 -1
  321. package/dist/skills/INDEX.md +1 -1
  322. package/dist/skills/overlay.md +200 -0
  323. package/dist/skills/schmancy/INDEX.md +1 -1
  324. package/dist/skills/schmancy/overlay.md +200 -0
  325. package/dist/slider.cjs +1 -1
  326. package/dist/slider.js +1 -1
  327. package/dist/{sound.service-BjSoGjmT.cjs → sound.service-BEN6Xjy_.cjs} +1 -1
  328. package/dist/{sound.service-BjSoGjmT.cjs.map → sound.service-BEN6Xjy_.cjs.map} +1 -1
  329. package/dist/{sound.service-cdkw3Wkv.js → sound.service-DWZe6swU.js} +1 -1
  330. package/dist/{sound.service-cdkw3Wkv.js.map → sound.service-DWZe6swU.js.map} +1 -1
  331. package/dist/{splash-screen-BemqNFNj.cjs → splash-screen-C9HqX2nR.cjs} +1 -1
  332. package/dist/{splash-screen-BemqNFNj.cjs.map → splash-screen-C9HqX2nR.cjs.map} +1 -1
  333. package/dist/{splash-screen-B0ppA3f1.js → splash-screen-COg3Z6n8.js} +1 -1
  334. package/dist/{splash-screen-B0ppA3f1.js.map → splash-screen-COg3Z6n8.js.map} +1 -1
  335. package/dist/splash-screen.cjs +1 -1
  336. package/dist/splash-screen.js +1 -1
  337. package/dist/{src-Cjy9zCiU.js → src-C7niWYur.js} +51 -51
  338. package/dist/{src-Cjy9zCiU.js.map → src-C7niWYur.js.map} +1 -1
  339. package/dist/{src-ByGCYD-E.cjs → src-I4M33WK2.cjs} +3 -3
  340. package/dist/{src-ByGCYD-E.cjs.map → src-I4M33WK2.cjs.map} +1 -1
  341. package/dist/steps.cjs +1 -1
  342. package/dist/steps.js +3 -3
  343. package/dist/{store-CO4nJyGj.cjs → store-CjFHCSDb.cjs} +1 -1
  344. package/dist/{store-CO4nJyGj.cjs.map → store-CjFHCSDb.cjs.map} +1 -1
  345. package/dist/{store-Bmj6rvZY.js.map → store-CjzZDQt8.js.map} +1 -1
  346. package/dist/store.cjs +1 -1
  347. package/dist/store.js +1 -1
  348. package/dist/{surface-CtpWeSGn.js → surface-0XM4DBaT.js} +2 -2
  349. package/dist/{surface-CtpWeSGn.js.map → surface-0XM4DBaT.js.map} +1 -1
  350. package/dist/{surface-CoLYICO1.cjs → surface-B6DA01kL.cjs} +1 -1
  351. package/dist/{surface-CoLYICO1.cjs.map → surface-B6DA01kL.cjs.map} +1 -1
  352. package/dist/surface.cjs +1 -1
  353. package/dist/surface.js +1 -1
  354. package/dist/{surface.mixin-CSKqQH-0.cjs → surface.mixin-DxOi-xo0.cjs} +1 -1
  355. package/dist/{surface.mixin-CSKqQH-0.cjs.map → surface.mixin-DxOi-xo0.cjs.map} +1 -1
  356. package/dist/switch.cjs +1 -1
  357. package/dist/switch.js +1 -1
  358. package/dist/{table-COQKtlJB.cjs → table-B-DsOqzT.cjs} +2 -2
  359. package/dist/{table-COQKtlJB.cjs.map → table-B-DsOqzT.cjs.map} +1 -1
  360. package/dist/{table-bgFb1KYU.js → table-hBEZRxM_.js} +3 -3
  361. package/dist/{table-bgFb1KYU.js.map → table-hBEZRxM_.js.map} +1 -1
  362. package/dist/table.cjs +1 -1
  363. package/dist/table.js +1 -1
  364. package/dist/{tabs-BicCpU1B.js → tabs-C7r4TqcX.js} +2 -2
  365. package/dist/{tabs-BicCpU1B.js.map → tabs-C7r4TqcX.js.map} +1 -1
  366. package/dist/{tabs-CoMJAXDy.cjs → tabs-DZaLZUBy.cjs} +1 -1
  367. package/dist/{tabs-CoMJAXDy.cjs.map → tabs-DZaLZUBy.cjs.map} +1 -1
  368. package/dist/tabs.cjs +1 -1
  369. package/dist/tabs.js +1 -1
  370. package/dist/tailwind.mixin-Bh58QnlW.cjs +2 -0
  371. package/dist/{tailwind.mixin-BfdVIGgD.cjs.map → tailwind.mixin-Bh58QnlW.cjs.map} +1 -1
  372. package/dist/tailwind.mixin-H5Pn7vSJ.js +219 -0
  373. package/dist/{tailwind.mixin-CNdR3zFD.js.map → tailwind.mixin-H5Pn7vSJ.js.map} +1 -1
  374. package/dist/teleport.cjs +1 -1
  375. package/dist/teleport.js +1 -1
  376. package/dist/{textarea-CxTSwn3x.cjs → textarea-B2544vx9.cjs} +1 -1
  377. package/dist/{textarea-CxTSwn3x.cjs.map → textarea-B2544vx9.cjs.map} +1 -1
  378. package/dist/{textarea-D7O9Uo15.js → textarea-CS-KdSLz.js} +1 -1
  379. package/dist/{textarea-D7O9Uo15.js.map → textarea-CS-KdSLz.js.map} +1 -1
  380. package/dist/textarea.cjs +1 -1
  381. package/dist/textarea.js +1 -1
  382. package/dist/{theme-DGiyJMTT.js → theme-Cq_c9IO3.js} +7 -7
  383. package/dist/{theme-DGiyJMTT.js.map → theme-Cq_c9IO3.js.map} +1 -1
  384. package/dist/{theme-CCez6SRm.cjs → theme-DU5yXaV-.cjs} +1 -1
  385. package/dist/{theme-CCez6SRm.cjs.map → theme-DU5yXaV-.cjs.map} +1 -1
  386. package/dist/{theme-button-BV0CxpGn.cjs → theme-button-CPujUbgV.cjs} +1 -1
  387. package/dist/{theme-button-BV0CxpGn.cjs.map → theme-button-CPujUbgV.cjs.map} +1 -1
  388. package/dist/{theme-button-s9GfSQL5.js → theme-button-OJl2ma0u.js} +1 -1
  389. package/dist/{theme-button-s9GfSQL5.js.map → theme-button-OJl2ma0u.js.map} +1 -1
  390. package/dist/theme-button.cjs +1 -1
  391. package/dist/theme-button.js +1 -1
  392. package/dist/theme.cjs +1 -1
  393. package/dist/{theme.events-EznKK2Y0.cjs.map → theme.events-DakXxZeP.cjs.map} +1 -1
  394. package/dist/{theme.events-Bw3mYjUA.js.map → theme.events-NuihzD_p.js.map} +1 -1
  395. package/dist/{theme.interface-Cyqv5XWY.js.map → theme.interface-Buged9Cg.js.map} +1 -1
  396. package/dist/{theme.interface-CCE3L1ql.cjs.map → theme.interface-DTwkuAKJ.cjs.map} +1 -1
  397. package/dist/theme.js +5 -5
  398. package/dist/{theme.service-ETiKUwVy.cjs → theme.service-DxJPUGlu.cjs} +1 -1
  399. package/dist/{theme.service-ETiKUwVy.cjs.map → theme.service-DxJPUGlu.cjs.map} +1 -1
  400. package/dist/{theme.service-_qP5WvB9.js → theme.service-cOfPrtfe.js} +2 -2
  401. package/dist/{theme.service-_qP5WvB9.js.map → theme.service-cOfPrtfe.js.map} +1 -1
  402. package/dist/tooltip.cjs +1 -1
  403. package/dist/tree.cjs +1 -1
  404. package/dist/tree.js +1 -1
  405. package/dist/{tslib.es6-PMITL0Z3.cjs.map → tslib.es6-Cnt75pb6.cjs.map} +1 -1
  406. package/dist/{tslib.es6-vJQZBGJO.js.map → tslib.es6-DMzzJKHV.js.map} +1 -1
  407. package/dist/{typewriter-BTqEQXsX.js → typewriter-DyN7xa0n.js} +5 -5
  408. package/dist/{typewriter-BTqEQXsX.js.map → typewriter-DyN7xa0n.js.map} +1 -1
  409. package/dist/{typewriter-DeaL3NfZ.cjs → typewriter-LK0S4NEr.cjs} +1 -1
  410. package/dist/{typewriter-DeaL3NfZ.cjs.map → typewriter-LK0S4NEr.cjs.map} +1 -1
  411. package/dist/typewriter.cjs +1 -1
  412. package/dist/typewriter.js +1 -1
  413. package/dist/typography.cjs +1 -1
  414. package/dist/typography.js +1 -1
  415. package/dist/{utils-C8PD8So2.cjs → utils-2qrmPb78.cjs} +1 -1
  416. package/dist/{utils-C8PD8So2.cjs.map → utils-2qrmPb78.cjs.map} +1 -1
  417. package/dist/{utils-DVuCPDfw.js → utils-xBXLvebz.js} +3 -3
  418. package/dist/{utils-DVuCPDfw.js.map → utils-xBXLvebz.js.map} +1 -1
  419. package/dist/utils.cjs +1 -1
  420. package/dist/utils.js +5 -5
  421. package/dist/visually-hidden.cjs +1 -1
  422. package/dist/visually-hidden.js +1 -1
  423. package/dist/{window-CDHDVOwO.js → window-BWecg8Ih.js} +6 -6
  424. package/dist/{window-CDHDVOwO.js.map → window-BWecg8Ih.js.map} +1 -1
  425. package/dist/{window-IGZgxuUC.cjs → window-Cjv2GqSN.cjs} +1 -1
  426. package/dist/{window-IGZgxuUC.cjs.map → window-Cjv2GqSN.cjs.map} +1 -1
  427. package/dist/window.cjs +1 -1
  428. package/dist/window.js +1 -1
  429. package/package.json +3 -2
  430. package/skills/schmancy/INDEX.md +1 -1
  431. package/skills/schmancy/overlay.md +200 -0
  432. package/src/overlay/index.ts +15 -0
  433. package/src/overlay/overlay.animations.ts +137 -0
  434. package/src/overlay/overlay.component.ts +452 -0
  435. package/src/overlay/overlay.confirm-body.ts +149 -0
  436. package/src/overlay/overlay.gestures.ts +131 -0
  437. package/src/overlay/overlay.layout.ts +76 -0
  438. package/src/overlay/overlay.service.ts +299 -0
  439. package/src/overlay/overlay.stack.ts +171 -0
  440. package/src/overlay/overlay.types.ts +146 -0
  441. package/types/src/overlay/index.d.ts +5 -0
  442. package/types/src/overlay/overlay.animations.d.ts +26 -0
  443. package/types/src/overlay/overlay.component.d.ts +48 -0
  444. package/types/src/overlay/overlay.confirm-body.d.ts +42 -0
  445. package/types/src/overlay/overlay.gestures.d.ts +39 -0
  446. package/types/src/overlay/overlay.layout.d.ts +48 -0
  447. package/types/src/overlay/overlay.service.d.ts +62 -0
  448. package/types/src/overlay/overlay.stack.d.ts +25 -0
  449. package/types/src/overlay/overlay.types.d.ts +122 -0
  450. package/dist/area-CApZWjqs.cjs.map +0 -1
  451. package/dist/area-D_p1YBgP.js.map +0 -1
  452. package/dist/chunk-BCfY8kxB.cjs +0 -1
  453. package/dist/context-C6GwmNJJ.cjs +0 -1
  454. package/dist/context-oBTPHrbc.js +0 -3
  455. package/dist/float-yZoLnUg0.cjs +0 -1
  456. package/dist/tailwind.mixin-BfdVIGgD.cjs +0 -2
  457. package/dist/tailwind.mixin-CNdR3zFD.js +0 -219
  458. /package/dist/{animation-Bcwh107v.cjs → animation-CQRdLgzX.cjs} +0 -0
  459. /package/dist/{animation-CXKSuUoE.js → animation-hXFClrIn.js} +0 -0
  460. /package/dist/{date-range-inline-B_g1YXu3.js → date-range-inline-CpKG6qt2.js} +0 -0
  461. /package/dist/{flow-BPDtbhLe.js → flow-BGkHnOnd.js} +0 -0
  462. /package/dist/{flow-Dn9AZktE.cjs → flow-ClAJ6Qby.cjs} +0 -0
  463. /package/dist/{form-C1qS9uvS.js → form-rCZqoAoK.js} +0 -0
  464. /package/dist/{hashContent-BUqULUiZ.js → hashContent-B2IntJQf.js} +0 -0
  465. /package/dist/{hashContent-CI39BY-_.cjs → hashContent-CahnEuut.cjs} +0 -0
  466. /package/dist/{input-Dv-HtkM9.js → input-Bc3bVISm.js} +0 -0
  467. /package/dist/{intersection-C0JuW_7U.js → intersection-BrXp4YTO.js} +0 -0
  468. /package/dist/{overlay-stack-J_eJCUTX.cjs → overlay-stack-7bs4ZNnh.cjs} +0 -0
  469. /package/dist/{overlay-stack-BJt_r6aZ.js → overlay-stack-DXPYHPhk.js} +0 -0
  470. /package/dist/{reduced-motion-B83yZbcO.js → reduced-motion-BZTLqAyl.js} +0 -0
  471. /package/dist/{search-BlGJ6uJv.js → search-CvUZRLF1.js} +0 -0
  472. /package/dist/{search-C8eAOzBm.cjs → search-CwMav5QB.cjs} +0 -0
  473. /package/dist/{store-Bmj6rvZY.js → store-CjzZDQt8.js} +0 -0
  474. /package/dist/{theme.events-EznKK2Y0.cjs → theme.events-DakXxZeP.cjs} +0 -0
  475. /package/dist/{theme.events-Bw3mYjUA.js → theme.events-NuihzD_p.js} +0 -0
  476. /package/dist/{theme.interface-Cyqv5XWY.js → theme.interface-Buged9Cg.js} +0 -0
  477. /package/dist/{theme.interface-CCE3L1ql.cjs → theme.interface-DTwkuAKJ.cjs} +0 -0
  478. /package/dist/{tslib.es6-PMITL0Z3.cjs → tslib.es6-Cnt75pb6.cjs} +0 -0
  479. /package/dist/{tslib.es6-vJQZBGJO.js → tslib.es6-DMzzJKHV.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"store-Bmj6rvZY.js","names":["isPlainObject","isArray","isMap","isSet","finalize"],"sources":["../node_modules/immer/dist/immer.mjs","../src/store/types.ts","../src/store/storage-manager.ts","../src/store/store.class.ts","../src/store/context-array.ts","../src/store/context-collection.ts","../src/store/context-object.ts","../src/store/context-create.ts","../src/store/filter-directive.ts","../src/store/selectors.ts","../src/store/selector-hook.ts"],"sourcesContent":["// src/utils/env.ts\nvar NOTHING = Symbol.for(\"immer-nothing\");\nvar DRAFTABLE = Symbol.for(\"immer-draftable\");\nvar DRAFT_STATE = Symbol.for(\"immer-state\");\n\n// src/utils/errors.ts\nvar errors = process.env.NODE_ENV !== \"production\" ? [\n // All error codes, starting by 0:\n function(plugin) {\n return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \\`enable${plugin}()\\` when initializing your application.`;\n },\n function(thing) {\n 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 '${thing}'`;\n },\n \"This object has been frozen and should not be mutated\",\n function(data) {\n return \"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? \" + data;\n },\n \"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.\",\n \"Immer forbids circular references\",\n \"The first or second argument to `produce` must be a function\",\n \"The third argument to `produce` must be a function or undefined\",\n \"First argument to `createDraft` must be a plain object, an array, or an immerable object\",\n \"First argument to `finishDraft` must be a draft returned by `createDraft`\",\n function(thing) {\n return `'current' expects a draft, got: ${thing}`;\n },\n \"Object.defineProperty() cannot be used on an Immer draft\",\n \"Object.setPrototypeOf() cannot be used on an Immer draft\",\n \"Immer only supports deleting array indices\",\n \"Immer only supports setting array indices and the 'length' property\",\n function(thing) {\n return `'original' expects a draft, got: ${thing}`;\n }\n // Note: if more errors are added, the errorOffset in Patches.ts should be increased\n // See Patches.ts for additional errors\n] : [];\nfunction die(error, ...args) {\n if (process.env.NODE_ENV !== \"production\") {\n const e = errors[error];\n const msg = isFunction(e) ? e.apply(null, args) : e;\n throw new Error(`[Immer] ${msg}`);\n }\n throw new Error(\n `[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`\n );\n}\n\n// src/utils/common.ts\nvar O = Object;\nvar getPrototypeOf = O.getPrototypeOf;\nvar CONSTRUCTOR = \"constructor\";\nvar PROTOTYPE = \"prototype\";\nvar CONFIGURABLE = \"configurable\";\nvar ENUMERABLE = \"enumerable\";\nvar WRITABLE = \"writable\";\nvar VALUE = \"value\";\nvar isDraft = (value) => !!value && !!value[DRAFT_STATE];\nfunction isDraftable(value) {\n if (!value)\n return false;\n return isPlainObject(value) || isArray(value) || !!value[DRAFTABLE] || !!value[CONSTRUCTOR]?.[DRAFTABLE] || isMap(value) || isSet(value);\n}\nvar objectCtorString = O[PROTOTYPE][CONSTRUCTOR].toString();\nvar cachedCtorStrings = /* @__PURE__ */ new WeakMap();\nfunction isPlainObject(value) {\n if (!value || !isObjectish(value))\n return false;\n const proto = getPrototypeOf(value);\n if (proto === null || proto === O[PROTOTYPE])\n return true;\n const Ctor = O.hasOwnProperty.call(proto, CONSTRUCTOR) && proto[CONSTRUCTOR];\n if (Ctor === Object)\n return true;\n if (!isFunction(Ctor))\n return false;\n let ctorString = cachedCtorStrings.get(Ctor);\n if (ctorString === void 0) {\n ctorString = Function.toString.call(Ctor);\n cachedCtorStrings.set(Ctor, ctorString);\n }\n return ctorString === objectCtorString;\n}\nfunction original(value) {\n if (!isDraft(value))\n die(15, value);\n return value[DRAFT_STATE].base_;\n}\nfunction each(obj, iter, strict = true) {\n if (getArchtype(obj) === 0 /* Object */) {\n const keys = strict ? Reflect.ownKeys(obj) : O.keys(obj);\n keys.forEach((key) => {\n iter(key, obj[key], obj);\n });\n } else {\n obj.forEach((entry, index) => iter(index, entry, obj));\n }\n}\nfunction getArchtype(thing) {\n const state = thing[DRAFT_STATE];\n return state ? state.type_ : isArray(thing) ? 1 /* Array */ : isMap(thing) ? 2 /* Map */ : isSet(thing) ? 3 /* Set */ : 0 /* Object */;\n}\nvar has = (thing, prop, type = getArchtype(thing)) => type === 2 /* Map */ ? thing.has(prop) : O[PROTOTYPE].hasOwnProperty.call(thing, prop);\nvar get = (thing, prop, type = getArchtype(thing)) => (\n // @ts-ignore\n type === 2 /* Map */ ? thing.get(prop) : thing[prop]\n);\nvar set = (thing, propOrOldValue, value, type = getArchtype(thing)) => {\n if (type === 2 /* Map */)\n thing.set(propOrOldValue, value);\n else if (type === 3 /* Set */) {\n thing.add(value);\n } else\n thing[propOrOldValue] = value;\n};\nfunction is(x, y) {\n if (x === y) {\n return x !== 0 || 1 / x === 1 / y;\n } else {\n return x !== x && y !== y;\n }\n}\nvar isArray = Array.isArray;\nvar isMap = (target) => target instanceof Map;\nvar isSet = (target) => target instanceof Set;\nvar isObjectish = (target) => typeof target === \"object\";\nvar isFunction = (target) => typeof target === \"function\";\nvar isBoolean = (target) => typeof target === \"boolean\";\nfunction isArrayIndex(value) {\n const n = +value;\n return Number.isInteger(n) && String(n) === value;\n}\nvar getProxyDraft = (value) => {\n if (!isObjectish(value))\n return null;\n return value?.[DRAFT_STATE];\n};\nvar latest = (state) => state.copy_ || state.base_;\nvar getValue = (value) => {\n const proxyDraft = getProxyDraft(value);\n return proxyDraft ? proxyDraft.copy_ ?? proxyDraft.base_ : value;\n};\nvar getFinalValue = (state) => state.modified_ ? state.copy_ : state.base_;\nfunction shallowCopy(base, strict) {\n if (isMap(base)) {\n return new Map(base);\n }\n if (isSet(base)) {\n return new Set(base);\n }\n if (isArray(base))\n return Array[PROTOTYPE].slice.call(base);\n const isPlain = isPlainObject(base);\n if (strict === true || strict === \"class_only\" && !isPlain) {\n const descriptors = O.getOwnPropertyDescriptors(base);\n delete descriptors[DRAFT_STATE];\n let keys = Reflect.ownKeys(descriptors);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const desc = descriptors[key];\n if (desc[WRITABLE] === false) {\n desc[WRITABLE] = true;\n desc[CONFIGURABLE] = true;\n }\n if (desc.get || desc.set)\n descriptors[key] = {\n [CONFIGURABLE]: true,\n [WRITABLE]: true,\n // could live with !!desc.set as well here...\n [ENUMERABLE]: desc[ENUMERABLE],\n [VALUE]: base[key]\n };\n }\n return O.create(getPrototypeOf(base), descriptors);\n } else {\n const proto = getPrototypeOf(base);\n if (proto !== null && isPlain) {\n return { ...base };\n }\n const obj = O.create(proto);\n return O.assign(obj, base);\n }\n}\nfunction freeze(obj, deep = false) {\n if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj))\n return obj;\n if (getArchtype(obj) > 1) {\n O.defineProperties(obj, {\n set: dontMutateMethodOverride,\n add: dontMutateMethodOverride,\n clear: dontMutateMethodOverride,\n delete: dontMutateMethodOverride\n });\n }\n O.freeze(obj);\n if (deep)\n each(\n obj,\n (_key, value) => {\n freeze(value, true);\n },\n false\n );\n return obj;\n}\nfunction dontMutateFrozenCollections() {\n die(2);\n}\nvar dontMutateMethodOverride = {\n [VALUE]: dontMutateFrozenCollections\n};\nfunction isFrozen(obj) {\n if (obj === null || !isObjectish(obj))\n return true;\n return O.isFrozen(obj);\n}\n\n// src/utils/plugins.ts\nvar PluginMapSet = \"MapSet\";\nvar PluginPatches = \"Patches\";\nvar PluginArrayMethods = \"ArrayMethods\";\nvar plugins = {};\nfunction getPlugin(pluginKey) {\n const plugin = plugins[pluginKey];\n if (!plugin) {\n die(0, pluginKey);\n }\n return plugin;\n}\nvar isPluginLoaded = (pluginKey) => !!plugins[pluginKey];\nfunction loadPlugin(pluginKey, implementation) {\n if (!plugins[pluginKey])\n plugins[pluginKey] = implementation;\n}\n\n// src/core/scope.ts\nvar currentScope;\nvar getCurrentScope = () => currentScope;\nvar createScope = (parent_, immer_) => ({\n drafts_: [],\n parent_,\n immer_,\n // Whenever the modified draft contains a draft from another scope, we\n // need to prevent auto-freezing so the unowned draft can be finalized.\n canAutoFreeze_: true,\n unfinalizedDrafts_: 0,\n handledSet_: /* @__PURE__ */ new Set(),\n processedForPatches_: /* @__PURE__ */ new Set(),\n mapSetPlugin_: isPluginLoaded(PluginMapSet) ? getPlugin(PluginMapSet) : void 0,\n arrayMethodsPlugin_: isPluginLoaded(PluginArrayMethods) ? getPlugin(PluginArrayMethods) : void 0\n});\nfunction usePatchesInScope(scope, patchListener) {\n if (patchListener) {\n scope.patchPlugin_ = getPlugin(PluginPatches);\n scope.patches_ = [];\n scope.inversePatches_ = [];\n scope.patchListener_ = patchListener;\n }\n}\nfunction revokeScope(scope) {\n leaveScope(scope);\n scope.drafts_.forEach(revokeDraft);\n scope.drafts_ = null;\n}\nfunction leaveScope(scope) {\n if (scope === currentScope) {\n currentScope = scope.parent_;\n }\n}\nvar enterScope = (immer2) => currentScope = createScope(currentScope, immer2);\nfunction revokeDraft(draft) {\n const state = draft[DRAFT_STATE];\n if (state.type_ === 0 /* Object */ || state.type_ === 1 /* Array */)\n state.revoke_();\n else\n state.revoked_ = true;\n}\n\n// src/core/finalize.ts\nfunction processResult(result, scope) {\n scope.unfinalizedDrafts_ = scope.drafts_.length;\n const baseDraft = scope.drafts_[0];\n const isReplaced = result !== void 0 && result !== baseDraft;\n if (isReplaced) {\n if (baseDraft[DRAFT_STATE].modified_) {\n revokeScope(scope);\n die(4);\n }\n if (isDraftable(result)) {\n result = finalize(scope, result);\n }\n const { patchPlugin_ } = scope;\n if (patchPlugin_) {\n patchPlugin_.generateReplacementPatches_(\n baseDraft[DRAFT_STATE].base_,\n result,\n scope\n );\n }\n } else {\n result = finalize(scope, baseDraft);\n }\n maybeFreeze(scope, result, true);\n revokeScope(scope);\n if (scope.patches_) {\n scope.patchListener_(scope.patches_, scope.inversePatches_);\n }\n return result !== NOTHING ? result : void 0;\n}\nfunction finalize(rootScope, value) {\n if (isFrozen(value))\n return value;\n const state = value[DRAFT_STATE];\n if (!state) {\n const finalValue = handleValue(value, rootScope.handledSet_, rootScope);\n return finalValue;\n }\n if (!isSameScope(state, rootScope)) {\n return value;\n }\n if (!state.modified_) {\n return state.base_;\n }\n if (!state.finalized_) {\n const { callbacks_ } = state;\n if (callbacks_) {\n while (callbacks_.length > 0) {\n const callback = callbacks_.pop();\n callback(rootScope);\n }\n }\n generatePatchesAndFinalize(state, rootScope);\n }\n return state.copy_;\n}\nfunction maybeFreeze(scope, value, deep = false) {\n if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {\n freeze(value, deep);\n }\n}\nfunction markStateFinalized(state) {\n state.finalized_ = true;\n state.scope_.unfinalizedDrafts_--;\n}\nvar isSameScope = (state, rootScope) => state.scope_ === rootScope;\nvar EMPTY_LOCATIONS_RESULT = [];\nfunction updateDraftInParent(parent, draftValue, finalizedValue, originalKey) {\n const parentCopy = latest(parent);\n const parentType = parent.type_;\n if (originalKey !== void 0) {\n const currentValue = get(parentCopy, originalKey, parentType);\n if (currentValue === draftValue) {\n set(parentCopy, originalKey, finalizedValue, parentType);\n return;\n }\n }\n if (!parent.draftLocations_) {\n const draftLocations = parent.draftLocations_ = /* @__PURE__ */ new Map();\n each(parentCopy, (key, value) => {\n if (isDraft(value)) {\n const keys = draftLocations.get(value) || [];\n keys.push(key);\n draftLocations.set(value, keys);\n }\n });\n }\n const locations = parent.draftLocations_.get(draftValue) ?? EMPTY_LOCATIONS_RESULT;\n for (const location of locations) {\n set(parentCopy, location, finalizedValue, parentType);\n }\n}\nfunction registerChildFinalizationCallback(parent, child, key) {\n parent.callbacks_.push(function childCleanup(rootScope) {\n const state = child;\n if (!state || !isSameScope(state, rootScope)) {\n return;\n }\n rootScope.mapSetPlugin_?.fixSetContents(state);\n const finalizedValue = getFinalValue(state);\n updateDraftInParent(parent, state.draft_ ?? state, finalizedValue, key);\n generatePatchesAndFinalize(state, rootScope);\n });\n}\nfunction generatePatchesAndFinalize(state, rootScope) {\n const shouldFinalize = state.modified_ && !state.finalized_ && (state.type_ === 3 /* Set */ || state.type_ === 1 /* Array */ && state.allIndicesReassigned_ || (state.assigned_?.size ?? 0) > 0);\n if (shouldFinalize) {\n const { patchPlugin_ } = rootScope;\n if (patchPlugin_) {\n const basePath = patchPlugin_.getPath(state);\n if (basePath) {\n patchPlugin_.generatePatches_(state, basePath, rootScope);\n }\n }\n markStateFinalized(state);\n }\n}\nfunction handleCrossReference(target, key, value) {\n const { scope_ } = target;\n if (isDraft(value)) {\n const state = value[DRAFT_STATE];\n if (isSameScope(state, scope_)) {\n state.callbacks_.push(function crossReferenceCleanup() {\n prepareCopy(target);\n const finalizedValue = getFinalValue(state);\n updateDraftInParent(target, value, finalizedValue, key);\n });\n }\n } else if (isDraftable(value)) {\n target.callbacks_.push(function nestedDraftCleanup() {\n const targetCopy = latest(target);\n if (target.type_ === 3 /* Set */) {\n if (targetCopy.has(value)) {\n handleValue(value, scope_.handledSet_, scope_);\n }\n } else {\n if (get(targetCopy, key, target.type_) === value) {\n if (scope_.drafts_.length > 1 && (target.assigned_.get(key) ?? false) === true && target.copy_) {\n handleValue(\n get(target.copy_, key, target.type_),\n scope_.handledSet_,\n scope_\n );\n }\n }\n }\n });\n }\n}\nfunction handleValue(target, handledSet, rootScope) {\n if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {\n return target;\n }\n if (isDraft(target) || handledSet.has(target) || !isDraftable(target) || isFrozen(target)) {\n return target;\n }\n handledSet.add(target);\n each(target, (key, value) => {\n if (isDraft(value)) {\n const state = value[DRAFT_STATE];\n if (isSameScope(state, rootScope)) {\n const updatedValue = getFinalValue(state);\n set(target, key, updatedValue, target.type_);\n markStateFinalized(state);\n }\n } else if (isDraftable(value)) {\n handleValue(value, handledSet, rootScope);\n }\n });\n return target;\n}\n\n// src/core/proxy.ts\nfunction createProxyProxy(base, parent) {\n const baseIsArray = isArray(base);\n const state = {\n type_: baseIsArray ? 1 /* Array */ : 0 /* Object */,\n // Track which produce call this is associated with.\n scope_: parent ? parent.scope_ : getCurrentScope(),\n // True for both shallow and deep changes.\n modified_: false,\n // Used during finalization.\n finalized_: false,\n // Track which properties have been assigned (true) or deleted (false).\n // actually instantiated in `prepareCopy()`\n assigned_: void 0,\n // The parent draft state.\n parent_: parent,\n // The base state.\n base_: base,\n // The base proxy.\n draft_: null,\n // set below\n // The base copy with any updated values.\n copy_: null,\n // Called by the `produce` function.\n revoke_: null,\n isManual_: false,\n // `callbacks` actually gets assigned in `createProxy`\n callbacks_: void 0\n };\n let target = state;\n let traps = objectTraps;\n if (baseIsArray) {\n target = [state];\n traps = arrayTraps;\n }\n const { revoke, proxy } = Proxy.revocable(target, traps);\n state.draft_ = proxy;\n state.revoke_ = revoke;\n return [proxy, state];\n}\nvar objectTraps = {\n get(state, prop) {\n if (prop === DRAFT_STATE)\n return state;\n let arrayPlugin = state.scope_.arrayMethodsPlugin_;\n const isArrayWithStringProp = state.type_ === 1 /* Array */ && typeof prop === \"string\";\n if (isArrayWithStringProp) {\n if (arrayPlugin?.isArrayOperationMethod(prop)) {\n return arrayPlugin.createMethodInterceptor(state, prop);\n }\n }\n const source = latest(state);\n if (!has(source, prop, state.type_)) {\n return readPropFromProto(state, source, prop);\n }\n const value = source[prop];\n if (state.finalized_ || !isDraftable(value)) {\n return value;\n }\n if (isArrayWithStringProp && state.operationMethod && arrayPlugin?.isMutatingArrayMethod(\n state.operationMethod\n ) && isArrayIndex(prop)) {\n return value;\n }\n if (value === peek(state.base_, prop)) {\n prepareCopy(state);\n const childKey = state.type_ === 1 /* Array */ ? +prop : prop;\n const childDraft = createProxy(state.scope_, value, state, childKey);\n return state.copy_[childKey] = childDraft;\n }\n return value;\n },\n has(state, prop) {\n return prop in latest(state);\n },\n ownKeys(state) {\n return Reflect.ownKeys(latest(state));\n },\n set(state, prop, value) {\n const desc = getDescriptorFromProto(latest(state), prop);\n if (desc?.set) {\n desc.set.call(state.draft_, value);\n return true;\n }\n if (!state.modified_) {\n const current2 = peek(latest(state), prop);\n const currentState = current2?.[DRAFT_STATE];\n if (currentState && currentState.base_ === value) {\n state.copy_[prop] = value;\n state.assigned_.set(prop, false);\n return true;\n }\n if (is(value, current2) && (value !== void 0 || has(state.base_, prop, state.type_)))\n return true;\n prepareCopy(state);\n markChanged(state);\n }\n if (state.copy_[prop] === value && // special case: handle new props with value 'undefined'\n (value !== void 0 || prop in state.copy_) || // special case: NaN\n Number.isNaN(value) && Number.isNaN(state.copy_[prop]))\n return true;\n state.copy_[prop] = value;\n state.assigned_.set(prop, true);\n handleCrossReference(state, prop, value);\n return true;\n },\n deleteProperty(state, prop) {\n prepareCopy(state);\n if (peek(state.base_, prop) !== void 0 || prop in state.base_) {\n state.assigned_.set(prop, false);\n markChanged(state);\n } else {\n state.assigned_.delete(prop);\n }\n if (state.copy_) {\n delete state.copy_[prop];\n }\n return true;\n },\n // Note: We never coerce `desc.value` into an Immer draft, because we can't make\n // the same guarantee in ES5 mode.\n getOwnPropertyDescriptor(state, prop) {\n const owner = latest(state);\n const desc = Reflect.getOwnPropertyDescriptor(owner, prop);\n if (!desc)\n return desc;\n return {\n [WRITABLE]: true,\n [CONFIGURABLE]: state.type_ !== 1 /* Array */ || prop !== \"length\",\n [ENUMERABLE]: desc[ENUMERABLE],\n [VALUE]: owner[prop]\n };\n },\n defineProperty() {\n die(11);\n },\n getPrototypeOf(state) {\n return getPrototypeOf(state.base_);\n },\n setPrototypeOf() {\n die(12);\n }\n};\nvar arrayTraps = {};\nfor (let key in objectTraps) {\n let fn = objectTraps[key];\n arrayTraps[key] = function() {\n const args = arguments;\n args[0] = args[0][0];\n return fn.apply(this, args);\n };\n}\narrayTraps.deleteProperty = function(state, prop) {\n if (process.env.NODE_ENV !== \"production\" && isNaN(parseInt(prop)))\n die(13);\n return arrayTraps.set.call(this, state, prop, void 0);\n};\narrayTraps.set = function(state, prop, value) {\n if (process.env.NODE_ENV !== \"production\" && prop !== \"length\" && isNaN(parseInt(prop)))\n die(14);\n return objectTraps.set.call(this, state[0], prop, value, state[0]);\n};\nfunction peek(draft, prop) {\n const state = draft[DRAFT_STATE];\n const source = state ? latest(state) : draft;\n return source[prop];\n}\nfunction readPropFromProto(state, source, prop) {\n const desc = getDescriptorFromProto(source, prop);\n return desc ? VALUE in desc ? desc[VALUE] : (\n // This is a very special case, if the prop is a getter defined by the\n // prototype, we should invoke it with the draft as context!\n desc.get?.call(state.draft_)\n ) : void 0;\n}\nfunction getDescriptorFromProto(source, prop) {\n if (!(prop in source))\n return void 0;\n let proto = getPrototypeOf(source);\n while (proto) {\n const desc = Object.getOwnPropertyDescriptor(proto, prop);\n if (desc)\n return desc;\n proto = getPrototypeOf(proto);\n }\n return void 0;\n}\nfunction markChanged(state) {\n if (!state.modified_) {\n state.modified_ = true;\n if (state.parent_) {\n markChanged(state.parent_);\n }\n }\n}\nfunction prepareCopy(state) {\n if (!state.copy_) {\n state.assigned_ = /* @__PURE__ */ new Map();\n state.copy_ = shallowCopy(\n state.base_,\n state.scope_.immer_.useStrictShallowCopy_\n );\n }\n}\n\n// src/core/immerClass.ts\nvar Immer2 = class {\n constructor(config) {\n this.autoFreeze_ = true;\n this.useStrictShallowCopy_ = false;\n this.useStrictIteration_ = false;\n /**\n * The `produce` function takes a value and a \"recipe function\" (whose\n * return value often depends on the base state). The recipe function is\n * free to mutate its first argument however it wants. All mutations are\n * only ever applied to a __copy__ of the base state.\n *\n * Pass only a function to create a \"curried producer\" which relieves you\n * from passing the recipe function every time.\n *\n * Only plain objects and arrays are made mutable. All other objects are\n * considered uncopyable.\n *\n * Note: This function is __bound__ to its `Immer` instance.\n *\n * @param {any} base - the initial state\n * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified\n * @param {Function} patchListener - optional function that will be called with all the patches produced here\n * @returns {any} a new state, or the initial state if nothing was modified\n */\n this.produce = (base, recipe, patchListener) => {\n if (isFunction(base) && !isFunction(recipe)) {\n const defaultBase = recipe;\n recipe = base;\n const self = this;\n return function curriedProduce(base2 = defaultBase, ...args) {\n return self.produce(base2, (draft) => recipe.call(this, draft, ...args));\n };\n }\n if (!isFunction(recipe))\n die(6);\n if (patchListener !== void 0 && !isFunction(patchListener))\n die(7);\n let result;\n if (isDraftable(base)) {\n const scope = enterScope(this);\n const proxy = createProxy(scope, base, void 0);\n let hasError = true;\n try {\n result = recipe(proxy);\n hasError = false;\n } finally {\n if (hasError)\n revokeScope(scope);\n else\n leaveScope(scope);\n }\n usePatchesInScope(scope, patchListener);\n return processResult(result, scope);\n } else if (!base || !isObjectish(base)) {\n result = recipe(base);\n if (result === void 0)\n result = base;\n if (result === NOTHING)\n result = void 0;\n if (this.autoFreeze_)\n freeze(result, true);\n if (patchListener) {\n const p = [];\n const ip = [];\n getPlugin(PluginPatches).generateReplacementPatches_(base, result, {\n patches_: p,\n inversePatches_: ip\n });\n patchListener(p, ip);\n }\n return result;\n } else\n die(1, base);\n };\n this.produceWithPatches = (base, recipe) => {\n if (isFunction(base)) {\n return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));\n }\n let patches, inversePatches;\n const result = this.produce(base, recipe, (p, ip) => {\n patches = p;\n inversePatches = ip;\n });\n return [result, patches, inversePatches];\n };\n if (isBoolean(config?.autoFreeze))\n this.setAutoFreeze(config.autoFreeze);\n if (isBoolean(config?.useStrictShallowCopy))\n this.setUseStrictShallowCopy(config.useStrictShallowCopy);\n if (isBoolean(config?.useStrictIteration))\n this.setUseStrictIteration(config.useStrictIteration);\n }\n createDraft(base) {\n if (!isDraftable(base))\n die(8);\n if (isDraft(base))\n base = current(base);\n const scope = enterScope(this);\n const proxy = createProxy(scope, base, void 0);\n proxy[DRAFT_STATE].isManual_ = true;\n leaveScope(scope);\n return proxy;\n }\n finishDraft(draft, patchListener) {\n const state = draft && draft[DRAFT_STATE];\n if (!state || !state.isManual_)\n die(9);\n const { scope_: scope } = state;\n usePatchesInScope(scope, patchListener);\n return processResult(void 0, scope);\n }\n /**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * By default, auto-freezing is enabled.\n */\n setAutoFreeze(value) {\n this.autoFreeze_ = value;\n }\n /**\n * Pass true to enable strict shallow copy.\n *\n * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n */\n setUseStrictShallowCopy(value) {\n this.useStrictShallowCopy_ = value;\n }\n /**\n * Pass false to use faster iteration that skips non-enumerable properties\n * but still handles symbols for compatibility.\n *\n * By default, strict iteration is enabled (includes all own properties).\n */\n setUseStrictIteration(value) {\n this.useStrictIteration_ = value;\n }\n shouldUseStrictIteration() {\n return this.useStrictIteration_;\n }\n applyPatches(base, patches) {\n let i;\n for (i = patches.length - 1; i >= 0; i--) {\n const patch = patches[i];\n if (patch.path.length === 0 && patch.op === \"replace\") {\n base = patch.value;\n break;\n }\n }\n if (i > -1) {\n patches = patches.slice(i + 1);\n }\n const applyPatchesImpl = getPlugin(PluginPatches).applyPatches_;\n if (isDraft(base)) {\n return applyPatchesImpl(base, patches);\n }\n return this.produce(\n base,\n (draft) => applyPatchesImpl(draft, patches)\n );\n }\n};\nfunction createProxy(rootScope, value, parent, key) {\n const [draft, state] = isMap(value) ? getPlugin(PluginMapSet).proxyMap_(value, parent) : isSet(value) ? getPlugin(PluginMapSet).proxySet_(value, parent) : createProxyProxy(value, parent);\n const scope = parent?.scope_ ?? getCurrentScope();\n scope.drafts_.push(draft);\n state.callbacks_ = parent?.callbacks_ ?? [];\n state.key_ = key;\n if (parent && key !== void 0) {\n registerChildFinalizationCallback(parent, state, key);\n } else {\n state.callbacks_.push(function rootDraftCleanup(rootScope2) {\n rootScope2.mapSetPlugin_?.fixSetContents(state);\n const { patchPlugin_ } = rootScope2;\n if (state.modified_ && patchPlugin_) {\n patchPlugin_.generatePatches_(state, [], rootScope2);\n }\n });\n }\n return draft;\n}\n\n// src/core/current.ts\nfunction current(value) {\n if (!isDraft(value))\n die(10, value);\n return currentImpl(value);\n}\nfunction currentImpl(value) {\n if (!isDraftable(value) || isFrozen(value))\n return value;\n const state = value[DRAFT_STATE];\n let copy;\n let strict = true;\n if (state) {\n if (!state.modified_)\n return state.base_;\n state.finalized_ = true;\n copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);\n strict = state.scope_.immer_.shouldUseStrictIteration();\n } else {\n copy = shallowCopy(value, true);\n }\n each(\n copy,\n (key, childValue) => {\n set(copy, key, currentImpl(childValue));\n },\n strict\n );\n if (state) {\n state.finalized_ = false;\n }\n return copy;\n}\n\n// src/plugins/patches.ts\nfunction enablePatches() {\n const errorOffset = 16;\n if (process.env.NODE_ENV !== \"production\") {\n errors.push(\n 'Sets cannot have \"replace\" patches.',\n function(op) {\n return \"Unsupported patch operation: \" + op;\n },\n function(path) {\n return \"Cannot apply patch, path doesn't resolve: \" + path;\n },\n \"Patching reserved attributes like __proto__, prototype and constructor is not allowed\"\n );\n }\n function getPath(state, path = []) {\n if (state.key_ !== void 0) {\n const parentCopy = state.parent_.copy_ ?? state.parent_.base_;\n const proxyDraft = getProxyDraft(get(parentCopy, state.key_));\n const valueAtKey = get(parentCopy, state.key_);\n if (valueAtKey === void 0) {\n return null;\n }\n if (valueAtKey !== state.draft_ && valueAtKey !== state.base_ && valueAtKey !== state.copy_) {\n return null;\n }\n if (proxyDraft != null && proxyDraft.base_ !== state.base_) {\n return null;\n }\n const isSet2 = state.parent_.type_ === 3 /* Set */;\n let key;\n if (isSet2) {\n const setParent = state.parent_;\n key = Array.from(setParent.drafts_.keys()).indexOf(state.key_);\n } else {\n key = state.key_;\n }\n if (!(isSet2 && parentCopy.size > key || has(parentCopy, key))) {\n return null;\n }\n path.push(key);\n }\n if (state.parent_) {\n return getPath(state.parent_, path);\n }\n path.reverse();\n try {\n resolvePath(state.copy_, path);\n } catch (e) {\n return null;\n }\n return path;\n }\n function resolvePath(base, path) {\n let current2 = base;\n for (let i = 0; i < path.length - 1; i++) {\n const key = path[i];\n current2 = get(current2, key);\n if (!isObjectish(current2) || current2 === null) {\n throw new Error(`Cannot resolve path at '${path.join(\"/\")}'`);\n }\n }\n return current2;\n }\n const REPLACE = \"replace\";\n const ADD = \"add\";\n const REMOVE = \"remove\";\n function generatePatches_(state, basePath, scope) {\n if (state.scope_.processedForPatches_.has(state)) {\n return;\n }\n state.scope_.processedForPatches_.add(state);\n const { patches_, inversePatches_ } = scope;\n switch (state.type_) {\n case 0 /* Object */:\n case 2 /* Map */:\n return generatePatchesFromAssigned(\n state,\n basePath,\n patches_,\n inversePatches_\n );\n case 1 /* Array */:\n return generateArrayPatches(\n state,\n basePath,\n patches_,\n inversePatches_\n );\n case 3 /* Set */:\n return generateSetPatches(\n state,\n basePath,\n patches_,\n inversePatches_\n );\n }\n }\n function generateArrayPatches(state, basePath, patches, inversePatches) {\n let { base_, assigned_ } = state;\n let copy_ = state.copy_;\n if (copy_.length < base_.length) {\n ;\n [base_, copy_] = [copy_, base_];\n [patches, inversePatches] = [inversePatches, patches];\n }\n const allReassigned = state.allIndicesReassigned_ === true;\n for (let i = 0; i < base_.length; i++) {\n const copiedItem = copy_[i];\n const baseItem = base_[i];\n const isAssigned = allReassigned || assigned_?.get(i.toString());\n if (isAssigned && copiedItem !== baseItem) {\n const childState = copiedItem?.[DRAFT_STATE];\n if (childState && childState.modified_) {\n continue;\n }\n const path = basePath.concat([i]);\n patches.push({\n op: REPLACE,\n path,\n // Need to maybe clone it, as it can in fact be the original value\n // due to the base/copy inversion at the start of this function\n value: clonePatchValueIfNeeded(copiedItem)\n });\n inversePatches.push({\n op: REPLACE,\n path,\n value: clonePatchValueIfNeeded(baseItem)\n });\n }\n }\n for (let i = base_.length; i < copy_.length; i++) {\n const path = basePath.concat([i]);\n patches.push({\n op: ADD,\n path,\n // Need to maybe clone it, as it can in fact be the original value\n // due to the base/copy inversion at the start of this function\n value: clonePatchValueIfNeeded(copy_[i])\n });\n }\n for (let i = copy_.length - 1; base_.length <= i; --i) {\n const path = basePath.concat([i]);\n inversePatches.push({\n op: REMOVE,\n path\n });\n }\n }\n function generatePatchesFromAssigned(state, basePath, patches, inversePatches) {\n const { base_, copy_, type_ } = state;\n each(state.assigned_, (key, assignedValue) => {\n const origValue = get(base_, key, type_);\n const value = get(copy_, key, type_);\n const op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD;\n if (origValue === value && op === REPLACE)\n return;\n const path = basePath.concat(key);\n patches.push(\n op === REMOVE ? { op, path } : { op, path, value: clonePatchValueIfNeeded(value) }\n );\n inversePatches.push(\n op === ADD ? { op: REMOVE, path } : op === REMOVE ? { op: ADD, path, value: clonePatchValueIfNeeded(origValue) } : { op: REPLACE, path, value: clonePatchValueIfNeeded(origValue) }\n );\n });\n }\n function generateSetPatches(state, basePath, patches, inversePatches) {\n let { base_, copy_ } = state;\n let i = 0;\n base_.forEach((value) => {\n if (!copy_.has(value)) {\n const path = basePath.concat([i]);\n patches.push({\n op: REMOVE,\n path,\n value\n });\n inversePatches.unshift({\n op: ADD,\n path,\n value\n });\n }\n i++;\n });\n i = 0;\n copy_.forEach((value) => {\n if (!base_.has(value)) {\n const path = basePath.concat([i]);\n patches.push({\n op: ADD,\n path,\n value\n });\n inversePatches.unshift({\n op: REMOVE,\n path,\n value\n });\n }\n i++;\n });\n }\n function generateReplacementPatches_(baseValue, replacement, scope) {\n const { patches_, inversePatches_ } = scope;\n patches_.push({\n op: REPLACE,\n path: [],\n value: replacement === NOTHING ? void 0 : replacement\n });\n inversePatches_.push({\n op: REPLACE,\n path: [],\n value: baseValue\n });\n }\n function applyPatches_(draft, patches) {\n patches.forEach((patch) => {\n const { path, op } = patch;\n let base = draft;\n for (let i = 0; i < path.length - 1; i++) {\n const parentType = getArchtype(base);\n let p = path[i];\n if (typeof p !== \"string\" && typeof p !== \"number\") {\n p = \"\" + p;\n }\n if ((parentType === 0 /* Object */ || parentType === 1 /* Array */) && (p === \"__proto__\" || p === CONSTRUCTOR))\n die(errorOffset + 3);\n if (isFunction(base) && p === PROTOTYPE)\n die(errorOffset + 3);\n base = get(base, p);\n if (!isObjectish(base))\n die(errorOffset + 2, path.join(\"/\"));\n }\n const type = getArchtype(base);\n const value = deepClonePatchValue(patch.value);\n const key = path[path.length - 1];\n switch (op) {\n case REPLACE:\n switch (type) {\n case 2 /* Map */:\n return base.set(key, value);\n case 3 /* Set */:\n die(errorOffset);\n default:\n return base[key] = value;\n }\n case ADD:\n switch (type) {\n case 1 /* Array */:\n return key === \"-\" ? base.push(value) : base.splice(key, 0, value);\n case 2 /* Map */:\n return base.set(key, value);\n case 3 /* Set */:\n return base.add(value);\n default:\n return base[key] = value;\n }\n case REMOVE:\n switch (type) {\n case 1 /* Array */:\n return base.splice(key, 1);\n case 2 /* Map */:\n return base.delete(key);\n case 3 /* Set */:\n return base.delete(patch.value);\n default:\n return delete base[key];\n }\n default:\n die(errorOffset + 1, op);\n }\n });\n return draft;\n }\n function deepClonePatchValue(obj) {\n if (!isDraftable(obj))\n return obj;\n if (isArray(obj))\n return obj.map(deepClonePatchValue);\n if (isMap(obj))\n return new Map(\n Array.from(obj.entries()).map(([k, v]) => [k, deepClonePatchValue(v)])\n );\n if (isSet(obj))\n return new Set(Array.from(obj).map(deepClonePatchValue));\n const cloned = Object.create(getPrototypeOf(obj));\n for (const key in obj)\n cloned[key] = deepClonePatchValue(obj[key]);\n if (has(obj, DRAFTABLE))\n cloned[DRAFTABLE] = obj[DRAFTABLE];\n return cloned;\n }\n function clonePatchValueIfNeeded(obj) {\n if (isDraft(obj)) {\n return deepClonePatchValue(obj);\n } else\n return obj;\n }\n loadPlugin(PluginPatches, {\n applyPatches_,\n generatePatches_,\n generateReplacementPatches_,\n getPath\n });\n}\n\n// src/plugins/mapset.ts\nfunction enableMapSet() {\n class DraftMap extends Map {\n constructor(target, parent) {\n super();\n this[DRAFT_STATE] = {\n type_: 2 /* Map */,\n parent_: parent,\n scope_: parent ? parent.scope_ : getCurrentScope(),\n modified_: false,\n finalized_: false,\n copy_: void 0,\n assigned_: void 0,\n base_: target,\n draft_: this,\n isManual_: false,\n revoked_: false,\n callbacks_: []\n };\n }\n get size() {\n return latest(this[DRAFT_STATE]).size;\n }\n has(key) {\n return latest(this[DRAFT_STATE]).has(key);\n }\n set(key, value) {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n if (!latest(state).has(key) || latest(state).get(key) !== value) {\n prepareMapCopy(state);\n markChanged(state);\n state.assigned_.set(key, true);\n state.copy_.set(key, value);\n state.assigned_.set(key, true);\n handleCrossReference(state, key, value);\n }\n return this;\n }\n delete(key) {\n if (!this.has(key)) {\n return false;\n }\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n prepareMapCopy(state);\n markChanged(state);\n if (state.base_.has(key)) {\n state.assigned_.set(key, false);\n } else {\n state.assigned_.delete(key);\n }\n state.copy_.delete(key);\n return true;\n }\n clear() {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n if (latest(state).size) {\n prepareMapCopy(state);\n markChanged(state);\n state.assigned_ = /* @__PURE__ */ new Map();\n each(state.base_, (key) => {\n state.assigned_.set(key, false);\n });\n state.copy_.clear();\n }\n }\n forEach(cb, thisArg) {\n const state = this[DRAFT_STATE];\n latest(state).forEach((_value, key, _map) => {\n cb.call(thisArg, this.get(key), key, this);\n });\n }\n get(key) {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n const value = latest(state).get(key);\n if (state.finalized_ || !isDraftable(value)) {\n return value;\n }\n if (value !== state.base_.get(key)) {\n return value;\n }\n const draft = createProxy(state.scope_, value, state, key);\n prepareMapCopy(state);\n state.copy_.set(key, draft);\n return draft;\n }\n keys() {\n return latest(this[DRAFT_STATE]).keys();\n }\n values() {\n const iterator = this.keys();\n return {\n [Symbol.iterator]: () => this.values(),\n next: () => {\n const r = iterator.next();\n if (r.done)\n return r;\n const value = this.get(r.value);\n return {\n done: false,\n value\n };\n }\n };\n }\n entries() {\n const iterator = this.keys();\n return {\n [Symbol.iterator]: () => this.entries(),\n next: () => {\n const r = iterator.next();\n if (r.done)\n return r;\n const value = this.get(r.value);\n return {\n done: false,\n value: [r.value, value]\n };\n }\n };\n }\n [(DRAFT_STATE, Symbol.iterator)]() {\n return this.entries();\n }\n }\n function proxyMap_(target, parent) {\n const map = new DraftMap(target, parent);\n return [map, map[DRAFT_STATE]];\n }\n function prepareMapCopy(state) {\n if (!state.copy_) {\n state.assigned_ = /* @__PURE__ */ new Map();\n state.copy_ = new Map(state.base_);\n }\n }\n class DraftSet extends Set {\n constructor(target, parent) {\n super();\n this[DRAFT_STATE] = {\n type_: 3 /* Set */,\n parent_: parent,\n scope_: parent ? parent.scope_ : getCurrentScope(),\n modified_: false,\n finalized_: false,\n copy_: void 0,\n base_: target,\n draft_: this,\n drafts_: /* @__PURE__ */ new Map(),\n revoked_: false,\n isManual_: false,\n assigned_: void 0,\n callbacks_: []\n };\n }\n get size() {\n return latest(this[DRAFT_STATE]).size;\n }\n has(value) {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n if (!state.copy_) {\n return state.base_.has(value);\n }\n if (state.copy_.has(value))\n return true;\n if (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value)))\n return true;\n return false;\n }\n add(value) {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n if (!this.has(value)) {\n prepareSetCopy(state);\n markChanged(state);\n state.copy_.add(value);\n handleCrossReference(state, value, value);\n }\n return this;\n }\n delete(value) {\n if (!this.has(value)) {\n return false;\n }\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n prepareSetCopy(state);\n markChanged(state);\n return state.copy_.delete(value) || (state.drafts_.has(value) ? state.copy_.delete(state.drafts_.get(value)) : (\n /* istanbul ignore next */\n false\n ));\n }\n clear() {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n if (latest(state).size) {\n prepareSetCopy(state);\n markChanged(state);\n state.copy_.clear();\n }\n }\n values() {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n prepareSetCopy(state);\n return state.copy_.values();\n }\n entries() {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n prepareSetCopy(state);\n return state.copy_.entries();\n }\n keys() {\n return this.values();\n }\n [(DRAFT_STATE, Symbol.iterator)]() {\n return this.values();\n }\n forEach(cb, thisArg) {\n const iterator = this.values();\n let result = iterator.next();\n while (!result.done) {\n cb.call(thisArg, result.value, result.value, this);\n result = iterator.next();\n }\n }\n }\n function proxySet_(target, parent) {\n const set2 = new DraftSet(target, parent);\n return [set2, set2[DRAFT_STATE]];\n }\n function prepareSetCopy(state) {\n if (!state.copy_) {\n state.copy_ = /* @__PURE__ */ new Set();\n state.base_.forEach((value) => {\n if (isDraftable(value)) {\n const draft = createProxy(state.scope_, value, state, value);\n state.drafts_.set(value, draft);\n state.copy_.add(draft);\n } else {\n state.copy_.add(value);\n }\n });\n }\n }\n function assertUnrevoked(state) {\n if (state.revoked_)\n die(3, JSON.stringify(latest(state)));\n }\n function fixSetContents(target) {\n if (target.type_ === 3 /* Set */ && target.copy_) {\n const copy = new Set(target.copy_);\n target.copy_.clear();\n copy.forEach((value) => {\n target.copy_.add(getValue(value));\n });\n }\n }\n loadPlugin(PluginMapSet, { proxyMap_, proxySet_, fixSetContents });\n}\n\n// src/plugins/arrayMethods.ts\nfunction enableArrayMethods() {\n const SHIFTING_METHODS = /* @__PURE__ */ new Set([\"shift\", \"unshift\"]);\n const QUEUE_METHODS = /* @__PURE__ */ new Set([\"push\", \"pop\"]);\n const RESULT_RETURNING_METHODS = /* @__PURE__ */ new Set([\n ...QUEUE_METHODS,\n ...SHIFTING_METHODS\n ]);\n const REORDERING_METHODS = /* @__PURE__ */ new Set([\"reverse\", \"sort\"]);\n const MUTATING_METHODS = /* @__PURE__ */ new Set([\n ...RESULT_RETURNING_METHODS,\n ...REORDERING_METHODS,\n \"splice\"\n ]);\n const FIND_METHODS = /* @__PURE__ */ new Set([\"find\", \"findLast\"]);\n const NON_MUTATING_METHODS = /* @__PURE__ */ new Set([\n \"filter\",\n \"slice\",\n \"concat\",\n \"flat\",\n ...FIND_METHODS,\n \"findIndex\",\n \"findLastIndex\",\n \"some\",\n \"every\",\n \"indexOf\",\n \"lastIndexOf\",\n \"includes\",\n \"join\",\n \"toString\",\n \"toLocaleString\"\n ]);\n function isMutatingArrayMethod(method) {\n return MUTATING_METHODS.has(method);\n }\n function isNonMutatingArrayMethod(method) {\n return NON_MUTATING_METHODS.has(method);\n }\n function isArrayOperationMethod(method) {\n return isMutatingArrayMethod(method) || isNonMutatingArrayMethod(method);\n }\n function enterOperation(state, method) {\n state.operationMethod = method;\n }\n function exitOperation(state) {\n state.operationMethod = void 0;\n }\n function executeArrayMethod(state, operation, markLength = true) {\n prepareCopy(state);\n const result = operation();\n markChanged(state);\n if (markLength)\n state.assigned_.set(\"length\", true);\n return result;\n }\n function markAllIndicesReassigned(state) {\n state.allIndicesReassigned_ = true;\n }\n function normalizeSliceIndex(index, length) {\n if (index < 0) {\n return Math.max(length + index, 0);\n }\n return Math.min(index, length);\n }\n function handleInsertedValues(state, startIndex, values) {\n for (let i = 0; i < values.length; i++) {\n const index = startIndex + i;\n state.assigned_.set(index, true);\n handleCrossReference(state, index, values[i]);\n }\n }\n function handleSimpleOperation(state, method, args) {\n return executeArrayMethod(state, () => {\n const lengthBefore = state.copy_.length;\n const result = state.copy_[method](...args);\n if (SHIFTING_METHODS.has(method)) {\n markAllIndicesReassigned(state);\n }\n if (method === \"push\" && args.length > 0) {\n handleInsertedValues(state, lengthBefore, args);\n } else if (method === \"unshift\" && args.length > 0) {\n handleInsertedValues(state, 0, args);\n }\n return RESULT_RETURNING_METHODS.has(method) ? result : state.draft_;\n });\n }\n function handleReorderingOperation(state, method, args) {\n return executeArrayMethod(\n state,\n () => {\n ;\n state.copy_[method](...args);\n markAllIndicesReassigned(state);\n return state.draft_;\n },\n false\n );\n }\n function createMethodInterceptor(state, originalMethod) {\n return function interceptedMethod(...args) {\n const method = originalMethod;\n enterOperation(state, method);\n try {\n if (isMutatingArrayMethod(method)) {\n if (RESULT_RETURNING_METHODS.has(method)) {\n return handleSimpleOperation(state, method, args);\n }\n if (REORDERING_METHODS.has(method)) {\n return handleReorderingOperation(state, method, args);\n }\n if (method === \"splice\") {\n const res = executeArrayMethod(\n state,\n () => state.copy_.splice(...args)\n );\n markAllIndicesReassigned(state);\n if (args.length > 2) {\n const startIndex = normalizeSliceIndex(\n args[0] ?? 0,\n state.copy_.length\n );\n handleInsertedValues(state, startIndex, args.slice(2));\n }\n return res;\n }\n } else {\n return handleNonMutatingOperation(state, method, args);\n }\n } finally {\n exitOperation(state);\n }\n };\n }\n function handleNonMutatingOperation(state, method, args) {\n const source = latest(state);\n if (method === \"filter\") {\n const predicate = args[0];\n const result = [];\n for (let i = 0; i < source.length; i++) {\n if (predicate(source[i], i, source)) {\n result.push(state.draft_[i]);\n }\n }\n return result;\n }\n if (FIND_METHODS.has(method)) {\n const predicate = args[0];\n const isForward = method === \"find\";\n const step = isForward ? 1 : -1;\n const start = isForward ? 0 : source.length - 1;\n for (let i = start; i >= 0 && i < source.length; i += step) {\n if (predicate(source[i], i, source)) {\n return state.draft_[i];\n }\n }\n return void 0;\n }\n if (method === \"slice\") {\n const rawStart = args[0] ?? 0;\n const rawEnd = args[1] ?? source.length;\n const start = normalizeSliceIndex(rawStart, source.length);\n const end = normalizeSliceIndex(rawEnd, source.length);\n const result = [];\n for (let i = start; i < end; i++) {\n result.push(state.draft_[i]);\n }\n return result;\n }\n return source[method](...args);\n }\n loadPlugin(PluginArrayMethods, {\n createMethodInterceptor,\n isArrayOperationMethod,\n isMutatingArrayMethod\n });\n}\n\n// src/immer.ts\nvar immer = new Immer2();\nvar produce = immer.produce;\nvar produceWithPatches = /* @__PURE__ */ immer.produceWithPatches.bind(\n immer\n);\nvar setAutoFreeze = /* @__PURE__ */ immer.setAutoFreeze.bind(immer);\nvar setUseStrictShallowCopy = /* @__PURE__ */ immer.setUseStrictShallowCopy.bind(\n immer\n);\nvar setUseStrictIteration = /* @__PURE__ */ immer.setUseStrictIteration.bind(\n immer\n);\nvar applyPatches = /* @__PURE__ */ immer.applyPatches.bind(immer);\nvar createDraft = /* @__PURE__ */ immer.createDraft.bind(immer);\nvar finishDraft = /* @__PURE__ */ immer.finishDraft.bind(immer);\nvar castDraft = (value) => value;\nvar castImmutable = (value) => value;\nexport {\n Immer2 as Immer,\n applyPatches,\n castDraft,\n castImmutable,\n createDraft,\n current,\n enableArrayMethods,\n enableMapSet,\n enablePatches,\n finishDraft,\n freeze,\n DRAFTABLE as immerable,\n isDraft,\n isDraftable,\n NOTHING as nothing,\n original,\n produce,\n produceWithPatches,\n setAutoFreeze,\n setUseStrictIteration,\n setUseStrictShallowCopy\n};\n//# sourceMappingURL=immer.mjs.map","// src/store/types.ts\nimport { Draft } from 'immer'\nimport { BehaviorSubject, Observable, Subject } from 'rxjs'\n\n/**\n * Storage types supported by the store\n */\nexport type StorageType = 'memory' | 'local' | 'session' | 'indexeddb'\n\n/**\n * Base store options\n */\nexport interface StoreOptions<T> {\n\t/** Key used for persistent storage */\n\tkey: string\n\n\t/** Storage type */\n\tstorage: StorageType\n\n\t/** Initial state */\n\tinitialState: T\n\n\t/** Enable dev tools */\n\tdevTools?: boolean\n}\n\n/**\n * Enhanced store error with type information and better context handling\n */\nexport class StoreError<T = unknown> extends Error {\n\t/** Original error that caused this store error */\n\tpublic readonly cause?: T\n\n\t/** Additional contextual information */\n\tpublic readonly context?: Record<string, unknown>\n\n\t/** Timestamp when the error occurred */\n\tpublic readonly timestamp: Date\n\n\tconstructor(message: string, cause?: T, context?: Record<string, unknown>) {\n\t\tsuper(message)\n\t\tthis.name = 'StoreError'\n\t\tthis.cause = cause\n\t\tthis.context = context\n\t\tthis.timestamp = new Date()\n\n\t\t// Capture stack trace if available\n\t\tif (Error.captureStackTrace) {\n\t\t\tError.captureStackTrace(this, StoreError)\n\t\t}\n\t}\n\n\t/**\n\t * Returns a JSON-serializable representation of the error\n\t */\n\ttoJSON(): Record<string, unknown> {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tmessage: this.message,\n\t\t\tcause: this.cause,\n\t\t\tcontext: this.context,\n\t\t\ttimestamp: this.timestamp.toISOString(),\n\t\t\tstack: this.stack,\n\t\t}\n\t}\n}\n\n/**\n * Core store interface with improved type definitions\n */\nexport interface IStore<T extends Record<string, any>> {\n\t/** Get the current store value */\n\treadonly value: T\n\n\t/** Observable stream of store values */\n\treadonly $: BehaviorSubject<T>\n\n\t/** The default/initial value of the store */\n\treadonly defaultValue: T\n\n\t/** Whether the store is ready (loaded from storage) */\n\tready: boolean\n\n\t/** Observable stream of store errors */\n\treadonly error$: Subject<StoreError | null>\n\n\t/**\n\t * Update store value with partial data\n\t * @param value Partial data to update\n\t * @param merge Whether to merge with existing data (default: true)\n\t */\n\tset(value: Partial<T>, merge?: boolean): void\n\n\t/**\n\t * Reset store to default value\n\t */\n\tclear(): void\n\n\t/**\n\t * Replace entire store value\n\t * @param newValue New value to set\n\t */\n\treplace(newValue: T): void\n\n\t/**\n\t * Delete a specific key from the store\n\t * @param key Key to delete\n\t */\n\tdelete<K extends keyof T>(key: K): void\n\n\t/**\n\t * Clean up resources\n\t */\n\tdestroy(): void\n}\n\n/**\n * Interface for collection stores with improved typing\n */\nexport interface ICollectionStore<T> {\n\t/** Get the current collection value */\n\treadonly value: Map<string, T>\n\n\t/** Observable stream of collection values */\n\treadonly $: BehaviorSubject<Map<string, T>>\n\n\t/** The default/initial value of the collection */\n\treadonly defaultValue: Map<string, T>\n\n\t/** Whether the store is ready (loaded from storage) */\n\tready: boolean\n\n\t/** Observable stream of store errors */\n\treadonly error$: Observable<StoreError | null>\n\n\t/**\n\t * Set a value in the collection\n\t * @param key Item key\n\t * @param value Item value\n\t */\n\tset<V = T>(key: string, value: V): void\n\n\t/**\n\t * Delete an item from the collection\n\t * @param key Item key to delete\n\t */\n\tdelete(key: string): void\n\n\t/**\n\t * Clear all items from the collection\n\t */\n\tclear(): void\n\n\t/**\n\t * Replace the entire collection\n\t * @param newValue New collection value\n\t */\n\treplace(newValue: Map<string, T>): void\n\n\t/**\n\t * Clean up resources\n\t */\n\tdestroy(): void\n}\n\n/**\n * Interface for a storage manager\n */\nexport interface IStorageManager<T> {\n\t/**\n\t * Load data from storage\n\t * @returns Promise resolving to stored data or null\n\t */\n\tload(): Promise<T | null>\n\n\t/**\n\t * Save data to storage\n\t * @param state Data to save\n\t */\n\tsave(state: T): Promise<void>\n\n\t/**\n\t * Clear data from storage\n\t */\n\tclear(): Promise<void>\n}\n\n/**\n * Factory function type for creating stores\n */\nexport type StoreFactory = <T extends Record<string, any>>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n) => IStore<T>\n\n/**\n * Factory function type for creating collection stores\n */\nexport type CollectionStoreFactory = <T>(\n\tinitialData: Map<string, T>,\n\tstorage: StorageType,\n\tkey: string,\n) => ICollectionStore<T>\n// Add this to your src/store/types.ts file\n\n/**\n * Interface for array stores with improved typing\n */\nexport interface IArrayStore<T> {\n\t/** Get the current array value */\n\treadonly value: T[]\n\n\t/** Observable stream of array values */\n\treadonly $: BehaviorSubject<T[]>\n\n\t/** The default/initial value of the array */\n\treadonly defaultValue: T[]\n\n\t/** Whether the store is ready (loaded from storage) */\n\tready: boolean\n\n\t/** Observable stream of store errors */\n\treadonly error$: Observable<StoreError | null>\n\n\t/**\n\t * Add item(s) to the end of the array\n\t * @param items Items to add\n\t */\n\tpush(...items: T[]): void\n\n\t/**\n\t * Remove and return the last item from the array\n\t * @returns The removed item or undefined if the array was empty\n\t */\n\tpop(): T | undefined\n\n\t/**\n\t * Add item(s) to the beginning of the array\n\t * @param items Items to add\n\t */\n\tunshift(...items: T[]): void\n\n\t/**\n\t * Remove and return the first item from the array\n\t * @returns The removed item or undefined if the array was empty\n\t */\n\tshift(): T | undefined\n\n\t/**\n\t * Update an item at a specific index\n\t * @param index The index to update\n\t * @param value The new value\n\t */\n\tset(index: number, value: T): void\n\n\t/**\n\t * Get the item at a specific index\n\t * @param index The index to get\n\t * @returns The item or undefined if index is out of bounds\n\t */\n\tget(index: number): T | undefined\n\n\t/**\n\t * Remove items from the array and optionally insert new ones\n\t * @param start The start index\n\t * @param deleteCount The number of items to delete\n\t * @param items Items to insert\n\t * @returns The removed items\n\t */\n\tsplice(start: number, deleteCount?: number, ...items: T[]): T[]\n\n\t/**\n\t * Remove an item by value (first occurrence)\n\t * @param item The item to remove\n\t * @param compareFn Optional function to compare items\n\t * @returns True if the item was found and removed\n\t */\n\tremove(item: T, compareFn?: (a: T, b: T) => boolean): boolean\n\n\t/**\n\t * Replace the entire array\n\t * @param newArray The new array\n\t */\n\treplace(newArray: T[]): void\n\n\t/**\n\t * Filter items in the array\n\t * @param predicate Function to test each item\n\t */\n\tfilter(predicate: (value: T, index: number, array: T[]) => boolean): void\n\n\t/**\n\t * Map over the array and transform items\n\t * @param mapper Function to transform each item\n\t * @returns Array of transformed items\n\t */\n\tmap<U>(mapper: (value: T, index: number, array: T[]) => U): U[]\n\n\t/**\n\t * Sort the array in place\n\t * @param compareFn Optional function to determine sort order\n\t */\n\tsort(compareFn?: (a: T, b: T) => number): void\n\n\t/**\n\t * Update a specific item using a callback function\n\t * @param index The index to update\n\t * @param updater Function that can modify the item\n\t */\n\tupdate(index: number, updater: (item: Draft<T>) => void): void\n\n\t/**\n\t * Clear all items from the array\n\t */\n\tclear(): void\n\n\t/**\n\t * Clean up resources\n\t */\n\tdestroy(): void\n}\n\n/**\n * Factory function type for creating array stores\n */\nexport type ArrayStoreFactory = <T>(initialData: T[], storage: StorageType, key: string) => IArrayStore<T>\n","import { IStorageManager, StorageType, StoreError } from './types'\n\n/**\n * Custom JSON replacer to handle Map and Set serialization\n *\n * LIMITATIONS:\n * - Only supports Maps with string/number/primitive keys\n * - Object keys will be stringified and may collide (e.g., {id: 1} and {id: 2} both become \"[object Object]\")\n * - Circular references are not supported (JSON.stringify limitation)\n *\n * @example\n * ```typescript\n * // ✅ Supported\n * new Map([['key', 'value'], [123, 'number-key']])\n *\n * // ❌ Not supported (object keys will become strings)\n * new Map([[{id: 1}, 'value']])\n * ```\n */\nfunction mapSetReplacer(_key: string, value: unknown): unknown {\n\tif (value instanceof Map) {\n\t\treturn {\n\t\t\t__type: 'Map',\n\t\t\tentries: Array.from(value.entries()),\n\t\t}\n\t}\n\tif (value instanceof Set) {\n\t\treturn {\n\t\t\t__type: 'Set',\n\t\t\tvalues: Array.from(value.values()),\n\t\t}\n\t}\n\treturn value\n}\n\n/**\n * Custom JSON reviver to handle Map and Set deserialization\n *\n * Includes validation to prevent malformed data or __type injection attacks.\n * Invalid structures are ignored and returned as-is.\n */\nfunction mapSetReviver(_key: string, value: unknown): unknown {\n\tif (value && typeof value === 'object' && '__type' in value) {\n\t\tconst typed = value as { __type: string; entries?: unknown[]; values?: unknown[] }\n\n\t\t// Validate and reconstruct Map\n\t\tif (typed.__type === 'Map') {\n\t\t\tif (!Array.isArray(typed.entries)) {\n\t\t\t\tconsole.warn('Invalid Map structure in storage (entries not an array), ignoring')\n\t\t\t\treturn value\n\t\t\t}\n\t\t\t// Validate all entries are [key, value] pairs\n\t\t\tconst isValid = typed.entries.every(e => Array.isArray(e) && e.length === 2)\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.warn('Invalid Map structure in storage (malformed entries), ignoring')\n\t\t\t\treturn value\n\t\t\t}\n\t\t\treturn new Map(typed.entries as Iterable<readonly [unknown, unknown]>)\n\t\t}\n\n\t\t// Validate and reconstruct Set\n\t\tif (typed.__type === 'Set') {\n\t\t\tif (!Array.isArray(typed.values)) {\n\t\t\t\tconsole.warn('Invalid Set structure in storage (values not an array), ignoring')\n\t\t\t\treturn value\n\t\t\t}\n\t\t\treturn new Set(typed.values)\n\t\t}\n\n\t\t// Unknown __type marker, log warning and ignore\n\t\tconsole.warn(`Unknown __type \"${typed.__type}\" in storage, ignoring`)\n\t}\n\treturn value\n}\n\n/**\n * Memory storage manager implementation\n */\nexport class MemoryStorageManager<T> implements IStorageManager<T> {\n\tprivate data: T | null = null\n\n\tasync load(): Promise<T | null> {\n\t\treturn this.data\n\t}\n\n\tasync save(state: T): Promise<void> {\n\t\tthis.data = state\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tthis.data = null\n\t}\n}\n\n/**\n * Local storage manager implementation\n */\nexport class LocalStorageManager<T> implements IStorageManager<T> {\n\tconstructor(private key: string) {}\n\n\tasync load(): Promise<T | null> {\n\t\ttry {\n\t\t\tconst data = localStorage.getItem(this.key)\n\t\t\treturn data ? JSON.parse(data, mapSetReviver) : null\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to load from localStorage (${this.key}):`, err)\n\t\t\treturn null\n\t\t}\n\t}\n\n\tasync save(state: T): Promise<void> {\n\t\ttry {\n\t\t\tlocalStorage.setItem(this.key, JSON.stringify(state, mapSetReplacer))\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to save to localStorage (${this.key}):`, err)\n\t\t\tthrow new StoreError<unknown>(`Failed to save to localStorage (${this.key})`, err)\n\t\t}\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tlocalStorage.removeItem(this.key)\n\t}\n}\n\n/**\n * Session storage manager implementation\n */\nexport class SessionStorageManager<T> implements IStorageManager<T> {\n\tconstructor(private key: string) {}\n\n\tasync load(): Promise<T | null> {\n\t\ttry {\n\t\t\tconst data = sessionStorage.getItem(this.key)\n\t\t\treturn data ? JSON.parse(data, mapSetReviver) : null\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to load from sessionStorage (${this.key}):`, err)\n\t\t\treturn null\n\t\t}\n\t}\n\n\tasync save(state: T): Promise<void> {\n\t\ttry {\n\t\t\tsessionStorage.setItem(this.key, JSON.stringify(state, mapSetReplacer))\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to save to sessionStorage (${this.key}):`, err)\n\t\t\tthrow new StoreError<unknown>(`Failed to save to sessionStorage (${this.key})`, err)\n\t\t}\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tsessionStorage.removeItem(this.key)\n\t}\n}\n\n/**\n * IndexedDB storage manager implementation with better error typing\n */\nexport class IndexedDBStorageManager<T> implements IStorageManager<T> {\n\tprivate static DB_NAME = 'StoreDB'\n\tprivate static STORE_NAME = 'states'\n\tprivate static DB_VERSION = 1\n\n\tconstructor(private key: string) {}\n\n\tprivate openDB(): Promise<IDBDatabase> {\n\t\treturn new Promise<IDBDatabase>((resolve, reject) => {\n\t\t\tconst request = indexedDB.open(IndexedDBStorageManager.DB_NAME, IndexedDBStorageManager.DB_VERSION)\n\n\t\t\trequest.onupgradeneeded = () => {\n\t\t\t\tconst db = request.result\n\t\t\t\tif (!db.objectStoreNames.contains(IndexedDBStorageManager.STORE_NAME)) {\n\t\t\t\t\tdb.createObjectStore(IndexedDBStorageManager.STORE_NAME)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trequest.onsuccess = () => resolve(request.result)\n\t\t\trequest.onerror = () => reject(request.error)\n\t\t})\n\t}\n\n\tasync load(): Promise<T | null> {\n\t\ttry {\n\t\t\tconst db = await this.openDB()\n\t\t\treturn new Promise<T | null>((resolve, reject) => {\n\t\t\t\tconst transaction = db.transaction(IndexedDBStorageManager.STORE_NAME, 'readonly')\n\t\t\t\tconst store = transaction.objectStore(IndexedDBStorageManager.STORE_NAME)\n\t\t\t\tconst request = store.get(this.key)\n\n\t\t\t\trequest.onsuccess = () => {\n\t\t\t\t\tdb.close()\n\t\t\t\t\tresolve(request.result || null)\n\t\t\t\t}\n\n\t\t\t\trequest.onerror = () => {\n\t\t\t\t\tdb.close()\n\t\t\t\t\treject(request.error)\n\t\t\t\t}\n\t\t\t})\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to load from IndexedDB (${this.key}):`, err)\n\t\t\treturn null\n\t\t}\n\t}\n\n\tasync save(state: T): Promise<void> {\n\t\ttry {\n\t\t\tconst db = await this.openDB()\n\t\t\treturn new Promise<void>((resolve, reject) => {\n\t\t\t\tconst transaction = db.transaction(IndexedDBStorageManager.STORE_NAME, 'readwrite')\n\t\t\t\tconst store = transaction.objectStore(IndexedDBStorageManager.STORE_NAME)\n\t\t\t\tconst request = store.put(state, this.key)\n\n\t\t\t\trequest.onsuccess = () => {\n\t\t\t\t\tdb.close()\n\t\t\t\t\tresolve()\n\t\t\t\t}\n\n\t\t\t\trequest.onerror = () => {\n\t\t\t\t\tdb.close()\n\t\t\t\t\treject(request.error)\n\t\t\t\t}\n\t\t\t})\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to save to IndexedDB (${this.key}):`, err)\n\t\t\tthrow new StoreError<unknown>(`Failed to save to IndexedDB (${this.key})`, err)\n\t\t}\n\t}\n\n\tasync clear(): Promise<void> {\n\t\ttry {\n\t\t\tconst db = await this.openDB()\n\t\t\treturn new Promise<void>((resolve, reject) => {\n\t\t\t\tconst transaction = db.transaction(IndexedDBStorageManager.STORE_NAME, 'readwrite')\n\t\t\t\tconst store = transaction.objectStore(IndexedDBStorageManager.STORE_NAME)\n\t\t\t\tconst request = store.delete(this.key)\n\n\t\t\t\trequest.onsuccess = () => {\n\t\t\t\t\tdb.close()\n\t\t\t\t\tresolve()\n\t\t\t\t}\n\n\t\t\t\trequest.onerror = () => {\n\t\t\t\t\tdb.close()\n\t\t\t\t\treject(request.error)\n\t\t\t\t}\n\t\t\t})\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to clear from IndexedDB (${this.key}):`, err)\n\t\t\tthrow new StoreError<unknown>(`Failed to clear from IndexedDB (${this.key})`, err)\n\t\t}\n\t}\n}\n\n/**\n * Factory function to create the appropriate storage manager\n */\nexport function createStorageManager<T>(type: StorageType, key: string): IStorageManager<T> {\n\tswitch (type) {\n\t\tcase 'local':\n\t\t\treturn new LocalStorageManager<T>(key)\n\t\tcase 'session':\n\t\t\treturn new SessionStorageManager<T>(key)\n\t\tcase 'indexeddb':\n\t\t\treturn new IndexedDBStorageManager<T>(key)\n\t\tcase 'memory':\n\t\tdefault:\n\t\t\treturn new MemoryStorageManager<T>()\n\t}\n}\n","// src/store/store.class.ts - Fixed version\n\nimport { produce, enableMapSet, immerable } from 'immer'\nimport { BehaviorSubject, Subject } from 'rxjs'\nimport { createStorageManager } from './storage-manager'\nimport { IStorageManager, StorageType, StoreError } from './types'\n\n// Enable Map and Set support for Immer\nenableMapSet()\n\n/**\n * Base store class to handle common functionality between store types\n * Now with Immer integration for immutability\n */\nexport abstract class BaseStore<T> {\n\t// Mark the class as immerable to allow Immer to create drafts\n\t[immerable] = true\n\n\t// State tracking\n\tprotected _ready: boolean = false\n\tprotected _destroy$ = new Subject<void>()\n\n\t// Observable streams\n\tpublic $: BehaviorSubject<T>\n\tpublic error$ = new BehaviorSubject<StoreError | null>(null)\n\n\t// Default value for the store\n\tpublic readonly defaultValue: T\n\n\t// Storage manager\n\tprotected storage: IStorageManager<T>\n\n\t/**\n\t * Get store ready state\n\t */\n\tpublic get ready(): boolean {\n\t\treturn this._ready\n\t}\n\n\t/**\n\t * Set store ready state\n\t */\n\tpublic set ready(value: boolean) {\n\t\tthis._ready = value\n\t\tthis.updateState(this.$.value)\n\t}\n\n\t/**\n\t * Get the current value\n\t */\n\tpublic get value(): T {\n\t\treturn this.$.getValue()\n\t}\n\n\t/**\n\t * Initialize the base store\n\t * @param storageType Storage type to use\n\t * @param key Unique key for the store\n\t * @param defaultValue Default/initial value\n\t */\n\tconstructor(\n\t\tprotected storageType: StorageType,\n\t\tprotected key: string,\n\t\tdefaultValue: T,\n\t) {\n\t\t// Before using produce, ensure the input is draftable\n\t\t// This ensures Immer won't throw an error on non-draftable values\n\t\tlet safeDefaultValue: T\n\n\t\tif (defaultValue instanceof Map) {\n\t\t\t// For Maps, create a new Map instance\n\t\t\tsafeDefaultValue = new Map(defaultValue) as unknown as T\n\t\t} else if (Array.isArray(defaultValue)) {\n\t\t\t// For arrays, create a new array instance\n\t\t\tsafeDefaultValue = [...defaultValue] as unknown as T\n\t\t} else if (defaultValue && typeof defaultValue === 'object') {\n\t\t\t// For objects, create a shallow copy\n\t\t\tsafeDefaultValue = { ...defaultValue } as T\n\t\t} else {\n\t\t\t// For primitives or other non-draftable types\n\t\t\tsafeDefaultValue = defaultValue\n\t\t}\n\n\t\t// Make an immutable copy of the default value when possible\n\t\ttry {\n\t\t\tthis.defaultValue = this.isImmerDraftable(safeDefaultValue)\n\t\t\t\t? produce(safeDefaultValue, draft => draft)\n\t\t\t\t: safeDefaultValue\n\t\t} catch (error) {\n\t\t\tconsole.warn(`[BaseStore] Unable to produce immutable copy of defaultValue:`, error)\n\t\t\tthis.defaultValue = safeDefaultValue\n\t\t}\n\n\t\t// Initialize BehaviorSubject with the default value\n\t\tthis.$ = new BehaviorSubject<T>(this.defaultValue)\n\t\tthis.storage = createStorageManager<T>(storageType, key)\n\n\t\t// Set ready immediately for memory storage\n\t\tif (storageType === 'memory') {\n\t\t\tthis._ready = true\n\t\t} else {\n\t\t\t// Initialize from storage for persistent stores\n\t\t\tthis.initializeFromStorage()\n\t\t}\n\t}\n\n\t/**\n\t * Check if a value can be safely used with Immer's produce\n\t */\n\tprotected isImmerDraftable(value: any): boolean {\n\t\treturn (\n\t\t\tvalue !== null &&\n\t\t\ttypeof value === 'object' &&\n\t\t\t(Array.isArray(value) ||\n\t\t\t\tvalue instanceof Map ||\n\t\t\t\tvalue instanceof Set ||\n\t\t\t\tObject.getPrototypeOf(value) === Object.prototype ||\n\t\t\t\tvalue[immerable] === true)\n\t\t)\n\t}\n\n\t/**\n\t * Cleanup method for all store types\n\t */\n\tpublic destroy(): void {\n\t\tthis._destroy$.next()\n\t\tthis._destroy$.complete()\n\t\tthis.$.complete()\n\t\tthis.error$.complete()\n\t}\n\n\t/**\n\t * Replace the entire store state immutably\n\t */\n\tpublic replace(newValue: T): void {\n\t\ttry {\n\t\t\t// Use Immer to create an immutable copy if possible\n\t\t\tconst nextState = this.isImmerDraftable(newValue) ? produce(newValue, draft => draft) : newValue\n\n\t\t\tthis.updateState(nextState)\n\t\t} catch (error) {\n\t\t\tconst storeError = new StoreError<unknown>(`Error replacing state in ${this.key}`, error)\n\t\t\tthis.error$.next(storeError)\n\t\t\tconsole.error(storeError)\n\n\t\t\t// Fallback to direct assignment\n\t\t\tthis.updateState(newValue)\n\t\t}\n\t}\n\n\t/**\n\t * Reset to default value - to be implemented by subclasses\n\t */\n\tpublic abstract clear(): void\n\n\t/**\n\t * Update the state with proper error handling and immutability\n\t */\n\tprotected updateState(newValue: T): void {\n\t\ttry {\n\t\t\t// Ensure immutability by creating a fresh copy with Immer when possible\n\t\t\tlet nextState: T\n\n\t\t\tif (this.isImmerDraftable(newValue)) {\n\t\t\t\tnextState = produce(newValue, draft => draft)\n\t\t\t} else {\n\t\t\t\tnextState = newValue\n\t\t\t}\n\n\t\t\tthis.$.next(nextState)\n\n\t\t\t// Persist to storage\n\t\t\tif (this.storageType !== 'memory') {\n\t\t\t\tthis.persistToStorage(nextState).catch(err => {\n\t\t\t\t\tconst error = new StoreError<unknown>(`Error saving to ${this.storageType} storage for ${this.key}`, err)\n\t\t\t\t\tthis.error$.next(error)\n\t\t\t\t\tconsole.error(error)\n\t\t\t\t})\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error updating state in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\n\t\t\t// Fallback to direct update\n\t\t\tthis.$.next(newValue)\n\t\t}\n\t}\n\n\t/**\n\t * Initialize the store from persistent storage\n\t */\n\tprotected async initializeFromStorage(): Promise<void> {\n\t\ttry {\n\t\t\tconst storedValue = await this.storage.load()\n\t\t\tif (storedValue) {\n\t\t\t\t// Process and update state with the stored value\n\t\t\t\tconst processedValue = this.processStoredValue(storedValue)\n\n\t\t\t\ttry {\n\t\t\t\t\t// Only use Immer if the value is draftable\n\t\t\t\t\tconst immutableValue = this.isImmerDraftable(processedValue)\n\t\t\t\t\t\t? produce(processedValue, draft => draft)\n\t\t\t\t\t\t: processedValue\n\n\t\t\t\t\tthis.updateState(immutableValue)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconsole.warn(`[BaseStore] Unable to create immutable copy, using value directly:`, error)\n\t\t\t\t\tthis.updateState(processedValue)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._ready = true\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error loading from ${this.storageType} storage for ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t\tthis._ready = true // Mark as ready even if loading fails\n\t\t}\n\t}\n\n\t/**\n\t * Process stored value (can be overridden by subclasses)\n\t */\n\tprotected processStoredValue(storedValue: T): T {\n\t\treturn storedValue\n\t}\n\n\t/**\n\t * Persist state to storage\n\t */\n\tprotected async persistToStorage(state: T): Promise<void> {\n\t\treturn this.storage.save(state)\n\t}\n\n\t/**\n\t * Setup development tools\n\t */\n\tprotected abstract setupDevTools(): void\n}\n","// src/store/context-array.ts - Array store implementation with Immer\nimport { Draft, castDraft, produce } from 'immer'\nimport { throttleTime } from 'rxjs'\nimport { BaseStore } from './store.class'\nimport { IArrayStore, StorageType, StoreError } from './types'\n\n/**\n * Enhanced array store with TypeScript support and immutability\n * Extends BaseStore for common functionality\n */\nexport class SchmancyArrayStore<T = any> extends BaseStore<T[]> implements IArrayStore<T> {\n\tpublic static type = 'array'\n\n\t// Static map to hold instances\n\tprivate static instances: Map<string, SchmancyArrayStore<any>> = new Map()\n\n\t/**\n\t * Static method to get or create an instance with proper typing\n\t */\n\tpublic static getInstance<T = any>(storage: StorageType, key: string, defaultValue: T[] = []): SchmancyArrayStore<T> {\n\t\tconst instanceKey = `${storage}:${key}`\n\t\tif (!this.instances.has(instanceKey)) {\n\t\t\tthis.instances.set(instanceKey, new SchmancyArrayStore<T>(storage, key, defaultValue))\n\t\t}\n\t\treturn this.instances.get(instanceKey) as SchmancyArrayStore<T>\n\t}\n\n\t/**\n\t * Constructor extension to set up persistence\n\t */\n\tconstructor(storageType: StorageType, key: string, defaultValue: T[] = []) {\n\t\tsuper(storageType, key, defaultValue)\n\n\t\t// Set up persistence throttling for better performance\n\t\tif (storageType !== 'memory') {\n\t\t\tthis.setupPersistence()\n\t\t}\n\t}\n\n\t/**\n\t * Set up persistence to storage with throttling\n\t */\n\tprivate setupPersistence(): void {\n\t\tthis.$.pipe(throttleTime(100, undefined, { leading: true, trailing: true })).subscribe(currentValue => {\n\t\t\tthis.storage.save(currentValue).catch(err => {\n\t\t\t\tconst error = new StoreError<unknown>(`Error saving to ${this.storageType} storage for ${this.key}`, err)\n\t\t\t\tthis.error$.next(error)\n\t\t\t\tconsole.error(error)\n\t\t\t})\n\t\t})\n\t}\n\n\t/**\n\t * Add an item to the end of the array\n\t */\n\tpublic push(...items: T[]): void {\n\t\ttry {\n\t\t\t// Use Immer to create a new immutable array\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tdraft.push(...items.map(item => castDraft(item) as Draft<T>))\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null) // Clear any previous errors\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error pushing items in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Remove and return the last item from the array\n\t */\n\tpublic pop(): T | undefined {\n\t\ttry {\n\t\t\t// Get the item before modifying the array\n\t\t\tconst originalItem = this.value.length > 0 ? this.value[this.value.length - 1] : undefined\n\n\t\t\t// Use Immer to create a new immutable array\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tdraft.pop()\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null) // Clear any previous errors\n\t\t\treturn originalItem\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error popping item from ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t\treturn undefined\n\t\t}\n\t}\n\t/**\n\t * Add item(s) to the beginning of the array\n\t */\n\tpublic unshift(...items: T[]): void {\n\t\ttry {\n\t\t\t// Use Immer to create a new immutable array\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tdraft.unshift(...items.map(item => castDraft(item) as Draft<T>))\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error unshifting items in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Remove and return the first item from the array\n\t */\n\tpublic shift(): T | undefined {\n\t\ttry {\n\t\t\t// Get the item before modifying the array\n\t\t\tconst originalItem = this.value.length > 0 ? this.value[0] : undefined\n\n\t\t\t// Use Immer to create a new immutable array\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tdraft.shift()\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t\treturn originalItem\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error shifting item from ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t\treturn undefined\n\t\t}\n\t}\n\n\t/**\n\t * Update an item at a specific index\n\t */\n\tpublic set(index: number, value: T): void {\n\t\ttry {\n\t\t\t// Use Immer to create a new immutable array\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tif (index >= 0 && index < draft.length) {\n\t\t\t\t\tdraft[index] = castDraft(value) as Draft<T>\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(`Index ${index} out of bounds (length: ${draft.length})`)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error setting item at index ${index} in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Get item at a specific index\n\t */\n\tpublic get(index: number): T | undefined {\n\t\treturn this.value[index]\n\t}\n\n\t/**\n\t * Remove items from the array\n\t */\n\tpublic splice(start: number, deleteCount?: number, ...items: T[]): T[] {\n\t\ttry {\n\t\t\t// Get a copy of the current array\n\t\t\tconst originalArray = [...this.value]\n\n\t\t\t// Perform splice on the copy to get the removed items\n\t\t\tconst removed = originalArray.splice(start, deleteCount ?? 0, ...items)\n\n\t\t\t// Now use Immer to create the new state with the same changes\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tdraft.splice(start, deleteCount ?? 0, ...items.map(item => castDraft(item) as Draft<T>))\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t\treturn removed\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error splicing items in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t\treturn []\n\t\t}\n\t}\n\n\t/**\n\t * Remove an item by value (first occurrence)\n\t */\n\tpublic remove(item: T, compareFn?: (a: T, b: T) => boolean): boolean {\n\t\ttry {\n\t\t\tconst equals = compareFn || ((a, b) => a === b)\n\n\t\t\t// Find the index in the original array\n\t\t\tconst index = this.value.findIndex(currentItem => equals(currentItem, item))\n\n\t\t\t// If found, remove using Immer\n\t\t\tif (index !== -1) {\n\t\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\t\tdraft.splice(index, 1)\n\t\t\t\t})\n\n\t\t\t\tthis.updateState(nextState)\n\t\t\t\tthis.error$.next(null)\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\t// Item not found\n\t\t\tthis.error$.next(null)\n\t\t\treturn false\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error removing item in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t\treturn false\n\t\t}\n\t}\n\n\t/**\n\t * Replace entire array\n\t */\n\tpublic replace(newArray: T[]): void {\n\t\ttry {\n\t\t\t// Create a fresh immutable copy with Immer\n\t\t\tconst nextState = produce(newArray, draft => draft)\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error replacing array in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Filter items in the array\n\t */\n\tpublic filter(predicate: (value: T, index: number, array: T[]) => boolean): void {\n\t\ttry {\n\t\t\t// Filter the original array first\n\t\t\tconst filteredArray = this.value.filter(predicate)\n\n\t\t\t// Then use Immer to create a new immutable array\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\t// Clear the draft array and fill it with the filtered items\n\t\t\t\tdraft.length = 0\n\t\t\t\tdraft.push(...filteredArray.map(item => castDraft(item) as Draft<T>))\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error filtering array in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Map over the array and transform items\n\t */\n\tpublic map<U>(mapper: (value: T, index: number, array: T[]) => U): U[] {\n\t\treturn this.value.map(mapper)\n\t}\n\n\t/**\n\t * Sort the array in place\n\t */\n\tpublic sort(compareFn?: (a: T, b: T) => number): void {\n\t\ttry {\n\t\t\t// Create a copy of the current array and apply the sort operation\n\t\t\tconst sortedArray = [...this.value].sort(compareFn)\n\n\t\t\t// Use Immer to create a new immutable array that matches the sorted array\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\t// Clear the array and refill it with the sorted items\n\t\t\t\tdraft.length = 0\n\t\t\t\tdraft.push(...sortedArray.map(item => castDraft(item) as Draft<T>))\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error sorting array in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Update a specific item using a callback function\n\t */\n\tpublic update(index: number, updater: (item: Draft<T>) => void): void {\n\t\ttry {\n\t\t\t// Use Immer to create a new immutable array\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tif (index >= 0 && index < draft.length) {\n\t\t\t\t\tupdater(draft[index])\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(`Index ${index} out of bounds (length: ${draft.length})`)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error updating item at index ${index} in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Clear the array\n\t */\n\tpublic clear(): void {\n\t\tthis.updateState([])\n\t}\n\n\t/**\n\t * Setup development tools for debugging\n\t */\n\tprotected setupDevTools(): void {\n\t\tif (typeof window !== 'undefined') {\n\t\t\t// Add to global store registry\n\t\t\t;(window as any).__STORES__ = (window as any).__STORES__ || {}\n\t\t\t;(window as any).__STORES__[this.key] = {\n\t\t\t\tgetState: () => this.value,\n\t\t\t\tpush: this.push.bind(this),\n\t\t\t\tpop: this.pop.bind(this),\n\t\t\t\tunshift: this.unshift.bind(this),\n\t\t\t\tshift: this.shift.bind(this),\n\t\t\t\tset: this.set.bind(this),\n\t\t\t\tget: this.get.bind(this),\n\t\t\t\tsplice: this.splice.bind(this),\n\t\t\t\tremove: this.remove.bind(this),\n\t\t\t\treplace: this.replace.bind(this),\n\t\t\t\tfilter: this.filter.bind(this),\n\t\t\t\tmap: this.map.bind(this),\n\t\t\t\tsort: this.sort.bind(this),\n\t\t\t\tupdate: this.update.bind(this),\n\t\t\t\tclear: this.clear.bind(this),\n\t\t\t\tsubscribe: (callback: (state: T[]) => void) => {\n\t\t\t\t\tconst subscription = this.$.subscribe(callback)\n\t\t\t\t\treturn () => subscription.unsubscribe()\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t}\n}\n","// src/store/context-collection.ts - Updated with Immer for immutability\nimport { throttleTime } from 'rxjs'\nimport { BaseStore } from './store.class'\nimport { ICollectionStore, StorageType, StoreError } from './types'\nimport { produce, Draft, castDraft } from 'immer'\n\n/**\n * Enhanced collection store with better TypeScript support and immutability\n * Now extends BaseStore for common functionality\n */\nexport default class SchmancyCollectionStore<V = any> extends BaseStore<Map<string, V>> implements ICollectionStore<V> {\n\tpublic static type = 'collection'\n\n\t// Static map to hold instances\n\tprivate static instances: Map<string, SchmancyCollectionStore<any>> = new Map()\n\n\t/**\n\t * Static method to get or create an instance with proper typing\n\t */\n\tpublic static getInstance<V = any>(\n\t\tstorage: StorageType,\n\t\tkey: string,\n\t\tdefaultValue: Map<string, V>,\n\t): SchmancyCollectionStore<V> {\n\t\tconst instanceKey = `${storage}:${key}`\n\t\tif (!this.instances.has(instanceKey)) {\n\t\t\tthis.instances.set(instanceKey, new SchmancyCollectionStore<V>(storage, key, defaultValue))\n\t\t}\n\t\treturn this.instances.get(instanceKey) as SchmancyCollectionStore<V>\n\t}\n\n\t/**\n\t * Set values in the collection with proper typing and immutability.\n\t * Supports multiple input types to prevent common developer mistakes.\n\t * \n\t * @example\n\t * // Single key-value pair\n\t * store.set('key1', value1)\n\t * \n\t * @example\n\t * // Merge from a Map\n\t * const dataMap = new Map([['key1', value1], ['key2', value2]])\n\t * store.set(dataMap)\n\t * \n\t * @example\n\t * // Merge from an object\n\t * store.set({ key1: value1, key2: value2 })\n\t */\n\tpublic set<T = V>(keyOrData: string | Map<string, T> | Record<string, T>, value?: T): void {\n\t\ttry {\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\t// Handle different input types\n\t\t\t\tif (typeof keyOrData === 'string') {\n\t\t\t\t\t// Traditional key-value pair\n\t\t\t\t\tif (value === undefined) {\n\t\t\t\t\t\tthrow new Error('Value is required when setting a single key')\n\t\t\t\t\t}\n\t\t\t\t\tdraft.set(keyOrData, castDraft(value) as unknown as Draft<V>)\n\t\t\t\t} else if (keyOrData instanceof Map) {\n\t\t\t\t\t// Merge all entries from the Map\n\t\t\t\t\tArray.from(keyOrData.entries()).forEach(([key, val]) => {\n\t\t\t\t\t\tdraft.set(key, castDraft(val) as unknown as Draft<V>)\n\t\t\t\t\t})\n\t\t\t\t} else if (typeof keyOrData === 'object' && keyOrData !== null) {\n\t\t\t\t\t// Merge all properties from the object\n\t\t\t\t\tObject.entries(keyOrData).forEach(([key, val]) => {\n\t\t\t\t\t\tdraft.set(key, castDraft(val) as unknown as Draft<V>)\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error('Invalid input: expected string key with value, Map, or object')\n\t\t\t\t}\n\t\t\t})\n\n\t\t\t// Update the state with the new immutable Map\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null) // Clear any previous errors\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error setting values in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Merge a Map into the collection. This is a helper method that provides\n\t * explicit semantics for merging operations.\n\t * \n\t * @param map The Map to merge into the collection\n\t * @example\n\t * const dataMap = new Map([['key1', value1], ['key2', value2]])\n\t * store.merge(dataMap)\n\t */\n\tpublic merge<T = V>(map: Map<string, T>): void {\n\t\tthis.set(map)\n\t}\n\n\t/**\n\t * Delete a value from the collection immutably\n\t */\n\tpublic delete(key: string): void {\n\t\ttry {\n\t\t\t// Use Immer to create a new immutable Map with the key deleted\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tdraft.delete(key)\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null) // Clear any previous errors\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error deleting key ${key} from ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Clear the collection immutably\n\t */\n\tpublic clear(): void {\n\t\t// Create a fresh empty Map\n\t\tthis.updateState(new Map<string, V>())\n\t}\n\n\t/**\n\t * Batch update multiple items in the collection\n\t * @param updates Object with keys and values to update\n\t */\n\tpublic batchUpdate(updates: Record<string, V>): void {\n\t\ttry {\n\t\t\t// Use Immer to apply all updates in a single immutable operation\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tObject.entries(updates).forEach(([key, value]) => {\n\t\t\t\t\tdraft.set(key, castDraft(value) as unknown as Draft<V>)\n\t\t\t\t})\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error batch updating in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Update an existing item in the collection using an updater function\n\t * @param key Key of the item to update\n\t * @param updater Function that receives the current value and returns the new value\n\t */\n\tpublic update(key: string, updater: (currentValue: Draft<V>) => void): void {\n\t\ttry {\n\t\t\t// Use Immer to update the specific item\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tconst currentValue = draft.get(key)\n\t\t\t\tif (currentValue !== undefined) {\n\t\t\t\t\tupdater(currentValue)\n\t\t\t\t\t// No need to set the value back since it's updated in place\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error updating item ${key} in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Constructor extension to set up persistence\n\t */\n\tconstructor(storageType: StorageType, key: string, defaultValue: Map<string, V>) {\n\t\tsuper(storageType, key, defaultValue)\n\n\t\t// Set up persistence throttling for better performance\n\t\tif (storageType !== 'memory') {\n\t\t\tthis.setupPersistence()\n\t\t}\n\t}\n\n\t/**\n\t * Set up persistence to storage with throttling\n\t */\n\tprivate setupPersistence(): void {\n\t\tthis.$.pipe(throttleTime(100, undefined, { leading: true, trailing: true })).subscribe(currentValue => {\n\t\t\tthis.storage.save(currentValue).catch(err => {\n\t\t\t\tconst error = new StoreError<unknown>(`Error saving to ${this.storageType} storage for ${this.key}`, err)\n\t\t\t\tthis.error$.next(error)\n\t\t\t\tconsole.error(error)\n\t\t\t})\n\t\t})\n\t}\n\n\t/**\n\t * Setup development tools for debugging\n\t */\n\tprotected setupDevTools(): void {\n\t\tif (typeof window !== 'undefined') {\n\t\t\t// Add to global store registry\n\t\t\t;(window as any).__STORES__ = (window as any).__STORES__ || {}\n\t\t\t;(window as any).__STORES__[this.key] = {\n\t\t\t\tgetState: () => this.value,\n\t\t\t\tset: this.set.bind(this),\n\t\t\t\tmerge: this.merge.bind(this),\n\t\t\t\tdelete: this.delete.bind(this),\n\t\t\t\tclear: this.clear.bind(this),\n\t\t\t\tbatchUpdate: this.batchUpdate.bind(this),\n\t\t\t\tupdate: this.update.bind(this),\n\t\t\t\tsubscribe: (callback: (state: Map<string, V>) => void) => {\n\t\t\t\t\tconst subscription = this.$.subscribe(callback)\n\t\t\t\t\treturn () => subscription.unsubscribe()\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t}\n}\n","// src/store/context-object.ts - Fixed version\n\nimport { BaseStore } from './store.class'\nimport { IStore, StorageType, StoreError } from './types'\nimport { produce, Draft, castDraft, immerable } from 'immer'\n\n/**\n * Enhanced store object with better TypeScript support and immutability\n * Now extends BaseStore for common functionality and uses Immer\n */\nexport class SchmancyStoreObject<T extends Record<string, any>> extends BaseStore<T> implements IStore<T> {\n\t// Mark as immerable so Immer can create drafts of this class\n\t[immerable] = true\n\n\tpublic static type = 'object'\n\n\t// Static map to hold instances with proper typing\n\tprivate static instances: Map<string, SchmancyStoreObject<any>> = new Map()\n\n\t/**\n\t * Static method to get or create an instance with strong typing\n\t */\n\tpublic static getInstance<T extends Record<string, any>>(\n\t\tstorage: StorageType,\n\t\tkey: string,\n\t\tdefaultValue: T,\n\t): SchmancyStoreObject<T> {\n\t\tconst instanceKey = `${storage}:${key}`\n\t\tif (!this.instances.has(instanceKey)) {\n\t\t\tthis.instances.set(instanceKey, new SchmancyStoreObject<T>(storage, key, defaultValue))\n\t\t}\n\t\treturn this.instances.get(instanceKey) as SchmancyStoreObject<T>\n\t}\n\n\t/**\n\t * Set state with proper typing and immutability using Immer\n\t */\n\tpublic set(value: Partial<T>, merge: boolean = true): void {\n\t\ttry {\n\t\t\tif (!this.isImmerDraftable(this.value)) {\n\t\t\t\t// If current value isn't draftable, handle directly\n\t\t\t\tconst nextState = merge ? { ...this.value, ...value } : (value as T)\n\n\t\t\t\tthis.updateState(nextState)\n\t\t\t\tthis.error$.next(null)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Use Immer to create an immutable update\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tif (merge) {\n\t\t\t\t\t// Handle null/undefined value safely\n\t\t\t\t\tif (value === null || value === undefined) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\t// Merge new values into existing state\n\t\t\t\t\t// Use castDraft to properly type the value for the draft context\n\t\t\t\t\ttry {\n\t\t\t\t\t\tObject.assign(draft, castDraft(value) as Draft<Partial<T>>)\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tconsole.warn('[SchmancyStoreObject] Error casting to draft, falling back to direct assign:', err)\n\t\t\t\t\t\t// Fallback to direct property assignment\n\t\t\t\t\t\tObject.keys(value).forEach(key => {\n\t\t\t\t\t\t\t;(draft as any)[key] = (value as any)[key]\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// For complete replacement, return a completely new object\n\t\t\t\t\t// This is handled specially by Immer\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn castDraft(value as T) as Draft<T>\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tconsole.warn('[SchmancyStoreObject] Error casting to draft, returning value directly:', err)\n\t\t\t\t\t\treturn value as unknown as Draft<T>\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null) // Clear any previous errors\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error updating store: ${this.key}`, err, { value, merge })\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\n\t\t\t// Fallback to direct update\n\t\t\ttry {\n\t\t\t\tconst fallbackState = merge ? { ...this.value, ...value } : (value as T)\n\t\t\t\tthis.updateState(fallbackState)\n\t\t\t} catch (fallbackErr) {\n\t\t\t\tconsole.error('Failed fallback update:', fallbackErr)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Reset the store to its default value\n\t */\n\tpublic clear(): void {\n\t\ttry {\n\t\t\t// Create a fresh copy of the default value using Immer\n\t\t\tif (this.isImmerDraftable(this.defaultValue)) {\n\t\t\t\tconst freshDefaultValue = produce(this.defaultValue, draft => draft)\n\t\t\t\tthis.set(freshDefaultValue, false)\n\t\t\t} else {\n\t\t\t\t// For non-draftable values, use direct replacement\n\t\t\t\tthis.set(this.defaultValue as any, false)\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error clearing store: ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\n\t\t\t// Fallback to direct reset\n\t\t\tthis.updateState(this.defaultValue)\n\t\t}\n\t}\n\n\t/**\n\t * Delete a specific key from the store with type checking and immutability\n\t */\n\tpublic delete<K extends keyof T>(key: K): void {\n\t\ttry {\n\t\t\tif (!this.isImmerDraftable(this.value)) {\n\t\t\t\t// Handle non-draftable objects directly\n\t\t\t\tconst nextState = { ...this.value }\n\t\t\t\tdelete nextState[key]\n\t\t\t\tthis.updateState(nextState as T)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Use Immer to create an immutable update that removes the key\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\t// Use type assertion to tell TypeScript this is safe\n\t\t\t\tdelete draft[key as keyof Draft<T>]\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error deleting key ${String(key)} from store: ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\n\t\t\t// Fallback to direct modification\n\t\t\ttry {\n\t\t\t\tconst fallbackState = { ...this.value }\n\t\t\t\tdelete fallbackState[key]\n\t\t\t\tthis.updateState(fallbackState as T)\n\t\t\t} catch (fallbackErr) {\n\t\t\t\tconsole.error('Failed fallback delete:', fallbackErr)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Update a nested property at a specific path\n\t * @param path Dot-separated path to the property (e.g., 'user.profile.name')\n\t * @param value New value to set\n\t */\n\tpublic setPath(path: string, value: any): void {\n\t\ttry {\n\t\t\tif (!path) {\n\t\t\t\tconsole.warn('[SchmancyStoreObject] Empty path provided to setPath')\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (!this.isImmerDraftable(this.value)) {\n\t\t\t\t// Handle non-draftable objects with direct modification\n\t\t\t\tconst parts = path.split('.')\n\t\t\t\tconst nextState = { ...this.value }\n\t\t\t\tlet current: any = nextState\n\n\t\t\t\tfor (let i = 0; i < parts.length - 1; i++) {\n\t\t\t\t\tconst part = parts[i]\n\t\t\t\t\tif (current[part] === undefined) {\n\t\t\t\t\t\tcurrent[part] = {}\n\t\t\t\t\t} else if (typeof current[part] !== 'object' || current[part] === null) {\n\t\t\t\t\t\tcurrent[part] = {}\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = current[part]\n\t\t\t\t}\n\n\t\t\t\tcurrent[parts[parts.length - 1]] = value\n\t\t\t\tthis.updateState(nextState)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Use Immer for immutable deep updates\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tconst parts = path.split('.')\n\t\t\t\tlet current: any = draft\n\n\t\t\t\t// Navigate to the parent of the property we want to update\n\t\t\t\tfor (let i = 0; i < parts.length - 1; i++) {\n\t\t\t\t\tconst part = parts[i]\n\n\t\t\t\t\t// Create the path if it doesn't exist\n\t\t\t\t\tif (current[part] === undefined) {\n\t\t\t\t\t\tcurrent[part] = {}\n\t\t\t\t\t} else if (typeof current[part] !== 'object' || current[part] === null) {\n\t\t\t\t\t\t// Convert to object if it's not one already\n\t\t\t\t\t\tcurrent[part] = {}\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrent = current[part]\n\t\t\t\t}\n\n\t\t\t\t// Set the value at the final path segment\n\t\t\t\tconst lastPart = parts[parts.length - 1]\n\t\t\t\ttry {\n\t\t\t\t\tcurrent[lastPart] = castDraft(value)\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconsole.warn('[SchmancyStoreObject] Error casting to draft, setting directly:', err)\n\t\t\t\t\tcurrent[lastPart] = value\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error setting path ${path} in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\n\t\t\t// Fallback to direct path setting\n\t\t\ttry {\n\t\t\t\tconst parts = path.split('.')\n\t\t\t\tconst nextState = { ...this.value }\n\t\t\t\tlet current: any = nextState\n\n\t\t\t\tfor (let i = 0; i < parts.length - 1; i++) {\n\t\t\t\t\tconst part = parts[i]\n\t\t\t\t\tif (current[part] === undefined) {\n\t\t\t\t\t\tcurrent[part] = {}\n\t\t\t\t\t} else if (typeof current[part] !== 'object' || current[part] === null) {\n\t\t\t\t\t\tcurrent[part] = {}\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = current[part]\n\t\t\t\t}\n\n\t\t\t\tcurrent[parts[parts.length - 1]] = value\n\t\t\t\tthis.updateState(nextState)\n\t\t\t} catch (fallbackErr) {\n\t\t\t\tconsole.error('Failed fallback setPath:', fallbackErr)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Process stored value by merging with default value\n\t */\n\tprotected processStoredValue(storedValue: T): T {\n\t\ttry {\n\t\t\t// Use Immer to create a clean merged state if possible\n\t\t\tif (this.isImmerDraftable(this.defaultValue) && this.isImmerDraftable(storedValue)) {\n\t\t\t\treturn produce(this.defaultValue, draft => {\n\t\t\t\t\tObject.assign(draft, castDraft(storedValue) as Draft<T>)\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\t// Otherwise use a standard merge\n\t\t\t\treturn { ...this.defaultValue, ...storedValue }\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tconsole.warn(`[SchmancyStoreObject] Error processing stored value, returning as-is:`, err)\n\t\t\treturn storedValue\n\t\t}\n\t}\n\n\t/**\n\t * Setup development tools for debugging\n\t */\n\tprotected setupDevTools(): void {\n\t\tif (typeof window !== 'undefined') {\n\t\t\t// Add to global store registry\n\t\t\t;(window as any).__STORES__ = (window as any).__STORES__ || {}\n\t\t\t;(window as any).__STORES__[this.key] = {\n\t\t\t\tgetState: () => this.value,\n\t\t\t\tset: this.set.bind(this),\n\t\t\t\tdelete: this.delete.bind(this),\n\t\t\t\tclear: this.clear.bind(this),\n\t\t\t\tsetPath: this.setPath.bind(this),\n\t\t\t\tsubscribe: (callback: (state: T) => void) => {\n\t\t\t\t\tconst subscription = this.$.subscribe(callback)\n\t\t\t\t\treturn () => subscription.unsubscribe()\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Inherit isImmerDraftable from BaseStore, but also check for [immerable]\n\t */\n\tprotected isImmerDraftable(value: any): boolean {\n\t\t// Use the parent implementation and add our own checks\n\t\treturn value !== null && typeof value === 'object' && (super.isImmerDraftable(value) || value[immerable] === true)\n\t}\n}\n","// src/store/context-create.ts - Fixed version\n\nimport { SchmancyArrayStore } from './context-array'\nimport SchmancyCollectionStore from './context-collection'\nimport { SchmancyStoreObject } from './context-object'\nimport { IArrayStore, ICollectionStore, IStore, StorageType } from './types'\n\n/**\n * Type guard to check if an object is empty\n */\nfunction isEmptyObject(obj: unknown): boolean {\n\tif (typeof obj !== 'object' || obj === null) {\n\t\treturn false\n\t}\n\treturn Object.keys(obj).length === 0\n}\n\n/**\n * Type guard for Map objects\n */\nfunction isMap<K, V>(value: unknown): value is Map<K, V> {\n\treturn value instanceof Map\n}\n\n/**\n * Type guard for Array objects\n */\nfunction isArray<T>(value: unknown): value is Array<T> {\n\treturn Array.isArray(value)\n}\n\n/**\n * Type guard for plain objects (not arrays, maps, null, etc.)\n */\nfunction isPlainObject(value: unknown): boolean {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object' &&\n\t\t!Array.isArray(value) &&\n\t\t!(value instanceof Map) &&\n\t\t!(value instanceof Set) &&\n\t\t!(value instanceof Date) &&\n\t\t!(value instanceof RegExp) &&\n\t\tObject.getPrototypeOf(value) === Object.prototype\n\t)\n}\n\n/**\n * Creates a regular object store with better typing and error handling\n */\nfunction createObjectStore<T extends Record<string, any>>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n): IStore<T> & SchmancyStoreObject<T> {\n\ttry {\n\t\t// Validate storage type\n\t\tif (storage === 'indexeddb') {\n\t\t\tconsole.warn(`IndexedDB storage is not optimal for plain objects. Using 'local' instead for key: ${key}`)\n\t\t\tstorage = 'local'\n\t\t}\n\n\t\t// Ensure initialData is a plain object\n\t\tif (!isPlainObject(initialData)) {\n\t\t\tconsole.warn(`Initial data is not a plain object. Converting to object for key: ${key}`)\n\t\t\tinitialData = { ...initialData } as T\n\t\t}\n\n\t\t// Create the store instance\n\t\tconst store = SchmancyStoreObject.getInstance<T>(storage, key, initialData)\n\n\t\t// Initialize with provided data if store is empty\n\t\tif (isEmptyObject(store.value)) {\n\t\t\tstore.set({ ...initialData }) // Use spread to create a copy\n\t\t}\n\n\t\treturn store\n\t} catch (err) {\n\t\tconsole.error(`Failed to create object store for key: ${key}`, err)\n\t\t// Fall back to a basic implementation that won't throw\n\t\tconst fallbackStore = SchmancyStoreObject.getInstance<T>(\n\t\t\t'memory', // Fallback to memory storage\n\t\t\t`${key}-fallback`,\n\t\t\tinitialData,\n\t\t)\n\t\tconsole.warn(`Using fallback memory store for key: ${key}`)\n\t\treturn fallbackStore\n\t}\n}\n\n/**\n * Creates a collection store with better typing and error handling\n */\nfunction createCollectionStore<V>(\n\tinitialData: Map<string, V>,\n\tstorage: StorageType,\n\tkey: string,\n): ICollectionStore<V> & SchmancyCollectionStore<V> {\n\ttry {\n\t\t// Create the store instance\n\t\tconst store = SchmancyCollectionStore.getInstance(storage, key, initialData)\n\n\t\t// Initialize with provided data if store is empty\n\t\tif (!store.value.size) {\n\t\t\t// Create a new Map instance to avoid modifying the input\n\t\t\tstore.replace(new Map(initialData))\n\t\t}\n\n\t\treturn store\n\t} catch (err) {\n\t\tconsole.error(`Failed to create collection store for key: ${key}`, err)\n\t\t// Fall back to a basic implementation that won't throw\n\t\tconst fallbackStore = SchmancyCollectionStore.getInstance<V>(\n\t\t\t'memory', // Fallback to memory storage\n\t\t\t`${key}-fallback`,\n\t\t\tnew Map(initialData),\n\t\t)\n\t\tconsole.warn(`Using fallback memory store for key: ${key}`)\n\t\treturn fallbackStore\n\t}\n}\n\n/**\n * Creates an array store with better typing and error handling\n */\nfunction createArrayStore<T>(\n\tinitialData: T[],\n\tstorage: StorageType,\n\tkey: string,\n): IArrayStore<T> & SchmancyArrayStore<T> {\n\ttry {\n\t\t// Create the store instance\n\t\tconst store = SchmancyArrayStore.getInstance(storage, key, initialData)\n\n\t\t// Initialize with provided data if store is empty\n\t\tif (!store.value.length) {\n\t\t\t// Create a new array instance to avoid modifying the input\n\t\t\tstore.replace([...initialData])\n\t\t}\n\n\t\treturn store\n\t} catch (err) {\n\t\tconsole.error(`Failed to create array store for key: ${key}`, err)\n\t\t// Fall back to a basic implementation that won't throw\n\t\tconst fallbackStore = SchmancyArrayStore.getInstance<T>(\n\t\t\t'memory', // Fallback to memory storage\n\t\t\t`${key}-fallback`,\n\t\t\t[...initialData],\n\t\t)\n\t\tconsole.warn(`Using fallback memory store for key: ${key}`)\n\t\treturn fallbackStore\n\t}\n}\n\n// Function overloads for better type inference\n/**\n * Creates a context for managing object state\n * @param initialData The initial object data\n * @param storage Storage type to use\n * @param key Unique key for the store\n * @returns A store instance for the object\n */\nexport function createContext<T extends Record<string, any>>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n): IStore<T> & SchmancyStoreObject<T>\n\n/**\n * Creates a context for managing collection state\n * @param initialData The initial Map collection\n * @param storage Storage type to use\n * @param key Unique key for the store\n * @returns A collection store instance\n */\nexport function createContext<V>(\n\tinitialData: Map<string, V>,\n\tstorage: StorageType,\n\tkey: string,\n): ICollectionStore<V> & SchmancyCollectionStore<V>\n\n/**\n * Creates a context for managing array state\n * @param initialData The initial array\n * @param storage Storage type to use\n * @param key Unique key for the store\n * @returns An array store instance\n */\nexport function createContext<T>(\n\tinitialData: T[],\n\tstorage: StorageType,\n\tkey: string,\n): IArrayStore<T> & SchmancyArrayStore<T>\n\n/**\n * Implementation of the createContext function with complete type checking\n * and robust error handling\n */\nexport function createContext<T extends Record<string, any> | Map<string, any> | any[]>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n):\n\t| (IStore<T> & SchmancyStoreObject<T>)\n\t| (ICollectionStore<any> & SchmancyCollectionStore<any>)\n\t| (IArrayStore<any> & SchmancyArrayStore<any>) {\n\ttry {\n\t\t// Validate input\n\t\tif (initialData === null || initialData === undefined) {\n\t\t\tconsole.error('Initial data cannot be null or undefined')\n\t\t\t// Provide a sensible default based on type expected\n\t\t\tif (key.includes('collection') || key.includes('map')) {\n\t\t\t\tinitialData = new Map() as unknown as T\n\t\t\t} else if (key.includes('array') || key.includes('list')) {\n\t\t\t\tinitialData = [] as unknown as T\n\t\t\t} else {\n\t\t\t\tinitialData = {} as T\n\t\t\t}\n\t\t}\n\n\t\t// Determine store type based on input data with improved type checking\n\t\tif (isMap<string, any>(initialData)) {\n\t\t\treturn createCollectionStore<any>(initialData, storage, key)\n\t\t} else if (isArray<any>(initialData)) {\n\t\t\treturn createArrayStore<any>(initialData, storage, key)\n\t\t} else if (typeof initialData === 'object') {\n\t\t\treturn createObjectStore<any>(initialData as Record<string, any>, storage, key)\n\t\t} else {\n\t\t\t// Handle non-object data by wrapping it\n\t\t\tconsole.warn(`Initial data must be an object, array, or Map. Got ${typeof initialData}. Creating object wrapper.`)\n\t\t\treturn createObjectStore<any>({ value: initialData } as Record<string, any>, storage, key)\n\t\t}\n\t} catch (error) {\n\t\t// Last-resort error handling\n\t\tconsole.error(`Fatal error creating context for ${key}:`, error)\n\n\t\t// Create an emergency fallback store that won't throw\n\t\treturn createObjectStore<any>(\n\t\t\ttypeof initialData === 'object' && initialData !== null ? { ...initialData } : { value: initialData },\n\t\t\t'memory',\n\t\t\t`emergency-fallback-${key}`,\n\t\t)\n\t}\n}\n\n/**\n * Creates an array context with simplified API and type inference\n * @param initialData The initial array data\n * @param key Unique key for the store\n * @param storage Storage type to use (defaults to 'local')\n * @returns An array store instance\n */\nexport function createArrayContext<T>(\n\tinitialData: T[] = [],\n\tkey: string,\n\tstorage: StorageType = 'local',\n): IArrayStore<T> & SchmancyArrayStore<T> {\n\ttry {\n\t\treturn createContext<T>(initialData, storage, key)\n\t} catch (err) {\n\t\tconsole.error(`Failed to create array context for key: ${key}`, err)\n\t\t// Return a fallback store\n\t\treturn createArrayStore<T>(initialData, 'memory', `${key}-fallback`)\n\t}\n}\n\n/**\n * Creates a testable array context\n * @param initialData The initial array data\n * @param key Unique key for the store\n * @returns An array store that uses memory storage\n */\nexport function createTestArrayContext<T>(\n\tinitialData: T[] = [],\n\tkey: string = 'test-array',\n): IArrayStore<T> & SchmancyArrayStore<T> {\n\ttry {\n\t\treturn createContext<T>(initialData, 'memory', key)\n\t} catch (err) {\n\t\tconsole.error(`Failed to create test array context for key: ${key}`, err)\n\t\t// Return a fallback store with a different key\n\t\treturn createArrayStore<T>(initialData, 'memory', `${key}-emergency-fallback`)\n\t}\n}\n","// src/store/filter-directive.ts\n\n/** Supported comparison operators with TypeScript literal types */\nexport type ComparisonOperator =\n\t| '=='\n\t| '!='\n\t| '>'\n\t| '<'\n\t| '>='\n\t| '<='\n\t| 'includes'\n\t| 'notIncludes'\n\t| 'startsWith'\n\t| 'endsWith'\n\t| 'in'\n\t| 'notIn'\n\t| 'any' // fuzzy search operator\n\n/**\n * Type-safe condition tuple\n */\nexport type ConditionTuple = [field: string, op: ComparisonOperator, expected: unknown, strict?: boolean]\n\n/**\n * Type-safe condition object\n */\nexport interface ConditionObject {\n\tkey: string | string[] // Array of keys applies OR logic across fields\n\toperator: ComparisonOperator\n\tvalue: unknown\n\tstrict?: boolean\n}\n\n/**\n * Unified query condition type\n */\nexport type QueryCondition = ConditionTuple | ConditionObject\n\n/**\n * Filter result with item and score\n */\nexport interface ScoredItem<T> {\n\titem: T\n\tscore: number\n}\n\n/**\n * Get a nested value from an object using a dot-separated path.\n * Checks explicitly for null/undefined so falsy values like 0 or false are preserved.\n */\nexport const getFieldValue = <T = any>(item: Record<string, any>, path: string): T => {\n\tif (!path) return item as unknown as T\n\n\tconst parts = path.split('.')\n\tlet value: any = item\n\n\tfor (const part of parts) {\n\t\tif (value == null) return undefined as unknown as T\n\t\tvalue = value[part]\n\t}\n\n\treturn value as T\n}\n\n/**\n * Compute the Levenshtein distance between two strings.\n */\nconst levenshtein = (a: string, b: string): number => {\n\tif (a === b) return 0\n\n\tconst matrix: number[][] = Array(b.length + 1)\n\t\t.fill(null)\n\t\t.map((_, i) => [i])\n\n\t// initialize the first row\n\tfor (let j = 0; j <= a.length; j++) {\n\t\tmatrix[0][j] = j\n\t}\n\n\tfor (let i = 1; i <= b.length; i++) {\n\t\tfor (let j = 1; j <= a.length; j++) {\n\t\t\tif (b.charAt(i - 1) === a.charAt(j - 1)) {\n\t\t\t\tmatrix[i][j] = matrix[i - 1][j - 1]\n\t\t\t} else {\n\t\t\t\tmatrix[i][j] = Math.min(\n\t\t\t\t\tmatrix[i - 1][j] + 1, // deletion\n\t\t\t\t\tmatrix[i][j - 1] + 1, // insertion\n\t\t\t\t\tmatrix[i - 1][j - 1] + 1, // substitution\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\treturn matrix[b.length][a.length]\n}\n\n/**\n * Check if string `sub` is a subsequence of string `str`.\n * All characters in `sub` must appear in order in `str` (they need not be contiguous).\n */\nconst isSubsequence = (sub: string, str: string): boolean => {\n\tif (!sub) return true\n\tif (!str) return false\n\n\tlet i = 0,\n\t\tj = 0\n\twhile (i < sub.length && j < str.length) {\n\t\tif (sub[i].toLowerCase() === str[j].toLowerCase()) i++\n\t\tj++\n\t}\n\treturn i === sub.length\n}\n\n/**\n * Check if every character (with frequency) in the query exists in the target.\n * For example, \"aovc\" matches \"avocados\".\n */\nconst anagramMatch = (query: string, target: string): boolean => {\n\tif (!query) return true\n\tif (!target) return false\n\n\tconst countChars = (s: string): Record<string, number> =>\n\t\ts\n\t\t\t.toLowerCase()\n\t\t\t.split('')\n\t\t\t.reduce(\n\t\t\t\t(acc, char) => {\n\t\t\t\t\tacc[char] = (acc[char] || 0) + 1\n\t\t\t\t\treturn acc\n\t\t\t\t},\n\t\t\t\t{} as Record<string, number>,\n\t\t\t)\n\n\tconst queryCount = countChars(query)\n\tconst targetCount = countChars(target)\n\treturn Object.keys(queryCount).every(char => (targetCount[char] || 0) >= queryCount[char])\n}\n\n/**\n * Generate bigrams for a string.\n */\nconst getBigrams = (s: string): string[] => {\n\tif (!s || s.length < 2) return []\n\n\tconst bigrams: string[] = []\n\tfor (let i = 0; i < s.length - 1; i++) {\n\t\tbigrams.push(s.substring(i, i + 2).toLowerCase())\n\t}\n\treturn bigrams\n}\n\n/**\n * Compute Dice's coefficient for two strings based on bigrams.\n * Returns a value between 0 (no similarity) and 1 (perfect match).\n */\nconst diceCoefficient = (s1: string, s2: string): number => {\n\tif (!s1 || !s2 || s1.length < 2 || s2.length < 2) return 0\n\n\tconst bigrams1 = getBigrams(s1)\n\tconst bigrams2 = getBigrams(s2)\n\n\tif (bigrams1.length === 0 || bigrams2.length === 0) return 0\n\n\tlet intersection = 0\n\tconst used = new Array(bigrams2.length).fill(false)\n\n\tfor (const bigram of bigrams1) {\n\t\tfor (let i = 0; i < bigrams2.length; i++) {\n\t\t\tif (!used[i] && bigrams2[i] === bigram) {\n\t\t\t\tintersection++\n\t\t\t\tused[i] = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn (2 * intersection) / (bigrams1.length + bigrams2.length)\n}\n\n/**\n * Compute a fuzzy similarity score between two strings.\n * The score is computed by taking the maximum of several methods:\n * - Direct substring match (score 1)\n * - Subsequence check (score 0.8)\n * - Anagram subset match (score 0.7)\n * - Dice coefficient\n * - Normalized Levenshtein similarity\n */\nconst computeFuzzyScore = (actual: string, expected: string): number => {\n\tif (!actual || !expected) return 0\n\n\tconst a = actual.toLowerCase().trim()\n\tconst b = expected.toLowerCase().trim()\n\n\tif (a === b) return 1\n\n\tconst substringScore = a.includes(b) ? 1 : 0\n\tconst subsequenceScore = isSubsequence(b, a) ? 0.8 : 0\n\tconst anagramScore = anagramMatch(b, a) ? 0.7 : 0\n\tconst diceScore = diceCoefficient(a, b)\n\n\tconst maxLen = Math.max(a.length, b.length)\n\tconst levenshteinScore = maxLen ? 1 - levenshtein(a, b) / maxLen : 0\n\n\treturn Math.max(substringScore, subsequenceScore, anagramScore, diceScore, levenshteinScore)\n}\n\n/**\n * Safely coerce value to string if possible, or return empty string\n */\nconst safeString = (value: unknown): string => {\n\tif (value == null) return ''\n\treturn String(value)\n}\n\n/**\n * Apply a query condition to an item and return score\n */\nfunction applyQueryCondition<T extends Record<string, any>>(\n\titem: T,\n\tquery: QueryCondition,\n\tfuzzyThreshold: number = 0.3,\n): { valid: boolean; score: number } {\n\tlet field: string,\n\t\top: ComparisonOperator,\n\t\texpected: unknown,\n\t\tstrict = false\n\n\tif (Array.isArray(query)) {\n\t\t;[field, op, expected, strict = false] = query\n\t} else {\n\t\t// Handle array of keys (OR logic)\n\t\tif (Array.isArray(query.key)) {\n\t\t\tconst results = query.key.map(k =>\n\t\t\t\tapplyQueryCondition(item, { ...query, key: k }, fuzzyThreshold)\n\t\t\t)\n\t\t\t// Return best valid result, or invalid if none valid\n\t\t\treturn results.reduce(\n\t\t\t\t(best, curr) => (curr.valid ? (curr.score > best.score ? curr : best) : best),\n\t\t\t\t{ valid: false, score: 0 }\n\t\t\t)\n\t\t}\n\n\t\tfield = query.key\n\t\top = query.operator\n\t\texpected = query.value\n\t\tstrict = query.strict || false\n\t}\n\n\t// Skip empty filters for non-strict queries\n\tif (!strict && (expected === '' || expected == null || (isArray(expected) && expected.length === 0))) {\n\t\treturn { valid: true, score: 1 }\n\t}\n\n\tconst actual = getFieldValue(item, field)\n\n\t// FIXED: Properly handle strict mode\n\tif (strict) {\n\t\t// For strict mode, use exact equality comparison for all operators except 'any'\n\t\tif (op === 'any') {\n\t\t\t// Fuzzy search still applies with strict mode\n\t\t\tif (typeof actual !== 'string' || typeof expected !== 'string') {\n\t\t\t\treturn { valid: false, score: 0 }\n\t\t\t}\n\n\t\t\tconst score = computeFuzzyScore(actual, expected)\n\t\t\treturn {\n\t\t\t\tvalid: score >= fuzzyThreshold,\n\t\t\t\tscore: score >= fuzzyThreshold ? score : 0,\n\t\t\t}\n\t\t} else {\n\t\t\t// For all other operators in strict mode,\n\t\t\t// delegate to compareValues function but return precise scores\n\t\t\tconst matches = compareValues(op, actual, expected)\n\t\t\treturn {\n\t\t\t\tvalid: matches,\n\t\t\t\tscore: matches ? 1 : 0,\n\t\t\t}\n\t\t}\n\t} else if (op === 'any') {\n\t\t// Fuzzy search requires both values to be strings\n\t\tif (typeof actual !== 'string' || typeof expected !== 'string') {\n\t\t\treturn { valid: false, score: 0 }\n\t\t}\n\n\t\tconst score = computeFuzzyScore(actual, expected)\n\t\tif (score < fuzzyThreshold) {\n\t\t\treturn { valid: false, score: 0 }\n\t\t}\n\n\t\treturn { valid: true, score }\n\t} else {\n\t\t// For non-fuzzy operators, check condition\n\t\tconst matches = compareValues(op, actual, expected)\n\t\treturn {\n\t\t\tvalid: matches,\n\t\t\tscore: matches ? 1 : 0,\n\t\t}\n\t}\n}\n\n/**\n * Filter a Map of items given an array of query conditions.\n * For each query condition:\n * - If the expected value is empty/null/undefined, it is treated as a match.\n * - For non-fuzzy operators, the condition must strictly match.\n * - For the \"any\" operator, a fuzzy similarity score is computed.\n * Items with a fuzzy score below a given threshold (e.g., 0.3) are excluded.\n *\n * The overall item score is the average of the scores from all conditions.\n * The results are sorted in descending order of relevance.\n *\n * @param items - A Map containing items to filter.\n * @param queries - An array of query conditions to apply.\n * @param fuzzyThreshold - Minimum score required for fuzzy matches (default: 0.3)\n * @returns An array of items that match all query conditions, sorted by relevance.\n */\nexport function filterMapItems<T extends Record<string, any>>(\n\titems: Map<string, T>,\n\tqueries: QueryCondition[] = [],\n\tfuzzyThreshold: number = 0.3,\n): T[] {\n\t// If no queries, return all items unsorted\n\tif (!queries.length) {\n\t\treturn Array.from(items.values())\n\t}\n\n\t// Score and filter each item\n\tconst scoredItems: ScoredItem<T>[] = []\n\n\tfor (const [_, item] of items.entries()) {\n\t\tlet totalScore = 0\n\t\tlet matchCount = 0\n\t\tlet valid = true\n\n\t\tfor (const query of queries) {\n\t\t\tconst result = applyQueryCondition(item, query, fuzzyThreshold)\n\n\t\t\tif (!result.valid) {\n\t\t\t\tvalid = false\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\ttotalScore += result.score\n\t\t\tmatchCount++\n\t\t}\n\n\t\tif (valid) {\n\t\t\tscoredItems.push({\n\t\t\t\titem,\n\t\t\t\tscore: matchCount > 0 ? totalScore / matchCount : 1,\n\t\t\t})\n\t\t}\n\t}\n\n\t// Sort by descending score\n\tscoredItems.sort((a, b) => b.score - a.score)\n\n\treturn scoredItems.map(x => x.item)\n}\n\n/**\n * Filter an array of items using query conditions\n */\nexport function filterArrayItems<T extends Record<string, any>>(\n\titems: T[],\n\tqueries: QueryCondition[] = [],\n\tfuzzyThreshold: number = 0.3,\n): T[] {\n\t// Create temporary map with numeric indices as keys\n\tconst map = new Map<string, T>()\n\titems.forEach((item, index) => map.set(String(index), item))\n\n\treturn filterMapItems(map, queries, fuzzyThreshold)\n}\n\n// Improved type guards for filter-directive.ts\n\n/**\n * Type guard for checking if a value is an array with better type inference\n * @param value Value to check\n * @returns True if the value is an array\n */\nexport function isArray<T = unknown>(value: unknown): value is Array<T> {\n\treturn Array.isArray(value)\n}\n\n/**\n * Type guard for checking if a value is a string\n * @param value Value to check\n * @returns True if the value is a string\n */\nexport function isString(value: unknown): value is string {\n\treturn typeof value === 'string'\n}\n\n/**\n * Type guard for checking if a value is a number\n * @param value Value to check\n * @returns True if the value is a number and not NaN\n */\nexport function isNumber(value: unknown): value is number {\n\treturn typeof value === 'number' && !isNaN(value)\n}\n\n/**\n * Type guard for checking if a value is a date\n * @param value Value to check\n * @returns True if the value is a valid Date object\n */\nexport function isDate(value: unknown): value is Date {\n\treturn value instanceof Date && !isNaN(value.getTime())\n}\n\n/**\n * Type guard for checking if a value is an iterable collection\n * @param value Value to check\n * @returns True if the value implements the iterable protocol\n */\nexport function isIterable<T = unknown>(value: unknown): value is Iterable<T> {\n\t// Must be non-null and of type 'object'\n\tif (value == null || typeof value !== 'object') {\n\t\treturn false\n\t}\n\n\t// Check for Symbol.iterator method\n\treturn Symbol.iterator in Object(value) && typeof (value as any)[Symbol.iterator] === 'function'\n}\n\n/**\n * Type guard for checking if a value is a Map\n * @param value Value to check\n * @returns True if the value is a Map\n */\nexport function isMap<K = unknown, V = unknown>(value: unknown): value is Map<K, V> {\n\treturn value instanceof Map\n}\n\n/**\n * Type guard for checking if a value is a Set\n * @param value Value to check\n * @returns True if the value is a Set\n */\nexport function isSet<T = unknown>(value: unknown): value is Set<T> {\n\treturn value instanceof Set\n}\n\n/**\n * Type guard for checking if a value is a plain object (not an array, Map, etc.)\n * @param value Value to check\n * @returns True if the value is a plain object\n */\nexport function isPlainObject(value: unknown): value is Record<string, unknown> {\n\tif (value === null || typeof value !== 'object') {\n\t\treturn false\n\t}\n\n\tconst proto = Object.getPrototypeOf(value)\n\treturn proto === Object.prototype || proto === null\n}\n\n/**\n * Type guard for checking if a value is undefined or null\n * @param value Value to check\n * @returns True if the value is undefined or null\n */\nexport function isNil(value: unknown): value is undefined | null {\n\treturn value === undefined || value === null\n}\n\n/**\n * Improved type-safe comparison function that uses appropriate type guards\n * @param op Comparison operator\n * @param actual Actual value\n * @param expected Expected value\n * @returns Result of the comparison\n */\nexport function compareValues(op: ComparisonOperator, actual: unknown, expected: unknown): boolean {\n\t// Handle null/undefined cases\n\tif (isNil(actual) && isNil(expected)) return true\n\tif (isNil(actual) || isNil(expected)) {\n\t\t// For equality operators, null == null but null != non-null\n\t\tif (op === '==') return actual === expected\n\t\tif (op === '!=') return actual !== expected\n\t\t// Other operators should return false for null/undefined values\n\t\treturn false\n\t}\n\n\tswitch (op) {\n\t\tcase '==':\n\t\t\treturn actual === expected\n\t\tcase '!=':\n\t\t\treturn actual !== expected\n\t\tcase '>':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual > expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() > expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) > 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase '<':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual < expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() < expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) < 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase '>=':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual >= expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() >= expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) >= 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase '<=':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual <= expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() <= expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) <= 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase 'includes': {\n\t\t\tif (isString(actual)) {\n\t\t\t\treturn actual.toLowerCase().includes(safeString(expected).toLowerCase())\n\t\t\t}\n\t\t\tif (isArray(actual)) {\n\t\t\t\treturn actual.includes(expected as any)\n\t\t\t}\n\t\t\tif (isSet(actual)) {\n\t\t\t\treturn actual.has(expected as any)\n\t\t\t}\n\t\t\tif (isMap(actual)) {\n\t\t\t\treturn Array.from(actual.values()).includes(expected as any)\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'notIncludes': {\n\t\t\tif (isString(actual)) {\n\t\t\t\treturn !actual.toLowerCase().includes(safeString(expected).toLowerCase())\n\t\t\t}\n\t\t\tif (isArray(actual)) {\n\t\t\t\treturn !actual.includes(expected as any)\n\t\t\t}\n\t\t\tif (isSet(actual)) {\n\t\t\t\treturn !actual.has(expected as any)\n\t\t\t}\n\t\t\tif (isMap(actual)) {\n\t\t\t\treturn !Array.from(actual.values()).includes(expected as any)\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\tcase 'startsWith': {\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.toLowerCase().startsWith(expected.toLowerCase())\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'endsWith': {\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.toLowerCase().endsWith(expected.toLowerCase())\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'in': {\n\t\t\tif (isArray(expected)) {\n\t\t\t\treturn expected.includes(actual as any)\n\t\t\t}\n\t\t\tif (isSet(expected)) {\n\t\t\t\treturn expected.has(actual as any)\n\t\t\t}\n\t\t\tif (isMap(expected)) {\n\t\t\t\treturn expected.has(actual as any) || Array.from(expected.values()).includes(actual as any)\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'notIn': {\n\t\t\tif (isArray(expected)) {\n\t\t\t\treturn !expected.includes(actual as any)\n\t\t\t}\n\t\t\tif (isSet(expected)) {\n\t\t\t\treturn !expected.has(actual as any)\n\t\t\t}\n\t\t\tif (isMap(expected)) {\n\t\t\t\treturn !expected.has(actual as any) && !Array.from(expected.values()).includes(actual as any)\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\tdefault: {\n\t\t\tconsole.warn(`Operator \"${op}\" is not supported in comparison.`)\n\t\t\treturn false\n\t\t}\n\t}\n}\n\n// Export a simpler alias for filterMapItems\nexport const filterMap = filterMapItems\n\n// Export an alias for filterArrayItems\nexport const filterArray = filterArrayItems\n","// src/store/selectors.ts\nimport { BehaviorSubject, Observable, combineLatest, distinctUntilChanged, map, share, shareReplay } from 'rxjs'\nimport { ICollectionStore, IStore, StoreError } from './types'\n\n/**\n * Deep equality comparison for maps and complex objects\n * More efficient than JSON.stringify for large objects\n */\nfunction deepEqual(a: unknown, b: unknown): boolean {\n\tif (a === b) return true\n\n\tif (a instanceof Map && b instanceof Map) {\n\t\tif (a.size !== b.size) return false\n\t\tfor (const [key, value] of a) {\n\t\t\tif (!b.has(key) || !deepEqual(value, b.get(key))) return false\n\t\t}\n\t\treturn true\n\t}\n\n\tif (a instanceof Set && b instanceof Set) {\n\t\tif (a.size !== b.size) return false\n\t\tfor (const item of a) {\n\t\t\tif (!b.has(item)) return false\n\t\t}\n\t\treturn true\n\t}\n\n\tif (typeof a === 'object' && a !== null && typeof b === 'object' && b !== null) {\n\t\tconst keysA = Object.keys(a)\n\t\tconst keysB = Object.keys(b)\n\n\t\tif (keysA.length !== keysB.length) return false\n\n\t\tfor (const key of keysA) {\n\t\t\t// @ts-ignore: Index signature\n\t\t\tif (!deepEqual(a[key], b[key])) return false\n\t\t}\n\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Creates a selector that derives a value from store state\n *\n * @param store The store to observe\n * @param selectorFn Function that transforms the state\n * @returns An observable of the selected state that only emits when the derived value changes\n */\nexport function createSelector<T, R>(store: IStore<T>, selectorFn: (state: T) => R): Observable<R> {\n\treturn store.$.pipe(map(selectorFn), distinctUntilChanged<R>(deepEqual), shareReplay(1))\n}\n\n/**\n * Creates a selector for collection stores that derives a value from the collection\n *\n * @param store The collection store to observe\n * @param selectorFn Function that transforms the collection\n * @returns An observable of the selected state that only emits when the derived value changes\n */\nexport function createCollectionSelector<T, R>(\n\tstore: ICollectionStore<T>,\n\tselectorFn: (state: Map<string, T>) => R,\n): Observable<R> {\n\treturn store.$.pipe(map(selectorFn), distinctUntilChanged<R>(deepEqual), shareReplay(1))\n}\n\n/**\n * Creates a selector that returns all items from a collection as an array\n *\n * @param store The collection store\n * @returns An observable of all items as an array\n */\nexport function createItemsSelector<T>(store: ICollectionStore<T>): Observable<T[]> {\n\treturn createCollectionSelector(store, collection => Array.from(collection.values()))\n}\n\n/**\n * Creates a selector that retrieves a single item from a collection\n *\n * @param store The collection store\n * @param itemKey The key of the item to select\n * @returns An observable of the selected item that emits when the item changes\n */\nexport function createItemSelector<T>(store: ICollectionStore<T>, itemKey: string): Observable<T | undefined> {\n\treturn createCollectionSelector(store, collection => collection.get(itemKey))\n}\n\n/**\n * Creates a selector that returns all keys from a collection\n */\nexport function createKeysSelector<T>(store: ICollectionStore<T>): Observable<string[]> {\n\treturn createCollectionSelector(store, collection => Array.from(collection.keys()))\n}\n\n/**\n * Creates a selector that returns entries (key-value pairs) from a collection\n */\nexport function createEntriesSelector<T>(store: ICollectionStore<T>): Observable<[string, T][]> {\n\treturn createCollectionSelector(store, collection => Array.from(collection.entries()))\n}\n\n/**\n * Creates a selector that sorts collection items\n */\nexport function createSortSelector<T>(store: ICollectionStore<T>, compareFn: (a: T, b: T) => number): Observable<T[]> {\n\treturn createCollectionSelector(store, collection => {\n\t\treturn Array.from(collection.values()).sort(compareFn)\n\t})\n}\n\n/**\n * Creates a selector that finds the first item matching a predicate\n */\nexport function createFindSelector<T>(\n\tstore: ICollectionStore<T>,\n\tpredicate: (item: T, key: string) => boolean,\n): Observable<T | undefined> {\n\treturn createCollectionSelector(store, collection => {\n\t\tfor (const [key, item] of collection.entries()) {\n\t\t\tif (predicate(item, key)) {\n\t\t\t\treturn item\n\t\t\t}\n\t\t}\n\t\treturn undefined\n\t})\n}\n\n/**\n * Creates a selector that filters items from a collection - OPTIMIZED\n *\n * @param store The collection store\n * @param filterFn Function that returns true for items to include\n * @returns An observable of filtered items as an array\n */\nexport function createFilterSelector<T>(\n\tstore: ICollectionStore<T>,\n\tfilterFn: (item: T, key: string) => boolean,\n): Observable<T[]> {\n\treturn createCollectionSelector(store, collection =>\n\t\tArray.from(collection.entries())\n\t\t\t.filter(([key, item]) => filterFn(item, key))\n\t\t\t.map(([_, item]) => item),\n\t)\n}\n\n/**\n * Creates a selector that maps collection values through a transform function - OPTIMIZED\n */\nexport function createMapSelector<T, R>(\n\tstore: ICollectionStore<T>,\n\tmapFn: (item: T, key: string) => R,\n): Observable<R[]> {\n\treturn createCollectionSelector(store, collection =>\n\t\tArray.from(collection.entries()).map(([key, item]) => mapFn(item, key)),\n\t)\n}\n\n/**\n * Creates a selector that counts items in a collection, optionally filtered - OPTIMIZED\n *\n * @param store The collection store\n * @param filterFn Optional function to filter which items to count\n * @returns An observable of the count\n */\nexport function createCountSelector<T>(\n\tstore: ICollectionStore<T>,\n\tfilterFn?: (item: T, key: string) => boolean,\n): Observable<number> {\n\treturn createCollectionSelector(store, collection => {\n\t\tif (!filterFn) return collection.size\n\n\t\treturn Array.from(collection.entries()).filter(([key, item]) => filterFn(item, key)).length\n\t})\n}\n\n/**\n * Optimized RxJS Pipeline - use share with reset on refCount zero for better memory management\n * in scenarios where selector subscriptions come and go\n *\n * @param store The store to observe\n * @param selectorFn Function that transforms the state\n * @returns An observable of the selected state with improved memory management\n */\nexport function createOptimizedSelector<T, R>(store: IStore<T>, selectorFn: (state: T) => R): Observable<R> {\n\treturn store.$.pipe(\n\t\tmap(selectorFn),\n\t\tdistinctUntilChanged<R>(deepEqual),\n\t\tshare({\n\t\t\tresetOnRefCountZero: true,\n\t\t\tresetOnError: false,\n\t\t\tresetOnComplete: false,\n\t\t}),\n\t)\n}\n\n/**\n * Creates a compound selector from multiple stores\n *\n * This function combines data from multiple stores to create a derived\n * state that's compatible with the @select decorator.\n *\n * @param stores Array of stores to derive state from\n * @param selectorFns Selector functions for each store\n * @param combinerFn Function that combines the selected values\n * @returns A store-compatible object to use with @select\n */\nexport function createCompoundSelector<R>(\n\tstores: Array<IStore<any> | ICollectionStore<any>>,\n\tselectorFns: Array<(state: any) => any>,\n\tcombinerFn: (...values: any[]) => R,\n): IStore<R> {\n\t// Calculate initial value\n\tconst initialValues = stores.map((store, index) => selectorFns[index](store.value))\n\tconst initialValue = combinerFn(...initialValues)\n\n\t// Create a store with the initial value\n\tconst result: IStore<R> = {\n\t\t$: new BehaviorSubject<R>(initialValue),\n\t\terror$: new BehaviorSubject<StoreError | null>(null),\n\t\tready: true,\n\t\tdefaultValue: initialValue,\n\n\t\tget value(): R {\n\t\t\treturn this.$.getValue()\n\t\t},\n\n\t\t// These methods are no-ops for read-only stores\n\t\tset(_value: Partial<R>, _merge?: boolean): void {\n\t\t\tconsole.warn('Compound selector store is read-only')\n\t\t},\n\n\t\tclear(): void {\n\t\t\tthis.$.next(this.defaultValue)\n\t\t},\n\n\t\treplace(_newValue: R): void {\n\t\t\tconsole.warn('Compound selector store is read-only')\n\t\t},\n\n\t\tdelete<K extends keyof R>(_key: K): void {\n\t\t\tconsole.warn('Compound selector store is read-only')\n\t\t},\n\n\t\tdestroy(): void {\n\t\t\tthis.$.complete()\n\t\t\tthis.error$.complete()\n\t\t},\n\t}\n\n\t// Set up the reactivity by subscribing to all source stores\n\tconst observables = stores.map((store, _) => store.$)\n\n\t// Create a subscription that updates the result whenever any source changes\n\tconst subscription = combineLatest(observables).subscribe({\n\t\tnext: storeValues => {\n\t\t\ttry {\n\t\t\t\t// Apply selectors to each store value\n\t\t\t\tconst selectedValues = storeValues.map((value, index) => selectorFns[index](value))\n\n\t\t\t\t// Apply combiner function\n\t\t\t\tconst newValue = combinerFn(...selectedValues)\n\n\t\t\t\t// Update the BehaviorSubject\n\t\t\t\tresult.$.next(newValue)\n\t\t\t} catch (err) {\n\t\t\t\tconst error = new StoreError('Error in compound selector', err)\n\t\t\t\tresult.error$.next(error)\n\t\t\t\tconsole.error(error)\n\t\t\t}\n\t\t},\n\t\terror: err => {\n\t\t\tconst error = new StoreError('Error in store subscription', err)\n\t\t\tresult.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t},\n\t})\n\n\t// Ensure the subscription is cleaned up when the store is destroyed\n\tconst originalDestroy = result.destroy\n\tresult.destroy = function () {\n\t\tsubscription.unsubscribe()\n\t\toriginalDestroy.call(this)\n\t}\n\n\treturn result\n}\n","// src/store/selector-hook.ts - Improved memory management\nimport { property as litProperty } from 'lit/decorators.js'\nimport { Observable, Subject, Subscription } from 'rxjs'\nimport { takeUntil } from 'rxjs/operators'\nimport { createCollectionSelector, createSelector } from './selectors'\nimport { ICollectionStore, IStore } from './types'\n\n/**\n * Symbol used for storing cleanup resources\n * Using a Symbol prevents name collisions with component properties\n */\nconst CLEANUP_SUBJECT = Symbol('selectorCleanup')\nconst SUBSCRIPTIONS = Symbol('selectorSubscriptions')\nconst INITIALIZED = Symbol('selectorInitialized')\nconst CONNECTED_CALLED = Symbol('connectedCallbackCalled')\n\n/**\n * Component lifecycle interface\n */\ninterface ComponentWithLifecycle {\n\t// Lifecycle hooks\n\tisConnected: boolean\n\tdisconnectedCallback?: () => void\n\tconnectedCallback?: () => void\n\trequestUpdate?: () => void\n\n\t// Internal properties using symbols to avoid name collisions\n\t[CLEANUP_SUBJECT]?: Subject<void>\n\t[SUBSCRIPTIONS]?: Map<string, Subscription>\n\t[INITIALIZED]?: Set<string>\n\t[CONNECTED_CALLED]?: boolean\n\n\t// Value storage\n\t[key: string]: any\n}\n\n/**\n * Property descriptor interface\n */\ntype PropertyDescriptor<T> = {\n\tget?: () => T\n\tset?: (value: T) => void\n\tvalue?: T\n\tconfigurable?: boolean\n\tenumerable?: boolean\n\twritable?: boolean\n}\n\n/**\n * Options for selecting from a store\n */\ninterface SelectOptions {\n\t/** If true, will wait for selector to emit a value (including null) before calling connectedCallback. Only undefined is considered \"not ready\". Default is true. */\n\trequired?: boolean\n\n\t/** If true, will only update the component and not set the property value */\n\tupdateOnly?: boolean\n\n\t/** If true, will use structuredClone to deeply clone values (prevents mutations) */\n\tdeepClone?: boolean\n\n\t/** Custom equality function to determine when to update */\n\tequals?: (a: any, b: any) => boolean\n\n\t/** Debug mode - logs selector activity */\n\tdebug?: boolean\n}\n\n/**\n * Type guard to check if a store is a collection store\n */\nfunction isCollectionStore<T>(store: IStore<any> | ICollectionStore<T>): store is ICollectionStore<T> {\n\treturn 'set' in store && typeof store.set === 'function' && store.value instanceof Map\n}\n\n/**\n * Ensures the cleanup resources exist on the component\n */\nfunction ensureCleanupResources(component: ComponentWithLifecycle): void {\n\tif (!component[CLEANUP_SUBJECT] || component[CLEANUP_SUBJECT].closed) {\n\t\tcomponent[CLEANUP_SUBJECT] = new Subject<void>()\n\t}\n\n\tif (!component[SUBSCRIPTIONS]) {\n\t\tcomponent[SUBSCRIPTIONS] = new Map()\n\t}\n\n\tif (!component[INITIALIZED]) {\n\t\tcomponent[INITIALIZED] = new Set()\n\t}\n}\n\n/**\n * Cleans up all selector resources\n */\nfunction cleanupSelectorResources(component: ComponentWithLifecycle): void {\n\tif (component[CLEANUP_SUBJECT]) {\n\t\tcomponent[CLEANUP_SUBJECT].next()\n\t\tcomponent[CLEANUP_SUBJECT].complete()\n\t\tcomponent[CLEANUP_SUBJECT] = undefined\n\t}\n\n\tif (component[SUBSCRIPTIONS]) {\n\t\tcomponent[SUBSCRIPTIONS].forEach(sub => sub.unsubscribe())\n\t\tcomponent[SUBSCRIPTIONS].clear()\n\t\tcomponent[SUBSCRIPTIONS] = undefined\n\t}\n\n\tif (component[INITIALIZED]) {\n\t\tcomponent[INITIALIZED].clear()\n\t\tcomponent[INITIALIZED] = undefined\n\t}\n\n\t// Reset the connected flag when cleaning up\n\tcomponent[CONNECTED_CALLED] = undefined\n}\n\n/**\n * Selector decorator that connects a component property to a store selector\n * with improved memory management\n *\n * @param store The store to select from\n * @param selectorFn Optional function to transform the store state\n * @param options Additional options for the selector\n */\nexport function select<T, R>(\n\tstore: IStore<T> | ICollectionStore<T>,\n\tselectorFn: (state: any) => R = (state: R) => state,\n\toptions: SelectOptions = { required: true },\n) {\n\treturn function (proto: Record<string, any>, propName: string, _descriptor?: PropertyDescriptor<R>) {\n\t\t// Register as a Lit property\n\t\tlitProperty({ attribute: false, type: Object })(proto, propName)\n\n\t\t// Store original lifecycle methods\n\t\tconst originalConnectedCallback = proto.connectedCallback\n\t\tconst originalDisconnectedCallback = proto.disconnectedCallback\n\n\t\t// Override connectedCallback to set up subscription\n\t\tproto.connectedCallback = function (this: ComponentWithLifecycle) {\n\t\t\t// Initialize cleanup resources\n\t\t\tensureCleanupResources(this)\n\n\t\t\t// Create the appropriate selector\n\t\t\tconst selector: Observable<R> = isCollectionStore(store)\n\t\t\t\t? createCollectionSelector(store, selectorFn)\n\t\t\t\t: createSelector(store as IStore<T>, selectorFn)\n\n\t\t\t// Call original connectedCallback immediately if not waiting for data\n\t\t\tif (!options.required && !this[CONNECTED_CALLED]) {\n\t\t\t\toriginalConnectedCallback?.call(this)\n\t\t\t\tthis[CONNECTED_CALLED] = true\n\t\t\t}\n\n\t\t\t// Clean up any existing subscription\n\t\t\tif (this[SUBSCRIPTIONS]!.has(propName)) {\n\t\t\t\tthis[SUBSCRIPTIONS]!.get(propName)?.unsubscribe()\n\t\t\t\tthis[SUBSCRIPTIONS]!.delete(propName)\n\t\t\t}\n\n\t\t\t// Debug log if needed\n\t\t\tif (options.debug) {\n\t\t\t\tconsole.debug(`[select] Setting up subscription for ${propName}`)\n\t\t\t}\n\n\t\t\t// Create new subscription with better error handling\n\t\t\tconst subscription = selector.pipe(takeUntil(this[CLEANUP_SUBJECT]!)).subscribe({\n\t\t\t\tnext: (value: R) => {\n\t\t\t\t\t// Handle value updates\n\t\t\t\t\tconst newValue = options.deepClone ? structuredClone(value) : value\n\n\t\t\t\t\tif (options.debug) {\n\t\t\t\t\t\tconsole.debug(`[select] New value for ${propName}:`, newValue)\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!options.updateOnly) {\n\t\t\t\t\t\tthis[propName] = newValue\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.requestUpdate?.()\n\n\t\t\t\t\t// If required and not initialized, call connectedCallback when we get a value\n\t\t\t\t\t// Allow null values but not undefined (undefined means the selector hasn't emitted yet)\n\t\t\t\t\tif (options.required && !this[INITIALIZED]!.has(propName) && newValue !== undefined) {\n\t\t\t\t\t\tthis[INITIALIZED]!.add(propName)\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Only call original connectedCallback once, regardless of how many selectors\n\t\t\t\t\t\tif (!this[CONNECTED_CALLED]) {\n\t\t\t\t\t\t\tif (options.debug) {\n\t\t\t\t\t\t\t\tconsole.debug(`[select] Calling delayed connectedCallback for ${propName}`)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\toriginalConnectedCallback?.call(this)\n\t\t\t\t\t\t\tthis[CONNECTED_CALLED] = true\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\terror: (err: Error) => {\n\t\t\t\t\tconsole.error(`Error in selector subscription for ${propName}:`, err)\n\t\t\t\t\t// Resubscribe on error to prevent component from becoming unresponsive\n\t\t\t\t\tif (this.isConnected) {\n\t\t\t\t\t\t// Small delay to prevent immediate resubscription\n\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\tif (this.isConnected) {\n\t\t\t\t\t\t\t\tif (options.debug) {\n\t\t\t\t\t\t\t\t\tconsole.debug(`[select] Resubscribing after error for ${propName}`)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tthis.connectedCallback?.()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 1000)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t})\n\n\t\t\t// Store the subscription for cleanup\n\t\t\tthis[SUBSCRIPTIONS]!.set(propName, subscription)\n\t\t}\n\n\t\t// Override disconnectedCallback to clean up subscriptions\n\t\tproto.disconnectedCallback = function (this: ComponentWithLifecycle) {\n\t\t\t// Call original disconnectedCallback\n\t\t\toriginalDisconnectedCallback?.call(this)\n\n\t\t\t// Debug log if needed\n\t\t\tif (options.debug) {\n\t\t\t\tconsole.debug(`[select] Cleaning up resources in disconnectedCallback`)\n\t\t\t}\n\n\t\t\t// Clean up all subscription resources\n\t\t\tcleanupSelectorResources(this)\n\t\t}\n\t}\n}\n\n/**\n * Creates a selector decorator that selects a specific item from a collection store\n * with improved memory management\n *\n * @param store The collection store\n * @param keyGetter Function that returns the key to select\n * @param options Additional options\n */\nexport function selectItem<T>(\n\tstore: ICollectionStore<T>,\n\tkeyGetter: (component: any) => string,\n\toptions: SelectOptions = { required: true },\n) {\n\treturn function (proto: Record<string, any>, propName: string, _descriptor?: PropertyDescriptor<T | undefined>) {\n\t\tselect(\n\t\t\tstore,\n\t\t\tfunction (state) {\n\t\t\t\t// This will be evaluated during subscription, when 'this' is available\n\t\t\t\tconst itemKey = keyGetter(this)\n\t\t\t\treturn itemKey ? state.get(itemKey) : undefined\n\t\t\t},\n\t\t\toptions,\n\t\t)(proto, propName)\n\t}\n}\n"],"x_google_ignoreList":[0],"mappings":";;;AACA,IAAI,KAAU,OAAO,IAAI,gBAAA,EACrB,IAAY,OAAO,IAAI,kBAAA,EACvB,IAAc,OAAO,IAAI,cAAA,EAGzB,KAAA,QAAA,IAAA,aAAkC,eA8BlC,EAAA,GA9BiD;CAEnD,SAAS,GAAA;AACP,SAAO,mBAAmB,EAAA,kFAAyF,EAAA;;CAErH,SAAS,GAAA;AACP,SAAO,sJAAsJ,EAAA;;CAE/J;CACA,SAAS,GAAA;AACP,SAAO,yHAAyH;;CAElI;CACA;CACA;CACA;CACA;CACA;CACA,SAAS,GAAA;AACP,SAAO,mCAAmC;;CAE5C;CACA;CACA;CACA;CACA,SAAS,GAAA;AACP,SAAO,oCAAoC;;CAAA;AAK/C,SAAS,EAAI,GAAA,GAAU,GAAA;AACrB,KAAA,QAAA,IAAA,aAA6B,cAAc;EACzC,IAAM,IAAI,GAAO,IACX,IAAM,EAAW,EAAA,GAAK,EAAE,MAAM,MAAM,EAAA,GAAQ;AAClD,QAAU,MAAM,WAAW,IAAA;;AAE7B,OAAU,MACR,8BAA8B,EAAA,yCAAA;;AAKlC,IAAI,IAAI,QACJ,IAAiB,EAAE,gBACnB,IAAc,eACd,KAAY,aACZ,KAAe,gBACf,IAAa,cACb,IAAW,YACX,IAAQ,SACR,KAAW,M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,KAAA,KAAmB,IAG1B,EAAU,OACb,EAAU,GAAe,SAAQ,MAAO,EAAI,aAAA,CAAA,EAC5C,EAAU,GAAe,OAAA,EACzB,EAAU,KAAA,KAAiB,IAGxB,EAAU,OACb,EAAU,GAAa,OAAA,EACvB,EAAU,KAAA,KAAe,IAI1B,EAAU,KAAA,KAAoB;;;;AAgI/B,SAAgB,GACf,GACA,GACA,IAAyB,EAAE,UAAA,CAAU,GAAA,EAAA;AAErC,QAAO,SAAU,GAA4B,GAAkB,GAAA;AAC9D,KACC,GACA,SAAU,GAAA;GAET,IAAM,IAAU,EAAU,KAAA;AAC1B,UAAO,IAAU,EAAM,IAAI,EAAA,GAAA,KAAW;KAEvC,EAPD,CAQE,GAAO,EAAA;;;AAAA,SAAA,KAAA,GAAA,MAAA,GAAA,KAAA,GAAA,KAAA,GAAA,KAAA,GAAA,MAAA,GAAA,KAAA,GAAA,KAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,KAAA,GAAA,KAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,KAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,KAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,MAAA"}
1
+ {"version":3,"file":"store-CjzZDQt8.js","names":["isPlainObject","isArray","isMap","isSet","finalize"],"sources":["../node_modules/immer/dist/immer.mjs","../src/store/types.ts","../src/store/storage-manager.ts","../src/store/store.class.ts","../src/store/context-array.ts","../src/store/context-collection.ts","../src/store/context-object.ts","../src/store/context-create.ts","../src/store/filter-directive.ts","../src/store/selectors.ts","../src/store/selector-hook.ts"],"sourcesContent":["// src/utils/env.ts\nvar NOTHING = Symbol.for(\"immer-nothing\");\nvar DRAFTABLE = Symbol.for(\"immer-draftable\");\nvar DRAFT_STATE = Symbol.for(\"immer-state\");\n\n// src/utils/errors.ts\nvar errors = process.env.NODE_ENV !== \"production\" ? [\n // All error codes, starting by 0:\n function(plugin) {\n return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \\`enable${plugin}()\\` when initializing your application.`;\n },\n function(thing) {\n 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 '${thing}'`;\n },\n \"This object has been frozen and should not be mutated\",\n function(data) {\n return \"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? \" + data;\n },\n \"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.\",\n \"Immer forbids circular references\",\n \"The first or second argument to `produce` must be a function\",\n \"The third argument to `produce` must be a function or undefined\",\n \"First argument to `createDraft` must be a plain object, an array, or an immerable object\",\n \"First argument to `finishDraft` must be a draft returned by `createDraft`\",\n function(thing) {\n return `'current' expects a draft, got: ${thing}`;\n },\n \"Object.defineProperty() cannot be used on an Immer draft\",\n \"Object.setPrototypeOf() cannot be used on an Immer draft\",\n \"Immer only supports deleting array indices\",\n \"Immer only supports setting array indices and the 'length' property\",\n function(thing) {\n return `'original' expects a draft, got: ${thing}`;\n }\n // Note: if more errors are added, the errorOffset in Patches.ts should be increased\n // See Patches.ts for additional errors\n] : [];\nfunction die(error, ...args) {\n if (process.env.NODE_ENV !== \"production\") {\n const e = errors[error];\n const msg = isFunction(e) ? e.apply(null, args) : e;\n throw new Error(`[Immer] ${msg}`);\n }\n throw new Error(\n `[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`\n );\n}\n\n// src/utils/common.ts\nvar O = Object;\nvar getPrototypeOf = O.getPrototypeOf;\nvar CONSTRUCTOR = \"constructor\";\nvar PROTOTYPE = \"prototype\";\nvar CONFIGURABLE = \"configurable\";\nvar ENUMERABLE = \"enumerable\";\nvar WRITABLE = \"writable\";\nvar VALUE = \"value\";\nvar isDraft = (value) => !!value && !!value[DRAFT_STATE];\nfunction isDraftable(value) {\n if (!value)\n return false;\n return isPlainObject(value) || isArray(value) || !!value[DRAFTABLE] || !!value[CONSTRUCTOR]?.[DRAFTABLE] || isMap(value) || isSet(value);\n}\nvar objectCtorString = O[PROTOTYPE][CONSTRUCTOR].toString();\nvar cachedCtorStrings = /* @__PURE__ */ new WeakMap();\nfunction isPlainObject(value) {\n if (!value || !isObjectish(value))\n return false;\n const proto = getPrototypeOf(value);\n if (proto === null || proto === O[PROTOTYPE])\n return true;\n const Ctor = O.hasOwnProperty.call(proto, CONSTRUCTOR) && proto[CONSTRUCTOR];\n if (Ctor === Object)\n return true;\n if (!isFunction(Ctor))\n return false;\n let ctorString = cachedCtorStrings.get(Ctor);\n if (ctorString === void 0) {\n ctorString = Function.toString.call(Ctor);\n cachedCtorStrings.set(Ctor, ctorString);\n }\n return ctorString === objectCtorString;\n}\nfunction original(value) {\n if (!isDraft(value))\n die(15, value);\n return value[DRAFT_STATE].base_;\n}\nfunction each(obj, iter, strict = true) {\n if (getArchtype(obj) === 0 /* Object */) {\n const keys = strict ? Reflect.ownKeys(obj) : O.keys(obj);\n keys.forEach((key) => {\n iter(key, obj[key], obj);\n });\n } else {\n obj.forEach((entry, index) => iter(index, entry, obj));\n }\n}\nfunction getArchtype(thing) {\n const state = thing[DRAFT_STATE];\n return state ? state.type_ : isArray(thing) ? 1 /* Array */ : isMap(thing) ? 2 /* Map */ : isSet(thing) ? 3 /* Set */ : 0 /* Object */;\n}\nvar has = (thing, prop, type = getArchtype(thing)) => type === 2 /* Map */ ? thing.has(prop) : O[PROTOTYPE].hasOwnProperty.call(thing, prop);\nvar get = (thing, prop, type = getArchtype(thing)) => (\n // @ts-ignore\n type === 2 /* Map */ ? thing.get(prop) : thing[prop]\n);\nvar set = (thing, propOrOldValue, value, type = getArchtype(thing)) => {\n if (type === 2 /* Map */)\n thing.set(propOrOldValue, value);\n else if (type === 3 /* Set */) {\n thing.add(value);\n } else\n thing[propOrOldValue] = value;\n};\nfunction is(x, y) {\n if (x === y) {\n return x !== 0 || 1 / x === 1 / y;\n } else {\n return x !== x && y !== y;\n }\n}\nvar isArray = Array.isArray;\nvar isMap = (target) => target instanceof Map;\nvar isSet = (target) => target instanceof Set;\nvar isObjectish = (target) => typeof target === \"object\";\nvar isFunction = (target) => typeof target === \"function\";\nvar isBoolean = (target) => typeof target === \"boolean\";\nfunction isArrayIndex(value) {\n const n = +value;\n return Number.isInteger(n) && String(n) === value;\n}\nvar getProxyDraft = (value) => {\n if (!isObjectish(value))\n return null;\n return value?.[DRAFT_STATE];\n};\nvar latest = (state) => state.copy_ || state.base_;\nvar getValue = (value) => {\n const proxyDraft = getProxyDraft(value);\n return proxyDraft ? proxyDraft.copy_ ?? proxyDraft.base_ : value;\n};\nvar getFinalValue = (state) => state.modified_ ? state.copy_ : state.base_;\nfunction shallowCopy(base, strict) {\n if (isMap(base)) {\n return new Map(base);\n }\n if (isSet(base)) {\n return new Set(base);\n }\n if (isArray(base))\n return Array[PROTOTYPE].slice.call(base);\n const isPlain = isPlainObject(base);\n if (strict === true || strict === \"class_only\" && !isPlain) {\n const descriptors = O.getOwnPropertyDescriptors(base);\n delete descriptors[DRAFT_STATE];\n let keys = Reflect.ownKeys(descriptors);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const desc = descriptors[key];\n if (desc[WRITABLE] === false) {\n desc[WRITABLE] = true;\n desc[CONFIGURABLE] = true;\n }\n if (desc.get || desc.set)\n descriptors[key] = {\n [CONFIGURABLE]: true,\n [WRITABLE]: true,\n // could live with !!desc.set as well here...\n [ENUMERABLE]: desc[ENUMERABLE],\n [VALUE]: base[key]\n };\n }\n return O.create(getPrototypeOf(base), descriptors);\n } else {\n const proto = getPrototypeOf(base);\n if (proto !== null && isPlain) {\n return { ...base };\n }\n const obj = O.create(proto);\n return O.assign(obj, base);\n }\n}\nfunction freeze(obj, deep = false) {\n if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj))\n return obj;\n if (getArchtype(obj) > 1) {\n O.defineProperties(obj, {\n set: dontMutateMethodOverride,\n add: dontMutateMethodOverride,\n clear: dontMutateMethodOverride,\n delete: dontMutateMethodOverride\n });\n }\n O.freeze(obj);\n if (deep)\n each(\n obj,\n (_key, value) => {\n freeze(value, true);\n },\n false\n );\n return obj;\n}\nfunction dontMutateFrozenCollections() {\n die(2);\n}\nvar dontMutateMethodOverride = {\n [VALUE]: dontMutateFrozenCollections\n};\nfunction isFrozen(obj) {\n if (obj === null || !isObjectish(obj))\n return true;\n return O.isFrozen(obj);\n}\n\n// src/utils/plugins.ts\nvar PluginMapSet = \"MapSet\";\nvar PluginPatches = \"Patches\";\nvar PluginArrayMethods = \"ArrayMethods\";\nvar plugins = {};\nfunction getPlugin(pluginKey) {\n const plugin = plugins[pluginKey];\n if (!plugin) {\n die(0, pluginKey);\n }\n return plugin;\n}\nvar isPluginLoaded = (pluginKey) => !!plugins[pluginKey];\nfunction loadPlugin(pluginKey, implementation) {\n if (!plugins[pluginKey])\n plugins[pluginKey] = implementation;\n}\n\n// src/core/scope.ts\nvar currentScope;\nvar getCurrentScope = () => currentScope;\nvar createScope = (parent_, immer_) => ({\n drafts_: [],\n parent_,\n immer_,\n // Whenever the modified draft contains a draft from another scope, we\n // need to prevent auto-freezing so the unowned draft can be finalized.\n canAutoFreeze_: true,\n unfinalizedDrafts_: 0,\n handledSet_: /* @__PURE__ */ new Set(),\n processedForPatches_: /* @__PURE__ */ new Set(),\n mapSetPlugin_: isPluginLoaded(PluginMapSet) ? getPlugin(PluginMapSet) : void 0,\n arrayMethodsPlugin_: isPluginLoaded(PluginArrayMethods) ? getPlugin(PluginArrayMethods) : void 0\n});\nfunction usePatchesInScope(scope, patchListener) {\n if (patchListener) {\n scope.patchPlugin_ = getPlugin(PluginPatches);\n scope.patches_ = [];\n scope.inversePatches_ = [];\n scope.patchListener_ = patchListener;\n }\n}\nfunction revokeScope(scope) {\n leaveScope(scope);\n scope.drafts_.forEach(revokeDraft);\n scope.drafts_ = null;\n}\nfunction leaveScope(scope) {\n if (scope === currentScope) {\n currentScope = scope.parent_;\n }\n}\nvar enterScope = (immer2) => currentScope = createScope(currentScope, immer2);\nfunction revokeDraft(draft) {\n const state = draft[DRAFT_STATE];\n if (state.type_ === 0 /* Object */ || state.type_ === 1 /* Array */)\n state.revoke_();\n else\n state.revoked_ = true;\n}\n\n// src/core/finalize.ts\nfunction processResult(result, scope) {\n scope.unfinalizedDrafts_ = scope.drafts_.length;\n const baseDraft = scope.drafts_[0];\n const isReplaced = result !== void 0 && result !== baseDraft;\n if (isReplaced) {\n if (baseDraft[DRAFT_STATE].modified_) {\n revokeScope(scope);\n die(4);\n }\n if (isDraftable(result)) {\n result = finalize(scope, result);\n }\n const { patchPlugin_ } = scope;\n if (patchPlugin_) {\n patchPlugin_.generateReplacementPatches_(\n baseDraft[DRAFT_STATE].base_,\n result,\n scope\n );\n }\n } else {\n result = finalize(scope, baseDraft);\n }\n maybeFreeze(scope, result, true);\n revokeScope(scope);\n if (scope.patches_) {\n scope.patchListener_(scope.patches_, scope.inversePatches_);\n }\n return result !== NOTHING ? result : void 0;\n}\nfunction finalize(rootScope, value) {\n if (isFrozen(value))\n return value;\n const state = value[DRAFT_STATE];\n if (!state) {\n const finalValue = handleValue(value, rootScope.handledSet_, rootScope);\n return finalValue;\n }\n if (!isSameScope(state, rootScope)) {\n return value;\n }\n if (!state.modified_) {\n return state.base_;\n }\n if (!state.finalized_) {\n const { callbacks_ } = state;\n if (callbacks_) {\n while (callbacks_.length > 0) {\n const callback = callbacks_.pop();\n callback(rootScope);\n }\n }\n generatePatchesAndFinalize(state, rootScope);\n }\n return state.copy_;\n}\nfunction maybeFreeze(scope, value, deep = false) {\n if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {\n freeze(value, deep);\n }\n}\nfunction markStateFinalized(state) {\n state.finalized_ = true;\n state.scope_.unfinalizedDrafts_--;\n}\nvar isSameScope = (state, rootScope) => state.scope_ === rootScope;\nvar EMPTY_LOCATIONS_RESULT = [];\nfunction updateDraftInParent(parent, draftValue, finalizedValue, originalKey) {\n const parentCopy = latest(parent);\n const parentType = parent.type_;\n if (originalKey !== void 0) {\n const currentValue = get(parentCopy, originalKey, parentType);\n if (currentValue === draftValue) {\n set(parentCopy, originalKey, finalizedValue, parentType);\n return;\n }\n }\n if (!parent.draftLocations_) {\n const draftLocations = parent.draftLocations_ = /* @__PURE__ */ new Map();\n each(parentCopy, (key, value) => {\n if (isDraft(value)) {\n const keys = draftLocations.get(value) || [];\n keys.push(key);\n draftLocations.set(value, keys);\n }\n });\n }\n const locations = parent.draftLocations_.get(draftValue) ?? EMPTY_LOCATIONS_RESULT;\n for (const location of locations) {\n set(parentCopy, location, finalizedValue, parentType);\n }\n}\nfunction registerChildFinalizationCallback(parent, child, key) {\n parent.callbacks_.push(function childCleanup(rootScope) {\n const state = child;\n if (!state || !isSameScope(state, rootScope)) {\n return;\n }\n rootScope.mapSetPlugin_?.fixSetContents(state);\n const finalizedValue = getFinalValue(state);\n updateDraftInParent(parent, state.draft_ ?? state, finalizedValue, key);\n generatePatchesAndFinalize(state, rootScope);\n });\n}\nfunction generatePatchesAndFinalize(state, rootScope) {\n const shouldFinalize = state.modified_ && !state.finalized_ && (state.type_ === 3 /* Set */ || state.type_ === 1 /* Array */ && state.allIndicesReassigned_ || (state.assigned_?.size ?? 0) > 0);\n if (shouldFinalize) {\n const { patchPlugin_ } = rootScope;\n if (patchPlugin_) {\n const basePath = patchPlugin_.getPath(state);\n if (basePath) {\n patchPlugin_.generatePatches_(state, basePath, rootScope);\n }\n }\n markStateFinalized(state);\n }\n}\nfunction handleCrossReference(target, key, value) {\n const { scope_ } = target;\n if (isDraft(value)) {\n const state = value[DRAFT_STATE];\n if (isSameScope(state, scope_)) {\n state.callbacks_.push(function crossReferenceCleanup() {\n prepareCopy(target);\n const finalizedValue = getFinalValue(state);\n updateDraftInParent(target, value, finalizedValue, key);\n });\n }\n } else if (isDraftable(value)) {\n target.callbacks_.push(function nestedDraftCleanup() {\n const targetCopy = latest(target);\n if (target.type_ === 3 /* Set */) {\n if (targetCopy.has(value)) {\n handleValue(value, scope_.handledSet_, scope_);\n }\n } else {\n if (get(targetCopy, key, target.type_) === value) {\n if (scope_.drafts_.length > 1 && (target.assigned_.get(key) ?? false) === true && target.copy_) {\n handleValue(\n get(target.copy_, key, target.type_),\n scope_.handledSet_,\n scope_\n );\n }\n }\n }\n });\n }\n}\nfunction handleValue(target, handledSet, rootScope) {\n if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {\n return target;\n }\n if (isDraft(target) || handledSet.has(target) || !isDraftable(target) || isFrozen(target)) {\n return target;\n }\n handledSet.add(target);\n each(target, (key, value) => {\n if (isDraft(value)) {\n const state = value[DRAFT_STATE];\n if (isSameScope(state, rootScope)) {\n const updatedValue = getFinalValue(state);\n set(target, key, updatedValue, target.type_);\n markStateFinalized(state);\n }\n } else if (isDraftable(value)) {\n handleValue(value, handledSet, rootScope);\n }\n });\n return target;\n}\n\n// src/core/proxy.ts\nfunction createProxyProxy(base, parent) {\n const baseIsArray = isArray(base);\n const state = {\n type_: baseIsArray ? 1 /* Array */ : 0 /* Object */,\n // Track which produce call this is associated with.\n scope_: parent ? parent.scope_ : getCurrentScope(),\n // True for both shallow and deep changes.\n modified_: false,\n // Used during finalization.\n finalized_: false,\n // Track which properties have been assigned (true) or deleted (false).\n // actually instantiated in `prepareCopy()`\n assigned_: void 0,\n // The parent draft state.\n parent_: parent,\n // The base state.\n base_: base,\n // The base proxy.\n draft_: null,\n // set below\n // The base copy with any updated values.\n copy_: null,\n // Called by the `produce` function.\n revoke_: null,\n isManual_: false,\n // `callbacks` actually gets assigned in `createProxy`\n callbacks_: void 0\n };\n let target = state;\n let traps = objectTraps;\n if (baseIsArray) {\n target = [state];\n traps = arrayTraps;\n }\n const { revoke, proxy } = Proxy.revocable(target, traps);\n state.draft_ = proxy;\n state.revoke_ = revoke;\n return [proxy, state];\n}\nvar objectTraps = {\n get(state, prop) {\n if (prop === DRAFT_STATE)\n return state;\n let arrayPlugin = state.scope_.arrayMethodsPlugin_;\n const isArrayWithStringProp = state.type_ === 1 /* Array */ && typeof prop === \"string\";\n if (isArrayWithStringProp) {\n if (arrayPlugin?.isArrayOperationMethod(prop)) {\n return arrayPlugin.createMethodInterceptor(state, prop);\n }\n }\n const source = latest(state);\n if (!has(source, prop, state.type_)) {\n return readPropFromProto(state, source, prop);\n }\n const value = source[prop];\n if (state.finalized_ || !isDraftable(value)) {\n return value;\n }\n if (isArrayWithStringProp && state.operationMethod && arrayPlugin?.isMutatingArrayMethod(\n state.operationMethod\n ) && isArrayIndex(prop)) {\n return value;\n }\n if (value === peek(state.base_, prop)) {\n prepareCopy(state);\n const childKey = state.type_ === 1 /* Array */ ? +prop : prop;\n const childDraft = createProxy(state.scope_, value, state, childKey);\n return state.copy_[childKey] = childDraft;\n }\n return value;\n },\n has(state, prop) {\n return prop in latest(state);\n },\n ownKeys(state) {\n return Reflect.ownKeys(latest(state));\n },\n set(state, prop, value) {\n const desc = getDescriptorFromProto(latest(state), prop);\n if (desc?.set) {\n desc.set.call(state.draft_, value);\n return true;\n }\n if (!state.modified_) {\n const current2 = peek(latest(state), prop);\n const currentState = current2?.[DRAFT_STATE];\n if (currentState && currentState.base_ === value) {\n state.copy_[prop] = value;\n state.assigned_.set(prop, false);\n return true;\n }\n if (is(value, current2) && (value !== void 0 || has(state.base_, prop, state.type_)))\n return true;\n prepareCopy(state);\n markChanged(state);\n }\n if (state.copy_[prop] === value && // special case: handle new props with value 'undefined'\n (value !== void 0 || prop in state.copy_) || // special case: NaN\n Number.isNaN(value) && Number.isNaN(state.copy_[prop]))\n return true;\n state.copy_[prop] = value;\n state.assigned_.set(prop, true);\n handleCrossReference(state, prop, value);\n return true;\n },\n deleteProperty(state, prop) {\n prepareCopy(state);\n if (peek(state.base_, prop) !== void 0 || prop in state.base_) {\n state.assigned_.set(prop, false);\n markChanged(state);\n } else {\n state.assigned_.delete(prop);\n }\n if (state.copy_) {\n delete state.copy_[prop];\n }\n return true;\n },\n // Note: We never coerce `desc.value` into an Immer draft, because we can't make\n // the same guarantee in ES5 mode.\n getOwnPropertyDescriptor(state, prop) {\n const owner = latest(state);\n const desc = Reflect.getOwnPropertyDescriptor(owner, prop);\n if (!desc)\n return desc;\n return {\n [WRITABLE]: true,\n [CONFIGURABLE]: state.type_ !== 1 /* Array */ || prop !== \"length\",\n [ENUMERABLE]: desc[ENUMERABLE],\n [VALUE]: owner[prop]\n };\n },\n defineProperty() {\n die(11);\n },\n getPrototypeOf(state) {\n return getPrototypeOf(state.base_);\n },\n setPrototypeOf() {\n die(12);\n }\n};\nvar arrayTraps = {};\nfor (let key in objectTraps) {\n let fn = objectTraps[key];\n arrayTraps[key] = function() {\n const args = arguments;\n args[0] = args[0][0];\n return fn.apply(this, args);\n };\n}\narrayTraps.deleteProperty = function(state, prop) {\n if (process.env.NODE_ENV !== \"production\" && isNaN(parseInt(prop)))\n die(13);\n return arrayTraps.set.call(this, state, prop, void 0);\n};\narrayTraps.set = function(state, prop, value) {\n if (process.env.NODE_ENV !== \"production\" && prop !== \"length\" && isNaN(parseInt(prop)))\n die(14);\n return objectTraps.set.call(this, state[0], prop, value, state[0]);\n};\nfunction peek(draft, prop) {\n const state = draft[DRAFT_STATE];\n const source = state ? latest(state) : draft;\n return source[prop];\n}\nfunction readPropFromProto(state, source, prop) {\n const desc = getDescriptorFromProto(source, prop);\n return desc ? VALUE in desc ? desc[VALUE] : (\n // This is a very special case, if the prop is a getter defined by the\n // prototype, we should invoke it with the draft as context!\n desc.get?.call(state.draft_)\n ) : void 0;\n}\nfunction getDescriptorFromProto(source, prop) {\n if (!(prop in source))\n return void 0;\n let proto = getPrototypeOf(source);\n while (proto) {\n const desc = Object.getOwnPropertyDescriptor(proto, prop);\n if (desc)\n return desc;\n proto = getPrototypeOf(proto);\n }\n return void 0;\n}\nfunction markChanged(state) {\n if (!state.modified_) {\n state.modified_ = true;\n if (state.parent_) {\n markChanged(state.parent_);\n }\n }\n}\nfunction prepareCopy(state) {\n if (!state.copy_) {\n state.assigned_ = /* @__PURE__ */ new Map();\n state.copy_ = shallowCopy(\n state.base_,\n state.scope_.immer_.useStrictShallowCopy_\n );\n }\n}\n\n// src/core/immerClass.ts\nvar Immer2 = class {\n constructor(config) {\n this.autoFreeze_ = true;\n this.useStrictShallowCopy_ = false;\n this.useStrictIteration_ = false;\n /**\n * The `produce` function takes a value and a \"recipe function\" (whose\n * return value often depends on the base state). The recipe function is\n * free to mutate its first argument however it wants. All mutations are\n * only ever applied to a __copy__ of the base state.\n *\n * Pass only a function to create a \"curried producer\" which relieves you\n * from passing the recipe function every time.\n *\n * Only plain objects and arrays are made mutable. All other objects are\n * considered uncopyable.\n *\n * Note: This function is __bound__ to its `Immer` instance.\n *\n * @param {any} base - the initial state\n * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified\n * @param {Function} patchListener - optional function that will be called with all the patches produced here\n * @returns {any} a new state, or the initial state if nothing was modified\n */\n this.produce = (base, recipe, patchListener) => {\n if (isFunction(base) && !isFunction(recipe)) {\n const defaultBase = recipe;\n recipe = base;\n const self = this;\n return function curriedProduce(base2 = defaultBase, ...args) {\n return self.produce(base2, (draft) => recipe.call(this, draft, ...args));\n };\n }\n if (!isFunction(recipe))\n die(6);\n if (patchListener !== void 0 && !isFunction(patchListener))\n die(7);\n let result;\n if (isDraftable(base)) {\n const scope = enterScope(this);\n const proxy = createProxy(scope, base, void 0);\n let hasError = true;\n try {\n result = recipe(proxy);\n hasError = false;\n } finally {\n if (hasError)\n revokeScope(scope);\n else\n leaveScope(scope);\n }\n usePatchesInScope(scope, patchListener);\n return processResult(result, scope);\n } else if (!base || !isObjectish(base)) {\n result = recipe(base);\n if (result === void 0)\n result = base;\n if (result === NOTHING)\n result = void 0;\n if (this.autoFreeze_)\n freeze(result, true);\n if (patchListener) {\n const p = [];\n const ip = [];\n getPlugin(PluginPatches).generateReplacementPatches_(base, result, {\n patches_: p,\n inversePatches_: ip\n });\n patchListener(p, ip);\n }\n return result;\n } else\n die(1, base);\n };\n this.produceWithPatches = (base, recipe) => {\n if (isFunction(base)) {\n return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));\n }\n let patches, inversePatches;\n const result = this.produce(base, recipe, (p, ip) => {\n patches = p;\n inversePatches = ip;\n });\n return [result, patches, inversePatches];\n };\n if (isBoolean(config?.autoFreeze))\n this.setAutoFreeze(config.autoFreeze);\n if (isBoolean(config?.useStrictShallowCopy))\n this.setUseStrictShallowCopy(config.useStrictShallowCopy);\n if (isBoolean(config?.useStrictIteration))\n this.setUseStrictIteration(config.useStrictIteration);\n }\n createDraft(base) {\n if (!isDraftable(base))\n die(8);\n if (isDraft(base))\n base = current(base);\n const scope = enterScope(this);\n const proxy = createProxy(scope, base, void 0);\n proxy[DRAFT_STATE].isManual_ = true;\n leaveScope(scope);\n return proxy;\n }\n finishDraft(draft, patchListener) {\n const state = draft && draft[DRAFT_STATE];\n if (!state || !state.isManual_)\n die(9);\n const { scope_: scope } = state;\n usePatchesInScope(scope, patchListener);\n return processResult(void 0, scope);\n }\n /**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * By default, auto-freezing is enabled.\n */\n setAutoFreeze(value) {\n this.autoFreeze_ = value;\n }\n /**\n * Pass true to enable strict shallow copy.\n *\n * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n */\n setUseStrictShallowCopy(value) {\n this.useStrictShallowCopy_ = value;\n }\n /**\n * Pass false to use faster iteration that skips non-enumerable properties\n * but still handles symbols for compatibility.\n *\n * By default, strict iteration is enabled (includes all own properties).\n */\n setUseStrictIteration(value) {\n this.useStrictIteration_ = value;\n }\n shouldUseStrictIteration() {\n return this.useStrictIteration_;\n }\n applyPatches(base, patches) {\n let i;\n for (i = patches.length - 1; i >= 0; i--) {\n const patch = patches[i];\n if (patch.path.length === 0 && patch.op === \"replace\") {\n base = patch.value;\n break;\n }\n }\n if (i > -1) {\n patches = patches.slice(i + 1);\n }\n const applyPatchesImpl = getPlugin(PluginPatches).applyPatches_;\n if (isDraft(base)) {\n return applyPatchesImpl(base, patches);\n }\n return this.produce(\n base,\n (draft) => applyPatchesImpl(draft, patches)\n );\n }\n};\nfunction createProxy(rootScope, value, parent, key) {\n const [draft, state] = isMap(value) ? getPlugin(PluginMapSet).proxyMap_(value, parent) : isSet(value) ? getPlugin(PluginMapSet).proxySet_(value, parent) : createProxyProxy(value, parent);\n const scope = parent?.scope_ ?? getCurrentScope();\n scope.drafts_.push(draft);\n state.callbacks_ = parent?.callbacks_ ?? [];\n state.key_ = key;\n if (parent && key !== void 0) {\n registerChildFinalizationCallback(parent, state, key);\n } else {\n state.callbacks_.push(function rootDraftCleanup(rootScope2) {\n rootScope2.mapSetPlugin_?.fixSetContents(state);\n const { patchPlugin_ } = rootScope2;\n if (state.modified_ && patchPlugin_) {\n patchPlugin_.generatePatches_(state, [], rootScope2);\n }\n });\n }\n return draft;\n}\n\n// src/core/current.ts\nfunction current(value) {\n if (!isDraft(value))\n die(10, value);\n return currentImpl(value);\n}\nfunction currentImpl(value) {\n if (!isDraftable(value) || isFrozen(value))\n return value;\n const state = value[DRAFT_STATE];\n let copy;\n let strict = true;\n if (state) {\n if (!state.modified_)\n return state.base_;\n state.finalized_ = true;\n copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);\n strict = state.scope_.immer_.shouldUseStrictIteration();\n } else {\n copy = shallowCopy(value, true);\n }\n each(\n copy,\n (key, childValue) => {\n set(copy, key, currentImpl(childValue));\n },\n strict\n );\n if (state) {\n state.finalized_ = false;\n }\n return copy;\n}\n\n// src/plugins/patches.ts\nfunction enablePatches() {\n const errorOffset = 16;\n if (process.env.NODE_ENV !== \"production\") {\n errors.push(\n 'Sets cannot have \"replace\" patches.',\n function(op) {\n return \"Unsupported patch operation: \" + op;\n },\n function(path) {\n return \"Cannot apply patch, path doesn't resolve: \" + path;\n },\n \"Patching reserved attributes like __proto__, prototype and constructor is not allowed\"\n );\n }\n function getPath(state, path = []) {\n if (state.key_ !== void 0) {\n const parentCopy = state.parent_.copy_ ?? state.parent_.base_;\n const proxyDraft = getProxyDraft(get(parentCopy, state.key_));\n const valueAtKey = get(parentCopy, state.key_);\n if (valueAtKey === void 0) {\n return null;\n }\n if (valueAtKey !== state.draft_ && valueAtKey !== state.base_ && valueAtKey !== state.copy_) {\n return null;\n }\n if (proxyDraft != null && proxyDraft.base_ !== state.base_) {\n return null;\n }\n const isSet2 = state.parent_.type_ === 3 /* Set */;\n let key;\n if (isSet2) {\n const setParent = state.parent_;\n key = Array.from(setParent.drafts_.keys()).indexOf(state.key_);\n } else {\n key = state.key_;\n }\n if (!(isSet2 && parentCopy.size > key || has(parentCopy, key))) {\n return null;\n }\n path.push(key);\n }\n if (state.parent_) {\n return getPath(state.parent_, path);\n }\n path.reverse();\n try {\n resolvePath(state.copy_, path);\n } catch (e) {\n return null;\n }\n return path;\n }\n function resolvePath(base, path) {\n let current2 = base;\n for (let i = 0; i < path.length - 1; i++) {\n const key = path[i];\n current2 = get(current2, key);\n if (!isObjectish(current2) || current2 === null) {\n throw new Error(`Cannot resolve path at '${path.join(\"/\")}'`);\n }\n }\n return current2;\n }\n const REPLACE = \"replace\";\n const ADD = \"add\";\n const REMOVE = \"remove\";\n function generatePatches_(state, basePath, scope) {\n if (state.scope_.processedForPatches_.has(state)) {\n return;\n }\n state.scope_.processedForPatches_.add(state);\n const { patches_, inversePatches_ } = scope;\n switch (state.type_) {\n case 0 /* Object */:\n case 2 /* Map */:\n return generatePatchesFromAssigned(\n state,\n basePath,\n patches_,\n inversePatches_\n );\n case 1 /* Array */:\n return generateArrayPatches(\n state,\n basePath,\n patches_,\n inversePatches_\n );\n case 3 /* Set */:\n return generateSetPatches(\n state,\n basePath,\n patches_,\n inversePatches_\n );\n }\n }\n function generateArrayPatches(state, basePath, patches, inversePatches) {\n let { base_, assigned_ } = state;\n let copy_ = state.copy_;\n if (copy_.length < base_.length) {\n ;\n [base_, copy_] = [copy_, base_];\n [patches, inversePatches] = [inversePatches, patches];\n }\n const allReassigned = state.allIndicesReassigned_ === true;\n for (let i = 0; i < base_.length; i++) {\n const copiedItem = copy_[i];\n const baseItem = base_[i];\n const isAssigned = allReassigned || assigned_?.get(i.toString());\n if (isAssigned && copiedItem !== baseItem) {\n const childState = copiedItem?.[DRAFT_STATE];\n if (childState && childState.modified_) {\n continue;\n }\n const path = basePath.concat([i]);\n patches.push({\n op: REPLACE,\n path,\n // Need to maybe clone it, as it can in fact be the original value\n // due to the base/copy inversion at the start of this function\n value: clonePatchValueIfNeeded(copiedItem)\n });\n inversePatches.push({\n op: REPLACE,\n path,\n value: clonePatchValueIfNeeded(baseItem)\n });\n }\n }\n for (let i = base_.length; i < copy_.length; i++) {\n const path = basePath.concat([i]);\n patches.push({\n op: ADD,\n path,\n // Need to maybe clone it, as it can in fact be the original value\n // due to the base/copy inversion at the start of this function\n value: clonePatchValueIfNeeded(copy_[i])\n });\n }\n for (let i = copy_.length - 1; base_.length <= i; --i) {\n const path = basePath.concat([i]);\n inversePatches.push({\n op: REMOVE,\n path\n });\n }\n }\n function generatePatchesFromAssigned(state, basePath, patches, inversePatches) {\n const { base_, copy_, type_ } = state;\n each(state.assigned_, (key, assignedValue) => {\n const origValue = get(base_, key, type_);\n const value = get(copy_, key, type_);\n const op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD;\n if (origValue === value && op === REPLACE)\n return;\n const path = basePath.concat(key);\n patches.push(\n op === REMOVE ? { op, path } : { op, path, value: clonePatchValueIfNeeded(value) }\n );\n inversePatches.push(\n op === ADD ? { op: REMOVE, path } : op === REMOVE ? { op: ADD, path, value: clonePatchValueIfNeeded(origValue) } : { op: REPLACE, path, value: clonePatchValueIfNeeded(origValue) }\n );\n });\n }\n function generateSetPatches(state, basePath, patches, inversePatches) {\n let { base_, copy_ } = state;\n let i = 0;\n base_.forEach((value) => {\n if (!copy_.has(value)) {\n const path = basePath.concat([i]);\n patches.push({\n op: REMOVE,\n path,\n value\n });\n inversePatches.unshift({\n op: ADD,\n path,\n value\n });\n }\n i++;\n });\n i = 0;\n copy_.forEach((value) => {\n if (!base_.has(value)) {\n const path = basePath.concat([i]);\n patches.push({\n op: ADD,\n path,\n value\n });\n inversePatches.unshift({\n op: REMOVE,\n path,\n value\n });\n }\n i++;\n });\n }\n function generateReplacementPatches_(baseValue, replacement, scope) {\n const { patches_, inversePatches_ } = scope;\n patches_.push({\n op: REPLACE,\n path: [],\n value: replacement === NOTHING ? void 0 : replacement\n });\n inversePatches_.push({\n op: REPLACE,\n path: [],\n value: baseValue\n });\n }\n function applyPatches_(draft, patches) {\n patches.forEach((patch) => {\n const { path, op } = patch;\n let base = draft;\n for (let i = 0; i < path.length - 1; i++) {\n const parentType = getArchtype(base);\n let p = path[i];\n if (typeof p !== \"string\" && typeof p !== \"number\") {\n p = \"\" + p;\n }\n if ((parentType === 0 /* Object */ || parentType === 1 /* Array */) && (p === \"__proto__\" || p === CONSTRUCTOR))\n die(errorOffset + 3);\n if (isFunction(base) && p === PROTOTYPE)\n die(errorOffset + 3);\n base = get(base, p);\n if (!isObjectish(base))\n die(errorOffset + 2, path.join(\"/\"));\n }\n const type = getArchtype(base);\n const value = deepClonePatchValue(patch.value);\n const key = path[path.length - 1];\n switch (op) {\n case REPLACE:\n switch (type) {\n case 2 /* Map */:\n return base.set(key, value);\n case 3 /* Set */:\n die(errorOffset);\n default:\n return base[key] = value;\n }\n case ADD:\n switch (type) {\n case 1 /* Array */:\n return key === \"-\" ? base.push(value) : base.splice(key, 0, value);\n case 2 /* Map */:\n return base.set(key, value);\n case 3 /* Set */:\n return base.add(value);\n default:\n return base[key] = value;\n }\n case REMOVE:\n switch (type) {\n case 1 /* Array */:\n return base.splice(key, 1);\n case 2 /* Map */:\n return base.delete(key);\n case 3 /* Set */:\n return base.delete(patch.value);\n default:\n return delete base[key];\n }\n default:\n die(errorOffset + 1, op);\n }\n });\n return draft;\n }\n function deepClonePatchValue(obj) {\n if (!isDraftable(obj))\n return obj;\n if (isArray(obj))\n return obj.map(deepClonePatchValue);\n if (isMap(obj))\n return new Map(\n Array.from(obj.entries()).map(([k, v]) => [k, deepClonePatchValue(v)])\n );\n if (isSet(obj))\n return new Set(Array.from(obj).map(deepClonePatchValue));\n const cloned = Object.create(getPrototypeOf(obj));\n for (const key in obj)\n cloned[key] = deepClonePatchValue(obj[key]);\n if (has(obj, DRAFTABLE))\n cloned[DRAFTABLE] = obj[DRAFTABLE];\n return cloned;\n }\n function clonePatchValueIfNeeded(obj) {\n if (isDraft(obj)) {\n return deepClonePatchValue(obj);\n } else\n return obj;\n }\n loadPlugin(PluginPatches, {\n applyPatches_,\n generatePatches_,\n generateReplacementPatches_,\n getPath\n });\n}\n\n// src/plugins/mapset.ts\nfunction enableMapSet() {\n class DraftMap extends Map {\n constructor(target, parent) {\n super();\n this[DRAFT_STATE] = {\n type_: 2 /* Map */,\n parent_: parent,\n scope_: parent ? parent.scope_ : getCurrentScope(),\n modified_: false,\n finalized_: false,\n copy_: void 0,\n assigned_: void 0,\n base_: target,\n draft_: this,\n isManual_: false,\n revoked_: false,\n callbacks_: []\n };\n }\n get size() {\n return latest(this[DRAFT_STATE]).size;\n }\n has(key) {\n return latest(this[DRAFT_STATE]).has(key);\n }\n set(key, value) {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n if (!latest(state).has(key) || latest(state).get(key) !== value) {\n prepareMapCopy(state);\n markChanged(state);\n state.assigned_.set(key, true);\n state.copy_.set(key, value);\n state.assigned_.set(key, true);\n handleCrossReference(state, key, value);\n }\n return this;\n }\n delete(key) {\n if (!this.has(key)) {\n return false;\n }\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n prepareMapCopy(state);\n markChanged(state);\n if (state.base_.has(key)) {\n state.assigned_.set(key, false);\n } else {\n state.assigned_.delete(key);\n }\n state.copy_.delete(key);\n return true;\n }\n clear() {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n if (latest(state).size) {\n prepareMapCopy(state);\n markChanged(state);\n state.assigned_ = /* @__PURE__ */ new Map();\n each(state.base_, (key) => {\n state.assigned_.set(key, false);\n });\n state.copy_.clear();\n }\n }\n forEach(cb, thisArg) {\n const state = this[DRAFT_STATE];\n latest(state).forEach((_value, key, _map) => {\n cb.call(thisArg, this.get(key), key, this);\n });\n }\n get(key) {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n const value = latest(state).get(key);\n if (state.finalized_ || !isDraftable(value)) {\n return value;\n }\n if (value !== state.base_.get(key)) {\n return value;\n }\n const draft = createProxy(state.scope_, value, state, key);\n prepareMapCopy(state);\n state.copy_.set(key, draft);\n return draft;\n }\n keys() {\n return latest(this[DRAFT_STATE]).keys();\n }\n values() {\n const iterator = this.keys();\n return {\n [Symbol.iterator]: () => this.values(),\n next: () => {\n const r = iterator.next();\n if (r.done)\n return r;\n const value = this.get(r.value);\n return {\n done: false,\n value\n };\n }\n };\n }\n entries() {\n const iterator = this.keys();\n return {\n [Symbol.iterator]: () => this.entries(),\n next: () => {\n const r = iterator.next();\n if (r.done)\n return r;\n const value = this.get(r.value);\n return {\n done: false,\n value: [r.value, value]\n };\n }\n };\n }\n [(DRAFT_STATE, Symbol.iterator)]() {\n return this.entries();\n }\n }\n function proxyMap_(target, parent) {\n const map = new DraftMap(target, parent);\n return [map, map[DRAFT_STATE]];\n }\n function prepareMapCopy(state) {\n if (!state.copy_) {\n state.assigned_ = /* @__PURE__ */ new Map();\n state.copy_ = new Map(state.base_);\n }\n }\n class DraftSet extends Set {\n constructor(target, parent) {\n super();\n this[DRAFT_STATE] = {\n type_: 3 /* Set */,\n parent_: parent,\n scope_: parent ? parent.scope_ : getCurrentScope(),\n modified_: false,\n finalized_: false,\n copy_: void 0,\n base_: target,\n draft_: this,\n drafts_: /* @__PURE__ */ new Map(),\n revoked_: false,\n isManual_: false,\n assigned_: void 0,\n callbacks_: []\n };\n }\n get size() {\n return latest(this[DRAFT_STATE]).size;\n }\n has(value) {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n if (!state.copy_) {\n return state.base_.has(value);\n }\n if (state.copy_.has(value))\n return true;\n if (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value)))\n return true;\n return false;\n }\n add(value) {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n if (!this.has(value)) {\n prepareSetCopy(state);\n markChanged(state);\n state.copy_.add(value);\n handleCrossReference(state, value, value);\n }\n return this;\n }\n delete(value) {\n if (!this.has(value)) {\n return false;\n }\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n prepareSetCopy(state);\n markChanged(state);\n return state.copy_.delete(value) || (state.drafts_.has(value) ? state.copy_.delete(state.drafts_.get(value)) : (\n /* istanbul ignore next */\n false\n ));\n }\n clear() {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n if (latest(state).size) {\n prepareSetCopy(state);\n markChanged(state);\n state.copy_.clear();\n }\n }\n values() {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n prepareSetCopy(state);\n return state.copy_.values();\n }\n entries() {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n prepareSetCopy(state);\n return state.copy_.entries();\n }\n keys() {\n return this.values();\n }\n [(DRAFT_STATE, Symbol.iterator)]() {\n return this.values();\n }\n forEach(cb, thisArg) {\n const iterator = this.values();\n let result = iterator.next();\n while (!result.done) {\n cb.call(thisArg, result.value, result.value, this);\n result = iterator.next();\n }\n }\n }\n function proxySet_(target, parent) {\n const set2 = new DraftSet(target, parent);\n return [set2, set2[DRAFT_STATE]];\n }\n function prepareSetCopy(state) {\n if (!state.copy_) {\n state.copy_ = /* @__PURE__ */ new Set();\n state.base_.forEach((value) => {\n if (isDraftable(value)) {\n const draft = createProxy(state.scope_, value, state, value);\n state.drafts_.set(value, draft);\n state.copy_.add(draft);\n } else {\n state.copy_.add(value);\n }\n });\n }\n }\n function assertUnrevoked(state) {\n if (state.revoked_)\n die(3, JSON.stringify(latest(state)));\n }\n function fixSetContents(target) {\n if (target.type_ === 3 /* Set */ && target.copy_) {\n const copy = new Set(target.copy_);\n target.copy_.clear();\n copy.forEach((value) => {\n target.copy_.add(getValue(value));\n });\n }\n }\n loadPlugin(PluginMapSet, { proxyMap_, proxySet_, fixSetContents });\n}\n\n// src/plugins/arrayMethods.ts\nfunction enableArrayMethods() {\n const SHIFTING_METHODS = /* @__PURE__ */ new Set([\"shift\", \"unshift\"]);\n const QUEUE_METHODS = /* @__PURE__ */ new Set([\"push\", \"pop\"]);\n const RESULT_RETURNING_METHODS = /* @__PURE__ */ new Set([\n ...QUEUE_METHODS,\n ...SHIFTING_METHODS\n ]);\n const REORDERING_METHODS = /* @__PURE__ */ new Set([\"reverse\", \"sort\"]);\n const MUTATING_METHODS = /* @__PURE__ */ new Set([\n ...RESULT_RETURNING_METHODS,\n ...REORDERING_METHODS,\n \"splice\"\n ]);\n const FIND_METHODS = /* @__PURE__ */ new Set([\"find\", \"findLast\"]);\n const NON_MUTATING_METHODS = /* @__PURE__ */ new Set([\n \"filter\",\n \"slice\",\n \"concat\",\n \"flat\",\n ...FIND_METHODS,\n \"findIndex\",\n \"findLastIndex\",\n \"some\",\n \"every\",\n \"indexOf\",\n \"lastIndexOf\",\n \"includes\",\n \"join\",\n \"toString\",\n \"toLocaleString\"\n ]);\n function isMutatingArrayMethod(method) {\n return MUTATING_METHODS.has(method);\n }\n function isNonMutatingArrayMethod(method) {\n return NON_MUTATING_METHODS.has(method);\n }\n function isArrayOperationMethod(method) {\n return isMutatingArrayMethod(method) || isNonMutatingArrayMethod(method);\n }\n function enterOperation(state, method) {\n state.operationMethod = method;\n }\n function exitOperation(state) {\n state.operationMethod = void 0;\n }\n function executeArrayMethod(state, operation, markLength = true) {\n prepareCopy(state);\n const result = operation();\n markChanged(state);\n if (markLength)\n state.assigned_.set(\"length\", true);\n return result;\n }\n function markAllIndicesReassigned(state) {\n state.allIndicesReassigned_ = true;\n }\n function normalizeSliceIndex(index, length) {\n if (index < 0) {\n return Math.max(length + index, 0);\n }\n return Math.min(index, length);\n }\n function handleInsertedValues(state, startIndex, values) {\n for (let i = 0; i < values.length; i++) {\n const index = startIndex + i;\n state.assigned_.set(index, true);\n handleCrossReference(state, index, values[i]);\n }\n }\n function handleSimpleOperation(state, method, args) {\n return executeArrayMethod(state, () => {\n const lengthBefore = state.copy_.length;\n const result = state.copy_[method](...args);\n if (SHIFTING_METHODS.has(method)) {\n markAllIndicesReassigned(state);\n }\n if (method === \"push\" && args.length > 0) {\n handleInsertedValues(state, lengthBefore, args);\n } else if (method === \"unshift\" && args.length > 0) {\n handleInsertedValues(state, 0, args);\n }\n return RESULT_RETURNING_METHODS.has(method) ? result : state.draft_;\n });\n }\n function handleReorderingOperation(state, method, args) {\n return executeArrayMethod(\n state,\n () => {\n ;\n state.copy_[method](...args);\n markAllIndicesReassigned(state);\n return state.draft_;\n },\n false\n );\n }\n function createMethodInterceptor(state, originalMethod) {\n return function interceptedMethod(...args) {\n const method = originalMethod;\n enterOperation(state, method);\n try {\n if (isMutatingArrayMethod(method)) {\n if (RESULT_RETURNING_METHODS.has(method)) {\n return handleSimpleOperation(state, method, args);\n }\n if (REORDERING_METHODS.has(method)) {\n return handleReorderingOperation(state, method, args);\n }\n if (method === \"splice\") {\n const res = executeArrayMethod(\n state,\n () => state.copy_.splice(...args)\n );\n markAllIndicesReassigned(state);\n if (args.length > 2) {\n const startIndex = normalizeSliceIndex(\n args[0] ?? 0,\n state.copy_.length\n );\n handleInsertedValues(state, startIndex, args.slice(2));\n }\n return res;\n }\n } else {\n return handleNonMutatingOperation(state, method, args);\n }\n } finally {\n exitOperation(state);\n }\n };\n }\n function handleNonMutatingOperation(state, method, args) {\n const source = latest(state);\n if (method === \"filter\") {\n const predicate = args[0];\n const result = [];\n for (let i = 0; i < source.length; i++) {\n if (predicate(source[i], i, source)) {\n result.push(state.draft_[i]);\n }\n }\n return result;\n }\n if (FIND_METHODS.has(method)) {\n const predicate = args[0];\n const isForward = method === \"find\";\n const step = isForward ? 1 : -1;\n const start = isForward ? 0 : source.length - 1;\n for (let i = start; i >= 0 && i < source.length; i += step) {\n if (predicate(source[i], i, source)) {\n return state.draft_[i];\n }\n }\n return void 0;\n }\n if (method === \"slice\") {\n const rawStart = args[0] ?? 0;\n const rawEnd = args[1] ?? source.length;\n const start = normalizeSliceIndex(rawStart, source.length);\n const end = normalizeSliceIndex(rawEnd, source.length);\n const result = [];\n for (let i = start; i < end; i++) {\n result.push(state.draft_[i]);\n }\n return result;\n }\n return source[method](...args);\n }\n loadPlugin(PluginArrayMethods, {\n createMethodInterceptor,\n isArrayOperationMethod,\n isMutatingArrayMethod\n });\n}\n\n// src/immer.ts\nvar immer = new Immer2();\nvar produce = immer.produce;\nvar produceWithPatches = /* @__PURE__ */ immer.produceWithPatches.bind(\n immer\n);\nvar setAutoFreeze = /* @__PURE__ */ immer.setAutoFreeze.bind(immer);\nvar setUseStrictShallowCopy = /* @__PURE__ */ immer.setUseStrictShallowCopy.bind(\n immer\n);\nvar setUseStrictIteration = /* @__PURE__ */ immer.setUseStrictIteration.bind(\n immer\n);\nvar applyPatches = /* @__PURE__ */ immer.applyPatches.bind(immer);\nvar createDraft = /* @__PURE__ */ immer.createDraft.bind(immer);\nvar finishDraft = /* @__PURE__ */ immer.finishDraft.bind(immer);\nvar castDraft = (value) => value;\nvar castImmutable = (value) => value;\nexport {\n Immer2 as Immer,\n applyPatches,\n castDraft,\n castImmutable,\n createDraft,\n current,\n enableArrayMethods,\n enableMapSet,\n enablePatches,\n finishDraft,\n freeze,\n DRAFTABLE as immerable,\n isDraft,\n isDraftable,\n NOTHING as nothing,\n original,\n produce,\n produceWithPatches,\n setAutoFreeze,\n setUseStrictIteration,\n setUseStrictShallowCopy\n};\n//# sourceMappingURL=immer.mjs.map","// src/store/types.ts\nimport { Draft } from 'immer'\nimport { BehaviorSubject, Observable, Subject } from 'rxjs'\n\n/**\n * Storage types supported by the store\n */\nexport type StorageType = 'memory' | 'local' | 'session' | 'indexeddb'\n\n/**\n * Base store options\n */\nexport interface StoreOptions<T> {\n\t/** Key used for persistent storage */\n\tkey: string\n\n\t/** Storage type */\n\tstorage: StorageType\n\n\t/** Initial state */\n\tinitialState: T\n\n\t/** Enable dev tools */\n\tdevTools?: boolean\n}\n\n/**\n * Enhanced store error with type information and better context handling\n */\nexport class StoreError<T = unknown> extends Error {\n\t/** Original error that caused this store error */\n\tpublic readonly cause?: T\n\n\t/** Additional contextual information */\n\tpublic readonly context?: Record<string, unknown>\n\n\t/** Timestamp when the error occurred */\n\tpublic readonly timestamp: Date\n\n\tconstructor(message: string, cause?: T, context?: Record<string, unknown>) {\n\t\tsuper(message)\n\t\tthis.name = 'StoreError'\n\t\tthis.cause = cause\n\t\tthis.context = context\n\t\tthis.timestamp = new Date()\n\n\t\t// Capture stack trace if available\n\t\tif (Error.captureStackTrace) {\n\t\t\tError.captureStackTrace(this, StoreError)\n\t\t}\n\t}\n\n\t/**\n\t * Returns a JSON-serializable representation of the error\n\t */\n\ttoJSON(): Record<string, unknown> {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tmessage: this.message,\n\t\t\tcause: this.cause,\n\t\t\tcontext: this.context,\n\t\t\ttimestamp: this.timestamp.toISOString(),\n\t\t\tstack: this.stack,\n\t\t}\n\t}\n}\n\n/**\n * Core store interface with improved type definitions\n */\nexport interface IStore<T extends Record<string, any>> {\n\t/** Get the current store value */\n\treadonly value: T\n\n\t/** Observable stream of store values */\n\treadonly $: BehaviorSubject<T>\n\n\t/** The default/initial value of the store */\n\treadonly defaultValue: T\n\n\t/** Whether the store is ready (loaded from storage) */\n\tready: boolean\n\n\t/** Observable stream of store errors */\n\treadonly error$: Subject<StoreError | null>\n\n\t/**\n\t * Update store value with partial data\n\t * @param value Partial data to update\n\t * @param merge Whether to merge with existing data (default: true)\n\t */\n\tset(value: Partial<T>, merge?: boolean): void\n\n\t/**\n\t * Reset store to default value\n\t */\n\tclear(): void\n\n\t/**\n\t * Replace entire store value\n\t * @param newValue New value to set\n\t */\n\treplace(newValue: T): void\n\n\t/**\n\t * Delete a specific key from the store\n\t * @param key Key to delete\n\t */\n\tdelete<K extends keyof T>(key: K): void\n\n\t/**\n\t * Clean up resources\n\t */\n\tdestroy(): void\n}\n\n/**\n * Interface for collection stores with improved typing\n */\nexport interface ICollectionStore<T> {\n\t/** Get the current collection value */\n\treadonly value: Map<string, T>\n\n\t/** Observable stream of collection values */\n\treadonly $: BehaviorSubject<Map<string, T>>\n\n\t/** The default/initial value of the collection */\n\treadonly defaultValue: Map<string, T>\n\n\t/** Whether the store is ready (loaded from storage) */\n\tready: boolean\n\n\t/** Observable stream of store errors */\n\treadonly error$: Observable<StoreError | null>\n\n\t/**\n\t * Set a value in the collection\n\t * @param key Item key\n\t * @param value Item value\n\t */\n\tset<V = T>(key: string, value: V): void\n\n\t/**\n\t * Delete an item from the collection\n\t * @param key Item key to delete\n\t */\n\tdelete(key: string): void\n\n\t/**\n\t * Clear all items from the collection\n\t */\n\tclear(): void\n\n\t/**\n\t * Replace the entire collection\n\t * @param newValue New collection value\n\t */\n\treplace(newValue: Map<string, T>): void\n\n\t/**\n\t * Clean up resources\n\t */\n\tdestroy(): void\n}\n\n/**\n * Interface for a storage manager\n */\nexport interface IStorageManager<T> {\n\t/**\n\t * Load data from storage\n\t * @returns Promise resolving to stored data or null\n\t */\n\tload(): Promise<T | null>\n\n\t/**\n\t * Save data to storage\n\t * @param state Data to save\n\t */\n\tsave(state: T): Promise<void>\n\n\t/**\n\t * Clear data from storage\n\t */\n\tclear(): Promise<void>\n}\n\n/**\n * Factory function type for creating stores\n */\nexport type StoreFactory = <T extends Record<string, any>>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n) => IStore<T>\n\n/**\n * Factory function type for creating collection stores\n */\nexport type CollectionStoreFactory = <T>(\n\tinitialData: Map<string, T>,\n\tstorage: StorageType,\n\tkey: string,\n) => ICollectionStore<T>\n// Add this to your src/store/types.ts file\n\n/**\n * Interface for array stores with improved typing\n */\nexport interface IArrayStore<T> {\n\t/** Get the current array value */\n\treadonly value: T[]\n\n\t/** Observable stream of array values */\n\treadonly $: BehaviorSubject<T[]>\n\n\t/** The default/initial value of the array */\n\treadonly defaultValue: T[]\n\n\t/** Whether the store is ready (loaded from storage) */\n\tready: boolean\n\n\t/** Observable stream of store errors */\n\treadonly error$: Observable<StoreError | null>\n\n\t/**\n\t * Add item(s) to the end of the array\n\t * @param items Items to add\n\t */\n\tpush(...items: T[]): void\n\n\t/**\n\t * Remove and return the last item from the array\n\t * @returns The removed item or undefined if the array was empty\n\t */\n\tpop(): T | undefined\n\n\t/**\n\t * Add item(s) to the beginning of the array\n\t * @param items Items to add\n\t */\n\tunshift(...items: T[]): void\n\n\t/**\n\t * Remove and return the first item from the array\n\t * @returns The removed item or undefined if the array was empty\n\t */\n\tshift(): T | undefined\n\n\t/**\n\t * Update an item at a specific index\n\t * @param index The index to update\n\t * @param value The new value\n\t */\n\tset(index: number, value: T): void\n\n\t/**\n\t * Get the item at a specific index\n\t * @param index The index to get\n\t * @returns The item or undefined if index is out of bounds\n\t */\n\tget(index: number): T | undefined\n\n\t/**\n\t * Remove items from the array and optionally insert new ones\n\t * @param start The start index\n\t * @param deleteCount The number of items to delete\n\t * @param items Items to insert\n\t * @returns The removed items\n\t */\n\tsplice(start: number, deleteCount?: number, ...items: T[]): T[]\n\n\t/**\n\t * Remove an item by value (first occurrence)\n\t * @param item The item to remove\n\t * @param compareFn Optional function to compare items\n\t * @returns True if the item was found and removed\n\t */\n\tremove(item: T, compareFn?: (a: T, b: T) => boolean): boolean\n\n\t/**\n\t * Replace the entire array\n\t * @param newArray The new array\n\t */\n\treplace(newArray: T[]): void\n\n\t/**\n\t * Filter items in the array\n\t * @param predicate Function to test each item\n\t */\n\tfilter(predicate: (value: T, index: number, array: T[]) => boolean): void\n\n\t/**\n\t * Map over the array and transform items\n\t * @param mapper Function to transform each item\n\t * @returns Array of transformed items\n\t */\n\tmap<U>(mapper: (value: T, index: number, array: T[]) => U): U[]\n\n\t/**\n\t * Sort the array in place\n\t * @param compareFn Optional function to determine sort order\n\t */\n\tsort(compareFn?: (a: T, b: T) => number): void\n\n\t/**\n\t * Update a specific item using a callback function\n\t * @param index The index to update\n\t * @param updater Function that can modify the item\n\t */\n\tupdate(index: number, updater: (item: Draft<T>) => void): void\n\n\t/**\n\t * Clear all items from the array\n\t */\n\tclear(): void\n\n\t/**\n\t * Clean up resources\n\t */\n\tdestroy(): void\n}\n\n/**\n * Factory function type for creating array stores\n */\nexport type ArrayStoreFactory = <T>(initialData: T[], storage: StorageType, key: string) => IArrayStore<T>\n","import { IStorageManager, StorageType, StoreError } from './types'\n\n/**\n * Custom JSON replacer to handle Map and Set serialization\n *\n * LIMITATIONS:\n * - Only supports Maps with string/number/primitive keys\n * - Object keys will be stringified and may collide (e.g., {id: 1} and {id: 2} both become \"[object Object]\")\n * - Circular references are not supported (JSON.stringify limitation)\n *\n * @example\n * ```typescript\n * // ✅ Supported\n * new Map([['key', 'value'], [123, 'number-key']])\n *\n * // ❌ Not supported (object keys will become strings)\n * new Map([[{id: 1}, 'value']])\n * ```\n */\nfunction mapSetReplacer(_key: string, value: unknown): unknown {\n\tif (value instanceof Map) {\n\t\treturn {\n\t\t\t__type: 'Map',\n\t\t\tentries: Array.from(value.entries()),\n\t\t}\n\t}\n\tif (value instanceof Set) {\n\t\treturn {\n\t\t\t__type: 'Set',\n\t\t\tvalues: Array.from(value.values()),\n\t\t}\n\t}\n\treturn value\n}\n\n/**\n * Custom JSON reviver to handle Map and Set deserialization\n *\n * Includes validation to prevent malformed data or __type injection attacks.\n * Invalid structures are ignored and returned as-is.\n */\nfunction mapSetReviver(_key: string, value: unknown): unknown {\n\tif (value && typeof value === 'object' && '__type' in value) {\n\t\tconst typed = value as { __type: string; entries?: unknown[]; values?: unknown[] }\n\n\t\t// Validate and reconstruct Map\n\t\tif (typed.__type === 'Map') {\n\t\t\tif (!Array.isArray(typed.entries)) {\n\t\t\t\tconsole.warn('Invalid Map structure in storage (entries not an array), ignoring')\n\t\t\t\treturn value\n\t\t\t}\n\t\t\t// Validate all entries are [key, value] pairs\n\t\t\tconst isValid = typed.entries.every(e => Array.isArray(e) && e.length === 2)\n\t\t\tif (!isValid) {\n\t\t\t\tconsole.warn('Invalid Map structure in storage (malformed entries), ignoring')\n\t\t\t\treturn value\n\t\t\t}\n\t\t\treturn new Map(typed.entries as Iterable<readonly [unknown, unknown]>)\n\t\t}\n\n\t\t// Validate and reconstruct Set\n\t\tif (typed.__type === 'Set') {\n\t\t\tif (!Array.isArray(typed.values)) {\n\t\t\t\tconsole.warn('Invalid Set structure in storage (values not an array), ignoring')\n\t\t\t\treturn value\n\t\t\t}\n\t\t\treturn new Set(typed.values)\n\t\t}\n\n\t\t// Unknown __type marker, log warning and ignore\n\t\tconsole.warn(`Unknown __type \"${typed.__type}\" in storage, ignoring`)\n\t}\n\treturn value\n}\n\n/**\n * Memory storage manager implementation\n */\nexport class MemoryStorageManager<T> implements IStorageManager<T> {\n\tprivate data: T | null = null\n\n\tasync load(): Promise<T | null> {\n\t\treturn this.data\n\t}\n\n\tasync save(state: T): Promise<void> {\n\t\tthis.data = state\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tthis.data = null\n\t}\n}\n\n/**\n * Local storage manager implementation\n */\nexport class LocalStorageManager<T> implements IStorageManager<T> {\n\tconstructor(private key: string) {}\n\n\tasync load(): Promise<T | null> {\n\t\ttry {\n\t\t\tconst data = localStorage.getItem(this.key)\n\t\t\treturn data ? JSON.parse(data, mapSetReviver) : null\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to load from localStorage (${this.key}):`, err)\n\t\t\treturn null\n\t\t}\n\t}\n\n\tasync save(state: T): Promise<void> {\n\t\ttry {\n\t\t\tlocalStorage.setItem(this.key, JSON.stringify(state, mapSetReplacer))\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to save to localStorage (${this.key}):`, err)\n\t\t\tthrow new StoreError<unknown>(`Failed to save to localStorage (${this.key})`, err)\n\t\t}\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tlocalStorage.removeItem(this.key)\n\t}\n}\n\n/**\n * Session storage manager implementation\n */\nexport class SessionStorageManager<T> implements IStorageManager<T> {\n\tconstructor(private key: string) {}\n\n\tasync load(): Promise<T | null> {\n\t\ttry {\n\t\t\tconst data = sessionStorage.getItem(this.key)\n\t\t\treturn data ? JSON.parse(data, mapSetReviver) : null\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to load from sessionStorage (${this.key}):`, err)\n\t\t\treturn null\n\t\t}\n\t}\n\n\tasync save(state: T): Promise<void> {\n\t\ttry {\n\t\t\tsessionStorage.setItem(this.key, JSON.stringify(state, mapSetReplacer))\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to save to sessionStorage (${this.key}):`, err)\n\t\t\tthrow new StoreError<unknown>(`Failed to save to sessionStorage (${this.key})`, err)\n\t\t}\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tsessionStorage.removeItem(this.key)\n\t}\n}\n\n/**\n * IndexedDB storage manager implementation with better error typing\n */\nexport class IndexedDBStorageManager<T> implements IStorageManager<T> {\n\tprivate static DB_NAME = 'StoreDB'\n\tprivate static STORE_NAME = 'states'\n\tprivate static DB_VERSION = 1\n\n\tconstructor(private key: string) {}\n\n\tprivate openDB(): Promise<IDBDatabase> {\n\t\treturn new Promise<IDBDatabase>((resolve, reject) => {\n\t\t\tconst request = indexedDB.open(IndexedDBStorageManager.DB_NAME, IndexedDBStorageManager.DB_VERSION)\n\n\t\t\trequest.onupgradeneeded = () => {\n\t\t\t\tconst db = request.result\n\t\t\t\tif (!db.objectStoreNames.contains(IndexedDBStorageManager.STORE_NAME)) {\n\t\t\t\t\tdb.createObjectStore(IndexedDBStorageManager.STORE_NAME)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trequest.onsuccess = () => resolve(request.result)\n\t\t\trequest.onerror = () => reject(request.error)\n\t\t})\n\t}\n\n\tasync load(): Promise<T | null> {\n\t\ttry {\n\t\t\tconst db = await this.openDB()\n\t\t\treturn new Promise<T | null>((resolve, reject) => {\n\t\t\t\tconst transaction = db.transaction(IndexedDBStorageManager.STORE_NAME, 'readonly')\n\t\t\t\tconst store = transaction.objectStore(IndexedDBStorageManager.STORE_NAME)\n\t\t\t\tconst request = store.get(this.key)\n\n\t\t\t\trequest.onsuccess = () => {\n\t\t\t\t\tdb.close()\n\t\t\t\t\tresolve(request.result || null)\n\t\t\t\t}\n\n\t\t\t\trequest.onerror = () => {\n\t\t\t\t\tdb.close()\n\t\t\t\t\treject(request.error)\n\t\t\t\t}\n\t\t\t})\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to load from IndexedDB (${this.key}):`, err)\n\t\t\treturn null\n\t\t}\n\t}\n\n\tasync save(state: T): Promise<void> {\n\t\ttry {\n\t\t\tconst db = await this.openDB()\n\t\t\treturn new Promise<void>((resolve, reject) => {\n\t\t\t\tconst transaction = db.transaction(IndexedDBStorageManager.STORE_NAME, 'readwrite')\n\t\t\t\tconst store = transaction.objectStore(IndexedDBStorageManager.STORE_NAME)\n\t\t\t\tconst request = store.put(state, this.key)\n\n\t\t\t\trequest.onsuccess = () => {\n\t\t\t\t\tdb.close()\n\t\t\t\t\tresolve()\n\t\t\t\t}\n\n\t\t\t\trequest.onerror = () => {\n\t\t\t\t\tdb.close()\n\t\t\t\t\treject(request.error)\n\t\t\t\t}\n\t\t\t})\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to save to IndexedDB (${this.key}):`, err)\n\t\t\tthrow new StoreError<unknown>(`Failed to save to IndexedDB (${this.key})`, err)\n\t\t}\n\t}\n\n\tasync clear(): Promise<void> {\n\t\ttry {\n\t\t\tconst db = await this.openDB()\n\t\t\treturn new Promise<void>((resolve, reject) => {\n\t\t\t\tconst transaction = db.transaction(IndexedDBStorageManager.STORE_NAME, 'readwrite')\n\t\t\t\tconst store = transaction.objectStore(IndexedDBStorageManager.STORE_NAME)\n\t\t\t\tconst request = store.delete(this.key)\n\n\t\t\t\trequest.onsuccess = () => {\n\t\t\t\t\tdb.close()\n\t\t\t\t\tresolve()\n\t\t\t\t}\n\n\t\t\t\trequest.onerror = () => {\n\t\t\t\t\tdb.close()\n\t\t\t\t\treject(request.error)\n\t\t\t\t}\n\t\t\t})\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to clear from IndexedDB (${this.key}):`, err)\n\t\t\tthrow new StoreError<unknown>(`Failed to clear from IndexedDB (${this.key})`, err)\n\t\t}\n\t}\n}\n\n/**\n * Factory function to create the appropriate storage manager\n */\nexport function createStorageManager<T>(type: StorageType, key: string): IStorageManager<T> {\n\tswitch (type) {\n\t\tcase 'local':\n\t\t\treturn new LocalStorageManager<T>(key)\n\t\tcase 'session':\n\t\t\treturn new SessionStorageManager<T>(key)\n\t\tcase 'indexeddb':\n\t\t\treturn new IndexedDBStorageManager<T>(key)\n\t\tcase 'memory':\n\t\tdefault:\n\t\t\treturn new MemoryStorageManager<T>()\n\t}\n}\n","// src/store/store.class.ts - Fixed version\n\nimport { produce, enableMapSet, immerable } from 'immer'\nimport { BehaviorSubject, Subject } from 'rxjs'\nimport { createStorageManager } from './storage-manager'\nimport { IStorageManager, StorageType, StoreError } from './types'\n\n// Enable Map and Set support for Immer\nenableMapSet()\n\n/**\n * Base store class to handle common functionality between store types\n * Now with Immer integration for immutability\n */\nexport abstract class BaseStore<T> {\n\t// Mark the class as immerable to allow Immer to create drafts\n\t[immerable] = true\n\n\t// State tracking\n\tprotected _ready: boolean = false\n\tprotected _destroy$ = new Subject<void>()\n\n\t// Observable streams\n\tpublic $: BehaviorSubject<T>\n\tpublic error$ = new BehaviorSubject<StoreError | null>(null)\n\n\t// Default value for the store\n\tpublic readonly defaultValue: T\n\n\t// Storage manager\n\tprotected storage: IStorageManager<T>\n\n\t/**\n\t * Get store ready state\n\t */\n\tpublic get ready(): boolean {\n\t\treturn this._ready\n\t}\n\n\t/**\n\t * Set store ready state\n\t */\n\tpublic set ready(value: boolean) {\n\t\tthis._ready = value\n\t\tthis.updateState(this.$.value)\n\t}\n\n\t/**\n\t * Get the current value\n\t */\n\tpublic get value(): T {\n\t\treturn this.$.getValue()\n\t}\n\n\t/**\n\t * Initialize the base store\n\t * @param storageType Storage type to use\n\t * @param key Unique key for the store\n\t * @param defaultValue Default/initial value\n\t */\n\tconstructor(\n\t\tprotected storageType: StorageType,\n\t\tprotected key: string,\n\t\tdefaultValue: T,\n\t) {\n\t\t// Before using produce, ensure the input is draftable\n\t\t// This ensures Immer won't throw an error on non-draftable values\n\t\tlet safeDefaultValue: T\n\n\t\tif (defaultValue instanceof Map) {\n\t\t\t// For Maps, create a new Map instance\n\t\t\tsafeDefaultValue = new Map(defaultValue) as unknown as T\n\t\t} else if (Array.isArray(defaultValue)) {\n\t\t\t// For arrays, create a new array instance\n\t\t\tsafeDefaultValue = [...defaultValue] as unknown as T\n\t\t} else if (defaultValue && typeof defaultValue === 'object') {\n\t\t\t// For objects, create a shallow copy\n\t\t\tsafeDefaultValue = { ...defaultValue } as T\n\t\t} else {\n\t\t\t// For primitives or other non-draftable types\n\t\t\tsafeDefaultValue = defaultValue\n\t\t}\n\n\t\t// Make an immutable copy of the default value when possible\n\t\ttry {\n\t\t\tthis.defaultValue = this.isImmerDraftable(safeDefaultValue)\n\t\t\t\t? produce(safeDefaultValue, draft => draft)\n\t\t\t\t: safeDefaultValue\n\t\t} catch (error) {\n\t\t\tconsole.warn(`[BaseStore] Unable to produce immutable copy of defaultValue:`, error)\n\t\t\tthis.defaultValue = safeDefaultValue\n\t\t}\n\n\t\t// Initialize BehaviorSubject with the default value\n\t\tthis.$ = new BehaviorSubject<T>(this.defaultValue)\n\t\tthis.storage = createStorageManager<T>(storageType, key)\n\n\t\t// Set ready immediately for memory storage\n\t\tif (storageType === 'memory') {\n\t\t\tthis._ready = true\n\t\t} else {\n\t\t\t// Initialize from storage for persistent stores\n\t\t\tthis.initializeFromStorage()\n\t\t}\n\t}\n\n\t/**\n\t * Check if a value can be safely used with Immer's produce\n\t */\n\tprotected isImmerDraftable(value: any): boolean {\n\t\treturn (\n\t\t\tvalue !== null &&\n\t\t\ttypeof value === 'object' &&\n\t\t\t(Array.isArray(value) ||\n\t\t\t\tvalue instanceof Map ||\n\t\t\t\tvalue instanceof Set ||\n\t\t\t\tObject.getPrototypeOf(value) === Object.prototype ||\n\t\t\t\tvalue[immerable] === true)\n\t\t)\n\t}\n\n\t/**\n\t * Cleanup method for all store types\n\t */\n\tpublic destroy(): void {\n\t\tthis._destroy$.next()\n\t\tthis._destroy$.complete()\n\t\tthis.$.complete()\n\t\tthis.error$.complete()\n\t}\n\n\t/**\n\t * Replace the entire store state immutably\n\t */\n\tpublic replace(newValue: T): void {\n\t\ttry {\n\t\t\t// Use Immer to create an immutable copy if possible\n\t\t\tconst nextState = this.isImmerDraftable(newValue) ? produce(newValue, draft => draft) : newValue\n\n\t\t\tthis.updateState(nextState)\n\t\t} catch (error) {\n\t\t\tconst storeError = new StoreError<unknown>(`Error replacing state in ${this.key}`, error)\n\t\t\tthis.error$.next(storeError)\n\t\t\tconsole.error(storeError)\n\n\t\t\t// Fallback to direct assignment\n\t\t\tthis.updateState(newValue)\n\t\t}\n\t}\n\n\t/**\n\t * Reset to default value - to be implemented by subclasses\n\t */\n\tpublic abstract clear(): void\n\n\t/**\n\t * Update the state with proper error handling and immutability\n\t */\n\tprotected updateState(newValue: T): void {\n\t\ttry {\n\t\t\t// Ensure immutability by creating a fresh copy with Immer when possible\n\t\t\tlet nextState: T\n\n\t\t\tif (this.isImmerDraftable(newValue)) {\n\t\t\t\tnextState = produce(newValue, draft => draft)\n\t\t\t} else {\n\t\t\t\tnextState = newValue\n\t\t\t}\n\n\t\t\tthis.$.next(nextState)\n\n\t\t\t// Persist to storage\n\t\t\tif (this.storageType !== 'memory') {\n\t\t\t\tthis.persistToStorage(nextState).catch(err => {\n\t\t\t\t\tconst error = new StoreError<unknown>(`Error saving to ${this.storageType} storage for ${this.key}`, err)\n\t\t\t\t\tthis.error$.next(error)\n\t\t\t\t\tconsole.error(error)\n\t\t\t\t})\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error updating state in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\n\t\t\t// Fallback to direct update\n\t\t\tthis.$.next(newValue)\n\t\t}\n\t}\n\n\t/**\n\t * Initialize the store from persistent storage\n\t */\n\tprotected async initializeFromStorage(): Promise<void> {\n\t\ttry {\n\t\t\tconst storedValue = await this.storage.load()\n\t\t\tif (storedValue) {\n\t\t\t\t// Process and update state with the stored value\n\t\t\t\tconst processedValue = this.processStoredValue(storedValue)\n\n\t\t\t\ttry {\n\t\t\t\t\t// Only use Immer if the value is draftable\n\t\t\t\t\tconst immutableValue = this.isImmerDraftable(processedValue)\n\t\t\t\t\t\t? produce(processedValue, draft => draft)\n\t\t\t\t\t\t: processedValue\n\n\t\t\t\t\tthis.updateState(immutableValue)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconsole.warn(`[BaseStore] Unable to create immutable copy, using value directly:`, error)\n\t\t\t\t\tthis.updateState(processedValue)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._ready = true\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error loading from ${this.storageType} storage for ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t\tthis._ready = true // Mark as ready even if loading fails\n\t\t}\n\t}\n\n\t/**\n\t * Process stored value (can be overridden by subclasses)\n\t */\n\tprotected processStoredValue(storedValue: T): T {\n\t\treturn storedValue\n\t}\n\n\t/**\n\t * Persist state to storage\n\t */\n\tprotected async persistToStorage(state: T): Promise<void> {\n\t\treturn this.storage.save(state)\n\t}\n\n\t/**\n\t * Setup development tools\n\t */\n\tprotected abstract setupDevTools(): void\n}\n","// src/store/context-array.ts - Array store implementation with Immer\nimport { Draft, castDraft, produce } from 'immer'\nimport { throttleTime } from 'rxjs'\nimport { BaseStore } from './store.class'\nimport { IArrayStore, StorageType, StoreError } from './types'\n\n/**\n * Enhanced array store with TypeScript support and immutability\n * Extends BaseStore for common functionality\n */\nexport class SchmancyArrayStore<T = any> extends BaseStore<T[]> implements IArrayStore<T> {\n\tpublic static type = 'array'\n\n\t// Static map to hold instances\n\tprivate static instances: Map<string, SchmancyArrayStore<any>> = new Map()\n\n\t/**\n\t * Static method to get or create an instance with proper typing\n\t */\n\tpublic static getInstance<T = any>(storage: StorageType, key: string, defaultValue: T[] = []): SchmancyArrayStore<T> {\n\t\tconst instanceKey = `${storage}:${key}`\n\t\tif (!this.instances.has(instanceKey)) {\n\t\t\tthis.instances.set(instanceKey, new SchmancyArrayStore<T>(storage, key, defaultValue))\n\t\t}\n\t\treturn this.instances.get(instanceKey) as SchmancyArrayStore<T>\n\t}\n\n\t/**\n\t * Constructor extension to set up persistence\n\t */\n\tconstructor(storageType: StorageType, key: string, defaultValue: T[] = []) {\n\t\tsuper(storageType, key, defaultValue)\n\n\t\t// Set up persistence throttling for better performance\n\t\tif (storageType !== 'memory') {\n\t\t\tthis.setupPersistence()\n\t\t}\n\t}\n\n\t/**\n\t * Set up persistence to storage with throttling\n\t */\n\tprivate setupPersistence(): void {\n\t\tthis.$.pipe(throttleTime(100, undefined, { leading: true, trailing: true })).subscribe(currentValue => {\n\t\t\tthis.storage.save(currentValue).catch(err => {\n\t\t\t\tconst error = new StoreError<unknown>(`Error saving to ${this.storageType} storage for ${this.key}`, err)\n\t\t\t\tthis.error$.next(error)\n\t\t\t\tconsole.error(error)\n\t\t\t})\n\t\t})\n\t}\n\n\t/**\n\t * Add an item to the end of the array\n\t */\n\tpublic push(...items: T[]): void {\n\t\ttry {\n\t\t\t// Use Immer to create a new immutable array\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tdraft.push(...items.map(item => castDraft(item) as Draft<T>))\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null) // Clear any previous errors\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error pushing items in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Remove and return the last item from the array\n\t */\n\tpublic pop(): T | undefined {\n\t\ttry {\n\t\t\t// Get the item before modifying the array\n\t\t\tconst originalItem = this.value.length > 0 ? this.value[this.value.length - 1] : undefined\n\n\t\t\t// Use Immer to create a new immutable array\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tdraft.pop()\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null) // Clear any previous errors\n\t\t\treturn originalItem\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error popping item from ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t\treturn undefined\n\t\t}\n\t}\n\t/**\n\t * Add item(s) to the beginning of the array\n\t */\n\tpublic unshift(...items: T[]): void {\n\t\ttry {\n\t\t\t// Use Immer to create a new immutable array\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tdraft.unshift(...items.map(item => castDraft(item) as Draft<T>))\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error unshifting items in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Remove and return the first item from the array\n\t */\n\tpublic shift(): T | undefined {\n\t\ttry {\n\t\t\t// Get the item before modifying the array\n\t\t\tconst originalItem = this.value.length > 0 ? this.value[0] : undefined\n\n\t\t\t// Use Immer to create a new immutable array\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tdraft.shift()\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t\treturn originalItem\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error shifting item from ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t\treturn undefined\n\t\t}\n\t}\n\n\t/**\n\t * Update an item at a specific index\n\t */\n\tpublic set(index: number, value: T): void {\n\t\ttry {\n\t\t\t// Use Immer to create a new immutable array\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tif (index >= 0 && index < draft.length) {\n\t\t\t\t\tdraft[index] = castDraft(value) as Draft<T>\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(`Index ${index} out of bounds (length: ${draft.length})`)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error setting item at index ${index} in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Get item at a specific index\n\t */\n\tpublic get(index: number): T | undefined {\n\t\treturn this.value[index]\n\t}\n\n\t/**\n\t * Remove items from the array\n\t */\n\tpublic splice(start: number, deleteCount?: number, ...items: T[]): T[] {\n\t\ttry {\n\t\t\t// Get a copy of the current array\n\t\t\tconst originalArray = [...this.value]\n\n\t\t\t// Perform splice on the copy to get the removed items\n\t\t\tconst removed = originalArray.splice(start, deleteCount ?? 0, ...items)\n\n\t\t\t// Now use Immer to create the new state with the same changes\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tdraft.splice(start, deleteCount ?? 0, ...items.map(item => castDraft(item) as Draft<T>))\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t\treturn removed\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error splicing items in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t\treturn []\n\t\t}\n\t}\n\n\t/**\n\t * Remove an item by value (first occurrence)\n\t */\n\tpublic remove(item: T, compareFn?: (a: T, b: T) => boolean): boolean {\n\t\ttry {\n\t\t\tconst equals = compareFn || ((a, b) => a === b)\n\n\t\t\t// Find the index in the original array\n\t\t\tconst index = this.value.findIndex(currentItem => equals(currentItem, item))\n\n\t\t\t// If found, remove using Immer\n\t\t\tif (index !== -1) {\n\t\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\t\tdraft.splice(index, 1)\n\t\t\t\t})\n\n\t\t\t\tthis.updateState(nextState)\n\t\t\t\tthis.error$.next(null)\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\t// Item not found\n\t\t\tthis.error$.next(null)\n\t\t\treturn false\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error removing item in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t\treturn false\n\t\t}\n\t}\n\n\t/**\n\t * Replace entire array\n\t */\n\tpublic replace(newArray: T[]): void {\n\t\ttry {\n\t\t\t// Create a fresh immutable copy with Immer\n\t\t\tconst nextState = produce(newArray, draft => draft)\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error replacing array in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Filter items in the array\n\t */\n\tpublic filter(predicate: (value: T, index: number, array: T[]) => boolean): void {\n\t\ttry {\n\t\t\t// Filter the original array first\n\t\t\tconst filteredArray = this.value.filter(predicate)\n\n\t\t\t// Then use Immer to create a new immutable array\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\t// Clear the draft array and fill it with the filtered items\n\t\t\t\tdraft.length = 0\n\t\t\t\tdraft.push(...filteredArray.map(item => castDraft(item) as Draft<T>))\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error filtering array in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Map over the array and transform items\n\t */\n\tpublic map<U>(mapper: (value: T, index: number, array: T[]) => U): U[] {\n\t\treturn this.value.map(mapper)\n\t}\n\n\t/**\n\t * Sort the array in place\n\t */\n\tpublic sort(compareFn?: (a: T, b: T) => number): void {\n\t\ttry {\n\t\t\t// Create a copy of the current array and apply the sort operation\n\t\t\tconst sortedArray = [...this.value].sort(compareFn)\n\n\t\t\t// Use Immer to create a new immutable array that matches the sorted array\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\t// Clear the array and refill it with the sorted items\n\t\t\t\tdraft.length = 0\n\t\t\t\tdraft.push(...sortedArray.map(item => castDraft(item) as Draft<T>))\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error sorting array in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Update a specific item using a callback function\n\t */\n\tpublic update(index: number, updater: (item: Draft<T>) => void): void {\n\t\ttry {\n\t\t\t// Use Immer to create a new immutable array\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tif (index >= 0 && index < draft.length) {\n\t\t\t\t\tupdater(draft[index])\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(`Index ${index} out of bounds (length: ${draft.length})`)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error updating item at index ${index} in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Clear the array\n\t */\n\tpublic clear(): void {\n\t\tthis.updateState([])\n\t}\n\n\t/**\n\t * Setup development tools for debugging\n\t */\n\tprotected setupDevTools(): void {\n\t\tif (typeof window !== 'undefined') {\n\t\t\t// Add to global store registry\n\t\t\t;(window as any).__STORES__ = (window as any).__STORES__ || {}\n\t\t\t;(window as any).__STORES__[this.key] = {\n\t\t\t\tgetState: () => this.value,\n\t\t\t\tpush: this.push.bind(this),\n\t\t\t\tpop: this.pop.bind(this),\n\t\t\t\tunshift: this.unshift.bind(this),\n\t\t\t\tshift: this.shift.bind(this),\n\t\t\t\tset: this.set.bind(this),\n\t\t\t\tget: this.get.bind(this),\n\t\t\t\tsplice: this.splice.bind(this),\n\t\t\t\tremove: this.remove.bind(this),\n\t\t\t\treplace: this.replace.bind(this),\n\t\t\t\tfilter: this.filter.bind(this),\n\t\t\t\tmap: this.map.bind(this),\n\t\t\t\tsort: this.sort.bind(this),\n\t\t\t\tupdate: this.update.bind(this),\n\t\t\t\tclear: this.clear.bind(this),\n\t\t\t\tsubscribe: (callback: (state: T[]) => void) => {\n\t\t\t\t\tconst subscription = this.$.subscribe(callback)\n\t\t\t\t\treturn () => subscription.unsubscribe()\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t}\n}\n","// src/store/context-collection.ts - Updated with Immer for immutability\nimport { throttleTime } from 'rxjs'\nimport { BaseStore } from './store.class'\nimport { ICollectionStore, StorageType, StoreError } from './types'\nimport { produce, Draft, castDraft } from 'immer'\n\n/**\n * Enhanced collection store with better TypeScript support and immutability\n * Now extends BaseStore for common functionality\n */\nexport default class SchmancyCollectionStore<V = any> extends BaseStore<Map<string, V>> implements ICollectionStore<V> {\n\tpublic static type = 'collection'\n\n\t// Static map to hold instances\n\tprivate static instances: Map<string, SchmancyCollectionStore<any>> = new Map()\n\n\t/**\n\t * Static method to get or create an instance with proper typing\n\t */\n\tpublic static getInstance<V = any>(\n\t\tstorage: StorageType,\n\t\tkey: string,\n\t\tdefaultValue: Map<string, V>,\n\t): SchmancyCollectionStore<V> {\n\t\tconst instanceKey = `${storage}:${key}`\n\t\tif (!this.instances.has(instanceKey)) {\n\t\t\tthis.instances.set(instanceKey, new SchmancyCollectionStore<V>(storage, key, defaultValue))\n\t\t}\n\t\treturn this.instances.get(instanceKey) as SchmancyCollectionStore<V>\n\t}\n\n\t/**\n\t * Set values in the collection with proper typing and immutability.\n\t * Supports multiple input types to prevent common developer mistakes.\n\t * \n\t * @example\n\t * // Single key-value pair\n\t * store.set('key1', value1)\n\t * \n\t * @example\n\t * // Merge from a Map\n\t * const dataMap = new Map([['key1', value1], ['key2', value2]])\n\t * store.set(dataMap)\n\t * \n\t * @example\n\t * // Merge from an object\n\t * store.set({ key1: value1, key2: value2 })\n\t */\n\tpublic set<T = V>(keyOrData: string | Map<string, T> | Record<string, T>, value?: T): void {\n\t\ttry {\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\t// Handle different input types\n\t\t\t\tif (typeof keyOrData === 'string') {\n\t\t\t\t\t// Traditional key-value pair\n\t\t\t\t\tif (value === undefined) {\n\t\t\t\t\t\tthrow new Error('Value is required when setting a single key')\n\t\t\t\t\t}\n\t\t\t\t\tdraft.set(keyOrData, castDraft(value) as unknown as Draft<V>)\n\t\t\t\t} else if (keyOrData instanceof Map) {\n\t\t\t\t\t// Merge all entries from the Map\n\t\t\t\t\tArray.from(keyOrData.entries()).forEach(([key, val]) => {\n\t\t\t\t\t\tdraft.set(key, castDraft(val) as unknown as Draft<V>)\n\t\t\t\t\t})\n\t\t\t\t} else if (typeof keyOrData === 'object' && keyOrData !== null) {\n\t\t\t\t\t// Merge all properties from the object\n\t\t\t\t\tObject.entries(keyOrData).forEach(([key, val]) => {\n\t\t\t\t\t\tdraft.set(key, castDraft(val) as unknown as Draft<V>)\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error('Invalid input: expected string key with value, Map, or object')\n\t\t\t\t}\n\t\t\t})\n\n\t\t\t// Update the state with the new immutable Map\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null) // Clear any previous errors\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error setting values in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Merge a Map into the collection. This is a helper method that provides\n\t * explicit semantics for merging operations.\n\t * \n\t * @param map The Map to merge into the collection\n\t * @example\n\t * const dataMap = new Map([['key1', value1], ['key2', value2]])\n\t * store.merge(dataMap)\n\t */\n\tpublic merge<T = V>(map: Map<string, T>): void {\n\t\tthis.set(map)\n\t}\n\n\t/**\n\t * Delete a value from the collection immutably\n\t */\n\tpublic delete(key: string): void {\n\t\ttry {\n\t\t\t// Use Immer to create a new immutable Map with the key deleted\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tdraft.delete(key)\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null) // Clear any previous errors\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error deleting key ${key} from ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Clear the collection immutably\n\t */\n\tpublic clear(): void {\n\t\t// Create a fresh empty Map\n\t\tthis.updateState(new Map<string, V>())\n\t}\n\n\t/**\n\t * Batch update multiple items in the collection\n\t * @param updates Object with keys and values to update\n\t */\n\tpublic batchUpdate(updates: Record<string, V>): void {\n\t\ttry {\n\t\t\t// Use Immer to apply all updates in a single immutable operation\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tObject.entries(updates).forEach(([key, value]) => {\n\t\t\t\t\tdraft.set(key, castDraft(value) as unknown as Draft<V>)\n\t\t\t\t})\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error batch updating in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Update an existing item in the collection using an updater function\n\t * @param key Key of the item to update\n\t * @param updater Function that receives the current value and returns the new value\n\t */\n\tpublic update(key: string, updater: (currentValue: Draft<V>) => void): void {\n\t\ttry {\n\t\t\t// Use Immer to update the specific item\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tconst currentValue = draft.get(key)\n\t\t\t\tif (currentValue !== undefined) {\n\t\t\t\t\tupdater(currentValue)\n\t\t\t\t\t// No need to set the value back since it's updated in place\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error updating item ${key} in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Constructor extension to set up persistence\n\t */\n\tconstructor(storageType: StorageType, key: string, defaultValue: Map<string, V>) {\n\t\tsuper(storageType, key, defaultValue)\n\n\t\t// Set up persistence throttling for better performance\n\t\tif (storageType !== 'memory') {\n\t\t\tthis.setupPersistence()\n\t\t}\n\t}\n\n\t/**\n\t * Set up persistence to storage with throttling\n\t */\n\tprivate setupPersistence(): void {\n\t\tthis.$.pipe(throttleTime(100, undefined, { leading: true, trailing: true })).subscribe(currentValue => {\n\t\t\tthis.storage.save(currentValue).catch(err => {\n\t\t\t\tconst error = new StoreError<unknown>(`Error saving to ${this.storageType} storage for ${this.key}`, err)\n\t\t\t\tthis.error$.next(error)\n\t\t\t\tconsole.error(error)\n\t\t\t})\n\t\t})\n\t}\n\n\t/**\n\t * Setup development tools for debugging\n\t */\n\tprotected setupDevTools(): void {\n\t\tif (typeof window !== 'undefined') {\n\t\t\t// Add to global store registry\n\t\t\t;(window as any).__STORES__ = (window as any).__STORES__ || {}\n\t\t\t;(window as any).__STORES__[this.key] = {\n\t\t\t\tgetState: () => this.value,\n\t\t\t\tset: this.set.bind(this),\n\t\t\t\tmerge: this.merge.bind(this),\n\t\t\t\tdelete: this.delete.bind(this),\n\t\t\t\tclear: this.clear.bind(this),\n\t\t\t\tbatchUpdate: this.batchUpdate.bind(this),\n\t\t\t\tupdate: this.update.bind(this),\n\t\t\t\tsubscribe: (callback: (state: Map<string, V>) => void) => {\n\t\t\t\t\tconst subscription = this.$.subscribe(callback)\n\t\t\t\t\treturn () => subscription.unsubscribe()\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t}\n}\n","// src/store/context-object.ts - Fixed version\n\nimport { BaseStore } from './store.class'\nimport { IStore, StorageType, StoreError } from './types'\nimport { produce, Draft, castDraft, immerable } from 'immer'\n\n/**\n * Enhanced store object with better TypeScript support and immutability\n * Now extends BaseStore for common functionality and uses Immer\n */\nexport class SchmancyStoreObject<T extends Record<string, any>> extends BaseStore<T> implements IStore<T> {\n\t// Mark as immerable so Immer can create drafts of this class\n\t[immerable] = true\n\n\tpublic static type = 'object'\n\n\t// Static map to hold instances with proper typing\n\tprivate static instances: Map<string, SchmancyStoreObject<any>> = new Map()\n\n\t/**\n\t * Static method to get or create an instance with strong typing\n\t */\n\tpublic static getInstance<T extends Record<string, any>>(\n\t\tstorage: StorageType,\n\t\tkey: string,\n\t\tdefaultValue: T,\n\t): SchmancyStoreObject<T> {\n\t\tconst instanceKey = `${storage}:${key}`\n\t\tif (!this.instances.has(instanceKey)) {\n\t\t\tthis.instances.set(instanceKey, new SchmancyStoreObject<T>(storage, key, defaultValue))\n\t\t}\n\t\treturn this.instances.get(instanceKey) as SchmancyStoreObject<T>\n\t}\n\n\t/**\n\t * Set state with proper typing and immutability using Immer\n\t */\n\tpublic set(value: Partial<T>, merge: boolean = true): void {\n\t\ttry {\n\t\t\tif (!this.isImmerDraftable(this.value)) {\n\t\t\t\t// If current value isn't draftable, handle directly\n\t\t\t\tconst nextState = merge ? { ...this.value, ...value } : (value as T)\n\n\t\t\t\tthis.updateState(nextState)\n\t\t\t\tthis.error$.next(null)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Use Immer to create an immutable update\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tif (merge) {\n\t\t\t\t\t// Handle null/undefined value safely\n\t\t\t\t\tif (value === null || value === undefined) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\t// Merge new values into existing state\n\t\t\t\t\t// Use castDraft to properly type the value for the draft context\n\t\t\t\t\ttry {\n\t\t\t\t\t\tObject.assign(draft, castDraft(value) as Draft<Partial<T>>)\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tconsole.warn('[SchmancyStoreObject] Error casting to draft, falling back to direct assign:', err)\n\t\t\t\t\t\t// Fallback to direct property assignment\n\t\t\t\t\t\tObject.keys(value).forEach(key => {\n\t\t\t\t\t\t\t;(draft as any)[key] = (value as any)[key]\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// For complete replacement, return a completely new object\n\t\t\t\t\t// This is handled specially by Immer\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn castDraft(value as T) as Draft<T>\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tconsole.warn('[SchmancyStoreObject] Error casting to draft, returning value directly:', err)\n\t\t\t\t\t\treturn value as unknown as Draft<T>\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null) // Clear any previous errors\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error updating store: ${this.key}`, err, { value, merge })\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\n\t\t\t// Fallback to direct update\n\t\t\ttry {\n\t\t\t\tconst fallbackState = merge ? { ...this.value, ...value } : (value as T)\n\t\t\t\tthis.updateState(fallbackState)\n\t\t\t} catch (fallbackErr) {\n\t\t\t\tconsole.error('Failed fallback update:', fallbackErr)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Reset the store to its default value\n\t */\n\tpublic clear(): void {\n\t\ttry {\n\t\t\t// Create a fresh copy of the default value using Immer\n\t\t\tif (this.isImmerDraftable(this.defaultValue)) {\n\t\t\t\tconst freshDefaultValue = produce(this.defaultValue, draft => draft)\n\t\t\t\tthis.set(freshDefaultValue, false)\n\t\t\t} else {\n\t\t\t\t// For non-draftable values, use direct replacement\n\t\t\t\tthis.set(this.defaultValue as any, false)\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error clearing store: ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\n\t\t\t// Fallback to direct reset\n\t\t\tthis.updateState(this.defaultValue)\n\t\t}\n\t}\n\n\t/**\n\t * Delete a specific key from the store with type checking and immutability\n\t */\n\tpublic delete<K extends keyof T>(key: K): void {\n\t\ttry {\n\t\t\tif (!this.isImmerDraftable(this.value)) {\n\t\t\t\t// Handle non-draftable objects directly\n\t\t\t\tconst nextState = { ...this.value }\n\t\t\t\tdelete nextState[key]\n\t\t\t\tthis.updateState(nextState as T)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Use Immer to create an immutable update that removes the key\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\t// Use type assertion to tell TypeScript this is safe\n\t\t\t\tdelete draft[key as keyof Draft<T>]\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error deleting key ${String(key)} from store: ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\n\t\t\t// Fallback to direct modification\n\t\t\ttry {\n\t\t\t\tconst fallbackState = { ...this.value }\n\t\t\t\tdelete fallbackState[key]\n\t\t\t\tthis.updateState(fallbackState as T)\n\t\t\t} catch (fallbackErr) {\n\t\t\t\tconsole.error('Failed fallback delete:', fallbackErr)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Update a nested property at a specific path\n\t * @param path Dot-separated path to the property (e.g., 'user.profile.name')\n\t * @param value New value to set\n\t */\n\tpublic setPath(path: string, value: any): void {\n\t\ttry {\n\t\t\tif (!path) {\n\t\t\t\tconsole.warn('[SchmancyStoreObject] Empty path provided to setPath')\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (!this.isImmerDraftable(this.value)) {\n\t\t\t\t// Handle non-draftable objects with direct modification\n\t\t\t\tconst parts = path.split('.')\n\t\t\t\tconst nextState = { ...this.value }\n\t\t\t\tlet current: any = nextState\n\n\t\t\t\tfor (let i = 0; i < parts.length - 1; i++) {\n\t\t\t\t\tconst part = parts[i]\n\t\t\t\t\tif (current[part] === undefined) {\n\t\t\t\t\t\tcurrent[part] = {}\n\t\t\t\t\t} else if (typeof current[part] !== 'object' || current[part] === null) {\n\t\t\t\t\t\tcurrent[part] = {}\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = current[part]\n\t\t\t\t}\n\n\t\t\t\tcurrent[parts[parts.length - 1]] = value\n\t\t\t\tthis.updateState(nextState)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Use Immer for immutable deep updates\n\t\t\tconst nextState = produce(this.value, draft => {\n\t\t\t\tconst parts = path.split('.')\n\t\t\t\tlet current: any = draft\n\n\t\t\t\t// Navigate to the parent of the property we want to update\n\t\t\t\tfor (let i = 0; i < parts.length - 1; i++) {\n\t\t\t\t\tconst part = parts[i]\n\n\t\t\t\t\t// Create the path if it doesn't exist\n\t\t\t\t\tif (current[part] === undefined) {\n\t\t\t\t\t\tcurrent[part] = {}\n\t\t\t\t\t} else if (typeof current[part] !== 'object' || current[part] === null) {\n\t\t\t\t\t\t// Convert to object if it's not one already\n\t\t\t\t\t\tcurrent[part] = {}\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrent = current[part]\n\t\t\t\t}\n\n\t\t\t\t// Set the value at the final path segment\n\t\t\t\tconst lastPart = parts[parts.length - 1]\n\t\t\t\ttry {\n\t\t\t\t\tcurrent[lastPart] = castDraft(value)\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconsole.warn('[SchmancyStoreObject] Error casting to draft, setting directly:', err)\n\t\t\t\t\tcurrent[lastPart] = value\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tthis.updateState(nextState)\n\t\t\tthis.error$.next(null)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error setting path ${path} in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\n\t\t\t// Fallback to direct path setting\n\t\t\ttry {\n\t\t\t\tconst parts = path.split('.')\n\t\t\t\tconst nextState = { ...this.value }\n\t\t\t\tlet current: any = nextState\n\n\t\t\t\tfor (let i = 0; i < parts.length - 1; i++) {\n\t\t\t\t\tconst part = parts[i]\n\t\t\t\t\tif (current[part] === undefined) {\n\t\t\t\t\t\tcurrent[part] = {}\n\t\t\t\t\t} else if (typeof current[part] !== 'object' || current[part] === null) {\n\t\t\t\t\t\tcurrent[part] = {}\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = current[part]\n\t\t\t\t}\n\n\t\t\t\tcurrent[parts[parts.length - 1]] = value\n\t\t\t\tthis.updateState(nextState)\n\t\t\t} catch (fallbackErr) {\n\t\t\t\tconsole.error('Failed fallback setPath:', fallbackErr)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Process stored value by merging with default value\n\t */\n\tprotected processStoredValue(storedValue: T): T {\n\t\ttry {\n\t\t\t// Use Immer to create a clean merged state if possible\n\t\t\tif (this.isImmerDraftable(this.defaultValue) && this.isImmerDraftable(storedValue)) {\n\t\t\t\treturn produce(this.defaultValue, draft => {\n\t\t\t\t\tObject.assign(draft, castDraft(storedValue) as Draft<T>)\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\t// Otherwise use a standard merge\n\t\t\t\treturn { ...this.defaultValue, ...storedValue }\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tconsole.warn(`[SchmancyStoreObject] Error processing stored value, returning as-is:`, err)\n\t\t\treturn storedValue\n\t\t}\n\t}\n\n\t/**\n\t * Setup development tools for debugging\n\t */\n\tprotected setupDevTools(): void {\n\t\tif (typeof window !== 'undefined') {\n\t\t\t// Add to global store registry\n\t\t\t;(window as any).__STORES__ = (window as any).__STORES__ || {}\n\t\t\t;(window as any).__STORES__[this.key] = {\n\t\t\t\tgetState: () => this.value,\n\t\t\t\tset: this.set.bind(this),\n\t\t\t\tdelete: this.delete.bind(this),\n\t\t\t\tclear: this.clear.bind(this),\n\t\t\t\tsetPath: this.setPath.bind(this),\n\t\t\t\tsubscribe: (callback: (state: T) => void) => {\n\t\t\t\t\tconst subscription = this.$.subscribe(callback)\n\t\t\t\t\treturn () => subscription.unsubscribe()\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Inherit isImmerDraftable from BaseStore, but also check for [immerable]\n\t */\n\tprotected isImmerDraftable(value: any): boolean {\n\t\t// Use the parent implementation and add our own checks\n\t\treturn value !== null && typeof value === 'object' && (super.isImmerDraftable(value) || value[immerable] === true)\n\t}\n}\n","// src/store/context-create.ts - Fixed version\n\nimport { SchmancyArrayStore } from './context-array'\nimport SchmancyCollectionStore from './context-collection'\nimport { SchmancyStoreObject } from './context-object'\nimport { IArrayStore, ICollectionStore, IStore, StorageType } from './types'\n\n/**\n * Type guard to check if an object is empty\n */\nfunction isEmptyObject(obj: unknown): boolean {\n\tif (typeof obj !== 'object' || obj === null) {\n\t\treturn false\n\t}\n\treturn Object.keys(obj).length === 0\n}\n\n/**\n * Type guard for Map objects\n */\nfunction isMap<K, V>(value: unknown): value is Map<K, V> {\n\treturn value instanceof Map\n}\n\n/**\n * Type guard for Array objects\n */\nfunction isArray<T>(value: unknown): value is Array<T> {\n\treturn Array.isArray(value)\n}\n\n/**\n * Type guard for plain objects (not arrays, maps, null, etc.)\n */\nfunction isPlainObject(value: unknown): boolean {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object' &&\n\t\t!Array.isArray(value) &&\n\t\t!(value instanceof Map) &&\n\t\t!(value instanceof Set) &&\n\t\t!(value instanceof Date) &&\n\t\t!(value instanceof RegExp) &&\n\t\tObject.getPrototypeOf(value) === Object.prototype\n\t)\n}\n\n/**\n * Creates a regular object store with better typing and error handling\n */\nfunction createObjectStore<T extends Record<string, any>>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n): IStore<T> & SchmancyStoreObject<T> {\n\ttry {\n\t\t// Validate storage type\n\t\tif (storage === 'indexeddb') {\n\t\t\tconsole.warn(`IndexedDB storage is not optimal for plain objects. Using 'local' instead for key: ${key}`)\n\t\t\tstorage = 'local'\n\t\t}\n\n\t\t// Ensure initialData is a plain object\n\t\tif (!isPlainObject(initialData)) {\n\t\t\tconsole.warn(`Initial data is not a plain object. Converting to object for key: ${key}`)\n\t\t\tinitialData = { ...initialData } as T\n\t\t}\n\n\t\t// Create the store instance\n\t\tconst store = SchmancyStoreObject.getInstance<T>(storage, key, initialData)\n\n\t\t// Initialize with provided data if store is empty\n\t\tif (isEmptyObject(store.value)) {\n\t\t\tstore.set({ ...initialData }) // Use spread to create a copy\n\t\t}\n\n\t\treturn store\n\t} catch (err) {\n\t\tconsole.error(`Failed to create object store for key: ${key}`, err)\n\t\t// Fall back to a basic implementation that won't throw\n\t\tconst fallbackStore = SchmancyStoreObject.getInstance<T>(\n\t\t\t'memory', // Fallback to memory storage\n\t\t\t`${key}-fallback`,\n\t\t\tinitialData,\n\t\t)\n\t\tconsole.warn(`Using fallback memory store for key: ${key}`)\n\t\treturn fallbackStore\n\t}\n}\n\n/**\n * Creates a collection store with better typing and error handling\n */\nfunction createCollectionStore<V>(\n\tinitialData: Map<string, V>,\n\tstorage: StorageType,\n\tkey: string,\n): ICollectionStore<V> & SchmancyCollectionStore<V> {\n\ttry {\n\t\t// Create the store instance\n\t\tconst store = SchmancyCollectionStore.getInstance(storage, key, initialData)\n\n\t\t// Initialize with provided data if store is empty\n\t\tif (!store.value.size) {\n\t\t\t// Create a new Map instance to avoid modifying the input\n\t\t\tstore.replace(new Map(initialData))\n\t\t}\n\n\t\treturn store\n\t} catch (err) {\n\t\tconsole.error(`Failed to create collection store for key: ${key}`, err)\n\t\t// Fall back to a basic implementation that won't throw\n\t\tconst fallbackStore = SchmancyCollectionStore.getInstance<V>(\n\t\t\t'memory', // Fallback to memory storage\n\t\t\t`${key}-fallback`,\n\t\t\tnew Map(initialData),\n\t\t)\n\t\tconsole.warn(`Using fallback memory store for key: ${key}`)\n\t\treturn fallbackStore\n\t}\n}\n\n/**\n * Creates an array store with better typing and error handling\n */\nfunction createArrayStore<T>(\n\tinitialData: T[],\n\tstorage: StorageType,\n\tkey: string,\n): IArrayStore<T> & SchmancyArrayStore<T> {\n\ttry {\n\t\t// Create the store instance\n\t\tconst store = SchmancyArrayStore.getInstance(storage, key, initialData)\n\n\t\t// Initialize with provided data if store is empty\n\t\tif (!store.value.length) {\n\t\t\t// Create a new array instance to avoid modifying the input\n\t\t\tstore.replace([...initialData])\n\t\t}\n\n\t\treturn store\n\t} catch (err) {\n\t\tconsole.error(`Failed to create array store for key: ${key}`, err)\n\t\t// Fall back to a basic implementation that won't throw\n\t\tconst fallbackStore = SchmancyArrayStore.getInstance<T>(\n\t\t\t'memory', // Fallback to memory storage\n\t\t\t`${key}-fallback`,\n\t\t\t[...initialData],\n\t\t)\n\t\tconsole.warn(`Using fallback memory store for key: ${key}`)\n\t\treturn fallbackStore\n\t}\n}\n\n// Function overloads for better type inference\n/**\n * Creates a context for managing object state\n * @param initialData The initial object data\n * @param storage Storage type to use\n * @param key Unique key for the store\n * @returns A store instance for the object\n */\nexport function createContext<T extends Record<string, any>>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n): IStore<T> & SchmancyStoreObject<T>\n\n/**\n * Creates a context for managing collection state\n * @param initialData The initial Map collection\n * @param storage Storage type to use\n * @param key Unique key for the store\n * @returns A collection store instance\n */\nexport function createContext<V>(\n\tinitialData: Map<string, V>,\n\tstorage: StorageType,\n\tkey: string,\n): ICollectionStore<V> & SchmancyCollectionStore<V>\n\n/**\n * Creates a context for managing array state\n * @param initialData The initial array\n * @param storage Storage type to use\n * @param key Unique key for the store\n * @returns An array store instance\n */\nexport function createContext<T>(\n\tinitialData: T[],\n\tstorage: StorageType,\n\tkey: string,\n): IArrayStore<T> & SchmancyArrayStore<T>\n\n/**\n * Implementation of the createContext function with complete type checking\n * and robust error handling\n */\nexport function createContext<T extends Record<string, any> | Map<string, any> | any[]>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n):\n\t| (IStore<T> & SchmancyStoreObject<T>)\n\t| (ICollectionStore<any> & SchmancyCollectionStore<any>)\n\t| (IArrayStore<any> & SchmancyArrayStore<any>) {\n\ttry {\n\t\t// Validate input\n\t\tif (initialData === null || initialData === undefined) {\n\t\t\tconsole.error('Initial data cannot be null or undefined')\n\t\t\t// Provide a sensible default based on type expected\n\t\t\tif (key.includes('collection') || key.includes('map')) {\n\t\t\t\tinitialData = new Map() as unknown as T\n\t\t\t} else if (key.includes('array') || key.includes('list')) {\n\t\t\t\tinitialData = [] as unknown as T\n\t\t\t} else {\n\t\t\t\tinitialData = {} as T\n\t\t\t}\n\t\t}\n\n\t\t// Determine store type based on input data with improved type checking\n\t\tif (isMap<string, any>(initialData)) {\n\t\t\treturn createCollectionStore<any>(initialData, storage, key)\n\t\t} else if (isArray<any>(initialData)) {\n\t\t\treturn createArrayStore<any>(initialData, storage, key)\n\t\t} else if (typeof initialData === 'object') {\n\t\t\treturn createObjectStore<any>(initialData as Record<string, any>, storage, key)\n\t\t} else {\n\t\t\t// Handle non-object data by wrapping it\n\t\t\tconsole.warn(`Initial data must be an object, array, or Map. Got ${typeof initialData}. Creating object wrapper.`)\n\t\t\treturn createObjectStore<any>({ value: initialData } as Record<string, any>, storage, key)\n\t\t}\n\t} catch (error) {\n\t\t// Last-resort error handling\n\t\tconsole.error(`Fatal error creating context for ${key}:`, error)\n\n\t\t// Create an emergency fallback store that won't throw\n\t\treturn createObjectStore<any>(\n\t\t\ttypeof initialData === 'object' && initialData !== null ? { ...initialData } : { value: initialData },\n\t\t\t'memory',\n\t\t\t`emergency-fallback-${key}`,\n\t\t)\n\t}\n}\n\n/**\n * Creates an array context with simplified API and type inference\n * @param initialData The initial array data\n * @param key Unique key for the store\n * @param storage Storage type to use (defaults to 'local')\n * @returns An array store instance\n */\nexport function createArrayContext<T>(\n\tinitialData: T[] = [],\n\tkey: string,\n\tstorage: StorageType = 'local',\n): IArrayStore<T> & SchmancyArrayStore<T> {\n\ttry {\n\t\treturn createContext<T>(initialData, storage, key)\n\t} catch (err) {\n\t\tconsole.error(`Failed to create array context for key: ${key}`, err)\n\t\t// Return a fallback store\n\t\treturn createArrayStore<T>(initialData, 'memory', `${key}-fallback`)\n\t}\n}\n\n/**\n * Creates a testable array context\n * @param initialData The initial array data\n * @param key Unique key for the store\n * @returns An array store that uses memory storage\n */\nexport function createTestArrayContext<T>(\n\tinitialData: T[] = [],\n\tkey: string = 'test-array',\n): IArrayStore<T> & SchmancyArrayStore<T> {\n\ttry {\n\t\treturn createContext<T>(initialData, 'memory', key)\n\t} catch (err) {\n\t\tconsole.error(`Failed to create test array context for key: ${key}`, err)\n\t\t// Return a fallback store with a different key\n\t\treturn createArrayStore<T>(initialData, 'memory', `${key}-emergency-fallback`)\n\t}\n}\n","// src/store/filter-directive.ts\n\n/** Supported comparison operators with TypeScript literal types */\nexport type ComparisonOperator =\n\t| '=='\n\t| '!='\n\t| '>'\n\t| '<'\n\t| '>='\n\t| '<='\n\t| 'includes'\n\t| 'notIncludes'\n\t| 'startsWith'\n\t| 'endsWith'\n\t| 'in'\n\t| 'notIn'\n\t| 'any' // fuzzy search operator\n\n/**\n * Type-safe condition tuple\n */\nexport type ConditionTuple = [field: string, op: ComparisonOperator, expected: unknown, strict?: boolean]\n\n/**\n * Type-safe condition object\n */\nexport interface ConditionObject {\n\tkey: string | string[] // Array of keys applies OR logic across fields\n\toperator: ComparisonOperator\n\tvalue: unknown\n\tstrict?: boolean\n}\n\n/**\n * Unified query condition type\n */\nexport type QueryCondition = ConditionTuple | ConditionObject\n\n/**\n * Filter result with item and score\n */\nexport interface ScoredItem<T> {\n\titem: T\n\tscore: number\n}\n\n/**\n * Get a nested value from an object using a dot-separated path.\n * Checks explicitly for null/undefined so falsy values like 0 or false are preserved.\n */\nexport const getFieldValue = <T = any>(item: Record<string, any>, path: string): T => {\n\tif (!path) return item as unknown as T\n\n\tconst parts = path.split('.')\n\tlet value: any = item\n\n\tfor (const part of parts) {\n\t\tif (value == null) return undefined as unknown as T\n\t\tvalue = value[part]\n\t}\n\n\treturn value as T\n}\n\n/**\n * Compute the Levenshtein distance between two strings.\n */\nconst levenshtein = (a: string, b: string): number => {\n\tif (a === b) return 0\n\n\tconst matrix: number[][] = Array(b.length + 1)\n\t\t.fill(null)\n\t\t.map((_, i) => [i])\n\n\t// initialize the first row\n\tfor (let j = 0; j <= a.length; j++) {\n\t\tmatrix[0][j] = j\n\t}\n\n\tfor (let i = 1; i <= b.length; i++) {\n\t\tfor (let j = 1; j <= a.length; j++) {\n\t\t\tif (b.charAt(i - 1) === a.charAt(j - 1)) {\n\t\t\t\tmatrix[i][j] = matrix[i - 1][j - 1]\n\t\t\t} else {\n\t\t\t\tmatrix[i][j] = Math.min(\n\t\t\t\t\tmatrix[i - 1][j] + 1, // deletion\n\t\t\t\t\tmatrix[i][j - 1] + 1, // insertion\n\t\t\t\t\tmatrix[i - 1][j - 1] + 1, // substitution\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\treturn matrix[b.length][a.length]\n}\n\n/**\n * Check if string `sub` is a subsequence of string `str`.\n * All characters in `sub` must appear in order in `str` (they need not be contiguous).\n */\nconst isSubsequence = (sub: string, str: string): boolean => {\n\tif (!sub) return true\n\tif (!str) return false\n\n\tlet i = 0,\n\t\tj = 0\n\twhile (i < sub.length && j < str.length) {\n\t\tif (sub[i].toLowerCase() === str[j].toLowerCase()) i++\n\t\tj++\n\t}\n\treturn i === sub.length\n}\n\n/**\n * Check if every character (with frequency) in the query exists in the target.\n * For example, \"aovc\" matches \"avocados\".\n */\nconst anagramMatch = (query: string, target: string): boolean => {\n\tif (!query) return true\n\tif (!target) return false\n\n\tconst countChars = (s: string): Record<string, number> =>\n\t\ts\n\t\t\t.toLowerCase()\n\t\t\t.split('')\n\t\t\t.reduce(\n\t\t\t\t(acc, char) => {\n\t\t\t\t\tacc[char] = (acc[char] || 0) + 1\n\t\t\t\t\treturn acc\n\t\t\t\t},\n\t\t\t\t{} as Record<string, number>,\n\t\t\t)\n\n\tconst queryCount = countChars(query)\n\tconst targetCount = countChars(target)\n\treturn Object.keys(queryCount).every(char => (targetCount[char] || 0) >= queryCount[char])\n}\n\n/**\n * Generate bigrams for a string.\n */\nconst getBigrams = (s: string): string[] => {\n\tif (!s || s.length < 2) return []\n\n\tconst bigrams: string[] = []\n\tfor (let i = 0; i < s.length - 1; i++) {\n\t\tbigrams.push(s.substring(i, i + 2).toLowerCase())\n\t}\n\treturn bigrams\n}\n\n/**\n * Compute Dice's coefficient for two strings based on bigrams.\n * Returns a value between 0 (no similarity) and 1 (perfect match).\n */\nconst diceCoefficient = (s1: string, s2: string): number => {\n\tif (!s1 || !s2 || s1.length < 2 || s2.length < 2) return 0\n\n\tconst bigrams1 = getBigrams(s1)\n\tconst bigrams2 = getBigrams(s2)\n\n\tif (bigrams1.length === 0 || bigrams2.length === 0) return 0\n\n\tlet intersection = 0\n\tconst used = new Array(bigrams2.length).fill(false)\n\n\tfor (const bigram of bigrams1) {\n\t\tfor (let i = 0; i < bigrams2.length; i++) {\n\t\t\tif (!used[i] && bigrams2[i] === bigram) {\n\t\t\t\tintersection++\n\t\t\t\tused[i] = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn (2 * intersection) / (bigrams1.length + bigrams2.length)\n}\n\n/**\n * Compute a fuzzy similarity score between two strings.\n * The score is computed by taking the maximum of several methods:\n * - Direct substring match (score 1)\n * - Subsequence check (score 0.8)\n * - Anagram subset match (score 0.7)\n * - Dice coefficient\n * - Normalized Levenshtein similarity\n */\nconst computeFuzzyScore = (actual: string, expected: string): number => {\n\tif (!actual || !expected) return 0\n\n\tconst a = actual.toLowerCase().trim()\n\tconst b = expected.toLowerCase().trim()\n\n\tif (a === b) return 1\n\n\tconst substringScore = a.includes(b) ? 1 : 0\n\tconst subsequenceScore = isSubsequence(b, a) ? 0.8 : 0\n\tconst anagramScore = anagramMatch(b, a) ? 0.7 : 0\n\tconst diceScore = diceCoefficient(a, b)\n\n\tconst maxLen = Math.max(a.length, b.length)\n\tconst levenshteinScore = maxLen ? 1 - levenshtein(a, b) / maxLen : 0\n\n\treturn Math.max(substringScore, subsequenceScore, anagramScore, diceScore, levenshteinScore)\n}\n\n/**\n * Safely coerce value to string if possible, or return empty string\n */\nconst safeString = (value: unknown): string => {\n\tif (value == null) return ''\n\treturn String(value)\n}\n\n/**\n * Apply a query condition to an item and return score\n */\nfunction applyQueryCondition<T extends Record<string, any>>(\n\titem: T,\n\tquery: QueryCondition,\n\tfuzzyThreshold: number = 0.3,\n): { valid: boolean; score: number } {\n\tlet field: string,\n\t\top: ComparisonOperator,\n\t\texpected: unknown,\n\t\tstrict = false\n\n\tif (Array.isArray(query)) {\n\t\t;[field, op, expected, strict = false] = query\n\t} else {\n\t\t// Handle array of keys (OR logic)\n\t\tif (Array.isArray(query.key)) {\n\t\t\tconst results = query.key.map(k =>\n\t\t\t\tapplyQueryCondition(item, { ...query, key: k }, fuzzyThreshold)\n\t\t\t)\n\t\t\t// Return best valid result, or invalid if none valid\n\t\t\treturn results.reduce(\n\t\t\t\t(best, curr) => (curr.valid ? (curr.score > best.score ? curr : best) : best),\n\t\t\t\t{ valid: false, score: 0 }\n\t\t\t)\n\t\t}\n\n\t\tfield = query.key\n\t\top = query.operator\n\t\texpected = query.value\n\t\tstrict = query.strict || false\n\t}\n\n\t// Skip empty filters for non-strict queries\n\tif (!strict && (expected === '' || expected == null || (isArray(expected) && expected.length === 0))) {\n\t\treturn { valid: true, score: 1 }\n\t}\n\n\tconst actual = getFieldValue(item, field)\n\n\t// FIXED: Properly handle strict mode\n\tif (strict) {\n\t\t// For strict mode, use exact equality comparison for all operators except 'any'\n\t\tif (op === 'any') {\n\t\t\t// Fuzzy search still applies with strict mode\n\t\t\tif (typeof actual !== 'string' || typeof expected !== 'string') {\n\t\t\t\treturn { valid: false, score: 0 }\n\t\t\t}\n\n\t\t\tconst score = computeFuzzyScore(actual, expected)\n\t\t\treturn {\n\t\t\t\tvalid: score >= fuzzyThreshold,\n\t\t\t\tscore: score >= fuzzyThreshold ? score : 0,\n\t\t\t}\n\t\t} else {\n\t\t\t// For all other operators in strict mode,\n\t\t\t// delegate to compareValues function but return precise scores\n\t\t\tconst matches = compareValues(op, actual, expected)\n\t\t\treturn {\n\t\t\t\tvalid: matches,\n\t\t\t\tscore: matches ? 1 : 0,\n\t\t\t}\n\t\t}\n\t} else if (op === 'any') {\n\t\t// Fuzzy search requires both values to be strings\n\t\tif (typeof actual !== 'string' || typeof expected !== 'string') {\n\t\t\treturn { valid: false, score: 0 }\n\t\t}\n\n\t\tconst score = computeFuzzyScore(actual, expected)\n\t\tif (score < fuzzyThreshold) {\n\t\t\treturn { valid: false, score: 0 }\n\t\t}\n\n\t\treturn { valid: true, score }\n\t} else {\n\t\t// For non-fuzzy operators, check condition\n\t\tconst matches = compareValues(op, actual, expected)\n\t\treturn {\n\t\t\tvalid: matches,\n\t\t\tscore: matches ? 1 : 0,\n\t\t}\n\t}\n}\n\n/**\n * Filter a Map of items given an array of query conditions.\n * For each query condition:\n * - If the expected value is empty/null/undefined, it is treated as a match.\n * - For non-fuzzy operators, the condition must strictly match.\n * - For the \"any\" operator, a fuzzy similarity score is computed.\n * Items with a fuzzy score below a given threshold (e.g., 0.3) are excluded.\n *\n * The overall item score is the average of the scores from all conditions.\n * The results are sorted in descending order of relevance.\n *\n * @param items - A Map containing items to filter.\n * @param queries - An array of query conditions to apply.\n * @param fuzzyThreshold - Minimum score required for fuzzy matches (default: 0.3)\n * @returns An array of items that match all query conditions, sorted by relevance.\n */\nexport function filterMapItems<T extends Record<string, any>>(\n\titems: Map<string, T>,\n\tqueries: QueryCondition[] = [],\n\tfuzzyThreshold: number = 0.3,\n): T[] {\n\t// If no queries, return all items unsorted\n\tif (!queries.length) {\n\t\treturn Array.from(items.values())\n\t}\n\n\t// Score and filter each item\n\tconst scoredItems: ScoredItem<T>[] = []\n\n\tfor (const [_, item] of items.entries()) {\n\t\tlet totalScore = 0\n\t\tlet matchCount = 0\n\t\tlet valid = true\n\n\t\tfor (const query of queries) {\n\t\t\tconst result = applyQueryCondition(item, query, fuzzyThreshold)\n\n\t\t\tif (!result.valid) {\n\t\t\t\tvalid = false\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\ttotalScore += result.score\n\t\t\tmatchCount++\n\t\t}\n\n\t\tif (valid) {\n\t\t\tscoredItems.push({\n\t\t\t\titem,\n\t\t\t\tscore: matchCount > 0 ? totalScore / matchCount : 1,\n\t\t\t})\n\t\t}\n\t}\n\n\t// Sort by descending score\n\tscoredItems.sort((a, b) => b.score - a.score)\n\n\treturn scoredItems.map(x => x.item)\n}\n\n/**\n * Filter an array of items using query conditions\n */\nexport function filterArrayItems<T extends Record<string, any>>(\n\titems: T[],\n\tqueries: QueryCondition[] = [],\n\tfuzzyThreshold: number = 0.3,\n): T[] {\n\t// Create temporary map with numeric indices as keys\n\tconst map = new Map<string, T>()\n\titems.forEach((item, index) => map.set(String(index), item))\n\n\treturn filterMapItems(map, queries, fuzzyThreshold)\n}\n\n// Improved type guards for filter-directive.ts\n\n/**\n * Type guard for checking if a value is an array with better type inference\n * @param value Value to check\n * @returns True if the value is an array\n */\nexport function isArray<T = unknown>(value: unknown): value is Array<T> {\n\treturn Array.isArray(value)\n}\n\n/**\n * Type guard for checking if a value is a string\n * @param value Value to check\n * @returns True if the value is a string\n */\nexport function isString(value: unknown): value is string {\n\treturn typeof value === 'string'\n}\n\n/**\n * Type guard for checking if a value is a number\n * @param value Value to check\n * @returns True if the value is a number and not NaN\n */\nexport function isNumber(value: unknown): value is number {\n\treturn typeof value === 'number' && !isNaN(value)\n}\n\n/**\n * Type guard for checking if a value is a date\n * @param value Value to check\n * @returns True if the value is a valid Date object\n */\nexport function isDate(value: unknown): value is Date {\n\treturn value instanceof Date && !isNaN(value.getTime())\n}\n\n/**\n * Type guard for checking if a value is an iterable collection\n * @param value Value to check\n * @returns True if the value implements the iterable protocol\n */\nexport function isIterable<T = unknown>(value: unknown): value is Iterable<T> {\n\t// Must be non-null and of type 'object'\n\tif (value == null || typeof value !== 'object') {\n\t\treturn false\n\t}\n\n\t// Check for Symbol.iterator method\n\treturn Symbol.iterator in Object(value) && typeof (value as any)[Symbol.iterator] === 'function'\n}\n\n/**\n * Type guard for checking if a value is a Map\n * @param value Value to check\n * @returns True if the value is a Map\n */\nexport function isMap<K = unknown, V = unknown>(value: unknown): value is Map<K, V> {\n\treturn value instanceof Map\n}\n\n/**\n * Type guard for checking if a value is a Set\n * @param value Value to check\n * @returns True if the value is a Set\n */\nexport function isSet<T = unknown>(value: unknown): value is Set<T> {\n\treturn value instanceof Set\n}\n\n/**\n * Type guard for checking if a value is a plain object (not an array, Map, etc.)\n * @param value Value to check\n * @returns True if the value is a plain object\n */\nexport function isPlainObject(value: unknown): value is Record<string, unknown> {\n\tif (value === null || typeof value !== 'object') {\n\t\treturn false\n\t}\n\n\tconst proto = Object.getPrototypeOf(value)\n\treturn proto === Object.prototype || proto === null\n}\n\n/**\n * Type guard for checking if a value is undefined or null\n * @param value Value to check\n * @returns True if the value is undefined or null\n */\nexport function isNil(value: unknown): value is undefined | null {\n\treturn value === undefined || value === null\n}\n\n/**\n * Improved type-safe comparison function that uses appropriate type guards\n * @param op Comparison operator\n * @param actual Actual value\n * @param expected Expected value\n * @returns Result of the comparison\n */\nexport function compareValues(op: ComparisonOperator, actual: unknown, expected: unknown): boolean {\n\t// Handle null/undefined cases\n\tif (isNil(actual) && isNil(expected)) return true\n\tif (isNil(actual) || isNil(expected)) {\n\t\t// For equality operators, null == null but null != non-null\n\t\tif (op === '==') return actual === expected\n\t\tif (op === '!=') return actual !== expected\n\t\t// Other operators should return false for null/undefined values\n\t\treturn false\n\t}\n\n\tswitch (op) {\n\t\tcase '==':\n\t\t\treturn actual === expected\n\t\tcase '!=':\n\t\t\treturn actual !== expected\n\t\tcase '>':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual > expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() > expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) > 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase '<':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual < expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() < expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) < 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase '>=':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual >= expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() >= expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) >= 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase '<=':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual <= expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() <= expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) <= 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase 'includes': {\n\t\t\tif (isString(actual)) {\n\t\t\t\treturn actual.toLowerCase().includes(safeString(expected).toLowerCase())\n\t\t\t}\n\t\t\tif (isArray(actual)) {\n\t\t\t\treturn actual.includes(expected as any)\n\t\t\t}\n\t\t\tif (isSet(actual)) {\n\t\t\t\treturn actual.has(expected as any)\n\t\t\t}\n\t\t\tif (isMap(actual)) {\n\t\t\t\treturn Array.from(actual.values()).includes(expected as any)\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'notIncludes': {\n\t\t\tif (isString(actual)) {\n\t\t\t\treturn !actual.toLowerCase().includes(safeString(expected).toLowerCase())\n\t\t\t}\n\t\t\tif (isArray(actual)) {\n\t\t\t\treturn !actual.includes(expected as any)\n\t\t\t}\n\t\t\tif (isSet(actual)) {\n\t\t\t\treturn !actual.has(expected as any)\n\t\t\t}\n\t\t\tif (isMap(actual)) {\n\t\t\t\treturn !Array.from(actual.values()).includes(expected as any)\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\tcase 'startsWith': {\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.toLowerCase().startsWith(expected.toLowerCase())\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'endsWith': {\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.toLowerCase().endsWith(expected.toLowerCase())\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'in': {\n\t\t\tif (isArray(expected)) {\n\t\t\t\treturn expected.includes(actual as any)\n\t\t\t}\n\t\t\tif (isSet(expected)) {\n\t\t\t\treturn expected.has(actual as any)\n\t\t\t}\n\t\t\tif (isMap(expected)) {\n\t\t\t\treturn expected.has(actual as any) || Array.from(expected.values()).includes(actual as any)\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'notIn': {\n\t\t\tif (isArray(expected)) {\n\t\t\t\treturn !expected.includes(actual as any)\n\t\t\t}\n\t\t\tif (isSet(expected)) {\n\t\t\t\treturn !expected.has(actual as any)\n\t\t\t}\n\t\t\tif (isMap(expected)) {\n\t\t\t\treturn !expected.has(actual as any) && !Array.from(expected.values()).includes(actual as any)\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\tdefault: {\n\t\t\tconsole.warn(`Operator \"${op}\" is not supported in comparison.`)\n\t\t\treturn false\n\t\t}\n\t}\n}\n\n// Export a simpler alias for filterMapItems\nexport const filterMap = filterMapItems\n\n// Export an alias for filterArrayItems\nexport const filterArray = filterArrayItems\n","// src/store/selectors.ts\nimport { BehaviorSubject, Observable, combineLatest, distinctUntilChanged, map, share, shareReplay } from 'rxjs'\nimport { ICollectionStore, IStore, StoreError } from './types'\n\n/**\n * Deep equality comparison for maps and complex objects\n * More efficient than JSON.stringify for large objects\n */\nfunction deepEqual(a: unknown, b: unknown): boolean {\n\tif (a === b) return true\n\n\tif (a instanceof Map && b instanceof Map) {\n\t\tif (a.size !== b.size) return false\n\t\tfor (const [key, value] of a) {\n\t\t\tif (!b.has(key) || !deepEqual(value, b.get(key))) return false\n\t\t}\n\t\treturn true\n\t}\n\n\tif (a instanceof Set && b instanceof Set) {\n\t\tif (a.size !== b.size) return false\n\t\tfor (const item of a) {\n\t\t\tif (!b.has(item)) return false\n\t\t}\n\t\treturn true\n\t}\n\n\tif (typeof a === 'object' && a !== null && typeof b === 'object' && b !== null) {\n\t\tconst keysA = Object.keys(a)\n\t\tconst keysB = Object.keys(b)\n\n\t\tif (keysA.length !== keysB.length) return false\n\n\t\tfor (const key of keysA) {\n\t\t\t// @ts-ignore: Index signature\n\t\t\tif (!deepEqual(a[key], b[key])) return false\n\t\t}\n\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Creates a selector that derives a value from store state\n *\n * @param store The store to observe\n * @param selectorFn Function that transforms the state\n * @returns An observable of the selected state that only emits when the derived value changes\n */\nexport function createSelector<T, R>(store: IStore<T>, selectorFn: (state: T) => R): Observable<R> {\n\treturn store.$.pipe(map(selectorFn), distinctUntilChanged<R>(deepEqual), shareReplay(1))\n}\n\n/**\n * Creates a selector for collection stores that derives a value from the collection\n *\n * @param store The collection store to observe\n * @param selectorFn Function that transforms the collection\n * @returns An observable of the selected state that only emits when the derived value changes\n */\nexport function createCollectionSelector<T, R>(\n\tstore: ICollectionStore<T>,\n\tselectorFn: (state: Map<string, T>) => R,\n): Observable<R> {\n\treturn store.$.pipe(map(selectorFn), distinctUntilChanged<R>(deepEqual), shareReplay(1))\n}\n\n/**\n * Creates a selector that returns all items from a collection as an array\n *\n * @param store The collection store\n * @returns An observable of all items as an array\n */\nexport function createItemsSelector<T>(store: ICollectionStore<T>): Observable<T[]> {\n\treturn createCollectionSelector(store, collection => Array.from(collection.values()))\n}\n\n/**\n * Creates a selector that retrieves a single item from a collection\n *\n * @param store The collection store\n * @param itemKey The key of the item to select\n * @returns An observable of the selected item that emits when the item changes\n */\nexport function createItemSelector<T>(store: ICollectionStore<T>, itemKey: string): Observable<T | undefined> {\n\treturn createCollectionSelector(store, collection => collection.get(itemKey))\n}\n\n/**\n * Creates a selector that returns all keys from a collection\n */\nexport function createKeysSelector<T>(store: ICollectionStore<T>): Observable<string[]> {\n\treturn createCollectionSelector(store, collection => Array.from(collection.keys()))\n}\n\n/**\n * Creates a selector that returns entries (key-value pairs) from a collection\n */\nexport function createEntriesSelector<T>(store: ICollectionStore<T>): Observable<[string, T][]> {\n\treturn createCollectionSelector(store, collection => Array.from(collection.entries()))\n}\n\n/**\n * Creates a selector that sorts collection items\n */\nexport function createSortSelector<T>(store: ICollectionStore<T>, compareFn: (a: T, b: T) => number): Observable<T[]> {\n\treturn createCollectionSelector(store, collection => {\n\t\treturn Array.from(collection.values()).sort(compareFn)\n\t})\n}\n\n/**\n * Creates a selector that finds the first item matching a predicate\n */\nexport function createFindSelector<T>(\n\tstore: ICollectionStore<T>,\n\tpredicate: (item: T, key: string) => boolean,\n): Observable<T | undefined> {\n\treturn createCollectionSelector(store, collection => {\n\t\tfor (const [key, item] of collection.entries()) {\n\t\t\tif (predicate(item, key)) {\n\t\t\t\treturn item\n\t\t\t}\n\t\t}\n\t\treturn undefined\n\t})\n}\n\n/**\n * Creates a selector that filters items from a collection - OPTIMIZED\n *\n * @param store The collection store\n * @param filterFn Function that returns true for items to include\n * @returns An observable of filtered items as an array\n */\nexport function createFilterSelector<T>(\n\tstore: ICollectionStore<T>,\n\tfilterFn: (item: T, key: string) => boolean,\n): Observable<T[]> {\n\treturn createCollectionSelector(store, collection =>\n\t\tArray.from(collection.entries())\n\t\t\t.filter(([key, item]) => filterFn(item, key))\n\t\t\t.map(([_, item]) => item),\n\t)\n}\n\n/**\n * Creates a selector that maps collection values through a transform function - OPTIMIZED\n */\nexport function createMapSelector<T, R>(\n\tstore: ICollectionStore<T>,\n\tmapFn: (item: T, key: string) => R,\n): Observable<R[]> {\n\treturn createCollectionSelector(store, collection =>\n\t\tArray.from(collection.entries()).map(([key, item]) => mapFn(item, key)),\n\t)\n}\n\n/**\n * Creates a selector that counts items in a collection, optionally filtered - OPTIMIZED\n *\n * @param store The collection store\n * @param filterFn Optional function to filter which items to count\n * @returns An observable of the count\n */\nexport function createCountSelector<T>(\n\tstore: ICollectionStore<T>,\n\tfilterFn?: (item: T, key: string) => boolean,\n): Observable<number> {\n\treturn createCollectionSelector(store, collection => {\n\t\tif (!filterFn) return collection.size\n\n\t\treturn Array.from(collection.entries()).filter(([key, item]) => filterFn(item, key)).length\n\t})\n}\n\n/**\n * Optimized RxJS Pipeline - use share with reset on refCount zero for better memory management\n * in scenarios where selector subscriptions come and go\n *\n * @param store The store to observe\n * @param selectorFn Function that transforms the state\n * @returns An observable of the selected state with improved memory management\n */\nexport function createOptimizedSelector<T, R>(store: IStore<T>, selectorFn: (state: T) => R): Observable<R> {\n\treturn store.$.pipe(\n\t\tmap(selectorFn),\n\t\tdistinctUntilChanged<R>(deepEqual),\n\t\tshare({\n\t\t\tresetOnRefCountZero: true,\n\t\t\tresetOnError: false,\n\t\t\tresetOnComplete: false,\n\t\t}),\n\t)\n}\n\n/**\n * Creates a compound selector from multiple stores\n *\n * This function combines data from multiple stores to create a derived\n * state that's compatible with the @select decorator.\n *\n * @param stores Array of stores to derive state from\n * @param selectorFns Selector functions for each store\n * @param combinerFn Function that combines the selected values\n * @returns A store-compatible object to use with @select\n */\nexport function createCompoundSelector<R>(\n\tstores: Array<IStore<any> | ICollectionStore<any>>,\n\tselectorFns: Array<(state: any) => any>,\n\tcombinerFn: (...values: any[]) => R,\n): IStore<R> {\n\t// Calculate initial value\n\tconst initialValues = stores.map((store, index) => selectorFns[index](store.value))\n\tconst initialValue = combinerFn(...initialValues)\n\n\t// Create a store with the initial value\n\tconst result: IStore<R> = {\n\t\t$: new BehaviorSubject<R>(initialValue),\n\t\terror$: new BehaviorSubject<StoreError | null>(null),\n\t\tready: true,\n\t\tdefaultValue: initialValue,\n\n\t\tget value(): R {\n\t\t\treturn this.$.getValue()\n\t\t},\n\n\t\t// These methods are no-ops for read-only stores\n\t\tset(_value: Partial<R>, _merge?: boolean): void {\n\t\t\tconsole.warn('Compound selector store is read-only')\n\t\t},\n\n\t\tclear(): void {\n\t\t\tthis.$.next(this.defaultValue)\n\t\t},\n\n\t\treplace(_newValue: R): void {\n\t\t\tconsole.warn('Compound selector store is read-only')\n\t\t},\n\n\t\tdelete<K extends keyof R>(_key: K): void {\n\t\t\tconsole.warn('Compound selector store is read-only')\n\t\t},\n\n\t\tdestroy(): void {\n\t\t\tthis.$.complete()\n\t\t\tthis.error$.complete()\n\t\t},\n\t}\n\n\t// Set up the reactivity by subscribing to all source stores\n\tconst observables = stores.map((store, _) => store.$)\n\n\t// Create a subscription that updates the result whenever any source changes\n\tconst subscription = combineLatest(observables).subscribe({\n\t\tnext: storeValues => {\n\t\t\ttry {\n\t\t\t\t// Apply selectors to each store value\n\t\t\t\tconst selectedValues = storeValues.map((value, index) => selectorFns[index](value))\n\n\t\t\t\t// Apply combiner function\n\t\t\t\tconst newValue = combinerFn(...selectedValues)\n\n\t\t\t\t// Update the BehaviorSubject\n\t\t\t\tresult.$.next(newValue)\n\t\t\t} catch (err) {\n\t\t\t\tconst error = new StoreError('Error in compound selector', err)\n\t\t\t\tresult.error$.next(error)\n\t\t\t\tconsole.error(error)\n\t\t\t}\n\t\t},\n\t\terror: err => {\n\t\t\tconst error = new StoreError('Error in store subscription', err)\n\t\t\tresult.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t},\n\t})\n\n\t// Ensure the subscription is cleaned up when the store is destroyed\n\tconst originalDestroy = result.destroy\n\tresult.destroy = function () {\n\t\tsubscription.unsubscribe()\n\t\toriginalDestroy.call(this)\n\t}\n\n\treturn result\n}\n","// src/store/selector-hook.ts - Improved memory management\nimport { property as litProperty } from 'lit/decorators.js'\nimport { Observable, Subject, Subscription } from 'rxjs'\nimport { takeUntil } from 'rxjs/operators'\nimport { createCollectionSelector, createSelector } from './selectors'\nimport { ICollectionStore, IStore } from './types'\n\n/**\n * Symbol used for storing cleanup resources\n * Using a Symbol prevents name collisions with component properties\n */\nconst CLEANUP_SUBJECT = Symbol('selectorCleanup')\nconst SUBSCRIPTIONS = Symbol('selectorSubscriptions')\nconst INITIALIZED = Symbol('selectorInitialized')\nconst CONNECTED_CALLED = Symbol('connectedCallbackCalled')\n\n/**\n * Component lifecycle interface\n */\ninterface ComponentWithLifecycle {\n\t// Lifecycle hooks\n\tisConnected: boolean\n\tdisconnectedCallback?: () => void\n\tconnectedCallback?: () => void\n\trequestUpdate?: () => void\n\n\t// Internal properties using symbols to avoid name collisions\n\t[CLEANUP_SUBJECT]?: Subject<void>\n\t[SUBSCRIPTIONS]?: Map<string, Subscription>\n\t[INITIALIZED]?: Set<string>\n\t[CONNECTED_CALLED]?: boolean\n\n\t// Value storage\n\t[key: string]: any\n}\n\n/**\n * Property descriptor interface\n */\ntype PropertyDescriptor<T> = {\n\tget?: () => T\n\tset?: (value: T) => void\n\tvalue?: T\n\tconfigurable?: boolean\n\tenumerable?: boolean\n\twritable?: boolean\n}\n\n/**\n * Options for selecting from a store\n */\ninterface SelectOptions {\n\t/** If true, will wait for selector to emit a value (including null) before calling connectedCallback. Only undefined is considered \"not ready\". Default is true. */\n\trequired?: boolean\n\n\t/** If true, will only update the component and not set the property value */\n\tupdateOnly?: boolean\n\n\t/** If true, will use structuredClone to deeply clone values (prevents mutations) */\n\tdeepClone?: boolean\n\n\t/** Custom equality function to determine when to update */\n\tequals?: (a: any, b: any) => boolean\n\n\t/** Debug mode - logs selector activity */\n\tdebug?: boolean\n}\n\n/**\n * Type guard to check if a store is a collection store\n */\nfunction isCollectionStore<T>(store: IStore<any> | ICollectionStore<T>): store is ICollectionStore<T> {\n\treturn 'set' in store && typeof store.set === 'function' && store.value instanceof Map\n}\n\n/**\n * Ensures the cleanup resources exist on the component\n */\nfunction ensureCleanupResources(component: ComponentWithLifecycle): void {\n\tif (!component[CLEANUP_SUBJECT] || component[CLEANUP_SUBJECT].closed) {\n\t\tcomponent[CLEANUP_SUBJECT] = new Subject<void>()\n\t}\n\n\tif (!component[SUBSCRIPTIONS]) {\n\t\tcomponent[SUBSCRIPTIONS] = new Map()\n\t}\n\n\tif (!component[INITIALIZED]) {\n\t\tcomponent[INITIALIZED] = new Set()\n\t}\n}\n\n/**\n * Cleans up all selector resources\n */\nfunction cleanupSelectorResources(component: ComponentWithLifecycle): void {\n\tif (component[CLEANUP_SUBJECT]) {\n\t\tcomponent[CLEANUP_SUBJECT].next()\n\t\tcomponent[CLEANUP_SUBJECT].complete()\n\t\tcomponent[CLEANUP_SUBJECT] = undefined\n\t}\n\n\tif (component[SUBSCRIPTIONS]) {\n\t\tcomponent[SUBSCRIPTIONS].forEach(sub => sub.unsubscribe())\n\t\tcomponent[SUBSCRIPTIONS].clear()\n\t\tcomponent[SUBSCRIPTIONS] = undefined\n\t}\n\n\tif (component[INITIALIZED]) {\n\t\tcomponent[INITIALIZED].clear()\n\t\tcomponent[INITIALIZED] = undefined\n\t}\n\n\t// Reset the connected flag when cleaning up\n\tcomponent[CONNECTED_CALLED] = undefined\n}\n\n/**\n * Selector decorator that connects a component property to a store selector\n * with improved memory management\n *\n * @param store The store to select from\n * @param selectorFn Optional function to transform the store state\n * @param options Additional options for the selector\n */\nexport function select<T, R>(\n\tstore: IStore<T> | ICollectionStore<T>,\n\tselectorFn: (state: any) => R = (state: R) => state,\n\toptions: SelectOptions = { required: true },\n) {\n\treturn function (proto: Record<string, any>, propName: string, _descriptor?: PropertyDescriptor<R>) {\n\t\t// Register as a Lit property\n\t\tlitProperty({ attribute: false, type: Object })(proto, propName)\n\n\t\t// Store original lifecycle methods\n\t\tconst originalConnectedCallback = proto.connectedCallback\n\t\tconst originalDisconnectedCallback = proto.disconnectedCallback\n\n\t\t// Override connectedCallback to set up subscription\n\t\tproto.connectedCallback = function (this: ComponentWithLifecycle) {\n\t\t\t// Initialize cleanup resources\n\t\t\tensureCleanupResources(this)\n\n\t\t\t// Create the appropriate selector\n\t\t\tconst selector: Observable<R> = isCollectionStore(store)\n\t\t\t\t? createCollectionSelector(store, selectorFn)\n\t\t\t\t: createSelector(store as IStore<T>, selectorFn)\n\n\t\t\t// Call original connectedCallback immediately if not waiting for data\n\t\t\tif (!options.required && !this[CONNECTED_CALLED]) {\n\t\t\t\toriginalConnectedCallback?.call(this)\n\t\t\t\tthis[CONNECTED_CALLED] = true\n\t\t\t}\n\n\t\t\t// Clean up any existing subscription\n\t\t\tif (this[SUBSCRIPTIONS]!.has(propName)) {\n\t\t\t\tthis[SUBSCRIPTIONS]!.get(propName)?.unsubscribe()\n\t\t\t\tthis[SUBSCRIPTIONS]!.delete(propName)\n\t\t\t}\n\n\t\t\t// Debug log if needed\n\t\t\tif (options.debug) {\n\t\t\t\tconsole.debug(`[select] Setting up subscription for ${propName}`)\n\t\t\t}\n\n\t\t\t// Create new subscription with better error handling\n\t\t\tconst subscription = selector.pipe(takeUntil(this[CLEANUP_SUBJECT]!)).subscribe({\n\t\t\t\tnext: (value: R) => {\n\t\t\t\t\t// Handle value updates\n\t\t\t\t\tconst newValue = options.deepClone ? structuredClone(value) : value\n\n\t\t\t\t\tif (options.debug) {\n\t\t\t\t\t\tconsole.debug(`[select] New value for ${propName}:`, newValue)\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!options.updateOnly) {\n\t\t\t\t\t\tthis[propName] = newValue\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.requestUpdate?.()\n\n\t\t\t\t\t// If required and not initialized, call connectedCallback when we get a value\n\t\t\t\t\t// Allow null values but not undefined (undefined means the selector hasn't emitted yet)\n\t\t\t\t\tif (options.required && !this[INITIALIZED]!.has(propName) && newValue !== undefined) {\n\t\t\t\t\t\tthis[INITIALIZED]!.add(propName)\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Only call original connectedCallback once, regardless of how many selectors\n\t\t\t\t\t\tif (!this[CONNECTED_CALLED]) {\n\t\t\t\t\t\t\tif (options.debug) {\n\t\t\t\t\t\t\t\tconsole.debug(`[select] Calling delayed connectedCallback for ${propName}`)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\toriginalConnectedCallback?.call(this)\n\t\t\t\t\t\t\tthis[CONNECTED_CALLED] = true\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\terror: (err: Error) => {\n\t\t\t\t\tconsole.error(`Error in selector subscription for ${propName}:`, err)\n\t\t\t\t\t// Resubscribe on error to prevent component from becoming unresponsive\n\t\t\t\t\tif (this.isConnected) {\n\t\t\t\t\t\t// Small delay to prevent immediate resubscription\n\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\tif (this.isConnected) {\n\t\t\t\t\t\t\t\tif (options.debug) {\n\t\t\t\t\t\t\t\t\tconsole.debug(`[select] Resubscribing after error for ${propName}`)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tthis.connectedCallback?.()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 1000)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t})\n\n\t\t\t// Store the subscription for cleanup\n\t\t\tthis[SUBSCRIPTIONS]!.set(propName, subscription)\n\t\t}\n\n\t\t// Override disconnectedCallback to clean up subscriptions\n\t\tproto.disconnectedCallback = function (this: ComponentWithLifecycle) {\n\t\t\t// Call original disconnectedCallback\n\t\t\toriginalDisconnectedCallback?.call(this)\n\n\t\t\t// Debug log if needed\n\t\t\tif (options.debug) {\n\t\t\t\tconsole.debug(`[select] Cleaning up resources in disconnectedCallback`)\n\t\t\t}\n\n\t\t\t// Clean up all subscription resources\n\t\t\tcleanupSelectorResources(this)\n\t\t}\n\t}\n}\n\n/**\n * Creates a selector decorator that selects a specific item from a collection store\n * with improved memory management\n *\n * @param store The collection store\n * @param keyGetter Function that returns the key to select\n * @param options Additional options\n */\nexport function selectItem<T>(\n\tstore: ICollectionStore<T>,\n\tkeyGetter: (component: any) => string,\n\toptions: SelectOptions = { required: true },\n) {\n\treturn function (proto: Record<string, any>, propName: string, _descriptor?: PropertyDescriptor<T | undefined>) {\n\t\tselect(\n\t\t\tstore,\n\t\t\tfunction (state) {\n\t\t\t\t// This will be evaluated during subscription, when 'this' is available\n\t\t\t\tconst itemKey = keyGetter(this)\n\t\t\t\treturn itemKey ? state.get(itemKey) : undefined\n\t\t\t},\n\t\t\toptions,\n\t\t)(proto, propName)\n\t}\n}\n"],"x_google_ignoreList":[0],"mappings":";;;AACA,IAAI,KAAU,OAAO,IAAI,gBAAA,EACrB,IAAY,OAAO,IAAI,kBAAA,EACvB,IAAc,OAAO,IAAI,cAAA,EAGzB,KAAA,QAAA,IAAA,aAAkC,eA8BlC,EAAA,GA9BiD;CAEnD,SAAS,GAAA;AACP,SAAO,mBAAmB,EAAA,kFAAyF,EAAA;;CAErH,SAAS,GAAA;AACP,SAAO,sJAAsJ,EAAA;;CAE/J;CACA,SAAS,GAAA;AACP,SAAO,yHAAyH;;CAElI;CACA;CACA;CACA;CACA;CACA;CACA,SAAS,GAAA;AACP,SAAO,mCAAmC;;CAE5C;CACA;CACA;CACA;CACA,SAAS,GAAA;AACP,SAAO,oCAAoC;;CAAA;AAK/C,SAAS,EAAI,GAAA,GAAU,GAAA;AACrB,KAAA,QAAA,IAAA,aAA6B,cAAc;EACzC,IAAM,IAAI,GAAO,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