@fuma-content/studio 1.0.0 → 1.0.2

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 (616) hide show
  1. package/build/client/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  2. package/build/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  3. package/build/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  4. package/build/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  5. package/build/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  6. package/build/client/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  7. package/build/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  8. package/build/client/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  9. package/build/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  10. package/build/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  11. package/build/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  12. package/build/client/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  13. package/build/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  14. package/build/client/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  15. package/build/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  16. package/build/client/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  17. package/build/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  18. package/build/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  19. package/build/client/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  20. package/build/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  21. package/build/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  22. package/build/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  23. package/build/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  24. package/build/client/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  25. package/build/client/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  26. package/build/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  27. package/build/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  28. package/build/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  29. package/build/client/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  30. package/build/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  31. package/build/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  32. package/build/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  33. package/build/client/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  34. package/build/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  35. package/build/client/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  36. package/build/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  37. package/build/client/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  38. package/build/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  39. package/build/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  40. package/build/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  41. package/build/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  42. package/build/client/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  43. package/build/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  44. package/build/client/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  45. package/build/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  46. package/build/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  47. package/build/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  48. package/build/client/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  49. package/build/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  50. package/build/client/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  51. package/build/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  52. package/build/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  53. package/build/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  54. package/build/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  55. package/build/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  56. package/build/client/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  57. package/build/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  58. package/build/client/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  59. package/build/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  60. package/build/client/assets/QueryClientProvider-DqiXnN2L.js +1 -0
  61. package/build/client/assets/actions-DkbV2Z0p.js +1 -0
  62. package/build/client/assets/actions-DpkI7OTF.js +1 -0
  63. package/build/client/assets/badge-CZkdLoIP.js +1 -0
  64. package/build/client/assets/button-Bm94vje1.js +41 -0
  65. package/build/client/assets/client-BWBqEatf.js +1 -0
  66. package/build/client/assets/client-Crg-pMcu.js +1 -0
  67. package/build/client/assets/client-DVneG3Rq.css +1 -0
  68. package/build/client/assets/client-OSVRoCKH.js +569 -0
  69. package/build/client/assets/dropdown-menu-EF-sTINr.js +1 -0
  70. package/build/client/assets/entry.rsc-D51PwnQL.js +1 -0
  71. package/build/client/assets/index-BdrDVoE8.js +1 -0
  72. package/build/client/assets/index-BpILsqFO.js +1 -0
  73. package/build/client/assets/index-Bx93mXy1.js +11 -0
  74. package/build/client/assets/index-CQRgqbuL.js +1 -0
  75. package/build/client/assets/index-DOs5iMXj.js +1 -0
  76. package/build/client/assets/index-DTzAH5JX.js +1 -0
  77. package/build/client/assets/layout-CnpYRqF0.js +1 -0
  78. package/build/client/assets/mdx-BNErtsK6.js +1 -0
  79. package/build/client/assets/page-DOzl4Kpa.js +1 -0
  80. package/build/client/assets/page-uNpJU_rv.js +1 -0
  81. package/build/client/assets/query-z9oLNeTD.js +1 -0
  82. package/build/client/assets/react-B8--K7an.js +10 -0
  83. package/build/client/assets/root-B_CXTQpA.js +1 -0
  84. package/build/client/assets/root-D3NoAGI1.js +1 -0
  85. package/build/client/assets/root-z8crlXSh.css +1 -0
  86. package/build/client/assets/route-DVneG3Rq.css +1 -0
  87. package/build/client/assets/router-a9jyj9wf.js +10 -0
  88. package/build/client/assets/separator-tWFpvpUX.js +1 -0
  89. package/build/client/assets/sidebar-BBYit8gY.js +12 -0
  90. package/build/client/assets/site-header-DQkKe-WA.js +1 -0
  91. package/build/client/assets/spinner-BdPhtfsc.js +1 -0
  92. package/build/client/assets/tooltip-Dvh-iHDG.js +16 -0
  93. package/build/client/assets/use-sync-ZgcwUdu_.js +9 -0
  94. package/build/client/assets/yaml-Cloe7OVn.js +32 -0
  95. package/build/server/__ssr_build/__vite_rsc_assets_manifest.js +268 -0
  96. package/build/server/__ssr_build/assets/QueryClientProvider-DlvBH3OQ.js +30 -0
  97. package/build/server/__ssr_build/assets/actions-B50-3n-a.js +63 -0
  98. package/build/server/__ssr_build/assets/actions-BFtCTvOL.js +21 -0
  99. package/{src/components/ui/badge.tsx → build/server/__ssr_build/assets/badge-DYFvBSp8.js} +23 -28
  100. package/build/server/__ssr_build/assets/button-C_-b_vqm.js +4098 -0
  101. package/build/server/__ssr_build/assets/client--HXec13w.js +130 -0
  102. package/build/server/__ssr_build/assets/client-BqW9rGyi.js +116885 -0
  103. package/build/server/__ssr_build/assets/client-CU90j0R8.js +154 -0
  104. package/build/server/__ssr_build/assets/dropdown-menu-D2YyT3lP.js +1312 -0
  105. package/build/server/__ssr_build/assets/entry.rsc-Cg_DxYkh.js +12 -0
  106. package/build/server/__ssr_build/assets/index-B-gno69w.js +58 -0
  107. package/build/server/__ssr_build/assets/index-DBc0nhEL.js +288 -0
  108. package/build/server/__ssr_build/assets/index-Dtw6X3NW.js +1092 -0
  109. package/build/server/__ssr_build/assets/index-DvVNShHF.js +86 -0
  110. package/build/server/__ssr_build/assets/index-PpqpVA51.js +612 -0
  111. package/build/server/__ssr_build/assets/layout-CPnSx9PI.js +454 -0
  112. package/build/server/__ssr_build/assets/mdx-bmeV1kyx.js +44 -0
  113. package/build/server/__ssr_build/assets/page-BwoghW3K.js +38 -0
  114. package/build/server/__ssr_build/assets/page-HxttullC.js +89 -0
  115. package/build/server/__ssr_build/assets/query-C1_xUNXy.js +1975 -0
  116. package/build/server/__ssr_build/assets/root-CS7F-km4.js +16 -0
  117. package/build/server/__ssr_build/assets/root-D-Y-rGw5.js +73 -0
  118. package/build/server/__ssr_build/assets/separator-8UA_ceSq.js +49 -0
  119. package/build/server/__ssr_build/assets/sidebar-BzNOZeBO.js +13194 -0
  120. package/build/server/__ssr_build/assets/site-header-CXHKSzqk.js +13 -0
  121. package/build/server/__ssr_build/assets/spinner-BXcLlTNs.js +1291 -0
  122. package/build/server/__ssr_build/assets/tooltip-DZ4WdJt-.js +9553 -0
  123. package/build/server/__ssr_build/assets/use-sync-TRS0zL-Y.js +3404 -0
  124. package/build/server/__ssr_build/assets/yaml-BEdFfhvc.js +63 -0
  125. package/build/server/__ssr_build/index.js +36076 -0
  126. package/build/server/__vite_rsc_assets_manifest.js +268 -0
  127. package/build/server/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  128. package/build/server/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  129. package/build/server/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  130. package/build/server/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  131. package/build/server/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  132. package/build/server/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  133. package/build/server/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  134. package/build/server/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  135. package/build/server/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  136. package/build/server/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  137. package/build/server/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  138. package/build/server/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  139. package/build/server/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  140. package/build/server/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  141. package/build/server/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  142. package/build/server/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  143. package/build/server/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  144. package/build/server/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  145. package/build/server/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  146. package/build/server/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  147. package/build/server/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  148. package/build/server/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  149. package/build/server/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  150. package/build/server/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  151. package/build/server/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  152. package/build/server/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  153. package/build/server/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  154. package/build/server/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  155. package/build/server/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  156. package/build/server/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  157. package/build/server/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  158. package/build/server/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  159. package/build/server/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  160. package/build/server/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  161. package/build/server/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  162. package/build/server/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  163. package/build/server/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  164. package/build/server/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  165. package/build/server/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  166. package/build/server/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  167. package/build/server/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  168. package/build/server/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  169. package/build/server/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  170. package/build/server/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  171. package/build/server/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  172. package/build/server/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  173. package/build/server/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  174. package/build/server/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  175. package/build/server/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  176. package/build/server/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  177. package/build/server/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  178. package/build/server/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  179. package/build/server/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  180. package/build/server/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  181. package/build/server/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  182. package/build/server/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  183. package/build/server/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  184. package/build/server/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  185. package/build/server/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  186. package/build/server/assets/actions-C92yn6jE.js +61 -0
  187. package/build/server/assets/actions-CWWFIcb1.js +46 -0
  188. package/build/server/assets/actions-DZdN0IBq.js +73 -0
  189. package/build/server/assets/client-BdxXy6rH.js +13 -0
  190. package/build/server/assets/client-DLzFPnCR.js +13 -0
  191. package/build/server/assets/config-Cb909uq6.js +257 -0
  192. package/build/server/assets/index-X49ifkk3.js +9 -0
  193. package/build/server/assets/jsx-runtime.react-server-D3We4JeM.js +324 -0
  194. package/build/server/assets/layout-CRw_6FCt.js +2071 -0
  195. package/build/server/assets/page-BcrsPZbM.js +9 -0
  196. package/build/server/assets/page-zlF_Ew1s.js +72 -0
  197. package/build/server/assets/root-CVOXO6T9.js +23 -0
  198. package/build/server/assets/root-dGb6ch_9.js +38 -0
  199. package/build/server/assets/root-z8crlXSh.css +1 -0
  200. package/build/server/assets/route-DVneG3Rq.css +1 -0
  201. package/build/server/assets/route-Ds0B4hTo.js +44 -0
  202. package/build/server/assets/route-DvwlfKZg.js +21 -0
  203. package/build/server/assets/route-o-6k10r9.js +70774 -0
  204. package/build/server/index.js +17032 -0
  205. package/dist/bin/cli.d.mts +1 -0
  206. package/dist/bin/cli.mjs +71 -0
  207. package/dist/bin.mjs +14 -40
  208. package/dist/package.mjs +1 -1
  209. package/package.json +33 -32
  210. package/dist/index.d.mts +0 -52
  211. package/dist/index.mjs +0 -67
  212. package/dist/mdx/actions.mjs +0 -32
  213. package/dist/mdx/client.mjs +0 -167
  214. package/dist/src/components/code-editor/mdx.lazy.mjs +0 -19
  215. package/dist/src/components/code-editor/mdx.mjs +0 -44
  216. package/dist/src/components/code-editor/yaml.lazy.mjs +0 -22
  217. package/dist/src/components/code-editor/yaml.mjs +0 -63
  218. package/dist/src/components/editor/editor-base-kit.mjs +0 -41
  219. package/dist/src/components/editor/editor-kit.mjs +0 -73
  220. package/dist/src/components/editor/md.mjs +0 -42
  221. package/dist/src/components/editor/plugins/ai-kit.mjs +0 -68
  222. package/dist/src/components/editor/plugins/align-base-kit.mjs +0 -28
  223. package/dist/src/components/editor/plugins/align-kit.mjs +0 -30
  224. package/dist/src/components/editor/plugins/autoformat-kit.mjs +0 -214
  225. package/dist/src/components/editor/plugins/basic-blocks-base-kit.mjs +0 -22
  226. package/dist/src/components/editor/plugins/basic-blocks-kit.mjs +0 -51
  227. package/dist/src/components/editor/plugins/basic-marks-base-kit.mjs +0 -20
  228. package/dist/src/components/editor/plugins/basic-marks-kit.mjs +0 -28
  229. package/dist/src/components/editor/plugins/block-menu-kit.mjs +0 -11
  230. package/dist/src/components/editor/plugins/block-placeholder-kit.mjs +0 -14
  231. package/dist/src/components/editor/plugins/block-selection-kit.mjs +0 -48
  232. package/dist/src/components/editor/plugins/callout-base-kit.mjs +0 -8
  233. package/dist/src/components/editor/plugins/callout-kit.mjs +0 -10
  234. package/dist/src/components/editor/plugins/code-block-base-kit.mjs +0 -16
  235. package/dist/src/components/editor/plugins/code-block-kit.mjs +0 -19
  236. package/dist/src/components/editor/plugins/column-base-kit.mjs +0 -8
  237. package/dist/src/components/editor/plugins/column-kit.mjs +0 -10
  238. package/dist/src/components/editor/plugins/comment-base-kit.mjs +0 -8
  239. package/dist/src/components/editor/plugins/comment-kit.mjs +0 -53
  240. package/dist/src/components/editor/plugins/copilot-kit.mjs +0 -49
  241. package/dist/src/components/editor/plugins/cursor-overlay-kit.mjs +0 -11
  242. package/dist/src/components/editor/plugins/date-base-kit.mjs +0 -8
  243. package/dist/src/components/editor/plugins/date-kit.mjs +0 -10
  244. package/dist/src/components/editor/plugins/discussion-kit.mjs +0 -94
  245. package/dist/src/components/editor/plugins/dnd-kit.mjs +0 -31
  246. package/dist/src/components/editor/plugins/emoji-kit.mjs +0 -11
  247. package/dist/src/components/editor/plugins/exit-break-kit.mjs +0 -12
  248. package/dist/src/components/editor/plugins/fixed-toolbar-kit.mjs +0 -15
  249. package/dist/src/components/editor/plugins/floating-toolbar-kit.mjs +0 -15
  250. package/dist/src/components/editor/plugins/font-base-kit.mjs +0 -14
  251. package/dist/src/components/editor/plugins/font-kit.mjs +0 -19
  252. package/dist/src/components/editor/plugins/indent-base-kit.mjs +0 -17
  253. package/dist/src/components/editor/plugins/indent-kit.mjs +0 -20
  254. package/dist/src/components/editor/plugins/line-height-base-kit.mjs +0 -20
  255. package/dist/src/components/editor/plugins/line-height-kit.mjs +0 -22
  256. package/dist/src/components/editor/plugins/link-base-kit.mjs +0 -8
  257. package/dist/src/components/editor/plugins/link-kit.mjs +0 -15
  258. package/dist/src/components/editor/plugins/list-base-kit.mjs +0 -19
  259. package/dist/src/components/editor/plugins/list-kit.mjs +0 -22
  260. package/dist/src/components/editor/plugins/markdown-kit.mjs +0 -17
  261. package/dist/src/components/editor/plugins/math-base-kit.mjs +0 -8
  262. package/dist/src/components/editor/plugins/math-kit.mjs +0 -10
  263. package/dist/src/components/editor/plugins/media-base-kit.mjs +0 -23
  264. package/dist/src/components/editor/plugins/media-kit.mjs +0 -37
  265. package/dist/src/components/editor/plugins/slash-kit.mjs +0 -11
  266. package/dist/src/components/editor/plugins/suggestion-base-kit.mjs +0 -8
  267. package/dist/src/components/editor/plugins/suggestion-kit.mjs +0 -50
  268. package/dist/src/components/editor/plugins/table-base-kit.mjs +0 -13
  269. package/dist/src/components/editor/plugins/table-kit.mjs +0 -15
  270. package/dist/src/components/editor/transforms.mjs +0 -125
  271. package/dist/src/components/editor/ui/ai-chat-editor.mjs +0 -21
  272. package/dist/src/components/editor/ui/ai-menu.mjs +0 -488
  273. package/dist/src/components/editor/ui/ai-node.mjs +0 -24
  274. package/dist/src/components/editor/ui/ai-toolbar-button.mjs +0 -23
  275. package/dist/src/components/editor/ui/align-toolbar-button.mjs +0 -71
  276. package/dist/src/components/editor/ui/block-context-menu.mjs +0 -130
  277. package/dist/src/components/editor/ui/block-discussion.mjs +0 -200
  278. package/dist/src/components/editor/ui/block-draggable.mjs +0 -265
  279. package/dist/src/components/editor/ui/block-list-static.mjs +0 -48
  280. package/dist/src/components/editor/ui/block-list.mjs +0 -47
  281. package/dist/src/components/editor/ui/block-selection.mjs +0 -28
  282. package/dist/src/components/editor/ui/block-suggestion.mjs +0 -319
  283. package/dist/src/components/editor/ui/blockquote-node-static.mjs +0 -14
  284. package/dist/src/components/editor/ui/blockquote-node.mjs +0 -16
  285. package/dist/src/components/editor/ui/callout-node-static.mjs +0 -29
  286. package/dist/src/components/editor/ui/callout-node.mjs +0 -50
  287. package/dist/src/components/editor/ui/caption.mjs +0 -39
  288. package/dist/src/components/editor/ui/code-block-node-static.mjs +0 -30
  289. package/dist/src/components/editor/ui/code-block-node.mjs +0 -121
  290. package/dist/src/components/editor/ui/code-node-static.mjs +0 -15
  291. package/dist/src/components/editor/ui/code-node.mjs +0 -17
  292. package/dist/src/components/editor/ui/column-node-static.mjs +0 -32
  293. package/dist/src/components/editor/ui/column-node.mjs +0 -229
  294. package/dist/src/components/editor/ui/comment-node-static.mjs +0 -14
  295. package/dist/src/components/editor/ui/comment-node.mjs +0 -33
  296. package/dist/src/components/editor/ui/comment-toolbar-button.mjs +0 -23
  297. package/dist/src/components/editor/ui/comment.mjs +0 -422
  298. package/dist/src/components/editor/ui/cursor-overlay.mjs +0 -36
  299. package/dist/src/components/editor/ui/date-node-static.mjs +0 -32
  300. package/dist/src/components/editor/ui/date-node.mjs +0 -60
  301. package/dist/src/components/editor/ui/editor-static.mjs +0 -31
  302. package/dist/src/components/editor/ui/editor.mjs +0 -60
  303. package/dist/src/components/editor/ui/emoji-node.mjs +0 -46
  304. package/dist/src/components/editor/ui/emoji-toolbar-button.mjs +0 -415
  305. package/dist/src/components/editor/ui/equation-node-static.mjs +0 -65
  306. package/dist/src/components/editor/ui/equation-node.mjs +0 -159
  307. package/dist/src/components/editor/ui/equation-toolbar-button.mjs +0 -23
  308. package/dist/src/components/editor/ui/fixed-toolbar-buttons.mjs +0 -109
  309. package/dist/src/components/editor/ui/fixed-toolbar.mjs +0 -16
  310. package/dist/src/components/editor/ui/floating-toolbar-buttons.mjs +0 -54
  311. package/dist/src/components/editor/ui/floating-toolbar.mjs +0 -51
  312. package/dist/src/components/editor/ui/font-color-toolbar-button.mjs +0 -637
  313. package/dist/src/components/editor/ui/font-size-toolbar-button.mjs +0 -83
  314. package/dist/src/components/editor/ui/ghost-text.mjs +0 -22
  315. package/dist/src/components/editor/ui/heading-node-static.mjs +0 -60
  316. package/dist/src/components/editor/ui/heading-node.mjs +0 -62
  317. package/dist/src/components/editor/ui/highlight-node-static.mjs +0 -15
  318. package/dist/src/components/editor/ui/highlight-node.mjs +0 -17
  319. package/dist/src/components/editor/ui/history-toolbar-button.mjs +0 -35
  320. package/dist/src/components/editor/ui/hr-node-static.mjs +0 -18
  321. package/dist/src/components/editor/ui/hr-node.mjs +0 -23
  322. package/dist/src/components/editor/ui/indent-toolbar-button.mjs +0 -29
  323. package/dist/src/components/editor/ui/inline-combobox.mjs +0 -148
  324. package/dist/src/components/editor/ui/insert-toolbar-button.mjs +0 -199
  325. package/dist/src/components/editor/ui/kbd-node-static.mjs +0 -15
  326. package/dist/src/components/editor/ui/kbd-node.mjs +0 -17
  327. package/dist/src/components/editor/ui/line-height-toolbar-button.mjs +0 -56
  328. package/dist/src/components/editor/ui/link-node-static.mjs +0 -20
  329. package/dist/src/components/editor/ui/link-node.mjs +0 -28
  330. package/dist/src/components/editor/ui/link-toolbar-button.mjs +0 -21
  331. package/dist/src/components/editor/ui/link-toolbar.mjs +0 -141
  332. package/dist/src/components/editor/ui/list-toolbar-button.mjs +0 -131
  333. package/dist/src/components/editor/ui/mark-toolbar-button.mjs +0 -20
  334. package/dist/src/components/editor/ui/media-image-node-static.mjs +0 -32
  335. package/dist/src/components/editor/ui/media-image-node.mjs +0 -64
  336. package/dist/src/components/editor/ui/media-placeholder-node.mjs +0 -184
  337. package/dist/src/components/editor/ui/media-preview-dialog.mjs +0 -113
  338. package/dist/src/components/editor/ui/media-toolbar-button.mjs +0 -156
  339. package/dist/src/components/editor/ui/media-toolbar.mjs +0 -80
  340. package/dist/src/components/editor/ui/media-upload-toast.mjs +0 -39
  341. package/dist/src/components/editor/ui/media-video-node-static.mjs +0 -27
  342. package/dist/src/components/editor/ui/mode-toolbar-button.mjs +0 -112
  343. package/dist/src/components/editor/ui/paragraph-node-static.mjs +0 -15
  344. package/dist/src/components/editor/ui/paragraph-node.mjs +0 -17
  345. package/dist/src/components/editor/ui/resize-handle.mjs +0 -43
  346. package/dist/src/components/editor/ui/slash-node.mjs +0 -228
  347. package/dist/src/components/editor/ui/suggestion-node-static.mjs +0 -24
  348. package/dist/src/components/editor/ui/suggestion-node.mjs +0 -111
  349. package/dist/src/components/editor/ui/suggestion-toolbar-button.mjs +0 -24
  350. package/dist/src/components/editor/ui/table-icons.mjs +0 -1310
  351. package/dist/src/components/editor/ui/table-node-static.mjs +0 -68
  352. package/dist/src/components/editor/ui/table-node.mjs +0 -375
  353. package/dist/src/components/editor/ui/table-toolbar-button.mjs +0 -190
  354. package/dist/src/components/editor/ui/turn-into-toolbar-button.mjs +0 -168
  355. package/dist/src/components/editor/use-chat.mjs +0 -80
  356. package/dist/src/components/json-schema-editor/client.mjs +0 -46
  357. package/dist/src/components/json-schema-editor/components/inputs.mjs +0 -438
  358. package/dist/src/components/json-schema-editor/get-default-values.mjs +0 -23
  359. package/dist/src/components/json-schema-editor/schema.mjs +0 -131
  360. package/dist/src/components/json-schema-editor/utils/merge-schema.mjs +0 -134
  361. package/dist/src/components/json-schema-editor/utils/schema-to-string.mjs +0 -53
  362. package/dist/src/components/ui/alert-dialog.mjs +0 -90
  363. package/dist/src/components/ui/avatar.mjs +0 -32
  364. package/dist/src/components/ui/button.mjs +0 -48
  365. package/dist/src/components/ui/calendar.mjs +0 -108
  366. package/dist/src/components/ui/checkbox.mjs +0 -23
  367. package/dist/src/components/ui/combobox.mjs +0 -53
  368. package/dist/src/components/ui/command.mjs +0 -42
  369. package/dist/src/components/ui/context-menu.mjs +0 -67
  370. package/dist/src/components/ui/dialog.mjs +0 -9
  371. package/dist/src/components/ui/dropdown-menu.mjs +0 -122
  372. package/dist/src/components/ui/input-group.mjs +0 -31
  373. package/dist/src/components/ui/input.mjs +0 -15
  374. package/dist/src/components/ui/label.mjs +0 -19
  375. package/dist/src/components/ui/popover.mjs +0 -37
  376. package/dist/src/components/ui/select.mjs +0 -80
  377. package/dist/src/components/ui/separator.mjs +0 -19
  378. package/dist/src/components/ui/spinner.mjs +0 -16
  379. package/dist/src/components/ui/tabs.mjs +0 -39
  380. package/dist/src/components/ui/textarea.mjs +0 -14
  381. package/dist/src/components/ui/toolbar.mjs +0 -183
  382. package/dist/src/components/ui/tooltip.mjs +0 -38
  383. package/dist/src/hooks/editor/use-is-creator.mjs +0 -19
  384. package/dist/src/hooks/use-upload-file.mjs +0 -73
  385. package/dist/src/lib/config.mjs +0 -34
  386. package/dist/src/lib/data/store.d.mts +0 -15
  387. package/dist/src/lib/lowlight.mjs +0 -7
  388. package/dist/src/lib/utils/deep-equal.mjs +0 -18
  389. package/dist/src/lib/utils/remove-undefined.mjs +0 -18
  390. package/dist/src/lib/utils.mjs +0 -10
  391. package/next.config.ts +0 -23
  392. package/postcss.config.mjs +0 -7
  393. package/src/app/(dashboard)/collection/[name]/[...slug]/page.client.tsx +0 -26
  394. package/src/app/(dashboard)/collection/[name]/[...slug]/page.tsx +0 -18
  395. package/src/app/(dashboard)/collection/[name]/page.client.tsx +0 -82
  396. package/src/app/(dashboard)/collection/[name]/page.tsx +0 -11
  397. package/src/app/(dashboard)/layout.tsx +0 -34
  398. package/src/app/(dashboard)/page.tsx +0 -38
  399. package/src/app/api/ai/command/prompts.ts +0 -313
  400. package/src/app/api/ai/command/route.ts +0 -203
  401. package/src/app/api/ai/command/utils.ts +0 -242
  402. package/src/app/api/ai/copilot/route.ts +0 -33
  403. package/src/app/api/uploadthing/route.ts +0 -5
  404. package/src/app/codeblock/LICENSE +0 -21
  405. package/src/app/codeblock/styles.css +0 -289
  406. package/src/app/favicon.ico +0 -0
  407. package/src/app/globals.css +0 -223
  408. package/src/app/layout.client.tsx +0 -15
  409. package/src/app/layout.tsx +0 -30
  410. package/src/components/app-sidebar.tsx +0 -162
  411. package/src/components/code-editor/mdx.lazy.tsx +0 -18
  412. package/src/components/code-editor/mdx.tsx +0 -48
  413. package/src/components/code-editor/yaml.lazy.tsx +0 -20
  414. package/src/components/code-editor/yaml.tsx +0 -71
  415. package/src/components/collection/actions.tsx +0 -41
  416. package/src/components/collection/client.tsx +0 -63
  417. package/src/components/collection/context.tsx +0 -24
  418. package/src/components/collection/document/actions.tsx +0 -83
  419. package/src/components/editor/editor-base-kit.tsx +0 -37
  420. package/src/components/editor/editor-kit.tsx +0 -87
  421. package/src/components/editor/md.tsx +0 -60
  422. package/src/components/editor/plugins/ai-kit.tsx +0 -102
  423. package/src/components/editor/plugins/align-base-kit.tsx +0 -16
  424. package/src/components/editor/plugins/align-kit.tsx +0 -18
  425. package/src/components/editor/plugins/autoformat-kit.tsx +0 -236
  426. package/src/components/editor/plugins/basic-blocks-base-kit.tsx +0 -34
  427. package/src/components/editor/plugins/basic-blocks-kit.tsx +0 -87
  428. package/src/components/editor/plugins/basic-marks-base-kit.tsx +0 -26
  429. package/src/components/editor/plugins/basic-marks-kit.tsx +0 -40
  430. package/src/components/editor/plugins/basic-nodes-kit.tsx +0 -6
  431. package/src/components/editor/plugins/block-menu-kit.tsx +0 -14
  432. package/src/components/editor/plugins/block-placeholder-kit.tsx +0 -17
  433. package/src/components/editor/plugins/block-selection-kit.tsx +0 -54
  434. package/src/components/editor/plugins/callout-base-kit.tsx +0 -5
  435. package/src/components/editor/plugins/callout-kit.tsx +0 -7
  436. package/src/components/editor/plugins/code-block-base-kit.tsx +0 -16
  437. package/src/components/editor/plugins/code-block-kit.tsx +0 -19
  438. package/src/components/editor/plugins/column-base-kit.tsx +0 -11
  439. package/src/components/editor/plugins/column-kit.tsx +0 -10
  440. package/src/components/editor/plugins/comment-base-kit.tsx +0 -5
  441. package/src/components/editor/plugins/comment-kit.tsx +0 -92
  442. package/src/components/editor/plugins/copilot-kit.tsx +0 -70
  443. package/src/components/editor/plugins/cursor-overlay-kit.tsx +0 -13
  444. package/src/components/editor/plugins/date-base-kit.tsx +0 -5
  445. package/src/components/editor/plugins/date-kit.tsx +0 -7
  446. package/src/components/editor/plugins/discussion-kit.tsx +0 -142
  447. package/src/components/editor/plugins/dnd-kit.tsx +0 -25
  448. package/src/components/editor/plugins/emoji-kit.tsx +0 -13
  449. package/src/components/editor/plugins/exit-break-kit.tsx +0 -12
  450. package/src/components/editor/plugins/fixed-toolbar-kit.tsx +0 -19
  451. package/src/components/editor/plugins/floating-toolbar-kit.tsx +0 -19
  452. package/src/components/editor/plugins/font-base-kit.tsx +0 -20
  453. package/src/components/editor/plugins/font-kit.tsx +0 -29
  454. package/src/components/editor/plugins/indent-base-kit.tsx +0 -13
  455. package/src/components/editor/plugins/indent-kit.tsx +0 -22
  456. package/src/components/editor/plugins/line-height-base-kit.tsx +0 -14
  457. package/src/components/editor/plugins/line-height-kit.tsx +0 -16
  458. package/src/components/editor/plugins/link-base-kit.tsx +0 -5
  459. package/src/components/editor/plugins/link-kit.tsx +0 -15
  460. package/src/components/editor/plugins/list-base-kit.tsx +0 -17
  461. package/src/components/editor/plugins/list-kit.tsx +0 -26
  462. package/src/components/editor/plugins/markdown-kit.tsx +0 -13
  463. package/src/components/editor/plugins/math-base-kit.tsx +0 -11
  464. package/src/components/editor/plugins/math-kit.tsx +0 -10
  465. package/src/components/editor/plugins/media-base-kit.tsx +0 -25
  466. package/src/components/editor/plugins/media-kit.tsx +0 -28
  467. package/src/components/editor/plugins/slash-kit.tsx +0 -18
  468. package/src/components/editor/plugins/suggestion-base-kit.tsx +0 -5
  469. package/src/components/editor/plugins/suggestion-kit.tsx +0 -83
  470. package/src/components/editor/plugins/table-base-kit.tsx +0 -20
  471. package/src/components/editor/plugins/table-kit.tsx +0 -22
  472. package/src/components/editor/settings-dialog.tsx +0 -418
  473. package/src/components/editor/transforms.ts +0 -193
  474. package/src/components/editor/types.ts +0 -149
  475. package/src/components/editor/ui/ai-chat-editor.tsx +0 -20
  476. package/src/components/editor/ui/ai-menu.tsx +0 -663
  477. package/src/components/editor/ui/ai-node.tsx +0 -40
  478. package/src/components/editor/ui/ai-toolbar-button.tsx +0 -23
  479. package/src/components/editor/ui/align-toolbar-button.tsx +0 -78
  480. package/src/components/editor/ui/block-context-menu.tsx +0 -154
  481. package/src/components/editor/ui/block-discussion.tsx +0 -318
  482. package/src/components/editor/ui/block-draggable.tsx +0 -464
  483. package/src/components/editor/ui/block-list-static.tsx +0 -75
  484. package/src/components/editor/ui/block-list.tsx +0 -72
  485. package/src/components/editor/ui/block-selection.tsx +0 -37
  486. package/src/components/editor/ui/block-suggestion.tsx +0 -438
  487. package/src/components/editor/ui/blockquote-node-static.tsx +0 -5
  488. package/src/components/editor/ui/blockquote-node.tsx +0 -7
  489. package/src/components/editor/ui/callout-node-static.tsx +0 -30
  490. package/src/components/editor/ui/callout-node.tsx +0 -64
  491. package/src/components/editor/ui/caption.tsx +0 -55
  492. package/src/components/editor/ui/code-block-node-static.tsx +0 -33
  493. package/src/components/editor/ui/code-block-node.tsx +0 -161
  494. package/src/components/editor/ui/code-node-static.tsx +0 -15
  495. package/src/components/editor/ui/code-node.tsx +0 -17
  496. package/src/components/editor/ui/column-node-static.tsx +0 -27
  497. package/src/components/editor/ui/column-node.tsx +0 -285
  498. package/src/components/editor/ui/comment-node-static.tsx +0 -12
  499. package/src/components/editor/ui/comment-node.tsx +0 -43
  500. package/src/components/editor/ui/comment-toolbar-button.tsx +0 -24
  501. package/src/components/editor/ui/comment.tsx +0 -577
  502. package/src/components/editor/ui/cursor-overlay.tsx +0 -66
  503. package/src/components/editor/ui/date-node-static.tsx +0 -45
  504. package/src/components/editor/ui/date-node.tsx +0 -86
  505. package/src/components/editor/ui/editor-static.tsx +0 -47
  506. package/src/components/editor/ui/editor.tsx +0 -120
  507. package/src/components/editor/ui/emoji-node.tsx +0 -65
  508. package/src/components/editor/ui/emoji-toolbar-button.tsx +0 -582
  509. package/src/components/editor/ui/equation-node-static.tsx +0 -94
  510. package/src/components/editor/ui/equation-node.tsx +0 -218
  511. package/src/components/editor/ui/equation-toolbar-button.tsx +0 -24
  512. package/src/components/editor/ui/fixed-toolbar-buttons.tsx +0 -135
  513. package/src/components/editor/ui/fixed-toolbar.tsx +0 -17
  514. package/src/components/editor/ui/floating-toolbar-buttons.tsx +0 -72
  515. package/src/components/editor/ui/floating-toolbar.tsx +0 -76
  516. package/src/components/editor/ui/font-color-toolbar-button.tsx +0 -804
  517. package/src/components/editor/ui/font-size-toolbar-button.tsx +0 -102
  518. package/src/components/editor/ui/ghost-text.tsx +0 -27
  519. package/src/components/editor/ui/heading-node-static.tsx +0 -54
  520. package/src/components/editor/ui/heading-node.tsx +0 -54
  521. package/src/components/editor/ui/highlight-node-static.tsx +0 -11
  522. package/src/components/editor/ui/highlight-node.tsx +0 -13
  523. package/src/components/editor/ui/history-toolbar-button.tsx +0 -41
  524. package/src/components/editor/ui/hr-node-static.tsx +0 -16
  525. package/src/components/editor/ui/hr-node.tsx +0 -28
  526. package/src/components/editor/ui/indent-toolbar-button.tsx +0 -27
  527. package/src/components/editor/ui/inline-combobox.tsx +0 -251
  528. package/src/components/editor/ui/insert-toolbar-button.tsx +0 -242
  529. package/src/components/editor/ui/kbd-node-static.tsx +0 -15
  530. package/src/components/editor/ui/kbd-node.tsx +0 -17
  531. package/src/components/editor/ui/line-height-toolbar-button.tsx +0 -66
  532. package/src/components/editor/ui/link-node-static.tsx +0 -21
  533. package/src/components/editor/ui/link-node.tsx +0 -37
  534. package/src/components/editor/ui/link-toolbar-button.tsx +0 -18
  535. package/src/components/editor/ui/link-toolbar.tsx +0 -196
  536. package/src/components/editor/ui/list-toolbar-button.tsx +0 -195
  537. package/src/components/editor/ui/mark-toolbar-button.tsx +0 -20
  538. package/src/components/editor/ui/media-image-node-static.tsx +0 -33
  539. package/src/components/editor/ui/media-image-node.tsx +0 -75
  540. package/src/components/editor/ui/media-placeholder-node.tsx +0 -235
  541. package/src/components/editor/ui/media-preview-dialog.tsx +0 -145
  542. package/src/components/editor/ui/media-toolbar-button.tsx +0 -202
  543. package/src/components/editor/ui/media-toolbar.tsx +0 -100
  544. package/src/components/editor/ui/media-upload-toast.tsx +0 -59
  545. package/src/components/editor/ui/media-video-node-static.tsx +0 -23
  546. package/src/components/editor/ui/mode-toolbar-button.tsx +0 -121
  547. package/src/components/editor/ui/paragraph-node-static.tsx +0 -13
  548. package/src/components/editor/ui/paragraph-node.tsx +0 -15
  549. package/src/components/editor/ui/resize-handle.tsx +0 -79
  550. package/src/components/editor/ui/slash-node.tsx +0 -274
  551. package/src/components/editor/ui/suggestion-node-static.tsx +0 -30
  552. package/src/components/editor/ui/suggestion-node.tsx +0 -157
  553. package/src/components/editor/ui/suggestion-toolbar-button.tsx +0 -25
  554. package/src/components/editor/ui/table-icons.tsx +0 -685
  555. package/src/components/editor/ui/table-node-static.tsx +0 -86
  556. package/src/components/editor/ui/table-node.tsx +0 -569
  557. package/src/components/editor/ui/table-toolbar-button.tsx +0 -260
  558. package/src/components/editor/ui/turn-into-toolbar-button.tsx +0 -176
  559. package/src/components/editor/use-chat.ts +0 -120
  560. package/src/components/icons/logo.tsx +0 -37
  561. package/src/components/json-schema-editor/client.tsx +0 -55
  562. package/src/components/json-schema-editor/components/inputs.tsx +0 -612
  563. package/src/components/json-schema-editor/get-default-values.ts +0 -29
  564. package/src/components/json-schema-editor/schema.tsx +0 -206
  565. package/src/components/json-schema-editor/utils/merge-schema.ts +0 -167
  566. package/src/components/json-schema-editor/utils/schema-to-string.ts +0 -87
  567. package/src/components/nav-user.tsx +0 -102
  568. package/src/components/site-header.tsx +0 -13
  569. package/src/components/ui/alert-dialog.tsx +0 -182
  570. package/src/components/ui/avatar.tsx +0 -96
  571. package/src/components/ui/button.tsx +0 -65
  572. package/src/components/ui/calendar.tsx +0 -186
  573. package/src/components/ui/checkbox.tsx +0 -29
  574. package/src/components/ui/combobox.tsx +0 -267
  575. package/src/components/ui/command.tsx +0 -180
  576. package/src/components/ui/context-menu.tsx +0 -161
  577. package/src/components/ui/dialog.tsx +0 -142
  578. package/src/components/ui/drawer.tsx +0 -120
  579. package/src/components/ui/dropdown-menu.tsx +0 -239
  580. package/src/components/ui/field.tsx +0 -224
  581. package/src/components/ui/input-group.tsx +0 -144
  582. package/src/components/ui/input.tsx +0 -19
  583. package/src/components/ui/label.tsx +0 -18
  584. package/src/components/ui/popover.tsx +0 -76
  585. package/src/components/ui/select.tsx +0 -182
  586. package/src/components/ui/separator.tsx +0 -28
  587. package/src/components/ui/sheet.tsx +0 -130
  588. package/src/components/ui/sidebar.tsx +0 -608
  589. package/src/components/ui/sonner.tsx +0 -45
  590. package/src/components/ui/spinner.tsx +0 -15
  591. package/src/components/ui/table.tsx +0 -89
  592. package/src/components/ui/tabs.tsx +0 -60
  593. package/src/components/ui/textarea.tsx +0 -18
  594. package/src/components/ui/toggle-group.tsx +0 -86
  595. package/src/components/ui/toggle.tsx +0 -45
  596. package/src/components/ui/toolbar.tsx +0 -365
  597. package/src/components/ui/tooltip.tsx +0 -57
  598. package/src/hooks/editor/use-is-creator.ts +0 -21
  599. package/src/hooks/use-mobile.ts +0 -19
  600. package/src/hooks/use-mounted.ts +0 -11
  601. package/src/hooks/use-upload-file.ts +0 -121
  602. package/src/lib/ai/markdown-joiner-transform.ts +0 -235
  603. package/src/lib/config.ts +0 -42
  604. package/src/lib/data/actions.ts +0 -46
  605. package/src/lib/data/boundary.client.tsx +0 -22
  606. package/src/lib/data/boundary.tsx +0 -22
  607. package/src/lib/data/query.ts +0 -9
  608. package/src/lib/data/store.ts +0 -52
  609. package/src/lib/lowlight.ts +0 -3
  610. package/src/lib/uploadthing.ts +0 -19
  611. package/src/lib/utils/deep-equal.ts +0 -37
  612. package/src/lib/utils/remove-undefined.ts +0 -21
  613. package/src/lib/utils/urls.ts +0 -6
  614. package/src/lib/utils.ts +0 -6
  615. package/tsconfig.build.json +0 -24
  616. package/tsconfig.json +0 -37
@@ -0,0 +1,1975 @@
1
+ var Subscribable = class {
2
+ constructor() {
3
+ this.listeners = /* @__PURE__ */ new Set();
4
+ this.subscribe = this.subscribe.bind(this);
5
+ }
6
+ subscribe(listener) {
7
+ this.listeners.add(listener);
8
+ this.onSubscribe();
9
+ return () => {
10
+ this.listeners.delete(listener);
11
+ this.onUnsubscribe();
12
+ };
13
+ }
14
+ hasListeners() {
15
+ return this.listeners.size > 0;
16
+ }
17
+ onSubscribe() {
18
+ }
19
+ onUnsubscribe() {
20
+ }
21
+ };
22
+ var defaultTimeoutProvider = {
23
+ // We need the wrapper function syntax below instead of direct references to
24
+ // global setTimeout etc.
25
+ //
26
+ // BAD: `setTimeout: setTimeout`
27
+ // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
28
+ //
29
+ // If we use direct references here, then anything that wants to spy on or
30
+ // replace the global setTimeout (like tests) won't work since we'll already
31
+ // have a hard reference to the original implementation at the time when this
32
+ // file was imported.
33
+ setTimeout: (callback, delay) => setTimeout(callback, delay),
34
+ clearTimeout: (timeoutId) => clearTimeout(timeoutId),
35
+ setInterval: (callback, delay) => setInterval(callback, delay),
36
+ clearInterval: (intervalId) => clearInterval(intervalId)
37
+ };
38
+ var TimeoutManager = class {
39
+ // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
40
+ // type at app boot; and if we leave that type, then any new timer provider
41
+ // would need to support ReturnType<typeof setTimeout>, which is infeasible.
42
+ //
43
+ // We settle for type safety for the TimeoutProvider type, and accept that
44
+ // this class is unsafe internally to allow for extension.
45
+ #provider = defaultTimeoutProvider;
46
+ #providerCalled = false;
47
+ setTimeoutProvider(provider) {
48
+ if (process.env.NODE_ENV !== "production") {
49
+ if (this.#providerCalled && provider !== this.#provider) {
50
+ console.error(
51
+ `[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,
52
+ { previous: this.#provider, provider }
53
+ );
54
+ }
55
+ }
56
+ this.#provider = provider;
57
+ if (process.env.NODE_ENV !== "production") {
58
+ this.#providerCalled = false;
59
+ }
60
+ }
61
+ setTimeout(callback, delay) {
62
+ if (process.env.NODE_ENV !== "production") {
63
+ this.#providerCalled = true;
64
+ }
65
+ return this.#provider.setTimeout(callback, delay);
66
+ }
67
+ clearTimeout(timeoutId) {
68
+ this.#provider.clearTimeout(timeoutId);
69
+ }
70
+ setInterval(callback, delay) {
71
+ if (process.env.NODE_ENV !== "production") {
72
+ this.#providerCalled = true;
73
+ }
74
+ return this.#provider.setInterval(callback, delay);
75
+ }
76
+ clearInterval(intervalId) {
77
+ this.#provider.clearInterval(intervalId);
78
+ }
79
+ };
80
+ var timeoutManager = new TimeoutManager();
81
+ function systemSetTimeoutZero(callback) {
82
+ setTimeout(callback, 0);
83
+ }
84
+ var isServer = typeof window === "undefined" || "Deno" in globalThis;
85
+ function noop() {
86
+ }
87
+ function functionalUpdate(updater, input) {
88
+ return typeof updater === "function" ? updater(input) : updater;
89
+ }
90
+ function isValidTimeout(value) {
91
+ return typeof value === "number" && value >= 0 && value !== Infinity;
92
+ }
93
+ function timeUntilStale(updatedAt, staleTime) {
94
+ return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
95
+ }
96
+ function resolveStaleTime(staleTime, query) {
97
+ return typeof staleTime === "function" ? staleTime(query) : staleTime;
98
+ }
99
+ function resolveEnabled(enabled, query) {
100
+ return typeof enabled === "function" ? enabled(query) : enabled;
101
+ }
102
+ function matchQuery(filters, query) {
103
+ const {
104
+ type = "all",
105
+ exact,
106
+ fetchStatus,
107
+ predicate,
108
+ queryKey,
109
+ stale
110
+ } = filters;
111
+ if (queryKey) {
112
+ if (exact) {
113
+ if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) {
114
+ return false;
115
+ }
116
+ } else if (!partialMatchKey(query.queryKey, queryKey)) {
117
+ return false;
118
+ }
119
+ }
120
+ if (type !== "all") {
121
+ const isActive = query.isActive();
122
+ if (type === "active" && !isActive) {
123
+ return false;
124
+ }
125
+ if (type === "inactive" && isActive) {
126
+ return false;
127
+ }
128
+ }
129
+ if (typeof stale === "boolean" && query.isStale() !== stale) {
130
+ return false;
131
+ }
132
+ if (fetchStatus && fetchStatus !== query.state.fetchStatus) {
133
+ return false;
134
+ }
135
+ if (predicate && !predicate(query)) {
136
+ return false;
137
+ }
138
+ return true;
139
+ }
140
+ function matchMutation(filters, mutation) {
141
+ const { exact, status, predicate, mutationKey } = filters;
142
+ if (mutationKey) {
143
+ if (!mutation.options.mutationKey) {
144
+ return false;
145
+ }
146
+ if (exact) {
147
+ if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) {
148
+ return false;
149
+ }
150
+ } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) {
151
+ return false;
152
+ }
153
+ }
154
+ if (status && mutation.state.status !== status) {
155
+ return false;
156
+ }
157
+ if (predicate && !predicate(mutation)) {
158
+ return false;
159
+ }
160
+ return true;
161
+ }
162
+ function hashQueryKeyByOptions(queryKey, options) {
163
+ const hashFn = options?.queryKeyHashFn || hashKey;
164
+ return hashFn(queryKey);
165
+ }
166
+ function hashKey(queryKey) {
167
+ return JSON.stringify(
168
+ queryKey,
169
+ (_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {
170
+ result[key] = val[key];
171
+ return result;
172
+ }, {}) : val
173
+ );
174
+ }
175
+ function partialMatchKey(a, b) {
176
+ if (a === b) {
177
+ return true;
178
+ }
179
+ if (typeof a !== typeof b) {
180
+ return false;
181
+ }
182
+ if (a && b && typeof a === "object" && typeof b === "object") {
183
+ return Object.keys(b).every((key) => partialMatchKey(a[key], b[key]));
184
+ }
185
+ return false;
186
+ }
187
+ var hasOwn = Object.prototype.hasOwnProperty;
188
+ function replaceEqualDeep(a, b, depth = 0) {
189
+ if (a === b) {
190
+ return a;
191
+ }
192
+ if (depth > 500) return b;
193
+ const array = isPlainArray(a) && isPlainArray(b);
194
+ if (!array && !(isPlainObject(a) && isPlainObject(b))) return b;
195
+ const aItems = array ? a : Object.keys(a);
196
+ const aSize = aItems.length;
197
+ const bItems = array ? b : Object.keys(b);
198
+ const bSize = bItems.length;
199
+ const copy = array ? new Array(bSize) : {};
200
+ let equalItems = 0;
201
+ for (let i = 0; i < bSize; i++) {
202
+ const key = array ? i : bItems[i];
203
+ const aItem = a[key];
204
+ const bItem = b[key];
205
+ if (aItem === bItem) {
206
+ copy[key] = aItem;
207
+ if (array ? i < aSize : hasOwn.call(a, key)) equalItems++;
208
+ continue;
209
+ }
210
+ if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") {
211
+ copy[key] = bItem;
212
+ continue;
213
+ }
214
+ const v = replaceEqualDeep(aItem, bItem, depth + 1);
215
+ copy[key] = v;
216
+ if (v === aItem) equalItems++;
217
+ }
218
+ return aSize === bSize && equalItems === aSize ? a : copy;
219
+ }
220
+ function isPlainArray(value) {
221
+ return Array.isArray(value) && value.length === Object.keys(value).length;
222
+ }
223
+ function isPlainObject(o) {
224
+ if (!hasObjectPrototype(o)) {
225
+ return false;
226
+ }
227
+ const ctor = o.constructor;
228
+ if (ctor === void 0) {
229
+ return true;
230
+ }
231
+ const prot = ctor.prototype;
232
+ if (!hasObjectPrototype(prot)) {
233
+ return false;
234
+ }
235
+ if (!prot.hasOwnProperty("isPrototypeOf")) {
236
+ return false;
237
+ }
238
+ if (Object.getPrototypeOf(o) !== Object.prototype) {
239
+ return false;
240
+ }
241
+ return true;
242
+ }
243
+ function hasObjectPrototype(o) {
244
+ return Object.prototype.toString.call(o) === "[object Object]";
245
+ }
246
+ function sleep(timeout) {
247
+ return new Promise((resolve) => {
248
+ timeoutManager.setTimeout(resolve, timeout);
249
+ });
250
+ }
251
+ function replaceData(prevData, data, options) {
252
+ if (typeof options.structuralSharing === "function") {
253
+ return options.structuralSharing(prevData, data);
254
+ } else if (options.structuralSharing !== false) {
255
+ if (process.env.NODE_ENV !== "production") {
256
+ try {
257
+ return replaceEqualDeep(prevData, data);
258
+ } catch (error) {
259
+ console.error(
260
+ `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error}`
261
+ );
262
+ throw error;
263
+ }
264
+ }
265
+ return replaceEqualDeep(prevData, data);
266
+ }
267
+ return data;
268
+ }
269
+ function addToEnd(items, item, max = 0) {
270
+ const newItems = [...items, item];
271
+ return max && newItems.length > max ? newItems.slice(1) : newItems;
272
+ }
273
+ function addToStart(items, item, max = 0) {
274
+ const newItems = [item, ...items];
275
+ return max && newItems.length > max ? newItems.slice(0, -1) : newItems;
276
+ }
277
+ var skipToken = /* @__PURE__ */ Symbol();
278
+ function ensureQueryFn(options, fetchOptions) {
279
+ if (process.env.NODE_ENV !== "production") {
280
+ if (options.queryFn === skipToken) {
281
+ console.error(
282
+ `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`
283
+ );
284
+ }
285
+ }
286
+ if (!options.queryFn && fetchOptions?.initialPromise) {
287
+ return () => fetchOptions.initialPromise;
288
+ }
289
+ if (!options.queryFn || options.queryFn === skipToken) {
290
+ return () => Promise.reject(new Error(`Missing queryFn: '${options.queryHash}'`));
291
+ }
292
+ return options.queryFn;
293
+ }
294
+ function addConsumeAwareSignal(object, getSignal, onCancelled) {
295
+ let consumed = false;
296
+ let signal;
297
+ Object.defineProperty(object, "signal", {
298
+ enumerable: true,
299
+ get: () => {
300
+ signal ??= getSignal();
301
+ if (consumed) {
302
+ return signal;
303
+ }
304
+ consumed = true;
305
+ if (signal.aborted) {
306
+ onCancelled();
307
+ } else {
308
+ signal.addEventListener("abort", onCancelled, { once: true });
309
+ }
310
+ return signal;
311
+ }
312
+ });
313
+ return object;
314
+ }
315
+ var FocusManager = class extends Subscribable {
316
+ #focused;
317
+ #cleanup;
318
+ #setup;
319
+ constructor() {
320
+ super();
321
+ this.#setup = (onFocus) => {
322
+ if (!isServer && window.addEventListener) {
323
+ const listener = () => onFocus();
324
+ window.addEventListener("visibilitychange", listener, false);
325
+ return () => {
326
+ window.removeEventListener("visibilitychange", listener);
327
+ };
328
+ }
329
+ return;
330
+ };
331
+ }
332
+ onSubscribe() {
333
+ if (!this.#cleanup) {
334
+ this.setEventListener(this.#setup);
335
+ }
336
+ }
337
+ onUnsubscribe() {
338
+ if (!this.hasListeners()) {
339
+ this.#cleanup?.();
340
+ this.#cleanup = void 0;
341
+ }
342
+ }
343
+ setEventListener(setup) {
344
+ this.#setup = setup;
345
+ this.#cleanup?.();
346
+ this.#cleanup = setup((focused) => {
347
+ if (typeof focused === "boolean") {
348
+ this.setFocused(focused);
349
+ } else {
350
+ this.onFocus();
351
+ }
352
+ });
353
+ }
354
+ setFocused(focused) {
355
+ const changed = this.#focused !== focused;
356
+ if (changed) {
357
+ this.#focused = focused;
358
+ this.onFocus();
359
+ }
360
+ }
361
+ onFocus() {
362
+ const isFocused = this.isFocused();
363
+ this.listeners.forEach((listener) => {
364
+ listener(isFocused);
365
+ });
366
+ }
367
+ isFocused() {
368
+ if (typeof this.#focused === "boolean") {
369
+ return this.#focused;
370
+ }
371
+ return globalThis.document?.visibilityState !== "hidden";
372
+ }
373
+ };
374
+ var focusManager = new FocusManager();
375
+ function pendingThenable() {
376
+ let resolve;
377
+ let reject;
378
+ const thenable = new Promise((_resolve, _reject) => {
379
+ resolve = _resolve;
380
+ reject = _reject;
381
+ });
382
+ thenable.status = "pending";
383
+ thenable.catch(() => {
384
+ });
385
+ function finalize(data) {
386
+ Object.assign(thenable, data);
387
+ delete thenable.resolve;
388
+ delete thenable.reject;
389
+ }
390
+ thenable.resolve = (value) => {
391
+ finalize({
392
+ status: "fulfilled",
393
+ value
394
+ });
395
+ resolve(value);
396
+ };
397
+ thenable.reject = (reason) => {
398
+ finalize({
399
+ status: "rejected",
400
+ reason
401
+ });
402
+ reject(reason);
403
+ };
404
+ return thenable;
405
+ }
406
+ function tryResolveSync(promise) {
407
+ let data;
408
+ promise.then((result) => {
409
+ data = result;
410
+ return result;
411
+ }, noop)?.catch(noop);
412
+ if (data !== void 0) {
413
+ return { data };
414
+ }
415
+ return void 0;
416
+ }
417
+ var defaultScheduler = systemSetTimeoutZero;
418
+ function createNotifyManager() {
419
+ let queue = [];
420
+ let transactions = 0;
421
+ let notifyFn = (callback) => {
422
+ callback();
423
+ };
424
+ let batchNotifyFn = (callback) => {
425
+ callback();
426
+ };
427
+ let scheduleFn = defaultScheduler;
428
+ const schedule = (callback) => {
429
+ if (transactions) {
430
+ queue.push(callback);
431
+ } else {
432
+ scheduleFn(() => {
433
+ notifyFn(callback);
434
+ });
435
+ }
436
+ };
437
+ const flush = () => {
438
+ const originalQueue = queue;
439
+ queue = [];
440
+ if (originalQueue.length) {
441
+ scheduleFn(() => {
442
+ batchNotifyFn(() => {
443
+ originalQueue.forEach((callback) => {
444
+ notifyFn(callback);
445
+ });
446
+ });
447
+ });
448
+ }
449
+ };
450
+ return {
451
+ batch: (callback) => {
452
+ let result;
453
+ transactions++;
454
+ try {
455
+ result = callback();
456
+ } finally {
457
+ transactions--;
458
+ if (!transactions) {
459
+ flush();
460
+ }
461
+ }
462
+ return result;
463
+ },
464
+ /**
465
+ * All calls to the wrapped function will be batched.
466
+ */
467
+ batchCalls: (callback) => {
468
+ return (...args) => {
469
+ schedule(() => {
470
+ callback(...args);
471
+ });
472
+ };
473
+ },
474
+ schedule,
475
+ /**
476
+ * Use this method to set a custom notify function.
477
+ * This can be used to for example wrap notifications with `React.act` while running tests.
478
+ */
479
+ setNotifyFunction: (fn) => {
480
+ notifyFn = fn;
481
+ },
482
+ /**
483
+ * Use this method to set a custom function to batch notifications together into a single tick.
484
+ * By default React Query will use the batch function provided by ReactDOM or React Native.
485
+ */
486
+ setBatchNotifyFunction: (fn) => {
487
+ batchNotifyFn = fn;
488
+ },
489
+ setScheduler: (fn) => {
490
+ scheduleFn = fn;
491
+ }
492
+ };
493
+ }
494
+ var notifyManager = createNotifyManager();
495
+ var OnlineManager = class extends Subscribable {
496
+ #online = true;
497
+ #cleanup;
498
+ #setup;
499
+ constructor() {
500
+ super();
501
+ this.#setup = (onOnline) => {
502
+ if (!isServer && window.addEventListener) {
503
+ const onlineListener = () => onOnline(true);
504
+ const offlineListener = () => onOnline(false);
505
+ window.addEventListener("online", onlineListener, false);
506
+ window.addEventListener("offline", offlineListener, false);
507
+ return () => {
508
+ window.removeEventListener("online", onlineListener);
509
+ window.removeEventListener("offline", offlineListener);
510
+ };
511
+ }
512
+ return;
513
+ };
514
+ }
515
+ onSubscribe() {
516
+ if (!this.#cleanup) {
517
+ this.setEventListener(this.#setup);
518
+ }
519
+ }
520
+ onUnsubscribe() {
521
+ if (!this.hasListeners()) {
522
+ this.#cleanup?.();
523
+ this.#cleanup = void 0;
524
+ }
525
+ }
526
+ setEventListener(setup) {
527
+ this.#setup = setup;
528
+ this.#cleanup?.();
529
+ this.#cleanup = setup(this.setOnline.bind(this));
530
+ }
531
+ setOnline(online) {
532
+ const changed = this.#online !== online;
533
+ if (changed) {
534
+ this.#online = online;
535
+ this.listeners.forEach((listener) => {
536
+ listener(online);
537
+ });
538
+ }
539
+ }
540
+ isOnline() {
541
+ return this.#online;
542
+ }
543
+ };
544
+ var onlineManager = new OnlineManager();
545
+ function defaultRetryDelay(failureCount) {
546
+ return Math.min(1e3 * 2 ** failureCount, 3e4);
547
+ }
548
+ function canFetch(networkMode) {
549
+ return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
550
+ }
551
+ var CancelledError = class extends Error {
552
+ constructor(options) {
553
+ super("CancelledError");
554
+ this.revert = options?.revert;
555
+ this.silent = options?.silent;
556
+ }
557
+ };
558
+ function createRetryer(config) {
559
+ let isRetryCancelled = false;
560
+ let failureCount = 0;
561
+ let continueFn;
562
+ const thenable = pendingThenable();
563
+ const isResolved = () => thenable.status !== "pending";
564
+ const cancel = (cancelOptions) => {
565
+ if (!isResolved()) {
566
+ const error = new CancelledError(cancelOptions);
567
+ reject(error);
568
+ config.onCancel?.(error);
569
+ }
570
+ };
571
+ const cancelRetry = () => {
572
+ isRetryCancelled = true;
573
+ };
574
+ const continueRetry = () => {
575
+ isRetryCancelled = false;
576
+ };
577
+ const canContinue = () => focusManager.isFocused() && (config.networkMode === "always" || onlineManager.isOnline()) && config.canRun();
578
+ const canStart = () => canFetch(config.networkMode) && config.canRun();
579
+ const resolve = (value) => {
580
+ if (!isResolved()) {
581
+ continueFn?.();
582
+ thenable.resolve(value);
583
+ }
584
+ };
585
+ const reject = (value) => {
586
+ if (!isResolved()) {
587
+ continueFn?.();
588
+ thenable.reject(value);
589
+ }
590
+ };
591
+ const pause = () => {
592
+ return new Promise((continueResolve) => {
593
+ continueFn = (value) => {
594
+ if (isResolved() || canContinue()) {
595
+ continueResolve(value);
596
+ }
597
+ };
598
+ config.onPause?.();
599
+ }).then(() => {
600
+ continueFn = void 0;
601
+ if (!isResolved()) {
602
+ config.onContinue?.();
603
+ }
604
+ });
605
+ };
606
+ const run = () => {
607
+ if (isResolved()) {
608
+ return;
609
+ }
610
+ let promiseOrValue;
611
+ const initialPromise = failureCount === 0 ? config.initialPromise : void 0;
612
+ try {
613
+ promiseOrValue = initialPromise ?? config.fn();
614
+ } catch (error) {
615
+ promiseOrValue = Promise.reject(error);
616
+ }
617
+ Promise.resolve(promiseOrValue).then(resolve).catch((error) => {
618
+ if (isResolved()) {
619
+ return;
620
+ }
621
+ const retry = config.retry ?? (isServer ? 0 : 3);
622
+ const retryDelay = config.retryDelay ?? defaultRetryDelay;
623
+ const delay = typeof retryDelay === "function" ? retryDelay(failureCount, error) : retryDelay;
624
+ const shouldRetry = retry === true || typeof retry === "number" && failureCount < retry || typeof retry === "function" && retry(failureCount, error);
625
+ if (isRetryCancelled || !shouldRetry) {
626
+ reject(error);
627
+ return;
628
+ }
629
+ failureCount++;
630
+ config.onFail?.(failureCount, error);
631
+ sleep(delay).then(() => {
632
+ return canContinue() ? void 0 : pause();
633
+ }).then(() => {
634
+ if (isRetryCancelled) {
635
+ reject(error);
636
+ } else {
637
+ run();
638
+ }
639
+ });
640
+ });
641
+ };
642
+ return {
643
+ promise: thenable,
644
+ status: () => thenable.status,
645
+ cancel,
646
+ continue: () => {
647
+ continueFn?.();
648
+ return thenable;
649
+ },
650
+ cancelRetry,
651
+ continueRetry,
652
+ canStart,
653
+ start: () => {
654
+ if (canStart()) {
655
+ run();
656
+ } else {
657
+ pause().then(run);
658
+ }
659
+ return thenable;
660
+ }
661
+ };
662
+ }
663
+ var Removable = class {
664
+ #gcTimeout;
665
+ destroy() {
666
+ this.clearGcTimeout();
667
+ }
668
+ scheduleGc() {
669
+ this.clearGcTimeout();
670
+ if (isValidTimeout(this.gcTime)) {
671
+ this.#gcTimeout = timeoutManager.setTimeout(() => {
672
+ this.optionalRemove();
673
+ }, this.gcTime);
674
+ }
675
+ }
676
+ updateGcTime(newGcTime) {
677
+ this.gcTime = Math.max(
678
+ this.gcTime || 0,
679
+ newGcTime ?? (isServer ? Infinity : 5 * 60 * 1e3)
680
+ );
681
+ }
682
+ clearGcTimeout() {
683
+ if (this.#gcTimeout) {
684
+ timeoutManager.clearTimeout(this.#gcTimeout);
685
+ this.#gcTimeout = void 0;
686
+ }
687
+ }
688
+ };
689
+ var Query = class extends Removable {
690
+ #initialState;
691
+ #revertState;
692
+ #cache;
693
+ #client;
694
+ #retryer;
695
+ #defaultOptions;
696
+ #abortSignalConsumed;
697
+ constructor(config) {
698
+ super();
699
+ this.#abortSignalConsumed = false;
700
+ this.#defaultOptions = config.defaultOptions;
701
+ this.setOptions(config.options);
702
+ this.observers = [];
703
+ this.#client = config.client;
704
+ this.#cache = this.#client.getQueryCache();
705
+ this.queryKey = config.queryKey;
706
+ this.queryHash = config.queryHash;
707
+ this.#initialState = getDefaultState$1(this.options);
708
+ this.state = config.state ?? this.#initialState;
709
+ this.scheduleGc();
710
+ }
711
+ get meta() {
712
+ return this.options.meta;
713
+ }
714
+ get promise() {
715
+ return this.#retryer?.promise;
716
+ }
717
+ setOptions(options) {
718
+ this.options = { ...this.#defaultOptions, ...options };
719
+ this.updateGcTime(this.options.gcTime);
720
+ if (this.state && this.state.data === void 0) {
721
+ const defaultState = getDefaultState$1(this.options);
722
+ if (defaultState.data !== void 0) {
723
+ this.setState(
724
+ successState(defaultState.data, defaultState.dataUpdatedAt)
725
+ );
726
+ this.#initialState = defaultState;
727
+ }
728
+ }
729
+ }
730
+ optionalRemove() {
731
+ if (!this.observers.length && this.state.fetchStatus === "idle") {
732
+ this.#cache.remove(this);
733
+ }
734
+ }
735
+ setData(newData, options) {
736
+ const data = replaceData(this.state.data, newData, this.options);
737
+ this.#dispatch({
738
+ data,
739
+ type: "success",
740
+ dataUpdatedAt: options?.updatedAt,
741
+ manual: options?.manual
742
+ });
743
+ return data;
744
+ }
745
+ setState(state, setStateOptions) {
746
+ this.#dispatch({ type: "setState", state, setStateOptions });
747
+ }
748
+ cancel(options) {
749
+ const promise = this.#retryer?.promise;
750
+ this.#retryer?.cancel(options);
751
+ return promise ? promise.then(noop).catch(noop) : Promise.resolve();
752
+ }
753
+ destroy() {
754
+ super.destroy();
755
+ this.cancel({ silent: true });
756
+ }
757
+ reset() {
758
+ this.destroy();
759
+ this.setState(this.#initialState);
760
+ }
761
+ isActive() {
762
+ return this.observers.some(
763
+ (observer) => resolveEnabled(observer.options.enabled, this) !== false
764
+ );
765
+ }
766
+ isDisabled() {
767
+ if (this.getObserversCount() > 0) {
768
+ return !this.isActive();
769
+ }
770
+ return this.options.queryFn === skipToken || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
771
+ }
772
+ isStatic() {
773
+ if (this.getObserversCount() > 0) {
774
+ return this.observers.some(
775
+ (observer) => resolveStaleTime(observer.options.staleTime, this) === "static"
776
+ );
777
+ }
778
+ return false;
779
+ }
780
+ isStale() {
781
+ if (this.getObserversCount() > 0) {
782
+ return this.observers.some(
783
+ (observer) => observer.getCurrentResult().isStale
784
+ );
785
+ }
786
+ return this.state.data === void 0 || this.state.isInvalidated;
787
+ }
788
+ isStaleByTime(staleTime = 0) {
789
+ if (this.state.data === void 0) {
790
+ return true;
791
+ }
792
+ if (staleTime === "static") {
793
+ return false;
794
+ }
795
+ if (this.state.isInvalidated) {
796
+ return true;
797
+ }
798
+ return !timeUntilStale(this.state.dataUpdatedAt, staleTime);
799
+ }
800
+ onFocus() {
801
+ const observer = this.observers.find((x) => x.shouldFetchOnWindowFocus());
802
+ observer?.refetch({ cancelRefetch: false });
803
+ this.#retryer?.continue();
804
+ }
805
+ onOnline() {
806
+ const observer = this.observers.find((x) => x.shouldFetchOnReconnect());
807
+ observer?.refetch({ cancelRefetch: false });
808
+ this.#retryer?.continue();
809
+ }
810
+ addObserver(observer) {
811
+ if (!this.observers.includes(observer)) {
812
+ this.observers.push(observer);
813
+ this.clearGcTimeout();
814
+ this.#cache.notify({ type: "observerAdded", query: this, observer });
815
+ }
816
+ }
817
+ removeObserver(observer) {
818
+ if (this.observers.includes(observer)) {
819
+ this.observers = this.observers.filter((x) => x !== observer);
820
+ if (!this.observers.length) {
821
+ if (this.#retryer) {
822
+ if (this.#abortSignalConsumed) {
823
+ this.#retryer.cancel({ revert: true });
824
+ } else {
825
+ this.#retryer.cancelRetry();
826
+ }
827
+ }
828
+ this.scheduleGc();
829
+ }
830
+ this.#cache.notify({ type: "observerRemoved", query: this, observer });
831
+ }
832
+ }
833
+ getObserversCount() {
834
+ return this.observers.length;
835
+ }
836
+ invalidate() {
837
+ if (!this.state.isInvalidated) {
838
+ this.#dispatch({ type: "invalidate" });
839
+ }
840
+ }
841
+ async fetch(options, fetchOptions) {
842
+ if (this.state.fetchStatus !== "idle" && // If the promise in the retryer is already rejected, we have to definitely
843
+ // re-start the fetch; there is a chance that the query is still in a
844
+ // pending state when that happens
845
+ this.#retryer?.status() !== "rejected") {
846
+ if (this.state.data !== void 0 && fetchOptions?.cancelRefetch) {
847
+ this.cancel({ silent: true });
848
+ } else if (this.#retryer) {
849
+ this.#retryer.continueRetry();
850
+ return this.#retryer.promise;
851
+ }
852
+ }
853
+ if (options) {
854
+ this.setOptions(options);
855
+ }
856
+ if (!this.options.queryFn) {
857
+ const observer = this.observers.find((x) => x.options.queryFn);
858
+ if (observer) {
859
+ this.setOptions(observer.options);
860
+ }
861
+ }
862
+ if (process.env.NODE_ENV !== "production") {
863
+ if (!Array.isArray(this.options.queryKey)) {
864
+ console.error(
865
+ `As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`
866
+ );
867
+ }
868
+ }
869
+ const abortController = new AbortController();
870
+ const addSignalProperty = (object) => {
871
+ Object.defineProperty(object, "signal", {
872
+ enumerable: true,
873
+ get: () => {
874
+ this.#abortSignalConsumed = true;
875
+ return abortController.signal;
876
+ }
877
+ });
878
+ };
879
+ const fetchFn = () => {
880
+ const queryFn = ensureQueryFn(this.options, fetchOptions);
881
+ const createQueryFnContext = () => {
882
+ const queryFnContext2 = {
883
+ client: this.#client,
884
+ queryKey: this.queryKey,
885
+ meta: this.meta
886
+ };
887
+ addSignalProperty(queryFnContext2);
888
+ return queryFnContext2;
889
+ };
890
+ const queryFnContext = createQueryFnContext();
891
+ this.#abortSignalConsumed = false;
892
+ if (this.options.persister) {
893
+ return this.options.persister(
894
+ queryFn,
895
+ queryFnContext,
896
+ this
897
+ );
898
+ }
899
+ return queryFn(queryFnContext);
900
+ };
901
+ const createFetchContext = () => {
902
+ const context2 = {
903
+ fetchOptions,
904
+ options: this.options,
905
+ queryKey: this.queryKey,
906
+ client: this.#client,
907
+ state: this.state,
908
+ fetchFn
909
+ };
910
+ addSignalProperty(context2);
911
+ return context2;
912
+ };
913
+ const context = createFetchContext();
914
+ this.options.behavior?.onFetch(context, this);
915
+ this.#revertState = this.state;
916
+ if (this.state.fetchStatus === "idle" || this.state.fetchMeta !== context.fetchOptions?.meta) {
917
+ this.#dispatch({ type: "fetch", meta: context.fetchOptions?.meta });
918
+ }
919
+ this.#retryer = createRetryer({
920
+ initialPromise: fetchOptions?.initialPromise,
921
+ fn: context.fetchFn,
922
+ onCancel: (error) => {
923
+ if (error instanceof CancelledError && error.revert) {
924
+ this.setState({
925
+ ...this.#revertState,
926
+ fetchStatus: "idle"
927
+ });
928
+ }
929
+ abortController.abort();
930
+ },
931
+ onFail: (failureCount, error) => {
932
+ this.#dispatch({ type: "failed", failureCount, error });
933
+ },
934
+ onPause: () => {
935
+ this.#dispatch({ type: "pause" });
936
+ },
937
+ onContinue: () => {
938
+ this.#dispatch({ type: "continue" });
939
+ },
940
+ retry: context.options.retry,
941
+ retryDelay: context.options.retryDelay,
942
+ networkMode: context.options.networkMode,
943
+ canRun: () => true
944
+ });
945
+ try {
946
+ const data = await this.#retryer.start();
947
+ if (data === void 0) {
948
+ if (process.env.NODE_ENV !== "production") {
949
+ console.error(
950
+ `Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
951
+ );
952
+ }
953
+ throw new Error(`${this.queryHash} data is undefined`);
954
+ }
955
+ this.setData(data);
956
+ this.#cache.config.onSuccess?.(data, this);
957
+ this.#cache.config.onSettled?.(
958
+ data,
959
+ this.state.error,
960
+ this
961
+ );
962
+ return data;
963
+ } catch (error) {
964
+ if (error instanceof CancelledError) {
965
+ if (error.silent) {
966
+ return this.#retryer.promise;
967
+ } else if (error.revert) {
968
+ if (this.state.data === void 0) {
969
+ throw error;
970
+ }
971
+ return this.state.data;
972
+ }
973
+ }
974
+ this.#dispatch({
975
+ type: "error",
976
+ error
977
+ });
978
+ this.#cache.config.onError?.(
979
+ error,
980
+ this
981
+ );
982
+ this.#cache.config.onSettled?.(
983
+ this.state.data,
984
+ error,
985
+ this
986
+ );
987
+ throw error;
988
+ } finally {
989
+ this.scheduleGc();
990
+ }
991
+ }
992
+ #dispatch(action) {
993
+ const reducer = (state) => {
994
+ switch (action.type) {
995
+ case "failed":
996
+ return {
997
+ ...state,
998
+ fetchFailureCount: action.failureCount,
999
+ fetchFailureReason: action.error
1000
+ };
1001
+ case "pause":
1002
+ return {
1003
+ ...state,
1004
+ fetchStatus: "paused"
1005
+ };
1006
+ case "continue":
1007
+ return {
1008
+ ...state,
1009
+ fetchStatus: "fetching"
1010
+ };
1011
+ case "fetch":
1012
+ return {
1013
+ ...state,
1014
+ ...fetchState(state.data, this.options),
1015
+ fetchMeta: action.meta ?? null
1016
+ };
1017
+ case "success":
1018
+ const newState = {
1019
+ ...state,
1020
+ ...successState(action.data, action.dataUpdatedAt),
1021
+ dataUpdateCount: state.dataUpdateCount + 1,
1022
+ ...!action.manual && {
1023
+ fetchStatus: "idle",
1024
+ fetchFailureCount: 0,
1025
+ fetchFailureReason: null
1026
+ }
1027
+ };
1028
+ this.#revertState = action.manual ? newState : void 0;
1029
+ return newState;
1030
+ case "error":
1031
+ const error = action.error;
1032
+ return {
1033
+ ...state,
1034
+ error,
1035
+ errorUpdateCount: state.errorUpdateCount + 1,
1036
+ errorUpdatedAt: Date.now(),
1037
+ fetchFailureCount: state.fetchFailureCount + 1,
1038
+ fetchFailureReason: error,
1039
+ fetchStatus: "idle",
1040
+ status: "error",
1041
+ // flag existing data as invalidated if we get a background error
1042
+ // note that "no data" always means stale so we can set unconditionally here
1043
+ isInvalidated: true
1044
+ };
1045
+ case "invalidate":
1046
+ return {
1047
+ ...state,
1048
+ isInvalidated: true
1049
+ };
1050
+ case "setState":
1051
+ return {
1052
+ ...state,
1053
+ ...action.state
1054
+ };
1055
+ }
1056
+ };
1057
+ this.state = reducer(this.state);
1058
+ notifyManager.batch(() => {
1059
+ this.observers.forEach((observer) => {
1060
+ observer.onQueryUpdate();
1061
+ });
1062
+ this.#cache.notify({ query: this, type: "updated", action });
1063
+ });
1064
+ }
1065
+ };
1066
+ function fetchState(data, options) {
1067
+ return {
1068
+ fetchFailureCount: 0,
1069
+ fetchFailureReason: null,
1070
+ fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
1071
+ ...data === void 0 && {
1072
+ error: null,
1073
+ status: "pending"
1074
+ }
1075
+ };
1076
+ }
1077
+ function successState(data, dataUpdatedAt) {
1078
+ return {
1079
+ data,
1080
+ dataUpdatedAt: dataUpdatedAt ?? Date.now(),
1081
+ error: null,
1082
+ isInvalidated: false,
1083
+ status: "success"
1084
+ };
1085
+ }
1086
+ function getDefaultState$1(options) {
1087
+ const data = typeof options.initialData === "function" ? options.initialData() : options.initialData;
1088
+ const hasData = data !== void 0;
1089
+ const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === "function" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;
1090
+ return {
1091
+ data,
1092
+ dataUpdateCount: 0,
1093
+ dataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,
1094
+ error: null,
1095
+ errorUpdateCount: 0,
1096
+ errorUpdatedAt: 0,
1097
+ fetchFailureCount: 0,
1098
+ fetchFailureReason: null,
1099
+ fetchMeta: null,
1100
+ isInvalidated: false,
1101
+ status: hasData ? "success" : "pending",
1102
+ fetchStatus: "idle"
1103
+ };
1104
+ }
1105
+ function infiniteQueryBehavior(pages) {
1106
+ return {
1107
+ onFetch: (context, query) => {
1108
+ const options = context.options;
1109
+ const direction = context.fetchOptions?.meta?.fetchMore?.direction;
1110
+ const oldPages = context.state.data?.pages || [];
1111
+ const oldPageParams = context.state.data?.pageParams || [];
1112
+ let result = { pages: [], pageParams: [] };
1113
+ let currentPage = 0;
1114
+ const fetchFn = async () => {
1115
+ let cancelled = false;
1116
+ const addSignalProperty = (object) => {
1117
+ addConsumeAwareSignal(
1118
+ object,
1119
+ () => context.signal,
1120
+ () => cancelled = true
1121
+ );
1122
+ };
1123
+ const queryFn = ensureQueryFn(context.options, context.fetchOptions);
1124
+ const fetchPage = async (data, param, previous) => {
1125
+ if (cancelled) {
1126
+ return Promise.reject();
1127
+ }
1128
+ if (param == null && data.pages.length) {
1129
+ return Promise.resolve(data);
1130
+ }
1131
+ const createQueryFnContext = () => {
1132
+ const queryFnContext2 = {
1133
+ client: context.client,
1134
+ queryKey: context.queryKey,
1135
+ pageParam: param,
1136
+ direction: previous ? "backward" : "forward",
1137
+ meta: context.options.meta
1138
+ };
1139
+ addSignalProperty(queryFnContext2);
1140
+ return queryFnContext2;
1141
+ };
1142
+ const queryFnContext = createQueryFnContext();
1143
+ const page = await queryFn(queryFnContext);
1144
+ const { maxPages } = context.options;
1145
+ const addTo = previous ? addToStart : addToEnd;
1146
+ return {
1147
+ pages: addTo(data.pages, page, maxPages),
1148
+ pageParams: addTo(data.pageParams, param, maxPages)
1149
+ };
1150
+ };
1151
+ if (direction && oldPages.length) {
1152
+ const previous = direction === "backward";
1153
+ const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;
1154
+ const oldData = {
1155
+ pages: oldPages,
1156
+ pageParams: oldPageParams
1157
+ };
1158
+ const param = pageParamFn(options, oldData);
1159
+ result = await fetchPage(oldData, param, previous);
1160
+ } else {
1161
+ const remainingPages = pages ?? oldPages.length;
1162
+ do {
1163
+ const param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result);
1164
+ if (currentPage > 0 && param == null) {
1165
+ break;
1166
+ }
1167
+ result = await fetchPage(result, param);
1168
+ currentPage++;
1169
+ } while (currentPage < remainingPages);
1170
+ }
1171
+ return result;
1172
+ };
1173
+ if (context.options.persister) {
1174
+ context.fetchFn = () => {
1175
+ return context.options.persister?.(
1176
+ fetchFn,
1177
+ {
1178
+ client: context.client,
1179
+ queryKey: context.queryKey,
1180
+ meta: context.options.meta,
1181
+ signal: context.signal
1182
+ },
1183
+ query
1184
+ );
1185
+ };
1186
+ } else {
1187
+ context.fetchFn = fetchFn;
1188
+ }
1189
+ }
1190
+ };
1191
+ }
1192
+ function getNextPageParam(options, { pages, pageParams }) {
1193
+ const lastIndex = pages.length - 1;
1194
+ return pages.length > 0 ? options.getNextPageParam(
1195
+ pages[lastIndex],
1196
+ pages,
1197
+ pageParams[lastIndex],
1198
+ pageParams
1199
+ ) : void 0;
1200
+ }
1201
+ function getPreviousPageParam(options, { pages, pageParams }) {
1202
+ return pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0;
1203
+ }
1204
+ var Mutation = class extends Removable {
1205
+ #client;
1206
+ #observers;
1207
+ #mutationCache;
1208
+ #retryer;
1209
+ constructor(config) {
1210
+ super();
1211
+ this.#client = config.client;
1212
+ this.mutationId = config.mutationId;
1213
+ this.#mutationCache = config.mutationCache;
1214
+ this.#observers = [];
1215
+ this.state = config.state || getDefaultState();
1216
+ this.setOptions(config.options);
1217
+ this.scheduleGc();
1218
+ }
1219
+ setOptions(options) {
1220
+ this.options = options;
1221
+ this.updateGcTime(this.options.gcTime);
1222
+ }
1223
+ get meta() {
1224
+ return this.options.meta;
1225
+ }
1226
+ addObserver(observer) {
1227
+ if (!this.#observers.includes(observer)) {
1228
+ this.#observers.push(observer);
1229
+ this.clearGcTimeout();
1230
+ this.#mutationCache.notify({
1231
+ type: "observerAdded",
1232
+ mutation: this,
1233
+ observer
1234
+ });
1235
+ }
1236
+ }
1237
+ removeObserver(observer) {
1238
+ this.#observers = this.#observers.filter((x) => x !== observer);
1239
+ this.scheduleGc();
1240
+ this.#mutationCache.notify({
1241
+ type: "observerRemoved",
1242
+ mutation: this,
1243
+ observer
1244
+ });
1245
+ }
1246
+ optionalRemove() {
1247
+ if (!this.#observers.length) {
1248
+ if (this.state.status === "pending") {
1249
+ this.scheduleGc();
1250
+ } else {
1251
+ this.#mutationCache.remove(this);
1252
+ }
1253
+ }
1254
+ }
1255
+ continue() {
1256
+ return this.#retryer?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
1257
+ this.execute(this.state.variables);
1258
+ }
1259
+ async execute(variables) {
1260
+ const onContinue = () => {
1261
+ this.#dispatch({ type: "continue" });
1262
+ };
1263
+ const mutationFnContext = {
1264
+ client: this.#client,
1265
+ meta: this.options.meta,
1266
+ mutationKey: this.options.mutationKey
1267
+ };
1268
+ this.#retryer = createRetryer({
1269
+ fn: () => {
1270
+ if (!this.options.mutationFn) {
1271
+ return Promise.reject(new Error("No mutationFn found"));
1272
+ }
1273
+ return this.options.mutationFn(variables, mutationFnContext);
1274
+ },
1275
+ onFail: (failureCount, error) => {
1276
+ this.#dispatch({ type: "failed", failureCount, error });
1277
+ },
1278
+ onPause: () => {
1279
+ this.#dispatch({ type: "pause" });
1280
+ },
1281
+ onContinue,
1282
+ retry: this.options.retry ?? 0,
1283
+ retryDelay: this.options.retryDelay,
1284
+ networkMode: this.options.networkMode,
1285
+ canRun: () => this.#mutationCache.canRun(this)
1286
+ });
1287
+ const restored = this.state.status === "pending";
1288
+ const isPaused = !this.#retryer.canStart();
1289
+ try {
1290
+ if (restored) {
1291
+ onContinue();
1292
+ } else {
1293
+ this.#dispatch({ type: "pending", variables, isPaused });
1294
+ if (this.#mutationCache.config.onMutate) {
1295
+ await this.#mutationCache.config.onMutate(
1296
+ variables,
1297
+ this,
1298
+ mutationFnContext
1299
+ );
1300
+ }
1301
+ const context = await this.options.onMutate?.(
1302
+ variables,
1303
+ mutationFnContext
1304
+ );
1305
+ if (context !== this.state.context) {
1306
+ this.#dispatch({
1307
+ type: "pending",
1308
+ context,
1309
+ variables,
1310
+ isPaused
1311
+ });
1312
+ }
1313
+ }
1314
+ const data = await this.#retryer.start();
1315
+ await this.#mutationCache.config.onSuccess?.(
1316
+ data,
1317
+ variables,
1318
+ this.state.context,
1319
+ this,
1320
+ mutationFnContext
1321
+ );
1322
+ await this.options.onSuccess?.(
1323
+ data,
1324
+ variables,
1325
+ this.state.context,
1326
+ mutationFnContext
1327
+ );
1328
+ await this.#mutationCache.config.onSettled?.(
1329
+ data,
1330
+ null,
1331
+ this.state.variables,
1332
+ this.state.context,
1333
+ this,
1334
+ mutationFnContext
1335
+ );
1336
+ await this.options.onSettled?.(
1337
+ data,
1338
+ null,
1339
+ variables,
1340
+ this.state.context,
1341
+ mutationFnContext
1342
+ );
1343
+ this.#dispatch({ type: "success", data });
1344
+ return data;
1345
+ } catch (error) {
1346
+ try {
1347
+ await this.#mutationCache.config.onError?.(
1348
+ error,
1349
+ variables,
1350
+ this.state.context,
1351
+ this,
1352
+ mutationFnContext
1353
+ );
1354
+ } catch (e) {
1355
+ void Promise.reject(e);
1356
+ }
1357
+ try {
1358
+ await this.options.onError?.(
1359
+ error,
1360
+ variables,
1361
+ this.state.context,
1362
+ mutationFnContext
1363
+ );
1364
+ } catch (e) {
1365
+ void Promise.reject(e);
1366
+ }
1367
+ try {
1368
+ await this.#mutationCache.config.onSettled?.(
1369
+ void 0,
1370
+ error,
1371
+ this.state.variables,
1372
+ this.state.context,
1373
+ this,
1374
+ mutationFnContext
1375
+ );
1376
+ } catch (e) {
1377
+ void Promise.reject(e);
1378
+ }
1379
+ try {
1380
+ await this.options.onSettled?.(
1381
+ void 0,
1382
+ error,
1383
+ variables,
1384
+ this.state.context,
1385
+ mutationFnContext
1386
+ );
1387
+ } catch (e) {
1388
+ void Promise.reject(e);
1389
+ }
1390
+ this.#dispatch({ type: "error", error });
1391
+ throw error;
1392
+ } finally {
1393
+ this.#mutationCache.runNext(this);
1394
+ }
1395
+ }
1396
+ #dispatch(action) {
1397
+ const reducer = (state) => {
1398
+ switch (action.type) {
1399
+ case "failed":
1400
+ return {
1401
+ ...state,
1402
+ failureCount: action.failureCount,
1403
+ failureReason: action.error
1404
+ };
1405
+ case "pause":
1406
+ return {
1407
+ ...state,
1408
+ isPaused: true
1409
+ };
1410
+ case "continue":
1411
+ return {
1412
+ ...state,
1413
+ isPaused: false
1414
+ };
1415
+ case "pending":
1416
+ return {
1417
+ ...state,
1418
+ context: action.context,
1419
+ data: void 0,
1420
+ failureCount: 0,
1421
+ failureReason: null,
1422
+ error: null,
1423
+ isPaused: action.isPaused,
1424
+ status: "pending",
1425
+ variables: action.variables,
1426
+ submittedAt: Date.now()
1427
+ };
1428
+ case "success":
1429
+ return {
1430
+ ...state,
1431
+ data: action.data,
1432
+ failureCount: 0,
1433
+ failureReason: null,
1434
+ error: null,
1435
+ status: "success",
1436
+ isPaused: false
1437
+ };
1438
+ case "error":
1439
+ return {
1440
+ ...state,
1441
+ data: void 0,
1442
+ error: action.error,
1443
+ failureCount: state.failureCount + 1,
1444
+ failureReason: action.error,
1445
+ isPaused: false,
1446
+ status: "error"
1447
+ };
1448
+ }
1449
+ };
1450
+ this.state = reducer(this.state);
1451
+ notifyManager.batch(() => {
1452
+ this.#observers.forEach((observer) => {
1453
+ observer.onMutationUpdate(action);
1454
+ });
1455
+ this.#mutationCache.notify({
1456
+ mutation: this,
1457
+ type: "updated",
1458
+ action
1459
+ });
1460
+ });
1461
+ }
1462
+ };
1463
+ function getDefaultState() {
1464
+ return {
1465
+ context: void 0,
1466
+ data: void 0,
1467
+ error: null,
1468
+ failureCount: 0,
1469
+ failureReason: null,
1470
+ isPaused: false,
1471
+ status: "idle",
1472
+ variables: void 0,
1473
+ submittedAt: 0
1474
+ };
1475
+ }
1476
+ var MutationCache = class extends Subscribable {
1477
+ constructor(config = {}) {
1478
+ super();
1479
+ this.config = config;
1480
+ this.#mutations = /* @__PURE__ */ new Set();
1481
+ this.#scopes = /* @__PURE__ */ new Map();
1482
+ this.#mutationId = 0;
1483
+ }
1484
+ #mutations;
1485
+ #scopes;
1486
+ #mutationId;
1487
+ build(client, options, state) {
1488
+ const mutation = new Mutation({
1489
+ client,
1490
+ mutationCache: this,
1491
+ mutationId: ++this.#mutationId,
1492
+ options: client.defaultMutationOptions(options),
1493
+ state
1494
+ });
1495
+ this.add(mutation);
1496
+ return mutation;
1497
+ }
1498
+ add(mutation) {
1499
+ this.#mutations.add(mutation);
1500
+ const scope = scopeFor(mutation);
1501
+ if (typeof scope === "string") {
1502
+ const scopedMutations = this.#scopes.get(scope);
1503
+ if (scopedMutations) {
1504
+ scopedMutations.push(mutation);
1505
+ } else {
1506
+ this.#scopes.set(scope, [mutation]);
1507
+ }
1508
+ }
1509
+ this.notify({ type: "added", mutation });
1510
+ }
1511
+ remove(mutation) {
1512
+ if (this.#mutations.delete(mutation)) {
1513
+ const scope = scopeFor(mutation);
1514
+ if (typeof scope === "string") {
1515
+ const scopedMutations = this.#scopes.get(scope);
1516
+ if (scopedMutations) {
1517
+ if (scopedMutations.length > 1) {
1518
+ const index = scopedMutations.indexOf(mutation);
1519
+ if (index !== -1) {
1520
+ scopedMutations.splice(index, 1);
1521
+ }
1522
+ } else if (scopedMutations[0] === mutation) {
1523
+ this.#scopes.delete(scope);
1524
+ }
1525
+ }
1526
+ }
1527
+ }
1528
+ this.notify({ type: "removed", mutation });
1529
+ }
1530
+ canRun(mutation) {
1531
+ const scope = scopeFor(mutation);
1532
+ if (typeof scope === "string") {
1533
+ const mutationsWithSameScope = this.#scopes.get(scope);
1534
+ const firstPendingMutation = mutationsWithSameScope?.find(
1535
+ (m) => m.state.status === "pending"
1536
+ );
1537
+ return !firstPendingMutation || firstPendingMutation === mutation;
1538
+ } else {
1539
+ return true;
1540
+ }
1541
+ }
1542
+ runNext(mutation) {
1543
+ const scope = scopeFor(mutation);
1544
+ if (typeof scope === "string") {
1545
+ const foundMutation = this.#scopes.get(scope)?.find((m) => m !== mutation && m.state.isPaused);
1546
+ return foundMutation?.continue() ?? Promise.resolve();
1547
+ } else {
1548
+ return Promise.resolve();
1549
+ }
1550
+ }
1551
+ clear() {
1552
+ notifyManager.batch(() => {
1553
+ this.#mutations.forEach((mutation) => {
1554
+ this.notify({ type: "removed", mutation });
1555
+ });
1556
+ this.#mutations.clear();
1557
+ this.#scopes.clear();
1558
+ });
1559
+ }
1560
+ getAll() {
1561
+ return Array.from(this.#mutations);
1562
+ }
1563
+ find(filters) {
1564
+ const defaultedFilters = { exact: true, ...filters };
1565
+ return this.getAll().find(
1566
+ (mutation) => matchMutation(defaultedFilters, mutation)
1567
+ );
1568
+ }
1569
+ findAll(filters = {}) {
1570
+ return this.getAll().filter((mutation) => matchMutation(filters, mutation));
1571
+ }
1572
+ notify(event) {
1573
+ notifyManager.batch(() => {
1574
+ this.listeners.forEach((listener) => {
1575
+ listener(event);
1576
+ });
1577
+ });
1578
+ }
1579
+ resumePausedMutations() {
1580
+ const pausedMutations = this.getAll().filter((x) => x.state.isPaused);
1581
+ return notifyManager.batch(
1582
+ () => Promise.all(
1583
+ pausedMutations.map((mutation) => mutation.continue().catch(noop))
1584
+ )
1585
+ );
1586
+ }
1587
+ };
1588
+ function scopeFor(mutation) {
1589
+ return mutation.options.scope?.id;
1590
+ }
1591
+ var QueryCache = class extends Subscribable {
1592
+ constructor(config = {}) {
1593
+ super();
1594
+ this.config = config;
1595
+ this.#queries = /* @__PURE__ */ new Map();
1596
+ }
1597
+ #queries;
1598
+ build(client, options, state) {
1599
+ const queryKey = options.queryKey;
1600
+ const queryHash = options.queryHash ?? hashQueryKeyByOptions(queryKey, options);
1601
+ let query = this.get(queryHash);
1602
+ if (!query) {
1603
+ query = new Query({
1604
+ client,
1605
+ queryKey,
1606
+ queryHash,
1607
+ options: client.defaultQueryOptions(options),
1608
+ state,
1609
+ defaultOptions: client.getQueryDefaults(queryKey)
1610
+ });
1611
+ this.add(query);
1612
+ }
1613
+ return query;
1614
+ }
1615
+ add(query) {
1616
+ if (!this.#queries.has(query.queryHash)) {
1617
+ this.#queries.set(query.queryHash, query);
1618
+ this.notify({
1619
+ type: "added",
1620
+ query
1621
+ });
1622
+ }
1623
+ }
1624
+ remove(query) {
1625
+ const queryInMap = this.#queries.get(query.queryHash);
1626
+ if (queryInMap) {
1627
+ query.destroy();
1628
+ if (queryInMap === query) {
1629
+ this.#queries.delete(query.queryHash);
1630
+ }
1631
+ this.notify({ type: "removed", query });
1632
+ }
1633
+ }
1634
+ clear() {
1635
+ notifyManager.batch(() => {
1636
+ this.getAll().forEach((query) => {
1637
+ this.remove(query);
1638
+ });
1639
+ });
1640
+ }
1641
+ get(queryHash) {
1642
+ return this.#queries.get(queryHash);
1643
+ }
1644
+ getAll() {
1645
+ return [...this.#queries.values()];
1646
+ }
1647
+ find(filters) {
1648
+ const defaultedFilters = { exact: true, ...filters };
1649
+ return this.getAll().find(
1650
+ (query) => matchQuery(defaultedFilters, query)
1651
+ );
1652
+ }
1653
+ findAll(filters = {}) {
1654
+ const queries = this.getAll();
1655
+ return Object.keys(filters).length > 0 ? queries.filter((query) => matchQuery(filters, query)) : queries;
1656
+ }
1657
+ notify(event) {
1658
+ notifyManager.batch(() => {
1659
+ this.listeners.forEach((listener) => {
1660
+ listener(event);
1661
+ });
1662
+ });
1663
+ }
1664
+ onFocus() {
1665
+ notifyManager.batch(() => {
1666
+ this.getAll().forEach((query) => {
1667
+ query.onFocus();
1668
+ });
1669
+ });
1670
+ }
1671
+ onOnline() {
1672
+ notifyManager.batch(() => {
1673
+ this.getAll().forEach((query) => {
1674
+ query.onOnline();
1675
+ });
1676
+ });
1677
+ }
1678
+ };
1679
+ var QueryClient = class {
1680
+ #queryCache;
1681
+ #mutationCache;
1682
+ #defaultOptions;
1683
+ #queryDefaults;
1684
+ #mutationDefaults;
1685
+ #mountCount;
1686
+ #unsubscribeFocus;
1687
+ #unsubscribeOnline;
1688
+ constructor(config = {}) {
1689
+ this.#queryCache = config.queryCache || new QueryCache();
1690
+ this.#mutationCache = config.mutationCache || new MutationCache();
1691
+ this.#defaultOptions = config.defaultOptions || {};
1692
+ this.#queryDefaults = /* @__PURE__ */ new Map();
1693
+ this.#mutationDefaults = /* @__PURE__ */ new Map();
1694
+ this.#mountCount = 0;
1695
+ }
1696
+ mount() {
1697
+ this.#mountCount++;
1698
+ if (this.#mountCount !== 1) return;
1699
+ this.#unsubscribeFocus = focusManager.subscribe(async (focused) => {
1700
+ if (focused) {
1701
+ await this.resumePausedMutations();
1702
+ this.#queryCache.onFocus();
1703
+ }
1704
+ });
1705
+ this.#unsubscribeOnline = onlineManager.subscribe(async (online) => {
1706
+ if (online) {
1707
+ await this.resumePausedMutations();
1708
+ this.#queryCache.onOnline();
1709
+ }
1710
+ });
1711
+ }
1712
+ unmount() {
1713
+ this.#mountCount--;
1714
+ if (this.#mountCount !== 0) return;
1715
+ this.#unsubscribeFocus?.();
1716
+ this.#unsubscribeFocus = void 0;
1717
+ this.#unsubscribeOnline?.();
1718
+ this.#unsubscribeOnline = void 0;
1719
+ }
1720
+ isFetching(filters) {
1721
+ return this.#queryCache.findAll({ ...filters, fetchStatus: "fetching" }).length;
1722
+ }
1723
+ isMutating(filters) {
1724
+ return this.#mutationCache.findAll({ ...filters, status: "pending" }).length;
1725
+ }
1726
+ /**
1727
+ * Imperative (non-reactive) way to retrieve data for a QueryKey.
1728
+ * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
1729
+ *
1730
+ * Hint: Do not use this function inside a component, because it won't receive updates.
1731
+ * Use `useQuery` to create a `QueryObserver` that subscribes to changes.
1732
+ */
1733
+ getQueryData(queryKey) {
1734
+ const options = this.defaultQueryOptions({ queryKey });
1735
+ return this.#queryCache.get(options.queryHash)?.state.data;
1736
+ }
1737
+ ensureQueryData(options) {
1738
+ const defaultedOptions = this.defaultQueryOptions(options);
1739
+ const query = this.#queryCache.build(this, defaultedOptions);
1740
+ const cachedData = query.state.data;
1741
+ if (cachedData === void 0) {
1742
+ return this.fetchQuery(options);
1743
+ }
1744
+ if (options.revalidateIfStale && query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query))) {
1745
+ void this.prefetchQuery(defaultedOptions);
1746
+ }
1747
+ return Promise.resolve(cachedData);
1748
+ }
1749
+ getQueriesData(filters) {
1750
+ return this.#queryCache.findAll(filters).map(({ queryKey, state }) => {
1751
+ const data = state.data;
1752
+ return [queryKey, data];
1753
+ });
1754
+ }
1755
+ setQueryData(queryKey, updater, options) {
1756
+ const defaultedOptions = this.defaultQueryOptions({ queryKey });
1757
+ const query = this.#queryCache.get(
1758
+ defaultedOptions.queryHash
1759
+ );
1760
+ const prevData = query?.state.data;
1761
+ const data = functionalUpdate(updater, prevData);
1762
+ if (data === void 0) {
1763
+ return void 0;
1764
+ }
1765
+ return this.#queryCache.build(this, defaultedOptions).setData(data, { ...options, manual: true });
1766
+ }
1767
+ setQueriesData(filters, updater, options) {
1768
+ return notifyManager.batch(
1769
+ () => this.#queryCache.findAll(filters).map(({ queryKey }) => [
1770
+ queryKey,
1771
+ this.setQueryData(queryKey, updater, options)
1772
+ ])
1773
+ );
1774
+ }
1775
+ getQueryState(queryKey) {
1776
+ const options = this.defaultQueryOptions({ queryKey });
1777
+ return this.#queryCache.get(
1778
+ options.queryHash
1779
+ )?.state;
1780
+ }
1781
+ removeQueries(filters) {
1782
+ const queryCache = this.#queryCache;
1783
+ notifyManager.batch(() => {
1784
+ queryCache.findAll(filters).forEach((query) => {
1785
+ queryCache.remove(query);
1786
+ });
1787
+ });
1788
+ }
1789
+ resetQueries(filters, options) {
1790
+ const queryCache = this.#queryCache;
1791
+ return notifyManager.batch(() => {
1792
+ queryCache.findAll(filters).forEach((query) => {
1793
+ query.reset();
1794
+ });
1795
+ return this.refetchQueries(
1796
+ {
1797
+ type: "active",
1798
+ ...filters
1799
+ },
1800
+ options
1801
+ );
1802
+ });
1803
+ }
1804
+ cancelQueries(filters, cancelOptions = {}) {
1805
+ const defaultedCancelOptions = { revert: true, ...cancelOptions };
1806
+ const promises = notifyManager.batch(
1807
+ () => this.#queryCache.findAll(filters).map((query) => query.cancel(defaultedCancelOptions))
1808
+ );
1809
+ return Promise.all(promises).then(noop).catch(noop);
1810
+ }
1811
+ invalidateQueries(filters, options = {}) {
1812
+ return notifyManager.batch(() => {
1813
+ this.#queryCache.findAll(filters).forEach((query) => {
1814
+ query.invalidate();
1815
+ });
1816
+ if (filters?.refetchType === "none") {
1817
+ return Promise.resolve();
1818
+ }
1819
+ return this.refetchQueries(
1820
+ {
1821
+ ...filters,
1822
+ type: filters?.refetchType ?? filters?.type ?? "active"
1823
+ },
1824
+ options
1825
+ );
1826
+ });
1827
+ }
1828
+ refetchQueries(filters, options = {}) {
1829
+ const fetchOptions = {
1830
+ ...options,
1831
+ cancelRefetch: options.cancelRefetch ?? true
1832
+ };
1833
+ const promises = notifyManager.batch(
1834
+ () => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled() && !query.isStatic()).map((query) => {
1835
+ let promise = query.fetch(void 0, fetchOptions);
1836
+ if (!fetchOptions.throwOnError) {
1837
+ promise = promise.catch(noop);
1838
+ }
1839
+ return query.state.fetchStatus === "paused" ? Promise.resolve() : promise;
1840
+ })
1841
+ );
1842
+ return Promise.all(promises).then(noop);
1843
+ }
1844
+ fetchQuery(options) {
1845
+ const defaultedOptions = this.defaultQueryOptions(options);
1846
+ if (defaultedOptions.retry === void 0) {
1847
+ defaultedOptions.retry = false;
1848
+ }
1849
+ const query = this.#queryCache.build(this, defaultedOptions);
1850
+ return query.isStaleByTime(
1851
+ resolveStaleTime(defaultedOptions.staleTime, query)
1852
+ ) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);
1853
+ }
1854
+ prefetchQuery(options) {
1855
+ return this.fetchQuery(options).then(noop).catch(noop);
1856
+ }
1857
+ fetchInfiniteQuery(options) {
1858
+ options.behavior = infiniteQueryBehavior(options.pages);
1859
+ return this.fetchQuery(options);
1860
+ }
1861
+ prefetchInfiniteQuery(options) {
1862
+ return this.fetchInfiniteQuery(options).then(noop).catch(noop);
1863
+ }
1864
+ ensureInfiniteQueryData(options) {
1865
+ options.behavior = infiniteQueryBehavior(options.pages);
1866
+ return this.ensureQueryData(options);
1867
+ }
1868
+ resumePausedMutations() {
1869
+ if (onlineManager.isOnline()) {
1870
+ return this.#mutationCache.resumePausedMutations();
1871
+ }
1872
+ return Promise.resolve();
1873
+ }
1874
+ getQueryCache() {
1875
+ return this.#queryCache;
1876
+ }
1877
+ getMutationCache() {
1878
+ return this.#mutationCache;
1879
+ }
1880
+ getDefaultOptions() {
1881
+ return this.#defaultOptions;
1882
+ }
1883
+ setDefaultOptions(options) {
1884
+ this.#defaultOptions = options;
1885
+ }
1886
+ setQueryDefaults(queryKey, options) {
1887
+ this.#queryDefaults.set(hashKey(queryKey), {
1888
+ queryKey,
1889
+ defaultOptions: options
1890
+ });
1891
+ }
1892
+ getQueryDefaults(queryKey) {
1893
+ const defaults = [...this.#queryDefaults.values()];
1894
+ const result = {};
1895
+ defaults.forEach((queryDefault) => {
1896
+ if (partialMatchKey(queryKey, queryDefault.queryKey)) {
1897
+ Object.assign(result, queryDefault.defaultOptions);
1898
+ }
1899
+ });
1900
+ return result;
1901
+ }
1902
+ setMutationDefaults(mutationKey, options) {
1903
+ this.#mutationDefaults.set(hashKey(mutationKey), {
1904
+ mutationKey,
1905
+ defaultOptions: options
1906
+ });
1907
+ }
1908
+ getMutationDefaults(mutationKey) {
1909
+ const defaults = [...this.#mutationDefaults.values()];
1910
+ const result = {};
1911
+ defaults.forEach((queryDefault) => {
1912
+ if (partialMatchKey(mutationKey, queryDefault.mutationKey)) {
1913
+ Object.assign(result, queryDefault.defaultOptions);
1914
+ }
1915
+ });
1916
+ return result;
1917
+ }
1918
+ defaultQueryOptions(options) {
1919
+ if (options._defaulted) {
1920
+ return options;
1921
+ }
1922
+ const defaultedOptions = {
1923
+ ...this.#defaultOptions.queries,
1924
+ ...this.getQueryDefaults(options.queryKey),
1925
+ ...options,
1926
+ _defaulted: true
1927
+ };
1928
+ if (!defaultedOptions.queryHash) {
1929
+ defaultedOptions.queryHash = hashQueryKeyByOptions(
1930
+ defaultedOptions.queryKey,
1931
+ defaultedOptions
1932
+ );
1933
+ }
1934
+ if (defaultedOptions.refetchOnReconnect === void 0) {
1935
+ defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== "always";
1936
+ }
1937
+ if (defaultedOptions.throwOnError === void 0) {
1938
+ defaultedOptions.throwOnError = !!defaultedOptions.suspense;
1939
+ }
1940
+ if (!defaultedOptions.networkMode && defaultedOptions.persister) {
1941
+ defaultedOptions.networkMode = "offlineFirst";
1942
+ }
1943
+ if (defaultedOptions.queryFn === skipToken) {
1944
+ defaultedOptions.enabled = false;
1945
+ }
1946
+ return defaultedOptions;
1947
+ }
1948
+ defaultMutationOptions(options) {
1949
+ if (options?._defaulted) {
1950
+ return options;
1951
+ }
1952
+ return {
1953
+ ...this.#defaultOptions.mutations,
1954
+ ...options?.mutationKey && this.getMutationDefaults(options.mutationKey),
1955
+ ...options,
1956
+ _defaulted: true
1957
+ };
1958
+ }
1959
+ clear() {
1960
+ this.#queryCache.clear();
1961
+ this.#mutationCache.clear();
1962
+ }
1963
+ };
1964
+ const queryClient = new QueryClient({
1965
+ defaultOptions: {
1966
+ queries: {
1967
+ staleTime: 5 * 1e3
1968
+ }
1969
+ }
1970
+ });
1971
+ export {
1972
+ noop as n,
1973
+ queryClient as q,
1974
+ tryResolveSync as t
1975
+ };