nolo-cli 0.259.0-alpha.1 → 0.261.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/README.md +1 -1
  2. package/{_executeModel-MTM4BJK3.js → _executeModel-PODMRXJJ.js} +97 -83
  3. package/accountResolver-NGICIMEE.js +1 -1
  4. package/{action-C6IQAKN4.js → action-NJTYNXXR.js} +12 -10
  5. package/{addContentAction-53364YDW.js → addContentAction-RUPXLROG.js} +14 -13
  6. package/{addDialogAgentAction-U5DD5EN5.js → addDialogAgentAction-57EJ2UBC.js} +20 -24
  7. package/{agentDeleteCommand-53NN3VSK.js → agentDeleteCommand-DRFCOTYP.js} +185 -147
  8. package/{agentEmailCommands-KOGGIT6I.js → agentEmailCommands-FHENHUBF.js} +143 -127
  9. package/{agentGrantCommands-L6O2HVJI.js → agentGrantCommands-BMVKNYIY.js} +9 -6
  10. package/{agentListCommands-62UYUQDI.js → agentListCommands-W66W5K3V.js} +88 -69
  11. package/{agentMachineCommands-W6TNJXEA.js → agentMachineCommands-C3BUBCXU.js} +69 -60
  12. package/{agentProviderCommands-QLTABYR7.js → agentProviderCommands-VIWKP7DM.js} +11 -8
  13. package/{agentPullCommand-2EYJ5ENC.js → agentPullCommand-5SNSXOY7.js} +10 -7
  14. package/agentRecordCommands-DYMHWTID.js +210 -0
  15. package/agentRun-QVFG3CI4.js +250 -0
  16. package/agentRunCommand-YV4V5HSL.js +248 -0
  17. package/{agentRunControl-LXMADX3N.js → agentRunControl-RGBHKPKJ.js} +19 -12
  18. package/{agentRuntimeLocal-YGNJMQW3.js → agentRuntimeLocal-LVEMOYS2.js} +62 -49
  19. package/{agentSlice-3HHYUQLM.js → agentSlice-OJCM7OUX.js} +15 -18
  20. package/appConfigCommands-ZUXQLE7L.js +417 -0
  21. package/{appDeleteCommands-5COJ6CSG.js → appDeleteCommands-L5UKUMXY.js} +68 -58
  22. package/{appDeployCommands-3JPAT3XO.js → appDeployCommands-KX2BRQUW.js} +74 -59
  23. package/{appDeployStatusCommands-RHZKF3G4.js → appDeployStatusCommands-7LHRSWW7.js} +68 -58
  24. package/{appGetCommands-73DXOAQW.js → appGetCommands-F7SDFCUK.js} +74 -58
  25. package/{appListCommands-HD5LOQ3G.js → appListCommands-U4NJKSMZ.js} +74 -58
  26. package/appMigrateCommands-JAPOLYSW.js +230 -0
  27. package/appSourceCommands-TLXPWXUH.js +279 -0
  28. package/authCommand-AU3GZBZ2.js +65 -0
  29. package/{authCommands-T5FODCEG.js → authCommands-JKBWMUQ4.js} +20 -17
  30. package/{builtinSkillRegistry-EDHD2UHU.js → builtinSkillRegistry-6XUWMAV5.js} +8 -6
  31. package/{chromeOpsCommands-3SSTDFRF.js → chromeOpsCommands-F47WYQWF.js} +68 -18
  32. package/{chunk-5YS6QHGT.js → chunk-2FGFY72B.js} +9 -9
  33. package/{chunk-MJBLXJMP.js → chunk-2I4R6ZRV.js} +12 -9
  34. package/{chunk-FXEPZKNJ.js → chunk-2MIZHEND.js} +506 -64
  35. package/{chunk-TLE77UJ5.js → chunk-2OROOEOQ.js} +0 -1
  36. package/{chunk-6RSNVJGO.js → chunk-2ZBPWX7N.js} +4 -4
  37. package/chunk-35JIFLIG.js +30 -0
  38. package/{chunk-7OVOZRZF.js → chunk-3B7OTHDW.js} +23 -379
  39. package/{chunk-DNNPARJK.js → chunk-3QMN3T6L.js} +50 -37
  40. package/{chunk-DMPZMYH4.js → chunk-3R4AYHJR.js} +13 -1
  41. package/{chunk-XNNBXUEM.js → chunk-3TII7WCF.js} +5 -5
  42. package/{chunk-223KZUJ6.js → chunk-4HZCBA4Q.js} +18 -15
  43. package/{chunk-C5A54QS7.js → chunk-4INJGWE3.js} +18 -5
  44. package/chunk-4IVMDQBA.js +261 -0
  45. package/chunk-4Y6CZ2N4.js +82 -0
  46. package/{chunk-KZ4A7EIV.js → chunk-56OAS5RZ.js} +1 -1
  47. package/{chunk-KQHEGELM.js → chunk-63G7JWEA.js} +16 -6
  48. package/{chunk-4EACJPZI.js → chunk-6BBXJGIQ.js} +51 -42
  49. package/chunk-72VWN4VK.js +51 -0
  50. package/chunk-7LR2IFUH.js +100 -0
  51. package/{chunk-S73EPYNC.js → chunk-7LS5ATRP.js} +20 -6
  52. package/{chunk-XPETQ4MR.js → chunk-7X4BFUJV.js} +24 -10
  53. package/{chunk-KHYSFS3W.js → chunk-A454UXB6.js} +148 -73
  54. package/chunk-A4O76A6V.js +432 -0
  55. package/chunk-AMNZPQCY.js +635 -0
  56. package/{chunk-4MXYCQBS.js → chunk-AQNWWJLH.js} +2 -56
  57. package/{chunk-LHCGKAFO.js → chunk-BKP325XS.js} +184 -112
  58. package/{chunk-PENRYZ4D.js → chunk-BPB3T5EU.js} +4 -7
  59. package/{chunk-U6QNVOR5.js → chunk-BUGLH2A7.js} +130 -6
  60. package/{chunk-2JHGUL5K.js → chunk-BVYHE6QD.js} +2 -2
  61. package/{chunk-KXOPLLFP.js → chunk-CA7LGAHV.js} +69 -9
  62. package/{chunk-2FZVXOFX.js → chunk-CEIWXKHP.js} +112 -200
  63. package/{chunk-Y2TCTNUD.js → chunk-CK2LMTYO.js} +4 -4
  64. package/{chunk-AIFQKNPP.js → chunk-CL33RFD7.js} +1 -1
  65. package/{chunk-57V4PADY.js → chunk-CNYPQYXT.js} +781 -449
  66. package/{chunk-P4R5KXU7.js → chunk-CW6LRDSF.js} +5 -5
  67. package/chunk-D3ONA3FP.js +762 -0
  68. package/{chunk-PIVTQRX6.js → chunk-DDKA6V6X.js} +111 -12
  69. package/chunk-DLXL4NSL.js +1179 -0
  70. package/{chunk-EJQE5HB7.js → chunk-DSBRIUX5.js} +4 -2
  71. package/{chunk-XRGBJHZX.js → chunk-E36V7MPY.js} +9 -5
  72. package/{chunk-4YPH5KRA.js → chunk-EDKMRDET.js} +1 -1
  73. package/{chunk-DBJODIZ6.js → chunk-EQOWWSNQ.js} +19 -27
  74. package/chunk-ER6NTALN.js +34 -0
  75. package/{chunk-L4XST72F.js → chunk-ERCSHBUD.js} +16027 -17392
  76. package/chunk-EUHMI5KG.js +101 -0
  77. package/{chunk-YQLAFJRQ.js → chunk-FBNVJ2TO.js} +1 -1
  78. package/{chunk-Q2EERN52.js → chunk-FF5ZRKW7.js} +12 -7
  79. package/{chunk-6XIE5ZGI.js → chunk-FGFJUFPS.js} +5 -6
  80. package/chunk-FI4DPLR7.js +902 -0
  81. package/{chunk-HDKMVYNJ.js → chunk-FNLT7NKG.js} +7 -11
  82. package/{chunk-JCQ3WCQ3.js → chunk-FOC4TORM.js} +69 -3
  83. package/chunk-FP46RAJQ.js +58 -0
  84. package/{chunk-JPXACKSW.js → chunk-G22P2J7O.js} +30 -81
  85. package/{chunk-7WHCIA5V.js → chunk-G5IAIGGD.js} +3 -8
  86. package/{chunk-FZENZCIA.js → chunk-GEC4CHS2.js} +19 -12
  87. package/chunk-GF4LYNNZ.js +25 -0
  88. package/{chunk-IYLUK67R.js → chunk-GH6SS2DZ.js} +25 -8
  89. package/chunk-HAZ6UVH4.js +368 -0
  90. package/{chunk-OKAXQFON.js → chunk-HB4J5HA6.js} +4 -4
  91. package/{chunk-324FWHUA.js → chunk-HHXF57CL.js} +12 -3
  92. package/chunk-HJTI7RZV.js +94 -0
  93. package/{chunk-HQUGB2HM.js → chunk-HMFKYZKP.js} +62 -50
  94. package/{chunk-Q2MPKE4B.js → chunk-HVRG27HI.js} +76 -26
  95. package/{chunk-46FETNLF.js → chunk-IN4B6Z2D.js} +7 -6
  96. package/chunk-IV6VUVLJ.js +88 -0
  97. package/{chunk-LLUBUHNT.js → chunk-IWWJSSST.js} +5 -9
  98. package/{chunk-7BIJFGKS.js → chunk-J22PFCQN.js} +106 -52
  99. package/chunk-J42X32PV.js +472 -0
  100. package/{chunk-LCBAMY2M.js → chunk-JKVOKKMQ.js} +0 -7
  101. package/{chunk-KT7S7ANZ.js → chunk-JPYOHIHX.js} +9 -9
  102. package/{chunk-R7XWZDOH.js → chunk-JUMQJSQF.js} +1423 -282
  103. package/{chunk-KVMLM5VD.js → chunk-KAHYBAEN.js} +211 -472
  104. package/{chunk-KLMBM6P6.js → chunk-KALCFXQO.js} +2454 -1115
  105. package/chunk-KDDXC2IH.js +148 -0
  106. package/chunk-KGKTN2NX.js +25 -0
  107. package/chunk-KGWE224L.js +246 -0
  108. package/{chunk-OYUMJMC5.js → chunk-KSV6T4AH.js} +6 -1
  109. package/{chunk-P27E22MA.js → chunk-L43DGEPZ.js} +1 -1
  110. package/{chunk-5BIDJVNX.js → chunk-L45P4JTE.js} +180 -31
  111. package/chunk-LHCIIUCX.js +222 -0
  112. package/{chunk-CBIGMWMI.js → chunk-LHJB4BXJ.js} +1 -1
  113. package/{chunk-TRRXYFTR.js → chunk-LOFRSJX2.js} +1 -0
  114. package/{chunk-SQL7YNED.js → chunk-LPXBBC32.js} +71 -5
  115. package/{chunk-BIDSIRTS.js → chunk-LTCZOOAM.js} +11 -17
  116. package/chunk-LUTSMSIL.js +425 -0
  117. package/chunk-LXP53WGF.js +168 -0
  118. package/{chunk-2CT2J3O6.js → chunk-M7VNNPVX.js} +2493 -4055
  119. package/chunk-MDAYRIP7.js +1889 -0
  120. package/{chunk-6B2OBX5B.js → chunk-MMXHIHJZ.js} +15 -47
  121. package/{chunk-HPDLPEUG.js → chunk-MPWQI36J.js} +267 -234
  122. package/chunk-MRACVEPZ.js +7 -0
  123. package/{chunk-ZYPXOQS2.js → chunk-MSFKHPA6.js} +1 -1
  124. package/chunk-NHLLXINQ.js +8 -0
  125. package/{chunk-QXTEEEIN.js → chunk-NJCTPWJU.js} +8 -8
  126. package/chunk-NLS7F5DW.js +1697 -0
  127. package/{chunk-FP37ELBT.js → chunk-NTBTVKKB.js} +17 -25
  128. package/{chunk-JLZJL3WC.js → chunk-O77F26YB.js} +370 -39
  129. package/{chunk-LVZVSLKO.js → chunk-O7ZY6SUK.js} +5 -22
  130. package/{chunk-YN23INFZ.js → chunk-OIOMBPCA.js} +23 -2
  131. package/{chunk-CJOOF4L5.js → chunk-OSZNERNW.js} +17 -14
  132. package/{chunk-JZO7KUF3.js → chunk-P4I55ASV.js} +313 -275
  133. package/{chunk-2C5VN7NH.js → chunk-P4XAHM4B.js} +1 -1
  134. package/chunk-PL5RKESU.js +40 -0
  135. package/chunk-Q5FJJ6XI.js +103 -0
  136. package/{chunk-WS36XPJD.js → chunk-Q5IXZF3S.js} +82 -6
  137. package/{createAgentAutomationAction-GRZ6XY7Q.js → chunk-QKM55LP2.js} +3 -160
  138. package/{chunk-WSLL7VV4.js → chunk-QXWXRBOL.js} +9 -9
  139. package/{chunk-MXA54TQM.js → chunk-QZYQ3Y3G.js} +1 -1
  140. package/{chunk-FE7G6DSP.js → chunk-R72QWIFO.js} +14 -4
  141. package/{chunk-5RGU3J7P.js → chunk-REAE2SZK.js} +0 -1
  142. package/chunk-RF576RYE.js +117 -0
  143. package/chunk-RI7SXDJW.js +1317 -0
  144. package/{chunk-FEIVARWR.js → chunk-RIOAPUGV.js} +238 -25
  145. package/{chunk-BZLGPM5B.js → chunk-RNLKWUVY.js} +7 -12
  146. package/{chunk-J7JRCOIW.js → chunk-RWXHGPWJ.js} +1 -1
  147. package/{chunk-J55F3IEZ.js → chunk-SARJZIGR.js} +1 -1
  148. package/chunk-SJFL32RD.js +356 -0
  149. package/{chunk-6SOWMEAY.js → chunk-SR57FDTX.js} +2 -258
  150. package/{chunk-MPGR4ZNR.js → chunk-SRVLHMES.js} +46 -42
  151. package/{chunk-CEKRIR22.js → chunk-SU4NCTW4.js} +1 -1
  152. package/{chunk-RD3QLZQV.js → chunk-SWJRX4M5.js} +324 -2
  153. package/{chunk-R3TUHCSJ.js → chunk-T3Y2NA4H.js} +8 -3
  154. package/{chunk-53W5BXLN.js → chunk-TCOHWKDM.js} +54 -55
  155. package/{chunk-KWNVPY6M.js → chunk-TJXO66M2.js} +8 -5
  156. package/{chunk-QIGQFON2.js → chunk-TXMFSGRY.js} +1 -1
  157. package/{chunk-ADYWV732.js → chunk-U5PSCTMR.js} +264 -177
  158. package/{chunk-UUCYUN6Y.js → chunk-UB7NV7NN.js} +1 -1
  159. package/{chunk-QGFLVQ6E.js → chunk-UBOTXA3Z.js} +4 -14
  160. package/{chunk-6YX2RAQN.js → chunk-UEZL3RBG.js} +89 -164
  161. package/{chunk-NCFKHYDM.js → chunk-UJL23HBL.js} +774 -119
  162. package/chunk-ULPU4C43.js +1710 -0
  163. package/{chunk-UA3QTA2S.js → chunk-VC3MAT33.js} +4442 -2570
  164. package/{chunk-VNHZJEQN.js → chunk-VCESLFF4.js} +3 -3
  165. package/chunk-VOO3YQQP.js +17157 -0
  166. package/{chunk-Y2GWUBNS.js → chunk-VZDSNDUD.js} +279 -149
  167. package/{chunk-6BMTKYAO.js → chunk-W2Z5E2R7.js} +126 -698
  168. package/{chunk-4ZCTKB27.js → chunk-W5GKF5ZW.js} +1 -0
  169. package/chunk-WEEB2JKA.js +443 -0
  170. package/{chunk-NUHQO3RB.js → chunk-WIVVNJUS.js} +1 -1
  171. package/chunk-WMBJDXMY.js +408 -0
  172. package/chunk-WSQLCWLQ.js +201 -0
  173. package/{chunk-OOVOAG4Q.js → chunk-WY6DMHMG.js} +1 -1
  174. package/{chunk-6K32PBRY.js → chunk-XJW6SLBZ.js} +3 -3
  175. package/{chunk-MNFUKRRU.js → chunk-XKNDVHF5.js} +7 -7
  176. package/{chunk-MHKPUGPD.js → chunk-XREMPMNK.js} +20 -4
  177. package/chunk-XT6C2QZW.js +46 -0
  178. package/chunk-XUDXQT7R.js +790 -0
  179. package/{chunk-ZEZC7IIM.js → chunk-YFSM2366.js} +35 -35
  180. package/{chunk-RIWKZT7E.js → chunk-YRPIUIEQ.js} +11 -9
  181. package/{chunk-U35UUM5K.js → chunk-YVOUSIIA.js} +1 -1
  182. package/{chunk-6VEO7Z3Y.js → chunk-Z27AH6A5.js} +6 -6
  183. package/chunk-Z3KTXWWB.js +76 -0
  184. package/{chunk-UWWOWTW2.js → chunk-Z7EP5HDL.js} +1 -1
  185. package/{chunk-YFEK7ACQ.js → chunk-ZB2E724W.js} +4 -4
  186. package/{chunk-YLAHYLDQ.js → chunk-ZC3CMUKU.js} +2 -89
  187. package/{chunk-5P3PPQVP.js → chunk-ZQAADXSF.js} +1 -1
  188. package/{cliAgentConfigHelpers-BXHQ3PXP.js → cliAgentConfigHelpers-BJJEXHSZ.js} +20 -14
  189. package/{cliAuthorityBrokerClient-TFNXJLXL.js → cliAuthorityBrokerClient-3SKOA7OZ.js} +3 -1
  190. package/cliAuthorityBrokerProcess-VIJEKQSX.js +34 -0
  191. package/{cliEnvHelpers-CNMP3RDX.js → cliEnvHelpers-NDMKN4X2.js} +6 -3
  192. package/{cliExecutor-K6FDZTQ2.js → cliExecutor-Z62UBJ5S.js} +12 -6
  193. package/cliLocalAgentRecordReader-KCZS2MZU.js +113 -0
  194. package/cloudAutomationCommands-2WQUGQSW.js +310 -0
  195. package/{commandRegistry-IFYQLPGM.js → commandRegistry-C64JBZJ3.js} +288 -121
  196. package/{contentThunks-QCFCD2X3.js → contentThunks-G3HEIRXC.js} +45 -43
  197. package/{cooldownCommands-WDOI5VD7.js → cooldownCommands-FPAFS7XG.js} +1 -1
  198. package/createAgentAutomationAction-DSBL3X3A.js +172 -0
  199. package/createDialogAction-OHFUHC53.js +86 -0
  200. package/{createPageAction-QCVBMP4C.js → createPageAction-E6JZSZLU.js} +49 -45
  201. package/{db-VR74ADGC.js → db-KTQ3LL2Q.js} +3 -3
  202. package/{dbSlice-RWPSVHBC.js → dbSlice-U3GPLEL3.js} +21 -16
  203. package/deleteDbKey-DRXKWJX5.js +86 -0
  204. package/{dialogCommands-4IEQUALS.js → dialogCommands-4EX2OTIC.js} +80 -66
  205. package/{dialogMessageRecord-OAV77LT7.js → dialogMessageRecord-2HJTEXQX.js} +1 -1
  206. package/dialogNotifyCommand-4SCE2Z2R.js +44 -0
  207. package/dialogPortabilityCommands-ZSFFHRX4.js +3036 -0
  208. package/{dialogSlice-XFYID6KE.js → dialogSlice-PRZCIJCH.js} +43 -42
  209. package/{dialogTraceCommand-Y67NRFCV.js → dialogTraceCommand-RKB76OVX.js} +84 -70
  210. package/{dialogUsageCommand-WJ3U6KZU.js → dialogUsageCommand-BP7HMRYP.js} +7 -4
  211. package/{docCreateCommands-QLRIWRQE.js → docCreateCommands-JGPNGIZ7.js} +68 -59
  212. package/{docDeleteCommands-XPRYA532.js → docDeleteCommands-XRJTNRDH.js} +68 -59
  213. package/{docReadCommands-EXQI7ETH.js → docReadCommands-6GFO4ARS.js} +67 -58
  214. package/{docStore-MWFUKZL2.js → docStore-QRLIWFTU.js} +16 -17
  215. package/{docUpdateCommands-EFBFQV77.js → docUpdateCommands-W2GXMUXW.js} +68 -59
  216. package/{ebookDownloaderAgentCommand-DYSKF5ZY.js → ebookDownloaderAgentCommand-2DHPGEOQ.js} +14 -17
  217. package/{fetchMessages-TQEUZD7H.js → fetchMessages-RGPIYEPZ.js} +2 -2
  218. package/{getPricing-5BLZRPTM.js → getPricing-BK6CUBAE.js} +8 -4
  219. package/{handleSendMessageAction-GG3TR62X.js → handleSendMessageAction-DHGWURJZ.js} +265 -119
  220. package/{hostCredentialCreate-26S6DDJ5.js → hostCredentialCreate-FPUZ7RMI.js} +138 -122
  221. package/index.js +36 -22
  222. package/{keys-RWF7UCB4.js → keys-FXEGMKSG.js} +2 -2
  223. package/localAutomationCommands-ZMU22RQJ.js +198 -0
  224. package/localAutomationRuntime-MU5FGJ3V.js +60 -0
  225. package/{localDialogRead-BJJT3TF5.js → localDialogRead-W2EVXISA.js} +2 -2
  226. package/{localRuntimeAdapter-VREWZWPC.js → localRuntimeAdapter-YBXQBV4G.js} +136 -119
  227. package/localRuntimeAuthority-LDXMEDO5.js +44 -0
  228. package/{localRuntimeDb-ZJFGNHML.js → localRuntimeDb-6TQZDLNU.js} +1 -1
  229. package/{machineCommands-CL5XK5UC.js → machineCommands-57RTUYRV.js} +251 -357
  230. package/{machineInfo-LWHTEBHJ.js → machineInfo-BJIU3WQ5.js} +4 -2
  231. package/machineWsRunDispatch-VBKV3FFE.js +227 -0
  232. package/{mcpLocalAuthorizeCommand-RBXJDE6J.js → mcpLocalAuthorizeCommand-J76SOJVZ.js} +40 -22
  233. package/mcpLocalManageCommands-USETIMHB.js +212 -0
  234. package/{memberThunks-43B7UYC5.js → memberThunks-7UERUEMI.js} +102 -22
  235. package/{memoryCommands-BC6REPQB.js → memoryCommands-N7NHEE55.js} +25 -34
  236. package/{models-ZX2BYIMB.js → models-TOXYINNM.js} +3 -2
  237. package/{offlineMarxistsAgentCommand-XVXUE6G5.js → offlineMarxistsAgentCommand-WZBJBCPZ.js} +16 -22
  238. package/package.json +3 -3
  239. package/parityCommands-LYDLWSLK.js +613 -0
  240. package/{projectArchive-OC63TWTD.js → projectArchive-KCNQDVWJ.js} +49 -45
  241. package/{providerPresetApply-NTJUINI6.js → providerPresetApply-IRJ56XIZ.js} +12 -16
  242. package/{providerRegistry-W45SLUV6.js → providerRegistry-26PAUYH2.js} +3 -13
  243. package/{read-KG6INYUT.js → read-SPSQ6NLR.js} +11 -10
  244. package/{readDocTool-N3GA52JR.js → readDocTool-ENUL2GNL.js} +5 -1
  245. package/{readlineWorkspace-2NO6D6IZ.js → readlineWorkspace-MKS7TAEF.js} +927 -573
  246. package/{rememberExplicit-CPAPONSI.js → rememberExplicit-7KX4HXQC.js} +4 -4
  247. package/remove-TNNDO635.js +32 -0
  248. package/{removeDialogAgentAction-EEVSOQOJ.js → removeDialogAgentAction-POPUZ3WU.js} +22 -26
  249. package/{runAgentClientLoop-U7V32UTD.js → runAgentClientLoop-KVILXQNI.js} +117 -82
  250. package/{runtimeDoctorCommands-V3M3JTUV.js → runtimeDoctorCommands-4J2DP4LZ.js} +23 -16
  251. package/{secretCommands-KVVZS7A6.js → secretCommands-CSTQYB6T.js} +2 -2
  252. package/{setDialogExtraReferencesAction-DNO5POHA.js → setDialogExtraReferencesAction-35THMVBP.js} +16 -17
  253. package/{setPrimaryDialogAgentAction-QABBEO4C.js → setPrimaryDialogAgentAction-WLXBNIG7.js} +23 -27
  254. package/{settingThunks-DVKG4X4S.js → settingThunks-6Y5U5M5N.js} +170 -497
  255. package/{skillDiscovery-5GEGWJ6N.js → skillDiscovery-IUEZZG2B.js} +3 -3
  256. package/{spaceCommands-7QKXKBDQ.js → spaceCommands-LXNJBO2U.js} +293 -58
  257. package/spacePruneCommand-2ITUFYBM.js +233 -0
  258. package/{store-Z53ICFL3.js → store-WSAVTR32.js} +3 -1
  259. package/{streamAgentChatTurn-UAGFOXNJ.js → streamAgentChatTurn-EY6MFKCA.js} +225 -137
  260. package/{switchDialogAgentAction-KYWJSGOO.js → switchDialogAgentAction-TG6BQRDA.js} +19 -23
  261. package/{tableCommands-EFA754RE.js → tableCommands-35G34R4B.js} +28 -49
  262. package/{toolApiClient-N5PYW2R3.js → toolApiClient-MPQIFYXP.js} +15 -4
  263. package/{tools-2Q2LBDUC.js → tools-CSLTRRUR.js} +73 -63
  264. package/{tuiRestart-4QDWLHYZ.js → tuiRestart-ALR4Q3JM.js} +20 -13
  265. package/tuiSummaryLlmCaller-3Y3JEXJK.js +52 -0
  266. package/{updateCommands-GJGRS6JK.js → updateCommands-GHQVP6Z5.js} +13 -8
  267. package/{updateDialogTitleAction-GGNTTI5L.js → updateDialogTitleAction-LFAWF5EW.js} +57 -58
  268. package/{usageCommand-WI6SQOPB.js → usageCommand-5VKW6T4C.js} +6 -8
  269. package/{usageRebuildCommand-WQRLLZAT.js → usageRebuildCommand-VUQETFMW.js} +11 -15
  270. package/{windowsSelfUpdate-C7LGVWYX.js → windowsSelfUpdate-SXSVXK4X.js} +2 -2
  271. package/workContext-ZAW6VXT7.js +18 -0
  272. package/workContextQueryProjection-CACY5VFE.js +23 -0
  273. package/{workloadLifecycle-DYX5ZMAT.js → workloadLifecycle-P2SJVV3S.js} +1 -1
  274. package/agentFavoriteCommands-7LOP3HUD.js +0 -186
  275. package/agentRecordCommands-TPE7NSZ6.js +0 -194
  276. package/agentRunCommand-DMVGBPLI.js +0 -232
  277. package/authCommand-V6EOMZX6.js +0 -79
  278. package/chunk-2MBTWINN.js +0 -89
  279. package/chunk-523DITKR.js +0 -32
  280. package/chunk-BUDVRYES.js +0 -2213
  281. package/chunk-BZMDWGQQ.js +0 -47
  282. package/chunk-GAHJLSDO.js +0 -107
  283. package/chunk-GYX6XTAI.js +0 -84
  284. package/chunk-HNUWUO75.js +0 -93
  285. package/chunk-HSBHS6KT.js +0 -33401
  286. package/chunk-KG27JIG4.js +0 -136
  287. package/chunk-OB4FBZXJ.js +0 -364
  288. package/chunk-OKH74FML.js +0 -3746
  289. package/chunk-OLZBQWZU.js +0 -6
  290. package/chunk-OOV5JN25.js +0 -1317
  291. package/chunk-OQFOE4SJ.js +0 -405
  292. package/chunk-PXYBUFDB.js +0 -53
  293. package/chunk-R3FZHW4Q.js +0 -103
  294. package/chunk-R3MV2GII.js +0 -106
  295. package/chunk-SCAC3NM5.js +0 -11751
  296. package/chunk-SR4FE5VD.js +0 -9
  297. package/chunk-SYTHYBMI.js +0 -3558
  298. package/chunk-UKZX3NHN.js +0 -48
  299. package/chunk-UVLYNWIE.js +0 -74
  300. package/chunk-VQX5JJNI.js +0 -861
  301. package/chunk-X4O7FJF5.js +0 -160
  302. package/chunk-YJPK35HB.js +0 -175
  303. package/chunk-YNIYE47Z.js +0 -105
  304. package/chunk-Z4PCXPUE.js +0 -127
  305. package/chunk-ZR5IVL4N.js +0 -862
  306. package/chunk-ZTHAJU3O.js +0 -2537
  307. package/cliAuthorityBrokerProcess-5ZFBTHLB.js +0 -22
  308. package/cliLocalAgentRecordReader-34UKRBLY.js +0 -104
  309. package/createDialogAction-ZAJERW62.js +0 -82
  310. package/deleteFile-ECU6FU5C.js +0 -55
  311. package/dialogNotifyCommand-IASQGEMW.js +0 -36
  312. package/localRuntimeAuthority-UF2DAQ3F.js +0 -28
  313. package/machineWsRunDispatch-TBVOYOAH.js +0 -209
  314. package/markdownToSlate-PXYAIBVL.js +0 -8
  315. package/tuiSummaryLlmCaller-HROLGN4F.js +0 -45
  316. package/webapi-QVV65DQF.js +0 -2487
  317. package/workContext-Y3ADAPZU.js +0 -14
  318. package/{chunk-USGHJSGO.js → chunk-GX2MFKF3.js} +3 -3
  319. package/{chunk-PHREU2KZ.js → chunk-WX266G2C.js} +0 -0
  320. package/{chunk-DXWGFL2Z.js → chunk-YY7IGJMN.js} +3 -3
package/chunk-ZTHAJU3O.js DELETED
@@ -1,2537 +0,0 @@
1
- import {
2
- googleSessionRequestToken,
3
- isGoogleAuthoritySession
4
- } from "./chunk-HDKMVYNJ.js";
5
- import {
6
- selectIdentityToken
7
- } from "./chunk-PXYBUFDB.js";
8
- import {
9
- isAbortError
10
- } from "./chunk-7DPNBQSV.js";
11
- import {
12
- API_ENDPOINTS
13
- } from "./chunk-LCBAMY2M.js";
14
-
15
- // node_modules/reselect/dist/reselect.mjs
16
- var CACHE_SIZE_CHECK_THRESHOLD = 1e3;
17
- var runCacheSizeCheck = (cacheSize, funcName) => {
18
- let stack = void 0;
19
- try {
20
- throw new Error();
21
- } catch (e) {
22
- ;
23
- ({ stack } = e);
24
- }
25
- console.warn(
26
- `A function memoized with weakMapMemoize${funcName ? ` (\`${funcName}\`)` : ""} has seen over ${cacheSize} distinct values for the same primitive argument position.
27
- Results keyed by primitive arguments are held strongly and are only released by \`clearCache()\`, so this cache will keep growing for as long as the function keeps seeing new values.
28
- If it is called with ever-changing primitives (ids, offsets, timestamps), pass the \`maxSize\` option to bound the cache, switch to \`lruMemoize\`, or call \`.clearCache()\` at a suitable point.
29
- See https://reselect.js.org/api/development-only-checks#cachesizecheck for details.`,
30
- { stack }
31
- );
32
- };
33
- var globalDevModeChecks = {
34
- inputStabilityCheck: "once",
35
- identityFunctionCheck: "once",
36
- cacheSizeCheck: "once"
37
- };
38
- var StrongRef = class {
39
- constructor(value) {
40
- this.value = value;
41
- }
42
- deref() {
43
- return this.value;
44
- }
45
- };
46
- var getWeakRef = () => typeof WeakRef === "undefined" ? StrongRef : WeakRef;
47
- var Ref = /* @__PURE__ */ getWeakRef();
48
- var UNTERMINATED = 0;
49
- var TERMINATED = 1;
50
- function createCacheNode() {
51
- return {
52
- s: UNTERMINATED,
53
- v: void 0,
54
- o: null,
55
- p: null
56
- };
57
- }
58
- function maybeDeref(r) {
59
- if (r instanceof Ref) {
60
- return r.deref();
61
- }
62
- return r;
63
- }
64
- function weakMapMemoize(func, options = {}) {
65
- let fnNode = createCacheNode();
66
- const { resultEqualityCheck, maxSize } = options;
67
- const useGenerations = maxSize !== void 0;
68
- if (useGenerations && (!Number.isInteger(maxSize) || maxSize < 1)) {
69
- throw new TypeError(
70
- `maxSize must be a positive integer, received: ${maxSize}`
71
- );
72
- }
73
- let prevNode = null;
74
- let insertionCount = 0;
75
- let lastResult;
76
- let resultsCount = 0;
77
- let hasWarnedAboutCacheSize = false;
78
- function maybeFlipGenerations() {
79
- if (insertionCount >= maxSize) {
80
- prevNode = fnNode;
81
- fnNode = createCacheNode();
82
- insertionCount = 0;
83
- }
84
- }
85
- function memoized() {
86
- let cacheNode = fnNode;
87
- const { length } = arguments;
88
- for (let i = 0, l = length; i < l; i++) {
89
- const arg = arguments[i];
90
- if (typeof arg === "function" || typeof arg === "object" && arg !== null) {
91
- let objectCache = cacheNode.o;
92
- if (objectCache === null) {
93
- cacheNode.o = objectCache = /* @__PURE__ */ new WeakMap();
94
- }
95
- const objectNode = objectCache.get(arg);
96
- if (objectNode === void 0) {
97
- cacheNode = createCacheNode();
98
- objectCache.set(arg, cacheNode);
99
- } else {
100
- cacheNode = objectNode;
101
- }
102
- } else {
103
- let primitiveCache = cacheNode.p;
104
- if (primitiveCache === null) {
105
- cacheNode.p = primitiveCache = /* @__PURE__ */ new Map();
106
- }
107
- const primitiveNode = primitiveCache.get(arg);
108
- if (primitiveNode === void 0) {
109
- cacheNode = createCacheNode();
110
- primitiveCache.set(arg, cacheNode);
111
- insertionCount++;
112
- if (process.env.NODE_ENV !== "production") {
113
- if (primitiveCache.size > CACHE_SIZE_CHECK_THRESHOLD) {
114
- const { cacheSizeCheck } = globalDevModeChecks;
115
- if (cacheSizeCheck === "always" || cacheSizeCheck === "once" && !hasWarnedAboutCacheSize) {
116
- hasWarnedAboutCacheSize = true;
117
- runCacheSizeCheck(primitiveCache.size, func.name);
118
- }
119
- }
120
- }
121
- } else {
122
- cacheNode = primitiveNode;
123
- }
124
- }
125
- }
126
- if (cacheNode.s === TERMINATED) {
127
- return cacheNode.v;
128
- }
129
- if (prevNode !== null) {
130
- let prevCacheNode = prevNode;
131
- for (let i = 0, l = length; i < l; i++) {
132
- const arg = arguments[i];
133
- let next;
134
- if (typeof arg === "function" || typeof arg === "object" && arg !== null) {
135
- const prevObjectCache = prevCacheNode.o;
136
- next = prevObjectCache !== null ? prevObjectCache.get(arg) : void 0;
137
- } else {
138
- const prevPrimitiveCache = prevCacheNode.p;
139
- next = prevPrimitiveCache !== null ? prevPrimitiveCache.get(arg) : void 0;
140
- }
141
- if (next === void 0) {
142
- prevCacheNode = null;
143
- break;
144
- }
145
- prevCacheNode = next;
146
- }
147
- if (prevCacheNode !== null && prevCacheNode.s === TERMINATED) {
148
- const promotedNode = cacheNode;
149
- promotedNode.s = TERMINATED;
150
- promotedNode.v = prevCacheNode.v;
151
- maybeFlipGenerations();
152
- return prevCacheNode.v;
153
- }
154
- }
155
- const terminatedNode = cacheNode;
156
- let result = func.apply(null, arguments);
157
- resultsCount++;
158
- if (resultEqualityCheck) {
159
- const lastResultValue = maybeDeref(lastResult);
160
- if (lastResultValue != null && resultEqualityCheck(lastResultValue, result)) {
161
- result = lastResultValue;
162
- resultsCount !== 0 && resultsCount--;
163
- }
164
- const needsWeakRef = typeof result === "object" && result !== null || typeof result === "function";
165
- lastResult = needsWeakRef ? /* @__PURE__ */ new Ref(result) : result;
166
- }
167
- terminatedNode.s = TERMINATED;
168
- terminatedNode.v = result;
169
- if (useGenerations) {
170
- maybeFlipGenerations();
171
- }
172
- return result;
173
- }
174
- memoized.clearCache = () => {
175
- fnNode = createCacheNode();
176
- prevNode = null;
177
- insertionCount = 0;
178
- memoized.resetResultsCount();
179
- if (process.env.NODE_ENV !== "production") {
180
- hasWarnedAboutCacheSize = false;
181
- }
182
- };
183
- memoized.resultsCount = () => resultsCount;
184
- memoized.resetResultsCount = () => {
185
- resultsCount = 0;
186
- };
187
- return memoized;
188
- }
189
- var runIdentityFunctionCheck = (resultFunc, inputSelectorsResults, outputSelectorResult) => {
190
- if (inputSelectorsResults.length === 1 && inputSelectorsResults[0] === outputSelectorResult) {
191
- let isInputSameAsOutput = false;
192
- try {
193
- const emptyObject = {};
194
- if (resultFunc(emptyObject) === emptyObject) isInputSameAsOutput = true;
195
- } catch {
196
- }
197
- if (isInputSameAsOutput) {
198
- let stack = void 0;
199
- try {
200
- throw new Error();
201
- } catch (e) {
202
- ;
203
- ({ stack } = e);
204
- }
205
- console.warn(
206
- "The result function returned its own inputs without modification. e.g\n`createSelector([state => state.todos], todos => todos)`\nThis could lead to inefficient memoization and unnecessary re-renders.\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.",
207
- { stack }
208
- );
209
- }
210
- }
211
- };
212
- var withoutResultEqualityCheck = (option) => {
213
- if (option === null || typeof option !== "object" || !("resultEqualityCheck" in option)) {
214
- return option;
215
- }
216
- const optionCopy = { ...option };
217
- delete optionCopy.resultEqualityCheck;
218
- return optionCopy;
219
- };
220
- var runInputStabilityCheck = (inputSelectorResultsObject, options, inputSelectorArgs) => {
221
- const { memoize, memoizeOptions } = options;
222
- const { inputSelectorResults, inputSelectorResultsCopy } = inputSelectorResultsObject;
223
- const probeMemoizeOptions = [];
224
- const { length } = memoizeOptions;
225
- for (let i = 0; i < length; i++) {
226
- probeMemoizeOptions.push(withoutResultEqualityCheck(memoizeOptions[i]));
227
- }
228
- const createAnEmptyObject = memoize(() => ({}), ...probeMemoizeOptions);
229
- const areInputSelectorResultsEqual = createAnEmptyObject.apply(null, inputSelectorResults) === createAnEmptyObject.apply(null, inputSelectorResultsCopy);
230
- if (!areInputSelectorResultsEqual) {
231
- let stack = void 0;
232
- try {
233
- throw new Error();
234
- } catch (e) {
235
- ;
236
- ({ stack } = e);
237
- }
238
- console.warn(
239
- "An input selector returned a different result when passed same arguments.\nThis means your output selector will likely run more frequently than intended.\nAvoid returning a new reference inside your input selector, e.g.\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`",
240
- {
241
- arguments: inputSelectorArgs,
242
- firstInputs: inputSelectorResults,
243
- secondInputs: inputSelectorResultsCopy,
244
- stack
245
- }
246
- );
247
- }
248
- };
249
- function assertIsFunction(func, errorMessage = `expected a function, instead received ${typeof func}`) {
250
- if (typeof func !== "function") {
251
- throw new TypeError(errorMessage);
252
- }
253
- }
254
- function assertIsArrayOfFunctions(array, errorMessage = `expected all items to be functions, instead received the following types: `) {
255
- if (!array.every((item) => typeof item === "function")) {
256
- const itemTypes = array.map(
257
- (item) => typeof item === "function" ? `function ${item.name || "unnamed"}()` : typeof item
258
- ).join(", ");
259
- throw new TypeError(`${errorMessage}[${itemTypes}]`);
260
- }
261
- }
262
- var ensureIsArray = (item) => {
263
- return Array.isArray(item) ? item : [item];
264
- };
265
- function getDependencies(createSelectorArgs) {
266
- const dependencies = Array.isArray(createSelectorArgs[0]) ? createSelectorArgs[0] : createSelectorArgs;
267
- assertIsArrayOfFunctions(
268
- dependencies,
269
- `createSelector expects all input-selectors to be functions, but received the following types: `
270
- );
271
- return dependencies;
272
- }
273
- function collectInputSelectorResults(dependencies, inputSelectorArgs) {
274
- const inputSelectorResults = [];
275
- const { length } = dependencies;
276
- for (let i = 0; i < length; i++) {
277
- inputSelectorResults.push(dependencies[i].apply(null, inputSelectorArgs));
278
- }
279
- return inputSelectorResults;
280
- }
281
- function createSelectorCreator(memoizeOrOptions, ...memoizeOptionsFromArgs) {
282
- const createSelectorCreatorOptions = typeof memoizeOrOptions === "function" ? {
283
- memoize: memoizeOrOptions,
284
- memoizeOptions: memoizeOptionsFromArgs
285
- } : memoizeOrOptions;
286
- const createSelector2 = (...createSelectorArgs) => {
287
- let recomputations = 0;
288
- let dependencyRecomputations = 0;
289
- let lastResult;
290
- let directlyPassedOptions = {};
291
- let resultFunc = createSelectorArgs.pop();
292
- if (typeof resultFunc === "object") {
293
- directlyPassedOptions = resultFunc;
294
- resultFunc = createSelectorArgs.pop();
295
- }
296
- assertIsFunction(
297
- resultFunc,
298
- `createSelector expects an output function after the inputs, but received: [${typeof resultFunc}]`
299
- );
300
- const combinedOptions = {
301
- ...createSelectorCreatorOptions,
302
- ...directlyPassedOptions
303
- };
304
- const {
305
- memoize,
306
- memoizeOptions = [],
307
- argsMemoize = weakMapMemoize,
308
- argsMemoizeOptions = []
309
- } = combinedOptions;
310
- const finalMemoizeOptions = ensureIsArray(memoizeOptions);
311
- const finalArgsMemoizeOptions = ensureIsArray(argsMemoizeOptions);
312
- const dependencies = getDependencies(createSelectorArgs);
313
- const memoizedResultFunc = memoize(function recomputationWrapper() {
314
- recomputations++;
315
- return resultFunc.apply(
316
- null,
317
- arguments
318
- );
319
- }, ...finalMemoizeOptions);
320
- let firstRun = true;
321
- const selector = argsMemoize(function dependenciesChecker() {
322
- dependencyRecomputations++;
323
- const { length } = dependencies;
324
- const inputSelectorResults = new Array(length);
325
- for (let i = 0; i < length; i++) {
326
- inputSelectorResults[i] = dependencies[i].apply(null, arguments);
327
- }
328
- lastResult = memoizedResultFunc.apply(null, inputSelectorResults);
329
- if (process.env.NODE_ENV !== "production") {
330
- const { devModeChecks } = combinedOptions;
331
- const identityFunctionCheck = devModeChecks !== void 0 && Object.prototype.hasOwnProperty.call(
332
- devModeChecks,
333
- "identityFunctionCheck"
334
- ) ? devModeChecks.identityFunctionCheck : globalDevModeChecks.identityFunctionCheck;
335
- const inputStabilityCheck = devModeChecks !== void 0 && Object.prototype.hasOwnProperty.call(
336
- devModeChecks,
337
- "inputStabilityCheck"
338
- ) ? devModeChecks.inputStabilityCheck : globalDevModeChecks.inputStabilityCheck;
339
- if (identityFunctionCheck === "always" || identityFunctionCheck === "once" && firstRun) {
340
- runIdentityFunctionCheck(
341
- resultFunc,
342
- inputSelectorResults,
343
- lastResult
344
- );
345
- }
346
- if (inputStabilityCheck === "always" || inputStabilityCheck === "once" && firstRun) {
347
- const inputSelectorResultsCopy = collectInputSelectorResults(
348
- dependencies,
349
- arguments
350
- );
351
- runInputStabilityCheck(
352
- { inputSelectorResults, inputSelectorResultsCopy },
353
- { memoize, memoizeOptions: finalMemoizeOptions },
354
- arguments
355
- );
356
- }
357
- if (firstRun) firstRun = false;
358
- }
359
- return lastResult;
360
- }, ...finalArgsMemoizeOptions);
361
- return Object.assign(selector, {
362
- resultFunc,
363
- memoizedResultFunc,
364
- dependencies,
365
- dependencyRecomputations: () => dependencyRecomputations,
366
- resetDependencyRecomputations: () => {
367
- dependencyRecomputations = 0;
368
- },
369
- lastResult: () => lastResult,
370
- recomputations: () => recomputations,
371
- resetRecomputations: () => {
372
- recomputations = 0;
373
- },
374
- memoize,
375
- argsMemoize
376
- });
377
- };
378
- Object.assign(createSelector2, {
379
- withTypes: () => createSelector2
380
- });
381
- return createSelector2;
382
- }
383
- var createSelector = /* @__PURE__ */ createSelectorCreator(weakMapMemoize);
384
-
385
- // node_modules/redux/dist/redux.mjs
386
- var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
387
- var ActionTypes = {
388
- INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
389
- REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
390
- PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
391
- };
392
- function isPlainObject(obj) {
393
- if (typeof obj !== "object" || obj === null)
394
- return false;
395
- let proto = obj;
396
- while (Object.getPrototypeOf(proto) !== null) {
397
- proto = Object.getPrototypeOf(proto);
398
- }
399
- return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
400
- }
401
- function compose(...funcs) {
402
- if (funcs.length === 0) {
403
- return (arg) => arg;
404
- }
405
- if (funcs.length === 1) {
406
- return funcs[0];
407
- }
408
- return funcs.reduce((a, b) => (...args) => a(b(...args)));
409
- }
410
- function isAction(action) {
411
- return isPlainObject(action) && "type" in action && typeof action.type === "string";
412
- }
413
-
414
- // node_modules/immer/dist/immer.mjs
415
- var NOTHING = Symbol.for("immer-nothing");
416
- var DRAFTABLE = Symbol.for("immer-draftable");
417
- var DRAFT_STATE = Symbol.for("immer-state");
418
- var errors = process.env.NODE_ENV !== "production" ? [
419
- // All error codes, starting by 0:
420
- function(plugin) {
421
- return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.`;
422
- },
423
- function(thing) {
424
- 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}'`;
425
- },
426
- "This object has been frozen and should not be mutated",
427
- function(data) {
428
- return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + data;
429
- },
430
- "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
431
- "Immer forbids circular references",
432
- "The first or second argument to `produce` must be a function",
433
- "The third argument to `produce` must be a function or undefined",
434
- "First argument to `createDraft` must be a plain object, an array, or an immerable object",
435
- "First argument to `finishDraft` must be a draft returned by `createDraft`",
436
- function(thing) {
437
- return `'current' expects a draft, got: ${thing}`;
438
- },
439
- "Object.defineProperty() cannot be used on an Immer draft",
440
- "Object.setPrototypeOf() cannot be used on an Immer draft",
441
- "Immer only supports deleting array indices",
442
- "Immer only supports setting array indices and the 'length' property",
443
- function(thing) {
444
- return `'original' expects a draft, got: ${thing}`;
445
- }
446
- // Note: if more errors are added, the errorOffset in Patches.ts should be increased
447
- // See Patches.ts for additional errors
448
- ] : [];
449
- function die(error, ...args) {
450
- if (process.env.NODE_ENV !== "production") {
451
- const e = errors[error];
452
- const msg = isFunction(e) ? e.apply(null, args) : e;
453
- throw new Error(`[Immer] ${msg}`);
454
- }
455
- throw new Error(
456
- `[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`
457
- );
458
- }
459
- var O = Object;
460
- var getPrototypeOf = O.getPrototypeOf;
461
- var CONSTRUCTOR = "constructor";
462
- var PROTOTYPE = "prototype";
463
- var CONFIGURABLE = "configurable";
464
- var ENUMERABLE = "enumerable";
465
- var WRITABLE = "writable";
466
- var VALUE = "value";
467
- var isDraft = (value) => !!value && !!value[DRAFT_STATE];
468
- function isDraftable(value) {
469
- if (!value)
470
- return false;
471
- return isPlainObject2(value) || isArray(value) || !!value[DRAFTABLE] || !!value[CONSTRUCTOR]?.[DRAFTABLE] || isMap(value) || isSet(value);
472
- }
473
- var objectCtorString = O[PROTOTYPE][CONSTRUCTOR].toString();
474
- var cachedCtorStrings = /* @__PURE__ */ new WeakMap();
475
- function isPlainObject2(value) {
476
- if (!value || !isObjectish(value))
477
- return false;
478
- const proto = getPrototypeOf(value);
479
- if (proto === null || proto === O[PROTOTYPE])
480
- return true;
481
- const Ctor = O.hasOwnProperty.call(proto, CONSTRUCTOR) && proto[CONSTRUCTOR];
482
- if (Ctor === Object)
483
- return true;
484
- if (!isFunction(Ctor))
485
- return false;
486
- let ctorString = cachedCtorStrings.get(Ctor);
487
- if (ctorString === void 0) {
488
- ctorString = Function.toString.call(Ctor);
489
- cachedCtorStrings.set(Ctor, ctorString);
490
- }
491
- return ctorString === objectCtorString;
492
- }
493
- function each(obj, iter, strict = true) {
494
- if (getArchtype(obj) === 0) {
495
- const keys = strict ? Reflect.ownKeys(obj) : O.keys(obj);
496
- keys.forEach((key) => {
497
- iter(key, obj[key], obj);
498
- });
499
- } else {
500
- obj.forEach((entry, index) => iter(index, entry, obj));
501
- }
502
- }
503
- function getArchtype(thing) {
504
- const state = thing[DRAFT_STATE];
505
- return state ? state.type_ : isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;
506
- }
507
- var has = (thing, prop, type = getArchtype(thing)) => type === 2 ? thing.has(prop) : O[PROTOTYPE].hasOwnProperty.call(thing, prop);
508
- var get = (thing, prop, type = getArchtype(thing)) => (
509
- // @ts-ignore
510
- type === 2 ? thing.get(prop) : thing[prop]
511
- );
512
- var set = (thing, propOrOldValue, value, type = getArchtype(thing)) => {
513
- if (type === 2)
514
- thing.set(propOrOldValue, value);
515
- else if (type === 3) {
516
- thing.add(value);
517
- } else
518
- thing[propOrOldValue] = value;
519
- };
520
- function is(x, y) {
521
- if (x === y) {
522
- return x !== 0 || 1 / x === 1 / y;
523
- } else {
524
- return x !== x && y !== y;
525
- }
526
- }
527
- var isArray = Array.isArray;
528
- var isMap = (target) => target instanceof Map;
529
- var isSet = (target) => target instanceof Set;
530
- var isObjectish = (target) => typeof target === "object";
531
- var isFunction = (target) => typeof target === "function";
532
- var isBoolean = (target) => typeof target === "boolean";
533
- function isArrayIndex(value) {
534
- const n = +value;
535
- return Number.isInteger(n) && String(n) === value;
536
- }
537
- var latest = (state) => state.copy_ || state.base_;
538
- var getFinalValue = (state) => state.modified_ ? state.copy_ : state.base_;
539
- function shallowCopy(base, strict) {
540
- if (isMap(base)) {
541
- return new Map(base);
542
- }
543
- if (isSet(base)) {
544
- return new Set(base);
545
- }
546
- if (isArray(base))
547
- return Array[PROTOTYPE].slice.call(base);
548
- const isPlain = isPlainObject2(base);
549
- if (strict === true || strict === "class_only" && !isPlain) {
550
- const descriptors = O.getOwnPropertyDescriptors(base);
551
- delete descriptors[DRAFT_STATE];
552
- let keys = Reflect.ownKeys(descriptors);
553
- for (let i = 0; i < keys.length; i++) {
554
- const key = keys[i];
555
- const desc = descriptors[key];
556
- if (desc[WRITABLE] === false) {
557
- desc[WRITABLE] = true;
558
- desc[CONFIGURABLE] = true;
559
- }
560
- if (desc.get || desc.set)
561
- descriptors[key] = {
562
- [CONFIGURABLE]: true,
563
- [WRITABLE]: true,
564
- // could live with !!desc.set as well here...
565
- [ENUMERABLE]: desc[ENUMERABLE],
566
- [VALUE]: base[key]
567
- };
568
- }
569
- return O.create(getPrototypeOf(base), descriptors);
570
- } else {
571
- const proto = getPrototypeOf(base);
572
- if (proto !== null && isPlain) {
573
- return { ...base };
574
- }
575
- const obj = O.create(proto);
576
- return O.assign(obj, base);
577
- }
578
- }
579
- function freeze(obj, deep = false) {
580
- if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj))
581
- return obj;
582
- if (getArchtype(obj) > 1) {
583
- O.defineProperties(obj, {
584
- set: dontMutateMethodOverride,
585
- add: dontMutateMethodOverride,
586
- clear: dontMutateMethodOverride,
587
- delete: dontMutateMethodOverride
588
- });
589
- }
590
- O.freeze(obj);
591
- if (deep)
592
- each(
593
- obj,
594
- (_key, value) => {
595
- freeze(value, true);
596
- },
597
- false
598
- );
599
- return obj;
600
- }
601
- function dontMutateFrozenCollections() {
602
- die(2);
603
- }
604
- var dontMutateMethodOverride = {
605
- [VALUE]: dontMutateFrozenCollections
606
- };
607
- function isFrozen(obj) {
608
- if (obj === null || !isObjectish(obj))
609
- return true;
610
- return O.isFrozen(obj);
611
- }
612
- var PluginMapSet = "MapSet";
613
- var PluginPatches = "Patches";
614
- var PluginArrayMethods = "ArrayMethods";
615
- var plugins = {};
616
- function getPlugin(pluginKey) {
617
- const plugin = plugins[pluginKey];
618
- if (!plugin) {
619
- die(0, pluginKey);
620
- }
621
- return plugin;
622
- }
623
- var isPluginLoaded = (pluginKey) => !!plugins[pluginKey];
624
- var currentScope;
625
- var getCurrentScope = () => currentScope;
626
- var createScope = (parent_, immer_) => ({
627
- drafts_: [],
628
- parent_,
629
- immer_,
630
- // Whenever the modified draft contains a draft from another scope, we
631
- // need to prevent auto-freezing so the unowned draft can be finalized.
632
- canAutoFreeze_: true,
633
- unfinalizedDrafts_: 0,
634
- handledSet_: /* @__PURE__ */ new Set(),
635
- processedForPatches_: /* @__PURE__ */ new Set(),
636
- mapSetPlugin_: isPluginLoaded(PluginMapSet) ? getPlugin(PluginMapSet) : void 0,
637
- arrayMethodsPlugin_: isPluginLoaded(PluginArrayMethods) ? getPlugin(PluginArrayMethods) : void 0
638
- });
639
- function usePatchesInScope(scope, patchListener) {
640
- if (patchListener) {
641
- scope.patchPlugin_ = getPlugin(PluginPatches);
642
- scope.patches_ = [];
643
- scope.inversePatches_ = [];
644
- scope.patchListener_ = patchListener;
645
- }
646
- }
647
- function revokeScope(scope) {
648
- leaveScope(scope);
649
- scope.drafts_.forEach(revokeDraft);
650
- scope.drafts_ = null;
651
- }
652
- function leaveScope(scope) {
653
- if (scope === currentScope) {
654
- currentScope = scope.parent_;
655
- }
656
- }
657
- var enterScope = (immer2) => currentScope = createScope(currentScope, immer2);
658
- function revokeDraft(draft) {
659
- const state = draft[DRAFT_STATE];
660
- if (state.type_ === 0 || state.type_ === 1)
661
- state.revoke_();
662
- else
663
- state.revoked_ = true;
664
- }
665
- function processResult(result, scope) {
666
- scope.unfinalizedDrafts_ = scope.drafts_.length;
667
- const baseDraft = scope.drafts_[0];
668
- const isReplaced = result !== void 0 && result !== baseDraft;
669
- if (isReplaced) {
670
- if (baseDraft[DRAFT_STATE].modified_) {
671
- revokeScope(scope);
672
- die(4);
673
- }
674
- if (isDraftable(result)) {
675
- result = finalize(scope, result);
676
- }
677
- const { patchPlugin_ } = scope;
678
- if (patchPlugin_) {
679
- patchPlugin_.generateReplacementPatches_(
680
- baseDraft[DRAFT_STATE].base_,
681
- result,
682
- scope
683
- );
684
- }
685
- } else {
686
- result = finalize(scope, baseDraft);
687
- }
688
- maybeFreeze(scope, result, true);
689
- revokeScope(scope);
690
- if (scope.patches_) {
691
- scope.patchListener_(scope.patches_, scope.inversePatches_);
692
- }
693
- return result !== NOTHING ? result : void 0;
694
- }
695
- function finalize(rootScope, value) {
696
- if (isFrozen(value))
697
- return value;
698
- const state = value[DRAFT_STATE];
699
- if (!state) {
700
- const finalValue = handleValue(value, rootScope.handledSet_, rootScope);
701
- return finalValue;
702
- }
703
- if (!isSameScope(state, rootScope)) {
704
- return value;
705
- }
706
- if (!state.modified_) {
707
- return state.base_;
708
- }
709
- if (!state.finalized_) {
710
- const { callbacks_ } = state;
711
- if (callbacks_) {
712
- while (callbacks_.length > 0) {
713
- const callback = callbacks_.pop();
714
- callback(rootScope);
715
- }
716
- }
717
- generatePatchesAndFinalize(state, rootScope);
718
- }
719
- return state.copy_;
720
- }
721
- function maybeFreeze(scope, value, deep = false) {
722
- if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {
723
- freeze(value, deep);
724
- }
725
- }
726
- function markStateFinalized(state) {
727
- state.finalized_ = true;
728
- state.scope_.unfinalizedDrafts_--;
729
- }
730
- var isSameScope = (state, rootScope) => state.scope_ === rootScope;
731
- var EMPTY_LOCATIONS_RESULT = [];
732
- function updateDraftInParent(parent, draftValue, finalizedValue, originalKey) {
733
- const parentCopy = latest(parent);
734
- const parentType = parent.type_;
735
- if (originalKey !== void 0) {
736
- const currentValue = get(parentCopy, originalKey, parentType);
737
- if (currentValue === draftValue) {
738
- set(parentCopy, originalKey, finalizedValue, parentType);
739
- return;
740
- }
741
- }
742
- if (!parent.draftLocations_) {
743
- const draftLocations = parent.draftLocations_ = /* @__PURE__ */ new Map();
744
- each(parentCopy, (key, value) => {
745
- if (isDraft(value)) {
746
- const keys = draftLocations.get(value) || [];
747
- keys.push(key);
748
- draftLocations.set(value, keys);
749
- }
750
- });
751
- }
752
- const locations = parent.draftLocations_.get(draftValue) ?? EMPTY_LOCATIONS_RESULT;
753
- for (const location of locations) {
754
- set(parentCopy, location, finalizedValue, parentType);
755
- }
756
- }
757
- function registerChildFinalizationCallback(parent, child, key) {
758
- parent.callbacks_.push(function childCleanup(rootScope) {
759
- const state = child;
760
- if (!state || !isSameScope(state, rootScope)) {
761
- return;
762
- }
763
- rootScope.mapSetPlugin_?.fixSetContents(state);
764
- const finalizedValue = getFinalValue(state);
765
- updateDraftInParent(parent, state.draft_ ?? state, finalizedValue, key);
766
- generatePatchesAndFinalize(state, rootScope);
767
- });
768
- }
769
- function generatePatchesAndFinalize(state, rootScope) {
770
- const shouldFinalize = state.modified_ && !state.finalized_ && (state.type_ === 3 || state.type_ === 1 && state.allIndicesReassigned_ || (state.assigned_?.size ?? 0) > 0);
771
- if (shouldFinalize) {
772
- const { patchPlugin_ } = rootScope;
773
- if (patchPlugin_) {
774
- const basePath = patchPlugin_.getPath(state);
775
- if (basePath) {
776
- patchPlugin_.generatePatches_(state, basePath, rootScope);
777
- }
778
- }
779
- markStateFinalized(state);
780
- }
781
- }
782
- function handleCrossReference(target, key, value) {
783
- const { scope_ } = target;
784
- if (isDraft(value)) {
785
- const state = value[DRAFT_STATE];
786
- if (isSameScope(state, scope_)) {
787
- state.callbacks_.push(function crossReferenceCleanup() {
788
- prepareCopy(target);
789
- const finalizedValue = getFinalValue(state);
790
- updateDraftInParent(target, value, finalizedValue, key);
791
- });
792
- }
793
- } else if (isDraftable(value)) {
794
- target.callbacks_.push(function nestedDraftCleanup() {
795
- const targetCopy = latest(target);
796
- if (target.type_ === 3) {
797
- if (targetCopy.has(value)) {
798
- handleValue(value, scope_.handledSet_, scope_);
799
- }
800
- } else {
801
- if (get(targetCopy, key, target.type_) === value) {
802
- if (scope_.drafts_.length > 1 && (target.assigned_.get(key) ?? false) === true && target.copy_) {
803
- handleValue(
804
- get(target.copy_, key, target.type_),
805
- scope_.handledSet_,
806
- scope_
807
- );
808
- }
809
- }
810
- }
811
- });
812
- }
813
- }
814
- function handleValue(target, handledSet, rootScope) {
815
- if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {
816
- return target;
817
- }
818
- if (isDraft(target) || handledSet.has(target) || !isDraftable(target) || isFrozen(target)) {
819
- return target;
820
- }
821
- handledSet.add(target);
822
- each(target, (key, value) => {
823
- if (isDraft(value)) {
824
- const state = value[DRAFT_STATE];
825
- if (isSameScope(state, rootScope)) {
826
- const updatedValue = getFinalValue(state);
827
- set(target, key, updatedValue, target.type_);
828
- markStateFinalized(state);
829
- }
830
- } else if (isDraftable(value)) {
831
- handleValue(value, handledSet, rootScope);
832
- }
833
- });
834
- return target;
835
- }
836
- function createProxyProxy(base, parent) {
837
- const baseIsArray = isArray(base);
838
- const state = {
839
- type_: baseIsArray ? 1 : 0,
840
- // Track which produce call this is associated with.
841
- scope_: parent ? parent.scope_ : getCurrentScope(),
842
- // True for both shallow and deep changes.
843
- modified_: false,
844
- // Used during finalization.
845
- finalized_: false,
846
- // Track which properties have been assigned (true) or deleted (false).
847
- // actually instantiated in `prepareCopy()`
848
- assigned_: void 0,
849
- // The parent draft state.
850
- parent_: parent,
851
- // The base state.
852
- base_: base,
853
- // The base proxy.
854
- draft_: null,
855
- // set below
856
- // The base copy with any updated values.
857
- copy_: null,
858
- // Called by the `produce` function.
859
- revoke_: null,
860
- isManual_: false,
861
- // `callbacks` actually gets assigned in `createProxy`
862
- callbacks_: void 0
863
- };
864
- let target = state;
865
- let traps = objectTraps;
866
- if (baseIsArray) {
867
- target = [state];
868
- traps = arrayTraps;
869
- }
870
- const { revoke, proxy } = Proxy.revocable(target, traps);
871
- state.draft_ = proxy;
872
- state.revoke_ = revoke;
873
- return [proxy, state];
874
- }
875
- var objectTraps = {
876
- get(state, prop) {
877
- if (prop === DRAFT_STATE)
878
- return state;
879
- let arrayPlugin = state.scope_.arrayMethodsPlugin_;
880
- const isArrayWithStringProp = state.type_ === 1 && typeof prop === "string";
881
- if (isArrayWithStringProp) {
882
- if (arrayPlugin?.isArrayOperationMethod(prop)) {
883
- return arrayPlugin.createMethodInterceptor(state, prop);
884
- }
885
- }
886
- const source = latest(state);
887
- if (!has(source, prop, state.type_)) {
888
- return readPropFromProto(state, source, prop);
889
- }
890
- const value = source[prop];
891
- if (state.finalized_ || !isDraftable(value)) {
892
- return value;
893
- }
894
- if (isArrayWithStringProp && state.operationMethod && arrayPlugin?.isMutatingArrayMethod(
895
- state.operationMethod
896
- ) && isArrayIndex(prop)) {
897
- return value;
898
- }
899
- if (value === peek(state.base_, prop) || isRelocatedBaseRef(state, prop, value)) {
900
- prepareCopy(state);
901
- const childKey = state.type_ === 1 ? +prop : prop;
902
- const childDraft = createProxy(state.scope_, value, state, childKey);
903
- return state.copy_[childKey] = childDraft;
904
- }
905
- return value;
906
- },
907
- has(state, prop) {
908
- return prop in latest(state);
909
- },
910
- ownKeys(state) {
911
- return Reflect.ownKeys(latest(state));
912
- },
913
- set(state, prop, value) {
914
- const desc = getDescriptorFromProto(latest(state), prop);
915
- if (desc?.set) {
916
- desc.set.call(state.draft_, value);
917
- return true;
918
- }
919
- if (!state.modified_) {
920
- const current2 = peek(latest(state), prop);
921
- const currentState = current2?.[DRAFT_STATE];
922
- if (currentState && currentState.base_ === value) {
923
- state.copy_[prop] = value;
924
- state.assigned_.delete(prop);
925
- return true;
926
- }
927
- if (is(value, current2) && (value !== void 0 || has(state.base_, prop, state.type_)))
928
- return true;
929
- prepareCopy(state);
930
- markChanged(state);
931
- }
932
- if (state.copy_[prop] === value && // special case: handle new props with value 'undefined'
933
- (value !== void 0 || has(state.copy_, prop, state.type_)) || // special case: NaN
934
- Number.isNaN(value) && Number.isNaN(state.copy_[prop]))
935
- return true;
936
- state.copy_[prop] = value;
937
- state.assigned_.set(prop, true);
938
- handleCrossReference(state, prop, value);
939
- return true;
940
- },
941
- deleteProperty(state, prop) {
942
- prepareCopy(state);
943
- if (peek(state.base_, prop) !== void 0 || prop in state.base_) {
944
- state.assigned_.set(prop, false);
945
- markChanged(state);
946
- } else {
947
- state.assigned_.delete(prop);
948
- }
949
- if (state.copy_) {
950
- delete state.copy_[prop];
951
- }
952
- return true;
953
- },
954
- // Note: We never coerce `desc.value` into an Immer draft, because we can't make
955
- // the same guarantee in ES5 mode.
956
- getOwnPropertyDescriptor(state, prop) {
957
- const owner = latest(state);
958
- const desc = Reflect.getOwnPropertyDescriptor(owner, prop);
959
- if (!desc)
960
- return desc;
961
- return {
962
- [WRITABLE]: true,
963
- [CONFIGURABLE]: state.type_ !== 1 || prop !== "length",
964
- [ENUMERABLE]: desc[ENUMERABLE],
965
- [VALUE]: owner[prop]
966
- };
967
- },
968
- defineProperty() {
969
- die(11);
970
- },
971
- getPrototypeOf(state) {
972
- return getPrototypeOf(state.base_);
973
- },
974
- setPrototypeOf() {
975
- die(12);
976
- }
977
- };
978
- var arrayTraps = {};
979
- for (let key in objectTraps) {
980
- let fn = objectTraps[key];
981
- arrayTraps[key] = function() {
982
- const args = arguments;
983
- args[0] = args[0][0];
984
- return fn.apply(this, args);
985
- };
986
- }
987
- arrayTraps.deleteProperty = function(state, prop) {
988
- if (process.env.NODE_ENV !== "production" && isNaN(parseInt(prop)))
989
- die(13);
990
- return arrayTraps.set.call(this, state, prop, void 0);
991
- };
992
- arrayTraps.set = function(state, prop, value) {
993
- if (process.env.NODE_ENV !== "production" && prop !== "length" && isNaN(parseInt(prop)))
994
- die(14);
995
- return objectTraps.set.call(this, state[0], prop, value, state[0]);
996
- };
997
- function peek(draft, prop) {
998
- const state = draft[DRAFT_STATE];
999
- const source = state ? latest(state) : draft;
1000
- return source[prop];
1001
- }
1002
- function isRelocatedBaseRef(state, prop, value) {
1003
- if (state.type_ !== 1 || !state.allIndicesReassigned_ || !isDraftable(value) || value[DRAFT_STATE]) {
1004
- return false;
1005
- }
1006
- return state.baseRefs_.has(value);
1007
- }
1008
- function readPropFromProto(state, source, prop) {
1009
- const desc = getDescriptorFromProto(source, prop);
1010
- return desc ? VALUE in desc ? desc[VALUE] : (
1011
- // This is a very special case, if the prop is a getter defined by the
1012
- // prototype, we should invoke it with the draft as context!
1013
- desc.get?.call(state.draft_)
1014
- ) : void 0;
1015
- }
1016
- function getDescriptorFromProto(source, prop) {
1017
- if (!(prop in source))
1018
- return void 0;
1019
- let proto = getPrototypeOf(source);
1020
- while (proto) {
1021
- const desc = Object.getOwnPropertyDescriptor(proto, prop);
1022
- if (desc)
1023
- return desc;
1024
- proto = getPrototypeOf(proto);
1025
- }
1026
- return void 0;
1027
- }
1028
- function markChanged(state) {
1029
- if (!state.modified_) {
1030
- state.modified_ = true;
1031
- if (state.parent_) {
1032
- markChanged(state.parent_);
1033
- }
1034
- }
1035
- }
1036
- function prepareCopy(state) {
1037
- if (!state.copy_) {
1038
- state.assigned_ = /* @__PURE__ */ new Map();
1039
- state.copy_ = shallowCopy(
1040
- state.base_,
1041
- state.scope_.immer_.useStrictShallowCopy_
1042
- );
1043
- }
1044
- }
1045
- var Immer2 = class {
1046
- constructor(config) {
1047
- this.autoFreeze_ = true;
1048
- this.useStrictShallowCopy_ = false;
1049
- this.useStrictIteration_ = false;
1050
- this.produce = (base, recipe, patchListener) => {
1051
- if (isFunction(base) && !isFunction(recipe)) {
1052
- const defaultBase = recipe;
1053
- recipe = base;
1054
- const self = this;
1055
- return function curriedProduce(base2 = defaultBase, ...args) {
1056
- return self.produce(base2, (draft) => recipe.call(this, draft, ...args));
1057
- };
1058
- }
1059
- if (!isFunction(recipe))
1060
- die(6);
1061
- if (patchListener !== void 0 && !isFunction(patchListener))
1062
- die(7);
1063
- let result;
1064
- if (isDraftable(base)) {
1065
- const scope = enterScope(this);
1066
- const proxy = createProxy(scope, base, void 0);
1067
- let hasError = true;
1068
- try {
1069
- result = recipe(proxy);
1070
- hasError = false;
1071
- } finally {
1072
- if (hasError)
1073
- revokeScope(scope);
1074
- else
1075
- leaveScope(scope);
1076
- }
1077
- usePatchesInScope(scope, patchListener);
1078
- return processResult(result, scope);
1079
- } else if (!base || !isObjectish(base)) {
1080
- result = recipe(base);
1081
- if (result === void 0)
1082
- result = base;
1083
- if (result === NOTHING)
1084
- result = void 0;
1085
- if (this.autoFreeze_)
1086
- freeze(result, true);
1087
- if (patchListener) {
1088
- const p = [];
1089
- const ip = [];
1090
- getPlugin(PluginPatches).generateReplacementPatches_(base, result, {
1091
- patches_: p,
1092
- inversePatches_: ip
1093
- });
1094
- patchListener(p, ip);
1095
- }
1096
- return result;
1097
- } else
1098
- die(1, base);
1099
- };
1100
- this.produceWithPatches = (base, recipe) => {
1101
- if (isFunction(base)) {
1102
- return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));
1103
- }
1104
- let patches, inversePatches;
1105
- const result = this.produce(base, recipe, (p, ip) => {
1106
- patches = p;
1107
- inversePatches = ip;
1108
- });
1109
- return [result, patches, inversePatches];
1110
- };
1111
- if (isBoolean(config?.autoFreeze))
1112
- this.setAutoFreeze(config.autoFreeze);
1113
- const strictShallowCopy = config?.useStrictShallowCopy;
1114
- if (isBoolean(strictShallowCopy) || strictShallowCopy === "class_only")
1115
- this.setUseStrictShallowCopy(strictShallowCopy);
1116
- if (isBoolean(config?.useStrictIteration))
1117
- this.setUseStrictIteration(config.useStrictIteration);
1118
- }
1119
- createDraft(base) {
1120
- if (!isDraftable(base))
1121
- die(8);
1122
- if (isDraft(base))
1123
- base = current(base);
1124
- const scope = enterScope(this);
1125
- const proxy = createProxy(scope, base, void 0);
1126
- proxy[DRAFT_STATE].isManual_ = true;
1127
- leaveScope(scope);
1128
- return proxy;
1129
- }
1130
- finishDraft(draft, patchListener) {
1131
- const state = draft && draft[DRAFT_STATE];
1132
- if (!state || !state.isManual_)
1133
- die(9);
1134
- const { scope_: scope } = state;
1135
- usePatchesInScope(scope, patchListener);
1136
- return processResult(void 0, scope);
1137
- }
1138
- /**
1139
- * Pass true to automatically freeze all copies created by Immer.
1140
- *
1141
- * By default, auto-freezing is enabled.
1142
- */
1143
- setAutoFreeze(value) {
1144
- this.autoFreeze_ = value;
1145
- }
1146
- /**
1147
- * Pass true to enable strict shallow copy.
1148
- *
1149
- * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
1150
- */
1151
- setUseStrictShallowCopy(value) {
1152
- this.useStrictShallowCopy_ = value;
1153
- }
1154
- /**
1155
- * Pass false to use faster iteration that skips non-enumerable properties
1156
- * but still handles symbols for compatibility.
1157
- *
1158
- * By default, strict iteration is enabled (includes all own properties).
1159
- */
1160
- setUseStrictIteration(value) {
1161
- this.useStrictIteration_ = value;
1162
- }
1163
- shouldUseStrictIteration() {
1164
- return this.useStrictIteration_;
1165
- }
1166
- applyPatches(base, patches) {
1167
- let i;
1168
- for (i = patches.length - 1; i >= 0; i--) {
1169
- const patch = patches[i];
1170
- if (patch.path.length === 0 && patch.op === "replace") {
1171
- base = patch.value;
1172
- break;
1173
- }
1174
- }
1175
- if (i > -1) {
1176
- patches = patches.slice(i + 1);
1177
- }
1178
- const applyPatchesImpl = getPlugin(PluginPatches).applyPatches_;
1179
- if (isDraft(base)) {
1180
- return applyPatchesImpl(base, patches);
1181
- }
1182
- return this.produce(
1183
- base,
1184
- (draft) => applyPatchesImpl(draft, patches)
1185
- );
1186
- }
1187
- };
1188
- function createProxy(rootScope, value, parent, key) {
1189
- const [draft, state] = isMap(value) ? getPlugin(PluginMapSet).proxyMap_(value, parent) : isSet(value) ? getPlugin(PluginMapSet).proxySet_(value, parent) : createProxyProxy(value, parent);
1190
- const scope = parent?.scope_ ?? getCurrentScope();
1191
- scope.drafts_.push(draft);
1192
- state.callbacks_ = parent?.callbacks_ ?? [];
1193
- state.key_ = key;
1194
- if (parent && key !== void 0) {
1195
- registerChildFinalizationCallback(parent, state, key);
1196
- } else {
1197
- state.callbacks_.push(function rootDraftCleanup(rootScope2) {
1198
- rootScope2.mapSetPlugin_?.fixSetContents(state);
1199
- const { patchPlugin_ } = rootScope2;
1200
- if (state.modified_ && patchPlugin_) {
1201
- patchPlugin_.generatePatches_(state, [], rootScope2);
1202
- }
1203
- });
1204
- }
1205
- return draft;
1206
- }
1207
- function current(value) {
1208
- if (!isDraft(value))
1209
- die(10, value);
1210
- return currentImpl(value);
1211
- }
1212
- function currentImpl(value) {
1213
- if (!isDraftable(value) || isFrozen(value))
1214
- return value;
1215
- const state = value[DRAFT_STATE];
1216
- let copy;
1217
- let strict = true;
1218
- if (state) {
1219
- if (!state.modified_)
1220
- return state.base_;
1221
- state.finalized_ = true;
1222
- copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);
1223
- strict = state.scope_.immer_.shouldUseStrictIteration();
1224
- } else {
1225
- copy = shallowCopy(value, true);
1226
- }
1227
- const source = copy;
1228
- if (isSet(copy))
1229
- copy = /* @__PURE__ */ new Set();
1230
- each(
1231
- source,
1232
- (key, childValue) => {
1233
- set(copy, key, currentImpl(childValue));
1234
- },
1235
- strict
1236
- );
1237
- if (state) {
1238
- state.finalized_ = false;
1239
- }
1240
- return copy;
1241
- }
1242
- var _globalIterator = globalThis.Iterator;
1243
- var hasIteratorFrom = typeof _globalIterator?.from === "function";
1244
- var immer = new Immer2();
1245
- var produce = immer.produce;
1246
-
1247
- // node_modules/@reduxjs/toolkit/dist/redux-toolkit.modern.mjs
1248
- var createDraftSafeSelectorCreator = (...args) => {
1249
- const createSelector2 = createSelectorCreator(...args);
1250
- const createDraftSafeSelector2 = Object.assign((...args2) => {
1251
- const selector = createSelector2(...args2);
1252
- const wrappedSelector = (value, ...rest) => selector(isDraft(value) ? current(value) : value, ...rest);
1253
- Object.assign(wrappedSelector, selector);
1254
- return wrappedSelector;
1255
- }, { withTypes: () => createDraftSafeSelector2 });
1256
- return createDraftSafeSelector2;
1257
- };
1258
- var createDraftSafeSelector = /* @__PURE__ */ createDraftSafeSelectorCreator(weakMapMemoize);
1259
- var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function() {
1260
- if (arguments.length === 0) return void 0;
1261
- if (typeof arguments[0] === "object") return compose;
1262
- return compose.apply(null, arguments);
1263
- };
1264
- typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__;
1265
- var hasMatchFunction = (v) => {
1266
- return v && typeof v.match === "function";
1267
- };
1268
- function createAction(type, prepareAction) {
1269
- function actionCreator(...args) {
1270
- if (prepareAction) {
1271
- let prepared = prepareAction(...args);
1272
- if (!prepared) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(0) : "prepareAction did not return an object");
1273
- return {
1274
- type,
1275
- payload: prepared.payload,
1276
- ..."meta" in prepared && { meta: prepared.meta },
1277
- ..."error" in prepared && { error: prepared.error }
1278
- };
1279
- }
1280
- return {
1281
- type,
1282
- payload: args[0]
1283
- };
1284
- }
1285
- actionCreator.toString = () => `${type}`;
1286
- actionCreator.type = type;
1287
- actionCreator.match = (action) => action != null && action.type === type && isAction(action);
1288
- return actionCreator;
1289
- }
1290
- function isFSA(action) {
1291
- return isAction(action) && Object.keys(action).every(isValidKey);
1292
- }
1293
- function isValidKey(key) {
1294
- return [
1295
- "type",
1296
- "payload",
1297
- "error",
1298
- "meta"
1299
- ].indexOf(key) > -1;
1300
- }
1301
- function freezeDraftable(val) {
1302
- return isDraftable(val) ? produce(val, () => {
1303
- }) : val;
1304
- }
1305
- function getOrInsertComputed(map, key, compute) {
1306
- if (map.has(key)) return map.get(key);
1307
- return map.set(key, compute(key)).get(key);
1308
- }
1309
- function executeReducerBuilderCallback(builderCallback) {
1310
- const actionsMap = {};
1311
- const actionMatchers = [];
1312
- let defaultCaseReducer;
1313
- const builder = {
1314
- addCase(typeOrActionCreator, reducer) {
1315
- if (process.env.NODE_ENV !== "production") {
1316
- if (actionMatchers.length > 0) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(26) : "`builder.addCase` should only be called before calling `builder.addMatcher`");
1317
- if (defaultCaseReducer) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(27) : "`builder.addCase` should only be called before calling `builder.addDefaultCase`");
1318
- }
1319
- const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
1320
- if (!type) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(28) : "`builder.addCase` cannot be called with an empty action type");
1321
- if (type in actionsMap) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(29) : `\`builder.addCase\` cannot be called with two reducers for the same action type '${type}'`);
1322
- actionsMap[type] = reducer;
1323
- return builder;
1324
- },
1325
- addAsyncThunk(asyncThunk, reducers) {
1326
- if (process.env.NODE_ENV !== "production") {
1327
- if (defaultCaseReducer) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(43) : "`builder.addAsyncThunk` should only be called before calling `builder.addDefaultCase`");
1328
- }
1329
- if (reducers.pending) actionsMap[asyncThunk.pending.type] = reducers.pending;
1330
- if (reducers.rejected) actionsMap[asyncThunk.rejected.type] = reducers.rejected;
1331
- if (reducers.fulfilled) actionsMap[asyncThunk.fulfilled.type] = reducers.fulfilled;
1332
- if (reducers.settled) actionMatchers.push({
1333
- matcher: asyncThunk.settled,
1334
- reducer: reducers.settled
1335
- });
1336
- return builder;
1337
- },
1338
- addMatcher(matcher, reducer) {
1339
- if (process.env.NODE_ENV !== "production") {
1340
- if (defaultCaseReducer) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(30) : "`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
1341
- }
1342
- actionMatchers.push({
1343
- matcher,
1344
- reducer
1345
- });
1346
- return builder;
1347
- },
1348
- addDefaultCase(reducer) {
1349
- if (process.env.NODE_ENV !== "production") {
1350
- if (defaultCaseReducer) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(31) : "`builder.addDefaultCase` can only be called once");
1351
- }
1352
- defaultCaseReducer = reducer;
1353
- return builder;
1354
- }
1355
- };
1356
- builderCallback(builder);
1357
- return [
1358
- actionsMap,
1359
- actionMatchers,
1360
- defaultCaseReducer
1361
- ];
1362
- }
1363
- function isStateFunction(x) {
1364
- return typeof x === "function";
1365
- }
1366
- function createReducer(initialState, mapOrBuilderCallback) {
1367
- if (process.env.NODE_ENV !== "production") {
1368
- if (typeof mapOrBuilderCallback === "object") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(8) : "The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");
1369
- }
1370
- let [actionsMap, finalActionMatchers, finalDefaultCaseReducer] = executeReducerBuilderCallback(mapOrBuilderCallback);
1371
- let getInitialState;
1372
- if (isStateFunction(initialState)) getInitialState = () => freezeDraftable(initialState());
1373
- else {
1374
- const frozenInitialState = freezeDraftable(initialState);
1375
- getInitialState = () => frozenInitialState;
1376
- }
1377
- function applyCaseReducer(previousState, caseReducer, action) {
1378
- if (isDraft(previousState)) {
1379
- const result = caseReducer(previousState, action);
1380
- if (result === void 0) return previousState;
1381
- return result;
1382
- } else if (!isDraftable(previousState)) {
1383
- const result = caseReducer(previousState, action);
1384
- if (result === void 0) {
1385
- if (previousState === null) return previousState;
1386
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(9) : "A case reducer on a non-draftable value must not return undefined");
1387
- }
1388
- return result;
1389
- } else return produce(previousState, (draft) => {
1390
- return caseReducer(draft, action);
1391
- });
1392
- }
1393
- function reducer(state = getInitialState(), action) {
1394
- const caseReducer = actionsMap[action.type];
1395
- let matchedReducers;
1396
- for (const { matcher, reducer: reducer2 } of finalActionMatchers) if (matcher(action) && reducer2) (matchedReducers ??= []).push(reducer2);
1397
- if (!caseReducer && !matchedReducers) return finalDefaultCaseReducer ? applyCaseReducer(state, finalDefaultCaseReducer, action) : state;
1398
- if (caseReducer) state = applyCaseReducer(state, caseReducer, action);
1399
- if (matchedReducers) for (const matchedReducer of matchedReducers) state = applyCaseReducer(state, matchedReducer, action);
1400
- return state;
1401
- }
1402
- reducer.getInitialState = getInitialState;
1403
- return reducer;
1404
- }
1405
- var matches = (matcher, action) => {
1406
- if (hasMatchFunction(matcher)) return matcher.match(action);
1407
- else return matcher(action);
1408
- };
1409
- function isAnyOf(...matchers) {
1410
- return (action) => {
1411
- return matchers.some((matcher) => matches(matcher, action));
1412
- };
1413
- }
1414
- var urlAlphabet = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW";
1415
- var nanoid = (size = 21) => {
1416
- let id = "";
1417
- let i = size;
1418
- while (i--) id += urlAlphabet[Math.random() * 64 | 0];
1419
- return id;
1420
- };
1421
- var commonProperties = [
1422
- "name",
1423
- "message",
1424
- "stack",
1425
- "code"
1426
- ];
1427
- var RejectWithValue = class {
1428
- payload;
1429
- meta;
1430
- _type;
1431
- constructor(payload, meta) {
1432
- this.payload = payload;
1433
- this.meta = meta;
1434
- }
1435
- };
1436
- var FulfillWithMeta = class {
1437
- payload;
1438
- meta;
1439
- _type;
1440
- constructor(payload, meta) {
1441
- this.payload = payload;
1442
- this.meta = meta;
1443
- }
1444
- };
1445
- var miniSerializeError = (value) => {
1446
- if (typeof value === "object" && value !== null) {
1447
- const simpleError = {};
1448
- for (const property of commonProperties) if (typeof value[property] === "string") simpleError[property] = value[property];
1449
- return simpleError;
1450
- }
1451
- return { message: String(value) };
1452
- };
1453
- var externalAbortMessage = "External signal was aborted";
1454
- var createAsyncThunk = /* @__PURE__ */ (() => {
1455
- function createAsyncThunk2(typePrefix, payloadCreator, options) {
1456
- const fulfilled = createAction(typePrefix + "/fulfilled", (payload, requestId, arg, meta) => ({
1457
- payload,
1458
- meta: {
1459
- ...meta || {},
1460
- arg,
1461
- requestId,
1462
- requestStatus: "fulfilled"
1463
- }
1464
- }));
1465
- const pending = createAction(typePrefix + "/pending", (requestId, arg, meta) => ({
1466
- payload: void 0,
1467
- meta: {
1468
- ...meta || {},
1469
- arg,
1470
- requestId,
1471
- requestStatus: "pending"
1472
- }
1473
- }));
1474
- const rejected = createAction(typePrefix + "/rejected", (error, requestId, arg, payload, meta) => ({
1475
- payload,
1476
- error: (options && options.serializeError || miniSerializeError)(error || "Rejected"),
1477
- meta: {
1478
- ...meta || {},
1479
- arg,
1480
- requestId,
1481
- rejectedWithValue: payload !== void 0,
1482
- requestStatus: "rejected",
1483
- aborted: error?.name === "AbortError",
1484
- condition: error?.name === "ConditionError"
1485
- }
1486
- }));
1487
- function actionCreator(arg, { signal } = {}) {
1488
- return (dispatch, getState, extra) => {
1489
- const requestId = options?.idGenerator ? options.idGenerator(arg) : nanoid();
1490
- const abortController = new AbortController();
1491
- let abortHandler;
1492
- let abortReason;
1493
- function abort(reason) {
1494
- abortReason = reason;
1495
- abortController.abort();
1496
- }
1497
- if (signal) {
1498
- if (signal.aborted) abort(externalAbortMessage);
1499
- else signal.addEventListener("abort", () => abort(externalAbortMessage), { once: true });
1500
- }
1501
- const promise = async function() {
1502
- let finalAction;
1503
- try {
1504
- let conditionResult = options?.condition?.(arg, {
1505
- getState,
1506
- extra
1507
- });
1508
- if (isThenable(conditionResult)) conditionResult = await conditionResult;
1509
- if (conditionResult === false) throw {
1510
- name: "ConditionError",
1511
- message: "Aborted due to condition callback returning false."
1512
- };
1513
- if (abortController.signal.aborted) throw {
1514
- name: "AbortError",
1515
- message: abortReason || "Aborted"
1516
- };
1517
- const abortedPromise = new Promise((_, reject) => {
1518
- abortHandler = () => {
1519
- reject({
1520
- name: "AbortError",
1521
- message: abortReason || "Aborted"
1522
- });
1523
- };
1524
- abortController.signal.addEventListener("abort", abortHandler, { once: true });
1525
- });
1526
- dispatch(pending(requestId, arg, options?.getPendingMeta?.({
1527
- requestId,
1528
- arg
1529
- }, {
1530
- getState,
1531
- extra
1532
- })));
1533
- finalAction = await Promise.race([abortedPromise, Promise.resolve(payloadCreator(arg, {
1534
- dispatch,
1535
- getState,
1536
- extra,
1537
- requestId,
1538
- signal: abortController.signal,
1539
- abort,
1540
- rejectWithValue: (value, meta) => {
1541
- return new RejectWithValue(value, meta);
1542
- },
1543
- fulfillWithValue: (value, meta) => {
1544
- return new FulfillWithMeta(value, meta);
1545
- }
1546
- })).then((result) => {
1547
- if (result instanceof RejectWithValue) throw result;
1548
- if (result instanceof FulfillWithMeta) return fulfilled(result.payload, requestId, arg, result.meta);
1549
- return fulfilled(result, requestId, arg);
1550
- })]);
1551
- } catch (err) {
1552
- finalAction = err instanceof RejectWithValue ? rejected(null, requestId, arg, err.payload, err.meta) : rejected(err, requestId, arg);
1553
- } finally {
1554
- if (abortHandler) abortController.signal.removeEventListener("abort", abortHandler);
1555
- }
1556
- if (!(options && !options.dispatchConditionRejection && rejected.match(finalAction) && finalAction.meta.condition)) dispatch(finalAction);
1557
- return finalAction;
1558
- }();
1559
- return Object.assign(promise, {
1560
- abort,
1561
- requestId,
1562
- arg,
1563
- unwrap() {
1564
- return promise.then(unwrapResult);
1565
- }
1566
- });
1567
- };
1568
- }
1569
- return Object.assign(actionCreator, {
1570
- pending,
1571
- rejected,
1572
- fulfilled,
1573
- settled: isAnyOf(rejected, fulfilled),
1574
- typePrefix
1575
- });
1576
- }
1577
- createAsyncThunk2.withTypes = () => createAsyncThunk2;
1578
- return createAsyncThunk2;
1579
- })();
1580
- function unwrapResult(action) {
1581
- if (action.meta && action.meta.rejectedWithValue) throw action.payload;
1582
- if (action.error) throw action.error;
1583
- return action.payload;
1584
- }
1585
- function isThenable(value) {
1586
- return value !== null && typeof value === "object" && typeof value.then === "function";
1587
- }
1588
- var asyncThunkSymbol = /* @__PURE__ */ Symbol.for("rtk-slice-createasyncthunk");
1589
- var asyncThunkCreator = /* @__PURE__ */ (() => ({ [asyncThunkSymbol]: createAsyncThunk }))();
1590
- function getType(slice, actionKey) {
1591
- return `${slice}/${actionKey}`;
1592
- }
1593
- function buildCreateSlice({ creators } = {}) {
1594
- const cAT = creators?.asyncThunk?.[asyncThunkSymbol];
1595
- return function createSlice(options) {
1596
- const { name, reducerPath = name } = options;
1597
- if (!name) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(11) : "`name` is a required option for createSlice");
1598
- if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
1599
- if (options.initialState === void 0) console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");
1600
- }
1601
- const reducers = (typeof options.reducers === "function" ? options.reducers(buildReducerCreators()) : options.reducers) || {};
1602
- const reducerNames = Object.keys(reducers);
1603
- const context = {
1604
- sliceCaseReducersByName: {},
1605
- sliceCaseReducersByType: {},
1606
- actionCreators: {},
1607
- sliceMatchers: []
1608
- };
1609
- const contextMethods = {
1610
- addCase(typeOrActionCreator, reducer2) {
1611
- const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
1612
- if (!type) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : "`context.addCase` cannot be called with an empty action type");
1613
- if (type in context.sliceCaseReducersByType) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : "`context.addCase` cannot be called with two reducers for the same action type: " + type);
1614
- context.sliceCaseReducersByType[type] = reducer2;
1615
- return contextMethods;
1616
- },
1617
- addMatcher(matcher, reducer2) {
1618
- context.sliceMatchers.push({
1619
- matcher,
1620
- reducer: reducer2
1621
- });
1622
- return contextMethods;
1623
- },
1624
- exposeAction(name2, actionCreator) {
1625
- context.actionCreators[name2] = actionCreator;
1626
- return contextMethods;
1627
- },
1628
- exposeCaseReducer(name2, reducer2) {
1629
- context.sliceCaseReducersByName[name2] = reducer2;
1630
- return contextMethods;
1631
- }
1632
- };
1633
- reducerNames.forEach((reducerName) => {
1634
- const reducerDefinition = reducers[reducerName];
1635
- const reducerDetails = {
1636
- reducerName,
1637
- type: getType(name, reducerName),
1638
- createNotation: typeof options.reducers === "function"
1639
- };
1640
- if (isAsyncThunkSliceReducerDefinition(reducerDefinition)) handleThunkCaseReducerDefinition(reducerDetails, reducerDefinition, contextMethods, cAT);
1641
- else handleNormalReducerDefinition(reducerDetails, reducerDefinition, contextMethods);
1642
- });
1643
- function buildReducer() {
1644
- if (process.env.NODE_ENV !== "production") {
1645
- if (typeof options.extraReducers === "object") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : "The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");
1646
- }
1647
- const [extraReducers = {}, actionMatchers = [], defaultCaseReducer = void 0] = typeof options.extraReducers === "function" ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers];
1648
- const finalCaseReducers = {
1649
- ...extraReducers,
1650
- ...context.sliceCaseReducersByType
1651
- };
1652
- return createReducer(options.initialState, (builder) => {
1653
- for (let key in finalCaseReducers) builder.addCase(key, finalCaseReducers[key]);
1654
- for (let sM of context.sliceMatchers) builder.addMatcher(sM.matcher, sM.reducer);
1655
- for (let m of actionMatchers) builder.addMatcher(m.matcher, m.reducer);
1656
- if (defaultCaseReducer) builder.addDefaultCase(defaultCaseReducer);
1657
- });
1658
- }
1659
- const selectSelf = (state) => state;
1660
- const injectedSelectorCache = /* @__PURE__ */ new Map();
1661
- const injectedStateCache = /* @__PURE__ */ new WeakMap();
1662
- let _reducer;
1663
- function reducer(state, action) {
1664
- if (!_reducer) _reducer = buildReducer();
1665
- return _reducer(state, action);
1666
- }
1667
- function getInitialState() {
1668
- if (!_reducer) _reducer = buildReducer();
1669
- return _reducer.getInitialState();
1670
- }
1671
- function makeSelectorProps(reducerPath2, injected = false) {
1672
- function selectSlice(state) {
1673
- let sliceState = state[reducerPath2];
1674
- if (typeof sliceState === "undefined") {
1675
- if (injected) sliceState = getOrInsertComputed(injectedStateCache, selectSlice, getInitialState);
1676
- else if (process.env.NODE_ENV !== "production") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(15) : "selectSlice returned undefined for an uninjected slice reducer");
1677
- }
1678
- return sliceState;
1679
- }
1680
- function getSelectors(selectState = selectSelf) {
1681
- return getOrInsertComputed(getOrInsertComputed(injectedSelectorCache, injected, () => /* @__PURE__ */ new WeakMap()), selectState, () => {
1682
- const map = {};
1683
- for (const [name2, selector] of Object.entries(options.selectors ?? {})) map[name2] = wrapSelector(selector, selectState, () => getOrInsertComputed(injectedStateCache, selectState, getInitialState), injected);
1684
- return map;
1685
- });
1686
- }
1687
- return {
1688
- reducerPath: reducerPath2,
1689
- getSelectors,
1690
- get selectors() {
1691
- return getSelectors(selectSlice);
1692
- },
1693
- selectSlice
1694
- };
1695
- }
1696
- const slice = {
1697
- name,
1698
- reducer,
1699
- actions: context.actionCreators,
1700
- caseReducers: context.sliceCaseReducersByName,
1701
- getInitialState,
1702
- ...makeSelectorProps(reducerPath),
1703
- injectInto(injectable, { reducerPath: pathOpt, ...config } = {}) {
1704
- const newReducerPath = pathOpt ?? reducerPath;
1705
- injectable.inject({
1706
- reducerPath: newReducerPath,
1707
- reducer
1708
- }, config);
1709
- return {
1710
- ...slice,
1711
- ...makeSelectorProps(newReducerPath, true)
1712
- };
1713
- }
1714
- };
1715
- return slice;
1716
- };
1717
- }
1718
- function wrapSelector(selector, selectState, getInitialState, injected) {
1719
- function wrapper(rootState, ...args) {
1720
- let sliceState = selectState(rootState);
1721
- if (typeof sliceState === "undefined") {
1722
- if (injected) sliceState = getInitialState();
1723
- else if (process.env.NODE_ENV !== "production") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(16) : "selectState returned undefined for an uninjected slice reducer");
1724
- }
1725
- return selector(sliceState, ...args);
1726
- }
1727
- wrapper.unwrapped = selector;
1728
- return wrapper;
1729
- }
1730
- function buildReducerCreators() {
1731
- function asyncThunk(payloadCreator, config) {
1732
- return {
1733
- _reducerDefinitionType: "asyncThunk",
1734
- payloadCreator,
1735
- ...config
1736
- };
1737
- }
1738
- asyncThunk.withTypes = () => asyncThunk;
1739
- return {
1740
- reducer(caseReducer) {
1741
- return Object.assign({ [caseReducer.name](...args) {
1742
- return caseReducer(...args);
1743
- } }[caseReducer.name], { _reducerDefinitionType: "reducer" });
1744
- },
1745
- preparedReducer(prepare, reducer) {
1746
- return {
1747
- _reducerDefinitionType: "reducerWithPrepare",
1748
- prepare,
1749
- reducer
1750
- };
1751
- },
1752
- asyncThunk
1753
- };
1754
- }
1755
- function handleNormalReducerDefinition({ type, reducerName, createNotation }, maybeReducerWithPrepare, context) {
1756
- let caseReducer;
1757
- let prepareCallback;
1758
- if ("reducer" in maybeReducerWithPrepare) {
1759
- if (createNotation && !isCaseReducerWithPrepareDefinition(maybeReducerWithPrepare)) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(17) : "Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");
1760
- caseReducer = maybeReducerWithPrepare.reducer;
1761
- prepareCallback = maybeReducerWithPrepare.prepare;
1762
- } else caseReducer = maybeReducerWithPrepare;
1763
- context.addCase(type, caseReducer).exposeCaseReducer(reducerName, caseReducer).exposeAction(reducerName, prepareCallback ? createAction(type, prepareCallback) : createAction(type));
1764
- }
1765
- function isAsyncThunkSliceReducerDefinition(reducerDefinition) {
1766
- return reducerDefinition._reducerDefinitionType === "asyncThunk";
1767
- }
1768
- function isCaseReducerWithPrepareDefinition(reducerDefinition) {
1769
- return reducerDefinition._reducerDefinitionType === "reducerWithPrepare";
1770
- }
1771
- function handleThunkCaseReducerDefinition({ type, reducerName }, reducerDefinition, context, cAT) {
1772
- if (!cAT) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(18) : "Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");
1773
- const { payloadCreator, fulfilled, pending, rejected, settled, options } = reducerDefinition;
1774
- const thunk = cAT(type, payloadCreator, options);
1775
- context.exposeAction(reducerName, thunk);
1776
- if (fulfilled) context.addCase(thunk.fulfilled, fulfilled);
1777
- if (pending) context.addCase(thunk.pending, pending);
1778
- if (rejected) context.addCase(thunk.rejected, rejected);
1779
- if (settled) context.addMatcher(thunk.settled, settled);
1780
- context.exposeCaseReducer(reducerName, {
1781
- fulfilled: fulfilled || noop$1,
1782
- pending: pending || noop$1,
1783
- rejected: rejected || noop$1,
1784
- settled: settled || noop$1
1785
- });
1786
- }
1787
- function noop$1() {
1788
- }
1789
- function getInitialEntityState() {
1790
- return {
1791
- ids: [],
1792
- entities: {}
1793
- };
1794
- }
1795
- function createInitialStateFactory(stateAdapter) {
1796
- function getInitialState(additionalState = {}, entities) {
1797
- const state = Object.assign(getInitialEntityState(), additionalState);
1798
- return entities ? stateAdapter.setAll(state, entities) : state;
1799
- }
1800
- return { getInitialState };
1801
- }
1802
- function createSelectorsFactory() {
1803
- function getSelectors(selectState, options = {}) {
1804
- const { createSelector: createSelector2 = createDraftSafeSelector } = options;
1805
- const selectIds = (state) => state.ids;
1806
- const selectEntities = (state) => state.entities;
1807
- const selectAll = createSelector2(selectIds, selectEntities, (ids, entities) => ids.map((id) => entities[id]));
1808
- const selectId = (_, id) => id;
1809
- const selectById = (entities, id) => entities[id];
1810
- const selectTotal = createSelector2(selectIds, (ids) => ids.length);
1811
- const selectIdsArg = (_, ids) => ids;
1812
- const selectByIds = (entities, ids) => {
1813
- const result = [];
1814
- for (const id of ids) {
1815
- const entity = entities[id];
1816
- if (entity !== void 0) result.push(entity);
1817
- }
1818
- return result;
1819
- };
1820
- if (!selectState) return {
1821
- selectIds,
1822
- selectEntities,
1823
- selectAll,
1824
- selectTotal,
1825
- selectById: createSelector2(selectEntities, selectId, selectById),
1826
- selectByIds: createSelector2(selectEntities, selectIdsArg, selectByIds)
1827
- };
1828
- const selectGlobalizedEntities = createSelector2(selectState, selectEntities);
1829
- return {
1830
- selectIds: createSelector2(selectState, selectIds),
1831
- selectEntities: selectGlobalizedEntities,
1832
- selectAll: createSelector2(selectState, selectAll),
1833
- selectTotal: createSelector2(selectState, selectTotal),
1834
- selectById: createSelector2(selectGlobalizedEntities, selectId, selectById),
1835
- selectByIds: createSelector2(selectGlobalizedEntities, selectIdsArg, selectByIds)
1836
- };
1837
- }
1838
- return { getSelectors };
1839
- }
1840
- var isDraftTyped = isDraft;
1841
- function createSingleArgumentStateOperator(mutator) {
1842
- const operator = createStateOperator((_, state) => mutator(state));
1843
- return function operation(state) {
1844
- return operator(state, void 0);
1845
- };
1846
- }
1847
- function createStateOperator(mutator) {
1848
- return function operation(state, arg) {
1849
- function isPayloadActionArgument(arg2) {
1850
- return isFSA(arg2);
1851
- }
1852
- const runMutator = (draft) => {
1853
- if (isPayloadActionArgument(arg)) mutator(arg.payload, draft);
1854
- else mutator(arg, draft);
1855
- };
1856
- if (isDraftTyped(state)) {
1857
- runMutator(state);
1858
- return state;
1859
- }
1860
- return produce(state, runMutator);
1861
- };
1862
- }
1863
- function selectIdValue(entity, selectId) {
1864
- const key = selectId(entity);
1865
- if (process.env.NODE_ENV !== "production" && key === void 0) console.warn("The entity passed to the `selectId` implementation returned undefined.", "You should probably provide your own `selectId` implementation.", "The entity that was passed:", entity, "The `selectId` implementation:", selectId.toString());
1866
- return key;
1867
- }
1868
- function ensureEntitiesArray(entities) {
1869
- if (!Array.isArray(entities)) entities = Object.values(entities);
1870
- return entities;
1871
- }
1872
- function isRemoveManyFilter(keysOrFilter) {
1873
- return !Array.isArray(keysOrFilter);
1874
- }
1875
- function getCurrent(value) {
1876
- return isDraft(value) ? current(value) : value;
1877
- }
1878
- function splitAddedUpdatedEntities(newEntities, selectId, state) {
1879
- newEntities = ensureEntitiesArray(newEntities);
1880
- const existingIdsArray = getCurrent(state.ids);
1881
- const existingIds = new Set(existingIdsArray);
1882
- const added = [];
1883
- const addedIds = /* @__PURE__ */ new Set([]);
1884
- const updated = [];
1885
- for (const entity of newEntities) {
1886
- const id = selectIdValue(entity, selectId);
1887
- if (existingIds.has(id) || addedIds.has(id)) updated.push({
1888
- id,
1889
- changes: entity
1890
- });
1891
- else {
1892
- addedIds.add(id);
1893
- added.push(entity);
1894
- }
1895
- }
1896
- return [
1897
- added,
1898
- updated,
1899
- existingIdsArray
1900
- ];
1901
- }
1902
- function createUnsortedStateAdapter(selectId) {
1903
- function addOneMutably(entity, state) {
1904
- const key = selectIdValue(entity, selectId);
1905
- if (key in state.entities) return;
1906
- state.ids.push(key);
1907
- state.entities[key] = entity;
1908
- }
1909
- function addManyMutably(newEntities, state) {
1910
- newEntities = ensureEntitiesArray(newEntities);
1911
- for (const entity of newEntities) addOneMutably(entity, state);
1912
- }
1913
- function setOneMutably(entity, state) {
1914
- const key = selectIdValue(entity, selectId);
1915
- if (!(key in state.entities)) state.ids.push(key);
1916
- state.entities[key] = entity;
1917
- }
1918
- function setManyMutably(newEntities, state) {
1919
- newEntities = ensureEntitiesArray(newEntities);
1920
- for (const entity of newEntities) setOneMutably(entity, state);
1921
- }
1922
- function setAllMutably(newEntities, state) {
1923
- newEntities = ensureEntitiesArray(newEntities);
1924
- state.ids = [];
1925
- state.entities = {};
1926
- setManyMutably(newEntities, state);
1927
- }
1928
- function removeOneMutably(key, state) {
1929
- return removeManyMutably([key], state);
1930
- }
1931
- function removeManyMutably(keysOrFilter, state) {
1932
- const keys = isRemoveManyFilter(keysOrFilter) ? selectMatchingIds(keysOrFilter.where, state) : keysOrFilter;
1933
- const removedIds = /* @__PURE__ */ new Set();
1934
- for (const key of keys) if (key in state.entities) {
1935
- delete state.entities[key];
1936
- removedIds.add(String(key));
1937
- }
1938
- if (removedIds.size > 0) state.ids = getCurrent(state.ids).filter((id) => !removedIds.has(String(id)));
1939
- }
1940
- function selectMatchingIds(where, state) {
1941
- const ids = getCurrent(state.ids);
1942
- const entities = getCurrent(state.entities);
1943
- const whereKeys = Object.keys(where);
1944
- if (whereKeys.length === 0) return [];
1945
- return ids.filter((id) => {
1946
- const entity = entities[id];
1947
- return whereKeys.every((key) => entity[key] === where[key]);
1948
- });
1949
- }
1950
- function removeAllMutably(state) {
1951
- Object.assign(state, {
1952
- ids: [],
1953
- entities: {}
1954
- });
1955
- }
1956
- function takeNewKey(keys, update, state) {
1957
- const original2 = state.entities[update.id];
1958
- if (original2 === void 0) return false;
1959
- const updated = Object.assign({}, original2, update.changes);
1960
- const newKey = selectIdValue(updated, selectId);
1961
- const hasNewKey = newKey !== update.id;
1962
- if (hasNewKey) {
1963
- keys[update.id] = newKey;
1964
- delete state.entities[update.id];
1965
- }
1966
- state.entities[newKey] = updated;
1967
- return hasNewKey;
1968
- }
1969
- function updateOneMutably(update, state) {
1970
- return updateManyMutably([update], state);
1971
- }
1972
- function updateManyMutably(updates, state) {
1973
- const newKeys = {};
1974
- const updatesPerEntity = {};
1975
- updates.forEach((update) => {
1976
- if (update.id in state.entities) updatesPerEntity[update.id] = {
1977
- id: update.id,
1978
- changes: {
1979
- ...updatesPerEntity[update.id]?.changes,
1980
- ...update.changes
1981
- }
1982
- };
1983
- });
1984
- updates = Object.values(updatesPerEntity);
1985
- if (updates.length > 0) {
1986
- if (updates.filter((update) => takeNewKey(newKeys, update, state)).length > 0) {
1987
- const ids = /* @__PURE__ */ new Set();
1988
- for (const id of state.ids) {
1989
- const newId = newKeys[id] ?? id;
1990
- if (newId in state.entities) ids.add(newId);
1991
- }
1992
- state.ids = Array.from(ids);
1993
- }
1994
- }
1995
- }
1996
- function upsertOneMutably(entity, state) {
1997
- return upsertManyMutably([entity], state);
1998
- }
1999
- function upsertManyMutably(newEntities, state) {
2000
- const [added, updated] = splitAddedUpdatedEntities(newEntities, selectId, state);
2001
- addManyMutably(added, state);
2002
- updateManyMutably(updated, state);
2003
- }
2004
- return {
2005
- removeAll: createSingleArgumentStateOperator(removeAllMutably),
2006
- addOne: createStateOperator(addOneMutably),
2007
- addMany: createStateOperator(addManyMutably),
2008
- setOne: createStateOperator(setOneMutably),
2009
- setMany: createStateOperator(setManyMutably),
2010
- setAll: createStateOperator(setAllMutably),
2011
- updateOne: createStateOperator(updateOneMutably),
2012
- updateMany: createStateOperator(updateManyMutably),
2013
- upsertOne: createStateOperator(upsertOneMutably),
2014
- upsertMany: createStateOperator(upsertManyMutably),
2015
- removeOne: createStateOperator(removeOneMutably),
2016
- removeMany: createStateOperator(removeManyMutably)
2017
- };
2018
- }
2019
- function findInsertIndex(sortedItems, item, comparisonFunction) {
2020
- let lowIndex = 0;
2021
- let highIndex = sortedItems.length;
2022
- while (lowIndex < highIndex) {
2023
- let middleIndex = lowIndex + highIndex >>> 1;
2024
- const currentItem = sortedItems[middleIndex];
2025
- if (comparisonFunction(item, currentItem) >= 0) lowIndex = middleIndex + 1;
2026
- else highIndex = middleIndex;
2027
- }
2028
- return lowIndex;
2029
- }
2030
- function insert(sortedItems, item, comparisonFunction) {
2031
- const insertAtIndex = findInsertIndex(sortedItems, item, comparisonFunction);
2032
- sortedItems.splice(insertAtIndex, 0, item);
2033
- return sortedItems;
2034
- }
2035
- function createSortedStateAdapter(selectId, comparer) {
2036
- const { removeOne, removeMany, removeAll } = createUnsortedStateAdapter(selectId);
2037
- function addOneMutably(entity, state) {
2038
- return addManyMutably([entity], state);
2039
- }
2040
- function addManyMutably(newEntities, state, existingIds) {
2041
- newEntities = ensureEntitiesArray(newEntities);
2042
- const existingKeys = new Set(existingIds ?? getCurrent(state.ids));
2043
- const addedKeys = /* @__PURE__ */ new Set();
2044
- const models = newEntities.filter((model) => {
2045
- const modelId = selectIdValue(model, selectId);
2046
- const notAdded = !addedKeys.has(modelId);
2047
- if (notAdded) addedKeys.add(modelId);
2048
- return !existingKeys.has(modelId) && notAdded;
2049
- });
2050
- if (models.length !== 0) mergeFunction(state, models);
2051
- }
2052
- function setOneMutably(entity, state) {
2053
- return setManyMutably([entity], state);
2054
- }
2055
- function setManyMutably(newEntities, state) {
2056
- let deduplicatedEntities = {};
2057
- newEntities = ensureEntitiesArray(newEntities);
2058
- if (newEntities.length !== 0) {
2059
- for (const item of newEntities) {
2060
- const entityId = selectId(item);
2061
- deduplicatedEntities[entityId] = item;
2062
- delete state.entities[entityId];
2063
- }
2064
- newEntities = ensureEntitiesArray(deduplicatedEntities);
2065
- mergeFunction(state, newEntities);
2066
- }
2067
- }
2068
- function setAllMutably(newEntities, state) {
2069
- newEntities = ensureEntitiesArray(newEntities);
2070
- state.entities = {};
2071
- state.ids = [];
2072
- setManyMutably(newEntities, state);
2073
- }
2074
- function updateOneMutably(update, state) {
2075
- return updateManyMutably([update], state);
2076
- }
2077
- function updateManyMutably(updates, state) {
2078
- let appliedUpdates = false;
2079
- let replacedIds = false;
2080
- const updatesPerEntity = {};
2081
- for (const update of updates) if (update.id in state.entities) updatesPerEntity[update.id] = {
2082
- id: update.id,
2083
- changes: {
2084
- ...updatesPerEntity[update.id]?.changes,
2085
- ...update.changes
2086
- }
2087
- };
2088
- for (const update of Object.values(updatesPerEntity)) {
2089
- const entity = state.entities[update.id];
2090
- if (!entity) continue;
2091
- appliedUpdates = true;
2092
- Object.assign(entity, update.changes);
2093
- const newId = selectId(entity);
2094
- if (update.id !== newId) {
2095
- replacedIds = true;
2096
- delete state.entities[update.id];
2097
- const oldIndex = state.ids.indexOf(update.id);
2098
- state.ids[oldIndex] = newId;
2099
- state.entities[newId] = entity;
2100
- }
2101
- }
2102
- if (appliedUpdates) mergeFunction(state, [], appliedUpdates, replacedIds);
2103
- }
2104
- function upsertOneMutably(entity, state) {
2105
- return upsertManyMutably([entity], state);
2106
- }
2107
- function upsertManyMutably(newEntities, state) {
2108
- const [added, updated, existingIdsArray] = splitAddedUpdatedEntities(newEntities, selectId, state);
2109
- if (added.length) addManyMutably(added, state, existingIdsArray);
2110
- if (updated.length) updateManyMutably(updated, state);
2111
- }
2112
- function areArraysEqual(a, b) {
2113
- if (a.length !== b.length) return false;
2114
- for (let i = 0; i < a.length; i++) {
2115
- if (a[i] === b[i]) continue;
2116
- return false;
2117
- }
2118
- return true;
2119
- }
2120
- function mergeFunction(state, addedItems, appliedUpdates, replacedIds) {
2121
- const currentEntities = getCurrent(state.entities);
2122
- const currentIds = getCurrent(state.ids);
2123
- const stateEntities = state.entities;
2124
- let ids = currentIds;
2125
- if (replacedIds) ids = new Set(currentIds);
2126
- let sortedEntities = [];
2127
- for (const id of ids) {
2128
- const entity = currentEntities[id];
2129
- if (entity) sortedEntities.push(entity);
2130
- }
2131
- const wasPreviouslyEmpty = sortedEntities.length === 0;
2132
- for (const item of addedItems) {
2133
- stateEntities[selectId(item)] = item;
2134
- if (!wasPreviouslyEmpty) insert(sortedEntities, item, comparer);
2135
- }
2136
- if (wasPreviouslyEmpty) sortedEntities = addedItems.slice().sort(comparer);
2137
- else if (appliedUpdates) sortedEntities.sort(comparer);
2138
- const newSortedIds = sortedEntities.map(selectId);
2139
- if (!areArraysEqual(currentIds, newSortedIds)) state.ids = newSortedIds;
2140
- }
2141
- return {
2142
- removeOne,
2143
- removeMany,
2144
- removeAll,
2145
- addOne: createStateOperator(addOneMutably),
2146
- updateOne: createStateOperator(updateOneMutably),
2147
- upsertOne: createStateOperator(upsertOneMutably),
2148
- setOne: createStateOperator(setOneMutably),
2149
- setMany: createStateOperator(setManyMutably),
2150
- setAll: createStateOperator(setAllMutably),
2151
- addMany: createStateOperator(addManyMutably),
2152
- updateMany: createStateOperator(updateManyMutably),
2153
- upsertMany: createStateOperator(upsertManyMutably)
2154
- };
2155
- }
2156
- function createEntityAdapter(options = {}) {
2157
- const { selectId, sortComparer } = {
2158
- sortComparer: false,
2159
- selectId: (instance) => instance.id,
2160
- ...options
2161
- };
2162
- const stateAdapter = sortComparer ? createSortedStateAdapter(selectId, sortComparer) : createUnsortedStateAdapter(selectId);
2163
- const stateFactory = createInitialStateFactory(stateAdapter);
2164
- const selectorsFactory = createSelectorsFactory();
2165
- return {
2166
- selectId,
2167
- sortComparer,
2168
- ...stateFactory,
2169
- ...selectorsFactory,
2170
- ...stateAdapter
2171
- };
2172
- }
2173
- var listener = "listener";
2174
- var completed = "completed";
2175
- var cancelled = "cancelled";
2176
- var taskCancelled = `task-${cancelled}`;
2177
- var taskCompleted = `task-${completed}`;
2178
- var listenerCancelled = `${listener}-${cancelled}`;
2179
- var listenerCompleted = `${listener}-${completed}`;
2180
- var { assign } = Object;
2181
- var alm = "listenerMiddleware";
2182
- var addListener = /* @__PURE__ */ assign(/* @__PURE__ */ createAction(`${alm}/add`), { withTypes: () => addListener });
2183
- var clearAllListeners = /* @__PURE__ */ createAction(`${alm}/removeAll`);
2184
- var removeListener = /* @__PURE__ */ assign(/* @__PURE__ */ createAction(`${alm}/remove`), { withTypes: () => removeListener });
2185
- var ORIGINAL_STATE = Symbol.for("rtk-state-proxy-original");
2186
- function formatProdErrorMessage(code) {
2187
- return `Minified Redux Toolkit error #${code}; visit https://redux-toolkit.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
2188
- }
2189
-
2190
- // packages/database/requests.ts
2191
- var TIMEOUT = 5e3;
2192
- var logRequestFailure = (level, message) => {
2193
- if (level === "silent") return;
2194
- if (level === "warn") {
2195
- console.warn(message);
2196
- return;
2197
- }
2198
- if (level === "info") {
2199
- console.info(message);
2200
- return;
2201
- }
2202
- console.error(message);
2203
- };
2204
- var mutationFailureIdentifiers = /* @__PURE__ */ new Set([
2205
- "AUTHORITY_HOME_CONTROLLED",
2206
- "AUTHORITY_MISMATCH",
2207
- "USER_BATCH_AUTHORITY_CONTROLLED",
2208
- "SPACE_OWNER_AGENT_FORBIDDEN",
2209
- "APP_WRITE_FORBIDDEN",
2210
- "INCOMPLETE_APP_PAYLOAD",
2211
- "REVISION_CONFLICT",
2212
- "tombstone_conflict",
2213
- "INVALID_REQUEST",
2214
- "FORBIDDEN",
2215
- "TOKEN_STATS_SERVER_MANAGED",
2216
- "PATCH_PERMISSION_DENIED",
2217
- "WRITE_PERMISSION_DENIED",
2218
- "UNSUPPORTED_OAUTH_PROVIDER",
2219
- "INVALID_AGENT_SKILL_MODE",
2220
- "AUTOMATION_OWNER_AGENT_FORBIDDEN",
2221
- "PROTOCOL_UNAVAILABLE",
2222
- "INVALID_IF_MATCH",
2223
- "provider_model_mismatch"
2224
- ]);
2225
- var DIAGNOSTIC_READ_TIMEOUT_MS = 1200;
2226
- var DIAGNOSTIC_MAX_BYTES = 8 * 1024;
2227
- var readBoundedJson = async (response) => {
2228
- const body = response.body;
2229
- if (!body) return null;
2230
- const reader = body.getReader();
2231
- const deadline = Date.now() + DIAGNOSTIC_READ_TIMEOUT_MS;
2232
- const chunks = [];
2233
- let received = 0;
2234
- try {
2235
- for (; ; ) {
2236
- const remainingMs = deadline - Date.now();
2237
- if (remainingMs <= 0) throw new Error("diagnostic read timed out");
2238
- let timer;
2239
- const timeout = new Promise((_, reject) => {
2240
- timer = setTimeout(() => reject(new Error("diagnostic read timed out")), remainingMs);
2241
- });
2242
- const { done, value } = await Promise.race([reader.read(), timeout]).finally(() => {
2243
- if (timer !== void 0) clearTimeout(timer);
2244
- });
2245
- if (done) break;
2246
- received += value.byteLength;
2247
- if (received > DIAGNOSTIC_MAX_BYTES) throw new Error("diagnostic read too large");
2248
- chunks.push(value);
2249
- }
2250
- } finally {
2251
- void reader.cancel().catch(() => {
2252
- });
2253
- }
2254
- const total = chunks.reduce((sum, chunk) => sum + chunk.byteLength, 0);
2255
- const merged = new Uint8Array(total);
2256
- let offset = 0;
2257
- for (const chunk of chunks) {
2258
- merged.set(chunk, offset);
2259
- offset += chunk.byteLength;
2260
- }
2261
- return JSON.parse(new TextDecoder().decode(merged));
2262
- };
2263
- var describeMutationFailure = async (response) => {
2264
- const status = `HTTP ${response.status}`;
2265
- try {
2266
- const body = await readBoundedJson(response);
2267
- const fields = ["error", "code", "message"].flatMap((field) => {
2268
- const value = body?.[field];
2269
- return typeof value === "string" && mutationFailureIdentifiers.has(value) ? [`${field}=${value}`] : [];
2270
- });
2271
- return fields.length ? `${status} (${fields.join(", ")})` : status;
2272
- } catch {
2273
- return status;
2274
- }
2275
- };
2276
- var noloRequest = async (server, config, state, signal) => {
2277
- const headers = { ...config.headers || { "Content-Type": "application/json" } };
2278
- const token = selectIdentityToken(state) ?? null;
2279
- const requestToken = googleSessionRequestToken(token ?? void 0, server);
2280
- if (requestToken) {
2281
- headers["Authorization"] = `Bearer ${requestToken}`;
2282
- }
2283
- return fetch(server + config.url, {
2284
- method: config.method || "GET",
2285
- headers,
2286
- body: config.body,
2287
- ...isGoogleAuthoritySession(token) ? { credentials: "omit", redirect: "error" } : {},
2288
- signal,
2289
- // 传递 AbortSignal
2290
- ...config.keepalive ? { keepalive: true } : {}
2291
- });
2292
- };
2293
- var noloPatchRequest = async (server, dbKey, updates, state, signal, options) => {
2294
- const failureLogLevel = options?.failureLogLevel ?? "error";
2295
- try {
2296
- const response = await noloRequest(
2297
- server,
2298
- {
2299
- url: `${API_ENDPOINTS.DATABASE}/patch/${dbKey}`,
2300
- method: "PATCH",
2301
- body: JSON.stringify(updates)
2302
- },
2303
- state,
2304
- signal
2305
- );
2306
- if (!response.ok && failureLogLevel !== "silent") {
2307
- logRequestFailure(
2308
- failureLogLevel,
2309
- `PATCH request failed for ${dbKey} on ${server}: ${await describeMutationFailure(response)}`
2310
- );
2311
- }
2312
- return response.ok;
2313
- } catch (error) {
2314
- if (!isAbortError(error)) {
2315
- logRequestFailure(
2316
- failureLogLevel,
2317
- `PATCH request failed for ${dbKey} on ${server}: ${error.message || "Unknown error"}`
2318
- );
2319
- }
2320
- return false;
2321
- }
2322
- };
2323
- var noloWriteRequest = async (server, writeConfig, state, signal, options) => {
2324
- const { data, customKey, userId, indexKeys } = writeConfig;
2325
- const failureLogLevel = options?.failureLogLevel ?? "error";
2326
- try {
2327
- const response = await noloRequest(
2328
- server,
2329
- {
2330
- url: `${API_ENDPOINTS.DATABASE}/write/`,
2331
- method: "POST",
2332
- body: JSON.stringify({ data, customKey, userId, indexKeys })
2333
- },
2334
- state,
2335
- signal
2336
- );
2337
- if (!response.ok && failureLogLevel !== "silent") {
2338
- logRequestFailure(
2339
- failureLogLevel,
2340
- `Write request failed for ${customKey} on ${server}: ${await describeMutationFailure(response)}`
2341
- );
2342
- }
2343
- return response.ok;
2344
- } catch (error) {
2345
- if (!isAbortError(error)) {
2346
- logRequestFailure(
2347
- failureLogLevel,
2348
- `Write request failed for ${customKey} on ${server}: ${error.message || "Unknown error"}`
2349
- );
2350
- }
2351
- return false;
2352
- }
2353
- };
2354
- var rnUploadAdapter = null;
2355
- var xhrUploadRequest = (url, formData, state, onProgress, signal) => new Promise((resolve, reject) => {
2356
- if (signal?.aborted) {
2357
- reject(new DOMException("Upload aborted", "AbortError"));
2358
- return;
2359
- }
2360
- const xhr = new XMLHttpRequest();
2361
- xhr.open("POST", url);
2362
- const token = selectIdentityToken(state) ?? null;
2363
- if (token) {
2364
- xhr.setRequestHeader("Authorization", `Bearer ${token}`);
2365
- }
2366
- const onAbortSignal = () => xhr.abort();
2367
- signal?.addEventListener("abort", onAbortSignal, { once: true });
2368
- const cleanup = () => signal?.removeEventListener("abort", onAbortSignal);
2369
- xhr.upload.onprogress = (event) => {
2370
- if (event.lengthComputable) onProgress(event.loaded, event.total);
2371
- };
2372
- xhr.onload = () => {
2373
- cleanup();
2374
- resolve({ ok: xhr.status >= 200 && xhr.status < 300, status: xhr.status });
2375
- };
2376
- xhr.onerror = () => {
2377
- cleanup();
2378
- reject(new Error("Network error during upload"));
2379
- };
2380
- xhr.onabort = () => {
2381
- cleanup();
2382
- reject(new DOMException("Upload aborted", "AbortError"));
2383
- };
2384
- xhr.send(formData);
2385
- });
2386
- var noloUploadRequest = async (server, uploadConfig, state, signal, onProgress) => {
2387
- const { file, metadata, customKey, userId, ownerType, spaceId } = uploadConfig;
2388
- const googleSession = isGoogleAuthoritySession(selectIdentityToken(state));
2389
- try {
2390
- googleSessionRequestToken(selectIdentityToken(state) ?? void 0, server);
2391
- const isReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
2392
- const isRNFile = (f) => f && typeof f.uri === "string" && typeof f.name === "string" && typeof f.type === "string";
2393
- if (isReactNative && isRNFile(file)) {
2394
- if (!rnUploadAdapter) {
2395
- throw new Error(
2396
- "React Native upload adapter is not registered. Call initRNUploadAdapter() in the RN app entry before uploading files."
2397
- );
2398
- }
2399
- return await rnUploadAdapter(server, uploadConfig, state, signal);
2400
- }
2401
- const formData = new FormData();
2402
- if (isRNFile(file)) {
2403
- formData.append("file", {
2404
- uri: file.uri,
2405
- type: file.type,
2406
- name: file.name
2407
- });
2408
- } else {
2409
- formData.append("file", file);
2410
- }
2411
- formData.append("metadata", JSON.stringify(metadata));
2412
- formData.append("customKey", customKey);
2413
- if (userId) {
2414
- formData.append("userId", userId);
2415
- }
2416
- if (ownerType) {
2417
- formData.append("ownerType", ownerType);
2418
- }
2419
- if (spaceId) {
2420
- formData.append("spaceId", spaceId);
2421
- }
2422
- if (onProgress && !googleSession && typeof XMLHttpRequest !== "undefined") {
2423
- const result = await xhrUploadRequest(
2424
- server + `${API_ENDPOINTS.DATABASE}/upload`,
2425
- formData,
2426
- state,
2427
- onProgress,
2428
- signal
2429
- );
2430
- if (!result.ok) {
2431
- console.error(
2432
- `Upload request failed for ${customKey} on ${server}: HTTP ${result.status}` + (ownerType === "space" ? " (space ownership claim rejected: the Space may not be synced to this server, or you are not a member there)" : "")
2433
- );
2434
- }
2435
- return result.ok;
2436
- }
2437
- const response = await noloRequest(
2438
- server,
2439
- {
2440
- url: `${API_ENDPOINTS.DATABASE}/upload`,
2441
- method: "POST",
2442
- body: formData,
2443
- // Cast to any to avoid TS mismatch with Bun/DOM FormData
2444
- headers: {}
2445
- // 不设置 Content-Type,让浏览器自动处理 multipart/form-data
2446
- },
2447
- state,
2448
- signal
2449
- );
2450
- if (!response.ok) {
2451
- console.error(
2452
- `Upload request failed for ${customKey} on ${server}: HTTP ${response.status}` + (ownerType === "space" ? " (space ownership claim rejected: the Space may not be synced to this server, or you are not a member there)" : "")
2453
- );
2454
- }
2455
- if (response.ok && googleSession && onProgress) onProgress(file.size, file.size);
2456
- return response.ok;
2457
- } catch (error) {
2458
- if (!isAbortError(error)) {
2459
- console.error(
2460
- `Upload request failed for ${customKey} on ${server}: ${error.message || "Unknown error"}`
2461
- );
2462
- }
2463
- return false;
2464
- }
2465
- };
2466
- var syncWithServers = (servers, requestFn, errorMessage, ...requestArgs) => {
2467
- servers.forEach((server) => {
2468
- const abortController = new AbortController();
2469
- const timeoutId = setTimeout(() => {
2470
- abortController.abort();
2471
- }, TIMEOUT);
2472
- requestFn(server, ...requestArgs, abortController.signal).then((success) => {
2473
- clearTimeout(timeoutId);
2474
- if (!success) {
2475
- console.warn(`${errorMessage} ${server}`);
2476
- }
2477
- }).catch((error) => {
2478
- clearTimeout(timeoutId);
2479
- if (!isAbortError(error)) {
2480
- console.error(
2481
- `Unexpected error during sync with ${server}: ${error.message || "Unknown error"}`
2482
- );
2483
- }
2484
- });
2485
- });
2486
- };
2487
- var noloDeleteRequest = async (server, dbKey, options, state, signal) => {
2488
- const { type = "single", force = false } = options;
2489
- try {
2490
- const queryParts = [];
2491
- if (type === "messages") queryParts.push("type=messages");
2492
- else if (type === "table") queryParts.push("type=table");
2493
- if (force) queryParts.push("force=true");
2494
- const query = queryParts.length ? `?${queryParts.join("&")}` : "";
2495
- const url = `${API_ENDPOINTS.DATABASE}/delete/${dbKey}${query}`;
2496
- const response = await noloRequest(
2497
- server,
2498
- {
2499
- url,
2500
- method: "DELETE",
2501
- keepalive: true
2502
- },
2503
- state,
2504
- signal
2505
- );
2506
- if (!response.ok) {
2507
- console.error(
2508
- `DELETE request failed for ${dbKey} on ${server}: HTTP ${response.status}`
2509
- );
2510
- return false;
2511
- }
2512
- return true;
2513
- } catch (error) {
2514
- if (!isAbortError(error)) {
2515
- console.error(
2516
- `DELETE request failed for ${dbKey} on ${server}: ${error.message || "Unknown error"}`
2517
- );
2518
- }
2519
- return false;
2520
- }
2521
- };
2522
-
2523
- export {
2524
- createSelector,
2525
- createAction,
2526
- createAsyncThunk,
2527
- asyncThunkCreator,
2528
- buildCreateSlice,
2529
- createEntityAdapter,
2530
- TIMEOUT,
2531
- noloRequest,
2532
- noloPatchRequest,
2533
- noloWriteRequest,
2534
- noloUploadRequest,
2535
- syncWithServers,
2536
- noloDeleteRequest
2537
- };