@shopify/shop-minis-react 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/dist/components/MinisContainer.js +11 -10
  2. package/dist/components/MinisContainer.js.map +1 -1
  3. package/dist/components/atoms/content-wrapper.js.map +1 -1
  4. package/dist/components/atoms/video-player.js +28 -26
  5. package/dist/components/atoms/video-player.js.map +1 -1
  6. package/dist/components/commerce/product-card.js +106 -79
  7. package/dist/components/commerce/product-card.js.map +1 -1
  8. package/dist/components/commerce/product-link.js +124 -137
  9. package/dist/components/commerce/product-link.js.map +1 -1
  10. package/dist/components/commerce/search.js +20 -20
  11. package/dist/components/commerce/search.js.map +1 -1
  12. package/dist/components/ui/sonner.js +3 -1
  13. package/dist/components/ui/sonner.js.map +1 -1
  14. package/dist/hooks/content/useContent.js +12 -18
  15. package/dist/hooks/content/useContent.js.map +1 -1
  16. package/dist/hooks/navigation/useNavigateWithTransition.js +10 -11
  17. package/dist/hooks/navigation/useNavigateWithTransition.js.map +1 -1
  18. package/dist/hooks/product/useCuratedProducts.js +9 -11
  19. package/dist/hooks/product/useCuratedProducts.js.map +1 -1
  20. package/dist/hooks/product/usePopularProducts.js +9 -11
  21. package/dist/hooks/product/usePopularProducts.js.map +1 -1
  22. package/dist/hooks/product/useProduct.js +11 -17
  23. package/dist/hooks/product/useProduct.js.map +1 -1
  24. package/dist/hooks/product/useProductList.js +10 -21
  25. package/dist/hooks/product/useProductList.js.map +1 -1
  26. package/dist/hooks/product/useProductLists.js +11 -13
  27. package/dist/hooks/product/useProductLists.js.map +1 -1
  28. package/dist/hooks/product/useProductMedia.js +12 -18
  29. package/dist/hooks/product/useProductMedia.js.map +1 -1
  30. package/dist/hooks/product/useProductSearch.js +34 -27
  31. package/dist/hooks/product/useProductSearch.js.map +1 -1
  32. package/dist/hooks/product/useProductVariants.js +11 -14
  33. package/dist/hooks/product/useProductVariants.js.map +1 -1
  34. package/dist/hooks/product/useProducts.js +12 -11
  35. package/dist/hooks/product/useProducts.js.map +1 -1
  36. package/dist/hooks/product/useRecommendedProducts.js +11 -13
  37. package/dist/hooks/product/useRecommendedProducts.js.map +1 -1
  38. package/dist/hooks/shop/useRecommendedShops.js +11 -13
  39. package/dist/hooks/shop/useRecommendedShops.js.map +1 -1
  40. package/dist/hooks/shop/useShop.js +12 -11
  41. package/dist/hooks/shop/useShop.js.map +1 -1
  42. package/dist/hooks/user/useBuyerAttributes.js +8 -10
  43. package/dist/hooks/user/useBuyerAttributes.js.map +1 -1
  44. package/dist/hooks/user/useCurrentUser.js +7 -9
  45. package/dist/hooks/user/useCurrentUser.js.map +1 -1
  46. package/dist/hooks/user/useFollowedShops.js +11 -14
  47. package/dist/hooks/user/useFollowedShops.js.map +1 -1
  48. package/dist/hooks/user/useOrders.js +7 -9
  49. package/dist/hooks/user/useOrders.js.map +1 -1
  50. package/dist/hooks/user/useRecentProducts.js +11 -13
  51. package/dist/hooks/user/useRecentProducts.js.map +1 -1
  52. package/dist/hooks/user/useRecentShops.js +10 -13
  53. package/dist/hooks/user/useRecentShops.js.map +1 -1
  54. package/dist/hooks/user/useSavedProducts.js +10 -13
  55. package/dist/hooks/user/useSavedProducts.js.map +1 -1
  56. package/dist/index.js +269 -264
  57. package/dist/index.js.map +1 -1
  58. package/dist/internal/components/product-review-stars.js +78 -0
  59. package/dist/internal/components/product-review-stars.js.map +1 -0
  60. package/dist/internal/reactQuery/MinisQueryProvider.js +11 -0
  61. package/dist/internal/reactQuery/MinisQueryProvider.js.map +1 -0
  62. package/dist/internal/reactQuery/queryClient.js +33 -0
  63. package/dist/internal/reactQuery/queryClient.js.map +1 -0
  64. package/dist/internal/reactQuery/useShopActionInfiniteQuery.js +52 -0
  65. package/dist/internal/reactQuery/useShopActionInfiniteQuery.js.map +1 -0
  66. package/dist/internal/reactQuery/useShopActionQuery.js +37 -0
  67. package/dist/internal/reactQuery/useShopActionQuery.js.map +1 -0
  68. package/dist/mocks.js +178 -107
  69. package/dist/mocks.js.map +1 -1
  70. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/focusManager.js +45 -0
  71. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/focusManager.js.map +1 -0
  72. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js +89 -0
  73. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js.map +1 -0
  74. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js +55 -0
  75. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js.map +1 -0
  76. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/mutation.js +198 -0
  77. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/mutation.js.map +1 -0
  78. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/mutationCache.js +99 -0
  79. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/mutationCache.js.map +1 -0
  80. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/notifyManager.js +67 -0
  81. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/notifyManager.js.map +1 -0
  82. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/onlineManager.js +39 -0
  83. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/onlineManager.js.map +1 -0
  84. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/query.js +299 -0
  85. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/query.js.map +1 -0
  86. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryCache.js +80 -0
  87. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryCache.js.map +1 -0
  88. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryClient.js +215 -0
  89. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryClient.js.map +1 -0
  90. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryObserver.js +300 -0
  91. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryObserver.js.map +1 -0
  92. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/removable.js +25 -0
  93. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/removable.js.map +1 -0
  94. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/retryer.js +76 -0
  95. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/retryer.js.map +1 -0
  96. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/subscribable.js +21 -0
  97. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/subscribable.js.map +1 -0
  98. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/thenable.js +26 -0
  99. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/thenable.js.map +1 -0
  100. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/utils.js +176 -0
  101. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/utils.js.map +1 -0
  102. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js +7 -0
  103. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js.map +1 -0
  104. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js +17 -0
  105. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js.map +1 -0
  106. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js +19 -0
  107. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js.map +1 -0
  108. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js +21 -0
  109. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js.map +1 -0
  110. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/suspense.js +18 -0
  111. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/suspense.js.map +1 -0
  112. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js +64 -0
  113. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js.map +1 -0
  114. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.js +13 -0
  115. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.js.map +1 -0
  116. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useQuery.js +9 -0
  117. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useQuery.js.map +1 -0
  118. package/dist/shop-minis-react/node_modules/.pnpm/lucide-react@0.513.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/star-half.js +21 -0
  119. package/dist/shop-minis-react/node_modules/.pnpm/lucide-react@0.513.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/star-half.js.map +1 -0
  120. package/dist/shop-minis-react/node_modules/.pnpm/sonner@2.0.5_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/sonner/dist/index.js +4 -4
  121. package/dist/shop-minis-react/node_modules/.pnpm/sonner@2.0.5_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/sonner/dist/index.js.map +1 -1
  122. package/package.json +2 -7
  123. package/src/components/MinisContainer.tsx +6 -3
  124. package/src/components/atoms/content-wrapper.tsx +1 -1
  125. package/src/components/atoms/video-player.tsx +7 -0
  126. package/src/components/commerce/product-card.test.tsx +135 -0
  127. package/src/components/commerce/product-card.tsx +39 -5
  128. package/src/components/commerce/product-link.test.tsx +15 -3
  129. package/src/components/commerce/product-link.tsx +9 -25
  130. package/src/components/commerce/search.tsx +2 -2
  131. package/src/components/index.ts +1 -0
  132. package/src/components/ui/sonner.tsx +2 -2
  133. package/src/hooks/content/useContent.ts +6 -17
  134. package/src/hooks/navigation/useNavigateWithTransition.test.ts +46 -7
  135. package/src/hooks/navigation/useNavigateWithTransition.ts +4 -1
  136. package/src/hooks/product/useCuratedProducts.ts +4 -6
  137. package/src/hooks/product/usePopularProducts.ts +4 -6
  138. package/src/hooks/product/useProduct.ts +6 -17
  139. package/src/hooks/product/useProductList.ts +4 -19
  140. package/src/hooks/product/useProductLists.ts +4 -6
  141. package/src/hooks/product/useProductMedia.ts +6 -17
  142. package/src/hooks/product/useProductSearch.ts +19 -15
  143. package/src/hooks/product/useProductVariants.ts +5 -13
  144. package/src/hooks/product/useProducts.ts +8 -12
  145. package/src/hooks/product/useRecommendedProducts.ts +4 -6
  146. package/src/hooks/shop/useRecommendedShops.ts +4 -6
  147. package/src/hooks/shop/useShop.ts +8 -12
  148. package/src/hooks/user/useBuyerAttributes.ts +4 -6
  149. package/src/hooks/user/useCurrentUser.ts +4 -6
  150. package/src/hooks/user/useFollowedShops.ts +5 -13
  151. package/src/hooks/user/useOrders.ts +4 -6
  152. package/src/hooks/user/useRecentProducts.ts +4 -6
  153. package/src/hooks/user/useRecentShops.ts +5 -13
  154. package/src/hooks/user/useSavedProducts.ts +5 -13
  155. package/src/internal/components/product-review-stars.test.tsx +90 -0
  156. package/src/internal/components/product-review-stars.tsx +113 -0
  157. package/src/internal/reactQuery/MinisQueryProvider.test.tsx +38 -0
  158. package/src/internal/reactQuery/MinisQueryProvider.tsx +16 -0
  159. package/src/internal/reactQuery/index.ts +8 -0
  160. package/src/internal/reactQuery/queryClient.test.tsx +91 -0
  161. package/src/internal/reactQuery/queryClient.ts +43 -0
  162. package/src/internal/reactQuery/useShopActionInfiniteQuery.test.tsx +357 -0
  163. package/src/internal/reactQuery/useShopActionInfiniteQuery.ts +129 -0
  164. package/src/internal/reactQuery/useShopActionQuery.test.tsx +184 -0
  165. package/src/internal/reactQuery/useShopActionQuery.ts +74 -0
  166. package/src/mocks.ts +10 -2
  167. package/src/providers/ImagePickerProvider.test.tsx +3 -9
  168. package/dist/internal/useShopActionsDataFetching.js +0 -79
  169. package/dist/internal/useShopActionsDataFetching.js.map +0 -1
  170. package/dist/internal/useShopActionsPaginatedDataFetching.js +0 -96
  171. package/dist/internal/useShopActionsPaginatedDataFetching.js.map +0 -1
  172. package/src/hooks/product/useProductSearch.test.ts +0 -470
  173. package/src/internal/useShopActionsDataFetching.test.ts +0 -465
  174. package/src/internal/useShopActionsDataFetching.ts +0 -150
  175. package/src/internal/useShopActionsPaginatedDataFetching.ts +0 -188
  176. package/src/stories/Accordion.stories.tsx +0 -124
  177. package/src/stories/AddToCart.stories.tsx +0 -251
  178. package/src/stories/Alert.stories.tsx +0 -38
  179. package/src/stories/AlertDialog.stories.tsx +0 -48
  180. package/src/stories/Avatar.stories.tsx +0 -29
  181. package/src/stories/Badge.stories.tsx +0 -46
  182. package/src/stories/Button.stories.tsx +0 -81
  183. package/src/stories/Card.stories.tsx +0 -40
  184. package/src/stories/Checkbox.stories.tsx +0 -44
  185. package/src/stories/FavoriteButton.stories.tsx +0 -58
  186. package/src/stories/IconButton.stories.tsx +0 -68
  187. package/src/stories/ImageContentWrapper.stories.tsx +0 -65
  188. package/src/stories/Input.stories.tsx +0 -44
  189. package/src/stories/Label.stories.tsx +0 -19
  190. package/src/stories/List.stories.tsx +0 -64
  191. package/src/stories/MerchantCard.stories.tsx +0 -127
  192. package/src/stories/ProductCard.stories.tsx +0 -92
  193. package/src/stories/ProductLink.stories.tsx +0 -46
  194. package/src/stories/ProductVariantPrice.stories.tsx +0 -70
  195. package/src/stories/Progress.stories.tsx +0 -30
  196. package/src/stories/PullToRefreshList.stories.tsx +0 -122
  197. package/src/stories/QuantitySelector.stories.tsx +0 -78
  198. package/src/stories/RadioGroup.stories.tsx +0 -51
  199. package/src/stories/Search.stories.tsx +0 -37
  200. package/src/stories/Select.stories.tsx +0 -85
  201. package/src/stories/Skeleton.stories.tsx +0 -19
  202. package/src/stories/TextInput.stories.tsx +0 -26
  203. package/src/stories/Toaster.stories.tsx +0 -46
  204. package/src/stories/Touchable.stories.tsx +0 -40
  205. package/src/stories/VideoPlayer.stories.tsx +0 -129
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queryClient.js","sources":["../../../../../../../../../../node_modules/.pnpm/@tanstack+query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryClient.js"],"sourcesContent":["// src/queryClient.ts\nimport {\n functionalUpdate,\n hashKey,\n hashQueryKeyByOptions,\n noop,\n partialMatchKey,\n resolveStaleTime,\n skipToken\n} from \"./utils.js\";\nimport { QueryCache } from \"./queryCache.js\";\nimport { MutationCache } from \"./mutationCache.js\";\nimport { focusManager } from \"./focusManager.js\";\nimport { onlineManager } from \"./onlineManager.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { infiniteQueryBehavior } from \"./infiniteQueryBehavior.js\";\nvar QueryClient = class {\n #queryCache;\n #mutationCache;\n #defaultOptions;\n #queryDefaults;\n #mutationDefaults;\n #mountCount;\n #unsubscribeFocus;\n #unsubscribeOnline;\n constructor(config = {}) {\n this.#queryCache = config.queryCache || new QueryCache();\n this.#mutationCache = config.mutationCache || new MutationCache();\n this.#defaultOptions = config.defaultOptions || {};\n this.#queryDefaults = /* @__PURE__ */ new Map();\n this.#mutationDefaults = /* @__PURE__ */ new Map();\n this.#mountCount = 0;\n }\n mount() {\n this.#mountCount++;\n if (this.#mountCount !== 1) return;\n this.#unsubscribeFocus = focusManager.subscribe(async (focused) => {\n if (focused) {\n await this.resumePausedMutations();\n this.#queryCache.onFocus();\n }\n });\n this.#unsubscribeOnline = onlineManager.subscribe(async (online) => {\n if (online) {\n await this.resumePausedMutations();\n this.#queryCache.onOnline();\n }\n });\n }\n unmount() {\n this.#mountCount--;\n if (this.#mountCount !== 0) return;\n this.#unsubscribeFocus?.();\n this.#unsubscribeFocus = void 0;\n this.#unsubscribeOnline?.();\n this.#unsubscribeOnline = void 0;\n }\n isFetching(filters) {\n return this.#queryCache.findAll({ ...filters, fetchStatus: \"fetching\" }).length;\n }\n isMutating(filters) {\n return this.#mutationCache.findAll({ ...filters, status: \"pending\" }).length;\n }\n /**\n * Imperative (non-reactive) way to retrieve data for a QueryKey.\n * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.\n *\n * Hint: Do not use this function inside a component, because it won't receive updates.\n * Use `useQuery` to create a `QueryObserver` that subscribes to changes.\n */\n getQueryData(queryKey) {\n const options = this.defaultQueryOptions({ queryKey });\n return this.#queryCache.get(options.queryHash)?.state.data;\n }\n ensureQueryData(options) {\n const defaultedOptions = this.defaultQueryOptions(options);\n const query = this.#queryCache.build(this, defaultedOptions);\n const cachedData = query.state.data;\n if (cachedData === void 0) {\n return this.fetchQuery(options);\n }\n if (options.revalidateIfStale && query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query))) {\n void this.prefetchQuery(defaultedOptions);\n }\n return Promise.resolve(cachedData);\n }\n getQueriesData(filters) {\n return this.#queryCache.findAll(filters).map(({ queryKey, state }) => {\n const data = state.data;\n return [queryKey, data];\n });\n }\n setQueryData(queryKey, updater, options) {\n const defaultedOptions = this.defaultQueryOptions({ queryKey });\n const query = this.#queryCache.get(\n defaultedOptions.queryHash\n );\n const prevData = query?.state.data;\n const data = functionalUpdate(updater, prevData);\n if (data === void 0) {\n return void 0;\n }\n return this.#queryCache.build(this, defaultedOptions).setData(data, { ...options, manual: true });\n }\n setQueriesData(filters, updater, options) {\n return notifyManager.batch(\n () => this.#queryCache.findAll(filters).map(({ queryKey }) => [\n queryKey,\n this.setQueryData(queryKey, updater, options)\n ])\n );\n }\n getQueryState(queryKey) {\n const options = this.defaultQueryOptions({ queryKey });\n return this.#queryCache.get(\n options.queryHash\n )?.state;\n }\n removeQueries(filters) {\n const queryCache = this.#queryCache;\n notifyManager.batch(() => {\n queryCache.findAll(filters).forEach((query) => {\n queryCache.remove(query);\n });\n });\n }\n resetQueries(filters, options) {\n const queryCache = this.#queryCache;\n return notifyManager.batch(() => {\n queryCache.findAll(filters).forEach((query) => {\n query.reset();\n });\n return this.refetchQueries(\n {\n type: \"active\",\n ...filters\n },\n options\n );\n });\n }\n cancelQueries(filters, cancelOptions = {}) {\n const defaultedCancelOptions = { revert: true, ...cancelOptions };\n const promises = notifyManager.batch(\n () => this.#queryCache.findAll(filters).map((query) => query.cancel(defaultedCancelOptions))\n );\n return Promise.all(promises).then(noop).catch(noop);\n }\n invalidateQueries(filters, options = {}) {\n return notifyManager.batch(() => {\n this.#queryCache.findAll(filters).forEach((query) => {\n query.invalidate();\n });\n if (filters?.refetchType === \"none\") {\n return Promise.resolve();\n }\n return this.refetchQueries(\n {\n ...filters,\n type: filters?.refetchType ?? filters?.type ?? \"active\"\n },\n options\n );\n });\n }\n refetchQueries(filters, options = {}) {\n const fetchOptions = {\n ...options,\n cancelRefetch: options.cancelRefetch ?? true\n };\n const promises = notifyManager.batch(\n () => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled() && !query.isStatic()).map((query) => {\n let promise = query.fetch(void 0, fetchOptions);\n if (!fetchOptions.throwOnError) {\n promise = promise.catch(noop);\n }\n return query.state.fetchStatus === \"paused\" ? Promise.resolve() : promise;\n })\n );\n return Promise.all(promises).then(noop);\n }\n fetchQuery(options) {\n const defaultedOptions = this.defaultQueryOptions(options);\n if (defaultedOptions.retry === void 0) {\n defaultedOptions.retry = false;\n }\n const query = this.#queryCache.build(this, defaultedOptions);\n return query.isStaleByTime(\n resolveStaleTime(defaultedOptions.staleTime, query)\n ) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);\n }\n prefetchQuery(options) {\n return this.fetchQuery(options).then(noop).catch(noop);\n }\n fetchInfiniteQuery(options) {\n options.behavior = infiniteQueryBehavior(options.pages);\n return this.fetchQuery(options);\n }\n prefetchInfiniteQuery(options) {\n return this.fetchInfiniteQuery(options).then(noop).catch(noop);\n }\n ensureInfiniteQueryData(options) {\n options.behavior = infiniteQueryBehavior(options.pages);\n return this.ensureQueryData(options);\n }\n resumePausedMutations() {\n if (onlineManager.isOnline()) {\n return this.#mutationCache.resumePausedMutations();\n }\n return Promise.resolve();\n }\n getQueryCache() {\n return this.#queryCache;\n }\n getMutationCache() {\n return this.#mutationCache;\n }\n getDefaultOptions() {\n return this.#defaultOptions;\n }\n setDefaultOptions(options) {\n this.#defaultOptions = options;\n }\n setQueryDefaults(queryKey, options) {\n this.#queryDefaults.set(hashKey(queryKey), {\n queryKey,\n defaultOptions: options\n });\n }\n getQueryDefaults(queryKey) {\n const defaults = [...this.#queryDefaults.values()];\n const result = {};\n defaults.forEach((queryDefault) => {\n if (partialMatchKey(queryKey, queryDefault.queryKey)) {\n Object.assign(result, queryDefault.defaultOptions);\n }\n });\n return result;\n }\n setMutationDefaults(mutationKey, options) {\n this.#mutationDefaults.set(hashKey(mutationKey), {\n mutationKey,\n defaultOptions: options\n });\n }\n getMutationDefaults(mutationKey) {\n const defaults = [...this.#mutationDefaults.values()];\n const result = {};\n defaults.forEach((queryDefault) => {\n if (partialMatchKey(mutationKey, queryDefault.mutationKey)) {\n Object.assign(result, queryDefault.defaultOptions);\n }\n });\n return result;\n }\n defaultQueryOptions(options) {\n if (options._defaulted) {\n return options;\n }\n const defaultedOptions = {\n ...this.#defaultOptions.queries,\n ...this.getQueryDefaults(options.queryKey),\n ...options,\n _defaulted: true\n };\n if (!defaultedOptions.queryHash) {\n defaultedOptions.queryHash = hashQueryKeyByOptions(\n defaultedOptions.queryKey,\n defaultedOptions\n );\n }\n if (defaultedOptions.refetchOnReconnect === void 0) {\n defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== \"always\";\n }\n if (defaultedOptions.throwOnError === void 0) {\n defaultedOptions.throwOnError = !!defaultedOptions.suspense;\n }\n if (!defaultedOptions.networkMode && defaultedOptions.persister) {\n defaultedOptions.networkMode = \"offlineFirst\";\n }\n if (defaultedOptions.queryFn === skipToken) {\n defaultedOptions.enabled = false;\n }\n return defaultedOptions;\n }\n defaultMutationOptions(options) {\n if (options?._defaulted) {\n return options;\n }\n return {\n ...this.#defaultOptions.mutations,\n ...options?.mutationKey && this.getMutationDefaults(options.mutationKey),\n ...options,\n _defaulted: true\n };\n }\n clear() {\n this.#queryCache.clear();\n this.#mutationCache.clear();\n }\n};\nexport {\n QueryClient\n};\n//# sourceMappingURL=queryClient.js.map"],"names":["QueryClient","#queryCache","#mutationCache","#defaultOptions","#queryDefaults","#mutationDefaults","#mountCount","#unsubscribeFocus","#unsubscribeOnline","config","QueryCache","MutationCache","focusManager","focused","onlineManager","online","filters","queryKey","options","defaultedOptions","query","cachedData","resolveStaleTime","state","data","updater","prevData","functionalUpdate","notifyManager","queryCache","cancelOptions","defaultedCancelOptions","promises","noop","fetchOptions","promise","infiniteQueryBehavior","hashKey","defaults","result","queryDefault","partialMatchKey","mutationKey","hashQueryKeyByOptions","skipToken"],"mappings":";;;;;;;AAgBG,IAACA,IAAc,MAAM;AAAA,EACtBC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA,YAAYC,IAAS,IAAI;AACvB,SAAKR,KAAcQ,EAAO,cAAc,IAAIC,EAAY,GACxD,KAAKR,KAAiBO,EAAO,iBAAiB,IAAIE,EAAe,G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;AAAA,IACb;AACD,WAAKC,EAAiB,cACpBA,EAAiB,YAAYwB;AAAA,MAC3BxB,EAAiB;AAAA,MACjBA;AAAA,IACD,IAECA,EAAiB,uBAAuB,WAC1CA,EAAiB,qBAAqBA,EAAiB,gBAAgB,WAErEA,EAAiB,iBAAiB,WACpCA,EAAiB,eAAe,CAAC,CAACA,EAAiB,WAEjD,CAACA,EAAiB,eAAeA,EAAiB,cACpDA,EAAiB,cAAc,iBAE7BA,EAAiB,YAAYyB,MAC/BzB,EAAiB,UAAU,KAEtBA;AAAA,EACX;AAAA,EACE,uBAAuBD,GAAS;AAC9B,WAAIA,GAAS,aACJA,IAEF;AAAA,MACL,GAAG,KAAKf,GAAgB;AAAA,MACxB,GAAGe,GAAS,eAAe,KAAK,oBAAoBA,EAAQ,WAAW;AAAA,MACvE,GAAGA;AAAA,MACH,YAAY;AAAA,IACb;AAAA,EACL;AAAA,EACE,QAAQ;AACN,SAAKjB,GAAY,MAAO,GACxB,KAAKC,GAAe,MAAO;AAAA,EAC/B;AACA;","x_google_ignoreList":[0]}
@@ -0,0 +1,300 @@
1
+ import { focusManager as _ } from "./focusManager.js";
2
+ import { notifyManager as j } from "./notifyManager.js";
3
+ import { fetchState as z } from "./query.js";
4
+ import { Subscribable as W } from "./subscribable.js";
5
+ import { pendingThenable as P } from "./thenable.js";
6
+ import { resolveEnabled as o, shallowEqualObjects as S, resolveStaleTime as d, noop as B, isServer as x, isValidTimeout as L, timeUntilStale as H, replaceData as M } from "./utils.js";
7
+ var q = class extends W {
8
+ constructor(t, e) {
9
+ super(), this.options = e, this.#s = t, this.#r = null, this.#i = P(), this.bindMethods(), this.setOptions(e);
10
+ }
11
+ #s;
12
+ #t = void 0;
13
+ #p = void 0;
14
+ #e = void 0;
15
+ #a;
16
+ #c;
17
+ #i;
18
+ #r;
19
+ #b;
20
+ #u;
21
+ // This property keeps track of the last query with defined data.
22
+ // It will be used to pass the previous data and query to the placeholder function between renders.
23
+ #d;
24
+ #h;
25
+ #o;
26
+ #n;
27
+ #f = /* @__PURE__ */ new Set();
28
+ bindMethods() {
29
+ this.refetch = this.refetch.bind(this);
30
+ }
31
+ onSubscribe() {
32
+ this.listeners.size === 1 && (this.#t.addObserver(this), k(this.#t, this.options) ? this.#l() : this.updateResult(), this.#g());
33
+ }
34
+ onUnsubscribe() {
35
+ this.hasListeners() || this.destroy();
36
+ }
37
+ shouldFetchOnReconnect() {
38
+ return C(
39
+ this.#t,
40
+ this.options,
41
+ this.options.refetchOnReconnect
42
+ );
43
+ }
44
+ shouldFetchOnWindowFocus() {
45
+ return C(
46
+ this.#t,
47
+ this.options,
48
+ this.options.refetchOnWindowFocus
49
+ );
50
+ }
51
+ destroy() {
52
+ this.listeners = /* @__PURE__ */ new Set(), this.#O(), this.#y(), this.#t.removeObserver(this);
53
+ }
54
+ setOptions(t) {
55
+ const e = this.options, s = this.#t;
56
+ if (this.options = this.#s.defaultQueryOptions(t), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof o(this.options.enabled, this.#t) != "boolean")
57
+ throw new Error(
58
+ "Expected enabled to be a boolean or a callback that returns a boolean"
59
+ );
60
+ this.#S(), this.#t.setOptions(this.options), e._defaulted && !S(this.options, e) && this.#s.getQueryCache().notify({
61
+ type: "observerOptionsUpdated",
62
+ query: this.#t,
63
+ observer: this
64
+ });
65
+ const i = this.hasListeners();
66
+ i && A(
67
+ this.#t,
68
+ s,
69
+ this.options,
70
+ e
71
+ ) && this.#l(), this.updateResult(), i && (this.#t !== s || o(this.options.enabled, this.#t) !== o(e.enabled, this.#t) || d(this.options.staleTime, this.#t) !== d(e.staleTime, this.#t)) && this.#v();
72
+ const a = this.#m();
73
+ i && (this.#t !== s || o(this.options.enabled, this.#t) !== o(e.enabled, this.#t) || a !== this.#n) && this.#R(a);
74
+ }
75
+ getOptimisticResult(t) {
76
+ const e = this.#s.getQueryCache().build(this.#s, t), s = this.createResult(e, t);
77
+ return K(this, s) && (this.#e = s, this.#c = this.options, this.#a = this.#t.state), s;
78
+ }
79
+ getCurrentResult() {
80
+ return this.#e;
81
+ }
82
+ trackResult(t, e) {
83
+ return new Proxy(t, {
84
+ get: (s, i) => (this.trackProp(i), e?.(i), i === "promise" && !this.options.experimental_prefetchInRender && this.#i.status === "pending" && this.#i.reject(
85
+ new Error(
86
+ "experimental_prefetchInRender feature flag is not enabled"
87
+ )
88
+ ), Reflect.get(s, i))
89
+ });
90
+ }
91
+ trackProp(t) {
92
+ this.#f.add(t);
93
+ }
94
+ getCurrentQuery() {
95
+ return this.#t;
96
+ }
97
+ refetch({ ...t } = {}) {
98
+ return this.fetch({
99
+ ...t
100
+ });
101
+ }
102
+ fetchOptimistic(t) {
103
+ const e = this.#s.defaultQueryOptions(t), s = this.#s.getQueryCache().build(this.#s, e);
104
+ return s.fetch().then(() => this.createResult(s, e));
105
+ }
106
+ fetch(t) {
107
+ return this.#l({
108
+ ...t,
109
+ cancelRefetch: t.cancelRefetch ?? !0
110
+ }).then(() => (this.updateResult(), this.#e));
111
+ }
112
+ #l(t) {
113
+ this.#S();
114
+ let e = this.#t.fetch(
115
+ this.options,
116
+ t
117
+ );
118
+ return t?.throwOnError || (e = e.catch(B)), e;
119
+ }
120
+ #v() {
121
+ this.#O();
122
+ const t = d(
123
+ this.options.staleTime,
124
+ this.#t
125
+ );
126
+ if (x || this.#e.isStale || !L(t))
127
+ return;
128
+ const s = H(this.#e.dataUpdatedAt, t) + 1;
129
+ this.#h = setTimeout(() => {
130
+ this.#e.isStale || this.updateResult();
131
+ }, s);
132
+ }
133
+ #m() {
134
+ return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#t) : this.options.refetchInterval) ?? !1;
135
+ }
136
+ #R(t) {
137
+ this.#y(), this.#n = t, !(x || o(this.options.enabled, this.#t) === !1 || !L(this.#n) || this.#n === 0) && (this.#o = setInterval(() => {
138
+ (this.options.refetchIntervalInBackground || _.isFocused()) && this.#l();
139
+ }, this.#n));
140
+ }
141
+ #g() {
142
+ this.#v(), this.#R(this.#m());
143
+ }
144
+ #O() {
145
+ this.#h && (clearTimeout(this.#h), this.#h = void 0);
146
+ }
147
+ #y() {
148
+ this.#o && (clearInterval(this.#o), this.#o = void 0);
149
+ }
150
+ createResult(t, e) {
151
+ const s = this.#t, i = this.options, a = this.#e, f = this.#a, m = this.#c, R = t !== s ? t.state : this.#p, { state: T } = t;
152
+ let r = { ...T }, Q = !1, n;
153
+ if (e._optimisticResults) {
154
+ const h = this.hasListeners(), b = !h && k(t, e), u = h && A(t, s, e, i);
155
+ (b || u) && (r = {
156
+ ...r,
157
+ ...z(T.data, t.options)
158
+ }), e._optimisticResults === "isRestoring" && (r.fetchStatus = "idle");
159
+ }
160
+ let { error: U, errorUpdatedAt: w, status: c } = r;
161
+ n = r.data;
162
+ let F = !1;
163
+ if (e.placeholderData !== void 0 && n === void 0 && c === "pending") {
164
+ let h;
165
+ a?.isPlaceholderData && e.placeholderData === m?.placeholderData ? (h = a.data, F = !0) : h = typeof e.placeholderData == "function" ? e.placeholderData(
166
+ this.#d?.state.data,
167
+ this.#d
168
+ ) : e.placeholderData, h !== void 0 && (c = "success", n = M(
169
+ a?.data,
170
+ h,
171
+ e
172
+ ), Q = !0);
173
+ }
174
+ if (e.select && n !== void 0 && !F)
175
+ if (a && n === f?.data && e.select === this.#b)
176
+ n = this.#u;
177
+ else
178
+ try {
179
+ this.#b = e.select, n = e.select(n), n = M(a?.data, n, e), this.#u = n, this.#r = null;
180
+ } catch (h) {
181
+ this.#r = h;
182
+ }
183
+ this.#r && (U = this.#r, n = this.#u, w = Date.now(), c = "error");
184
+ const g = r.fetchStatus === "fetching", O = c === "pending", y = c === "error", D = O && g, E = n !== void 0, l = {
185
+ status: c,
186
+ fetchStatus: r.fetchStatus,
187
+ isPending: O,
188
+ isSuccess: c === "success",
189
+ isError: y,
190
+ isInitialLoading: D,
191
+ isLoading: D,
192
+ data: n,
193
+ dataUpdatedAt: r.dataUpdatedAt,
194
+ error: U,
195
+ errorUpdatedAt: w,
196
+ failureCount: r.fetchFailureCount,
197
+ failureReason: r.fetchFailureReason,
198
+ errorUpdateCount: r.errorUpdateCount,
199
+ isFetched: r.dataUpdateCount > 0 || r.errorUpdateCount > 0,
200
+ isFetchedAfterMount: r.dataUpdateCount > R.dataUpdateCount || r.errorUpdateCount > R.errorUpdateCount,
201
+ isFetching: g,
202
+ isRefetching: g && !O,
203
+ isLoadingError: y && !E,
204
+ isPaused: r.fetchStatus === "paused",
205
+ isPlaceholderData: Q,
206
+ isRefetchError: y && E,
207
+ isStale: I(t, e),
208
+ refetch: this.refetch,
209
+ promise: this.#i,
210
+ isEnabled: o(e.enabled, t) !== !1
211
+ };
212
+ if (this.options.experimental_prefetchInRender) {
213
+ const h = (v) => {
214
+ l.status === "error" ? v.reject(l.error) : l.data !== void 0 && v.resolve(l.data);
215
+ }, b = () => {
216
+ const v = this.#i = l.promise = P();
217
+ h(v);
218
+ }, u = this.#i;
219
+ switch (u.status) {
220
+ case "pending":
221
+ t.queryHash === s.queryHash && h(u);
222
+ break;
223
+ case "fulfilled":
224
+ (l.status === "error" || l.data !== u.value) && b();
225
+ break;
226
+ case "rejected":
227
+ (l.status !== "error" || l.error !== u.reason) && b();
228
+ break;
229
+ }
230
+ }
231
+ return l;
232
+ }
233
+ updateResult() {
234
+ const t = this.#e, e = this.createResult(this.#t, this.options);
235
+ if (this.#a = this.#t.state, this.#c = this.options, this.#a.data !== void 0 && (this.#d = this.#t), S(e, t))
236
+ return;
237
+ this.#e = e;
238
+ const s = () => {
239
+ if (!t)
240
+ return !0;
241
+ const { notifyOnChangeProps: i } = this.options, a = typeof i == "function" ? i() : i;
242
+ if (a === "all" || !a && !this.#f.size)
243
+ return !0;
244
+ const f = new Set(
245
+ a ?? this.#f
246
+ );
247
+ return this.options.throwOnError && f.add("error"), Object.keys(this.#e).some((m) => {
248
+ const p = m;
249
+ return this.#e[p] !== t[p] && f.has(p);
250
+ });
251
+ };
252
+ this.#C({ listeners: s() });
253
+ }
254
+ #S() {
255
+ const t = this.#s.getQueryCache().build(this.#s, this.options);
256
+ if (t === this.#t)
257
+ return;
258
+ const e = this.#t;
259
+ this.#t = t, this.#p = t.state, this.hasListeners() && (e?.removeObserver(this), t.addObserver(this));
260
+ }
261
+ onQueryUpdate() {
262
+ this.updateResult(), this.hasListeners() && this.#g();
263
+ }
264
+ #C(t) {
265
+ j.batch(() => {
266
+ t.listeners && this.listeners.forEach((e) => {
267
+ e(this.#e);
268
+ }), this.#s.getQueryCache().notify({
269
+ query: this.#t,
270
+ type: "observerResultsUpdated"
271
+ });
272
+ });
273
+ }
274
+ };
275
+ function V(t, e) {
276
+ return o(e.enabled, t) !== !1 && t.state.data === void 0 && !(t.state.status === "error" && e.retryOnMount === !1);
277
+ }
278
+ function k(t, e) {
279
+ return V(t, e) || t.state.data !== void 0 && C(t, e, e.refetchOnMount);
280
+ }
281
+ function C(t, e, s) {
282
+ if (o(e.enabled, t) !== !1 && d(e.staleTime, t) !== "static") {
283
+ const i = typeof s == "function" ? s(t) : s;
284
+ return i === "always" || i !== !1 && I(t, e);
285
+ }
286
+ return !1;
287
+ }
288
+ function A(t, e, s, i) {
289
+ return (t !== e || o(i.enabled, t) === !1) && (!s.suspense || t.state.status !== "error") && I(t, s);
290
+ }
291
+ function I(t, e) {
292
+ return o(e.enabled, t) !== !1 && t.isStaleByTime(d(e.staleTime, t));
293
+ }
294
+ function K(t, e) {
295
+ return !S(t.getCurrentResult(), e);
296
+ }
297
+ export {
298
+ q as QueryObserver
299
+ };
300
+ //# sourceMappingURL=queryObserver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queryObserver.js","sources":["../../../../../../../../../../node_modules/.pnpm/@tanstack+query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryObserver.js"],"sourcesContent":["// src/queryObserver.ts\nimport { focusManager } from \"./focusManager.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { fetchState } from \"./query.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { pendingThenable } from \"./thenable.js\";\nimport {\n isServer,\n isValidTimeout,\n noop,\n replaceData,\n resolveEnabled,\n resolveStaleTime,\n shallowEqualObjects,\n timeUntilStale\n} from \"./utils.js\";\nvar QueryObserver = class extends Subscribable {\n constructor(client, options) {\n super();\n this.options = options;\n this.#client = client;\n this.#selectError = null;\n this.#currentThenable = pendingThenable();\n this.bindMethods();\n this.setOptions(options);\n }\n #client;\n #currentQuery = void 0;\n #currentQueryInitialState = void 0;\n #currentResult = void 0;\n #currentResultState;\n #currentResultOptions;\n #currentThenable;\n #selectError;\n #selectFn;\n #selectResult;\n // This property keeps track of the last query with defined data.\n // It will be used to pass the previous data and query to the placeholder function between renders.\n #lastQueryWithDefinedData;\n #staleTimeoutId;\n #refetchIntervalId;\n #currentRefetchInterval;\n #trackedProps = /* @__PURE__ */ new Set();\n bindMethods() {\n this.refetch = this.refetch.bind(this);\n }\n onSubscribe() {\n if (this.listeners.size === 1) {\n this.#currentQuery.addObserver(this);\n if (shouldFetchOnMount(this.#currentQuery, this.options)) {\n this.#executeFetch();\n } else {\n this.updateResult();\n }\n this.#updateTimers();\n }\n }\n onUnsubscribe() {\n if (!this.hasListeners()) {\n this.destroy();\n }\n }\n shouldFetchOnReconnect() {\n return shouldFetchOn(\n this.#currentQuery,\n this.options,\n this.options.refetchOnReconnect\n );\n }\n shouldFetchOnWindowFocus() {\n return shouldFetchOn(\n this.#currentQuery,\n this.options,\n this.options.refetchOnWindowFocus\n );\n }\n destroy() {\n this.listeners = /* @__PURE__ */ new Set();\n this.#clearStaleTimeout();\n this.#clearRefetchInterval();\n this.#currentQuery.removeObserver(this);\n }\n setOptions(options) {\n const prevOptions = this.options;\n const prevQuery = this.#currentQuery;\n this.options = this.#client.defaultQueryOptions(options);\n if (this.options.enabled !== void 0 && typeof this.options.enabled !== \"boolean\" && typeof this.options.enabled !== \"function\" && typeof resolveEnabled(this.options.enabled, this.#currentQuery) !== \"boolean\") {\n throw new Error(\n \"Expected enabled to be a boolean or a callback that returns a boolean\"\n );\n }\n this.#updateQuery();\n this.#currentQuery.setOptions(this.options);\n if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) {\n this.#client.getQueryCache().notify({\n type: \"observerOptionsUpdated\",\n query: this.#currentQuery,\n observer: this\n });\n }\n const mounted = this.hasListeners();\n if (mounted && shouldFetchOptionally(\n this.#currentQuery,\n prevQuery,\n this.options,\n prevOptions\n )) {\n this.#executeFetch();\n }\n this.updateResult();\n if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || resolveStaleTime(this.options.staleTime, this.#currentQuery) !== resolveStaleTime(prevOptions.staleTime, this.#currentQuery))) {\n this.#updateStaleTimeout();\n }\n const nextRefetchInterval = this.#computeRefetchInterval();\n if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || nextRefetchInterval !== this.#currentRefetchInterval)) {\n this.#updateRefetchInterval(nextRefetchInterval);\n }\n }\n getOptimisticResult(options) {\n const query = this.#client.getQueryCache().build(this.#client, options);\n const result = this.createResult(query, options);\n if (shouldAssignObserverCurrentProperties(this, result)) {\n this.#currentResult = result;\n this.#currentResultOptions = this.options;\n this.#currentResultState = this.#currentQuery.state;\n }\n return result;\n }\n getCurrentResult() {\n return this.#currentResult;\n }\n trackResult(result, onPropTracked) {\n return new Proxy(result, {\n get: (target, key) => {\n this.trackProp(key);\n onPropTracked?.(key);\n if (key === \"promise\" && !this.options.experimental_prefetchInRender && this.#currentThenable.status === \"pending\") {\n this.#currentThenable.reject(\n new Error(\n \"experimental_prefetchInRender feature flag is not enabled\"\n )\n );\n }\n return Reflect.get(target, key);\n }\n });\n }\n trackProp(key) {\n this.#trackedProps.add(key);\n }\n getCurrentQuery() {\n return this.#currentQuery;\n }\n refetch({ ...options } = {}) {\n return this.fetch({\n ...options\n });\n }\n fetchOptimistic(options) {\n const defaultedOptions = this.#client.defaultQueryOptions(options);\n const query = this.#client.getQueryCache().build(this.#client, defaultedOptions);\n return query.fetch().then(() => this.createResult(query, defaultedOptions));\n }\n fetch(fetchOptions) {\n return this.#executeFetch({\n ...fetchOptions,\n cancelRefetch: fetchOptions.cancelRefetch ?? true\n }).then(() => {\n this.updateResult();\n return this.#currentResult;\n });\n }\n #executeFetch(fetchOptions) {\n this.#updateQuery();\n let promise = this.#currentQuery.fetch(\n this.options,\n fetchOptions\n );\n if (!fetchOptions?.throwOnError) {\n promise = promise.catch(noop);\n }\n return promise;\n }\n #updateStaleTimeout() {\n this.#clearStaleTimeout();\n const staleTime = resolveStaleTime(\n this.options.staleTime,\n this.#currentQuery\n );\n if (isServer || this.#currentResult.isStale || !isValidTimeout(staleTime)) {\n return;\n }\n const time = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime);\n const timeout = time + 1;\n this.#staleTimeoutId = setTimeout(() => {\n if (!this.#currentResult.isStale) {\n this.updateResult();\n }\n }, timeout);\n }\n #computeRefetchInterval() {\n return (typeof this.options.refetchInterval === \"function\" ? this.options.refetchInterval(this.#currentQuery) : this.options.refetchInterval) ?? false;\n }\n #updateRefetchInterval(nextInterval) {\n this.#clearRefetchInterval();\n this.#currentRefetchInterval = nextInterval;\n if (isServer || resolveEnabled(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {\n return;\n }\n this.#refetchIntervalId = setInterval(() => {\n if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {\n this.#executeFetch();\n }\n }, this.#currentRefetchInterval);\n }\n #updateTimers() {\n this.#updateStaleTimeout();\n this.#updateRefetchInterval(this.#computeRefetchInterval());\n }\n #clearStaleTimeout() {\n if (this.#staleTimeoutId) {\n clearTimeout(this.#staleTimeoutId);\n this.#staleTimeoutId = void 0;\n }\n }\n #clearRefetchInterval() {\n if (this.#refetchIntervalId) {\n clearInterval(this.#refetchIntervalId);\n this.#refetchIntervalId = void 0;\n }\n }\n createResult(query, options) {\n const prevQuery = this.#currentQuery;\n const prevOptions = this.options;\n const prevResult = this.#currentResult;\n const prevResultState = this.#currentResultState;\n const prevResultOptions = this.#currentResultOptions;\n const queryChange = query !== prevQuery;\n const queryInitialState = queryChange ? query.state : this.#currentQueryInitialState;\n const { state } = query;\n let newState = { ...state };\n let isPlaceholderData = false;\n let data;\n if (options._optimisticResults) {\n const mounted = this.hasListeners();\n const fetchOnMount = !mounted && shouldFetchOnMount(query, options);\n const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);\n if (fetchOnMount || fetchOptionally) {\n newState = {\n ...newState,\n ...fetchState(state.data, query.options)\n };\n }\n if (options._optimisticResults === \"isRestoring\") {\n newState.fetchStatus = \"idle\";\n }\n }\n let { error, errorUpdatedAt, status } = newState;\n data = newState.data;\n let skipSelect = false;\n if (options.placeholderData !== void 0 && data === void 0 && status === \"pending\") {\n let placeholderData;\n if (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) {\n placeholderData = prevResult.data;\n skipSelect = true;\n } else {\n placeholderData = typeof options.placeholderData === \"function\" ? options.placeholderData(\n this.#lastQueryWithDefinedData?.state.data,\n this.#lastQueryWithDefinedData\n ) : options.placeholderData;\n }\n if (placeholderData !== void 0) {\n status = \"success\";\n data = replaceData(\n prevResult?.data,\n placeholderData,\n options\n );\n isPlaceholderData = true;\n }\n }\n if (options.select && data !== void 0 && !skipSelect) {\n if (prevResult && data === prevResultState?.data && options.select === this.#selectFn) {\n data = this.#selectResult;\n } else {\n try {\n this.#selectFn = options.select;\n data = options.select(data);\n data = replaceData(prevResult?.data, data, options);\n this.#selectResult = data;\n this.#selectError = null;\n } catch (selectError) {\n this.#selectError = selectError;\n }\n }\n }\n if (this.#selectError) {\n error = this.#selectError;\n data = this.#selectResult;\n errorUpdatedAt = Date.now();\n status = \"error\";\n }\n const isFetching = newState.fetchStatus === \"fetching\";\n const isPending = status === \"pending\";\n const isError = status === \"error\";\n const isLoading = isPending && isFetching;\n const hasData = data !== void 0;\n const result = {\n status,\n fetchStatus: newState.fetchStatus,\n isPending,\n isSuccess: status === \"success\",\n isError,\n isInitialLoading: isLoading,\n isLoading,\n data,\n dataUpdatedAt: newState.dataUpdatedAt,\n error,\n errorUpdatedAt,\n failureCount: newState.fetchFailureCount,\n failureReason: newState.fetchFailureReason,\n errorUpdateCount: newState.errorUpdateCount,\n isFetched: newState.dataUpdateCount > 0 || newState.errorUpdateCount > 0,\n isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,\n isFetching,\n isRefetching: isFetching && !isPending,\n isLoadingError: isError && !hasData,\n isPaused: newState.fetchStatus === \"paused\",\n isPlaceholderData,\n isRefetchError: isError && hasData,\n isStale: isStale(query, options),\n refetch: this.refetch,\n promise: this.#currentThenable,\n isEnabled: resolveEnabled(options.enabled, query) !== false\n };\n const nextResult = result;\n if (this.options.experimental_prefetchInRender) {\n const finalizeThenableIfPossible = (thenable) => {\n if (nextResult.status === \"error\") {\n thenable.reject(nextResult.error);\n } else if (nextResult.data !== void 0) {\n thenable.resolve(nextResult.data);\n }\n };\n const recreateThenable = () => {\n const pending = this.#currentThenable = nextResult.promise = pendingThenable();\n finalizeThenableIfPossible(pending);\n };\n const prevThenable = this.#currentThenable;\n switch (prevThenable.status) {\n case \"pending\":\n if (query.queryHash === prevQuery.queryHash) {\n finalizeThenableIfPossible(prevThenable);\n }\n break;\n case \"fulfilled\":\n if (nextResult.status === \"error\" || nextResult.data !== prevThenable.value) {\n recreateThenable();\n }\n break;\n case \"rejected\":\n if (nextResult.status !== \"error\" || nextResult.error !== prevThenable.reason) {\n recreateThenable();\n }\n break;\n }\n }\n return nextResult;\n }\n updateResult() {\n const prevResult = this.#currentResult;\n const nextResult = this.createResult(this.#currentQuery, this.options);\n this.#currentResultState = this.#currentQuery.state;\n this.#currentResultOptions = this.options;\n if (this.#currentResultState.data !== void 0) {\n this.#lastQueryWithDefinedData = this.#currentQuery;\n }\n if (shallowEqualObjects(nextResult, prevResult)) {\n return;\n }\n this.#currentResult = nextResult;\n const shouldNotifyListeners = () => {\n if (!prevResult) {\n return true;\n }\n const { notifyOnChangeProps } = this.options;\n const notifyOnChangePropsValue = typeof notifyOnChangeProps === \"function\" ? notifyOnChangeProps() : notifyOnChangeProps;\n if (notifyOnChangePropsValue === \"all\" || !notifyOnChangePropsValue && !this.#trackedProps.size) {\n return true;\n }\n const includedProps = new Set(\n notifyOnChangePropsValue ?? this.#trackedProps\n );\n if (this.options.throwOnError) {\n includedProps.add(\"error\");\n }\n return Object.keys(this.#currentResult).some((key) => {\n const typedKey = key;\n const changed = this.#currentResult[typedKey] !== prevResult[typedKey];\n return changed && includedProps.has(typedKey);\n });\n };\n this.#notify({ listeners: shouldNotifyListeners() });\n }\n #updateQuery() {\n const query = this.#client.getQueryCache().build(this.#client, this.options);\n if (query === this.#currentQuery) {\n return;\n }\n const prevQuery = this.#currentQuery;\n this.#currentQuery = query;\n this.#currentQueryInitialState = query.state;\n if (this.hasListeners()) {\n prevQuery?.removeObserver(this);\n query.addObserver(this);\n }\n }\n onQueryUpdate() {\n this.updateResult();\n if (this.hasListeners()) {\n this.#updateTimers();\n }\n }\n #notify(notifyOptions) {\n notifyManager.batch(() => {\n if (notifyOptions.listeners) {\n this.listeners.forEach((listener) => {\n listener(this.#currentResult);\n });\n }\n this.#client.getQueryCache().notify({\n query: this.#currentQuery,\n type: \"observerResultsUpdated\"\n });\n });\n }\n};\nfunction shouldLoadOnMount(query, options) {\n return resolveEnabled(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === \"error\" && options.retryOnMount === false);\n}\nfunction shouldFetchOnMount(query, options) {\n return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);\n}\nfunction shouldFetchOn(query, options, field) {\n if (resolveEnabled(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== \"static\") {\n const value = typeof field === \"function\" ? field(query) : field;\n return value === \"always\" || value !== false && isStale(query, options);\n }\n return false;\n}\nfunction shouldFetchOptionally(query, prevQuery, options, prevOptions) {\n return (query !== prevQuery || resolveEnabled(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== \"error\") && isStale(query, options);\n}\nfunction isStale(query, options) {\n return resolveEnabled(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));\n}\nfunction shouldAssignObserverCurrentProperties(observer, optimisticResult) {\n if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {\n return true;\n }\n return false;\n}\nexport {\n QueryObserver\n};\n//# sourceMappingURL=queryObserver.js.map"],"names":["QueryObserver","Subscribable","client","options","#client","#selectError","#currentThenable","pendingThenable","#currentQuery","#currentQueryInitialState","#currentResult","#currentResultState","#currentResultOptions","#selectFn","#selectResult","#lastQueryWithDefinedData","#staleTimeoutId","#refetchIntervalId","#currentRefetchInterval","#trackedProps","shouldFetchOnMount","#executeFetch","#updateTimers","shouldFetchOn","#clearStaleTimeout","#clearRefetchInterval","prevOptions","prevQuery","resolveEnabled","#updateQuery","shallowEqualObjects","mounted","shouldFetchOptionally","resolveStaleTime","#updateStaleTimeout","nextRefetchInterval","#computeRefetchInterval","#updateRefetchInterval","query","result","shouldAssignObserverCurrentProperties","onPropTracked","target","key","defaultedOptions","fetchOptions","promise","noop","staleTime","isServer","isValidTimeout","timeout","timeUntilStale","nextInterval","focusManager","prevResult","prevResultState","prevResultOptions","queryInitialState","state","newState","isPlaceholderData","data","fetchOnMount","fetchOptionally","fetchState","error","errorUpdatedAt","status","skipSelect","placeholderData","replaceData","selectError","isFetching","isPending","isError","isLoading","hasData","nextResult","isStale","finalizeThenableIfPossible","thenable","recreateThenable","pending","prevThenable","shouldNotifyListeners","notifyOnChangeProps","notifyOnChangePropsValue","includedProps","typedKey","#notify","notifyOptions","notifyManager","listener","shouldLoadOnMount","field","value","observer","optimisticResult"],"mappings":";;;;;;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xD,GAAOnC,GAAS;AACzC,SAAOyB,EAAezB,EAAQ,SAASmC,CAAK,MAAM,MAASA,EAAM,MAAM,SAAS,UAAU,EAAEA,EAAM,MAAM,WAAW,WAAWnC,EAAQ,iBAAiB;AACzJ;AACA,SAASiB,EAAmBkB,GAAOnC,GAAS;AAC1C,SAAO2F,EAAkBxD,GAAOnC,CAAO,KAAKmC,EAAM,MAAM,SAAS,UAAUf,EAAce,GAAOnC,GAASA,EAAQ,cAAc;AACjI;AACA,SAASoB,EAAce,GAAOnC,GAAS4F,GAAO;AAC5C,MAAInE,EAAezB,EAAQ,SAASmC,CAAK,MAAM,MAASL,EAAiB9B,EAAQ,WAAWmC,CAAK,MAAM,UAAU;AAC/G,UAAM0D,IAAQ,OAAOD,KAAU,aAAaA,EAAMzD,CAAK,IAAIyD;AAC3D,WAAOC,MAAU,YAAYA,MAAU,MAASjB,EAAQzC,GAAOnC,CAAO;AAAA,EAC1E;AACE,SAAO;AACT;AACA,SAAS6B,EAAsBM,GAAOX,GAAWxB,GAASuB,GAAa;AACrE,UAAQY,MAAUX,KAAaC,EAAeF,EAAY,SAASY,CAAK,MAAM,QAAW,CAACnC,EAAQ,YAAYmC,EAAM,MAAM,WAAW,YAAYyC,EAAQzC,GAAOnC,CAAO;AACzK;AACA,SAAS4E,EAAQzC,GAAOnC,GAAS;AAC/B,SAAOyB,EAAezB,EAAQ,SAASmC,CAAK,MAAM,MAASA,EAAM,cAAcL,EAAiB9B,EAAQ,WAAWmC,CAAK,CAAC;AAC3H;AACA,SAASE,EAAsCyD,GAAUC,GAAkB;AACzE,SAAK,CAAApE,EAAoBmE,EAAS,iBAAkB,GAAEC,CAAgB;AAIxE;","x_google_ignoreList":[0]}
@@ -0,0 +1,25 @@
1
+ import { isValidTimeout as e, isServer as t } from "./utils.js";
2
+ var m = class {
3
+ #i;
4
+ destroy() {
5
+ this.clearGcTimeout();
6
+ }
7
+ scheduleGc() {
8
+ this.clearGcTimeout(), e(this.gcTime) && (this.#i = setTimeout(() => {
9
+ this.optionalRemove();
10
+ }, this.gcTime));
11
+ }
12
+ updateGcTime(i) {
13
+ this.gcTime = Math.max(
14
+ this.gcTime || 0,
15
+ i ?? (t ? 1 / 0 : 5 * 60 * 1e3)
16
+ );
17
+ }
18
+ clearGcTimeout() {
19
+ this.#i && (clearTimeout(this.#i), this.#i = void 0);
20
+ }
21
+ };
22
+ export {
23
+ m as Removable
24
+ };
25
+ //# sourceMappingURL=removable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removable.js","sources":["../../../../../../../../../../node_modules/.pnpm/@tanstack+query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/removable.js"],"sourcesContent":["// src/removable.ts\nimport { isServer, isValidTimeout } from \"./utils.js\";\nvar Removable = class {\n #gcTimeout;\n destroy() {\n this.clearGcTimeout();\n }\n scheduleGc() {\n this.clearGcTimeout();\n if (isValidTimeout(this.gcTime)) {\n this.#gcTimeout = setTimeout(() => {\n this.optionalRemove();\n }, this.gcTime);\n }\n }\n updateGcTime(newGcTime) {\n this.gcTime = Math.max(\n this.gcTime || 0,\n newGcTime ?? (isServer ? Infinity : 5 * 60 * 1e3)\n );\n }\n clearGcTimeout() {\n if (this.#gcTimeout) {\n clearTimeout(this.#gcTimeout);\n this.#gcTimeout = void 0;\n }\n }\n};\nexport {\n Removable\n};\n//# sourceMappingURL=removable.js.map"],"names":["Removable","#gcTimeout","isValidTimeout","newGcTime","isServer"],"mappings":";AAEG,IAACA,IAAY,MAAM;AAAA,EACpBC;AAAA,EACA,UAAU;AACR,SAAK,eAAgB;AAAA,EACzB;AAAA,EACE,aAAa;AACX,SAAK,eAAgB,GACjBC,EAAe,KAAK,MAAM,MAC5B,KAAKD,KAAa,WAAW,MAAM;AACjC,WAAK,eAAgB;AAAA,IAC7B,GAAS,KAAK,MAAM;AAAA,EAEpB;AAAA,EACE,aAAaE,GAAW;AACtB,SAAK,SAAS,KAAK;AAAA,MACjB,KAAK,UAAU;AAAA,MACfA,MAAcC,IAAW,QAAW,IAAI,KAAK;AAAA,IAC9C;AAAA,EACL;AAAA,EACE,iBAAiB;AACf,IAAI,KAAKH,OACP,aAAa,KAAKA,EAAU,GAC5B,KAAKA,KAAa;AAAA,EAExB;AACA;","x_google_ignoreList":[0]}
@@ -0,0 +1,76 @@
1
+ import { focusManager as F } from "./focusManager.js";
2
+ import { onlineManager as p } from "./onlineManager.js";
3
+ import { pendingThenable as b } from "./thenable.js";
4
+ import { isServer as j, sleep as D } from "./utils.js";
5
+ function E(e) {
6
+ return Math.min(1e3 * 2 ** e, 3e4);
7
+ }
8
+ function O(e) {
9
+ return (e ?? "online") === "online" ? p.isOnline() : !0;
10
+ }
11
+ var k = class extends Error {
12
+ constructor(e) {
13
+ super("CancelledError"), this.revert = e?.revert, this.silent = e?.silent;
14
+ }
15
+ };
16
+ function q(e) {
17
+ let c = !1, o = 0, a;
18
+ const n = b(), r = () => n.status !== "pending", v = (t) => {
19
+ if (!r()) {
20
+ const i = new k(t);
21
+ u(i), e.onCancel?.(i);
22
+ }
23
+ }, R = () => {
24
+ c = !0;
25
+ }, C = () => {
26
+ c = !1;
27
+ }, m = () => F.isFocused() && (e.networkMode === "always" || p.isOnline()) && e.canRun(), d = () => O(e.networkMode) && e.canRun(), P = (t) => {
28
+ r() || (a?.(), n.resolve(t));
29
+ }, u = (t) => {
30
+ r() || (a?.(), n.reject(t));
31
+ }, h = () => new Promise((t) => {
32
+ a = (i) => {
33
+ (r() || m()) && t(i);
34
+ }, e.onPause?.();
35
+ }).then(() => {
36
+ a = void 0, r() || e.onContinue?.();
37
+ }), y = () => {
38
+ if (r())
39
+ return;
40
+ let t;
41
+ const i = o === 0 ? e.initialPromise : void 0;
42
+ try {
43
+ t = i ?? e.fn();
44
+ } catch (s) {
45
+ t = Promise.reject(s);
46
+ }
47
+ Promise.resolve(t).then(P).catch((s) => {
48
+ if (r())
49
+ return;
50
+ const l = e.retry ?? (j ? 0 : 3), f = e.retryDelay ?? E, w = typeof f == "function" ? f(o, s) : f, M = l === !0 || typeof l == "number" && o < l || typeof l == "function" && l(o, s);
51
+ if (c || !M) {
52
+ u(s);
53
+ return;
54
+ }
55
+ o++, e.onFail?.(o, s), D(w).then(() => m() ? void 0 : h()).then(() => {
56
+ c ? u(s) : y();
57
+ });
58
+ });
59
+ };
60
+ return {
61
+ promise: n,
62
+ status: () => n.status,
63
+ cancel: v,
64
+ continue: () => (a?.(), n),
65
+ cancelRetry: R,
66
+ continueRetry: C,
67
+ canStart: d,
68
+ start: () => (d() ? y() : h().then(y), n)
69
+ };
70
+ }
71
+ export {
72
+ k as CancelledError,
73
+ O as canFetch,
74
+ q as createRetryer
75
+ };
76
+ //# sourceMappingURL=retryer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retryer.js","sources":["../../../../../../../../../../node_modules/.pnpm/@tanstack+query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/retryer.js"],"sourcesContent":["// src/retryer.ts\nimport { focusManager } from \"./focusManager.js\";\nimport { onlineManager } from \"./onlineManager.js\";\nimport { pendingThenable } from \"./thenable.js\";\nimport { isServer, sleep } from \"./utils.js\";\nfunction defaultRetryDelay(failureCount) {\n return Math.min(1e3 * 2 ** failureCount, 3e4);\n}\nfunction canFetch(networkMode) {\n return (networkMode ?? \"online\") === \"online\" ? onlineManager.isOnline() : true;\n}\nvar CancelledError = class extends Error {\n constructor(options) {\n super(\"CancelledError\");\n this.revert = options?.revert;\n this.silent = options?.silent;\n }\n};\nfunction isCancelledError(value) {\n return value instanceof CancelledError;\n}\nfunction createRetryer(config) {\n let isRetryCancelled = false;\n let failureCount = 0;\n let continueFn;\n const thenable = pendingThenable();\n const isResolved = () => thenable.status !== \"pending\";\n const cancel = (cancelOptions) => {\n if (!isResolved()) {\n const error = new CancelledError(cancelOptions);\n reject(error);\n config.onCancel?.(error);\n }\n };\n const cancelRetry = () => {\n isRetryCancelled = true;\n };\n const continueRetry = () => {\n isRetryCancelled = false;\n };\n const canContinue = () => focusManager.isFocused() && (config.networkMode === \"always\" || onlineManager.isOnline()) && config.canRun();\n const canStart = () => canFetch(config.networkMode) && config.canRun();\n const resolve = (value) => {\n if (!isResolved()) {\n continueFn?.();\n thenable.resolve(value);\n }\n };\n const reject = (value) => {\n if (!isResolved()) {\n continueFn?.();\n thenable.reject(value);\n }\n };\n const pause = () => {\n return new Promise((continueResolve) => {\n continueFn = (value) => {\n if (isResolved() || canContinue()) {\n continueResolve(value);\n }\n };\n config.onPause?.();\n }).then(() => {\n continueFn = void 0;\n if (!isResolved()) {\n config.onContinue?.();\n }\n });\n };\n const run = () => {\n if (isResolved()) {\n return;\n }\n let promiseOrValue;\n const initialPromise = failureCount === 0 ? config.initialPromise : void 0;\n try {\n promiseOrValue = initialPromise ?? config.fn();\n } catch (error) {\n promiseOrValue = Promise.reject(error);\n }\n Promise.resolve(promiseOrValue).then(resolve).catch((error) => {\n if (isResolved()) {\n return;\n }\n const retry = config.retry ?? (isServer ? 0 : 3);\n const retryDelay = config.retryDelay ?? defaultRetryDelay;\n const delay = typeof retryDelay === \"function\" ? retryDelay(failureCount, error) : retryDelay;\n const shouldRetry = retry === true || typeof retry === \"number\" && failureCount < retry || typeof retry === \"function\" && retry(failureCount, error);\n if (isRetryCancelled || !shouldRetry) {\n reject(error);\n return;\n }\n failureCount++;\n config.onFail?.(failureCount, error);\n sleep(delay).then(() => {\n return canContinue() ? void 0 : pause();\n }).then(() => {\n if (isRetryCancelled) {\n reject(error);\n } else {\n run();\n }\n });\n });\n };\n return {\n promise: thenable,\n status: () => thenable.status,\n cancel,\n continue: () => {\n continueFn?.();\n return thenable;\n },\n cancelRetry,\n continueRetry,\n canStart,\n start: () => {\n if (canStart()) {\n run();\n } else {\n pause().then(run);\n }\n return thenable;\n }\n };\n}\nexport {\n CancelledError,\n canFetch,\n createRetryer,\n isCancelledError\n};\n//# sourceMappingURL=retryer.js.map"],"names":["defaultRetryDelay","failureCount","canFetch","networkMode","onlineManager","CancelledError","options","createRetryer","config","isRetryCancelled","continueFn","thenable","pendingThenable","isResolved","cancel","cancelOptions","error","reject","cancelRetry","continueRetry","canContinue","focusManager","canStart","resolve","value","pause","continueResolve","run","promiseOrValue","initialPromise","retry","isServer","retryDelay","delay","shouldRetry","sleep"],"mappings":";;;;AAKA,SAASA,EAAkBC,GAAc;AACvC,SAAO,KAAK,IAAI,MAAM,KAAKA,GAAc,GAAG;AAC9C;AACA,SAASC,EAASC,GAAa;AAC7B,UAAQA,KAAe,cAAc,WAAWC,EAAc,SAAQ,IAAK;AAC7E;AACG,IAACC,IAAiB,cAAc,MAAM;AAAA,EACvC,YAAYC,GAAS;AACnB,UAAM,gBAAgB,GACtB,KAAK,SAASA,GAAS,QACvB,KAAK,SAASA,GAAS;AAAA,EAC3B;AACA;AAIA,SAASC,EAAcC,GAAQ;AAC7B,MAAIC,IAAmB,IACnBR,IAAe,GACfS;AACJ,QAAMC,IAAWC,EAAiB,GAC5BC,IAAa,MAAMF,EAAS,WAAW,WACvCG,IAAS,CAACC,MAAkB;AAChC,QAAI,CAACF,EAAU,GAAI;AACjB,YAAMG,IAAQ,IAAIX,EAAeU,CAAa;AAC9C,MAAAE,EAAOD,CAAK,GACZR,EAAO,WAAWQ,CAAK;AAAA,IAC7B;AAAA,EACG,GACKE,IAAc,MAAM;AACxB,IAAAT,IAAmB;AAAA,EACpB,GACKU,IAAgB,MAAM;AAC1B,IAAAV,IAAmB;AAAA,EACpB,GACKW,IAAc,MAAMC,EAAa,UAAS,MAAOb,EAAO,gBAAgB,YAAYJ,EAAc,SAAQ,MAAOI,EAAO,OAAQ,GAChIc,IAAW,MAAMpB,EAASM,EAAO,WAAW,KAAKA,EAAO,OAAQ,GAChEe,IAAU,CAACC,MAAU;AACzB,IAAKX,EAAU,MACbH,IAAc,GACdC,EAAS,QAAQa,CAAK;AAAA,EAEzB,GACKP,IAAS,CAACO,MAAU;AACxB,IAAKX,EAAU,MACbH,IAAc,GACdC,EAAS,OAAOa,CAAK;AAAA,EAExB,GACKC,IAAQ,MACL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AU,OACRJ,IAAc,GACPC;AAAA,IAET,aAAAO;AAAA,IACA,eAAAC;AAAA,IACA,UAAAG;AAAA,IACA,OAAO,OACDA,EAAQ,IACVK,EAAK,IAELF,EAAO,EAAC,KAAKE,CAAG,GAEXhB;AAAA,EAEV;AACH;","x_google_ignoreList":[0]}
@@ -0,0 +1,21 @@
1
+ var e = class {
2
+ constructor() {
3
+ this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
4
+ }
5
+ subscribe(s) {
6
+ return this.listeners.add(s), this.onSubscribe(), () => {
7
+ this.listeners.delete(s), this.onUnsubscribe();
8
+ };
9
+ }
10
+ hasListeners() {
11
+ return this.listeners.size > 0;
12
+ }
13
+ onSubscribe() {
14
+ }
15
+ onUnsubscribe() {
16
+ }
17
+ };
18
+ export {
19
+ e as Subscribable
20
+ };
21
+ //# sourceMappingURL=subscribable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscribable.js","sources":["../../../../../../../../../../node_modules/.pnpm/@tanstack+query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/subscribable.js"],"sourcesContent":["// src/subscribable.ts\nvar Subscribable = class {\n constructor() {\n this.listeners = /* @__PURE__ */ new Set();\n this.subscribe = this.subscribe.bind(this);\n }\n subscribe(listener) {\n this.listeners.add(listener);\n this.onSubscribe();\n return () => {\n this.listeners.delete(listener);\n this.onUnsubscribe();\n };\n }\n hasListeners() {\n return this.listeners.size > 0;\n }\n onSubscribe() {\n }\n onUnsubscribe() {\n }\n};\nexport {\n Subscribable\n};\n//# sourceMappingURL=subscribable.js.map"],"names":["Subscribable","listener"],"mappings":"AACG,IAACA,IAAe,MAAM;AAAA,EACvB,cAAc;AACZ,SAAK,YAA4B,oBAAI,IAAK,GAC1C,KAAK,YAAY,KAAK,UAAU,KAAK,IAAI;AAAA,EAC7C;AAAA,EACE,UAAUC,GAAU;AAClB,gBAAK,UAAU,IAAIA,CAAQ,GAC3B,KAAK,YAAa,GACX,MAAM;AACX,WAAK,UAAU,OAAOA,CAAQ,GAC9B,KAAK,cAAe;AAAA,IACrB;AAAA,EACL;AAAA,EACE,eAAe;AACb,WAAO,KAAK,UAAU,OAAO;AAAA,EACjC;AAAA,EACE,cAAc;AAAA,EAChB;AAAA,EACE,gBAAgB;AAAA,EAClB;AACA;","x_google_ignoreList":[0]}
@@ -0,0 +1,26 @@
1
+ function r() {
2
+ let n, l;
3
+ const t = new Promise((e, c) => {
4
+ n = e, l = c;
5
+ });
6
+ t.status = "pending", t.catch(() => {
7
+ });
8
+ function s(e) {
9
+ Object.assign(t, e), delete t.resolve, delete t.reject;
10
+ }
11
+ return t.resolve = (e) => {
12
+ s({
13
+ status: "fulfilled",
14
+ value: e
15
+ }), n(e);
16
+ }, t.reject = (e) => {
17
+ s({
18
+ status: "rejected",
19
+ reason: e
20
+ }), l(e);
21
+ }, t;
22
+ }
23
+ export {
24
+ r as pendingThenable
25
+ };
26
+ //# sourceMappingURL=thenable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thenable.js","sources":["../../../../../../../../../../node_modules/.pnpm/@tanstack+query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/thenable.js"],"sourcesContent":["// src/thenable.ts\nimport { noop } from \"./utils.js\";\nfunction pendingThenable() {\n let resolve;\n let reject;\n const thenable = new Promise((_resolve, _reject) => {\n resolve = _resolve;\n reject = _reject;\n });\n thenable.status = \"pending\";\n thenable.catch(() => {\n });\n function finalize(data) {\n Object.assign(thenable, data);\n delete thenable.resolve;\n delete thenable.reject;\n }\n thenable.resolve = (value) => {\n finalize({\n status: \"fulfilled\",\n value\n });\n resolve(value);\n };\n thenable.reject = (reason) => {\n finalize({\n status: \"rejected\",\n reason\n });\n reject(reason);\n };\n return thenable;\n}\nfunction tryResolveSync(promise) {\n let data;\n promise.then((result) => {\n data = result;\n return result;\n }, noop)?.catch(noop);\n if (data !== void 0) {\n return { data };\n }\n return void 0;\n}\nexport {\n pendingThenable,\n tryResolveSync\n};\n//# sourceMappingURL=thenable.js.map"],"names":["pendingThenable","resolve","reject","thenable","_resolve","_reject","finalize","data","value","reason"],"mappings":"AAEA,SAASA,IAAkB;AACzB,MAAIC,GACAC;AACJ,QAAMC,IAAW,IAAI,QAAQ,CAACC,GAAUC,MAAY;AAClD,IAAAJ,IAAUG,GACVF,IAASG;AAAA,EACb,CAAG;AACD,EAAAF,EAAS,SAAS,WAClBA,EAAS,MAAM,MAAM;AAAA,EACvB,CAAG;AACD,WAASG,EAASC,GAAM;AACtB,WAAO,OAAOJ,GAAUI,CAAI,GAC5B,OAAOJ,EAAS,SAChB,OAAOA,EAAS;AAAA,EACpB;AACE,SAAAA,EAAS,UAAU,CAACK,MAAU;AAC5B,IAAAF,EAAS;AAAA,MACP,QAAQ;AAAA,MACR,OAAAE;AAAA,IACN,CAAK,GACDP,EAAQO,CAAK;AAAA,EACd,GACDL,EAAS,SAAS,CAACM,MAAW;AAC5B,IAAAH,EAAS;AAAA,MACP,QAAQ;AAAA,MACR,QAAAG;AAAA,IACN,CAAK,GACDP,EAAOO,CAAM;AAAA,EACd,GACMN;AACT;","x_google_ignoreList":[0]}