@protobase/ui 0.116.0 → 0.117.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 (328) hide show
  1. package/dist/account/messages.d.ts +2 -2
  2. package/dist/app/app.js +84 -50
  3. package/dist/app/bottom-bar-from-meta.d.ts +8 -2
  4. package/dist/app/bottom-bar-from-meta.js +23 -11
  5. package/dist/app/charts/messages.d.ts +2 -2
  6. package/dist/app/comments/messages.d.ts +2 -2
  7. package/dist/app/confirm-sign-in-messages.d.ts +2 -2
  8. package/dist/app/create/messages.d.ts +2 -2
  9. package/dist/app/delete/messages.d.ts +2 -2
  10. package/dist/app/displays/messages.d.ts +2 -2
  11. package/dist/app/export/export-dialog.js +1 -1
  12. package/dist/app/export/messages.d.ts +2 -2
  13. package/dist/app/field-types/custom-step-container/messages.d.ts +2 -2
  14. package/dist/app/field-types/runner-install/messages.d.ts +2 -2
  15. package/dist/app/field-types/workflow/messages.d.ts +2 -2
  16. package/dist/app/field-types/workflow-page/messages.d.ts +2 -2
  17. package/dist/app/field-types/workflow-run/messages.d.ts +2 -2
  18. package/dist/app/field-types/workflow-status/messages.d.ts +2 -2
  19. package/dist/app/file-viewers/messages.d.ts +2 -2
  20. package/dist/app/focus/messages.d.ts +2 -2
  21. package/dist/app/gallery/lightbox.js +1 -1
  22. package/dist/app/gallery/messages.d.ts +2 -2
  23. package/dist/app/hand-order/messages.d.ts +2 -2
  24. package/dist/app/history/messages.d.ts +2 -2
  25. package/dist/app/import/import-dialog.js +1 -1
  26. package/dist/app/import/messages.d.ts +2 -2
  27. package/dist/app/import/new-table/import-table-dialog.js +1 -1
  28. package/dist/app/list-messages.d.ts +2 -2
  29. package/dist/app/list-page.js +1 -1
  30. package/dist/app/messages.d.ts +2 -2
  31. package/dist/app/meta-gate-messages.d.ts +2 -2
  32. package/dist/app/new-version/messages.d.ts +2 -2
  33. package/dist/app/pages/action-inputs/action-inputs-dialog.js +1 -1
  34. package/dist/app/pages/messages.d.ts +2 -2
  35. package/dist/app/pages/record-actions.js +1 -1
  36. package/dist/app/record-chart/messages.d.ts +2 -2
  37. package/dist/app/record-messages.d.ts +2 -2
  38. package/dist/app/record-row/messages.d.ts +2 -2
  39. package/dist/app/refresh-mark.js +46 -10
  40. package/dist/app/related-cards/messages.d.ts +2 -2
  41. package/dist/app/runtime/messages.d.ts +2 -2
  42. package/dist/app/saved/messages.d.ts +2 -2
  43. package/dist/app/searches/messages.d.ts +2 -2
  44. package/dist/app/searches/update-search-dialog.js +1 -1
  45. package/dist/app-shell/account-entry.d.ts +17 -0
  46. package/dist/app-shell/account-entry.js +40 -0
  47. package/dist/app-shell/app-shell.d.ts +13 -1
  48. package/dist/app-shell/app-shell.js +80 -10
  49. package/dist/app-shell/back-target.d.ts +3 -2
  50. package/dist/app-shell/back-target.js +4 -3
  51. package/dist/app-shell/bottom-bar.d.ts +15 -3
  52. package/dist/app-shell/bottom-bar.js +70 -42
  53. package/dist/app-shell/brand-bar.d.ts +15 -0
  54. package/dist/app-shell/brand-bar.js +19 -0
  55. package/dist/app-shell/brand-status-bar.d.ts +8 -0
  56. package/dist/app-shell/brand-status-bar.js +27 -0
  57. package/dist/app-shell/breadcrumb.d.ts +4 -2
  58. package/dist/app-shell/breadcrumb.js +45 -37
  59. package/dist/app-shell/drawer.d.ts +2 -1
  60. package/dist/app-shell/drawer.js +22 -5
  61. package/dist/app-shell/global-search.d.ts +3 -1
  62. package/dist/app-shell/global-search.js +4 -4
  63. package/dist/app-shell/index.js +2 -2
  64. package/dist/app-shell/leading-slot.d.ts +9 -0
  65. package/dist/app-shell/leading-slot.js +10 -0
  66. package/dist/app-shell/logo.js +2 -1
  67. package/dist/app-shell/menu-page.d.ts +19 -0
  68. package/dist/app-shell/menu-page.js +29 -0
  69. package/dist/app-shell/messages.d.ts +2 -2
  70. package/dist/app-shell/more-page.d.ts +45 -0
  71. package/dist/app-shell/more-page.js +30 -0
  72. package/dist/app-shell/native-tab-bar.d.ts +47 -0
  73. package/dist/app-shell/native-tab-bar.js +45 -0
  74. package/dist/app-shell/page-scroll.d.ts +3 -2
  75. package/dist/app-shell/page-scroll.js +5 -3
  76. package/dist/app-shell/profile-menu.d.ts +5 -1
  77. package/dist/app-shell/profile-menu.js +138 -117
  78. package/dist/app-shell/sidebar.d.ts +12 -1
  79. package/dist/app-shell/sidebar.js +20 -10
  80. package/dist/app-shell/tab-icon.d.ts +7 -0
  81. package/dist/app-shell/tab-icon.js +38 -0
  82. package/dist/app-shell/top-bar.d.ts +19 -3
  83. package/dist/app-shell/top-bar.js +104 -60
  84. package/dist/app-shell/use-native-bottom-bar.d.ts +16 -0
  85. package/dist/app-shell/use-native-bottom-bar.js +62 -0
  86. package/dist/assistant-dock/messages.d.ts +2 -2
  87. package/dist/auth/messages.d.ts +2 -2
  88. package/dist/calls/call-guests-panel.js +2 -2
  89. package/dist/calls/messages.d.ts +2 -2
  90. package/dist/carousel/messages.d.ts +2 -2
  91. package/dist/chat/messages.d.ts +2 -2
  92. package/dist/data-grid/header-menu.js +33 -28
  93. package/dist/data-grid/messages.d.ts +2 -2
  94. package/dist/data-grid/row-menu.js +38 -33
  95. package/dist/filter-panel/messages.d.ts +2 -2
  96. package/dist/focus-page/bar-actions.js +1 -1
  97. package/dist/format/messages.d.ts +2 -2
  98. package/dist/index.d.ts +2 -1
  99. package/dist/index.js +5 -4
  100. package/dist/inline-child-table/messages.d.ts +2 -2
  101. package/dist/invitations/messages.d.ts +2 -2
  102. package/dist/live/messages.d.ts +2 -2
  103. package/dist/locale/en.js +7 -0
  104. package/dist/locale/en.json.d.ts +7 -0
  105. package/dist/locale/messages.d.ts +14 -0
  106. package/dist/locale/nl.js +7 -0
  107. package/dist/mailbox/messages.d.ts +2 -2
  108. package/dist/mocks/customers.d.ts +1 -1
  109. package/dist/mocks/invoices.d.ts +2 -2
  110. package/dist/mocks/orders.d.ts +1 -1
  111. package/dist/notifications/bell/messages.d.ts +2 -2
  112. package/dist/notifications/bell/notification-bell.js +40 -35
  113. package/dist/organizations/messages.d.ts +2 -2
  114. package/dist/package.js +1 -1
  115. package/dist/primitives/avatar.d.ts +1 -1
  116. package/dist/primitives/avatar.js +2 -1
  117. package/dist/primitives/drawer-math.d.ts +39 -0
  118. package/dist/primitives/drawer-math.js +43 -0
  119. package/dist/primitives/menu-select.js +51 -44
  120. package/dist/primitives/menu-surface.d.ts +22 -0
  121. package/dist/primitives/menu-surface.js +29 -0
  122. package/dist/primitives/messages.d.ts +2 -2
  123. package/dist/primitives/popover-menu.js +1 -0
  124. package/dist/primitives/sheet-drag.d.ts +5 -5
  125. package/dist/primitives/sheet-drag.js +10 -16
  126. package/dist/primitives/sheet.d.ts +5 -2
  127. package/dist/primitives/sheet.js +9 -6
  128. package/dist/primitives/use-drawer-drag.d.ts +34 -0
  129. package/dist/primitives/use-drawer-drag.js +103 -0
  130. package/dist/primitives/use-sheet-drag.d.ts +2 -2
  131. package/dist/primitives/use-sheet-drag.js +10 -9
  132. package/dist/record-view/action-menu.js +45 -40
  133. package/dist/shell/assets/{account-page-9Aq9kvrG.js → account-page-dcJyxP-d.js} +2 -2
  134. package/dist/shell/assets/app-BAQxWF5r.css +2 -0
  135. package/dist/shell/assets/app-DTl8rg8j.js +34 -0
  136. package/dist/shell/assets/{assistant-shell-BGtjYwwY.js → assistant-shell-Bw1jJrLm.js} +2 -2
  137. package/dist/shell/assets/board-display-DDFDZzOk.js +2 -0
  138. package/dist/shell/assets/{calendar-display-DKXi1P_o.js → calendar-display-B0R6JkIL.js} +2 -2
  139. package/dist/shell/assets/call-rings-CzvSKlfI.js +2 -0
  140. package/dist/shell/assets/{calls-DR-Ci2ND.js → calls-BgwbMyeR.js} +2 -2
  141. package/dist/shell/assets/{circle-alert-C0Jeesr7.js → circle-alert-CANqQIsU.js} +2 -2
  142. package/dist/shell/assets/composed-page-gwTeW0b3.js +2 -0
  143. package/dist/shell/assets/{composer-section-rLoyhseD.js → composer-section-gsOgYgY2.js} +2 -2
  144. package/dist/shell/assets/{connect-route-B9xNNieq.js → connect-route-CtL1EJIN.js} +2 -2
  145. package/dist/shell/assets/{copy-field-DkCyHPwg.js → copy-field-CamvXHHQ.js} +2 -2
  146. package/dist/shell/assets/create-route-Cx8yqS-H.js +2 -0
  147. package/dist/shell/assets/{custom-step-container-field-Do5pWJ_q.js → custom-step-container-field-0-Q_RuZy.js} +4 -4
  148. package/dist/shell/assets/embedded-list-56J4XDiR.js +3 -0
  149. package/dist/shell/assets/en-CtEQkQWj.js +2 -0
  150. package/dist/shell/assets/{export-dialog-CovrAwYy.js → export-dialog-CEp2g6vx.js} +2 -2
  151. package/dist/shell/assets/export-worker-DlWkifnE.js +15 -0
  152. package/dist/shell/assets/{graph-view-BfRhAOfb.js → graph-view-CgjfBK_g.js} +2 -2
  153. package/dist/shell/assets/{group-donut-DC8GLnC8.js → group-donut-DGZUg_gn.js} +2 -2
  154. package/dist/shell/assets/{guest-call-page-Dc8M5yz6.js → guest-call-page-BhTshbrl.js} +3 -3
  155. package/dist/shell/assets/{html-viewer-DH_s-gLB.js → html-viewer-GD1mwLEo.js} +2 -2
  156. package/dist/shell/assets/{import-dialog-Ge24RdwQ.js → import-dialog-ByRCf2Cp.js} +2 -2
  157. package/dist/shell/assets/import-table-dialog-CiDY_0RT.js +2 -0
  158. package/dist/shell/assets/{index-Bi_Jks-d.js → index-PtDa8a1m.js} +1 -1
  159. package/dist/shell/assets/invitations-page-Bh-RCnnl.js +2 -0
  160. package/dist/shell/assets/{layout-grid-DCBxzjaE.js → layout-grid-DJrFC12w.js} +2 -2
  161. package/dist/shell/assets/{legend-item-BZXnHPzh.js → legend-item-YdN_NHUz.js} +2 -2
  162. package/dist/shell/assets/{lib-vis.gl-react-maplibre-CdxVSk--.js → lib-vis.gl-react-maplibre-1cv426UN.js} +2 -2
  163. package/dist/shell/assets/list-page-BU1MrXbN.js +4 -0
  164. package/dist/shell/assets/maplibre-BedvDUG2.js +2 -0
  165. package/dist/shell/assets/{markdown-content-DMl-cVjQ.js → markdown-content-BlKajH2l.js} +2 -2
  166. package/dist/shell/assets/members-page-BYUO0Dq2.js +2 -0
  167. package/dist/shell/assets/{messages-D5XhIbDz.js → messages-DQ0cj-Ao.js} +2 -2
  168. package/dist/shell/assets/nl-9OWL4NdF.js +2 -0
  169. package/dist/shell/assets/organization-page-BrC1nHC-.js +2 -0
  170. package/dist/shell/assets/organizations-page-CaUeWdr4.js +2 -0
  171. package/dist/shell/assets/parse-worker-NutG5-Js.js +35 -0
  172. package/dist/shell/assets/{pending-invitation-row-BIO4J3ts.js → pending-invitation-row-juUdWvG6.js} +2 -2
  173. package/dist/shell/assets/{period-chart-CoT2IDzy.js → period-chart-BUZhUb5l.js} +2 -2
  174. package/dist/shell/assets/{person-row-DBeHOA2K.js → person-row-DH3JhMfz.js} +2 -2
  175. package/dist/shell/assets/public-form-page-d3TamPPE.js +2 -0
  176. package/dist/shell/assets/record-lines-NtlHP9Lz.js +2 -0
  177. package/dist/shell/assets/{record-map-BR34Q9uI.js → record-map-BDXoF9AS.js} +2 -2
  178. package/dist/shell/assets/{record-opens-Dbjd4FLe.js → record-opens-C1KgR6ff.js} +2 -2
  179. package/dist/shell/assets/record-page-D88DdoET.js +3 -0
  180. package/dist/shell/assets/record-preview-BT9_Hdcn.js +2 -0
  181. package/dist/shell/assets/{records-map-CXanq-qN.js → records-map-BjHcY5gU.js} +2 -2
  182. package/dist/shell/assets/render-node-v6KfRocH.js +3 -0
  183. package/dist/shell/assets/reorder-button-B3GeKMOJ.js +2 -0
  184. package/dist/shell/assets/{run-trace-view-D1DZCrDs.js → run-trace-view-Ddc0SELh.js} +2 -2
  185. package/dist/shell/assets/{runner-install-field-C2XhrG0M.js → runner-install-field-CiD9Pw1j.js} +2 -2
  186. package/dist/shell/assets/{runtime-update-C5TxLpYf.js → runtime-update-CoXcnfxB.js} +2 -2
  187. package/dist/shell/assets/shared-protobase-ui-CwLnXvxx.js +1 -0
  188. package/dist/shell/assets/sheet-source-DbJu1SrV.js +3 -0
  189. package/dist/shell/assets/sign-in-policy-page-B40iAeJa.js +2 -0
  190. package/dist/shell/assets/start-block-queries-C_udrEM9.js +2 -0
  191. package/dist/shell/assets/step-catalog-7obnZV6X.js +2 -0
  192. package/dist/shell/assets/{step-panel-TfW-31Gv.js → step-panel-BM_xu6Yy.js} +2 -2
  193. package/dist/shell/assets/timeline-display-CdLfWAbQ.js +2 -0
  194. package/dist/shell/assets/{trash-BjnGkZfx.js → trash-BHo3HvFy.js} +2 -2
  195. package/dist/shell/assets/{update-set-BahNKmxv.js → update-set-DTikSoau.js} +2 -2
  196. package/dist/shell/assets/use-calendar-move-Bhha2yOp.js +2 -0
  197. package/dist/shell/assets/{use-display-rows-DsBBYuKB.js → use-display-rows-CS_0O_UE.js} +2 -2
  198. package/dist/shell/assets/{use-paged-search-DaT4uUhX.js → use-paged-search-ChxCRCpF.js} +2 -2
  199. package/dist/shell/assets/{use-run-trace-DHk7l8MX.js → use-run-trace-BfRRgSgG.js} +2 -2
  200. package/dist/shell/assets/{use-workflow-page-DPIhXcnb.js → use-workflow-page-CTdBd8_8.js} +2 -2
  201. package/dist/shell/assets/{use-workflow-types-Bp8iqkBg.js → use-workflow-types-cZQ59ATf.js} +2 -2
  202. package/dist/shell/assets/{vendor-DQHyyBk1.js → vendor-t7Q7QbPu.js} +2 -2
  203. package/dist/shell/assets/{workflow-canvas-CiGUTx4K.js → workflow-canvas-B0kWJeH0.js} +4 -4
  204. package/dist/shell/assets/{workflow-field-lqBx3RDj.js → workflow-field-DXIk6V2Y.js} +3 -3
  205. package/dist/shell/assets/{workflow-graph-editor-DgufTFii.js → workflow-graph-editor-Cem4aY2u.js} +2 -2
  206. package/dist/shell/assets/{workflow-run-field-C4BtvPnB.js → workflow-run-field-BeMn3eOH.js} +3 -3
  207. package/dist/shell/assets/workflow-status-field-0wvGDiva.js +2 -0
  208. package/dist/shell/assets/workflow-workbench-qT5c0xnH.js +4 -0
  209. package/dist/shell/index.html +5 -5
  210. package/dist/shell/protobase.shell.json +3 -3
  211. package/dist/shell/protobase.sw.js +2 -2
  212. package/dist/shell-source-maps/assets/{account-page-9Aq9kvrG.js.map → account-page-dcJyxP-d.js.map} +1 -1
  213. package/dist/shell-source-maps/assets/app-DTl8rg8j.js.map +1 -0
  214. package/dist/shell-source-maps/assets/{assistant-shell-BGtjYwwY.js.map → assistant-shell-Bw1jJrLm.js.map} +1 -1
  215. package/dist/shell-source-maps/assets/{board-display-Ck6nnv4b.js.map → board-display-DDFDZzOk.js.map} +1 -1
  216. package/dist/shell-source-maps/assets/{calendar-display-DKXi1P_o.js.map → calendar-display-B0R6JkIL.js.map} +1 -1
  217. package/dist/shell-source-maps/assets/{call-rings-Bs9dtURX.js.map → call-rings-CzvSKlfI.js.map} +1 -1
  218. package/dist/shell-source-maps/assets/{calls-DR-Ci2ND.js.map → calls-BgwbMyeR.js.map} +1 -1
  219. package/dist/shell-source-maps/assets/{circle-alert-C0Jeesr7.js.map → circle-alert-CANqQIsU.js.map} +1 -1
  220. package/dist/shell-source-maps/assets/{composed-page-Bdzzzuyj.js.map → composed-page-gwTeW0b3.js.map} +1 -1
  221. package/dist/shell-source-maps/assets/{composer-section-rLoyhseD.js.map → composer-section-gsOgYgY2.js.map} +1 -1
  222. package/dist/shell-source-maps/assets/{connect-route-B9xNNieq.js.map → connect-route-CtL1EJIN.js.map} +1 -1
  223. package/dist/shell-source-maps/assets/{copy-field-DkCyHPwg.js.map → copy-field-CamvXHHQ.js.map} +1 -1
  224. package/dist/shell-source-maps/assets/{create-route-DBrv5Kqi.js.map → create-route-Cx8yqS-H.js.map} +1 -1
  225. package/dist/shell-source-maps/assets/{custom-step-container-field-Do5pWJ_q.js.map → custom-step-container-field-0-Q_RuZy.js.map} +1 -1
  226. package/dist/shell-source-maps/assets/embedded-list-56J4XDiR.js.map +1 -0
  227. package/dist/shell-source-maps/assets/en-CtEQkQWj.js.map +1 -0
  228. package/dist/shell-source-maps/assets/{export-dialog-CovrAwYy.js.map → export-dialog-CEp2g6vx.js.map} +1 -1
  229. package/dist/shell-source-maps/assets/export-worker-DlWkifnE.js.map +1 -0
  230. package/dist/shell-source-maps/assets/{graph-view-BfRhAOfb.js.map → graph-view-CgjfBK_g.js.map} +1 -1
  231. package/dist/shell-source-maps/assets/{group-donut-DC8GLnC8.js.map → group-donut-DGZUg_gn.js.map} +1 -1
  232. package/dist/shell-source-maps/assets/{guest-call-page-Dc8M5yz6.js.map → guest-call-page-BhTshbrl.js.map} +1 -1
  233. package/dist/shell-source-maps/assets/{html-viewer-DH_s-gLB.js.map → html-viewer-GD1mwLEo.js.map} +1 -1
  234. package/dist/shell-source-maps/assets/{import-dialog-Ge24RdwQ.js.map → import-dialog-ByRCf2Cp.js.map} +1 -1
  235. package/dist/shell-source-maps/assets/{import-table-dialog-D1aVXF3R.js.map → import-table-dialog-CiDY_0RT.js.map} +1 -1
  236. package/dist/shell-source-maps/assets/{invitations-page-CFwYUoqb.js.map → invitations-page-Bh-RCnnl.js.map} +1 -1
  237. package/dist/shell-source-maps/assets/{layout-grid-DCBxzjaE.js.map → layout-grid-DJrFC12w.js.map} +1 -1
  238. package/dist/shell-source-maps/assets/{legend-item-BZXnHPzh.js.map → legend-item-YdN_NHUz.js.map} +1 -1
  239. package/dist/shell-source-maps/assets/{lib-vis.gl-react-maplibre-CdxVSk--.js.map → lib-vis.gl-react-maplibre-1cv426UN.js.map} +1 -1
  240. package/dist/shell-source-maps/assets/{list-page-DwIEEzTz.js.map → list-page-BU1MrXbN.js.map} +1 -1
  241. package/dist/shell-source-maps/assets/{maplibre-C7kZagL3.js.map → maplibre-BedvDUG2.js.map} +1 -1
  242. package/dist/shell-source-maps/assets/{markdown-content-DMl-cVjQ.js.map → markdown-content-BlKajH2l.js.map} +1 -1
  243. package/dist/shell-source-maps/assets/{members-page-BfrzLCXo.js.map → members-page-BYUO0Dq2.js.map} +1 -1
  244. package/dist/shell-source-maps/assets/{messages-D5XhIbDz.js.map → messages-DQ0cj-Ao.js.map} +1 -1
  245. package/dist/shell-source-maps/assets/nl-9OWL4NdF.js.map +1 -0
  246. package/dist/shell-source-maps/assets/{organization-page-DxA2154P.js.map → organization-page-BrC1nHC-.js.map} +1 -1
  247. package/dist/shell-source-maps/assets/{organizations-page-Bf4oXbvZ.js.map → organizations-page-CaUeWdr4.js.map} +1 -1
  248. package/dist/shell-source-maps/assets/parse-worker-NutG5-Js.js.map +1 -0
  249. package/dist/shell-source-maps/assets/{pending-invitation-row-BIO4J3ts.js.map → pending-invitation-row-juUdWvG6.js.map} +1 -1
  250. package/dist/shell-source-maps/assets/{period-chart-CoT2IDzy.js.map → period-chart-BUZhUb5l.js.map} +1 -1
  251. package/dist/shell-source-maps/assets/{person-row-DBeHOA2K.js.map → person-row-DH3JhMfz.js.map} +1 -1
  252. package/dist/shell-source-maps/assets/{public-form-page-Dhinql3j.js.map → public-form-page-d3TamPPE.js.map} +1 -1
  253. package/dist/shell-source-maps/assets/{record-lines-Dmb8bl38.js.map → record-lines-NtlHP9Lz.js.map} +1 -1
  254. package/dist/shell-source-maps/assets/{record-map-BR34Q9uI.js.map → record-map-BDXoF9AS.js.map} +1 -1
  255. package/dist/shell-source-maps/assets/{record-opens-Dbjd4FLe.js.map → record-opens-C1KgR6ff.js.map} +1 -1
  256. package/dist/shell-source-maps/assets/{record-page-Dnpo_8uE.js.map → record-page-D88DdoET.js.map} +1 -1
  257. package/dist/shell-source-maps/assets/{record-preview-CarOT-Gn.js.map → record-preview-BT9_Hdcn.js.map} +1 -1
  258. package/dist/shell-source-maps/assets/{records-map-CXanq-qN.js.map → records-map-BjHcY5gU.js.map} +1 -1
  259. package/dist/shell-source-maps/assets/{render-node-DGYXKoGV.js.map → render-node-v6KfRocH.js.map} +1 -1
  260. package/dist/shell-source-maps/assets/{reorder-button-9_dAk_3O.js.map → reorder-button-B3GeKMOJ.js.map} +1 -1
  261. package/dist/shell-source-maps/assets/{run-trace-view-D1DZCrDs.js.map → run-trace-view-Ddc0SELh.js.map} +1 -1
  262. package/dist/shell-source-maps/assets/{runner-install-field-C2XhrG0M.js.map → runner-install-field-CiD9Pw1j.js.map} +1 -1
  263. package/dist/shell-source-maps/assets/{runtime-update-C5TxLpYf.js.map → runtime-update-CoXcnfxB.js.map} +1 -1
  264. package/dist/shell-source-maps/assets/{sheet-source-DqFYbJpm.js.map → sheet-source-DbJu1SrV.js.map} +1 -1
  265. package/dist/shell-source-maps/assets/{sign-in-policy-page-vjGTg9Do.js.map → sign-in-policy-page-B40iAeJa.js.map} +1 -1
  266. package/dist/shell-source-maps/assets/{start-block-queries-CmVDv8_F.js.map → start-block-queries-C_udrEM9.js.map} +1 -1
  267. package/dist/shell-source-maps/assets/{step-catalog-PWiIgJSI.js.map → step-catalog-7obnZV6X.js.map} +1 -1
  268. package/dist/shell-source-maps/assets/{step-panel-TfW-31Gv.js.map → step-panel-BM_xu6Yy.js.map} +1 -1
  269. package/dist/shell-source-maps/assets/{timeline-display-eBf3tuig.js.map → timeline-display-CdLfWAbQ.js.map} +1 -1
  270. package/dist/shell-source-maps/assets/{trash-BjnGkZfx.js.map → trash-BHo3HvFy.js.map} +1 -1
  271. package/dist/shell-source-maps/assets/{update-set-BahNKmxv.js.map → update-set-DTikSoau.js.map} +1 -1
  272. package/dist/shell-source-maps/assets/{use-calendar-move-Bfp2yC0P.js.map → use-calendar-move-Bhha2yOp.js.map} +1 -1
  273. package/dist/shell-source-maps/assets/{use-display-rows-DsBBYuKB.js.map → use-display-rows-CS_0O_UE.js.map} +1 -1
  274. package/dist/shell-source-maps/assets/{use-paged-search-DaT4uUhX.js.map → use-paged-search-ChxCRCpF.js.map} +1 -1
  275. package/dist/shell-source-maps/assets/{use-run-trace-DHk7l8MX.js.map → use-run-trace-BfRRgSgG.js.map} +1 -1
  276. package/dist/shell-source-maps/assets/{use-workflow-page-DPIhXcnb.js.map → use-workflow-page-CTdBd8_8.js.map} +1 -1
  277. package/dist/shell-source-maps/assets/{use-workflow-types-Bp8iqkBg.js.map → use-workflow-types-cZQ59ATf.js.map} +1 -1
  278. package/dist/shell-source-maps/assets/{vendor-DQHyyBk1.js.map → vendor-t7Q7QbPu.js.map} +1 -1
  279. package/dist/shell-source-maps/assets/{workflow-canvas-CiGUTx4K.js.map → workflow-canvas-B0kWJeH0.js.map} +1 -1
  280. package/dist/shell-source-maps/assets/{workflow-field-lqBx3RDj.js.map → workflow-field-DXIk6V2Y.js.map} +1 -1
  281. package/dist/shell-source-maps/assets/{workflow-graph-editor-DgufTFii.js.map → workflow-graph-editor-Cem4aY2u.js.map} +1 -1
  282. package/dist/shell-source-maps/assets/{workflow-run-field-C4BtvPnB.js.map → workflow-run-field-BeMn3eOH.js.map} +1 -1
  283. package/dist/shell-source-maps/assets/{workflow-status-field-CqDaP0V9.js.map → workflow-status-field-0wvGDiva.js.map} +1 -1
  284. package/dist/shell-source-maps/assets/{workflow-workbench-CgL6wHPG.js.map → workflow-workbench-qT5c0xnH.js.map} +1 -1
  285. package/dist/status/messages.d.ts +2 -2
  286. package/dist/status/status-dialog.js +1 -1
  287. package/dist/theme.css +6 -0
  288. package/dist/users/messages.d.ts +2 -2
  289. package/package.json +5 -5
  290. package/dist/shell/assets/app-BnDutf0s.js +0 -34
  291. package/dist/shell/assets/app-DcrDZ6Fc.css +0 -2
  292. package/dist/shell/assets/board-display-Ck6nnv4b.js +0 -2
  293. package/dist/shell/assets/call-rings-Bs9dtURX.js +0 -2
  294. package/dist/shell/assets/composed-page-Bdzzzuyj.js +0 -2
  295. package/dist/shell/assets/create-route-DBrv5Kqi.js +0 -2
  296. package/dist/shell/assets/embedded-list-CPgxhzPw.js +0 -3
  297. package/dist/shell/assets/en-B0Sx6LpA.js +0 -2
  298. package/dist/shell/assets/export-worker-DnXy8F95.js +0 -15
  299. package/dist/shell/assets/import-table-dialog-D1aVXF3R.js +0 -2
  300. package/dist/shell/assets/invitations-page-CFwYUoqb.js +0 -2
  301. package/dist/shell/assets/list-page-DwIEEzTz.js +0 -4
  302. package/dist/shell/assets/maplibre-C7kZagL3.js +0 -2
  303. package/dist/shell/assets/members-page-BfrzLCXo.js +0 -2
  304. package/dist/shell/assets/nl-DD4sTnQJ.js +0 -2
  305. package/dist/shell/assets/organization-page-DxA2154P.js +0 -2
  306. package/dist/shell/assets/organizations-page-Bf4oXbvZ.js +0 -2
  307. package/dist/shell/assets/parse-worker-BYXW4dAv.js +0 -35
  308. package/dist/shell/assets/public-form-page-Dhinql3j.js +0 -2
  309. package/dist/shell/assets/record-lines-Dmb8bl38.js +0 -2
  310. package/dist/shell/assets/record-page-Dnpo_8uE.js +0 -3
  311. package/dist/shell/assets/record-preview-CarOT-Gn.js +0 -2
  312. package/dist/shell/assets/render-node-DGYXKoGV.js +0 -3
  313. package/dist/shell/assets/reorder-button-9_dAk_3O.js +0 -2
  314. package/dist/shell/assets/shared-protobase-ui-HnfzBwws.js +0 -1
  315. package/dist/shell/assets/sheet-source-DqFYbJpm.js +0 -3
  316. package/dist/shell/assets/sign-in-policy-page-vjGTg9Do.js +0 -2
  317. package/dist/shell/assets/start-block-queries-CmVDv8_F.js +0 -2
  318. package/dist/shell/assets/step-catalog-PWiIgJSI.js +0 -2
  319. package/dist/shell/assets/timeline-display-eBf3tuig.js +0 -2
  320. package/dist/shell/assets/use-calendar-move-Bfp2yC0P.js +0 -2
  321. package/dist/shell/assets/workflow-status-field-CqDaP0V9.js +0 -2
  322. package/dist/shell/assets/workflow-workbench-CgL6wHPG.js +0 -4
  323. package/dist/shell-source-maps/assets/app-BnDutf0s.js.map +0 -1
  324. package/dist/shell-source-maps/assets/embedded-list-CPgxhzPw.js.map +0 -1
  325. package/dist/shell-source-maps/assets/en-B0Sx6LpA.js.map +0 -1
  326. package/dist/shell-source-maps/assets/export-worker-DnXy8F95.js.map +0 -1
  327. package/dist/shell-source-maps/assets/nl-DD4sTnQJ.js.map +0 -1
  328. package/dist/shell-source-maps/assets/parse-worker-BYXW4dAv.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"vendor-DQHyyBk1.js","names":["isValidDate","PACKAGE_VERSION","now","isPlainObject","isServer","isServer","isPlainObject","getMethod","PACKAGE_VERSION","isServer","getDefaultState","n","a","t","__toESM","require_react","require_jsx_runtime","diagnostic","distance","row","b","i","next","j","cost","suggest","lower","name","best","candidates","candidate","joinSpans","daysIn","month","year","isValidDate$1","match","text","day","isValidTimestamp","hour","minute","second","offsetHour","offsetMinute","unitSeconds","timestampMillis","durationText","durationSeconds","timestampShape","dateShape","dateTail","hexShape","numberShape","at","shape","source","scanNumeric","timestamp","start","end","hex","isDelimiter","extensions","simple","hexDigits","from","length","escape","char","lengths","code","octal","scanString","quote","errors","value","result","punctuation","keywords","afterNow","rparen","lparen","tokens","lex","special","push","surrogate","scan","twoChars","offsetPlus","ParseAbort","error","abort","message","hint","span","peek","c","offset","token","eat","kind","describe","expect","what","withDepth","run","segmentKinds","parseMember","first","path","part","isIndex","durationFrom","operandKinds$1","isOperand$1","node","parseCall","args","parseArg","parseOperand","number","raw","member","composite","open","inner","primary","startsOperand","left","nowOffset","isNow","allowed","op","right","parseRight","arg","comparators","termStarts","group","items","item","sync","depth","parseRestriction","star","parseSimple","parseExpression","parseTerm","following","negativeNumber","parseTermRecovering","parseFactor","parseSequence","parseFilter","maxLength","options","lexed","parts","stray","defined","ast","findField","fields","alias","spec","resolveMember","head","found","ctx","usable","s","close","filterable","segment","problem","expected","textOf$1","numeric","compatible","wanted","actual","checkValue","type","isOperandArg","checkArg","param","resolved","checked","checkOperand","checkCall","functions","call","fn","min","expectedCount","p","arithmetic$1","literalTypes","ordered","checkSubject","operatorError","checkRight","subject","checkCompare","wildcard","checkHas","checkExpr","checkFilter","escapes","literal","isNegative","printOperand","printArg","isExpr","printFilter","operandKinds","grouped","parent","Decimal","int","scale","other","plain","parseDecimal","fraction","numericText","doubleOf","decimalOf","globMatch","resume","pattern","isDuration","literalValue","secondsOf","millisOf","textOf","verdict","order","numbers","x","y","againstString","millis","seconds","compareValue","resolvePath","current","record","step","elements","values","maxDepth","leaves","defaultSearch","needle","leaf","isOperand","arithmetic","sign","callValue","operandValue","evaluateExpr","matches","convertFor","evaluateCompare","evaluateHas","key","evaluateFilter","tokenize","parseOrderBy","pos","fail","skipItem","parseItem","last","word","direction","after","find","field","checkOrderBy","schema","f","sortable","failed","require_constants","__commonJSMin","require_debug","require_re","debug","re","safeRe","src","safeSrc","R","LETTERDASHNUMBER","safeRegexReplacements","MAX_LENGTH","MAX_SAFE_BUILD_LENGTH","makeSafeRegex","max","createToken","safe","index","isGlobal","MAX_SAFE_COMPONENT_LENGTH","require_parse_options","looseOption","emptyOpts","require_identifiers","compareIdentifiers","anum","bnum","require_semver$1","parseOptions","isPrereleaseIdentifier","identifiers","identifier","prerelease","SemVer","version","m","MAX_SAFE_INTEGER","id","num","release","identifierBase","base","prereleaseBase","require_parse","er","throwErrors","require_valid$1","parse","v","require_clean","require_inc","require_diff","v1","version1","v2","version2","comparison","v1Higher","highVersion","lowVersion","highHasPre","prefix","require_major","loose","require_minor","require_patch","require_prerelease","parsed","require_compare","require_rcompare","compare","require_compare_loose","require_compare_build","versionA","versionB","require_sort","compareBuild","list","require_rsort","require_gt","require_lt","require_eq","require_neq","require_gte","require_lte","require_cmp","eq","neq","gt","gte","lt","lte","require_coerce","coerceRtlRegex","major","require_truncate","constants","truncate","truncation","clonedVersion","cloneInputVersion","doTruncation","isPrerelease","require_lrucache","firstKey","require_range","SPACE_CHARACTERS","Range","range","Comparator","r","isNullSet","isAny","comps","k","BUILDSTRIPRE","memoKey","FLAG_INCLUDE_PRERELEASE","FLAG_LOOSE","cached","cache","hr","hyphenReplace","comparatorTrimReplace","tildeTrimReplace","caretTrimReplace","rangeList","parseComparator","comp","replaceGTE0","rangeMap","isSatisfiable","thisComparators","rangeComparators","thisComparator","rangeComparator","testSet","require_comparator","remainingComparators","testComparator","otherComparator","replaceCarets","replaceTildes","replaceXRanges","replaceStars","isX","invalidXRangeOrder","M","replaceTilde","z","_","pr","ret","replaceCaret","replaceXRange","gtlt","xM","xm","xp","anyX","fM","fm","incPr","fp","fpr","to","tM","tm","tp","tpr","set","ANY","cmp","require_satisfies","require_to_comparators","require_max_satisfying","maxSV","rangeObj","versions","require_min_satisfying","minSV","require_min_version","minver","setMin","compver","comparator","require_valid","require_outside","satisfies","gtfn","ltefn","ltfn","ecomp","hilo","high","low","require_gtr","outside","require_ltr","require_intersects","r1","r2","require_simplify","prev","ranges","simplified","original","require_subset","subset","sub","dom","sawNonNull","simpleSub","simpleDom","isSub","simpleSubset","minimumVersionWithPreRelease","minimumVersion","eqSet","higherGT","lowerLT","gtltComp","higher","hasDomLT","hasDomGT","needDomLTPre","needDomGTPre","require_semver","internalRe","ParseError","LF","CR","SPACE","MAX_FIELD_PREFIX_LENGTH","createParser","config","pendingFragments","pendingFragmentsLength","bomPrefix","data","dataLines","eventType","terminated","skippingLine","skipNextLineFeed","feed","chunk","resumeAfterSkip","trailing","processLines","storeTrailing","checkForBufferOverflow","shouldBufferTrailing","input","crIndex","lfIndex","lineEnd","parseLine","firstCharCode","onComment","isPotentialField","maxBufferSize","onError","searchIndex","onId","onEvent","isDataPrefix","valueStart","isEventPrefix","dispatchEvent","line","fieldSeparatorIndex","processField","onRetry","reset","incompleteLine","memoize","cacheDefault","serializer","serializerDefault","strategyDefault","isPrimitive","monadic","cacheKey","computedValue","variadic","assemble","strategy","context","serialize","strategyVariadic","strategyMonadic","ObjectWithoutPrototypeCache","strategies","DATE_TIME_REGEX","parseDateTimeSkeleton","skeleton","len","WHITE_SPACE_REGEX","parseNumberSkeletonFromString","stringTokens","stringToken","stemAndOptions","stem","option","icuUnitToEcma","unit","FRACTION_PRECISION_REGEX","SIGNIFICANT_PRECISION_REGEX","INTEGER_WIDTH_REGEX","CONCISE_INTEGER_WIDTH_REGEX","parseSignificantPrecision","str","g2","g1","parseSign","parseConciseScientificAndEngineeringStem","signDisplay","parseNotationOptions","opt","parseNumberSkeleton","all","g3","g4","g5","signOpts","conciseScientificAndEngineeringOpts","ErrorKind","\"EXPECT_ARGUMENT_CLOSING_BRACE\"","\"EMPTY_ARGUMENT\"","\"MALFORMED_ARGUMENT\"","\"EXPECT_ARGUMENT_TYPE\"","\"INVALID_ARGUMENT_TYPE\"","\"EXPECT_ARGUMENT_STYLE\"","\"INVALID_NUMBER_SKELETON\"","\"INVALID_DATE_TIME_SKELETON\"","\"EXPECT_NUMBER_SKELETON\"","\"EXPECT_DATE_TIME_SKELETON\"","\"UNCLOSED_QUOTE_IN_ARGUMENT_STYLE\"","\"EXPECT_SELECT_ARGUMENT_OPTIONS\"","\"EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE\"","\"INVALID_PLURAL_ARGUMENT_OFFSET_VALUE\"","\"EXPECT_SELECT_ARGUMENT_SELECTOR\"","\"EXPECT_PLURAL_ARGUMENT_SELECTOR\"","\"EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\"","\"EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT\"","\"INVALID_PLURAL_ARGUMENT_SELECTOR\"","\"DUPLICATE_PLURAL_ARGUMENT_SELECTOR\"","\"DUPLICATE_SELECT_ARGUMENT_SELECTOR\"","\"MISSING_OTHER_CLAUSE\"","\"INVALID_TAG\"","\"INVALID_TAG_NAME\"","\"UNMATCHED_CLOSING_TAG\"","\"UNCLOSED_TAG\"","isLiteralElement","el","isArgumentElement","isNumberElement","isDateElement","isTimeElement","isSelectElement","isPluralElement","isPoundElement","isTagElement","isNumberSkeleton","isDateTimeSkeleton","SPACE_SEPARATOR_REGEX","IDENTIFIER_PREFIX_REGEX","timeData","\"AC\"","\"AD\"","\"AE\"","\"AF\"","\"AG\"","\"AI\"","\"AL\"","\"AM\"","\"AO\"","\"AR\"","\"AS\"","\"AT\"","\"AU\"","\"AW\"","\"AX\"","\"AZ\"","\"BA\"","\"BB\"","\"BD\"","\"BE\"","\"BF\"","\"BG\"","\"BH\"","\"BI\"","\"BJ\"","\"BL\"","\"BM\"","\"BN\"","\"BO\"","\"BQ\"","\"BR\"","\"BS\"","\"BT\"","\"BW\"","\"BY\"","\"BZ\"","\"CA\"","\"CC\"","\"CD\"","\"CF\"","\"CG\"","\"CH\"","\"CI\"","\"CK\"","\"CL\"","\"CM\"","\"CN\"","\"CO\"","\"CP\"","\"CR\"","\"CU\"","\"CV\"","\"CW\"","\"CX\"","\"CY\"","\"CZ\"","\"DE\"","\"DG\"","\"DJ\"","\"DK\"","\"DM\"","\"DO\"","\"DZ\"","\"EA\"","\"EC\"","\"EE\"","\"EG\"","\"EH\"","\"ER\"","\"ES\"","\"ET\"","\"FI\"","\"FJ\"","\"FK\"","\"FM\"","\"FO\"","\"FR\"","\"GA\"","\"GB\"","\"GD\"","\"GE\"","\"GF\"","\"GG\"","\"GH\"","\"GI\"","\"GL\"","\"GM\"","\"GN\"","\"GP\"","\"GQ\"","\"GR\"","\"GS\"","\"GT\"","\"GU\"","\"GW\"","\"GY\"","\"HK\"","\"HN\"","\"HR\"","\"HU\"","\"IC\"","\"ID\"","\"IE\"","\"IL\"","\"IM\"","\"IN\"","\"IO\"","\"IQ\"","\"IR\"","\"IS\"","\"IT\"","\"JE\"","\"JM\"","\"JO\"","\"JP\"","\"KE\"","\"KG\"","\"KH\"","\"KI\"","\"KM\"","\"KN\"","\"KP\"","\"KR\"","\"KW\"","\"KY\"","\"KZ\"","\"LA\"","\"LB\"","\"LC\"","\"LI\"","\"LK\"","\"LR\"","\"LS\"","\"LT\"","\"LU\"","\"LV\"","\"LY\"","\"MA\"","\"MC\"","\"MD\"","\"ME\"","\"MF\"","\"MG\"","\"MH\"","\"MK\"","\"ML\"","\"MM\"","\"MN\"","\"MO\"","\"MP\"","\"MQ\"","\"MR\"","\"MS\"","\"MT\"","\"MU\"","\"MV\"","\"MW\"","\"MX\"","\"MY\"","\"MZ\"","\"NA\"","\"NC\"","\"NE\"","\"NF\"","\"NG\"","\"NI\"","\"NL\"","\"NO\"","\"NP\"","\"NR\"","\"NU\"","\"NZ\"","\"OM\"","\"PA\"","\"PE\"","\"PF\"","\"PG\"","\"PH\"","\"PK\"","\"PL\"","\"PM\"","\"PN\"","\"PR\"","\"PS\"","\"PT\"","\"PW\"","\"PY\"","\"QA\"","\"RE\"","\"RO\"","\"RS\"","\"RU\"","\"RW\"","\"SA\"","\"SB\"","\"SC\"","\"SD\"","\"SE\"","\"SG\"","\"SH\"","\"SI\"","\"SJ\"","\"SK\"","\"SL\"","\"SM\"","\"SN\"","\"SO\"","\"SR\"","\"SS\"","\"ST\"","\"SV\"","\"SX\"","\"SY\"","\"SZ\"","\"TA\"","\"TC\"","\"TD\"","\"TF\"","\"TG\"","\"TH\"","\"TJ\"","\"TL\"","\"TM\"","\"TN\"","\"TO\"","\"TR\"","\"TT\"","\"TW\"","\"TZ\"","\"UA\"","\"UG\"","\"UM\"","\"US\"","\"UY\"","\"UZ\"","\"VA\"","\"VC\"","\"VE\"","\"VG\"","\"VI\"","\"VN\"","\"VU\"","\"WF\"","\"WS\"","\"XK\"","\"YE\"","\"YT\"","\"ZA\"","\"ZM\"","\"ZW\"","getBestPattern","skeletonCopy","patternPos","patternChar","extraLength","hourLen","dayPeriodLen","hourChar","getDefaultHourSymbolFromLocale","locale","hourCycle","localeWithHourCycles","languageTag","regionTag","SPACE_SEPARATOR_START_REGEX","SPACE_SEPARATOR_END_REGEX","createLocation","hasNativeFromEntries","hasTrimStart","hasTrimEnd","fromEntries","obj","entries","trimStart","trimEnd","IDENTIFIER_PREFIX_RE","createIdentifierPrefixRegex","regex","matchIdentifierAtIndex","plainTopLevelEndPosition","column","Parser","firstCode","plainEndPosition","nestingLevel","expectingCloseTag","parentArgType","position","_isAlpha","startPosition","tagName","childrenResult","children","endTagStartPosition","closingTagNameStartPosition","startOffset","_isPotentialElementNameChar","parseQuoteResult","parseUnquotedResult","parseLeftAngleResult","location","_isAlphaOrSlash","codePoints","ch","openingBracePosition","startingPosition","endOffset","typeStartPosition","argType","typeEndPosition","styleAndLocation","styleStartPosition","style","argCloseResult","dateTimePattern","identifierAndLocation","pluralOffset","optionsResult","nestedBraces","apostrophePosition","hasOtherClause","parsedSelectors","selector","selectorLocation","parsedFirstIdentifier","fragmentResult","expectCloseTag","hasDigits","decimal","invalidNumberError","expectNumberError","currentOffset","targetOffset","_isWhiteSpace","codepoint","pruneLocation","els","opts","FormatError","msg","originalMessage","InvalidValueError","variableId","InvalidValueTypeError","MissingValueError","mergeLiteral","lastPart","isFormatXMLElementFn","formatToParts","currentPluralValue","formatters","locales","varName","formats","formatFn","chunks","exactKey","numericValue","rule","mergeConfig","c2","c1","mergeConfigs","configs","defaultConfig","createFastMemoizeCache","store","createDefaultFormatters","IntlMessageFormat","parseOpts","overrideFormats","supportedLocales","scriptRel","assetsURL","dep","seen","isCssPreloadUrl","url","__vitePreload","promise","deps","preloadedHrefs","cspNonceMeta","cspNonce","allSettled","promises","importMetaResolve","specifier","depString","importerUrl","isCss","links","link","res","rej","handlePreloadError","e","err","baseModule","defineErrorCodes","codes","PASSKEY_ERROR_CODES","PACKAGE_VERSION$1","bufferToBase64URLString","bytes","buffer","charCode","base64URLStringToBuffer","base64","base64URLString","padLength","padded","binary","browserSupportsWebAuthn","_browserSupportsWebAuthnInternals","toPublicKeyCredentialDescriptor","descriptor","isValidDomain","hostname","WebAuthnError","cause","identifyRegistrationError","publicKey","effectiveDomain","WebAuthnAbortService","abortError","newController","attachments","toAuthenticatorAttachment","attachment","startRegistration","optionsJSON","createOptions","useAutoRegister","credential","transports","response","responsePublicKeyAlgorithm","warnOnBrokenImplementation","responsePublicKey","_publicKey","responseAuthenticatorData","rawId","methodName","browserSupportsWebAuthnAutofill","_browserSupportsWebAuthnAutofillInternals","resolve","globalPublicKeyCredential","identifyAuthenticationError","startAuthentication","allowCredentials","getOptions","useBrowserAutofill","verifyBrowserAutofillInput","userHandle","PACKAGE_VERSION","kBroadcastChannel","now$1","WindowBroadcastChannel","listener","handler","event","getGlobalBroadcastChannel","listenerQueue","lqIndex","batchSeen","QUEUE_ITEMS_PER_LISTENER","nanostoresGlobal","drainQueue","thrown","pendingStores","atom","listeners","$atom","initialValue","runListenerQueue","oldValue","changedKey","newValue","unbind","SET","MOUNT","UNMOUNT","REVERT_MUTATION","on","object","eventKey","mutateStore","l","eventProps","currentListeners","onSet","$store","originSet","originSetKey","isAborted","runListeners","changed","changedValue","STORE_UNMOUNT_DELAY","onMount","destroy","initialize","payload","originListen","originOff","isPlainObject$2","prototype","isJsonEqual","keysA","keysB","withEquality","isEqual","kFocusManager","WindowFocusManager","focused","visibilityHandler","getGlobalFocusManager","kOnlineManager","WindowOnlineManager","online","onOnline","onOffline","getGlobalOnlineManager","PROTO_POLLUTION_PATTERNS","JSON_SIGNATURE","SPECIAL_VALUES","ISO_DATE_REGEX","isValidDate","date","parseISODate","ms","offsetSign","betterJSONParse","trimmed","lowerValue","strict","warnings","parseDates","reviver","parseJSON","kAuthQuery","createAuthQueryAtom","queryAtom","isServer$3","isAuthQueryStateEqual","useAuthQuery","queryParams","latestRequestId","requestId","$fetch","stableData","retryAttempts","request","retryAttempt","isUnauthorized","currentValue","initializedAtom","isMountFetchPending","isMounted","shouldRefetchAfterPending","fetchOnMount","shouldRefetch","isInitialized","timeoutId","cleanups","initAtom","cleanup","now","FOCUS_REFETCH_RATE_LIMIT_SECONDS","createSessionRefreshManager","refetchInterval","refetchOnWindowFocus","refetchWhenOffline","state","triggerRefetch","fetchSession","broadcastSessionUpdate","setupPolling","shouldPollSession","setupBroadcast","setupFocusRefetch","setupOnlineRefetch","setupSignalSubscription","sessionSignal","_envShim","_getEnv","env","prop","getEnvVar","fallback","isErrorStackTraceLimitWritable","desc","hideInternalStackFrames","lines","stack","makeErrorForHideStackFrame","HideStackFramesError","Base","limit","#hiddenStack","clazz","statusCodes","status","body","headers","statusCode","publicBody","BetterAuthError","SLASH_CHAR_CODE","trimTrailingSlashes","checkHasPath","assertHasProtocol","parsedUrl","withPath","trimmedUrl","validateProxyHeader","header","getBaseURL","loadEnv","fromEnv","fromRequest","fromRequestProto","trustedProxyHeaders","getOrigin","DANGEROUS_URL_SCHEMES","isSafeUrlScheme","redirectPlugin","isServer$2","SESSION_MOUNT_DEDUPE_INTERVAL","hydrateSessionAtom","currentSession","sessionAtom","session","normalizeSessionResponse","normalizeSessionData","isSessionAtomEqual","getSessionAtom","$signal","flight","freshUntil","sessionRevision","refetch","executeSessionFetch","signal","outcome","refreshRes","latest","sessionData","fetchError","getFreshUntil","expiresAt","sessionExpiresAt","controller","settleFlight","fetchSessionOnMount","refreshManager","trigger","isPlainObject$1","_defu","defaults","baseObject","namespace","merger","createDefu","arguments_","defu","BetterFetchError","statusText","initializePlugins","hooks","plugin","pluginRes","LinearRetryStrategy","attempt","ExponentialRetryStrategy","createRetryStrategy","methods","parseMethodModifier","separator","method","isReservedPathSegment","encodeLiteralPathSegment","resolvePathSegment","pathParam","pathParams","getURL$1","basePath","baseURL","requestPath","urlQuery","query","serializedValue","val","params","paramPaths","queryParamString","getAuthHeader","getValue","\"authorization\"","username","password","JSON_RE","detectResponseType","_contentType","textTypes","contentType","isJSONParsable","isJSONSerializable","jsonParse","isFunction","getFetch","mergeHeaders","sources","merged","getHeaders","detectContentType","getMediaType","getBody","getMethod$1","getTimeout","abortTimeout","ValidationError","issues","parseStandardSchema","_typeof","o","toPrimitive","toPropertyKey","_defineProperty","ownKeys","_objectSpread2","betterFetch","_options$body","__url","fetch","_url","onRequest","clearTimeout","responseContext","onResponse","_options$hookOptions","responseType","successContext","onSuccess","_options$hookOptions2","parser","responseText","isJSONResponse","errorObject","errorContext","_options$hookOptions3","retryStrategy","_retryAttempt","delay","applySchemaPlugin","_config$plugins","urlKey","keySchema","schemaMethod","validatedHeaders","normalizedHeaders","validated","finalHeaders","createFetch","resolvePublicAuthUrl","protocol","matchesSessionSignal","getClientConfig","isCredentialsSupported","pluginsFetchPlugins","pl","lifeCyclePlugin","_onSuccess","_onError","_onRequest","_onResponse","restOfFetchOptions","hasHydrated","hydrateSession","plugins","pluginsActions","pluginsAtoms","pluginPathMethods","atomListeners","isAtom","capitalizeFirstLetter","WORD_PATTERN","APOSTROPHE_PATTERN","splitWords","toKebabCase","getMethod","knownPathMethods","_query","fetchOptions","createDynamicPathProxy","createProxy","fullPath","routes","routePath","argFetchOptions","client","visited","atoms","createAuthClient","resolvedHooks","getPasskeyActions","mergedExtensions","responseBody","verified","$listPasskeys","fetchOpts","passkeyClient","EMAIL_OTP_ERROR_CODES","emailOTPClient","jwtClient","jwksPath","TWO_FACTOR_ERROR_CODES","twoFactorClient","import_react","import_jsx_runtime","QueryClientContext","useQueryClient","queryClient","QueryClientProvider","defaultTimeoutProvider","callback","intervalId","timeoutManager","#provider","provider","systemSetTimeoutZero","isServer$1","noop","functionalUpdate","updater","isValidTimeout","timeUntilStale","updatedAt","staleTime","resolveQueryValue","matchQuery","filters","queryKey","exact","hashQueryKeyByOptions","partialMatchKey","isActive","stale","fetchStatus","predicate","matchMutation","mutationKey","mutation","hashKey","isPlainObject","bKeys","hasOwn","replaceEqualDeep","array","isPlainArray","aSize","bItems","bSize","copy","equalItems","aItem","bItem","shallowEqualObjects","hasObjectPrototype","objectPrototype","ctor","prot","sleep","timeout","replaceData","prevData","keepPreviousData","previousData","addToEnd","newItems","addToStart","skipToken","ensureQueryFn","shouldThrowError","throwOnError","addConsumeAwareSignal","consumed","getSignal","onCancelled","isServerFn","isServer","Subscribable","focusManager","#setup","onFocus","#cleanup","setup","#focused","isFocused","tryResolveSync","dehydrateMutation","dehydratePromise","serializeData","shouldRedactErrors","dehydrateQuery","defaultShouldDehydrateMutation","defaultShouldDehydrateQuery","dehydrate","filterMutation","mutations","filterQuery","hydrate","mutationCache","queryCache","deserializeData","dehydratedState","mutationOptions","syncData","rawData","queryHash","existingQueryIsPending","existingQueryIsFetching","hasNewerSyncData","dehydratedAt","_ignored","serializedState","queryType","defaultScheduler","createNotifyManager","queue","transactions","notifyFn","batchNotifyFn","scheduleFn","schedule","flush","originalQueue","notifyManager","onlineManager","onlineListener","offlineListener","#online","defaultRetryDelay","failureCount","canFetch","networkMode","CancelledError","createRetryer","isRetryCancelled","continueFn","promiseResolve","promiseReject","reject","isResolved","cancel","cancelOptions","cancelRetry","continueRetry","canContinue","canStart","pause","continueResolve","promiseOrValue","initialPromise","retry","retryDelay","shouldRetry","Removable","#gcTimeout","newGcTime","infiniteQueryBehavior","oldPages","oldPageParams","currentPage","fetchFn","cancelled","addSignalProperty","queryFn","fetchPage","queryFnContext","previous","page","addTo","maxPages","pageParamFn","getPreviousPageParam","getNextPageParam","oldData","remainingPages","pages","lastIndex","pageParams","hasNextPage","hasPreviousPage","Query","#abortSignalConsumed","#defaultOptions","#client","#cache","#initialState","getDefaultState$1","#queryType","#retryer","defaultState","successState","newData","#dispatch","observer","abortController","#revertState","retryer","reducer","action","fetchState","newState","dataUpdatedAt","hasData","initialDataUpdatedAt","QueryObserver","#selectError","#currentQuery","shouldFetchOnMount","#executeFetch","#updateTimers","shouldFetchOn","#clearStaleTimeout","#clearRefetchInterval","prevOptions","prevQuery","#updateQuery","mounted","shouldFetchOptionally","#updateStaleTimeout","nextRefetchInterval","#computeRefetchInterval","#currentRefetchInterval","#updateRefetchInterval","#currentResult","#currentResultOptions","#currentResultState","onPropTracked","target","#trackedProps","defaultedOptions","unsubscribe","resolveEarly","cachePromise","#shouldScheduleTimer","#staleTimeoutId","nextInterval","#refetchIntervalId","prevResult","prevResultState","prevResultOptions","queryInitialState","#currentQueryInitialState","isPlaceholderData","fetchOptionally","skipSelect","placeholderData","#lastQueryWithDefinedData","#selectFn","#selectResult","selectError","isFetching","isPending","isError","isLoading","isStale","nextResult","notifyListeners","notifyOnChangePropsValue","notifyOnChangeProps","includedProps","typedKey","shouldLoadOnMount","InfiniteQueryObserver","parentResult","fetchDirection","isFetchNextPageError","isFetchingNextPage","isFetchPreviousPageError","isFetchingPreviousPage","isRefetchError","isRefetching","Mutation","#mutationCache","#observers","getDefaultState","onContinue","mutationFnContext","variables","restored","isPaused","MutationCache","#mutations","#scopes","#mutationId","scope","scopeFor","scopedMutations","firstPendingMutation","defaultedFilters","pausedMutations","MutationObserver","#updateResult","#currentMutation","#notify","#mutateOptions","onMutateResult","difference","excludeSet","array2","array1","QueriesObserver","#options","#queries","#result","queries","#onUpdate","prevObservers","newObserverMatches","#findMatchingObservers","newObservers","newResult","hasLengthChange","hasIndexChange","hasStructuralChange","hasResultChange","#observerMatches","queryHashes","#combineResult","combine","#trackResult","trackedProps","observerResult","accessedProp","lastHashes","#lastQueryHashes","queryHashesChanged","hash","#lastResult","#lastCombine","#combinedResult","prevObserversMap","previousObservers","observers","shouldSkipCombine","#shouldSkipCombine","previousResult","QueryCache","QueryClient","#queryCache","#queryDefaults","#mutationDefaults","#mountCount","#unsubscribeFocus","#unsubscribeOnline","cachedData","matched","queriesToRefetch","defaultedCancelOptions","queryData","select","queryDefault","IsRestoringContext","useIsRestoring","createValue","isReset","QueryErrorResetBoundaryContext","useQueryErrorResetBoundary","ensurePreventErrorBoundaryRetry","errorResetBoundary","useClearResetErrorBoundary","getHasError","suspense","ensureSuspenseTimers","MIN_SUSPENSE_TIME_MS","clamp","originalStaleTime","shouldSuspend","fetchOptimistic","useQueries","isRestoring","subscribed","defaultedQueries","queryOptions","optimisticResult","getCombinedResult","trackResult","shouldSubscribe","onStoreChange","suspensePromises","firstSingleResultWhichShouldThrow","useBaseQuery","Observer","useQuery","useIsFetching","useMutation","mutate","useInfiniteQuery","QrCodeDataType","\"Border\"","\"Data\"","\"Function\"","\"Position\"","\"Timing\"","\"Alignment\"","QrCodeDataType2","LOW","MEDIUM","QUARTILE","HIGH","EccMap","NUMERIC_REGEX","ALPHANUMERIC_REGEX","ALPHANUMERIC_CHARSET","MIN_VERSION","MAX_VERSION","PENALTY_N1","PENALTY_N2","PENALTY_N3","PENALTY_N4","ECC_CODEWORDS_PER_BLOCK","NUM_ERROR_CORRECTION_BLOCKS","QrCode","ecc","msk","allCodewords","dataCodewords","minPenalty","penalty","alignPatPos","numAlign","mask","rem","bits","getBit","color","dy","dx","dist","xx","yy","isDark","ver","ecl","getNumDataCodewords","numBlocks","blockEccLen","rawCodewords","getNumRawDataModules","numShortBlocks","shortBlockLen","blocks","rsDiv","reedSolomonComputeDivisor","dat","reedSolomonComputeRemainder","block","vert","invert","runColor","runX","runHistory","runY","dark","sum","total","core","currentRunColor","currentRunLength","appendBits","bb","QrSegment","mode","numChars","bitData","MODE_NUMERIC","MODE_ALPHANUMERIC","MODE_BYTE","numCharCountBits","makeBytes","makeNumeric","isNumeric","digits","makeAlphanumeric","isAlphanumeric","temp","makeSegments","toUtf8ByteArray","getTotalBits","seg","segs","ccbits","degree","root","reedSolomonMultiply","divisor","factor","coef","encodeSegments","minVersion","maxVersion","dataUsedBits","dataCapacityBits2","usedBits","newEcl","boostEcl","dataCapacityBits","padByte","encode","qr","maskPattern","boostEcc","addBorder","border","mod","newSize","size","thumbHashToRGBA","header24","header16","l_dc","p_dc","q_dc","l_scale","hasAlpha","p_scale","q_scale","isLandscape","lx","ly","a_dc","a_scale","ac_start","ac_index","decodeChannel","ac","cy","ny","cx","nx","l_ac","p_ac","q_ac","a_ac","ratio","thumbHashToApproximateAspectRatio","w","round","h","rgba","fx","fy","q","cos","PI","fy2","g","rgbaToDataURL","idat","table","u","thumbHashToDataURL","image"],"sources":["../../../../../node_modules/.bun/aip-parsers@1.0.0/node_modules/aip-parsers/dist/suggest-DaQ79xMY.js","../../../../../node_modules/.bun/aip-parsers@1.0.0/node_modules/aip-parsers/dist/filter-CnhA37_F.js","../../../../../node_modules/.bun/aip-parsers@1.0.0/node_modules/aip-parsers/dist/order-by-aYK3GUpT.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/internal/constants.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/internal/debug.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/internal/re.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/internal/parse-options.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/internal/identifiers.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/classes/semver.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/parse.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/valid.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/clean.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/inc.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/diff.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/major.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/minor.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/patch.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/prerelease.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/compare.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/rcompare.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/compare-loose.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/compare-build.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/sort.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/rsort.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/gt.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/lt.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/eq.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/neq.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/gte.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/lte.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/cmp.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/coerce.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/truncate.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/internal/lrucache.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/classes/range.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/classes/comparator.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/satisfies.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/to-comparators.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/max-satisfying.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/min-satisfying.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/min-version.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/valid.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/outside.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/gtr.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/ltr.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/intersects.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/simplify.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/subset.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/index.js","../../../../../node_modules/.bun/eventsource-parser@4.1.3/node_modules/eventsource-parser/dist/errors.js","../../../../../node_modules/.bun/eventsource-parser@4.1.3/node_modules/eventsource-parser/dist/parse.js","../../../../../node_modules/.bun/@formatjs+fast-memoize@3.1.7/node_modules/@formatjs/fast-memoize/index.js","../../../../../node_modules/.bun/@formatjs+icu-skeleton-parser@2.1.12/node_modules/@formatjs/icu-skeleton-parser/index.js","../../../../../node_modules/.bun/@formatjs+icu-messageformat-parser@3.5.22/node_modules/@formatjs/icu-messageformat-parser/index.js","../../../../../node_modules/.bun/intl-messageformat@12.1.4/node_modules/intl-messageformat/index.js","../../../../../node_modules/.bun/@better-auth+core@1.7.12+d8c37f950c8f0cf7/node_modules/@better-auth/core/dist/utils/error-codes.mjs","../../../../../node_modules/.bun/@better-auth+passkey@1.7.12+8eaedbcd779c7282/node_modules/@better-auth/passkey/dist/version-DAM-NEJL.mjs","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/bufferToBase64URLString.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/base64URLStringToBuffer.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthn.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/toPublicKeyCredentialDescriptor.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/isValidDomain.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/webAuthnError.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/identifyRegistrationError.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/webAuthnAbortService.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/toAuthenticatorAttachment.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/methods/startRegistration.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthnAutofill.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/identifyAuthenticationError.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/methods/startAuthentication.js","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/package.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/version.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/broadcast-channel.mjs","../../../../../node_modules/.bun/nanostores@1.5.5/node_modules/nanostores/atom/index.js","../../../../../node_modules/.bun/nanostores@1.5.5/node_modules/nanostores/lifecycle/index.js","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/equality.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/focus-manager.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/online-manager.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/parser.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/query-atom.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/query.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/session-refresh.mjs","../../../../../node_modules/.bun/@better-auth+core@1.7.12+d8c37f950c8f0cf7/node_modules/@better-auth/core/dist/env/env-impl.mjs","../../../../../node_modules/.bun/better-call@1.4.4+fff7ddf946fac095/node_modules/better-call/dist/error.mjs","../../../../../node_modules/.bun/@better-auth+core@1.7.12+d8c37f950c8f0cf7/node_modules/@better-auth/core/dist/error/index.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/utils/url.mjs","../../../../../node_modules/.bun/@better-auth+core@1.7.12+d8c37f950c8f0cf7/node_modules/@better-auth/core/dist/utils/url.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/fetch-plugins.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/session-atom.mjs","../../../../../node_modules/.bun/defu@6.1.7/node_modules/defu/dist/defu.mjs","../../../../../node_modules/.bun/@better-fetch+fetch@1.3.2/node_modules/@better-fetch/fetch/dist/index.js","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/config.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/utils/is-atom.mjs","../../../../../node_modules/.bun/@better-auth+core@1.7.12+d8c37f950c8f0cf7/node_modules/@better-auth/core/dist/utils/string.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/proxy.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/vanilla.mjs","../../../../../node_modules/.bun/@better-auth+passkey@1.7.12+8eaedbcd779c7282/node_modules/@better-auth/passkey/dist/client.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/plugins/email-otp/error-codes.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/plugins/email-otp/client.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/plugins/jwt/client.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/plugins/two-factor/error-code.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/plugins/two-factor/client.mjs","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/timeoutManager.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/utils.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/environmentManager.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/subscribable.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/focusManager.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/hydration.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/notifyManager.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/onlineManager.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/retryer.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/removable.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/query.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/queryObserver.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/mutation.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/mutationCache.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/mutationObserver.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/queriesObserver.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/queryCache.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/queryClient.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/suspense.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/useQueries.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/useQuery.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/useIsFetching.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/useMutation.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.js","../../../../../node_modules/.bun/uqr@0.1.3/node_modules/uqr/dist/index.mjs","../../../../../node_modules/.bun/thumbhash@0.1.1/node_modules/thumbhash/thumbhash.js"],"sourcesContent":["//#region src/shared/diagnostic.ts\nconst diagnostic = (code, message, hint, span) => ({\n\tcode,\n\tmessage,\n\thint,\n\tspan\n});\n//#endregion\n//#region src/shared/suggest.ts\nconst distance = (a, b) => {\n\tlet row = Array.from({ length: b.length + 1 }, (_, i) => i);\n\tfor (let i = 1; i <= a.length; i++) {\n\t\tconst next = [i];\n\t\tfor (let j = 1; j <= b.length; j++) {\n\t\t\tconst cost = a[i - 1] === b[j - 1] ? 0 : 1;\n\t\t\tnext[j] = Math.min(row[j] + 1, next[j - 1] + 1, row[j - 1] + cost);\n\t\t}\n\t\trow = next;\n\t}\n\treturn row[b.length];\n};\n/** The closest candidate to `name`, if any is close enough to be a likely typo. */\nconst suggest = (name, candidates) => {\n\tconst lower = name.toLowerCase();\n\tconst best = candidates.map((candidate) => ({\n\t\tcandidate,\n\t\tscore: distance(lower, candidate.toLowerCase())\n\t})).sort((a, b) => a.score - b.score)[0];\n\treturn best && best.score <= Math.max(2, Math.floor(name.length / 3)) ? best.candidate : void 0;\n};\n//#endregion\nexport { diagnostic as n, suggest as t };\n","import { n as diagnostic, t as suggest } from \"./suggest-DaQ79xMY.js\";\n//#region src/filter/errors.ts\nvar FilterSyntaxError = class extends Error {\n\terrors;\n\tconstructor(errors) {\n\t\tsuper(errors[0].message);\n\t\tthis.errors = errors;\n\t}\n};\n//#endregion\n//#region src/shared/span.ts\nconst joinSpans = (a, b) => ({\n\tstart: a.start,\n\tend: b.end\n});\n/** 1-based line and column of an offset, for editors and error messages. */\nconst lineColumn = (source, offset) => {\n\tconst before = source.slice(0, offset);\n\treturn {\n\t\tline: before.split(\"\\n\").length,\n\t\tcolumn: offset - (before.lastIndexOf(\"\\n\") + 1) + 1\n\t};\n};\n//#endregion\n//#region src/filter/datetime.ts\nconst daysIn = (year, month) => {\n\tif (month === 2) return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0) ? 29 : 28;\n\treturn [\n\t\t4,\n\t\t6,\n\t\t9,\n\t\t11\n\t].includes(month) ? 30 : 31;\n};\nconst isValidDate = (text) => {\n\tconst match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(text);\n\tif (!match) return false;\n\tconst [year, month, day] = [\n\t\tNumber(match[1]),\n\t\tNumber(match[2]),\n\t\tNumber(match[3])\n\t];\n\treturn month >= 1 && month <= 12 && day >= 1 && day <= daysIn(year, month);\n};\nconst isValidTimestamp = (text) => {\n\tconst match = /^(\\d{4}-\\d{2}-\\d{2})[Tt](\\d{2}):(\\d{2}):(\\d{2})(?:\\.\\d+)?(?:[Zz]|[+-](\\d{2}):(\\d{2}))$/.exec(text);\n\tif (!match) return false;\n\tconst [hour, minute, second] = [\n\t\tNumber(match[2]),\n\t\tNumber(match[3]),\n\t\tNumber(match[4])\n\t];\n\tconst [offsetHour, offsetMinute] = [Number(match[5] ?? 0), Number(match[6] ?? 0)];\n\treturn isValidDate(match[1]) && hour <= 23 && minute <= 59 && second <= 59 && offsetHour <= 23 && offsetMinute <= 59;\n};\nconst unitSeconds = {\n\ts: 1,\n\tm: 60,\n\th: 3600,\n\td: 86400,\n\tw: 604800\n};\n/** Milliseconds since the epoch, or undefined when the text is not a valid RFC-3339 timestamp. */\nconst timestampMillis = (text) => isValidTimestamp(text) ? Date.parse(text.toUpperCase()) : void 0;\nconst durationText = /^(\\d+(?:\\.\\d+)?)(s|m|h|d|w)$/;\n/** Seconds for texts like `30s` or `1.5h` (units beyond `s` are an extension). */\nconst durationSeconds = (text) => {\n\tconst match = durationText.exec(text);\n\treturn match ? Number(match[1]) * unitSeconds[match[2]] : void 0;\n};\n//#endregion\n//#region src/filter/lexer/number.ts\nconst timestampShape = /\\d{4}-\\d{2}-\\d{2}[Tt]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:[Zz]|[+-]\\d{2}:\\d{2})/y;\nconst dateShape = /\\d{4}-\\d{2}-\\d{2}/y;\nconst dateTail = /[TtZz0-9:.+-]*/y;\nconst hexShape = /0[xX][0-9a-fA-F]+/y;\nconst numberShape = /\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?/y;\nconst match = (shape, source, at) => {\n\tshape.lastIndex = at;\n\treturn shape.exec(source)?.[0];\n};\n/**\n* Scans a token that starts with a digit. Returns undefined when the digits are just the\n* start of ordinary text (for example `3rd` or `30d` without the durationUnits extension).\n*/\nconst scanNumeric = (source, start, isDelimiter, extensions) => {\n\tconst timestamp = match(timestampShape, source, start);\n\tif (timestamp && isValidTimestamp(timestamp)) return {\n\t\tkind: \"timestamp\",\n\t\tend: start + timestamp.length\n\t};\n\tif (timestamp || match(dateShape, source, start)) {\n\t\tconst end = start + (match(dateTail, source, start) ?? \"\").length;\n\t\treturn {\n\t\t\tkind: \"error\",\n\t\t\tend,\n\t\t\terror: diagnostic(\"invalid-timestamp\", `\"${source.slice(start, end)}\" is not a valid RFC-3339 timestamp`, \"Use a full timestamp like 2012-04-21T11:30:00Z, or quote a plain date: \\\"2012-04-21\\\"\", {\n\t\t\t\tstart,\n\t\t\t\tend\n\t\t\t})\n\t\t};\n\t}\n\tconst hex = match(hexShape, source, start);\n\tif (hex) return isDelimiter(source[start + hex.length]) ? {\n\t\tkind: \"number\",\n\t\tend: start + hex.length\n\t} : void 0;\n\tconst end = start + match(numberShape, source, start).length;\n\tif ((extensions.durationUnits ? \"smhdw\" : \"s\").includes(source[end] ?? \" \") && isDelimiter(source[end + 1])) return {\n\t\tkind: \"duration\",\n\t\tend: end + 1\n\t};\n\treturn isDelimiter(source[end]) ? {\n\t\tkind: \"number\",\n\t\tend\n\t} : void 0;\n};\n//#endregion\n//#region src/filter/lexer/string.ts\nconst simple = {\n\ta: \"\\x07\",\n\tb: \"\\b\",\n\tf: \"\\f\",\n\tn: \"\\n\",\n\tr: \"\\r\",\n\tt: \"\t\",\n\tv: \"\\v\",\n\t\"'\": \"'\",\n\t\"\\\"\": \"\\\"\",\n\t\"\\\\\": \"\\\\\",\n\t\"?\": \"?\",\n\t\"`\": \"`\"\n};\nconst hexDigits = (source, from, length) => {\n\tconst text = source.slice(from, from + length);\n\treturn text.length === length && /^[0-9a-fA-F]+$/.test(text) ? parseInt(text, 16) : void 0;\n};\nconst escape = (source, at) => {\n\tconst char = source[at + 1];\n\tif (char === void 0) return {\n\t\terror: \"a backslash at the end\",\n\t\tend: at + 1\n\t};\n\tif (Object.hasOwn(simple, char)) return {\n\t\ttext: simple[char],\n\t\tend: at + 2\n\t};\n\tconst lengths = {\n\t\tx: 2,\n\t\tu: 4,\n\t\tU: 8\n\t};\n\tif (Object.hasOwn(lengths, char)) {\n\t\tconst code = hexDigits(source, at + 2, lengths[char]);\n\t\tconst end = at + 2 + lengths[char];\n\t\treturn code !== void 0 && code <= 1114111 && !(code >= 55296 && code <= 57343) ? {\n\t\t\ttext: String.fromCodePoint(code),\n\t\t\tend\n\t\t} : {\n\t\t\terror: `\\\\${char} needs ${lengths[char]} hex digits naming a Unicode scalar value`,\n\t\t\tend: at + 2\n\t\t};\n\t}\n\tconst octal = /^[0-3][0-7]{2}/.exec(source.slice(at + 1, at + 4));\n\tif (octal) return {\n\t\ttext: String.fromCharCode(parseInt(octal[0], 8)),\n\t\tend: at + 4\n\t};\n\treturn {\n\t\terror: `the escape \"\\\\${char}\"`,\n\t\tend: at + 2\n\t};\n};\nconst scanString = (source, start) => {\n\tconst quote = source[start];\n\tconst errors = [];\n\tlet value = \"\";\n\tlet i = start + 1;\n\twhile (i < source.length) {\n\t\tconst char = source[i];\n\t\tif (char === quote) return {\n\t\t\tend: i + 1,\n\t\t\tvalue,\n\t\t\terrors\n\t\t};\n\t\tif (char !== \"\\\\\") {\n\t\t\tvalue += char;\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tconst result = escape(source, i);\n\t\tif (\"text\" in result) value += result.text;\n\t\telse errors.push(diagnostic(\"invalid-escape\", `Invalid escape: ${result.error}`, \"Valid escapes: \\\\a \\\\b \\\\f \\\\n \\\\r \\\\t \\\\v \\\\' \\\\\\\" \\\\\\\\ \\\\? \\\\` \\\\xHH \\\\uXXXX \\\\UXXXXXXXX \\\\ooo\", {\n\t\t\tstart: i,\n\t\t\tend: result.end\n\t\t}));\n\t\ti = result.end;\n\t}\n\terrors.push(diagnostic(\"unterminated-string\", \"String is missing its closing quote\", `Add a closing ${quote}`, {\n\t\tstart,\n\t\tend: source.length\n\t}));\n\treturn {\n\t\tend: source.length,\n\t\tvalue: void 0,\n\t\terrors\n\t};\n};\n//#endregion\n//#region src/filter/lexer/lexer.ts\nconst punctuation = {\n\t\"(\": \"lparen\",\n\t\")\": \"rparen\",\n\t\",\": \"comma\",\n\t\".\": \"dot\",\n\t\":\": \"has\",\n\t\"=\": \"eq\",\n\t\"<\": \"lt\",\n\t\">\": \"gt\",\n\t\"-\": \"minus\"\n};\nconst keywords = {\n\tAND: \"and\",\n\tOR: \"or\",\n\tNOT: \"not\"\n};\nconst afterNow = (tokens) => {\n\tconst [rparen, lparen, name] = [\n\t\ttokens.at(-1),\n\t\ttokens.at(-2),\n\t\ttokens.at(-3)\n\t];\n\treturn rparen?.kind === \"rparen\" && lparen?.kind === \"lparen\" && name?.text === \"now\";\n};\nconst lex = (source, extensions = {}) => {\n\tconst tokens = [];\n\tconst errors = [];\n\tconst special = (char) => char !== void 0 && (char in punctuation || char === \"!\" || extensions.arithmetic === true && char === \"+\");\n\tconst isDelimiter = (char) => char === void 0 || /\\s/.test(char) || special(char) || char === \"\\\"\" || char === \"'\";\n\tconst push = (kind, start, end, value = source.slice(start, end)) => tokens.push({\n\t\tkind,\n\t\ttext: source.slice(start, end),\n\t\tvalue,\n\t\tspan: {\n\t\t\tstart,\n\t\t\tend\n\t\t}\n\t});\n\tconst surrogate = source.isWellFormed() ? -1 : source.search(/[\\ud800-\\udbff](?![\\udc00-\\udfff])|(?<![\\ud800-\\udbff])[\\udc00-\\udfff]/);\n\tif (surrogate >= 0) errors.push(diagnostic(\"invalid-unicode\", \"The filter contains an unpaired surrogate\", \"Use well-formed UTF-16 text\", {\n\t\tstart: surrogate,\n\t\tend: surrogate + 1\n\t}));\n\tlet i = 0;\n\twhile (i < source.length) {\n\t\tconst char = source[i];\n\t\tif (/\\s/.test(char)) {\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === \"\\\"\" || char === \"'\") {\n\t\t\tconst scan = scanString(source, i);\n\t\t\terrors.push(...scan.errors);\n\t\t\tif (scan.value !== void 0) push(\"string\", i, scan.end, scan.value);\n\t\t\ti = scan.end;\n\t\t\tcontinue;\n\t\t}\n\t\tif (/[0-9]/.test(char)) {\n\t\t\tconst scan = scanNumeric(source, i, isDelimiter, extensions);\n\t\t\tif (scan?.kind === \"error\") errors.push(scan.error);\n\t\t\telse if (scan) push(scan.kind, i, scan.end);\n\t\t\tif (scan) {\n\t\t\t\ti = scan.end;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tif (char === \"!\" || char === \"<\" || char === \">\") {\n\t\t\tconst twoChars = source[i + 1] === \"=\";\n\t\t\tif (char === \"!\" && !twoChars) {\n\t\t\t\terrors.push(diagnostic(\"unexpected-character\", \"Unexpected character \\\"!\\\"\", \"Use != for \\\"not equal\\\" or NOT / - for negation\", {\n\t\t\t\t\tstart: i,\n\t\t\t\t\tend: i + 1\n\t\t\t\t}));\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tpush(char === \"!\" ? \"ne\" : char === \"<\" ? twoChars ? \"le\" : \"lt\" : twoChars ? \"ge\" : \"gt\", i, i + (twoChars ? 2 : 1));\n\t\t\ti += twoChars ? 2 : 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (Object.hasOwn(punctuation, char)) {\n\t\t\tpush(punctuation[char], i, i + 1);\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tconst offsetPlus = extensions.arithmetic === \"now-offset\" && afterNow(tokens);\n\t\tif (char === \"+\" && (extensions.arithmetic === true || offsetPlus)) {\n\t\t\tpush(\"plus\", i, i + 1);\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tlet end = i + 1;\n\t\twhile (!isDelimiter(source[end])) end++;\n\t\tconst text = source.slice(i, end);\n\t\tpush(Object.hasOwn(keywords, text) ? keywords[text] : \"text\", i, end);\n\t\ti = end;\n\t}\n\tpush(\"eof\", source.length, source.length);\n\treturn {\n\t\ttokens,\n\t\terrors\n\t};\n};\n//#endregion\n//#region src/filter/parser/cursor.ts\nvar ParseAbort = class extends Error {\n\terror;\n\tconstructor(error) {\n\t\tsuper(error.message);\n\t\tthis.error = error;\n\t}\n};\nconst abort = (code, message, hint, span) => {\n\tthrow new ParseAbort(diagnostic(code, message, hint, span));\n};\nconst peek = (c, offset = 0) => c.tokens[Math.min(c.pos + offset, c.tokens.length - 1)];\nconst next = (c) => {\n\tconst token = peek(c);\n\tif (token.kind !== \"eof\") c.pos++;\n\treturn token;\n};\nconst eat = (c, kind) => peek(c).kind === kind ? next(c) : void 0;\nconst describe = (token) => token.kind === \"eof\" ? \"end of input\" : `\"${token.text}\"`;\nconst expect = (c, kind, what, hint) => eat(c, kind) ?? abort(\"expected-token\", `Expected ${what} but found ${describe(peek(c))}`, hint, peek(c).span);\nconst withDepth = (c, span, run) => {\n\tif (c.depth >= c.maxDepth) abort(\"too-deep\", \"The filter is nested too deeply\", `Nest at most ${c.maxDepth} levels`, span);\n\tc.depth++;\n\ttry {\n\t\treturn run();\n\t} finally {\n\t\tc.depth--;\n\t}\n};\nconst segmentKinds = [\n\t\"text\",\n\t\"and\",\n\t\"or\",\n\t\"not\"\n];\nconst parseMember = (c) => {\n\tconst first = expect(c, \"text\", \"a field name or value\", \"Text may not contain spaces or the characters ( ) - . = : < > ! ,\");\n\tconst path = [first.text];\n\tlet span = first.span;\n\tfor (;;) {\n\t\tif (peek(c).kind !== \"dot\") break;\n\t\tconst part = peek(c, 1);\n\t\tconst isIndex = part.kind === \"number\" && /^\\d+(\\.\\d+)?$/.test(part.text);\n\t\tif (!segmentKinds.includes(part.kind) && !isIndex) abort(\"expected-token\", `Expected a field name after \".\" but found ${describe(part)}`, \"Write traversals like customer.country\", part.span);\n\t\tnext(c);\n\t\tnext(c);\n\t\tpath.push(...isIndex ? part.text.split(\".\") : [part.text]);\n\t\tspan = joinSpans(span, part.span);\n\t}\n\treturn {\n\t\tkind: \"member\",\n\t\tpath,\n\t\tspan\n\t};\n};\n//#endregion\n//#region src/filter/parser/duration.ts\nconst durationFrom = (token) => ({\n\tkind: \"duration\",\n\tamount: Number(token.text.slice(0, -1)),\n\tunit: token.text.slice(-1),\n\tspan: token.span\n});\n//#endregion\n//#region src/filter/parser/operand.ts\nconst operandKinds$1 = [\n\t\"member\",\n\t\"string\",\n\t\"number\",\n\t\"boolean\",\n\t\"duration\",\n\t\"timestamp\",\n\t\"call\",\n\t\"binary\"\n];\nconst isOperand$1 = (node) => operandKinds$1.includes(node.kind);\nconst parseCall = (c, name, start) => withDepth(c, start, () => {\n\tnext(c);\n\tconst args = [];\n\tif (peek(c).kind !== \"rparen\") do\n\t\targs.push(parseArg(c));\n\twhile (eat(c, \"comma\"));\n\tconst close = expect(c, \"rparen\", \"\\\")\\\"\", `Close the call to ${name}() with \")\"`);\n\treturn {\n\t\tkind: \"call\",\n\t\tname,\n\t\targs,\n\t\tspan: joinSpans(start, close.span)\n\t};\n});\n/** A single value, member or function call; arithmetic and groups are handled by parseArg. */\nconst parseOperand = (c) => {\n\tconst token = peek(c);\n\tswitch (token.kind) {\n\t\tcase \"string\":\n\t\t\tnext(c);\n\t\t\treturn {\n\t\t\t\tkind: \"string\",\n\t\t\t\tvalue: token.value,\n\t\t\t\tspan: token.span\n\t\t\t};\n\t\tcase \"number\":\n\t\t\tnext(c);\n\t\t\treturn {\n\t\t\t\tkind: \"number\",\n\t\t\t\tvalue: Number(token.text),\n\t\t\t\traw: token.text,\n\t\t\t\tspan: token.span\n\t\t\t};\n\t\tcase \"duration\":\n\t\t\tnext(c);\n\t\t\treturn durationFrom(token);\n\t\tcase \"timestamp\":\n\t\t\tnext(c);\n\t\t\treturn {\n\t\t\t\tkind: \"timestamp\",\n\t\t\t\tvalue: token.text,\n\t\t\t\tspan: token.span\n\t\t\t};\n\t\tcase \"minus\": {\n\t\t\tconst number = peek(c, 1);\n\t\t\tif (number.kind !== \"number\" || number.span.start !== token.span.end) abort(\"unexpected-token\", `Expected a number after \"-\" but found ${describe(number)}`, \"Write negative numbers as -5, without a space\", number.span);\n\t\t\tnext(c);\n\t\t\tnext(c);\n\t\t\tconst raw = `-${number.text}`;\n\t\t\treturn {\n\t\t\t\tkind: \"number\",\n\t\t\t\tvalue: -Number(number.text),\n\t\t\t\traw,\n\t\t\t\tspan: joinSpans(token.span, number.span)\n\t\t\t};\n\t\t}\n\t\tcase \"text\": {\n\t\t\tif ((token.text === \"true\" || token.text === \"false\") && peek(c, 1).kind !== \"dot\" && !(peek(c, 1).kind === \"lparen\" && peek(c, 1).span.start === token.span.end)) {\n\t\t\t\tnext(c);\n\t\t\t\treturn {\n\t\t\t\t\tkind: \"boolean\",\n\t\t\t\t\tvalue: token.text === \"true\",\n\t\t\t\t\tspan: token.span\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst member = parseMember(c);\n\t\t\treturn peek(c).kind === \"lparen\" && peek(c).span.start === member.span.end ? parseCall(c, member.path.join(\".\"), member.span) : member;\n\t\t}\n\t\tdefault: return abort(\"unexpected-token\", `Expected a value but found ${describe(token)}`, \"Values are text, \\\"strings\\\", numbers, true/false, durations, timestamps or function calls\", token.span);\n\t}\n};\nconst composite = (c) => {\n\tconst open = next(c);\n\treturn withDepth(c, open.span, () => {\n\t\tconst inner = c.expression(c);\n\t\texpect(c, \"rparen\", \"\\\")\\\"\", \"Close the group opened here\");\n\t\tif (!inner) return abort(\"unexpected-token\", \"Empty group\", \"Put an expression inside the parentheses\", open.span);\n\t\treturn inner.kind === \"global\" ? inner.value : inner;\n\t});\n};\nconst primary = (c) => peek(c).kind === \"lparen\" ? composite(c) : parseOperand(c);\nconst startsOperand = (c) => [\n\t\"text\",\n\t\"string\",\n\t\"number\",\n\t\"duration\",\n\t\"timestamp\",\n\t\"lparen\",\n\t\"minus\"\n].includes(peek(c, 1).kind);\nconst parseArg = (c) => {\n\tconst first = primary(c);\n\tif (!c.extensions.arithmetic || !isOperand$1(first)) return first;\n\tlet left = first;\n\tconst nowOffset = c.extensions.arithmetic === \"now-offset\";\n\tconst isNow = () => left.kind === \"call\" && left.name === \"now\" && left.args.length === 0;\n\tconst allowed = () => !nowOffset || isNow() && peek(c, 1).kind === \"duration\";\n\tif (nowOffset && isNow() && (peek(c).kind === \"plus\" || peek(c).kind === \"minus\") && peek(c, 1).kind !== \"duration\") return abort(\"expected-token\", `Expected a duration after \"${peek(c).text}\" but found ${describe(peek(c, 1))}`, \"Durations need a unit, for example now() - 30d\", peek(c, 1).span);\n\twhile ((peek(c).kind === \"plus\" || peek(c).kind === \"minus\") && startsOperand(c) && allowed()) {\n\t\tconst op = next(c).kind === \"plus\" ? \"+\" : \"-\";\n\t\tconst right = primary(c);\n\t\tif (!isOperand$1(right)) return abort(\"unexpected-token\", \"Arithmetic needs values, not conditions\", \"Use values on both sides of + and -\", right.span);\n\t\tleft = {\n\t\t\tkind: \"binary\",\n\t\t\top,\n\t\t\tleft,\n\t\t\tright,\n\t\t\tspan: joinSpans(left.span, right.span)\n\t\t};\n\t}\n\treturn left;\n};\nconst parseRight = (c) => {\n\tconst start = peek(c);\n\tconst arg = parseArg(c);\n\tif (!isOperand$1(arg)) abort(\"unexpected-token\", \"A comparison needs a value on the right\", \"Write field = value\", start.span);\n\treturn arg;\n};\n//#endregion\n//#region src/filter/parser/expression.ts\nconst comparators = {\n\teq: \"=\",\n\tne: \"!=\",\n\tlt: \"<\",\n\tle: \"<=\",\n\tgt: \">\",\n\tge: \">=\"\n};\nconst termStarts = [\n\t\"text\",\n\t\"string\",\n\t\"number\",\n\t\"duration\",\n\t\"timestamp\",\n\t\"not\",\n\t\"minus\",\n\t\"lparen\"\n];\nconst group = (kind, items) => {\n\tconst args = items.filter((item) => item !== void 0);\n\tif (args.length <= 1) return args[0];\n\treturn {\n\t\tkind,\n\t\targs,\n\t\tspan: joinSpans(args[0].span, args[args.length - 1].span)\n\t};\n};\nconst sync = (c) => {\n\tlet depth = 0;\n\tfor (;;) {\n\t\tconst { kind } = peek(c);\n\t\tif (kind === \"eof\") return;\n\t\tif (depth === 0 && (kind === \"and\" || kind === \"or\" || kind === \"rparen\")) return;\n\t\tif (kind === \"lparen\") depth++;\n\t\tif (kind === \"rparen\") depth--;\n\t\tnext(c);\n\t}\n};\nconst parseRestriction = (c) => {\n\tconst left = parseOperand(c);\n\tconst token = peek(c);\n\tif (token.kind === \"has\") {\n\t\tnext(c);\n\t\tconst star = peek(c);\n\t\tif (star.kind === \"text\" && star.text === \"*\") {\n\t\t\tnext(c);\n\t\t\treturn {\n\t\t\t\tkind: \"present\",\n\t\t\t\tleft,\n\t\t\t\tspan: joinSpans(left.span, star.span)\n\t\t\t};\n\t\t}\n\t\tconst right = parseRight(c);\n\t\treturn {\n\t\t\tkind: \"has\",\n\t\t\tleft,\n\t\t\tright,\n\t\t\tspan: joinSpans(left.span, right.span)\n\t\t};\n\t}\n\tconst op = comparators[token.kind];\n\tif (op) {\n\t\tnext(c);\n\t\tconst right = parseRight(c);\n\t\treturn {\n\t\t\tkind: \"compare\",\n\t\t\top,\n\t\t\tleft,\n\t\t\tright,\n\t\t\tspan: joinSpans(left.span, right.span)\n\t\t};\n\t}\n\treturn left.kind === \"call\" ? left : {\n\t\tkind: \"global\",\n\t\tvalue: left,\n\t\tspan: left.span\n\t};\n};\nconst parseSimple = (c) => {\n\tconst open = peek(c);\n\tif (open.kind !== \"lparen\") return parseRestriction(c);\n\tnext(c);\n\treturn withDepth(c, open.span, () => {\n\t\tconst inner = parseExpression(c);\n\t\tif (!eat(c, \"rparen\")) c.errors.push(diagnostic(\"expected-token\", `Expected \")\" but found ${describe(peek(c))}`, \"Close the group opened here\", open.span));\n\t\treturn inner;\n\t});\n};\nconst parseTerm = (c) => {\n\tconst token = peek(c);\n\tif (token.kind !== \"not\" && token.kind !== \"minus\") {\n\t\tif (!termStarts.includes(token.kind)) return abort(\"unexpected-token\", `Unexpected ${describe(token)}`, \"Expected a field, a value or \\\"(\\\"\", token.span);\n\t\treturn withDepth(c, token.span, () => parseSimple(c));\n\t}\n\tnext(c);\n\tconst following = peek(c);\n\tconst negativeNumber = following.kind === \"minus\" && peek(c, 1).kind === \"number\" && peek(c, 1).span.start === following.span.end;\n\tif (following.kind === \"not\" || following.kind === \"minus\" && !negativeNumber) abort(\"unexpected-token\", \"Negations cannot be stacked\", \"Group the inner one: NOT (NOT a)\", following.span);\n\tconst arg = withDepth(c, token.span, () => parseSimple(c));\n\tif (!arg) return void 0;\n\tconst span = joinSpans(token.span, arg.span);\n\tif (token.kind === \"minus\" && arg.kind === \"global\" && arg.value.kind === \"number\" && !arg.value.raw.startsWith(\"-\")) {\n\t\tconst { raw, value } = arg.value;\n\t\treturn {\n\t\t\tkind: \"global\",\n\t\t\tvalue: {\n\t\t\t\tkind: \"number\",\n\t\t\t\tvalue: -value,\n\t\t\t\traw: `-${raw}`,\n\t\t\t\tspan\n\t\t\t},\n\t\t\tspan\n\t\t};\n\t}\n\treturn {\n\t\tkind: \"not\",\n\t\targ,\n\t\tspan\n\t};\n};\nconst parseTermRecovering = (c) => {\n\ttry {\n\t\treturn parseTerm(c);\n\t} catch (error) {\n\t\tif (!(error instanceof ParseAbort)) throw error;\n\t\tc.errors.push(error.error);\n\t\tsync(c);\n\t\treturn;\n\t}\n};\nconst parseFactor = (c) => {\n\tconst items = [parseTermRecovering(c)];\n\twhile (eat(c, \"or\")) items.push(parseTermRecovering(c));\n\treturn group(\"or\", items);\n};\nconst parseSequence = (c) => {\n\tconst items = [parseFactor(c)];\n\twhile (termStarts.includes(peek(c).kind)) items.push(parseFactor(c));\n\treturn group(\"sequence\", items);\n};\nconst parseExpression = (c) => {\n\tconst items = [parseSequence(c)];\n\twhile (eat(c, \"and\")) items.push(parseSequence(c));\n\treturn group(\"and\", items);\n};\n//#endregion\n//#region src/filter/parser/parse.ts\nconst parseFilter = (source, options = {}) => {\n\tconst maxLength = options.maxLength ?? 1e4;\n\tif (source.length > maxLength) return {\n\t\tok: false,\n\t\tast: void 0,\n\t\terrors: [diagnostic(\"too-long\", `The filter is longer than ${maxLength} characters`, \"Shorten the filter\", {\n\t\t\tstart: maxLength,\n\t\t\tend: source.length\n\t\t})]\n\t};\n\tconst extensions = options.extensions ?? {};\n\tconst lexed = lex(source, extensions);\n\tconst c = {\n\t\ttokens: lexed.tokens,\n\t\tpos: 0,\n\t\terrors: lexed.errors,\n\t\tdepth: 0,\n\t\tmaxDepth: options.maxDepth ?? 64,\n\t\textensions,\n\t\texpression: parseExpression\n\t};\n\tconst parts = [];\n\twhile (peek(c).kind !== \"eof\") {\n\t\tif (peek(c).kind === \"rparen\") {\n\t\t\tconst stray = next(c);\n\t\t\tc.errors.push(diagnostic(\"unexpected-token\", \"Unmatched \\\")\\\"\", \"Remove it or add a matching \\\"(\\\"\", stray.span));\n\t\t\tcontinue;\n\t\t}\n\t\tparts.push(parseExpression(c));\n\t}\n\tconst defined = parts.filter((part) => part !== void 0);\n\tconst ast = defined.length <= 1 ? defined[0] : {\n\t\tkind: \"and\",\n\t\targs: defined,\n\t\tspan: {\n\t\t\tstart: defined[0].span.start,\n\t\t\tend: defined[defined.length - 1].span.end\n\t\t}\n\t};\n\tconst errors = [...c.errors].sort((a, b) => a.span.start - b.span.start);\n\treturn errors.length === 0 ? {\n\t\tok: true,\n\t\tast,\n\t\terrors: []\n\t} : {\n\t\tok: false,\n\t\tast,\n\t\terrors\n\t};\n};\n/** Returns undefined for an empty filter. */\nconst parseFilterOrThrow = (source, options) => {\n\tconst result = parseFilter(source, options);\n\tif (!result.ok) throw new FilterSyntaxError(result.errors);\n\treturn result.ast;\n};\n//#endregion\n//#region src/filter/check/field.ts\nconst findField = (fields, name) => {\n\tif (Object.hasOwn(fields, name)) return {\n\t\tname,\n\t\tspec: fields[name]\n\t};\n\tconst alias = Object.entries(fields).find(([, spec]) => spec.aliases?.includes(name));\n\treturn alias && {\n\t\tname: alias[0],\n\t\tspec: alias[1]\n\t};\n};\n/**\n* Resolves a member against the schema, following message fields and map keys. Aliases are\n* replaced by the real field name in the returned member.\n*/\nconst resolveMember = (ctx, member) => {\n\tconst head = member.path[0];\n\tconst found = findField(ctx.schema.fields, head);\n\tif (!found) {\n\t\tconst usable = Object.entries(ctx.schema.fields).filter(([, s]) => s.filterable !== false).map(([name]) => name);\n\t\tconst close = suggest(head, usable);\n\t\tctx.errors.push(diagnostic(\"unknown-field\", `Unknown field \"${head}\"`, close ? `Did you mean \"${close}\"?` : `Available fields: ${usable.join(\", \")}`, member.span));\n\t\treturn;\n\t}\n\tconst path = [found.name];\n\tlet spec = found.spec;\n\tlet filterable = spec.filterable !== false;\n\tfor (const segment of member.path.slice(1)) {\n\t\tconst inner = spec.type === \"message\" ? spec.fields?.[segment] : spec.type === \"map\" ? spec.value : spec.type === \"any\" ? spec : void 0;\n\t\tif (!inner || spec.type === \"message\" && !Object.hasOwn(spec.fields ?? {}, segment)) {\n\t\t\tctx.errors.push(diagnostic(\"invalid-traversal\", `Cannot traverse into \"${segment}\" of \"${path.join(\".\")}\"`, spec.type === \"message\" ? `Available fields: ${Object.keys(spec.fields ?? {}).join(\", \")}` : \"Only message, map and any fields can be traversed\", member.span));\n\t\t\treturn;\n\t\t}\n\t\tpath.push(segment);\n\t\tspec = inner;\n\t\tfilterable &&= spec.filterable !== false;\n\t}\n\tif (!filterable) {\n\t\tctx.errors.push(diagnostic(\"not-filterable\", `Field \"${path.join(\".\")}\" cannot be filtered on`, \"Mark it filterable in the schema\", member.span));\n\t\treturn;\n\t}\n\treturn {\n\t\t...member,\n\t\tpath,\n\t\tfield: {\n\t\t\tname: path.join(\".\"),\n\t\t\tspec\n\t\t}\n\t};\n};\n//#endregion\n//#region src/filter/check/value.ts\nconst problem = (message, hint) => ({\n\tmessage,\n\thint\n});\nconst expected = (what, hint) => problem(`Expected ${what}`, hint);\nconst textOf$1 = (node) => node.kind === \"string\" ? node.value : node.kind === \"member\" ? node.path.join(\".\") : void 0;\nconst numeric = {\n\tinteger: /^-?(\\d+|0[xX][0-9a-fA-F]+)$/,\n\tnumber: /^-?\\d+(\\.\\d+)?([eE][+-]?\\d+)?$|^-?0[xX][0-9a-fA-F]+$/\n};\n/** Whether a value of type `actual` can be compared with a field of type `wanted`. */\nconst compatible = (wanted, actual) => wanted === actual || wanted === \"any\" || actual === \"any\" || [\"integer\", \"number\"].includes(wanted) && [\"integer\", \"number\"].includes(actual);\n/** Checks a literal or text against a type. Calls and arithmetic are checked by their return type. */\nconst checkValue = (type, spec, node) => {\n\tconst text = textOf$1(node);\n\tswitch (type) {\n\t\tcase \"any\": return;\n\t\tcase \"string\": return text !== void 0 ? void 0 : expected(\"a string\", \"Quote text values: \\\"...\\\"\");\n\t\tcase \"enum\":\n\t\t\tif (text !== void 0 && spec?.values?.includes(text)) return void 0;\n\t\t\treturn problem(\"Invalid enum value\", `Allowed values: ${(spec?.values ?? []).join(\", \")}`);\n\t\tcase \"integer\":\n\t\tcase \"number\": {\n\t\t\tconst raw = node.kind === \"number\" ? node.raw : text;\n\t\t\tif (raw !== void 0 && numeric[type].test(raw)) return void 0;\n\t\t\treturn expected(type === \"integer\" ? \"an integer\" : \"a number\", \"Write 42, -1.5 or 2.5e3, or quote a numeric string\");\n\t\t}\n\t\tcase \"boolean\":\n\t\t\tif (node.kind === \"boolean\" || text === \"true\" || text === \"false\") return void 0;\n\t\t\treturn expected(\"true or false\", \"Write true or false\");\n\t\tcase \"timestamp\":\n\t\t\tif (node.kind === \"timestamp\" || text !== void 0 && isValidTimestamp(text)) return void 0;\n\t\t\treturn expected(\"an RFC-3339 timestamp\", \"Use \\\"2012-04-21T11:30:00Z\\\"\");\n\t\tcase \"duration\":\n\t\t\tif (node.kind === \"duration\" || text !== void 0 && durationSeconds(text) !== void 0) return void 0;\n\t\t\treturn expected(\"a duration\", \"Use a number with a unit, for example 20s or 1.5s\");\n\t\tcase \"map\":\n\t\tcase \"message\": return problem(`${type} fields cannot be compared`, \"Compare a nested field, or use field:key\");\n\t}\n};\n//#endregion\n//#region src/filter/check/call.ts\nconst isOperandArg = (arg) => [\n\t\"member\",\n\t\"string\",\n\t\"number\",\n\t\"boolean\",\n\t\"duration\",\n\t\"timestamp\",\n\t\"call\",\n\t\"binary\"\n].includes(arg.kind);\nconst checkArg = (ctx, param, arg, checkOperand) => {\n\tif (!isOperandArg(arg)) {\n\t\tctx.errors.push(diagnostic(\"wrong-argument\", `Argument \"${param.name}\" must be a value`, \"Pass a field, literal or function call\", arg.span));\n\t\treturn;\n\t}\n\tif (param.type === \"field\") {\n\t\tif (arg.kind !== \"member\") {\n\t\t\tctx.errors.push(diagnostic(\"wrong-argument\", `Argument \"${param.name}\" must be a field`, \"Pass a field name without quotes\", arg.span));\n\t\t\treturn;\n\t\t}\n\t\tconst resolved = resolveMember(ctx, arg);\n\t\tif (resolved && param.of && !param.of.includes(resolved.field.spec.type)) {\n\t\t\tctx.errors.push(diagnostic(\"wrong-argument\", `Argument \"${param.name}\" cannot be a ${resolved.field.spec.type} field`, `Accepted field types: ${param.of.join(\", \")}`, arg.span));\n\t\t\treturn;\n\t\t}\n\t\treturn resolved;\n\t}\n\tconst checked = checkOperand(ctx, arg);\n\tif (!checked) return void 0;\n\tif (param.type === \"any\") return checked.node;\n\tconst problem = checked.type && (arg.kind === \"call\" || arg.kind === \"binary\") ? compatible(param.type, checked.type) ? void 0 : {\n\t\tmessage: `Expected ${param.type}`,\n\t\thint: `Argument \"${param.name}\" is ${checked.type}`\n\t} : checkValue(param.type, void 0, checked.node);\n\tif (problem) ctx.errors.push(diagnostic(\"wrong-argument\", problem.message, problem.hint, arg.span));\n\treturn problem ? void 0 : checked.node;\n};\nconst checkCall = (ctx, call, checkOperand) => {\n\tconst functions = ctx.schema.functions ?? {};\n\tif (!Object.hasOwn(functions, call.name)) {\n\t\tconst close = suggest(call.name, Object.keys(functions));\n\t\tctx.errors.push(diagnostic(\"unknown-function\", `Unknown function \"${call.name}\"`, close ? `Did you mean \"${close}\"?` : `Available functions: ${Object.keys(functions).join(\", \") || \"none\"}`, call.span));\n\t\treturn;\n\t}\n\tconst fn = functions[call.name];\n\tconst min = fn.params.length;\n\tif (call.args.length < min || !fn.rest && call.args.length > min) {\n\t\tconst expectedCount = fn.rest ? `at least ${min}` : String(min);\n\t\tctx.errors.push(diagnostic(\"wrong-arity\", `${call.name}() takes ${expectedCount} argument(s) but got ${call.args.length}`, `Usage: ${call.name}(${[...fn.params, ...fn.rest ? [fn.rest] : []].map((p) => p.name).join(\", \")})`, call.span));\n\t\treturn;\n\t}\n\tconst args = call.args.map((arg, i) => checkArg(ctx, fn.params[i] ?? fn.rest, arg, checkOperand));\n\tif (args.some((arg) => arg === void 0)) return void 0;\n\treturn {\n\t\tcall: {\n\t\t\t...call,\n\t\t\targs\n\t\t},\n\t\treturns: fn.returns ?? \"boolean\"\n\t};\n};\n//#endregion\n//#region src/filter/check/operand.ts\nconst arithmetic$1 = (left, right, op) => {\n\tif (left === \"timestamp\" && right === \"duration\") return \"timestamp\";\n\tif (left === \"timestamp\" && right === \"timestamp\" && op === \"-\") return \"duration\";\n\tif (left === \"duration\" && right === \"duration\") return \"duration\";\n\tif ((left === \"integer\" || left === \"number\") && (right === \"integer\" || right === \"number\")) return left === \"integer\" && right === \"integer\" ? \"integer\" : \"number\";\n};\nconst literalTypes = {\n\tnumber: \"number\",\n\tboolean: \"boolean\",\n\tduration: \"duration\",\n\ttimestamp: \"timestamp\"\n};\n/**\n* Checks a value operand (never a field reference): calls are validated against the registry,\n* arithmetic against operand types. Literals and text keep an undefined type until compared.\n*/\nconst checkOperand = (ctx, node) => {\n\tswitch (node.kind) {\n\t\tcase \"call\": {\n\t\t\tconst checked = checkCall(ctx, node, checkOperand);\n\t\t\treturn checked && {\n\t\t\t\tnode: checked.call,\n\t\t\t\ttype: checked.returns\n\t\t\t};\n\t\t}\n\t\tcase \"binary\": {\n\t\t\tconst left = checkOperand(ctx, node.left);\n\t\t\tconst right = checkOperand(ctx, node.right);\n\t\t\tif (!left || !right) return void 0;\n\t\t\tconst type = left.type && right.type ? arithmetic$1(left.type, right.type, node.op) : left.type ?? right.type ?? \"number\";\n\t\t\tif (!type) {\n\t\t\t\tctx.errors.push(diagnostic(\"invalid-value\", `Cannot apply \"${node.op}\" to ${left.type} and ${right.type}`, \"Add a duration to a timestamp, or combine numbers\", node.span));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tnode: {\n\t\t\t\t\t...node,\n\t\t\t\t\tleft: left.node,\n\t\t\t\t\tright: right.node\n\t\t\t\t},\n\t\t\t\ttype\n\t\t\t};\n\t\t}\n\t\tcase \"number\":\n\t\tcase \"boolean\":\n\t\tcase \"duration\":\n\t\tcase \"timestamp\": return {\n\t\t\tnode,\n\t\t\ttype: literalTypes[node.kind]\n\t\t};\n\t\tdefault: return {\n\t\t\tnode,\n\t\t\ttype: void 0\n\t\t};\n\t}\n};\n//#endregion\n//#region src/filter/check/check.ts\nconst ordered = [\n\t\"string\",\n\t\"integer\",\n\t\"number\",\n\t\"timestamp\",\n\t\"duration\",\n\t\"any\"\n];\nconst checkSubject = (ctx, node) => {\n\tif (node.kind === \"member\") {\n\t\tconst resolved = resolveMember(ctx, node);\n\t\treturn resolved && {\n\t\t\tnode: resolved,\n\t\t\ttype: resolved.field.spec.type,\n\t\t\tspec: resolved.field.spec\n\t\t};\n\t}\n\tconst checked = checkOperand(ctx, node);\n\treturn checked && {\n\t\t...checked,\n\t\tspec: void 0\n\t};\n};\nconst operatorError = (ctx, message, hint, node) => {\n\tctx.errors.push(diagnostic(\"operator-not-allowed\", message, hint, node.span));\n};\nconst checkRight = (ctx, subject, node) => {\n\tif (!subject.type) return checkOperand(ctx, node)?.node;\n\tconst checked = checkOperand(ctx, node);\n\tif (!checked) return void 0;\n\tconst problem = checked.type && (node.kind === \"call\" || node.kind === \"binary\") ? compatible(subject.type, checked.type) ? void 0 : {\n\t\tmessage: `Expected ${subject.type} but got ${checked.type}`,\n\t\thint: \"Compare values of the same type\"\n\t} : checkValue(subject.type, subject.spec, checked.node);\n\tif (problem) ctx.errors.push(diagnostic(\"invalid-value\", problem.message, problem.hint, node.span));\n\treturn problem ? void 0 : checked.node;\n};\nconst checkCompare = (ctx, node) => {\n\tconst subject = checkSubject(ctx, node.left);\n\tif (!subject) return void 0;\n\tconst type = subject.type;\n\tif (subject.spec?.repeated) return operatorError(ctx, `\"${node.op}\" is not supported on repeated fields`, \"Use field:value to test membership\", node);\n\tif (type === \"map\" || type === \"message\") return operatorError(ctx, `${type} fields cannot be compared`, \"Use field:key, or compare a nested field\", node);\n\tif (type && ![\"=\", \"!=\"].includes(node.op) && !ordered.includes(type)) return operatorError(ctx, `\"${node.op}\" is not supported for ${type} fields`, \"Supported: = !=\", node);\n\tconst wildcard = (node.op === \"=\" || node.op === \"!=\") && node.right.kind === \"string\" && node.right.value.includes(\"*\");\n\tif (wildcard && type && type !== \"string\" && type !== \"any\") {\n\t\tctx.errors.push(diagnostic(\"wildcard-not-allowed\", `Wildcards are only supported on string fields, not ${type}`, \"Remove the \\\"*\\\"\", node.right.span));\n\t\treturn;\n\t}\n\tconst right = wildcard ? node.right : checkRight(ctx, subject, node.right);\n\treturn right && {\n\t\t...node,\n\t\tleft: subject.node,\n\t\tright\n\t};\n};\nconst checkHas = (ctx, node) => {\n\tconst subject = checkSubject(ctx, node.left);\n\tif (!subject) return void 0;\n\tconst { type, spec } = subject;\n\tconst element = !spec?.repeated && (type === \"map\" || type === \"message\") ? {\n\t\t...subject,\n\t\ttype: \"string\"\n\t} : subject;\n\tconst right = checkRight(ctx, element, node.right);\n\treturn right && {\n\t\t...node,\n\t\tleft: subject.node,\n\t\tright\n\t};\n};\nconst checkExpr = (ctx, node) => {\n\tswitch (node.kind) {\n\t\tcase \"sequence\":\n\t\tcase \"and\":\n\t\tcase \"or\": {\n\t\t\tconst args = node.args.map((arg) => checkExpr(ctx, arg));\n\t\t\treturn args.every((arg) => arg) ? {\n\t\t\t\t...node,\n\t\t\t\targs\n\t\t\t} : void 0;\n\t\t}\n\t\tcase \"not\": {\n\t\t\tconst arg = checkExpr(ctx, node.arg);\n\t\t\treturn arg && {\n\t\t\t\t...node,\n\t\t\t\targ\n\t\t\t};\n\t\t}\n\t\tcase \"compare\": return checkCompare(ctx, node);\n\t\tcase \"has\": return checkHas(ctx, node);\n\t\tcase \"present\": {\n\t\t\tconst subject = checkSubject(ctx, node.left);\n\t\t\treturn subject && {\n\t\t\t\t...node,\n\t\t\t\tleft: subject.node\n\t\t\t};\n\t\t}\n\t\tcase \"global\": return node;\n\t\tcase \"call\": {\n\t\t\tconst checked = checkCall(ctx, node, checkOperand);\n\t\t\tif (checked && checked.returns !== \"boolean\") {\n\t\t\t\tctx.errors.push(diagnostic(\"not-boolean\", `${node.name}() returns ${checked.returns}, not a condition`, \"Compare its result: f(x) > 1\", node.span));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn checked?.call;\n\t\t}\n\t}\n};\n/**\n* Returns the tree with members resolved (`member.field`) and aliases canonicalised, or every\n* error found.\n*/\nconst checkFilter = (ast, schema) => {\n\tconst ctx = {\n\t\tschema,\n\t\terrors: []\n\t};\n\tconst checked = checkExpr(ctx, ast);\n\tif (!checked || ctx.errors.length > 0) return {\n\t\tok: false,\n\t\terrors: [...ctx.errors].sort((a, b) => a.span.start - b.span.start)\n\t};\n\treturn {\n\t\tok: true,\n\t\tast: checked\n\t};\n};\n//#endregion\n//#region src/filter/print/quote.ts\nconst escapes = {\n\t\"\\\\\": \"\\\\\\\\\",\n\t\"\\\"\": \"\\\\\\\"\",\n\t\"\\n\": \"\\\\n\",\n\t\"\\r\": \"\\\\r\",\n\t\"\t\": \"\\\\t\",\n\t\"\\x07\": \"\\\\a\",\n\t\"\\b\": \"\\\\b\",\n\t\"\\f\": \"\\\\f\",\n\t\"\\v\": \"\\\\v\"\n};\n/** Double-quoted string with backslashes, quotes and control characters escaped. */\nconst quote = (value) => {\n\tif (!value.isWellFormed()) throw new Error(\"Strings with unpaired surrogates cannot be printed\");\n\treturn `\"${value.replace(/[\\\\\"\\u0000-\\u001f\\u007f-\\u009f]/g, (char) => escapes[char] ?? `\\\\u${char.charCodeAt(0).toString(16).padStart(4, \"0\")}`)}\"`;\n};\n//#endregion\n//#region src/filter/print/print.ts\nconst literal = (node) => {\n\tswitch (node.kind) {\n\t\tcase \"string\": return quote(node.value);\n\t\tcase \"number\": return node.raw;\n\t\tcase \"boolean\": return String(node.value);\n\t\tcase \"duration\": return `${node.amount}${node.unit}`;\n\t\tcase \"timestamp\": return node.value;\n\t}\n};\nconst isNegative = (node) => node.kind === \"number\" && node.raw.startsWith(\"-\");\nconst printOperand = (node) => {\n\tswitch (node.kind) {\n\t\tcase \"member\": return node.path.join(\".\");\n\t\tcase \"call\": return `${node.name}(${node.args.map(printArg).join(\", \")})`;\n\t\tcase \"binary\":\n\t\t\tif (node.right.kind === \"binary\") throw new Error(\"Arithmetic is left-associative; a binary on the right cannot be printed\");\n\t\t\treturn `${printOperand(node.left)} ${node.op} ${printOperand(node.right)}`;\n\t\tdefault: return literal(node);\n\t}\n};\nconst printArg = (node) => isExpr(node) ? `(${printFilter(node)})` : printOperand(node);\nconst operandKinds = [\n\t\"member\",\n\t\"string\",\n\t\"number\",\n\t\"boolean\",\n\t\"duration\",\n\t\"timestamp\",\n\t\"binary\"\n];\nconst isExpr = (node) => !operandKinds.includes(node.kind) && node.kind !== \"call\";\nconst left = (node) => {\n\tif (isNegative(node)) throw new Error(\"A negative number cannot start a comparison; \\\"-5 = x\\\" parses as a negation\");\n\treturn printOperand(node);\n};\nconst grouped = (parent, node) => {\n\treturn {\n\t\tand: [\"and\", \"or\"],\n\t\tsequence: [\n\t\t\t\"and\",\n\t\t\t\"or\",\n\t\t\t\"sequence\"\n\t\t],\n\t\tor: [\n\t\t\t\"and\",\n\t\t\t\"or\",\n\t\t\t\"sequence\"\n\t\t],\n\t\tnot: [\n\t\t\t\"and\",\n\t\t\t\"or\",\n\t\t\t\"sequence\",\n\t\t\t\"not\"\n\t\t]\n\t}[parent].includes(node.kind) ? `(${printFilter(node)})` : printFilter(node);\n};\n/**\n* Canonical text: AND/OR/NOT keywords (never \"-\"), double-quoted strings, and parentheses\n* around every OR, AND or sequence nested inside another group.\n*/\nconst printFilter = (node) => {\n\tswitch (node.kind) {\n\t\tcase \"and\": return node.args.map((arg) => grouped(\"and\", arg)).join(\" AND \");\n\t\tcase \"or\": return node.args.map((arg) => grouped(\"or\", arg)).join(\" OR \");\n\t\tcase \"sequence\": return node.args.map((arg) => grouped(\"sequence\", arg)).join(\" \");\n\t\tcase \"not\": return `NOT ${grouped(\"not\", node.arg)}`;\n\t\tcase \"compare\": return `${left(node.left)} ${node.op} ${printOperand(node.right)}`;\n\t\tcase \"has\": return `${left(node.left)}:${printOperand(node.right)}`;\n\t\tcase \"present\": return `${left(node.left)}:*`;\n\t\tcase \"global\": return printOperand(node.value);\n\t\tcase \"call\": return printOperand(node);\n\t}\n};\n//#endregion\n//#region src/filter/evaluate/decimal.ts\n/** Exact decimal number, so values beyond double precision compare correctly. */\nvar Decimal = class {\n\tint;\n\tscale;\n\tconstructor(int, scale) {\n\t\tthis.int = int;\n\t\tthis.scale = scale;\n\t}\n\tcompare(other) {\n\t\tconst scale = Math.max(this.scale, other.scale);\n\t\tconst a = this.int * 10n ** BigInt(scale - this.scale);\n\t\tconst b = other.int * 10n ** BigInt(scale - other.scale);\n\t\treturn a < b ? -1 : a > b ? 1 : 0;\n\t}\n\ttoNumber() {\n\t\treturn Number(`${this.int}e-${this.scale}`);\n\t}\n};\nconst plain = /^(-?)(\\d+)(?:\\.(\\d+))?$/;\n/** Parses plain decimal text such as `-12.50`; undefined for exponents, hex and other text. */\nconst parseDecimal = (text) => {\n\tconst match = plain.exec(text);\n\tif (!match) return void 0;\n\tconst fraction = match[3] ?? \"\";\n\treturn new Decimal(BigInt(`${match[1]}${match[2]}${fraction}`), fraction.length);\n};\nconst numericText = /^-?(?:\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?|0[xX][0-9a-fA-F]+)$/;\n/** Double value of a number, decimal or numeric text, including exponent and hex forms. */\nconst doubleOf = (value) => {\n\tif (typeof value === \"number\") return value;\n\tif (typeof value === \"bigint\") return Number(value);\n\tif (value instanceof Decimal) return value.toNumber();\n\tif (typeof value !== \"string\" || !numericText.test(value)) return void 0;\n\treturn value.startsWith(\"-\") ? -Number(value.slice(1)) : Number(value);\n};\nconst decimalOf = (value) => {\n\tif (typeof value === \"bigint\") return new Decimal(value, 0);\n\tif (typeof value === \"number\") return Number.isFinite(value) ? parseDecimal(String(value)) : void 0;\n\tif (typeof value === \"string\") return parseDecimal(value);\n\treturn value instanceof Decimal ? value : void 0;\n};\n//#endregion\n//#region src/filter/evaluate/glob.ts\n/**\n* Whole-string match where each `*` matches any run of characters (including none).\n* Linear scan with backtracking to the last star, so hostile patterns cannot blow up.\n*/\nconst globMatch = (pattern, text) => {\n\tlet p = 0;\n\tlet t = 0;\n\tlet star = -1;\n\tlet resume = 0;\n\twhile (t < text.length) if (p < pattern.length && pattern[p] === \"*\") {\n\t\tstar = p++;\n\t\tresume = t;\n\t} else if (p < pattern.length && pattern[p] === text[t]) {\n\t\tp++;\n\t\tt++;\n\t} else if (star >= 0) {\n\t\tp = star + 1;\n\t\tt = ++resume;\n\t} else return false;\n\twhile (pattern[p] === \"*\") p++;\n\treturn p === pattern.length;\n};\n//#endregion\n//#region src/filter/evaluate/values.ts\nconst isDuration = (value) => typeof value === \"object\" && value !== null && !(value instanceof Date) && !(value instanceof Decimal) && \"seconds\" in value && typeof value.seconds === \"number\";\n/** Evaluated value of a literal; numbers keep full precision when written as plain decimals. */\nconst literalValue = (node) => {\n\tswitch (node.kind) {\n\t\tcase \"string\": return node.value;\n\t\tcase \"number\": return parseDecimal(node.raw) ?? node.value;\n\t\tcase \"boolean\": return node.value;\n\t\tcase \"duration\": return { seconds: node.amount * unitSeconds[node.unit] };\n\t\tcase \"timestamp\": return new Date(timestampMillis(node.value) ?? NaN);\n\t}\n};\nconst secondsOf = (value) => {\n\tif (isDuration(value)) return value.seconds;\n\tif (typeof value === \"number\") return value;\n\treturn typeof value === \"string\" ? durationSeconds(value) : void 0;\n};\nconst millisOf = (value) => {\n\tif (value instanceof Date) return value.getTime();\n\treturn typeof value === \"string\" ? timestampMillis(value) : void 0;\n};\n/** Source-like text of a value, used for search terms and key lookups. */\nconst textOf = (node) => {\n\tswitch (node.kind) {\n\t\tcase \"string\": return node.value;\n\t\tcase \"member\": return node.path.join(\".\");\n\t\tcase \"number\": return node.raw;\n\t\tcase \"boolean\": return String(node.value);\n\t\tcase \"duration\": return `${node.amount}${node.unit}`;\n\t\tcase \"timestamp\": return node.value;\n\t\tdefault: return;\n\t}\n};\n//#endregion\n//#region src/filter/evaluate/compare.ts\nconst verdict = (op, order) => {\n\tswitch (op) {\n\t\tcase \"=\": return order === 0;\n\t\tcase \"!=\": return order !== 0;\n\t\tcase \"<\": return order < 0;\n\t\tcase \"<=\": return order <= 0;\n\t\tcase \">\": return order > 0;\n\t\tcase \">=\": return order >= 0;\n\t}\n};\nconst order = (a, b) => a < b ? -1 : a > b ? 1 : 0;\nconst numbers = (actual, expected) => {\n\tconst a = decimalOf(actual);\n\tconst b = decimalOf(expected);\n\tif (a && b) return a.compare(b);\n\tconst x = doubleOf(actual);\n\tconst y = doubleOf(expected);\n\treturn x === void 0 || y === void 0 || Number.isNaN(x) || Number.isNaN(y) ? void 0 : order(x, y);\n};\nconst againstString = (op, actual, expected) => {\n\tconst wildcard = (op === \"=\" || op === \"!=\") && expected.includes(\"*\");\n\tif (typeof actual === \"string\") return wildcard ? verdict(op, globMatch(expected, actual) ? 0 : 1) : verdict(op, order(actual, expected));\n\tif (typeof actual === \"number\" || typeof actual === \"bigint\") {\n\t\tconst result = numbers(actual, expected);\n\t\treturn result === void 0 ? void 0 : verdict(op, result);\n\t}\n\tif (actual instanceof Date) {\n\t\tconst millis = millisOf(expected);\n\t\treturn millis === void 0 ? void 0 : verdict(op, order(actual.getTime(), millis));\n\t}\n\tif (typeof actual === \"boolean\") return expected === \"true\" || expected === \"false\" ? verdict(op, order(String(actual), expected)) : void 0;\n\tif (isDuration(actual)) {\n\t\tconst seconds = secondsOf(expected);\n\t\treturn seconds === void 0 ? void 0 : verdict(op, order(actual.seconds, seconds));\n\t}\n};\n/**\n* Compares one actual value with the evaluated right-hand value. Incomparable pairs are\n* false for every operator, including `!=`; the caller turns `!=` into NOT(`=`).\n*/\nconst compareValue = (op, actual, expected) => {\n\tif (actual === null || actual === void 0) return false;\n\tif (typeof expected === \"string\") return againstString(op, actual, expected) ?? false;\n\tif (expected instanceof Decimal || typeof expected === \"number\" || typeof expected === \"bigint\") {\n\t\tconst result = numbers(actual, expected);\n\t\treturn result === void 0 ? false : verdict(op, result);\n\t}\n\tif (typeof expected === \"boolean\") {\n\t\tconst value = typeof actual === \"string\" ? actual === \"true\" ? true : actual === \"false\" ? false : void 0 : actual;\n\t\treturn typeof value === \"boolean\" ? verdict(op, order(String(value), String(expected))) : false;\n\t}\n\tif (expected instanceof Date) {\n\t\tconst millis = millisOf(actual);\n\t\treturn millis === void 0 || Number.isNaN(expected.getTime()) ? false : verdict(op, order(millis, expected.getTime()));\n\t}\n\tif (isDuration(expected)) {\n\t\tconst seconds = secondsOf(actual);\n\t\treturn seconds === void 0 ? false : verdict(op, order(seconds, expected.seconds));\n\t}\n\treturn false;\n};\n//#endregion\n//#region src/filter/evaluate/resolve.ts\n/**\n* Values found at a dotted path. Arrays on the way are traversed element-wise, so a path\n* through repeated fields can yield several values; a missing path yields none.\n*/\nconst resolvePath = (record, path) => {\n\tlet current = [record];\n\tfor (const segment of path) current = current.flatMap((value) => {\n\t\tif (Array.isArray(value)) return value.flatMap((item) => step(item, segment));\n\t\treturn step(value, segment);\n\t});\n\treturn current.filter((value) => value !== void 0 && value !== null);\n};\nconst step = (value, segment) => {\n\tif (typeof value !== \"object\" || value === null) return [];\n\tif (value instanceof Map) return value.has(segment) ? [value.get(segment)] : [];\n\treturn Object.hasOwn(value, segment) ? [value[segment]] : [];\n};\n/** One level of array flattening, so repeated fields compare per element. */\nconst elements = (values) => values.flatMap((value) => Array.isArray(value) ? value : [value]);\n//#endregion\n//#region src/filter/evaluate/search.ts\nconst maxDepth = 32;\nconst leaves = (value, depth) => {\n\tif (depth > maxDepth || value === null || value === void 0) return [];\n\tif (typeof value === \"string\") return [value];\n\tif (typeof value === \"number\" || typeof value === \"boolean\" || typeof value === \"bigint\") return [String(value)];\n\tif (value instanceof Date) return [value.toISOString()];\n\tif (Array.isArray(value)) return value.flatMap((item) => leaves(item, depth + 1));\n\tif (value instanceof Map) return [...value.values()].flatMap((item) => leaves(item, depth + 1));\n\tif (typeof value === \"object\") return Object.values(value).flatMap((item) => leaves(item, depth + 1));\n\treturn [];\n};\n/** Default global restriction: case-insensitive substring over every string and number in the record. */\nconst defaultSearch = (text, record) => {\n\tconst needle = text.toLowerCase();\n\treturn leaves(record, 0).some((leaf) => leaf.toLowerCase().includes(needle));\n};\n//#endregion\n//#region src/filter/evaluate/evaluate.ts\nconst isOperand = (node) => [\n\t\"member\",\n\t\"string\",\n\t\"number\",\n\t\"boolean\",\n\t\"duration\",\n\t\"timestamp\",\n\t\"call\",\n\t\"binary\"\n].includes(node.kind);\nconst arithmetic = (op, left, right) => {\n\tconst sign = op === \"+\" ? 1 : -1;\n\tif (left instanceof Date && isDuration(right)) return new Date(left.getTime() + sign * right.seconds * 1e3);\n\tif (left instanceof Date && right instanceof Date && op === \"-\") return { seconds: (left.getTime() - right.getTime()) / 1e3 };\n\tif (isDuration(left) && isDuration(right)) return { seconds: left.seconds + sign * right.seconds };\n\tconst a = left instanceof Decimal ? left.toNumber() : left;\n\tconst b = right instanceof Decimal ? right.toNumber() : right;\n\treturn typeof a === \"number\" && typeof b === \"number\" ? a + sign * b : void 0;\n};\nconst callValue = (call, ctx) => {\n\tconst fn = ctx.options.functions?.[call.name];\n\tif (!fn?.evaluate) throw new Error(`Function \"${call.name}\" has no evaluate implementation`);\n\tconst args = call.args.map((arg, i) => {\n\t\tconst param = fn.params[i] ?? fn.rest;\n\t\tif (arg.kind === \"member\" && param?.type === \"field\") return elements(resolvePath(ctx.record, arg.path));\n\t\treturn isOperand(arg) ? operandValue(arg, ctx) : evaluateExpr(arg, ctx);\n\t});\n\treturn fn.evaluate(...args);\n};\nconst operandValue = (node, ctx) => {\n\tswitch (node.kind) {\n\t\tcase \"member\": return node.path.join(\".\");\n\t\tcase \"call\": return callValue(node, ctx);\n\t\tcase \"binary\": return arithmetic(node.op, operandValue(node.left, ctx), operandValue(node.right, ctx));\n\t\tdefault: return literalValue(node);\n\t}\n};\nconst candidates = (node, ctx) => node.kind === \"member\" ? resolvePath(ctx.record, node.path) : [operandValue(node, ctx)];\nconst matches = (op, values, expected) => elements(values).some((value) => compareValue(op, value, expected));\nconst convertFor = (left, expected) => {\n\tconst type = left.kind === \"member\" ? left.field?.spec.type : void 0;\n\tif (typeof expected !== \"string\" || !type) return expected;\n\tif (type === \"timestamp\") return millisOf(expected) === void 0 ? expected : new Date(millisOf(expected));\n\tif (type === \"duration\") return secondsOf(expected) === void 0 ? expected : { seconds: secondsOf(expected) };\n\tif (type === \"integer\" || type === \"number\") return decimalOf(expected) ?? expected;\n\tif (type === \"boolean\") return expected === \"true\" ? true : expected === \"false\" ? false : expected;\n\treturn expected;\n};\nconst evaluateCompare = (node, ctx) => {\n\tconst expected = convertFor(node.left, operandValue(node.right, ctx));\n\tconst values = candidates(node.left, ctx);\n\tif (node.op === \"!=\") return !matches(\"=\", values, expected);\n\treturn matches(node.op, values, expected);\n};\nconst evaluateHas = (node, ctx) => {\n\tconst expected = operandValue(node.right, ctx);\n\tconst key = textOf(node.right);\n\treturn candidates(node.left, ctx).some((value) => {\n\t\tif (Array.isArray(value)) return value.some((item) => compareValue(\"=\", item, expected));\n\t\tif (value instanceof Map) return key !== void 0 && value.has(key);\n\t\tif (typeof value === \"object\" && value !== null && !(value instanceof Date) && !isDuration(value) && !(value instanceof Decimal)) return key !== void 0 && Object.hasOwn(value, key);\n\t\treturn compareValue(\"=\", value, expected);\n\t});\n};\nconst evaluateExpr = (node, ctx) => {\n\tswitch (node.kind) {\n\t\tcase \"sequence\":\n\t\tcase \"and\": return node.args.every((arg) => evaluateExpr(arg, ctx));\n\t\tcase \"or\": return node.args.some((arg) => evaluateExpr(arg, ctx));\n\t\tcase \"not\": return !evaluateExpr(node.arg, ctx);\n\t\tcase \"compare\": return evaluateCompare(node, ctx);\n\t\tcase \"has\": return evaluateHas(node, ctx);\n\t\tcase \"present\": return candidates(node.left, ctx).some((value) => value !== void 0 && value !== null);\n\t\tcase \"global\": return (ctx.options.search ?? defaultSearch)(textOf(node.value) ?? String(operandValue(node.value, ctx)), ctx.record);\n\t\tcase \"call\": return callValue(node, ctx) === true;\n\t}\n};\n/**\n* Pass a checked filter so field types decide how quoted values convert.\n* Throws when a called function has no `evaluate` implementation.\n*/\nconst evaluateFilter = (ast, record, options = {}) => evaluateExpr(ast, {\n\trecord,\n\toptions\n});\n//#endregion\nexport { checkFilter as a, lineColumn as c, quote as i, FilterSyntaxError as l, printFilter as n, parseFilter as o, printOperand as r, parseFilterOrThrow as s, evaluateFilter as t };\n","import { n as diagnostic, t as suggest } from \"./suggest-DaQ79xMY.js\";\n//#region src/order-by/parse.ts\nconst tokenize = (source) => {\n\tconst tokens = [];\n\tfor (const match of source.matchAll(/,|\\.|[^\\s,.]+/g)) {\n\t\tconst start = match.index;\n\t\tconst kind = match[0] === \",\" ? \"comma\" : match[0] === \".\" ? \"dot\" : \"word\";\n\t\ttokens.push({\n\t\t\tkind,\n\t\t\ttext: match[0],\n\t\t\tspan: {\n\t\t\t\tstart,\n\t\t\t\tend: start + match[0].length\n\t\t\t}\n\t\t});\n\t}\n\treturn tokens;\n};\n/** Accepts `asc` as well as the spec's `desc` suffix. Reports every error found. */\nconst parseOrderBy = (source) => {\n\tconst tokens = tokenize(source);\n\tconst errors = [];\n\tconst items = [];\n\tconst end = {\n\t\tstart: source.length,\n\t\tend: source.length\n\t};\n\tlet pos = 0;\n\tconst fail = (code, message, hint, span) => errors.push(diagnostic(code, message, hint, span));\n\tconst skipItem = () => {\n\t\twhile (pos < tokens.length && tokens[pos].kind !== \"comma\") pos++;\n\t\tpos++;\n\t};\n\tconst parseItem = () => {\n\t\tconst first = tokens[pos];\n\t\tif (!first || first.kind !== \"word\") {\n\t\t\tfail(\"expected-field\", `Expected a field name but found ${first ? `\"${first.text}\"` : \"end of input\"}`, \"Write order_by like: createdAt desc, total\", first?.span ?? end);\n\t\t\treturn false;\n\t\t}\n\t\tconst path = [first.text];\n\t\tlet last = first;\n\t\tpos++;\n\t\twhile (tokens[pos]?.kind === \"dot\") {\n\t\t\tconst part = tokens[pos + 1];\n\t\t\tif (part?.kind !== \"word\") {\n\t\t\t\tfail(\"expected-field\", \"Expected a field name after \\\".\\\"\", \"Write subfields like address.street\", part?.span ?? end);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tpath.push(part.text);\n\t\t\tlast = part;\n\t\t\tpos += 2;\n\t\t}\n\t\tconst word = tokens[pos];\n\t\tlet direction = \"asc\";\n\t\tif (word?.kind === \"word\") {\n\t\t\tif (word.text !== \"asc\" && word.text !== \"desc\") {\n\t\t\t\tfail(\"unexpected-token\", `Expected \"desc\" or \",\" but found \"${word.text}\"`, \"Separate fields with commas; append \\\" desc\\\" for descending order\", word.span);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tdirection = word.text;\n\t\t\tlast = word;\n\t\t\tpos++;\n\t\t}\n\t\tconst after = tokens[pos];\n\t\tif (after && after.kind !== \"comma\") {\n\t\t\tfail(\"unexpected-token\", `Expected \",\" but found \"${after.text}\"`, \"Separate fields with commas\", after.span);\n\t\t\treturn false;\n\t\t}\n\t\titems.push({\n\t\t\tpath,\n\t\t\tdirection,\n\t\t\tspan: {\n\t\t\t\tstart: first.span.start,\n\t\t\t\tend: last.span.end\n\t\t\t}\n\t\t});\n\t\treturn true;\n\t};\n\twhile (pos < tokens.length) {\n\t\tif (!parseItem()) {\n\t\t\tskipItem();\n\t\t\tcontinue;\n\t\t}\n\t\tif (tokens[pos]?.kind === \"comma\") {\n\t\t\tpos++;\n\t\t\tif (pos >= tokens.length) fail(\"expected-field\", \"Expected a field name after \\\",\\\"\", \"Remove the trailing comma\", end);\n\t\t}\n\t}\n\treturn errors.length === 0 ? {\n\t\tok: true,\n\t\titems,\n\t\terrors: []\n\t} : {\n\t\tok: false,\n\t\titems,\n\t\terrors\n\t};\n};\n//#endregion\n//#region src/order-by/print.ts\n/** Canonical order_by: `foo desc, bar`; ascending is implicit. */\nconst printOrderBy = (items) => items.map((item) => item.path.join(\".\") + (item.direction === \"desc\" ? \" desc\" : \"\")).join(\", \");\n//#endregion\n//#region src/order-by/check.ts\nconst find = (fields, name) => {\n\tif (Object.hasOwn(fields, name)) return {\n\t\tname,\n\t\tfield: fields[name]\n\t};\n\tconst alias = Object.entries(fields).find(([, field]) => field.aliases?.includes(name));\n\treturn alias && {\n\t\tname: alias[0],\n\t\tfield: alias[1]\n\t};\n};\n/** Replaces aliases with the real field names. Fields are sortable unless `sortable: false`. */\nconst checkOrderBy = (items, schema) => {\n\tconst errors = [];\n\tconst checked = [];\n\tfor (const item of items) {\n\t\tconst found = find(schema.fields, item.path[0]);\n\t\tif (!found) {\n\t\t\tconst usable = Object.entries(schema.fields).filter(([, f]) => f.sortable !== false).map(([name]) => name);\n\t\t\tconst close = suggest(item.path[0], usable);\n\t\t\terrors.push(diagnostic(\"unknown-field\", `Unknown field \"${item.path[0]}\"`, close ? `Did you mean \"${close}\"?` : `Available fields: ${usable.join(\", \")}`, item.span));\n\t\t\tcontinue;\n\t\t}\n\t\tconst path = [found.name];\n\t\tlet field = found.field;\n\t\tlet sortable = field.sortable !== false;\n\t\tlet failed = false;\n\t\tfor (const segment of item.path.slice(1)) {\n\t\t\tconst inner = field.fields ? find(field.fields, segment)?.field : field.value;\n\t\t\tif (!inner) {\n\t\t\t\terrors.push(diagnostic(\"invalid-traversal\", `Cannot sort by \"${segment}\" inside \"${path.join(\".\")}\"`, \"Only nested message fields and map values can be traversed\", item.span));\n\t\t\t\tfailed = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tpath.push(field.fields ? find(field.fields, segment).name : segment);\n\t\t\tfield = inner;\n\t\t\tsortable &&= field.sortable !== false;\n\t\t}\n\t\tif (failed) continue;\n\t\tif (!sortable) {\n\t\t\terrors.push(diagnostic(\"not-sortable\", `Field \"${path.join(\".\")}\" cannot be sorted on`, \"Mark it sortable in the schema\", item.span));\n\t\t\tcontinue;\n\t\t}\n\t\tchecked.push({\n\t\t\t...item,\n\t\t\tpath\n\t\t});\n\t}\n\treturn errors.length === 0 ? {\n\t\tok: true,\n\t\titems: checked\n\t} : {\n\t\tok: false,\n\t\terrors\n\t};\n};\n//#endregion\nexport { printOrderBy as n, parseOrderBy as r, checkOrderBy as t };\n","'use strict'\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0'\n\nconst MAX_LENGTH = 256\nconst MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n/* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16\n\n// Max safe length for a build identifier. The max length minus 6 characters for\n// the shortest version with a build 0.0.0+BUILD.\nconst MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6\n\nconst RELEASE_TYPES = [\n 'major',\n 'premajor',\n 'minor',\n 'preminor',\n 'patch',\n 'prepatch',\n 'prerelease',\n]\n\nmodule.exports = {\n MAX_LENGTH,\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_SAFE_INTEGER,\n RELEASE_TYPES,\n SEMVER_SPEC_VERSION,\n FLAG_INCLUDE_PRERELEASE: 0b001,\n FLAG_LOOSE: 0b010,\n}\n","'use strict'\n\nconst debug = (\n typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)\n) ? (...args) => console.error('SEMVER', ...args)\n : () => {}\n\nmodule.exports = debug\n","'use strict'\n\nconst {\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_LENGTH,\n} = require('./constants')\nconst debug = require('./debug')\nexports = module.exports = {}\n\n// The actual regexps go on exports.re\nconst re = exports.re = []\nconst safeRe = exports.safeRe = []\nconst src = exports.src = []\nconst safeSrc = exports.safeSrc = []\nconst t = exports.t = {}\nlet R = 0\n\nconst LETTERDASHNUMBER = '[a-zA-Z0-9-]'\n\n// Replace some greedy regex tokens to prevent regex dos issues. These regex are\n// used internally via the safeRe object since all inputs in this library get\n// normalized first to trim and collapse all extra whitespace. The original\n// regexes are exported for userland consumption and lower level usage. A\n// future breaking change could export the safer regex only with a note that\n// all input should have extra whitespace removed.\nconst safeRegexReplacements = [\n ['\\\\s', 1],\n ['\\\\d', MAX_LENGTH],\n [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],\n]\n\nconst makeSafeRegex = (value) => {\n for (const [token, max] of safeRegexReplacements) {\n value = value\n .split(`${token}*`).join(`${token}{0,${max}}`)\n .split(`${token}+`).join(`${token}{1,${max}}`)\n }\n return value\n}\n\nconst createToken = (name, value, isGlobal) => {\n const safe = makeSafeRegex(value)\n const index = R++\n debug(name, index, value)\n t[name] = index\n src[index] = value\n safeSrc[index] = safe\n re[index] = new RegExp(value, isGlobal ? 'g' : undefined)\n safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)\n}\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\ncreateToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*')\ncreateToken('NUMERICIDENTIFIERLOOSE', '\\\\d+')\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\ncreateToken('NONNUMERICIDENTIFIER', `\\\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\ncreateToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n// Non-numeric identifiers include numeric identifiers but can be longer.\n// Therefore non-numeric identifiers must go first.\n\ncreateToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\ncreateToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`)\n\ncreateToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\ncreateToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\ncreateToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]\n}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`)\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups. The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\ncreateToken('FULLPLAIN', `v?${src[t.MAINVERSION]\n}${src[t.PRERELEASE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('FULL', `^${src[t.FULLPLAIN]}$`)\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\ncreateToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]\n}${src[t.PRERELEASELOOSE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)\n\ncreateToken('GTLT', '((?:<|>)?=?)')\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifier, meaning \"any version\"\n// Only the first item is strictly required.\ncreateToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`)\ncreateToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`)\n\ncreateToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:${src[t.PRERELEASE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:${src[t.PRERELEASELOOSE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`)\ncreateToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\ncreateToken('COERCEPLAIN', `${'(^|[^\\\\d])' +\n '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)\ncreateToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\\\d])`)\ncreateToken('COERCEFULL', src[t.COERCEPLAIN] +\n `(?:${src[t.PRERELEASE]})?` +\n `(?:${src[t.BUILD]})?` +\n `(?:$|[^\\\\d])`)\ncreateToken('COERCERTL', src[t.COERCE], true)\ncreateToken('COERCERTLFULL', src[t.COERCEFULL], true)\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\ncreateToken('LONETILDE', '(?:~>?)')\n\ncreateToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true)\nexports.tildeTrimReplace = '$1~'\n\ncreateToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\ncreateToken('LONECARET', '(?:\\\\^)')\n\ncreateToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true)\nexports.caretTrimReplace = '$1^'\n\ncreateToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\ncreateToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`)\ncreateToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`)\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\ncreateToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]\n}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)\nexports.comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\ncreateToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAIN]})` +\n `\\\\s*$`)\n\ncreateToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s*$`)\n\n// Star ranges basically just allow anything at all.\ncreateToken('STAR', '(<|>)?=?\\\\s*\\\\*')\n// >=0.0.0 is like a star\ncreateToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$')\ncreateToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$')\n","'use strict'\n\n// parse out just the options we care about\nconst looseOption = Object.freeze({ loose: true })\nconst emptyOpts = Object.freeze({ })\nconst parseOptions = options => {\n if (!options) {\n return emptyOpts\n }\n\n if (typeof options !== 'object') {\n return looseOption\n }\n\n return options\n}\nmodule.exports = parseOptions\n","'use strict'\n\nconst numeric = /^[0-9]+$/\nconst compareIdentifiers = (a, b) => {\n if (typeof a === 'number' && typeof b === 'number') {\n return a === b ? 0 : a < b ? -1 : 1\n }\n\n const anum = numeric.test(a)\n const bnum = numeric.test(b)\n\n if (anum && bnum) {\n a = +a\n b = +b\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n}\n\nconst rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)\n\nmodule.exports = {\n compareIdentifiers,\n rcompareIdentifiers,\n}\n","'use strict'\n\nconst debug = require('../internal/debug')\nconst { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst parseOptions = require('../internal/parse-options')\nconst { compareIdentifiers } = require('../internal/identifiers')\n\nconst isPrereleaseIdentifier = (prerelease, identifier) => {\n const identifiers = identifier.split('.')\n if (identifiers.length > prerelease.length) {\n return false\n }\n\n for (let i = 0; i < identifiers.length; i++) {\n if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) {\n return false\n }\n }\n\n return true\n}\n\nclass SemVer {\n constructor (version, options) {\n options = parseOptions(options)\n\n if (version instanceof SemVer) {\n if (version.loose === !!options.loose &&\n version.includePrerelease === !!options.includePrerelease) {\n return version\n } else {\n version = version.version\n }\n } else if (typeof version !== 'string') {\n throw new TypeError(`Invalid version. Must be a string. Got type \"${typeof version}\".`)\n }\n\n if (version.length > MAX_LENGTH) {\n throw new TypeError(\n `version is longer than ${MAX_LENGTH} characters`\n )\n }\n\n debug('SemVer', version, options)\n this.options = options\n this.loose = !!options.loose\n // this isn't actually relevant for versions, but keep it so that we\n // don't run into trouble passing this.options around.\n this.includePrerelease = !!options.includePrerelease\n\n const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])\n\n if (!m) {\n throw new TypeError(`Invalid Version: ${version}`)\n }\n\n this.raw = version\n\n // these are actually numbers\n this.major = +m[1]\n this.minor = +m[2]\n this.patch = +m[3]\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = []\n } else {\n this.prerelease = m[4].split('.').map((id) => {\n if (/^[0-9]+$/.test(id)) {\n const num = +id\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n })\n }\n\n this.build = m[5] ? m[5].split('.') : []\n this.format()\n }\n\n format () {\n this.version = `${this.major}.${this.minor}.${this.patch}`\n if (this.prerelease.length) {\n this.version += `-${this.prerelease.join('.')}`\n }\n return this.version\n }\n\n toString () {\n return this.version\n }\n\n compare (other) {\n debug('SemVer.compare', this.version, this.options, other)\n if (!(other instanceof SemVer)) {\n if (typeof other === 'string' && other === this.version) {\n return 0\n }\n other = new SemVer(other, this.options)\n }\n\n if (other.version === this.version) {\n return 0\n }\n\n return this.compareMain(other) || this.comparePre(other)\n }\n\n compareMain (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n if (this.major < other.major) {\n return -1\n }\n if (this.major > other.major) {\n return 1\n }\n if (this.minor < other.minor) {\n return -1\n }\n if (this.minor > other.minor) {\n return 1\n }\n if (this.patch < other.patch) {\n return -1\n }\n if (this.patch > other.patch) {\n return 1\n }\n return 0\n }\n\n comparePre (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n let i = 0\n do {\n const a = this.prerelease[i]\n const b = other.prerelease[i]\n debug('prerelease compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n compareBuild (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n let i = 0\n do {\n const a = this.build[i]\n const b = other.build[i]\n debug('build compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n // preminor will bump the version up to the next minor release, and immediately\n // down to pre-release. premajor and prepatch work the same way.\n inc (release, identifier, identifierBase) {\n if (release.startsWith('pre')) {\n if (!identifier && identifierBase === false) {\n throw new Error('invalid increment argument: identifier is empty')\n }\n // Avoid an invalid semver results\n if (identifier) {\n const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])\n if (!match || match[1] !== identifier) {\n throw new Error(`invalid identifier: ${identifier}`)\n }\n }\n }\n\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor = 0\n this.major++\n this.inc('pre', identifier, identifierBase)\n break\n case 'preminor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor++\n this.inc('pre', identifier, identifierBase)\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0\n this.inc('patch', identifier, identifierBase)\n this.inc('pre', identifier, identifierBase)\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier, identifierBase)\n }\n this.inc('pre', identifier, identifierBase)\n break\n case 'release':\n if (this.prerelease.length === 0) {\n throw new Error(`version ${this.raw} is not a prerelease`)\n }\n this.prerelease.length = 0\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (\n this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0\n ) {\n this.major++\n }\n this.minor = 0\n this.patch = 0\n this.prerelease = []\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++\n }\n this.patch = 0\n this.prerelease = []\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++\n }\n this.prerelease = []\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n case 'pre': {\n const base = Number(identifierBase) ? 1 : 0\n\n if (this.prerelease.length === 0) {\n this.prerelease = [base]\n } else {\n let i = this.prerelease.length\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++\n i = -2\n }\n }\n if (i === -1) {\n // didn't increment anything\n if (identifier === this.prerelease.join('.') && identifierBase === false) {\n throw new Error('invalid increment argument: identifier already exists')\n }\n this.prerelease.push(base)\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n let prerelease = [identifier, base]\n if (identifierBase === false) {\n prerelease = [identifier]\n }\n if (isPrereleaseIdentifier(this.prerelease, identifier)) {\n const prereleaseBase = this.prerelease[identifier.split('.').length]\n if (isNaN(prereleaseBase)) {\n this.prerelease = prerelease\n }\n } else {\n this.prerelease = prerelease\n }\n }\n break\n }\n default:\n throw new Error(`invalid increment argument: ${release}`)\n }\n this.raw = this.format()\n if (this.build.length) {\n this.raw += `+${this.build.join('.')}`\n }\n return this\n }\n}\n\nmodule.exports = SemVer\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst parse = (version, options, throwErrors = false) => {\n if (version instanceof SemVer) {\n return version\n }\n try {\n return new SemVer(version, options)\n } catch (er) {\n if (!throwErrors) {\n return null\n }\n throw er\n }\n}\n\nmodule.exports = parse\n","'use strict'\n\nconst parse = require('./parse')\nconst valid = (version, options) => {\n const v = parse(version, options)\n return v ? v.version : null\n}\nmodule.exports = valid\n","'use strict'\n\nconst parse = require('./parse')\nconst clean = (version, options) => {\n const s = parse(version.trim().replace(/^[=v]+/, ''), options)\n return s ? s.version : null\n}\nmodule.exports = clean\n","'use strict'\n\nconst SemVer = require('../classes/semver')\n\nconst inc = (version, release, options, identifier, identifierBase) => {\n if (typeof (options) === 'string') {\n identifierBase = identifier\n identifier = options\n options = undefined\n }\n\n try {\n return new SemVer(\n version instanceof SemVer ? version.version : version,\n options\n ).inc(release, identifier, identifierBase).version\n } catch (er) {\n return null\n }\n}\nmodule.exports = inc\n","'use strict'\n\nconst parse = require('./parse.js')\n\nconst diff = (version1, version2) => {\n const v1 = parse(version1, null, true)\n const v2 = parse(version2, null, true)\n const comparison = v1.compare(v2)\n\n if (comparison === 0) {\n return null\n }\n\n const v1Higher = comparison > 0\n const highVersion = v1Higher ? v1 : v2\n const lowVersion = v1Higher ? v2 : v1\n const highHasPre = !!highVersion.prerelease.length\n const lowHasPre = !!lowVersion.prerelease.length\n\n if (lowHasPre && !highHasPre) {\n // Going from prerelease -> no prerelease requires some special casing\n\n // If the low version has only a major, then it will always be a major\n // Some examples:\n // 1.0.0-1 -> 1.0.0\n // 1.0.0-1 -> 1.1.1\n // 1.0.0-1 -> 2.0.0\n if (!lowVersion.patch && !lowVersion.minor) {\n return 'major'\n }\n\n // If the main part has no difference\n if (lowVersion.compareMain(highVersion) === 0) {\n if (lowVersion.minor && !lowVersion.patch) {\n return 'minor'\n }\n return 'patch'\n }\n }\n\n // add the `pre` prefix if we are going to a prerelease version\n const prefix = highHasPre ? 'pre' : ''\n\n if (v1.major !== v2.major) {\n return prefix + 'major'\n }\n\n if (v1.minor !== v2.minor) {\n return prefix + 'minor'\n }\n\n if (v1.patch !== v2.patch) {\n return prefix + 'patch'\n }\n\n // high and low are prereleases\n return 'prerelease'\n}\n\nmodule.exports = diff\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst major = (a, loose) => new SemVer(a, loose).major\nmodule.exports = major\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst minor = (a, loose) => new SemVer(a, loose).minor\nmodule.exports = minor\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst patch = (a, loose) => new SemVer(a, loose).patch\nmodule.exports = patch\n","'use strict'\n\nconst parse = require('./parse')\nconst prerelease = (version, options) => {\n const parsed = parse(version, options)\n return (parsed && parsed.prerelease.length) ? parsed.prerelease : null\n}\nmodule.exports = prerelease\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst compare = (a, b, loose) =>\n new SemVer(a, loose).compare(new SemVer(b, loose))\n\nmodule.exports = compare\n","'use strict'\n\nconst compare = require('./compare')\nconst rcompare = (a, b, loose) => compare(b, a, loose)\nmodule.exports = rcompare\n","'use strict'\n\nconst compare = require('./compare')\nconst compareLoose = (a, b) => compare(a, b, true)\nmodule.exports = compareLoose\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst compareBuild = (a, b, loose) => {\n const versionA = new SemVer(a, loose)\n const versionB = new SemVer(b, loose)\n return versionA.compare(versionB) || versionA.compareBuild(versionB)\n}\nmodule.exports = compareBuild\n","'use strict'\n\nconst compareBuild = require('./compare-build')\nconst sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))\nmodule.exports = sort\n","'use strict'\n\nconst compareBuild = require('./compare-build')\nconst rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))\nmodule.exports = rsort\n","'use strict'\n\nconst compare = require('./compare')\nconst gt = (a, b, loose) => compare(a, b, loose) > 0\nmodule.exports = gt\n","'use strict'\n\nconst compare = require('./compare')\nconst lt = (a, b, loose) => compare(a, b, loose) < 0\nmodule.exports = lt\n","'use strict'\n\nconst compare = require('./compare')\nconst eq = (a, b, loose) => compare(a, b, loose) === 0\nmodule.exports = eq\n","'use strict'\n\nconst compare = require('./compare')\nconst neq = (a, b, loose) => compare(a, b, loose) !== 0\nmodule.exports = neq\n","'use strict'\n\nconst compare = require('./compare')\nconst gte = (a, b, loose) => compare(a, b, loose) >= 0\nmodule.exports = gte\n","'use strict'\n\nconst compare = require('./compare')\nconst lte = (a, b, loose) => compare(a, b, loose) <= 0\nmodule.exports = lte\n","'use strict'\n\nconst eq = require('./eq')\nconst neq = require('./neq')\nconst gt = require('./gt')\nconst gte = require('./gte')\nconst lt = require('./lt')\nconst lte = require('./lte')\n\nconst cmp = (a, op, b, loose) => {\n switch (op) {\n case '===':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a === b\n\n case '!==':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a !== b\n\n case '':\n case '=':\n case '==':\n return eq(a, b, loose)\n\n case '!=':\n return neq(a, b, loose)\n\n case '>':\n return gt(a, b, loose)\n\n case '>=':\n return gte(a, b, loose)\n\n case '<':\n return lt(a, b, loose)\n\n case '<=':\n return lte(a, b, loose)\n\n default:\n throw new TypeError(`Invalid operator: ${op}`)\n }\n}\nmodule.exports = cmp\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst parse = require('./parse')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst coerce = (version, options) => {\n if (version instanceof SemVer) {\n return version\n }\n\n if (typeof version === 'number') {\n version = String(version)\n }\n\n if (typeof version !== 'string') {\n return null\n }\n\n options = options || {}\n\n let match = null\n if (!options.rtl) {\n match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE])\n } else {\n // Find the right-most coercible string that does not share\n // a terminus with a more left-ward coercible string.\n // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'\n // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'\n //\n // Walk through the string checking with a /g regexp\n // Manually set the index so as to pick up overlapping matches.\n // Stop when we get a match that ends at the string end, since no\n // coercible string can be more right-ward without the same terminus.\n const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL]\n let next\n while ((next = coerceRtlRegex.exec(version)) &&\n (!match || match.index + match[0].length !== version.length)\n ) {\n if (!match ||\n next.index + next[0].length !== match.index + match[0].length) {\n match = next\n }\n coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length\n }\n // leave it in a clean state\n coerceRtlRegex.lastIndex = -1\n }\n\n if (match === null) {\n return null\n }\n\n const major = match[2]\n const minor = match[3] || '0'\n const patch = match[4] || '0'\n const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : ''\n const build = options.includePrerelease && match[6] ? `+${match[6]}` : ''\n\n return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)\n}\nmodule.exports = coerce\n","'use strict'\n\nconst parse = require('./parse')\nconst constants = require('../internal/constants')\nconst SemVer = require('../classes/semver')\n\nconst truncate = (version, truncation, options) => {\n if (!constants.RELEASE_TYPES.includes(truncation)) {\n return null\n }\n\n const clonedVersion = cloneInputVersion(version, options)\n return clonedVersion && doTruncation(clonedVersion, truncation)\n}\n\nconst cloneInputVersion = (version, options) => {\n const versionStringToParse = (\n version instanceof SemVer ? version.version : version\n )\n\n return parse(versionStringToParse, options)\n}\n\nconst doTruncation = (version, truncation) => {\n if (isPrerelease(truncation)) {\n return version.version\n }\n\n version.prerelease = []\n\n switch (truncation) {\n case 'major':\n version.minor = 0\n version.patch = 0\n break\n case 'minor':\n version.patch = 0\n break\n }\n\n return version.format()\n}\n\nconst isPrerelease = (type) => {\n return type.startsWith('pre')\n}\n\nmodule.exports = truncate\n","'use strict'\n\nclass LRUCache {\n constructor () {\n this.max = 1000\n this.map = new Map()\n }\n\n get (key) {\n const value = this.map.get(key)\n if (value === undefined) {\n return undefined\n } else {\n // Remove the key from the map and add it to the end\n this.map.delete(key)\n this.map.set(key, value)\n return value\n }\n }\n\n delete (key) {\n return this.map.delete(key)\n }\n\n set (key, value) {\n const deleted = this.delete(key)\n\n if (!deleted && value !== undefined) {\n // If cache is full, delete the least recently used item\n if (this.map.size >= this.max) {\n const firstKey = this.map.keys().next().value\n this.delete(firstKey)\n }\n\n this.map.set(key, value)\n }\n\n return this\n }\n}\n\nmodule.exports = LRUCache\n","'use strict'\n\nconst SPACE_CHARACTERS = /\\s+/g\n\n// hoisted class for cyclic dependency\nclass Range {\n constructor (range, options) {\n options = parseOptions(options)\n\n if (range instanceof Range) {\n if (\n range.loose === !!options.loose &&\n range.includePrerelease === !!options.includePrerelease\n ) {\n return range\n } else {\n return new Range(range.raw, options)\n }\n }\n\n if (range instanceof Comparator) {\n // just put it in the set and return\n this.raw = range.value\n this.set = [[range]]\n this.formatted = undefined\n return this\n }\n\n this.options = options\n this.loose = !!options.loose\n this.includePrerelease = !!options.includePrerelease\n\n // First reduce all whitespace as much as possible so we do not have to rely\n // on potentially slow regexes like \\s*. This is then stored and used for\n // future error messages as well.\n this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')\n\n // First, split on ||\n this.set = this.raw\n .split('||')\n // map the range to a 2d array of comparators\n .map(r => this.parseRange(r.trim()))\n // throw out any comparator lists that are empty\n // this generally means that it was not a valid range, which is allowed\n // in loose mode, but will still throw if the WHOLE range is invalid.\n .filter(c => c.length)\n\n if (!this.set.length) {\n throw new TypeError(`Invalid SemVer Range: ${this.raw}`)\n }\n\n // if we have any that are not the null set, throw out null sets.\n if (this.set.length > 1) {\n // keep the first one, in case they're all null sets\n const first = this.set[0]\n this.set = this.set.filter(c => !isNullSet(c[0]))\n if (this.set.length === 0) {\n this.set = [first]\n } else if (this.set.length > 1) {\n // if we have any that are *, then the range is just *\n for (const c of this.set) {\n if (c.length === 1 && isAny(c[0])) {\n this.set = [c]\n break\n }\n }\n }\n }\n\n this.formatted = undefined\n }\n\n get range () {\n if (this.formatted === undefined) {\n this.formatted = ''\n for (let i = 0; i < this.set.length; i++) {\n if (i > 0) {\n this.formatted += '||'\n }\n const comps = this.set[i]\n for (let k = 0; k < comps.length; k++) {\n if (k > 0) {\n this.formatted += ' '\n }\n this.formatted += comps[k].toString().trim()\n }\n }\n }\n return this.formatted\n }\n\n format () {\n return this.range\n }\n\n toString () {\n return this.range\n }\n\n parseRange (range) {\n // strip build metadata so it can't bleed into the version\n range = range.replace(BUILDSTRIPRE, '')\n\n // memoize range parsing for performance.\n // this is a very hot path, and fully deterministic.\n const memoOpts =\n (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |\n (this.options.loose && FLAG_LOOSE)\n const memoKey = memoOpts + ':' + range\n const cached = cache.get(memoKey)\n if (cached) {\n return cached\n }\n\n const loose = this.options.loose\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]\n range = range.replace(hr, hyphenReplace(this.options.includePrerelease))\n debug('hyphen replace', range)\n\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)\n debug('comparator trim', range)\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[t.TILDETRIM], tildeTrimReplace)\n debug('tilde trim', range)\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[t.CARETTRIM], caretTrimReplace)\n debug('caret trim', range)\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n let rangeList = range\n .split(' ')\n .map(comp => parseComparator(comp, this.options))\n .join(' ')\n .split(/\\s+/)\n // >=0.0.0 is equivalent to *\n .map(comp => replaceGTE0(comp, this.options))\n\n if (loose) {\n // in loose mode, throw out any that are not valid comparators\n rangeList = rangeList.filter(comp => {\n debug('loose invalid filter', comp, this.options)\n return !!comp.match(re[t.COMPARATORLOOSE])\n })\n }\n debug('range list', rangeList)\n\n // if any comparators are the null set, then replace with JUST null set\n // if more than one comparator, remove any * comparators\n // also, don't include the same comparator more than once\n const rangeMap = new Map()\n const comparators = rangeList.map(comp => new Comparator(comp, this.options))\n for (const comp of comparators) {\n if (isNullSet(comp)) {\n return [comp]\n }\n rangeMap.set(comp.value, comp)\n }\n if (rangeMap.size > 1 && rangeMap.has('')) {\n rangeMap.delete('')\n }\n\n const result = [...rangeMap.values()]\n cache.set(memoKey, result)\n return result\n }\n\n intersects (range, options) {\n if (!(range instanceof Range)) {\n throw new TypeError('a Range is required')\n }\n\n return this.set.some((thisComparators) => {\n return (\n isSatisfiable(thisComparators, options) &&\n range.set.some((rangeComparators) => {\n return (\n isSatisfiable(rangeComparators, options) &&\n thisComparators.every((thisComparator) => {\n return rangeComparators.every((rangeComparator) => {\n return thisComparator.intersects(rangeComparator, options)\n })\n })\n )\n })\n )\n })\n }\n\n // if ANY of the sets match ALL of its comparators, then pass\n test (version) {\n if (!version) {\n return false\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n for (let i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version, this.options)) {\n return true\n }\n }\n return false\n }\n}\n\nmodule.exports = Range\n\nconst LRU = require('../internal/lrucache')\nconst cache = new LRU()\n\nconst parseOptions = require('../internal/parse-options')\nconst Comparator = require('./comparator')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst {\n safeRe: re,\n src,\n t,\n comparatorTrimReplace,\n tildeTrimReplace,\n caretTrimReplace,\n} = require('../internal/re')\nconst { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')\n\n// unbounded global build-metadata stripper used by parseRange\nconst BUILDSTRIPRE = new RegExp(src[t.BUILD], 'g')\n\nconst isNullSet = c => c.value === '<0.0.0-0'\nconst isAny = c => c.value === ''\n\n// take a set of comparators and determine whether there\n// exists a version which can satisfy it\nconst isSatisfiable = (comparators, options) => {\n let result = true\n const remainingComparators = comparators.slice()\n let testComparator = remainingComparators.pop()\n\n while (result && remainingComparators.length) {\n result = remainingComparators.every((otherComparator) => {\n return testComparator.intersects(otherComparator, options)\n })\n\n testComparator = remainingComparators.pop()\n }\n\n return result\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nconst parseComparator = (comp, options) => {\n comp = comp.replace(re[t.BUILD], '')\n debug('comp', comp, options)\n comp = replaceCarets(comp, options)\n debug('caret', comp)\n comp = replaceTildes(comp, options)\n debug('tildes', comp)\n comp = replaceXRanges(comp, options)\n debug('xrange', comp)\n comp = replaceStars(comp, options)\n debug('stars', comp)\n return comp\n}\n\nconst isX = id => !id || id.toLowerCase() === 'x' || id === '*'\n\nconst invalidXRangeOrder = (M, m, p) => (\n (isX(M) && !isX(m)) ||\n (isX(m) && p && !isX(p))\n)\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n// ~0.0.1 --> >=0.0.1 <0.1.0-0\nconst replaceTildes = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceTilde(c, options))\n .join(' ')\n}\n\nconst replaceTilde = (comp, options) => {\n const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]\n // if we're including prereleases in the match, then the lower bound is\n // -0, the lowest possible prerelease value, just like x-ranges and carets.\n // this keeps `~1.2` equivalent to the `1.2.x` x-range it's documented as.\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('tilde', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n // ~1.2 == >=1.2.0 <1.3.0-0\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else if (pr) {\n debug('replaceTilde pr', pr)\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n } else {\n // ~1.2.3 == >=1.2.3 <1.3.0-0\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('tilde return', ret)\n return ret\n })\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n// ^1.2.3 --> >=1.2.3 <2.0.0-0\n// ^1.2.0 --> >=1.2.0 <2.0.0-0\n// ^0.0.1 --> >=0.0.1 <0.0.2-0\n// ^0.1.0 --> >=0.1.0 <0.2.0-0\nconst replaceCarets = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceCaret(c, options))\n .join(' ')\n}\n\nconst replaceCaret = (comp, options) => {\n debug('caret', comp, options)\n const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('caret', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n if (M === '0') {\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else {\n ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`\n }\n } else if (pr) {\n debug('replaceCaret pr', pr)\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${+M + 1}.0.0-0`\n }\n } else {\n debug('no pr')\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p\n } <${+M + 1}.0.0-0`\n }\n }\n\n debug('caret return', ret)\n return ret\n })\n}\n\nconst replaceXRanges = (comp, options) => {\n debug('replaceXRanges', comp, options)\n return comp\n .split(/\\s+/)\n .map((c) => replaceXRange(c, options))\n .join(' ')\n}\n\nconst replaceXRange = (comp, options) => {\n comp = comp.trim()\n const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]\n return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n debug('xRange', comp, ret, gtlt, M, m, p, pr)\n if (invalidXRangeOrder(M, m, p)) {\n return comp\n }\n\n const xM = isX(M)\n const xm = xM || isX(m)\n const xp = xm || isX(p)\n const anyX = xp\n\n if (gtlt === '=' && anyX) {\n gtlt = ''\n }\n\n // if we're including prereleases in the match, then we need\n // to fix this to -0, the lowest possible prerelease value\n pr = options.includePrerelease ? '-0' : ''\n\n if (xM) {\n if (gtlt === '>' || gtlt === '<') {\n // nothing is allowed\n ret = '<0.0.0-0'\n } else {\n // nothing is forbidden\n ret = '*'\n }\n } else if (gtlt && anyX) {\n // we know patch is an x, because we have any x at all.\n // replace X with 0\n if (xm) {\n m = 0\n }\n p = 0\n\n if (gtlt === '>') {\n // >1 => >=2.0.0\n // >1.2 => >=1.3.0\n gtlt = '>='\n if (xm) {\n M = +M + 1\n m = 0\n p = 0\n } else {\n m = +m + 1\n p = 0\n }\n } else if (gtlt === '<=') {\n // <=0.7.x is actually <0.8.0, since any 0.7.x should\n // pass. Similarly, <=7.x is actually <8.0.0, etc.\n gtlt = '<'\n if (xm) {\n M = +M + 1\n } else {\n m = +m + 1\n }\n }\n\n if (gtlt === '<') {\n pr = '-0'\n }\n\n ret = `${gtlt + M}.${m}.${p}${pr}`\n } else if (xm) {\n ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`\n } else if (xp) {\n ret = `>=${M}.${m}.0${pr\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('xRange return', ret)\n\n return ret\n })\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nconst replaceStars = (comp, options) => {\n debug('replaceStars', comp, options)\n // Looseness is ignored here. star is always as loose as it gets!\n return comp\n .trim()\n .replace(re[t.STAR], '')\n}\n\nconst replaceGTE0 = (comp, options) => {\n debug('replaceGTE0', comp, options)\n return comp\n .trim()\n .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')\n}\n\n// This function is passed to string.replace(re[t.HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0 <3.5.0-0\n// TODO build?\nconst hyphenReplace = incPr => ($0,\n from, fM, fm, fp, fpr, fb,\n to, tM, tm, tp, tpr) => {\n if (isX(fM)) {\n from = ''\n } else if (isX(fm)) {\n from = `>=${fM}.0.0${incPr ? '-0' : ''}`\n } else if (isX(fp)) {\n from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`\n } else if (fpr) {\n from = `>=${from}`\n } else {\n from = `>=${from}${incPr ? '-0' : ''}`\n }\n\n if (isX(tM)) {\n to = ''\n } else if (isX(tm)) {\n to = `<${+tM + 1}.0.0-0`\n } else if (isX(tp)) {\n to = `<${tM}.${+tm + 1}.0-0`\n } else if (tpr) {\n to = `<=${tM}.${tm}.${tp}-${tpr}`\n } else if (incPr) {\n to = `<${tM}.${tm}.${+tp + 1}-0`\n } else {\n to = `<=${to}`\n }\n\n return `${from} ${to}`.trim()\n}\n\nconst testSet = (set, version, options) => {\n for (let i = 0; i < set.length; i++) {\n if (!set[i].test(version)) {\n return false\n }\n }\n\n if (version.prerelease.length && !options.includePrerelease) {\n // Find the set of versions that are allowed to have prereleases\n // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n // That should allow `1.2.3-pr.2` to pass.\n // However, `1.2.4-alpha.notready` should NOT be allowed,\n // even though it's within the range set by the comparators.\n for (let i = 0; i < set.length; i++) {\n debug(set[i].semver)\n if (set[i].semver === Comparator.ANY) {\n continue\n }\n\n if (set[i].semver.prerelease.length > 0) {\n const allowed = set[i].semver\n if (allowed.major === version.major &&\n allowed.minor === version.minor &&\n allowed.patch === version.patch) {\n return true\n }\n }\n }\n\n // Version has a -pre, but it's not one of the ones we like.\n return false\n }\n\n return true\n}\n","'use strict'\n\nconst ANY = Symbol('SemVer ANY')\n// hoisted class for cyclic dependency\nclass Comparator {\n static get ANY () {\n return ANY\n }\n\n constructor (comp, options) {\n options = parseOptions(options)\n\n if (comp instanceof Comparator) {\n if (comp.loose === !!options.loose) {\n return comp\n } else {\n comp = comp.value\n }\n }\n\n comp = comp.trim().split(/\\s+/).join(' ')\n debug('comparator', comp, options)\n this.options = options\n this.loose = !!options.loose\n this.parse(comp)\n\n if (this.semver === ANY) {\n this.value = ''\n } else {\n this.value = this.operator + this.semver.version\n }\n\n debug('comp', this)\n }\n\n parse (comp) {\n const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]\n const m = comp.match(r)\n\n if (!m) {\n throw new TypeError(`Invalid comparator: ${comp}`)\n }\n\n this.operator = m[1] !== undefined ? m[1] : ''\n if (this.operator === '=') {\n this.operator = ''\n }\n\n // if it literally is just '>' or '' then allow anything.\n if (!m[2]) {\n this.semver = ANY\n } else {\n this.semver = new SemVer(m[2], this.options.loose)\n }\n }\n\n toString () {\n return this.value\n }\n\n test (version) {\n debug('Comparator.test', version, this.options.loose)\n\n if (this.semver === ANY || version === ANY) {\n return true\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n return cmp(version, this.operator, this.semver, this.options)\n }\n\n intersects (comp, options) {\n if (!(comp instanceof Comparator)) {\n throw new TypeError('a Comparator is required')\n }\n\n if (this.operator === '') {\n if (this.value === '') {\n return true\n }\n return new Range(comp.value, options).test(this.value)\n } else if (comp.operator === '') {\n if (comp.value === '') {\n return true\n }\n return new Range(this.value, options).test(comp.semver)\n }\n\n options = parseOptions(options)\n\n // Special cases where nothing can possibly be lower\n if (options.includePrerelease &&\n (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {\n return false\n }\n if (!options.includePrerelease &&\n (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {\n return false\n }\n\n // Same direction increasing (> or >=)\n if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {\n return true\n }\n // Same direction decreasing (< or <=)\n if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {\n return true\n }\n // same SemVer and both sides are inclusive (<= or >=)\n if (\n (this.semver.version === comp.semver.version) &&\n this.operator.includes('=') && comp.operator.includes('=')) {\n return true\n }\n // opposite directions less than\n if (cmp(this.semver, '<', comp.semver, options) &&\n this.operator.startsWith('>') && comp.operator.startsWith('<')) {\n return true\n }\n // opposite directions greater than\n if (cmp(this.semver, '>', comp.semver, options) &&\n this.operator.startsWith('<') && comp.operator.startsWith('>')) {\n return true\n }\n return false\n }\n}\n\nmodule.exports = Comparator\n\nconst parseOptions = require('../internal/parse-options')\nconst { safeRe: re, t } = require('../internal/re')\nconst cmp = require('../functions/cmp')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst Range = require('./range')\n","'use strict'\n\nconst Range = require('../classes/range')\nconst satisfies = (version, range, options) => {\n try {\n range = new Range(range, options)\n } catch (er) {\n return false\n }\n return range.test(version)\n}\nmodule.exports = satisfies\n","'use strict'\n\nconst Range = require('../classes/range')\n\n// Mostly just for testing and legacy API reasons\nconst toComparators = (range, options) =>\n new Range(range, options).set\n .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))\n\nmodule.exports = toComparators\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\n\nconst maxSatisfying = (versions, range, options) => {\n let max = null\n let maxSV = null\n let rangeObj = null\n try {\n rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!max || maxSV.compare(v) === -1) {\n // compare(max, v, true)\n max = v\n maxSV = new SemVer(max, options)\n }\n }\n })\n return max\n}\nmodule.exports = maxSatisfying\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst minSatisfying = (versions, range, options) => {\n let min = null\n let minSV = null\n let rangeObj = null\n try {\n rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!min || minSV.compare(v) === 1) {\n // compare(min, v, true)\n min = v\n minSV = new SemVer(min, options)\n }\n }\n })\n return min\n}\nmodule.exports = minSatisfying\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst gt = require('../functions/gt')\n\nconst minVersion = (range, loose) => {\n range = new Range(range, loose)\n\n let minver = new SemVer('0.0.0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = new SemVer('0.0.0-0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = null\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i]\n\n let setMin = null\n comparators.forEach((comparator) => {\n // Clone to avoid manipulating the comparator's semver object.\n const compver = new SemVer(comparator.semver.version)\n switch (comparator.operator) {\n case '>':\n if (compver.prerelease.length === 0) {\n compver.patch++\n } else {\n compver.prerelease.push(0)\n }\n compver.raw = compver.format()\n /* fallthrough */\n case '':\n case '>=':\n if (!setMin || gt(compver, setMin)) {\n setMin = compver\n }\n break\n case '<':\n case '<=':\n /* Ignore maximum versions */\n break\n /* istanbul ignore next */\n default:\n throw new Error(`Unexpected operation: ${comparator.operator}`)\n }\n })\n if (setMin && (!minver || gt(minver, setMin))) {\n minver = setMin\n }\n }\n\n if (minver && range.test(minver)) {\n return minver\n }\n\n return null\n}\nmodule.exports = minVersion\n","'use strict'\n\nconst Range = require('../classes/range')\nconst validRange = (range, options) => {\n try {\n // Return '*' instead of '' so that truthiness works.\n // This will throw if it's invalid anyway\n return new Range(range, options).range || '*'\n } catch (er) {\n return null\n }\n}\nmodule.exports = validRange\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Comparator = require('../classes/comparator')\nconst { ANY } = Comparator\nconst Range = require('../classes/range')\nconst satisfies = require('../functions/satisfies')\nconst gt = require('../functions/gt')\nconst lt = require('../functions/lt')\nconst lte = require('../functions/lte')\nconst gte = require('../functions/gte')\n\nconst outside = (version, range, hilo, options) => {\n version = new SemVer(version, options)\n range = new Range(range, options)\n\n let gtfn, ltefn, ltfn, comp, ecomp\n switch (hilo) {\n case '>':\n gtfn = gt\n ltefn = lte\n ltfn = lt\n comp = '>'\n ecomp = '>='\n break\n case '<':\n gtfn = lt\n ltefn = gte\n ltfn = gt\n comp = '<'\n ecomp = '<='\n break\n default:\n throw new TypeError('Must provide a hilo val of \"<\" or \">\"')\n }\n\n // If it satisfies the range it is not outside\n if (satisfies(version, range, options)) {\n return false\n }\n\n // From now on, variable terms are as if we're in \"gtr\" mode.\n // but note that everything is flipped for the \"ltr\" function.\n\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i]\n\n let high = null\n let low = null\n\n comparators.forEach((comparator) => {\n if (comparator.semver === ANY) {\n comparator = new Comparator('>=0.0.0')\n }\n high = high || comparator\n low = low || comparator\n if (gtfn(comparator.semver, high.semver, options)) {\n high = comparator\n } else if (ltfn(comparator.semver, low.semver, options)) {\n low = comparator\n }\n })\n\n // If the edge version comparator has a operator then our version\n // isn't outside it\n if (high.operator === comp || high.operator === ecomp) {\n return false\n }\n\n // If the lowest version comparator has an operator and our version\n // is less than it then it isn't higher than the range\n if ((!low.operator || low.operator === comp) &&\n ltefn(version, low.semver)) {\n return false\n } else if (low.operator === ecomp && ltfn(version, low.semver)) {\n return false\n }\n }\n return true\n}\n\nmodule.exports = outside\n","'use strict'\n\n// Determine if version is greater than all the versions possible in the range.\nconst outside = require('./outside')\nconst gtr = (version, range, options) => outside(version, range, '>', options)\nmodule.exports = gtr\n","'use strict'\n\nconst outside = require('./outside')\n// Determine if version is less than all the versions possible in the range\nconst ltr = (version, range, options) => outside(version, range, '<', options)\nmodule.exports = ltr\n","'use strict'\n\nconst Range = require('../classes/range')\nconst intersects = (r1, r2, options) => {\n r1 = new Range(r1, options)\n r2 = new Range(r2, options)\n return r1.intersects(r2, options)\n}\nmodule.exports = intersects\n","'use strict'\n\n// given a set of versions and a range, create a \"simplified\" range\n// that includes the same versions that the original range does\n// If the original range is shorter than the simplified one, return that.\nconst satisfies = require('../functions/satisfies.js')\nconst compare = require('../functions/compare.js')\nmodule.exports = (versions, range, options) => {\n const set = []\n let first = null\n let prev = null\n const v = versions.sort((a, b) => compare(a, b, options))\n for (const version of v) {\n const included = satisfies(version, range, options)\n if (included) {\n prev = version\n if (!first) {\n first = version\n }\n } else {\n if (prev) {\n set.push([first, prev])\n }\n prev = null\n first = null\n }\n }\n if (first) {\n set.push([first, null])\n }\n\n const ranges = []\n for (const [min, max] of set) {\n if (min === max) {\n ranges.push(min)\n } else if (!max && min === v[0]) {\n ranges.push('*')\n } else if (!max) {\n ranges.push(`>=${min}`)\n } else if (min === v[0]) {\n ranges.push(`<=${max}`)\n } else {\n ranges.push(`${min} - ${max}`)\n }\n }\n const simplified = ranges.join(' || ')\n const original = typeof range.raw === 'string' ? range.raw : String(range)\n return simplified.length < original.length ? simplified : range\n}\n","'use strict'\n\nconst Range = require('../classes/range.js')\nconst Comparator = require('../classes/comparator.js')\nconst { ANY } = Comparator\nconst satisfies = require('../functions/satisfies.js')\nconst compare = require('../functions/compare.js')\n\n// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:\n// - Every simple range `r1, r2, ...` is a null set, OR\n// - Every simple range `r1, r2, ...` which is not a null set is a subset of\n// some `R1, R2, ...`\n//\n// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:\n// - If c is only the ANY comparator\n// - If C is only the ANY comparator, return true\n// - Else if in prerelease mode, return false\n// - else replace c with `[>=0.0.0]`\n// - If C is only the ANY comparator\n// - if in prerelease mode, return true\n// - else replace C with `[>=0.0.0]`\n// - Let EQ be the set of = comparators in c\n// - If EQ is more than one, return true (null set)\n// - Let GT be the highest > or >= comparator in c\n// - Let LT be the lowest < or <= comparator in c\n// - If GT and LT, and GT.semver > LT.semver, return true (null set)\n// - If any C is a = range, and GT or LT are set, return false\n// - If EQ\n// - If GT, and EQ does not satisfy GT, return true (null set)\n// - If LT, and EQ does not satisfy LT, return true (null set)\n// - If EQ satisfies every C, return true\n// - Else return false\n// - If GT\n// - If GT.semver is lower than any > or >= comp in C, return false\n// - If GT is >=, and GT.semver does not satisfy every C, return false\n// - If GT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the GT.semver tuple, return false\n// - If LT\n// - If LT.semver is greater than any < or <= comp in C, return false\n// - If LT is <=, and LT.semver does not satisfy every C, return false\n// - If LT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the LT.semver tuple, return false\n// - Else return true\n\nconst subset = (sub, dom, options = {}) => {\n if (sub === dom) {\n return true\n }\n\n sub = new Range(sub, options)\n dom = new Range(dom, options)\n let sawNonNull = false\n\n OUTER: for (const simpleSub of sub.set) {\n for (const simpleDom of dom.set) {\n const isSub = simpleSubset(simpleSub, simpleDom, options)\n sawNonNull = sawNonNull || isSub !== null\n if (isSub) {\n continue OUTER\n }\n }\n // the null set is a subset of everything, but null simple ranges in\n // a complex range should be ignored. so if we saw a non-null range,\n // then we know this isn't a subset, but if EVERY simple range was null,\n // then it is a subset.\n if (sawNonNull) {\n return false\n }\n }\n return true\n}\n\nconst minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')]\nconst minimumVersion = [new Comparator('>=0.0.0')]\n\nconst simpleSubset = (sub, dom, options) => {\n if (sub === dom) {\n return true\n }\n\n if (sub.length === 1 && sub[0].semver === ANY) {\n if (dom.length === 1 && dom[0].semver === ANY) {\n return true\n } else if (options.includePrerelease) {\n sub = minimumVersionWithPreRelease\n } else {\n sub = minimumVersion\n }\n }\n\n if (dom.length === 1 && dom[0].semver === ANY) {\n if (options.includePrerelease) {\n return true\n } else {\n dom = minimumVersion\n }\n }\n\n const eqSet = new Set()\n let gt, lt\n for (const c of sub) {\n if (c.operator === '>' || c.operator === '>=') {\n gt = higherGT(gt, c, options)\n } else if (c.operator === '<' || c.operator === '<=') {\n lt = lowerLT(lt, c, options)\n } else {\n eqSet.add(c.semver)\n }\n }\n\n if (eqSet.size > 1) {\n return null\n }\n\n let gtltComp\n if (gt && lt) {\n gtltComp = compare(gt.semver, lt.semver, options)\n if (gtltComp > 0) {\n return null\n } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {\n return null\n }\n }\n\n // will iterate one or zero times\n for (const eq of eqSet) {\n if (gt && !satisfies(eq, String(gt), options)) {\n return null\n }\n\n if (lt && !satisfies(eq, String(lt), options)) {\n return null\n }\n\n for (const c of dom) {\n if (!satisfies(eq, String(c), options)) {\n return false\n }\n }\n\n return true\n }\n\n let higher, lower\n let hasDomLT, hasDomGT\n // if the subset has a prerelease, we need a comparator in the superset\n // with the same tuple and a prerelease, or it's not a subset\n let needDomLTPre = lt &&\n !options.includePrerelease &&\n lt.semver.prerelease.length ? lt.semver : false\n let needDomGTPre = gt &&\n !options.includePrerelease &&\n gt.semver.prerelease.length ? gt.semver : false\n // exception: <1.2.3-0 is the same as <1.2.3\n if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&\n lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {\n needDomLTPre = false\n }\n\n for (const c of dom) {\n hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='\n hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='\n if (gt) {\n if (needDomGTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomGTPre.major &&\n c.semver.minor === needDomGTPre.minor &&\n c.semver.patch === needDomGTPre.patch) {\n needDomGTPre = false\n }\n }\n if (c.operator === '>' || c.operator === '>=') {\n higher = higherGT(gt, c, options)\n if (higher === c && higher !== gt) {\n return false\n }\n } else if (gt.operator === '>=' && !c.test(gt.semver)) {\n return false\n }\n }\n if (lt) {\n if (needDomLTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomLTPre.major &&\n c.semver.minor === needDomLTPre.minor &&\n c.semver.patch === needDomLTPre.patch) {\n needDomLTPre = false\n }\n }\n if (c.operator === '<' || c.operator === '<=') {\n lower = lowerLT(lt, c, options)\n if (lower === c && lower !== lt) {\n return false\n }\n } else if (lt.operator === '<=' && !c.test(lt.semver)) {\n return false\n }\n }\n if (!c.operator && (lt || gt) && gtltComp !== 0) {\n return false\n }\n }\n\n // if there was a < or >, and nothing in the dom, then must be false\n // UNLESS it was limited by another range in the other direction.\n // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0\n if (gt && hasDomLT && !lt && gtltComp !== 0) {\n return false\n }\n\n if (lt && hasDomGT && !gt && gtltComp !== 0) {\n return false\n }\n\n // we needed a prerelease range in a specific tuple, but didn't get one\n // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,\n // because it includes prereleases in the 1.2.3 tuple\n if (needDomGTPre || needDomLTPre) {\n return false\n }\n\n return true\n}\n\n// >=1.2.3 is lower than >1.2.3\nconst higherGT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options)\n return comp > 0 ? a\n : comp < 0 ? b\n : b.operator === '>' && a.operator === '>=' ? b\n : a\n}\n\n// <=1.2.3 is higher than <1.2.3\nconst lowerLT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options)\n return comp < 0 ? a\n : comp > 0 ? b\n : b.operator === '<' && a.operator === '<=' ? b\n : a\n}\n\nmodule.exports = subset\n","'use strict'\n\n// just pre-load all the stuff that index.js lazily exports\nconst internalRe = require('./internal/re')\nconst constants = require('./internal/constants')\nconst SemVer = require('./classes/semver')\nconst identifiers = require('./internal/identifiers')\nconst parse = require('./functions/parse')\nconst valid = require('./functions/valid')\nconst clean = require('./functions/clean')\nconst inc = require('./functions/inc')\nconst diff = require('./functions/diff')\nconst major = require('./functions/major')\nconst minor = require('./functions/minor')\nconst patch = require('./functions/patch')\nconst prerelease = require('./functions/prerelease')\nconst compare = require('./functions/compare')\nconst rcompare = require('./functions/rcompare')\nconst compareLoose = require('./functions/compare-loose')\nconst compareBuild = require('./functions/compare-build')\nconst sort = require('./functions/sort')\nconst rsort = require('./functions/rsort')\nconst gt = require('./functions/gt')\nconst lt = require('./functions/lt')\nconst eq = require('./functions/eq')\nconst neq = require('./functions/neq')\nconst gte = require('./functions/gte')\nconst lte = require('./functions/lte')\nconst cmp = require('./functions/cmp')\nconst coerce = require('./functions/coerce')\nconst truncate = require('./functions/truncate')\nconst Comparator = require('./classes/comparator')\nconst Range = require('./classes/range')\nconst satisfies = require('./functions/satisfies')\nconst toComparators = require('./ranges/to-comparators')\nconst maxSatisfying = require('./ranges/max-satisfying')\nconst minSatisfying = require('./ranges/min-satisfying')\nconst minVersion = require('./ranges/min-version')\nconst validRange = require('./ranges/valid')\nconst outside = require('./ranges/outside')\nconst gtr = require('./ranges/gtr')\nconst ltr = require('./ranges/ltr')\nconst intersects = require('./ranges/intersects')\nconst simplifyRange = require('./ranges/simplify')\nconst subset = require('./ranges/subset')\nmodule.exports = {\n parse,\n valid,\n clean,\n inc,\n diff,\n major,\n minor,\n patch,\n prerelease,\n compare,\n rcompare,\n compareLoose,\n compareBuild,\n sort,\n rsort,\n gt,\n lt,\n eq,\n neq,\n gte,\n lte,\n cmp,\n coerce,\n truncate,\n Comparator,\n Range,\n satisfies,\n toComparators,\n maxSatisfying,\n minSatisfying,\n minVersion,\n validRange,\n outside,\n gtr,\n ltr,\n intersects,\n simplifyRange,\n subset,\n SemVer,\n re: internalRe.re,\n src: internalRe.src,\n tokens: internalRe.t,\n SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,\n RELEASE_TYPES: constants.RELEASE_TYPES,\n compareIdentifiers: identifiers.compareIdentifiers,\n rcompareIdentifiers: identifiers.rcompareIdentifiers,\n}\n","/**\n * Error thrown when encountering an issue during parsing.\n *\n * @public\n */\nexport class ParseError extends Error {\n constructor(message, options) {\n super(message);\n this.name = 'ParseError';\n this.type = options.type;\n this.field = options.field;\n this.value = options.value;\n this.line = options.line;\n }\n}\n//# sourceMappingURL=errors.js.map","/**\n * EventSource/Server-Sent Events parser\n * @see https://html.spec.whatwg.org/multipage/server-sent-events.html\n */\nimport { ParseError } from './errors.js';\n// ASCII codes used in the hot parsing paths.\nconst LF = 10;\nconst CR = 13;\nconst SPACE = 32;\nconst MAX_FIELD_PREFIX_LENGTH = 6;\n/**\n * Creates a new EventSource parser.\n *\n * @param config - Parser configuration. Accepts callbacks (see {@link ParserCallbacks})\n * and options like `maxBufferSize` (see {@link ParserConfig}).\n *\n * @returns A new EventSource parser, with `feed` and `reset` methods.\n * @public\n */\nexport function createParser(config) {\n if (typeof config === 'function') {\n throw new TypeError('`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?');\n }\n const { maxBufferSize, onComment, onError, onEvent, onId, onRetry } = config;\n // Trailing bytes from prior `feed()` calls that did not yet form a complete line.\n // Stored as an array of fragments and only joined when a line terminator arrives.\n // Concatenating per-feed (`prefix + chunk`) is O(N²) when a single SSE line spans\n // many chunks (e.g. a large `data:` payload streamed in tiny slices, or an MCP-style\n // server that emits one giant content block). Buffering as fragments + joining once\n // makes the same workload linear.\n const pendingFragments = [];\n // Running total of `pendingFragments` lengths, kept in sync with the array so the\n // `maxBufferSize` check doesn't have to walk the fragment list on every feed.\n let pendingFragmentsLength = 0;\n // Empty or partial leading BOM; undefined once the BOM check is complete.\n let bomPrefix = '';\n let id;\n let data = '';\n let dataLines = 0;\n let eventType;\n // Set after a `maxBufferSize` overflow. Once tripped, `feed()` throws until\n // `reset()` is called — see the comment on `maxBufferSize` in `ParserConfig`.\n let terminated = false;\n let skippingLine = false;\n // Set when a line (parsed or discarded) was terminated by a trailing `\\r` at the very\n // end of a chunk. That `\\r` is ambiguous: it may be a bare-CR terminator or the first\n // half of a `\\r\\n` whose `\\n` lands in the next chunk. The line itself is complete\n // either way, but we must remember to swallow a single leading `\\n` from the next\n // chunk so the pair is treated as one terminator rather than a blank line (which\n // would dispatch an event prematurely).\n let skipNextLineFeed = false;\n /**\n * Feeds a chunk of the SSE stream to the parser. Any trailing bytes that do\n * not yet form a complete line are held back and prepended to the next chunk,\n * so callers can pass arbitrary slices of the stream without worrying about\n * line boundaries.\n *\n * Per the SSE spec, one leading UTF-8 BOM is stripped before parsing,\n * even when split across chunks. This handles both the raw 3-byte form (0xEF 0xBB\n * 0xBF) and a single decoded U+FEFF, so a leading BOM is ignored regardless of\n * how the caller decoded the bytes.\n *\n * @see https://html.spec.whatwg.org/multipage/server-sent-events.html#parsing-an-event-stream\n */\n function feed(chunk) {\n if (terminated) {\n throw new Error('Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.');\n }\n if (bomPrefix !== undefined) {\n chunk = bomPrefix + chunk;\n // Wait only while the input could still be a raw BOM. Empty chunks must\n // not finish the check, and a mismatched prefix must remain ordinary input.\n if (chunk === '' || chunk === '\\xEF' || chunk === '\\xEF\\xBB') {\n bomPrefix = chunk;\n return;\n }\n bomPrefix = undefined;\n // Strip exactly one leading BOM, in decoded or raw byte-valued form.\n chunk = chunk.replace(/^(?:\\uFEFF|\\xEF\\xBB\\xBF)/, '');\n }\n // Rare resume states from a prior chunk boundary: a pending `\\r\\n` split or a\n // line being discarded. Single combined check keeps the hot path to one branch;\n // the actual handling lives out-of-line in `resumeAfterSkip`.\n if (skippingLine || skipNextLineFeed) {\n chunk = resumeAfterSkip(chunk);\n if (!chunk) {\n return;\n }\n }\n // Hot path: no buffered prefix from a prior partial line. Hand the chunk\n // straight to `processLines`, exactly like the original implementation.\n // Zero new work in the common case (every chunk ends with `\\n\\n`).\n if (!pendingFragments.length) {\n const trailing = processLines(chunk);\n if (trailing !== '') {\n storeTrailing(trailing);\n }\n checkForBufferOverflow();\n return;\n }\n // We have a buffered prefix. If this chunk also has no terminator, append\n // to the buffer without concatenating — that's the O(N²) trap we're\n // avoiding (large single `data:` payload split across many tiny chunks).\n if (chunk.indexOf('\\n') === -1 && chunk.indexOf('\\r') === -1) {\n if (pendingFragmentsLength < MAX_FIELD_PREFIX_LENGTH) {\n const head = pendingFragments.join('') +\n chunk.slice(0, MAX_FIELD_PREFIX_LENGTH - pendingFragmentsLength);\n if (!shouldBufferTrailing(head)) {\n pendingFragments.length = 0;\n pendingFragmentsLength = 0;\n skippingLine = true;\n return;\n }\n }\n pendingFragments.push(chunk);\n pendingFragmentsLength += chunk.length;\n checkForBufferOverflow();\n return;\n }\n // Terminator arrived. Join the accumulated fragments + this chunk once,\n // process, and buffer any new trailing partial line.\n pendingFragments.push(chunk);\n const input = pendingFragments.join('');\n pendingFragments.length = 0;\n pendingFragmentsLength = 0;\n storeTrailing(processLines(input));\n checkForBufferOverflow();\n }\n // Out-of-line handler for the rare post-boundary states. `skipNextLineFeed` means a\n // line (parsed or discarded) ended with a trailing `\\r` at the previous chunk boundary,\n // so a single leading `\\n` must be swallowed to consume a split `\\r\\n` as one terminator.\n // `skippingLine` means we are discarding an invalid line until its terminator arrives.\n // The two states are mutually exclusive. Returns the remaining chunk to parse ('' if\n // this chunk was fully consumed).\n function resumeAfterSkip(chunk) {\n if (chunk.length === 0) {\n return chunk;\n }\n if (skipNextLineFeed) {\n skipNextLineFeed = false;\n return chunk.charCodeAt(0) === LF ? chunk.slice(1) : chunk;\n }\n const crIndex = chunk.indexOf('\\r');\n const lfIndex = chunk.indexOf('\\n');\n const lineEnd = crIndex === -1 ? lfIndex : lfIndex === -1 ? crIndex : crIndex < lfIndex ? crIndex : lfIndex;\n if (lineEnd === -1) {\n return '';\n }\n // Trailing `\\r` at the very end of the chunk: defer the CRLF/CR decision to the\n // next chunk (see `skipNextLineFeed`) rather than greedily consuming just the `\\r`.\n if (lineEnd === chunk.length - 1 && chunk.charCodeAt(lineEnd) === CR) {\n skippingLine = false;\n skipNextLineFeed = true;\n return '';\n }\n skippingLine = false;\n return chunk.slice(lineEnd + (chunk.charCodeAt(lineEnd) === CR && chunk.charCodeAt(lineEnd + 1) === LF ? 2 : 1));\n }\n function storeTrailing(trailing) {\n if (!trailing)\n return;\n // A trailing that ends with `\\r` is not a partial line: the `\\r` terminates it,\n // and only the CRLF-vs-CR ambiguity remains (the matching `\\n` may start the next\n // chunk). Parse the completed line now — buffering it could grow unbounded through\n // the no-terminator append path, and discarding it would eat the terminator and\n // make skip mode swallow the next line.\n if (trailing.charCodeAt(trailing.length - 1) === CR) {\n parseLine(trailing, 0, trailing.length - 1);\n if (checkForBufferOverflow())\n return;\n skipNextLineFeed = true;\n return;\n }\n if (shouldBufferTrailing(trailing)) {\n pendingFragments.push(trailing);\n pendingFragmentsLength = trailing.length;\n return;\n }\n skippingLine = true;\n }\n function shouldBufferTrailing(trailing) {\n const firstCharCode = trailing.charCodeAt(0);\n return ((firstCharCode === 58 && !!onComment) ||\n (firstCharCode === 100 && isPotentialField(trailing, 'data')) ||\n (firstCharCode === 101 && isPotentialField(trailing, 'event')) ||\n (firstCharCode === 105 && isPotentialField(trailing, 'id')) ||\n (firstCharCode === 114 && isPotentialField(trailing, 'retry')));\n }\n // Returns true when parsing must stop for the current chunk (the parser was already\n // terminated or has just overflowed), and false when processing can continue.\n function checkForBufferOverflow() {\n if (terminated)\n return true;\n if (maxBufferSize === undefined)\n return false;\n if (pendingFragmentsLength + data.length <= maxBufferSize)\n return false;\n terminated = true;\n pendingFragments.length = 0;\n pendingFragmentsLength = 0;\n id = undefined;\n data = '';\n dataLines = 0;\n eventType = undefined;\n skippingLine = false;\n skipNextLineFeed = false;\n onError === null || onError === void 0 ? void 0 : onError(new ParseError(`Buffered data exceeded max buffer size of ${maxBufferSize} characters`, {\n type: 'max-buffer-size-exceeded',\n }));\n return true;\n }\n /**\n * Splits `chunk` into SSE lines and dispatches each to the appropriate handler.\n * Returns any trailing bytes that did not terminate with a line break, so the\n * caller can prepend them to the next chunk.\n *\n * The SSE spec permits three line terminators: `\\n`, `\\r`, and `\\r\\n`. Real-world\n * streams almost always use plain `\\n`, so we take a fast path when no `\\r` is\n * present in the chunk. The slow path is spec-correct but does more work per line.\n */\n function processLines(chunk) {\n let searchIndex = 0;\n // Fast path: LF-only chunk (the common case for typical SSE servers).\n // We can scan forward with a single `indexOf('\\n')` per line and inline\n // the hot-path branches for `data:` and `event:` without the CR bookkeeping\n // the slow path needs.\n if (chunk.indexOf('\\r') === -1) {\n let lfIndex = chunk.indexOf('\\n', searchIndex);\n while (lfIndex !== -1) {\n // Blank line: end-of-event marker. Dispatch the accumulated event (if any)\n // and reset the buffered fields. This is hoisted out of `parseLine` because\n // it's the single most common line shape after `data:` lines.\n if (searchIndex === lfIndex) {\n if (id !== undefined) {\n onId === null || onId === void 0 ? void 0 : onId(id);\n }\n if (dataLines > 0) {\n onEvent === null || onEvent === void 0 ? void 0 : onEvent({ id, event: eventType, data });\n }\n id = undefined;\n data = '';\n dataLines = 0;\n eventType = undefined;\n searchIndex = lfIndex + 1;\n lfIndex = chunk.indexOf('\\n', searchIndex);\n continue;\n }\n const firstCharCode = chunk.charCodeAt(searchIndex);\n if (isDataPrefix(chunk, searchIndex, firstCharCode)) {\n // `data:` line — append the value to the event's data buffer.\n // 'data:'.length === 5, 'data: '.length === 6\n const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5;\n const value = chunk.slice(valueStart, lfIndex);\n // Fast path within a fast path: if this is the first data line AND the\n // next char is another LF (i.e. `data:foo\\n\\n`), dispatch immediately\n // without ever writing to the `data` buffer. This is the shape of a\n // typical single-line SSE event (ChatGPT-style streams, etc.) and is\n // hot enough to be worth the duplication.\n if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {\n if (id !== undefined) {\n onId === null || onId === void 0 ? void 0 : onId(id);\n }\n onEvent === null || onEvent === void 0 ? void 0 : onEvent({ id, event: eventType, data: value });\n id = undefined;\n data = '';\n eventType = undefined;\n searchIndex = lfIndex + 2;\n lfIndex = chunk.indexOf('\\n', searchIndex);\n continue;\n }\n // Multi-line data: concatenate with newline separator per spec.\n data = dataLines === 0 ? value : `${data}\\n${value}`;\n dataLines++;\n }\n else if (isEventPrefix(chunk, searchIndex, firstCharCode)) {\n // `event:` line — set the event type for the next dispatch. Per spec,\n // an empty value resets `event type` to its default (undefined here).\n // 'event:'.length === 6, 'event: '.length === 7\n eventType =\n chunk.slice(chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6, lfIndex) || undefined;\n }\n else {\n // Everything else: `id:`, `retry:`, comment lines (`:` prefix), unknown\n // fields, or malformed lines. These are rarer and go through the full\n // per-line parser, which handles the SSE field grammar in detail.\n parseLine(chunk, searchIndex, lfIndex);\n }\n if (checkForBufferOverflow())\n return '';\n searchIndex = lfIndex + 1;\n lfIndex = chunk.indexOf('\\n', searchIndex);\n }\n return chunk.slice(searchIndex);\n }\n // Slow path: the chunk contains at least one `\\r`, so lines may be terminated\n // by `\\r`, `\\n`, or `\\r\\n`. We locate the next terminator by looking at both\n // the nearest `\\r` and `\\n` and picking whichever comes first.\n let crIndex = chunk.indexOf('\\r', searchIndex);\n let lfIndex = chunk.indexOf('\\n', searchIndex);\n while (searchIndex < chunk.length) {\n let lineEnd = -1;\n if (crIndex !== -1 && lfIndex !== -1) {\n lineEnd = crIndex < lfIndex ? crIndex : lfIndex;\n }\n else if (crIndex !== -1) {\n // A trailing `\\r` at the very end of the chunk is ambiguous: it could be\n // a bare-CR terminator, or the first half of a `\\r\\n` whose `\\n` arrives\n // in the next chunk. Defer until we see more input.\n if (crIndex === chunk.length - 1) {\n lineEnd = -1;\n }\n else {\n lineEnd = crIndex;\n }\n }\n else if (lfIndex !== -1) {\n lineEnd = lfIndex;\n }\n if (lineEnd === -1) {\n break;\n }\n parseLine(chunk, searchIndex, lineEnd);\n if (checkForBufferOverflow())\n return '';\n searchIndex = lineEnd + 1;\n // If we just consumed a `\\r` and the next char is `\\n`, skip it so the\n // pair is treated as a single terminator rather than an empty line.\n if (chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF) {\n searchIndex++;\n }\n // Reuse unconsumed matches and failed searches instead of rescanning the suffix.\n if (crIndex !== -1 && crIndex < searchIndex) {\n crIndex = chunk.indexOf('\\r', searchIndex);\n }\n if (lfIndex !== -1 && lfIndex < searchIndex) {\n lfIndex = chunk.indexOf('\\n', searchIndex);\n }\n }\n return chunk.slice(searchIndex);\n }\n function parseLine(chunk, start, end) {\n if (start === end) {\n dispatchEvent();\n return;\n }\n const firstCharCode = chunk.charCodeAt(start);\n if (isDataPrefix(chunk, start, firstCharCode)) {\n // 'data:'.length === 5, 'data: '.length === 6\n const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5;\n const value = chunk.slice(valueStart, end);\n data = dataLines === 0 ? value : `${data}\\n${value}`;\n dataLines++;\n return;\n }\n if (isEventPrefix(chunk, start, firstCharCode)) {\n // 'event:'.length === 6, 'event: '.length === 7\n eventType =\n chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || undefined;\n return;\n }\n // Fast path for \"id:\" — 'i' = 105, 'd' = 100, ':' = 58\n if (firstCharCode === 105 &&\n chunk.charCodeAt(start + 1) === 100 &&\n chunk.charCodeAt(start + 2) === 58) {\n // 'id:'.length === 3, 'id: '.length === 4\n const value = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);\n // If the field value does not contain U+0000 NULL, then set the `ID` buffer to\n // the field value. Otherwise, ignore the field.\n if (!value.includes('\\0'))\n id = value;\n return;\n }\n // Comment line — ':' = 58\n if (firstCharCode === 58) {\n if (onComment) {\n const line = chunk.slice(start, end);\n // skip ':' (+1), or ': ' (+2) when a space follows\n onComment(line.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1));\n }\n return;\n }\n const line = chunk.slice(start, end);\n const fieldSeparatorIndex = line.indexOf(':');\n if (fieldSeparatorIndex === -1) {\n processField(line, '', line);\n return;\n }\n const field = line.slice(0, fieldSeparatorIndex);\n // skip ':' (+1), or ': ' (+2) when a space follows\n const offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1;\n const value = line.slice(fieldSeparatorIndex + offset);\n processField(field, value, line);\n }\n function processField(field, value, line) {\n // Field names must be compared literally, with no case folding performed.\n switch (field) {\n case 'event':\n // Set the `event type` buffer to field value\n eventType = value || undefined;\n break;\n case 'data':\n data = dataLines === 0 ? value : `${data}\\n${value}`;\n dataLines++;\n break;\n case 'id':\n // If the field value does not contain U+0000 NULL, then set the `ID` buffer to\n // the field value. Otherwise, ignore the field.\n if (!value.includes('\\0'))\n id = value;\n break;\n case 'retry':\n // If the field value consists of only ASCII digits, then interpret the field value as an\n // integer in base ten, and set the event stream's reconnection time to that integer.\n // Otherwise, ignore the field.\n if (/^\\d+$/.test(value)) {\n onRetry === null || onRetry === void 0 ? void 0 : onRetry(parseInt(value, 10));\n }\n else {\n onError === null || onError === void 0 ? void 0 : onError(new ParseError(`Invalid \\`retry\\` value: \"${value}\"`, {\n type: 'invalid-retry',\n value,\n line,\n }));\n }\n break;\n default:\n // Otherwise, the field is ignored.\n onError === null || onError === void 0 ? void 0 : onError(new ParseError(`Unknown field \"${field.length > 20 ? `${field.slice(0, 20)}…` : field}\"`, { type: 'unknown-field', field, value, line }));\n break;\n }\n }\n function dispatchEvent() {\n if (id !== undefined) {\n onId === null || onId === void 0 ? void 0 : onId(id);\n }\n if (dataLines > 0) {\n onEvent === null || onEvent === void 0 ? void 0 : onEvent({\n id,\n event: eventType,\n data,\n });\n }\n id = undefined;\n data = '';\n dataLines = 0;\n eventType = undefined;\n }\n function reset(options = {}) {\n if (options.consume && pendingFragments.length > 0) {\n const incompleteLine = pendingFragments.join('');\n parseLine(incompleteLine, 0, incompleteLine.length);\n }\n bomPrefix = '';\n id = undefined;\n data = '';\n dataLines = 0;\n eventType = undefined;\n pendingFragments.length = 0;\n pendingFragmentsLength = 0;\n terminated = false;\n skippingLine = false;\n skipNextLineFeed = false;\n }\n return { feed, reset };\n}\n/**\n * Checks if `chunk` starts with the literal `data:` at index `i`.\n *\n * Equivalent to `chunk.startsWith('data:', i)`, but benchmarks show this\n * hand-unrolled char-code comparison is ~20% faster on common event types.\n * The caller passes `firstCharCode` (the code at `i`) so it can be reused\n * across prefix checks.\n *\n * ASCII: 'd' = 100, 'a' = 97, 't' = 116, 'a' = 97, ':' = 58\n */\nfunction isDataPrefix(chunk, i, firstCharCode) {\n return (firstCharCode === 100 &&\n chunk.charCodeAt(i + 1) === 97 &&\n chunk.charCodeAt(i + 2) === 116 &&\n chunk.charCodeAt(i + 3) === 97 &&\n chunk.charCodeAt(i + 4) === 58);\n}\n/**\n * Checks if `chunk` starts with the literal `event:` at index `i`.\n *\n * See {@link isDataPrefix} for why this is hand-unrolled rather than using\n * `String.prototype.startsWith`.\n *\n * ASCII: 'e' = 101, 'v' = 118, 'e' = 101, 'n' = 110, 't' = 116, ':' = 58\n */\nfunction isEventPrefix(chunk, i, firstCharCode) {\n return (firstCharCode === 101 &&\n chunk.charCodeAt(i + 1) === 118 &&\n chunk.charCodeAt(i + 2) === 101 &&\n chunk.charCodeAt(i + 3) === 110 &&\n chunk.charCodeAt(i + 4) === 116 &&\n chunk.charCodeAt(i + 5) === 58);\n}\nfunction isPotentialField(line, field) {\n let i = 1;\n while (i < line.length && i < field.length) {\n if (line.charCodeAt(i) !== field.charCodeAt(i)) {\n return false;\n }\n i++;\n }\n return line.length <= field.length || line.charCodeAt(field.length) === 58;\n}\n//# sourceMappingURL=parse.js.map","//#region packages/fast-memoize/index.ts\nfunction memoize(fn, options) {\n\tconst cache = options && options.cache ? options.cache : cacheDefault;\n\tconst serializer = options && options.serializer ? options.serializer : serializerDefault;\n\treturn (options && options.strategy ? options.strategy : strategyDefault)(fn, {\n\t\tcache,\n\t\tserializer\n\t});\n}\nfunction isPrimitive(value) {\n\treturn value == null || typeof value === \"number\" || typeof value === \"boolean\";\n}\nfunction monadic(fn, cache, serializer, arg) {\n\tconst cacheKey = isPrimitive(arg) ? arg : serializer(arg);\n\tlet computedValue = cache.get(cacheKey);\n\tif (typeof computedValue === \"undefined\") {\n\t\tcomputedValue = fn.call(this, arg);\n\t\tcache.set(cacheKey, computedValue);\n\t}\n\treturn computedValue;\n}\nfunction variadic(fn, cache, serializer) {\n\tconst args = Array.prototype.slice.call(arguments, 3);\n\tconst cacheKey = serializer(args);\n\tlet computedValue = cache.get(cacheKey);\n\tif (typeof computedValue === \"undefined\") {\n\t\tcomputedValue = fn.apply(this, args);\n\t\tcache.set(cacheKey, computedValue);\n\t}\n\treturn computedValue;\n}\nfunction assemble(fn, context, strategy, cache, serialize) {\n\treturn strategy.bind(context, fn, cache, serialize);\n}\nfunction strategyDefault(fn, options) {\n\tconst strategy = fn.length === 1 ? monadic : variadic;\n\treturn assemble(fn, this, strategy, options.cache.create(), options.serializer);\n}\nfunction strategyVariadic(fn, options) {\n\treturn assemble(fn, this, variadic, options.cache.create(), options.serializer);\n}\nfunction strategyMonadic(fn, options) {\n\treturn assemble(fn, this, monadic, options.cache.create(), options.serializer);\n}\nconst serializerDefault = function() {\n\treturn JSON.stringify(arguments);\n};\nvar ObjectWithoutPrototypeCache = class {\n\tconstructor() {\n\t\tthis.cache = Object.create(null);\n\t}\n\tget(key) {\n\t\treturn this.cache[key];\n\t}\n\tset(key, value) {\n\t\tthis.cache[key] = value;\n\t}\n};\nconst cacheDefault = { create: function create() {\n\treturn new ObjectWithoutPrototypeCache();\n} };\nconst strategies = {\n\tvariadic: strategyVariadic,\n\tmonadic: strategyMonadic\n};\n//#endregion\nexport { memoize, strategies };\n\n//# sourceMappingURL=index.js.map","//#region packages/icu-skeleton-parser/date-time.ts\n/**\n* https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n* Credit: https://github.com/caridy/intl-datetimeformat-pattern/blob/master/index.js\n* with some tweaks\n*/\nconst DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;\n/**\n* Parse Date time skeleton into Intl.DateTimeFormatOptions\n* Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n* @public\n* @param skeleton skeleton string\n*/\nfunction parseDateTimeSkeleton(skeleton) {\n\tconst result = {};\n\tskeleton.replace(DATE_TIME_REGEX, (match) => {\n\t\tconst len = match.length;\n\t\tswitch (match[0]) {\n\t\t\tcase \"G\":\n\t\t\t\tresult.era = len === 4 ? \"long\" : len === 5 ? \"narrow\" : \"short\";\n\t\t\t\tbreak;\n\t\t\tcase \"y\":\n\t\t\t\tresult.year = len === 2 ? \"2-digit\" : \"numeric\";\n\t\t\t\tbreak;\n\t\t\tcase \"Y\":\n\t\t\tcase \"u\":\n\t\t\tcase \"U\":\n\t\t\tcase \"r\": throw new RangeError(\"`Y/u/U/r` (year) patterns are not supported, use `y` instead\");\n\t\t\tcase \"q\":\n\t\t\tcase \"Q\": throw new RangeError(\"`q/Q` (quarter) patterns are not supported\");\n\t\t\tcase \"M\":\n\t\t\tcase \"L\":\n\t\t\t\tresult.month = [\n\t\t\t\t\t\"numeric\",\n\t\t\t\t\t\"2-digit\",\n\t\t\t\t\t\"short\",\n\t\t\t\t\t\"long\",\n\t\t\t\t\t\"narrow\"\n\t\t\t\t][len - 1];\n\t\t\t\tbreak;\n\t\t\tcase \"w\":\n\t\t\tcase \"W\": throw new RangeError(\"`w/W` (week) patterns are not supported\");\n\t\t\tcase \"d\":\n\t\t\t\tresult.day = [\"numeric\", \"2-digit\"][len - 1];\n\t\t\t\tbreak;\n\t\t\tcase \"D\":\n\t\t\tcase \"F\":\n\t\t\tcase \"g\": throw new RangeError(\"`D/F/g` (day) patterns are not supported, use `d` instead\");\n\t\t\tcase \"E\":\n\t\t\t\tresult.weekday = len === 4 ? \"long\" : len === 5 ? \"narrow\" : \"short\";\n\t\t\t\tbreak;\n\t\t\tcase \"e\":\n\t\t\t\tif (len < 4) throw new RangeError(\"`e..eee` (weekday) patterns are not supported\");\n\t\t\t\tresult.weekday = [\n\t\t\t\t\t\"short\",\n\t\t\t\t\t\"long\",\n\t\t\t\t\t\"narrow\",\n\t\t\t\t\t\"short\"\n\t\t\t\t][len - 3];\n\t\t\t\tbreak;\n\t\t\tcase \"c\":\n\t\t\t\tif (len < 4) throw new RangeError(\"`c..ccc` (weekday) patterns are not supported\");\n\t\t\t\tresult.weekday = [\n\t\t\t\t\t\"short\",\n\t\t\t\t\t\"long\",\n\t\t\t\t\t\"narrow\",\n\t\t\t\t\t\"short\"\n\t\t\t\t][len - 3];\n\t\t\t\tbreak;\n\t\t\tcase \"a\":\n\t\t\t\tresult.hour12 = true;\n\t\t\t\tbreak;\n\t\t\tcase \"b\":\n\t\t\tcase \"B\": throw new RangeError(\"`b/B` (period) patterns are not supported, use `a` instead\");\n\t\t\tcase \"h\":\n\t\t\t\tresult.hourCycle = \"h12\";\n\t\t\t\tresult.hour = [\"numeric\", \"2-digit\"][len - 1];\n\t\t\t\tbreak;\n\t\t\tcase \"H\":\n\t\t\t\tresult.hourCycle = \"h23\";\n\t\t\t\tresult.hour = [\"numeric\", \"2-digit\"][len - 1];\n\t\t\t\tbreak;\n\t\t\tcase \"K\":\n\t\t\t\tresult.hourCycle = \"h11\";\n\t\t\t\tresult.hour = [\"numeric\", \"2-digit\"][len - 1];\n\t\t\t\tbreak;\n\t\t\tcase \"k\":\n\t\t\t\tresult.hourCycle = \"h24\";\n\t\t\t\tresult.hour = [\"numeric\", \"2-digit\"][len - 1];\n\t\t\t\tbreak;\n\t\t\tcase \"j\":\n\t\t\tcase \"J\":\n\t\t\tcase \"C\": throw new RangeError(\"`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead\");\n\t\t\tcase \"m\":\n\t\t\t\tresult.minute = [\"numeric\", \"2-digit\"][len - 1];\n\t\t\t\tbreak;\n\t\t\tcase \"s\":\n\t\t\t\tresult.second = [\"numeric\", \"2-digit\"][len - 1];\n\t\t\t\tbreak;\n\t\t\tcase \"S\":\n\t\t\tcase \"A\": throw new RangeError(\"`S/A` (second) patterns are not supported, use `s` instead\");\n\t\t\tcase \"z\":\n\t\t\t\tresult.timeZoneName = len < 4 ? \"short\" : \"long\";\n\t\t\t\tbreak;\n\t\t\tcase \"Z\":\n\t\t\tcase \"O\":\n\t\t\tcase \"v\":\n\t\t\tcase \"V\":\n\t\t\tcase \"X\":\n\t\t\tcase \"x\": throw new RangeError(\"`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead\");\n\t\t}\n\t\treturn \"\";\n\t});\n\treturn result;\n}\n//#endregion\n//#region node_modules/.aspect_rules_js/@formatjs_generated+unicode@0.0.0/node_modules/@formatjs_generated/unicode/icu-skeleton-parser-regex.js\nconst WHITE_SPACE_REGEX = /[\\t-\\r \\x85\\u200E\\u200F\\u2028\\u2029]/i;\n//#endregion\n//#region packages/icu-skeleton-parser/number.ts\nfunction parseNumberSkeletonFromString(skeleton) {\n\tif (skeleton.length === 0) throw new Error(\"Number skeleton cannot be empty\");\n\tconst stringTokens = skeleton.split(WHITE_SPACE_REGEX).filter((x) => x.length > 0);\n\tconst tokens = [];\n\tfor (const stringToken of stringTokens) {\n\t\tlet stemAndOptions = stringToken.split(\"/\");\n\t\tif (stemAndOptions.length === 0) throw new Error(\"Invalid number skeleton\");\n\t\tconst [stem, ...options] = stemAndOptions;\n\t\tfor (const option of options) if (option.length === 0) throw new Error(\"Invalid number skeleton\");\n\t\ttokens.push({\n\t\t\tstem,\n\t\t\toptions\n\t\t});\n\t}\n\treturn tokens;\n}\nfunction icuUnitToEcma(unit) {\n\treturn unit.replace(/^(.*?)-/, \"\");\n}\nconst FRACTION_PRECISION_REGEX = /^\\.(?:(0+)(\\*)?|(#+)|(0+)(#+))$/g;\nconst SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\\+|#+)?[rs]?$/g;\nconst INTEGER_WIDTH_REGEX = /(\\*)(0+)|(#+)(0+)|(0+)/g;\nconst CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;\nfunction parseSignificantPrecision(str) {\n\tconst result = {};\n\tif (str[str.length - 1] === \"r\") result.roundingPriority = \"morePrecision\";\n\telse if (str[str.length - 1] === \"s\") result.roundingPriority = \"lessPrecision\";\n\tstr.replace(SIGNIFICANT_PRECISION_REGEX, function(_, g1, g2) {\n\t\tif (typeof g2 !== \"string\") {\n\t\t\tresult.minimumSignificantDigits = g1.length;\n\t\t\tresult.maximumSignificantDigits = g1.length;\n\t\t} else if (g2 === \"+\") result.minimumSignificantDigits = g1.length;\n\t\telse if (g1[0] === \"#\") result.maximumSignificantDigits = g1.length;\n\t\telse {\n\t\t\tresult.minimumSignificantDigits = g1.length;\n\t\t\tresult.maximumSignificantDigits = g1.length + (typeof g2 === \"string\" ? g2.length : 0);\n\t\t}\n\t\treturn \"\";\n\t});\n\treturn result;\n}\nfunction parseSign(str) {\n\tswitch (str) {\n\t\tcase \"sign-auto\": return { signDisplay: \"auto\" };\n\t\tcase \"sign-accounting\":\n\t\tcase \"()\": return { currencySign: \"accounting\" };\n\t\tcase \"sign-always\":\n\t\tcase \"+!\": return { signDisplay: \"always\" };\n\t\tcase \"sign-accounting-always\":\n\t\tcase \"()!\": return {\n\t\t\tsignDisplay: \"always\",\n\t\t\tcurrencySign: \"accounting\"\n\t\t};\n\t\tcase \"sign-except-zero\":\n\t\tcase \"+?\": return { signDisplay: \"exceptZero\" };\n\t\tcase \"sign-accounting-except-zero\":\n\t\tcase \"()?\": return {\n\t\t\tsignDisplay: \"exceptZero\",\n\t\t\tcurrencySign: \"accounting\"\n\t\t};\n\t\tcase \"sign-never\":\n\t\tcase \"+_\": return { signDisplay: \"never\" };\n\t}\n}\nfunction parseConciseScientificAndEngineeringStem(stem) {\n\tlet result;\n\tif (stem[0] === \"E\" && stem[1] === \"E\") {\n\t\tresult = { notation: \"engineering\" };\n\t\tstem = stem.slice(2);\n\t} else if (stem[0] === \"E\") {\n\t\tresult = { notation: \"scientific\" };\n\t\tstem = stem.slice(1);\n\t}\n\tif (result) {\n\t\tconst signDisplay = stem.slice(0, 2);\n\t\tif (signDisplay === \"+!\") {\n\t\t\tresult.signDisplay = \"always\";\n\t\t\tstem = stem.slice(2);\n\t\t} else if (signDisplay === \"+?\") {\n\t\t\tresult.signDisplay = \"exceptZero\";\n\t\t\tstem = stem.slice(2);\n\t\t}\n\t\tif (!CONCISE_INTEGER_WIDTH_REGEX.test(stem)) throw new Error(\"Malformed concise eng/scientific notation\");\n\t\tresult.minimumIntegerDigits = stem.length;\n\t}\n\treturn result;\n}\nfunction parseNotationOptions(opt) {\n\tconst result = {};\n\tconst signOpts = parseSign(opt);\n\tif (signOpts) return signOpts;\n\treturn result;\n}\n/**\n* https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md#skeleton-stems-and-options\n*/\nfunction parseNumberSkeleton(tokens) {\n\tlet result = {};\n\tfor (const token of tokens) {\n\t\tswitch (token.stem) {\n\t\t\tcase \"percent\":\n\t\t\tcase \"%\":\n\t\t\t\tresult.style = \"percent\";\n\t\t\t\tcontinue;\n\t\t\tcase \"%x100\":\n\t\t\t\tresult.style = \"percent\";\n\t\t\t\tresult.scale = 100;\n\t\t\t\tcontinue;\n\t\t\tcase \"currency\":\n\t\t\t\tresult.style = \"currency\";\n\t\t\t\tresult.currency = token.options[0];\n\t\t\t\tcontinue;\n\t\t\tcase \"group-off\":\n\t\t\tcase \",_\":\n\t\t\t\tresult.useGrouping = false;\n\t\t\t\tcontinue;\n\t\t\tcase \"precision-integer\":\n\t\t\tcase \".\":\n\t\t\t\tresult.maximumFractionDigits = 0;\n\t\t\t\tcontinue;\n\t\t\tcase \"measure-unit\":\n\t\t\tcase \"unit\":\n\t\t\t\tresult.style = \"unit\";\n\t\t\t\tresult.unit = icuUnitToEcma(token.options[0]);\n\t\t\t\tcontinue;\n\t\t\tcase \"compact-short\":\n\t\t\tcase \"K\":\n\t\t\t\tresult.notation = \"compact\";\n\t\t\t\tresult.compactDisplay = \"short\";\n\t\t\t\tcontinue;\n\t\t\tcase \"compact-long\":\n\t\t\tcase \"KK\":\n\t\t\t\tresult.notation = \"compact\";\n\t\t\t\tresult.compactDisplay = \"long\";\n\t\t\t\tcontinue;\n\t\t\tcase \"scientific\":\n\t\t\t\tresult = {\n\t\t\t\t\t...result,\n\t\t\t\t\tnotation: \"scientific\",\n\t\t\t\t\t...token.options.reduce((all, opt) => ({\n\t\t\t\t\t\t...all,\n\t\t\t\t\t\t...parseNotationOptions(opt)\n\t\t\t\t\t}), {})\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\tcase \"engineering\":\n\t\t\t\tresult = {\n\t\t\t\t\t...result,\n\t\t\t\t\tnotation: \"engineering\",\n\t\t\t\t\t...token.options.reduce((all, opt) => ({\n\t\t\t\t\t\t...all,\n\t\t\t\t\t\t...parseNotationOptions(opt)\n\t\t\t\t\t}), {})\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\tcase \"notation-simple\":\n\t\t\t\tresult.notation = \"standard\";\n\t\t\t\tcontinue;\n\t\t\tcase \"unit-width-narrow\":\n\t\t\t\tresult.currencyDisplay = \"narrowSymbol\";\n\t\t\t\tresult.unitDisplay = \"narrow\";\n\t\t\t\tcontinue;\n\t\t\tcase \"unit-width-short\":\n\t\t\t\tresult.currencyDisplay = \"code\";\n\t\t\t\tresult.unitDisplay = \"short\";\n\t\t\t\tcontinue;\n\t\t\tcase \"unit-width-full-name\":\n\t\t\t\tresult.currencyDisplay = \"name\";\n\t\t\t\tresult.unitDisplay = \"long\";\n\t\t\t\tcontinue;\n\t\t\tcase \"unit-width-iso-code\":\n\t\t\t\tresult.currencyDisplay = \"symbol\";\n\t\t\t\tcontinue;\n\t\t\tcase \"scale\":\n\t\t\t\tresult.scale = parseFloat(token.options[0]);\n\t\t\t\tcontinue;\n\t\t\tcase \"rounding-mode-floor\":\n\t\t\t\tresult.roundingMode = \"floor\";\n\t\t\t\tcontinue;\n\t\t\tcase \"rounding-mode-ceiling\":\n\t\t\t\tresult.roundingMode = \"ceil\";\n\t\t\t\tcontinue;\n\t\t\tcase \"rounding-mode-down\":\n\t\t\t\tresult.roundingMode = \"trunc\";\n\t\t\t\tcontinue;\n\t\t\tcase \"rounding-mode-up\":\n\t\t\t\tresult.roundingMode = \"expand\";\n\t\t\t\tcontinue;\n\t\t\tcase \"rounding-mode-half-even\":\n\t\t\t\tresult.roundingMode = \"halfEven\";\n\t\t\t\tcontinue;\n\t\t\tcase \"rounding-mode-half-down\":\n\t\t\t\tresult.roundingMode = \"halfTrunc\";\n\t\t\t\tcontinue;\n\t\t\tcase \"rounding-mode-half-up\":\n\t\t\t\tresult.roundingMode = \"halfExpand\";\n\t\t\t\tcontinue;\n\t\t\tcase \"integer-width\":\n\t\t\t\tif (token.options.length > 1) throw new RangeError(\"integer-width stems only accept a single optional option\");\n\t\t\t\ttoken.options[0].replace(INTEGER_WIDTH_REGEX, function(_, g1, g2, g3, g4, g5) {\n\t\t\t\t\tif (g1) result.minimumIntegerDigits = g2.length;\n\t\t\t\t\telse if (g3 && g4) throw new Error(\"We currently do not support maximum integer digits\");\n\t\t\t\t\telse if (g5) throw new Error(\"We currently do not support exact integer digits\");\n\t\t\t\t\treturn \"\";\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t}\n\t\tif (CONCISE_INTEGER_WIDTH_REGEX.test(token.stem)) {\n\t\t\tresult.minimumIntegerDigits = token.stem.length;\n\t\t\tcontinue;\n\t\t}\n\t\tif (FRACTION_PRECISION_REGEX.test(token.stem)) {\n\t\t\tif (token.options.length > 1) throw new RangeError(\"Fraction-precision stems only accept a single optional option\");\n\t\t\ttoken.stem.replace(FRACTION_PRECISION_REGEX, function(_, g1, g2, g3, g4, g5) {\n\t\t\t\tif (g2 === \"*\") result.minimumFractionDigits = g1.length;\n\t\t\t\telse if (g3 && g3[0] === \"#\") result.maximumFractionDigits = g3.length;\n\t\t\t\telse if (g4 && g5) {\n\t\t\t\t\tresult.minimumFractionDigits = g4.length;\n\t\t\t\t\tresult.maximumFractionDigits = g4.length + g5.length;\n\t\t\t\t} else {\n\t\t\t\t\tresult.minimumFractionDigits = g1.length;\n\t\t\t\t\tresult.maximumFractionDigits = g1.length;\n\t\t\t\t}\n\t\t\t\treturn \"\";\n\t\t\t});\n\t\t\tconst opt = token.options[0];\n\t\t\tif (opt === \"w\") result = {\n\t\t\t\t...result,\n\t\t\t\ttrailingZeroDisplay: \"stripIfInteger\"\n\t\t\t};\n\t\t\telse if (opt) result = {\n\t\t\t\t...result,\n\t\t\t\t...parseSignificantPrecision(opt)\n\t\t\t};\n\t\t\tcontinue;\n\t\t}\n\t\tif (SIGNIFICANT_PRECISION_REGEX.test(token.stem)) {\n\t\t\tresult = {\n\t\t\t\t...result,\n\t\t\t\t...parseSignificantPrecision(token.stem)\n\t\t\t};\n\t\t\tcontinue;\n\t\t}\n\t\tconst signOpts = parseSign(token.stem);\n\t\tif (signOpts) result = {\n\t\t\t...result,\n\t\t\t...signOpts\n\t\t};\n\t\tconst conciseScientificAndEngineeringOpts = parseConciseScientificAndEngineeringStem(token.stem);\n\t\tif (conciseScientificAndEngineeringOpts) result = {\n\t\t\t...result,\n\t\t\t...conciseScientificAndEngineeringOpts\n\t\t};\n\t}\n\treturn result;\n}\n//#endregion\nexport { parseDateTimeSkeleton, parseNumberSkeleton, parseNumberSkeletonFromString };\n\n//# sourceMappingURL=index.js.map","import { parseDateTimeSkeleton, parseNumberSkeleton, parseNumberSkeletonFromString } from \"@formatjs/icu-skeleton-parser\";\n//#region packages/icu-messageformat-parser/error.ts\nlet ErrorKind = /* @__PURE__ */ function(ErrorKind) {\n\t/** Argument is unclosed (e.g. `{0`) */\n\tErrorKind[ErrorKind[\"EXPECT_ARGUMENT_CLOSING_BRACE\"] = 1] = \"EXPECT_ARGUMENT_CLOSING_BRACE\";\n\t/** Argument is empty (e.g. `{}`). */\n\tErrorKind[ErrorKind[\"EMPTY_ARGUMENT\"] = 2] = \"EMPTY_ARGUMENT\";\n\t/** Argument is malformed (e.g. `{foo!}``) */\n\tErrorKind[ErrorKind[\"MALFORMED_ARGUMENT\"] = 3] = \"MALFORMED_ARGUMENT\";\n\t/** Expect an argument type (e.g. `{foo,}`) */\n\tErrorKind[ErrorKind[\"EXPECT_ARGUMENT_TYPE\"] = 4] = \"EXPECT_ARGUMENT_TYPE\";\n\t/** Unsupported argument type (e.g. `{foo,foo}`) */\n\tErrorKind[ErrorKind[\"INVALID_ARGUMENT_TYPE\"] = 5] = \"INVALID_ARGUMENT_TYPE\";\n\t/** Expect an argument style (e.g. `{foo, number, }`) */\n\tErrorKind[ErrorKind[\"EXPECT_ARGUMENT_STYLE\"] = 6] = \"EXPECT_ARGUMENT_STYLE\";\n\t/** The number skeleton is invalid. */\n\tErrorKind[ErrorKind[\"INVALID_NUMBER_SKELETON\"] = 7] = \"INVALID_NUMBER_SKELETON\";\n\t/** The date time skeleton is invalid. */\n\tErrorKind[ErrorKind[\"INVALID_DATE_TIME_SKELETON\"] = 8] = \"INVALID_DATE_TIME_SKELETON\";\n\t/** Exepct a number skeleton following the `::` (e.g. `{foo, number, ::}`) */\n\tErrorKind[ErrorKind[\"EXPECT_NUMBER_SKELETON\"] = 9] = \"EXPECT_NUMBER_SKELETON\";\n\t/** Exepct a date time skeleton following the `::` (e.g. `{foo, date, ::}`) */\n\tErrorKind[ErrorKind[\"EXPECT_DATE_TIME_SKELETON\"] = 10] = \"EXPECT_DATE_TIME_SKELETON\";\n\t/** Unmatched apostrophes in the argument style (e.g. `{foo, number, 'test`) */\n\tErrorKind[ErrorKind[\"UNCLOSED_QUOTE_IN_ARGUMENT_STYLE\"] = 11] = \"UNCLOSED_QUOTE_IN_ARGUMENT_STYLE\";\n\t/** Missing select argument options (e.g. `{foo, select}`) */\n\tErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_OPTIONS\"] = 12] = \"EXPECT_SELECT_ARGUMENT_OPTIONS\";\n\t/** Expecting an offset value in `plural` or `selectordinal` argument (e.g `{foo, plural, offset}`) */\n\tErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE\"] = 13] = \"EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE\";\n\t/** Offset value in `plural` or `selectordinal` is invalid (e.g. `{foo, plural, offset: x}`) */\n\tErrorKind[ErrorKind[\"INVALID_PLURAL_ARGUMENT_OFFSET_VALUE\"] = 14] = \"INVALID_PLURAL_ARGUMENT_OFFSET_VALUE\";\n\t/** Expecting a selector in `select` argument (e.g `{foo, select}`) */\n\tErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_SELECTOR\"] = 15] = \"EXPECT_SELECT_ARGUMENT_SELECTOR\";\n\t/** Expecting a selector in `plural` or `selectordinal` argument (e.g `{foo, plural}`) */\n\tErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_SELECTOR\"] = 16] = \"EXPECT_PLURAL_ARGUMENT_SELECTOR\";\n\t/** Expecting a message fragment after the `select` selector (e.g. `{foo, select, apple}`) */\n\tErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\"] = 17] = \"EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\";\n\t/**\n\t* Expecting a message fragment after the `plural` or `selectordinal` selector\n\t* (e.g. `{foo, plural, one}`)\n\t*/\n\tErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT\"] = 18] = \"EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT\";\n\t/** Selector in `plural` or `selectordinal` is malformed (e.g. `{foo, plural, =x {#}}`) */\n\tErrorKind[ErrorKind[\"INVALID_PLURAL_ARGUMENT_SELECTOR\"] = 19] = \"INVALID_PLURAL_ARGUMENT_SELECTOR\";\n\t/**\n\t* Duplicate selectors in `plural` or `selectordinal` argument.\n\t* (e.g. {foo, plural, one {#} one {#}})\n\t*/\n\tErrorKind[ErrorKind[\"DUPLICATE_PLURAL_ARGUMENT_SELECTOR\"] = 20] = \"DUPLICATE_PLURAL_ARGUMENT_SELECTOR\";\n\t/** Duplicate selectors in `select` argument.\n\t* (e.g. {foo, select, apple {apple} apple {apple}})\n\t*/\n\tErrorKind[ErrorKind[\"DUPLICATE_SELECT_ARGUMENT_SELECTOR\"] = 21] = \"DUPLICATE_SELECT_ARGUMENT_SELECTOR\";\n\t/** Plural or select argument option must have `other` clause. */\n\tErrorKind[ErrorKind[\"MISSING_OTHER_CLAUSE\"] = 22] = \"MISSING_OTHER_CLAUSE\";\n\t/** The tag is malformed. (e.g. `<bold!>foo</bold!>) */\n\tErrorKind[ErrorKind[\"INVALID_TAG\"] = 23] = \"INVALID_TAG\";\n\t/** The tag name is invalid. (e.g. `<123>foo</123>`) */\n\tErrorKind[ErrorKind[\"INVALID_TAG_NAME\"] = 25] = \"INVALID_TAG_NAME\";\n\t/** The closing tag does not match the opening tag. (e.g. `<bold>foo</italic>`) */\n\tErrorKind[ErrorKind[\"UNMATCHED_CLOSING_TAG\"] = 26] = \"UNMATCHED_CLOSING_TAG\";\n\t/** The opening tag has unmatched closing tag. (e.g. `<bold>foo`) */\n\tErrorKind[ErrorKind[\"UNCLOSED_TAG\"] = 27] = \"UNCLOSED_TAG\";\n\treturn ErrorKind;\n}({});\n//#endregion\n//#region packages/icu-messageformat-parser/types.ts\nlet TYPE = /* @__PURE__ */ function(TYPE) {\n\t/**\n\t* Raw text\n\t*/\n\tTYPE[TYPE[\"literal\"] = 0] = \"literal\";\n\t/**\n\t* Variable w/o any format, e.g `var` in `this is a {var}`\n\t*/\n\tTYPE[TYPE[\"argument\"] = 1] = \"argument\";\n\t/**\n\t* Variable w/ number format\n\t*/\n\tTYPE[TYPE[\"number\"] = 2] = \"number\";\n\t/**\n\t* Variable w/ date format\n\t*/\n\tTYPE[TYPE[\"date\"] = 3] = \"date\";\n\t/**\n\t* Variable w/ time format\n\t*/\n\tTYPE[TYPE[\"time\"] = 4] = \"time\";\n\t/**\n\t* Variable w/ select format\n\t*/\n\tTYPE[TYPE[\"select\"] = 5] = \"select\";\n\t/**\n\t* Variable w/ plural format\n\t*/\n\tTYPE[TYPE[\"plural\"] = 6] = \"plural\";\n\t/**\n\t* Only possible within plural argument.\n\t* This is the `#` symbol that will be substituted with the count.\n\t*/\n\tTYPE[TYPE[\"pound\"] = 7] = \"pound\";\n\t/**\n\t* XML-like tag\n\t*/\n\tTYPE[TYPE[\"tag\"] = 8] = \"tag\";\n\treturn TYPE;\n}({});\nlet SKELETON_TYPE = /* @__PURE__ */ function(SKELETON_TYPE) {\n\tSKELETON_TYPE[SKELETON_TYPE[\"number\"] = 0] = \"number\";\n\tSKELETON_TYPE[SKELETON_TYPE[\"dateTime\"] = 1] = \"dateTime\";\n\treturn SKELETON_TYPE;\n}({});\n/**\n* Type Guards\n*/\nfunction isLiteralElement(el) {\n\treturn el.type === 0;\n}\nfunction isArgumentElement(el) {\n\treturn el.type === 1;\n}\nfunction isNumberElement(el) {\n\treturn el.type === 2;\n}\nfunction isDateElement(el) {\n\treturn el.type === 3;\n}\nfunction isTimeElement(el) {\n\treturn el.type === 4;\n}\nfunction isSelectElement(el) {\n\treturn el.type === 5;\n}\nfunction isPluralElement(el) {\n\treturn el.type === 6;\n}\nfunction isPoundElement(el) {\n\treturn el.type === 7;\n}\nfunction isTagElement(el) {\n\treturn el.type === 8;\n}\nfunction isNumberSkeleton(el) {\n\treturn !!(el && typeof el === \"object\" && el.type === 0);\n}\nfunction isDateTimeSkeleton(el) {\n\treturn !!(el && typeof el === \"object\" && el.type === 1);\n}\nfunction createLiteralElement(value) {\n\treturn {\n\t\ttype: 0,\n\t\tvalue\n\t};\n}\nfunction createNumberElement(value, style) {\n\treturn {\n\t\ttype: 2,\n\t\tvalue,\n\t\tstyle\n\t};\n}\n//#endregion\n//#region node_modules/.aspect_rules_js/@formatjs_generated+unicode@0.0.0/node_modules/@formatjs_generated/unicode/icu-messageformat-parser-regex.js\nconst SPACE_SEPARATOR_REGEX = /[ \\xA0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000]/;\nconst IDENTIFIER_PREFIX_REGEX = /([^\\t-\\r -\\/:-@\\[-\\^`\\{-~\\x85\\xA0-\\xA7\\xA9\\xAB\\xAC\\xAE\\xB0\\xB1\\xB6\\xBB\\xBF\\xD7\\xF7\\u1680\\u2000-\\u200A\\u2010-\\u2029\\u202F-\\u203E\\u2041-\\u2053\\u2055-\\u205F\\u2190-\\u245F\\u2500-\\u2775\\u2794-\\u2BFF\\u2E00-\\u2E7F\\u3000-\\u3003\\u3008-\\u3020\\u3030\\uFD3E\\uFD3F\\uFE45\\uFE46]*)/g;\n//#endregion\n//#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.core@0.0.0/node_modules/@formatjs_generated/cldr.core/time-data.js\nconst timeData = {\n\t\"001\": [\"H\", \"h\"],\n\t\"419\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"AC\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"AD\": [\"H\", \"hB\"],\n\t\"AE\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"AF\": [\n\t\t\"H\",\n\t\t\"hb\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"AG\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"AI\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"AL\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"AM\": [\"H\", \"hB\"],\n\t\"AO\": [\"H\", \"hB\"],\n\t\"AR\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"AS\": [\"h\", \"H\"],\n\t\"AT\": [\"H\", \"hB\"],\n\t\"AU\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"AW\": [\"H\", \"hB\"],\n\t\"AX\": [\"H\"],\n\t\"AZ\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"BA\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"BB\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"BD\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"H\"\n\t],\n\t\"BE\": [\"H\", \"hB\"],\n\t\"BF\": [\"H\", \"hB\"],\n\t\"BG\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"BH\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"BI\": [\"H\", \"h\"],\n\t\"BJ\": [\"H\", \"hB\"],\n\t\"BL\": [\"H\", \"hB\"],\n\t\"BM\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"BN\": [\n\t\t\"hb\",\n\t\t\"hB\",\n\t\t\"h\",\n\t\t\"H\"\n\t],\n\t\"BO\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"BQ\": [\"H\"],\n\t\"BR\": [\"H\", \"hB\"],\n\t\"BS\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"BT\": [\"h\", \"H\"],\n\t\"BW\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"BY\": [\"H\", \"h\"],\n\t\"BZ\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"CA\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"CC\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"CD\": [\"hB\", \"H\"],\n\t\"CF\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"CG\": [\"H\", \"hB\"],\n\t\"CH\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"CI\": [\"H\", \"hB\"],\n\t\"CK\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"CL\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"CM\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"CN\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"h\"\n\t],\n\t\"CO\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"CP\": [\"H\"],\n\t\"CR\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"CU\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"CV\": [\"H\", \"hB\"],\n\t\"CW\": [\"H\", \"hB\"],\n\t\"CX\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"CY\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"CZ\": [\"H\"],\n\t\"DE\": [\"H\", \"hB\"],\n\t\"DG\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"DJ\": [\"h\", \"H\"],\n\t\"DK\": [\"H\"],\n\t\"DM\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"DO\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"DZ\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"EA\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"EC\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"EE\": [\"H\", \"hB\"],\n\t\"EG\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"EH\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"ER\": [\"h\", \"H\"],\n\t\"ES\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\",\n\t\t\"hb\"\n\t],\n\t\"ET\": [\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"h\",\n\t\t\"H\"\n\t],\n\t\"FI\": [\"H\"],\n\t\"FJ\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"FK\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"FM\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"FO\": [\"H\", \"h\"],\n\t\"FR\": [\"H\", \"hB\"],\n\t\"GA\": [\"H\", \"hB\"],\n\t\"GB\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"GD\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"GE\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"GF\": [\"H\", \"hB\"],\n\t\"GG\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"GH\": [\"h\", \"H\"],\n\t\"GI\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"GL\": [\"H\", \"h\"],\n\t\"GM\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"GN\": [\"H\", \"hB\"],\n\t\"GP\": [\"H\", \"hB\"],\n\t\"GQ\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\",\n\t\t\"hb\"\n\t],\n\t\"GR\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"GS\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"GT\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"GU\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"GW\": [\"H\", \"hB\"],\n\t\"GY\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"HK\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"HN\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"HR\": [\"H\", \"hB\"],\n\t\"HU\": [\"H\", \"h\"],\n\t\"IC\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"ID\": [\"H\"],\n\t\"IE\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"IL\": [\"H\", \"hB\"],\n\t\"IM\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"IN\": [\"h\", \"H\"],\n\t\"IO\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"IQ\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"IR\": [\"hB\", \"H\"],\n\t\"IS\": [\"H\"],\n\t\"IT\": [\"H\", \"hB\"],\n\t\"JE\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"JM\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"JO\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"JP\": [\n\t\t\"H\",\n\t\t\"K\",\n\t\t\"h\"\n\t],\n\t\"KE\": [\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"h\"\n\t],\n\t\"KG\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"KH\": [\n\t\t\"hB\",\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hb\"\n\t],\n\t\"KI\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"KM\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"KN\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"KP\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"KR\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"KW\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"KY\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"KZ\": [\"H\", \"hB\"],\n\t\"LA\": [\n\t\t\"H\",\n\t\t\"hb\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"LB\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"LC\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"LI\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"LK\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"LR\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"LS\": [\"h\", \"H\"],\n\t\"LT\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"LU\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"LV\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"h\"\n\t],\n\t\"LY\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"MA\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"MC\": [\"H\", \"hB\"],\n\t\"MD\": [\"H\", \"hB\"],\n\t\"ME\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"MF\": [\"H\", \"hB\"],\n\t\"MG\": [\"H\", \"h\"],\n\t\"MH\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"MK\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"ML\": [\"H\"],\n\t\"MM\": [\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"h\"\n\t],\n\t\"MN\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"MO\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"MP\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"MQ\": [\"H\", \"hB\"],\n\t\"MR\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"MS\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"MT\": [\"H\", \"h\"],\n\t\"MU\": [\"H\", \"h\"],\n\t\"MV\": [\"H\", \"h\"],\n\t\"MW\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"MX\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"MY\": [\n\t\t\"hb\",\n\t\t\"hB\",\n\t\t\"h\",\n\t\t\"H\"\n\t],\n\t\"MZ\": [\"H\", \"hB\"],\n\t\"NA\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"NC\": [\"H\", \"hB\"],\n\t\"NE\": [\"H\"],\n\t\"NF\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"NG\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"NI\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"NL\": [\"H\", \"hB\"],\n\t\"NO\": [\"H\", \"h\"],\n\t\"NP\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"NR\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"NU\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"NZ\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"OM\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"PA\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"PE\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"PF\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"PG\": [\"h\", \"H\"],\n\t\"PH\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"PK\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"H\"\n\t],\n\t\"PL\": [\"H\", \"h\"],\n\t\"PM\": [\"H\", \"hB\"],\n\t\"PN\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"PR\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"PS\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"PT\": [\"H\", \"hB\"],\n\t\"PW\": [\"h\", \"H\"],\n\t\"PY\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"QA\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"RE\": [\"H\", \"hB\"],\n\t\"RO\": [\"H\", \"hB\"],\n\t\"RS\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"RU\": [\"H\"],\n\t\"RW\": [\"H\", \"h\"],\n\t\"SA\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"SB\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"SC\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"SD\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"SE\": [\"H\"],\n\t\"SG\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"SH\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"SI\": [\"H\", \"hB\"],\n\t\"SJ\": [\"H\"],\n\t\"SK\": [\"H\"],\n\t\"SL\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"SM\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"SN\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"SO\": [\"h\", \"H\"],\n\t\"SR\": [\"H\", \"hB\"],\n\t\"SS\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"ST\": [\"H\", \"hB\"],\n\t\"SV\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"SX\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"SY\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"SZ\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"TA\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"TC\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"TD\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"TF\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"TG\": [\"H\", \"hB\"],\n\t\"TH\": [\"H\", \"h\"],\n\t\"TJ\": [\"H\", \"h\"],\n\t\"TL\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"h\"\n\t],\n\t\"TM\": [\"H\", \"h\"],\n\t\"TN\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"TO\": [\"h\", \"H\"],\n\t\"TR\": [\"H\", \"hB\"],\n\t\"TT\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"TW\": [\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"h\",\n\t\t\"H\"\n\t],\n\t\"TZ\": [\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"h\"\n\t],\n\t\"UA\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"UG\": [\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"h\"\n\t],\n\t\"UM\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"US\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"UY\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"UZ\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"VA\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"VC\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"VE\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"VG\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"VI\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"VN\": [\"H\", \"h\"],\n\t\"VU\": [\"h\", \"H\"],\n\t\"WF\": [\"H\", \"hB\"],\n\t\"WS\": [\"h\", \"H\"],\n\t\"XK\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"YE\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"YT\": [\"H\", \"hB\"],\n\t\"ZA\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"ZM\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"ZW\": [\"H\", \"h\"],\n\t\"af-ZA\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"ar-001\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"ca-ES\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"en-001\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"en-HK\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"en-IL\": [\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ZA\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"h\"\n\t]\n};\n//#endregion\n//#region packages/icu-messageformat-parser/date-time-pattern-generator.ts\n/**\n* Returns the best matching date time pattern if a date time skeleton\n* pattern is provided with a locale. Follows the Unicode specification:\n* https://www.unicode.org/reports/tr35/tr35-dates.html#table-mapping-requested-time-skeletons-to-patterns\n* @param skeleton date time skeleton pattern that possibly includes j, J or C\n* @param locale\n*/\nfunction getBestPattern(skeleton, locale) {\n\tlet skeletonCopy = \"\";\n\tfor (let patternPos = 0; patternPos < skeleton.length; patternPos++) {\n\t\tconst patternChar = skeleton.charAt(patternPos);\n\t\tif (patternChar === \"j\") {\n\t\t\tlet extraLength = 0;\n\t\t\twhile (patternPos + 1 < skeleton.length && skeleton.charAt(patternPos + 1) === patternChar) {\n\t\t\t\textraLength++;\n\t\t\t\tpatternPos++;\n\t\t\t}\n\t\t\tlet hourLen = 1 + (extraLength & 1);\n\t\t\tlet dayPeriodLen = extraLength < 2 ? 1 : 3 + (extraLength >> 1);\n\t\t\tlet dayPeriodChar = \"a\";\n\t\t\tlet hourChar = getDefaultHourSymbolFromLocale(locale);\n\t\t\tif (hourChar == \"H\" || hourChar == \"k\") dayPeriodLen = 0;\n\t\t\twhile (dayPeriodLen-- > 0) skeletonCopy += dayPeriodChar;\n\t\t\twhile (hourLen-- > 0) skeletonCopy = hourChar + skeletonCopy;\n\t\t} else if (patternChar === \"J\") skeletonCopy += \"H\";\n\t\telse skeletonCopy += patternChar;\n\t}\n\treturn skeletonCopy;\n}\n/**\n* Maps the [hour cycle type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/hourCycle)\n* of the given `locale` to the corresponding time pattern.\n* @param locale\n*/\nfunction getDefaultHourSymbolFromLocale(locale) {\n\tlet hourCycle = locale.hourCycle;\n\tif (hourCycle === void 0) {\n\t\tconst localeWithHourCycles = locale;\n\t\thourCycle = localeWithHourCycles.getHourCycles?.()[0] ?? localeWithHourCycles.hourCycles?.[0];\n\t}\n\tif (hourCycle) switch (hourCycle) {\n\t\tcase \"h24\": return \"k\";\n\t\tcase \"h23\": return \"H\";\n\t\tcase \"h12\": return \"h\";\n\t\tcase \"h11\": return \"K\";\n\t\tdefault: throw new Error(\"Invalid hourCycle\");\n\t}\n\tconst languageTag = locale.language;\n\tlet regionTag;\n\tif (languageTag !== \"root\") regionTag = locale.maximize().region;\n\treturn (timeData[`${languageTag}-${regionTag}`] || timeData[regionTag || \"\"] || timeData[languageTag || \"\"] || timeData[`${languageTag}-001`] || timeData[\"001\"])[0].charAt(0);\n}\n//#endregion\n//#region packages/icu-messageformat-parser/parser.ts\nconst SPACE_SEPARATOR_START_REGEX = new RegExp(`^${SPACE_SEPARATOR_REGEX.source}*`);\nconst SPACE_SEPARATOR_END_REGEX = new RegExp(`${SPACE_SEPARATOR_REGEX.source}*$`);\nfunction createLocation(start, end) {\n\treturn {\n\t\tstart,\n\t\tend\n\t};\n}\nconst hasNativeFromEntries = !!Object.fromEntries;\nconst hasTrimStart = !!String.prototype.trimStart;\nconst hasTrimEnd = !!String.prototype.trimEnd;\nconst fromEntries = hasNativeFromEntries ? Object.fromEntries : function fromEntries(entries) {\n\tconst obj = {};\n\tfor (const [k, v] of entries) obj[k] = v;\n\treturn obj;\n};\nconst trimStart = hasTrimStart ? function trimStart(s) {\n\treturn s.trimStart();\n} : function trimStart(s) {\n\treturn s.replace(SPACE_SEPARATOR_START_REGEX, \"\");\n};\nconst trimEnd = hasTrimEnd ? function trimEnd(s) {\n\treturn s.trimEnd();\n} : function trimEnd(s) {\n\treturn s.replace(SPACE_SEPARATOR_END_REGEX, \"\");\n};\nlet IDENTIFIER_PREFIX_RE = createIdentifierPrefixRegex();\nfunction createIdentifierPrefixRegex() {\n\ttry {\n\t\tconst regex = new RegExp(\"([^\\\\p{White_Space}\\\\p{Pattern_Syntax}]*)\", \"yu\");\n\t\tif (regex.exec(\"a \")?.[1] === \"a\") return regex;\n\t} catch {}\n\treturn IDENTIFIER_PREFIX_REGEX;\n}\nfunction matchIdentifierAtIndex(s, index) {\n\tIDENTIFIER_PREFIX_RE.lastIndex = index;\n\treturn IDENTIFIER_PREFIX_RE.exec(s)[1] ?? \"\";\n}\nfunction plainTopLevelEndPosition(message) {\n\tif (message.length === 0) return null;\n\tlet line = 1;\n\tlet column = 1;\n\tfor (let offset = 0; offset < message.length;) {\n\t\tconst code = message.charCodeAt(offset);\n\t\tswitch (code) {\n\t\t\tcase 35:\n\t\t\tcase 39:\n\t\t\tcase 60:\n\t\t\tcase 123:\n\t\t\tcase 125: return null;\n\t\t}\n\t\tif (code === 10) {\n\t\t\tline++;\n\t\t\tcolumn = 1;\n\t\t\toffset++;\n\t\t} else {\n\t\t\tcolumn++;\n\t\t\tif (code >= 55296 && code <= 56319 && offset + 1 < message.length) {\n\t\t\t\tconst next = message.charCodeAt(offset + 1);\n\t\t\t\toffset += next >= 56320 && next <= 57343 ? 2 : 1;\n\t\t\t} else offset++;\n\t\t}\n\t}\n\treturn {\n\t\toffset: message.length,\n\t\tline,\n\t\tcolumn\n\t};\n}\nvar Parser = class {\n\tconstructor(message, options = {}) {\n\t\tthis.message = message;\n\t\tthis.position = {\n\t\t\toffset: 0,\n\t\t\tline: 1,\n\t\t\tcolumn: 1\n\t\t};\n\t\tthis.ignoreTag = !!options.ignoreTag;\n\t\tthis.locale = options.locale;\n\t\tthis.requiresOtherClause = !!options.requiresOtherClause;\n\t\tthis.shouldParseSkeletons = !!options.shouldParseSkeletons;\n\t}\n\tparse() {\n\t\tif (this.offset() !== 0) throw Error(\"parser can only be used once\");\n\t\tif (this.message.length > 0) {\n\t\t\tconst firstCode = this.message.charCodeAt(0);\n\t\t\tif (firstCode !== 35 && firstCode !== 39 && firstCode !== 60 && firstCode !== 123 && firstCode !== 125) {\n\t\t\t\tconst plainEndPosition = plainTopLevelEndPosition(this.message);\n\t\t\t\tif (plainEndPosition) {\n\t\t\t\t\tconst start = this.clonePosition();\n\t\t\t\t\tthis.position = plainEndPosition;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tval: [{\n\t\t\t\t\t\t\ttype: 0,\n\t\t\t\t\t\t\tvalue: this.message,\n\t\t\t\t\t\t\tlocation: createLocation(start, this.clonePosition())\n\t\t\t\t\t\t}],\n\t\t\t\t\t\terr: null\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this.parseMessage(0, \"\", false);\n\t}\n\tparseMessage(nestingLevel, parentArgType, expectingCloseTag) {\n\t\tlet elements = [];\n\t\twhile (!this.isEOF()) {\n\t\t\tconst char = this.char();\n\t\t\tif (char === 123) {\n\t\t\t\tconst result = this.parseArgument(nestingLevel, expectingCloseTag);\n\t\t\t\tif (result.err) return result;\n\t\t\t\telements.push(result.val);\n\t\t\t} else if (char === 125 && nestingLevel > 0) break;\n\t\t\telse if (char === 35 && (parentArgType === \"plural\" || parentArgType === \"selectordinal\")) {\n\t\t\t\tconst position = this.clonePosition();\n\t\t\t\tthis.bump();\n\t\t\t\telements.push({\n\t\t\t\t\ttype: 7,\n\t\t\t\t\tlocation: createLocation(position, this.clonePosition())\n\t\t\t\t});\n\t\t\t} else if (char === 60 && !this.ignoreTag && this.peek() === 47) {\n\t\t\t\tif (expectingCloseTag) break;\n\t\t\t\telse return this.error(26, createLocation(this.clonePosition(), this.clonePosition()));\n\t\t\t} else if (char === 60 && !this.ignoreTag && _isAlpha(this.peek() || 0)) {\n\t\t\t\tconst result = this.parseTag(nestingLevel, parentArgType);\n\t\t\t\tif (result.err) return result;\n\t\t\t\telements.push(result.val);\n\t\t\t} else {\n\t\t\t\tconst result = this.parseLiteral(nestingLevel, parentArgType);\n\t\t\t\tif (result.err) return result;\n\t\t\t\telements.push(result.val);\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\tval: elements,\n\t\t\terr: null\n\t\t};\n\t}\n\t/**\n\t* A tag name must start with an ASCII lower/upper case letter. The grammar is based on the\n\t* [custom element name][] except that a dash is NOT always mandatory and uppercase letters\n\t* are accepted:\n\t*\n\t* ```\n\t* tag ::= \"<\" tagName (whitespace)* \"/>\" | \"<\" tagName (whitespace)* \">\" message \"</\" tagName (whitespace)* \">\"\n\t* tagName ::= [a-z] (PENChar)*\n\t* PENChar ::=\n\t* \"-\" | \".\" | [0-9] | \"_\" | [a-z] | [A-Z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] |\n\t* [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] |\n\t* [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]\n\t* ```\n\t*\n\t* [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name\n\t* NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do\n\t* since other tag-based engines like React allow it\n\t*/\n\tparseTag(nestingLevel, parentArgType) {\n\t\tconst startPosition = this.clonePosition();\n\t\tthis.bump();\n\t\tconst tagName = this.parseTagName();\n\t\tthis.bumpSpace();\n\t\tif (this.bumpIf(\"/>\")) return {\n\t\t\tval: {\n\t\t\t\ttype: 0,\n\t\t\t\tvalue: `<${tagName}/>`,\n\t\t\t\tlocation: createLocation(startPosition, this.clonePosition())\n\t\t\t},\n\t\t\terr: null\n\t\t};\n\t\telse if (this.bumpIf(\">\")) {\n\t\t\tconst childrenResult = this.parseMessage(nestingLevel + 1, parentArgType, true);\n\t\t\tif (childrenResult.err) return childrenResult;\n\t\t\tconst children = childrenResult.val;\n\t\t\tconst endTagStartPosition = this.clonePosition();\n\t\t\tif (this.bumpIf(\"</\")) {\n\t\t\t\tif (this.isEOF() || !_isAlpha(this.char())) return this.error(23, createLocation(endTagStartPosition, this.clonePosition()));\n\t\t\t\tconst closingTagNameStartPosition = this.clonePosition();\n\t\t\t\tif (tagName !== this.parseTagName()) return this.error(26, createLocation(closingTagNameStartPosition, this.clonePosition()));\n\t\t\t\tthis.bumpSpace();\n\t\t\t\tif (!this.bumpIf(\">\")) return this.error(23, createLocation(endTagStartPosition, this.clonePosition()));\n\t\t\t\treturn {\n\t\t\t\t\tval: {\n\t\t\t\t\t\ttype: 8,\n\t\t\t\t\t\tvalue: tagName,\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t\tlocation: createLocation(startPosition, this.clonePosition())\n\t\t\t\t\t},\n\t\t\t\t\terr: null\n\t\t\t\t};\n\t\t\t} else return this.error(27, createLocation(startPosition, this.clonePosition()));\n\t\t} else return this.error(23, createLocation(startPosition, this.clonePosition()));\n\t}\n\t/**\n\t* This method assumes that the caller has peeked ahead for the first tag character.\n\t*/\n\tparseTagName() {\n\t\tconst startOffset = this.offset();\n\t\tthis.bump();\n\t\twhile (!this.isEOF() && _isPotentialElementNameChar(this.char())) this.bump();\n\t\treturn this.message.slice(startOffset, this.offset());\n\t}\n\tparseLiteral(nestingLevel, parentArgType) {\n\t\tconst start = this.clonePosition();\n\t\tlet value = \"\";\n\t\twhile (true) {\n\t\t\tconst parseQuoteResult = this.tryParseQuote(parentArgType);\n\t\t\tif (parseQuoteResult) {\n\t\t\t\tvalue += parseQuoteResult;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst parseUnquotedResult = this.tryParseUnquoted(nestingLevel, parentArgType);\n\t\t\tif (parseUnquotedResult) {\n\t\t\t\tvalue += parseUnquotedResult;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst parseLeftAngleResult = this.tryParseLeftAngleBracket();\n\t\t\tif (parseLeftAngleResult) {\n\t\t\t\tvalue += parseLeftAngleResult;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tconst location = createLocation(start, this.clonePosition());\n\t\treturn {\n\t\t\tval: {\n\t\t\t\ttype: 0,\n\t\t\t\tvalue,\n\t\t\t\tlocation\n\t\t\t},\n\t\t\terr: null\n\t\t};\n\t}\n\ttryParseLeftAngleBracket() {\n\t\tif (!this.isEOF() && this.char() === 60 && (this.ignoreTag || !_isAlphaOrSlash(this.peek() || 0))) {\n\t\t\tthis.bump();\n\t\t\treturn \"<\";\n\t\t}\n\t\treturn null;\n\t}\n\t/**\n\t* Starting with ICU 4.8, an ASCII apostrophe only starts quoted text if it immediately precedes\n\t* a character that requires quoting (that is, \"only where needed\"), and works the same in\n\t* nested messages as on the top level of the pattern. The new behavior is otherwise compatible.\n\t*/\n\ttryParseQuote(parentArgType) {\n\t\tif (this.isEOF() || this.char() !== 39) return null;\n\t\tswitch (this.peek()) {\n\t\t\tcase 39:\n\t\t\t\tthis.bump();\n\t\t\t\tthis.bump();\n\t\t\t\treturn \"'\";\n\t\t\tcase 123:\n\t\t\tcase 60:\n\t\t\tcase 62:\n\t\t\tcase 125: break;\n\t\t\tcase 35:\n\t\t\t\tif (parentArgType === \"plural\" || parentArgType === \"selectordinal\") break;\n\t\t\t\treturn null;\n\t\t\tdefault: return null;\n\t\t}\n\t\tthis.bump();\n\t\tconst codePoints = [this.char()];\n\t\tthis.bump();\n\t\twhile (!this.isEOF()) {\n\t\t\tconst ch = this.char();\n\t\t\tif (ch === 39) {\n\t\t\t\tif (this.peek() === 39) {\n\t\t\t\t\tcodePoints.push(39);\n\t\t\t\t\tthis.bump();\n\t\t\t\t} else {\n\t\t\t\t\tthis.bump();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else codePoints.push(ch);\n\t\t\tthis.bump();\n\t\t}\n\t\treturn String.fromCodePoint(...codePoints);\n\t}\n\ttryParseUnquoted(nestingLevel, parentArgType) {\n\t\tif (this.isEOF()) return null;\n\t\tconst ch = this.char();\n\t\tif (ch === 60 || ch === 123 || ch === 35 && (parentArgType === \"plural\" || parentArgType === \"selectordinal\") || ch === 125 && nestingLevel > 0) return null;\n\t\telse {\n\t\t\tthis.bump();\n\t\t\treturn String.fromCodePoint(ch);\n\t\t}\n\t}\n\tparseArgument(nestingLevel, expectingCloseTag) {\n\t\tconst openingBracePosition = this.clonePosition();\n\t\tthis.bump();\n\t\tthis.bumpSpace();\n\t\tif (this.isEOF()) return this.error(1, createLocation(openingBracePosition, this.clonePosition()));\n\t\tif (this.char() === 125) {\n\t\t\tthis.bump();\n\t\t\treturn this.error(2, createLocation(openingBracePosition, this.clonePosition()));\n\t\t}\n\t\tlet value = this.parseIdentifierIfPossible().value;\n\t\tif (!value) return this.error(3, createLocation(openingBracePosition, this.clonePosition()));\n\t\tthis.bumpSpace();\n\t\tif (this.isEOF()) return this.error(1, createLocation(openingBracePosition, this.clonePosition()));\n\t\tswitch (this.char()) {\n\t\t\tcase 125:\n\t\t\t\tthis.bump();\n\t\t\t\treturn {\n\t\t\t\t\tval: {\n\t\t\t\t\t\ttype: 1,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tlocation: createLocation(openingBracePosition, this.clonePosition())\n\t\t\t\t\t},\n\t\t\t\t\terr: null\n\t\t\t\t};\n\t\t\tcase 44:\n\t\t\t\tthis.bump();\n\t\t\t\tthis.bumpSpace();\n\t\t\t\tif (this.isEOF()) return this.error(1, createLocation(openingBracePosition, this.clonePosition()));\n\t\t\t\treturn this.parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition);\n\t\t\tdefault: return this.error(3, createLocation(openingBracePosition, this.clonePosition()));\n\t\t}\n\t}\n\t/**\n\t* Advance the parser until the end of the identifier, if it is currently on\n\t* an identifier character. Return an empty string otherwise.\n\t*/\n\tparseIdentifierIfPossible() {\n\t\tconst startingPosition = this.clonePosition();\n\t\tconst startOffset = this.offset();\n\t\tconst value = matchIdentifierAtIndex(this.message, startOffset);\n\t\tconst endOffset = startOffset + value.length;\n\t\tthis.bumpTo(endOffset);\n\t\treturn {\n\t\t\tvalue,\n\t\t\tlocation: createLocation(startingPosition, this.clonePosition())\n\t\t};\n\t}\n\tparseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition) {\n\t\tlet typeStartPosition = this.clonePosition();\n\t\tlet argType = this.parseIdentifierIfPossible().value;\n\t\tlet typeEndPosition = this.clonePosition();\n\t\tswitch (argType) {\n\t\t\tcase \"\": return this.error(4, createLocation(typeStartPosition, typeEndPosition));\n\t\t\tcase \"number\":\n\t\t\tcase \"date\":\n\t\t\tcase \"time\": {\n\t\t\t\tthis.bumpSpace();\n\t\t\t\tlet styleAndLocation = null;\n\t\t\t\tif (this.bumpIf(\",\")) {\n\t\t\t\t\tthis.bumpSpace();\n\t\t\t\t\tconst styleStartPosition = this.clonePosition();\n\t\t\t\t\tconst result = this.parseSimpleArgStyleIfPossible();\n\t\t\t\t\tif (result.err) return result;\n\t\t\t\t\tconst style = trimEnd(result.val);\n\t\t\t\t\tif (style.length === 0) return this.error(6, createLocation(this.clonePosition(), this.clonePosition()));\n\t\t\t\t\tstyleAndLocation = {\n\t\t\t\t\t\tstyle,\n\t\t\t\t\t\tstyleLocation: createLocation(styleStartPosition, this.clonePosition())\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tconst argCloseResult = this.tryParseArgumentClose(openingBracePosition);\n\t\t\t\tif (argCloseResult.err) return argCloseResult;\n\t\t\t\tconst location = createLocation(openingBracePosition, this.clonePosition());\n\t\t\t\tif (styleAndLocation && styleAndLocation.style.startsWith(\"::\")) {\n\t\t\t\t\tlet skeleton = trimStart(styleAndLocation.style.slice(2));\n\t\t\t\t\tif (argType === \"number\") {\n\t\t\t\t\t\tconst result = this.parseNumberSkeletonFromString(skeleton, styleAndLocation.styleLocation);\n\t\t\t\t\t\tif (result.err) return result;\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tval: {\n\t\t\t\t\t\t\t\ttype: 2,\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\tstyle: result.val\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\terr: null\n\t\t\t\t\t\t};\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (skeleton.length === 0) return this.error(10, location);\n\t\t\t\t\t\tlet dateTimePattern = skeleton;\n\t\t\t\t\t\tif (this.locale) dateTimePattern = getBestPattern(skeleton, this.locale);\n\t\t\t\t\t\tconst style = {\n\t\t\t\t\t\t\ttype: 1,\n\t\t\t\t\t\t\tpattern: dateTimePattern,\n\t\t\t\t\t\t\tlocation: styleAndLocation.styleLocation,\n\t\t\t\t\t\t\tparsedOptions: this.shouldParseSkeletons ? parseDateTimeSkeleton(dateTimePattern) : {}\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tval: {\n\t\t\t\t\t\t\t\ttype: argType === \"date\" ? 3 : 4,\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\tstyle\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\terr: null\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tval: {\n\t\t\t\t\t\ttype: argType === \"number\" ? 2 : argType === \"date\" ? 3 : 4,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tlocation,\n\t\t\t\t\t\tstyle: styleAndLocation?.style ?? null\n\t\t\t\t\t},\n\t\t\t\t\terr: null\n\t\t\t\t};\n\t\t\t}\n\t\t\tcase \"plural\":\n\t\t\tcase \"selectordinal\":\n\t\t\tcase \"select\": {\n\t\t\t\tconst typeEndPosition = this.clonePosition();\n\t\t\t\tthis.bumpSpace();\n\t\t\t\tif (!this.bumpIf(\",\")) return this.error(12, createLocation(typeEndPosition, { ...typeEndPosition }));\n\t\t\t\tthis.bumpSpace();\n\t\t\t\tlet identifierAndLocation = this.parseIdentifierIfPossible();\n\t\t\t\tlet pluralOffset = 0;\n\t\t\t\tif (argType !== \"select\" && identifierAndLocation.value === \"offset\") {\n\t\t\t\t\tif (!this.bumpIf(\":\")) return this.error(13, createLocation(this.clonePosition(), this.clonePosition()));\n\t\t\t\t\tthis.bumpSpace();\n\t\t\t\t\tconst result = this.tryParseDecimalInteger(13, 14);\n\t\t\t\t\tif (result.err) return result;\n\t\t\t\t\tthis.bumpSpace();\n\t\t\t\t\tidentifierAndLocation = this.parseIdentifierIfPossible();\n\t\t\t\t\tpluralOffset = result.val;\n\t\t\t\t}\n\t\t\t\tconst optionsResult = this.tryParsePluralOrSelectOptions(nestingLevel, argType, expectingCloseTag, identifierAndLocation);\n\t\t\t\tif (optionsResult.err) return optionsResult;\n\t\t\t\tconst argCloseResult = this.tryParseArgumentClose(openingBracePosition);\n\t\t\t\tif (argCloseResult.err) return argCloseResult;\n\t\t\t\tconst location = createLocation(openingBracePosition, this.clonePosition());\n\t\t\t\tif (argType === \"select\") return {\n\t\t\t\t\tval: {\n\t\t\t\t\t\ttype: 5,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\toptions: fromEntries(optionsResult.val),\n\t\t\t\t\t\tlocation\n\t\t\t\t\t},\n\t\t\t\t\terr: null\n\t\t\t\t};\n\t\t\t\telse return {\n\t\t\t\t\tval: {\n\t\t\t\t\t\ttype: 6,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\toptions: fromEntries(optionsResult.val),\n\t\t\t\t\t\toffset: pluralOffset,\n\t\t\t\t\t\tpluralType: argType === \"plural\" ? \"cardinal\" : \"ordinal\",\n\t\t\t\t\t\tlocation\n\t\t\t\t\t},\n\t\t\t\t\terr: null\n\t\t\t\t};\n\t\t\t}\n\t\t\tdefault: return this.error(5, createLocation(typeStartPosition, typeEndPosition));\n\t\t}\n\t}\n\ttryParseArgumentClose(openingBracePosition) {\n\t\tif (this.isEOF() || this.char() !== 125) return this.error(1, createLocation(openingBracePosition, this.clonePosition()));\n\t\tthis.bump();\n\t\treturn {\n\t\t\tval: true,\n\t\t\terr: null\n\t\t};\n\t}\n\t/**\n\t* See: https://github.com/unicode-org/icu/blob/af7ed1f6d2298013dc303628438ec4abe1f16479/icu4c/source/common/messagepattern.cpp#L659\n\t*/\n\tparseSimpleArgStyleIfPossible() {\n\t\tlet nestedBraces = 0;\n\t\tconst startPosition = this.clonePosition();\n\t\twhile (!this.isEOF()) switch (this.char()) {\n\t\t\tcase 39: {\n\t\t\t\tthis.bump();\n\t\t\t\tlet apostrophePosition = this.clonePosition();\n\t\t\t\tif (!this.bumpUntil(\"'\")) return this.error(11, createLocation(apostrophePosition, this.clonePosition()));\n\t\t\t\tthis.bump();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 123:\n\t\t\t\tnestedBraces += 1;\n\t\t\t\tthis.bump();\n\t\t\t\tbreak;\n\t\t\tcase 125:\n\t\t\t\tif (nestedBraces > 0) nestedBraces -= 1;\n\t\t\t\telse return {\n\t\t\t\t\tval: this.message.slice(startPosition.offset, this.offset()),\n\t\t\t\t\terr: null\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\tdefault: this.bump();\n\t\t}\n\t\treturn {\n\t\t\tval: this.message.slice(startPosition.offset, this.offset()),\n\t\t\terr: null\n\t\t};\n\t}\n\tparseNumberSkeletonFromString(skeleton, location) {\n\t\tlet tokens = [];\n\t\ttry {\n\t\t\ttokens = parseNumberSkeletonFromString(skeleton);\n\t\t} catch {\n\t\t\treturn this.error(7, location);\n\t\t}\n\t\treturn {\n\t\t\tval: {\n\t\t\t\ttype: 0,\n\t\t\t\ttokens,\n\t\t\t\tlocation,\n\t\t\t\tparsedOptions: this.shouldParseSkeletons ? parseNumberSkeleton(tokens) : {}\n\t\t\t},\n\t\t\terr: null\n\t\t};\n\t}\n\t/**\n\t* @param nesting_level The current nesting level of messages.\n\t* This can be positive when parsing message fragment in select or plural argument options.\n\t* @param parent_arg_type The parent argument's type.\n\t* @param parsed_first_identifier If provided, this is the first identifier-like selector of\n\t* the argument. It is a by-product of a previous parsing attempt.\n\t* @param expecting_close_tag If true, this message is directly or indirectly nested inside\n\t* between a pair of opening and closing tags. The nested message will not parse beyond\n\t* the closing tag boundary.\n\t*/\n\ttryParsePluralOrSelectOptions(nestingLevel, parentArgType, expectCloseTag, parsedFirstIdentifier) {\n\t\tlet hasOtherClause = false;\n\t\tconst options = [];\n\t\tconst parsedSelectors = /* @__PURE__ */ new Set();\n\t\tlet { value: selector, location: selectorLocation } = parsedFirstIdentifier;\n\t\twhile (true) {\n\t\t\tif (selector.length === 0) {\n\t\t\t\tconst startPosition = this.clonePosition();\n\t\t\t\tif (parentArgType !== \"select\" && this.bumpIf(\"=\")) {\n\t\t\t\t\tconst result = this.tryParseDecimalInteger(16, 19);\n\t\t\t\t\tif (result.err) return result;\n\t\t\t\t\tselectorLocation = createLocation(startPosition, this.clonePosition());\n\t\t\t\t\tselector = this.message.slice(startPosition.offset, this.offset());\n\t\t\t\t} else break;\n\t\t\t}\n\t\t\tif (parsedSelectors.has(selector)) return this.error(parentArgType === \"select\" ? 21 : 20, selectorLocation);\n\t\t\tif (selector === \"other\") hasOtherClause = true;\n\t\t\tthis.bumpSpace();\n\t\t\tconst openingBracePosition = this.clonePosition();\n\t\t\tif (!this.bumpIf(\"{\")) return this.error(parentArgType === \"select\" ? 17 : 18, createLocation(this.clonePosition(), this.clonePosition()));\n\t\t\tconst fragmentResult = this.parseMessage(nestingLevel + 1, parentArgType, expectCloseTag);\n\t\t\tif (fragmentResult.err) return fragmentResult;\n\t\t\tconst argCloseResult = this.tryParseArgumentClose(openingBracePosition);\n\t\t\tif (argCloseResult.err) return argCloseResult;\n\t\t\toptions.push([selector, {\n\t\t\t\tvalue: fragmentResult.val,\n\t\t\t\tlocation: createLocation(openingBracePosition, this.clonePosition())\n\t\t\t}]);\n\t\t\tparsedSelectors.add(selector);\n\t\t\tthis.bumpSpace();\n\t\t\t({value: selector, location: selectorLocation} = this.parseIdentifierIfPossible());\n\t\t}\n\t\tif (options.length === 0) return this.error(parentArgType === \"select\" ? 15 : 16, createLocation(this.clonePosition(), this.clonePosition()));\n\t\tif (this.requiresOtherClause && !hasOtherClause) return this.error(22, createLocation(this.clonePosition(), this.clonePosition()));\n\t\treturn {\n\t\t\tval: options,\n\t\t\terr: null\n\t\t};\n\t}\n\ttryParseDecimalInteger(expectNumberError, invalidNumberError) {\n\t\tlet sign = 1;\n\t\tconst startingPosition = this.clonePosition();\n\t\tif (this.bumpIf(\"+\")) {} else if (this.bumpIf(\"-\")) sign = -1;\n\t\tlet hasDigits = false;\n\t\tlet decimal = 0;\n\t\twhile (!this.isEOF()) {\n\t\t\tconst ch = this.char();\n\t\t\tif (ch >= 48 && ch <= 57) {\n\t\t\t\thasDigits = true;\n\t\t\t\tdecimal = decimal * 10 + (ch - 48);\n\t\t\t\tthis.bump();\n\t\t\t} else break;\n\t\t}\n\t\tconst location = createLocation(startingPosition, this.clonePosition());\n\t\tif (!hasDigits) return this.error(expectNumberError, location);\n\t\tdecimal *= sign;\n\t\tif (!Number.isSafeInteger(decimal)) return this.error(invalidNumberError, location);\n\t\treturn {\n\t\t\tval: decimal,\n\t\t\terr: null\n\t\t};\n\t}\n\toffset() {\n\t\treturn this.position.offset;\n\t}\n\tisEOF() {\n\t\treturn this.offset() === this.message.length;\n\t}\n\tclonePosition() {\n\t\treturn {\n\t\t\toffset: this.position.offset,\n\t\t\tline: this.position.line,\n\t\t\tcolumn: this.position.column\n\t\t};\n\t}\n\t/**\n\t* Return the code point at the current position of the parser.\n\t* Throws if the index is out of bound.\n\t*/\n\tchar() {\n\t\tconst offset = this.position.offset;\n\t\tif (offset >= this.message.length) throw Error(\"out of bound\");\n\t\tconst code = this.message.codePointAt(offset);\n\t\tif (code === void 0) throw Error(`Offset ${offset} is at invalid UTF-16 code unit boundary`);\n\t\treturn code;\n\t}\n\terror(kind, location) {\n\t\treturn {\n\t\t\tval: null,\n\t\t\terr: {\n\t\t\t\tkind,\n\t\t\t\tmessage: this.message,\n\t\t\t\tlocation\n\t\t\t}\n\t\t};\n\t}\n\t/** Bump the parser to the next UTF-16 code unit. */\n\tbump() {\n\t\tif (this.isEOF()) return;\n\t\tconst code = this.char();\n\t\tif (code === 10) {\n\t\t\tthis.position.line += 1;\n\t\t\tthis.position.column = 1;\n\t\t\tthis.position.offset += 1;\n\t\t} else {\n\t\t\tthis.position.column += 1;\n\t\t\tthis.position.offset += code < 65536 ? 1 : 2;\n\t\t}\n\t}\n\t/**\n\t* If the substring starting at the current position of the parser has\n\t* the given prefix, then bump the parser to the character immediately\n\t* following the prefix and return true. Otherwise, don't bump the parser\n\t* and return false.\n\t*/\n\tbumpIf(prefix) {\n\t\tconst offset = this.offset();\n\t\tif (this.message.slice(offset, offset + prefix.length) === prefix) {\n\t\t\tfor (let i = 0; i < prefix.length; i++) this.bump();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\t/**\n\t* Bump the parser until the pattern character is found and return `true`.\n\t* Otherwise bump to the end of the file and return `false`.\n\t*/\n\tbumpUntil(pattern) {\n\t\tconst currentOffset = this.offset();\n\t\tconst index = this.message.indexOf(pattern, currentOffset);\n\t\tif (index >= 0) {\n\t\t\tthis.bumpTo(index);\n\t\t\treturn true;\n\t\t} else {\n\t\t\tthis.bumpTo(this.message.length);\n\t\t\treturn false;\n\t\t}\n\t}\n\t/**\n\t* Bump the parser to the target offset.\n\t* If target offset is beyond the end of the input, bump the parser to the end of the input.\n\t*/\n\tbumpTo(targetOffset) {\n\t\tif (this.offset() > targetOffset) throw Error(`targetOffset ${targetOffset} must be greater than or equal to the current offset ${this.offset()}`);\n\t\ttargetOffset = Math.min(targetOffset, this.message.length);\n\t\twhile (true) {\n\t\t\tconst offset = this.offset();\n\t\t\tif (offset === targetOffset) break;\n\t\t\tif (offset > targetOffset) throw Error(`targetOffset ${targetOffset} is at invalid UTF-16 code unit boundary`);\n\t\t\tthis.bump();\n\t\t\tif (this.isEOF()) break;\n\t\t}\n\t}\n\t/** advance the parser through all whitespace to the next non-whitespace code unit. */\n\tbumpSpace() {\n\t\twhile (!this.isEOF() && _isWhiteSpace(this.char())) this.bump();\n\t}\n\t/**\n\t* Peek at the *next* Unicode codepoint in the input without advancing the parser.\n\t* If the input has been exhausted, then this returns null.\n\t*/\n\tpeek() {\n\t\tif (this.isEOF()) return null;\n\t\tconst code = this.char();\n\t\tconst offset = this.offset();\n\t\treturn this.message.charCodeAt(offset + (code >= 65536 ? 2 : 1)) ?? null;\n\t}\n};\n/**\n* This check if codepoint is alphabet (lower & uppercase)\n* @param codepoint\n* @returns\n*/\nfunction _isAlpha(codepoint) {\n\treturn codepoint >= 97 && codepoint <= 122 || codepoint >= 65 && codepoint <= 90;\n}\nfunction _isAlphaOrSlash(codepoint) {\n\treturn _isAlpha(codepoint) || codepoint === 47;\n}\n/** See `parseTag` function docs. */\nfunction _isPotentialElementNameChar(c) {\n\treturn c === 45 || c === 46 || c >= 48 && c <= 57 || c === 95 || c >= 97 && c <= 122 || c >= 65 && c <= 90 || c == 183 || c >= 192 && c <= 214 || c >= 216 && c <= 246 || c >= 248 && c <= 893 || c >= 895 && c <= 8191 || c >= 8204 && c <= 8205 || c >= 8255 && c <= 8256 || c >= 8304 && c <= 8591 || c >= 11264 && c <= 12271 || c >= 12289 && c <= 55295 || c >= 63744 && c <= 64975 || c >= 65008 && c <= 65533 || c >= 65536 && c <= 983039;\n}\n/**\n* Code point equivalent of regex `\\p{White_Space}`.\n* From: https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt\n*/\nfunction _isWhiteSpace(c) {\n\treturn c >= 9 && c <= 13 || c === 32 || c === 133 || c >= 8206 && c <= 8207 || c === 8232 || c === 8233;\n}\n//#endregion\n//#region packages/icu-messageformat-parser/manipulator.ts\n/**\n* Collect variable types, allowing shared date/time arguments.\n* @param ast AST to collect variables from\n* @param vars Map of variable names to type sets\n*/\nfunction collectVariables(ast, vars = /* @__PURE__ */ new Map()) {\n\tast.forEach((el) => {\n\t\tif (isArgumentElement(el) || isDateElement(el) || isTimeElement(el) || isNumberElement(el)) {\n\t\t\tif (vars.has(el.value)) {\n\t\t\t\tconst existingTypes = vars.get(el.value);\n\t\t\t\tif (!existingTypes.has(el.type) && !existingTypes.has(6) && !existingTypes.has(5)) {\n\t\t\t\t\tif ((el.type === 3 || el.type === 4) && Array.from(existingTypes).every((type) => type === 3 || type === 4)) existingTypes.add(el.type);\n\t\t\t\t\telse throw new Error(`Variable ${el.value} has conflicting types`);\n\t\t\t\t}\n\t\t\t} else vars.set(el.value, /* @__PURE__ */ new Set([el.type]));\n\t\t}\n\t\tif (isPluralElement(el) || isSelectElement(el)) {\n\t\t\tvars.set(el.value, /* @__PURE__ */ new Set([el.type]));\n\t\t\tObject.keys(el.options).forEach((k) => {\n\t\t\t\tcollectVariables(el.options[k].value, vars);\n\t\t\t});\n\t\t}\n\t\tif (isTagElement(el)) {\n\t\t\tvars.set(el.value, /* @__PURE__ */ new Set([el.type]));\n\t\t\tcollectVariables(el.children, vars);\n\t\t}\n\t});\n}\n/**\n* Check if 2 ASTs are structurally the same. This primarily means that\n* they have the same variables with the same type\n* @param a\n* @param b\n* @returns\n*/\nfunction isStructurallySame(a, b) {\n\tconst aVars = /* @__PURE__ */ new Map();\n\tconst bVars = /* @__PURE__ */ new Map();\n\tcollectVariables(a, aVars);\n\tcollectVariables(b, bVars);\n\tif (aVars.size !== bVars.size) return {\n\t\tsuccess: false,\n\t\terror: /* @__PURE__ */ new Error(`Different number of variables: [${Array.from(aVars.keys()).join(\", \")}] vs [${Array.from(bVars.keys()).join(\", \")}]`)\n\t};\n\treturn Array.from(aVars.entries()).reduce((result, [key, type]) => {\n\t\tif (!result.success) return result;\n\t\tconst bType = bVars.get(key);\n\t\tif (bType == null) return {\n\t\t\tsuccess: false,\n\t\t\terror: /* @__PURE__ */ new Error(`Missing variable ${key} in message`)\n\t\t};\n\t\tif (bType.size !== type.size || !Array.from(type).every((t) => bType.has(t))) return {\n\t\t\tsuccess: false,\n\t\t\terror: /* @__PURE__ */ new Error(`Variable ${key} has conflicting types: ${Array.from(type, (t) => TYPE[t]).join(\", \")} vs ${Array.from(bType, (t) => TYPE[t]).join(\", \")}`)\n\t\t};\n\t\treturn result;\n\t}, { success: true });\n}\n//#endregion\n//#region packages/icu-messageformat-parser/index.ts\nfunction pruneLocation(els) {\n\tels.forEach((el) => {\n\t\tdelete el.location;\n\t\tif (isSelectElement(el) || isPluralElement(el)) for (const k in el.options) {\n\t\t\tdelete el.options[k].location;\n\t\t\tpruneLocation(el.options[k].value);\n\t\t}\n\t\telse if (isNumberElement(el) && isNumberSkeleton(el.style)) delete el.style.location;\n\t\telse if ((isDateElement(el) || isTimeElement(el)) && isDateTimeSkeleton(el.style)) delete el.style.location;\n\t\telse if (isTagElement(el)) pruneLocation(el.children);\n\t});\n}\nfunction parse(message, opts = {}) {\n\topts = {\n\t\tshouldParseSkeletons: true,\n\t\trequiresOtherClause: true,\n\t\t...opts\n\t};\n\tconst result = new Parser(message, opts).parse();\n\tif (result.err) {\n\t\tconst error = SyntaxError(ErrorKind[result.err.kind]);\n\t\terror.location = result.err.location;\n\t\terror.originalMessage = result.err.message;\n\t\tthrow error;\n\t}\n\tif (!opts?.captureLocation) pruneLocation(result.val);\n\treturn result.val;\n}\nconst _Parser = Parser;\n//#endregion\nexport { SKELETON_TYPE, TYPE, _Parser, createLiteralElement, createNumberElement, isArgumentElement, isDateElement, isDateTimeSkeleton, isLiteralElement, isNumberElement, isNumberSkeleton, isPluralElement, isPoundElement, isSelectElement, isStructurallySame, isTagElement, isTimeElement, parse };\n\n//# sourceMappingURL=index.js.map","import { memoize, strategies } from \"@formatjs/fast-memoize\";\nimport { isArgumentElement, isDateElement, isDateTimeSkeleton, isLiteralElement, isNumberElement, isNumberSkeleton, isPluralElement, isPoundElement, isSelectElement, isTagElement, isTimeElement, parse } from \"@formatjs/icu-messageformat-parser\";\n//#region packages/intl-messageformat/error.ts\nlet ErrorCode = /* @__PURE__ */ function(ErrorCode) {\n\tErrorCode[\"MISSING_VALUE\"] = \"MISSING_VALUE\";\n\tErrorCode[\"INVALID_VALUE\"] = \"INVALID_VALUE\";\n\tErrorCode[\"MISSING_INTL_API\"] = \"MISSING_INTL_API\";\n\treturn ErrorCode;\n}({});\nvar FormatError = class extends Error {\n\tconstructor(msg, code, originalMessage) {\n\t\tsuper(msg);\n\t\tthis.code = code;\n\t\tthis.originalMessage = originalMessage;\n\t}\n\ttoString() {\n\t\treturn `[formatjs Error: ${this.code}] ${this.message}`;\n\t}\n};\nvar InvalidValueError = class extends FormatError {\n\tconstructor(variableId, value, options, originalMessage) {\n\t\tsuper(`Invalid values for \"${variableId}\": \"${value}\". Options are \"${Object.keys(options).join(\"\\\", \\\"\")}\"`, \"INVALID_VALUE\", originalMessage);\n\t}\n};\nvar InvalidValueTypeError = class extends FormatError {\n\tconstructor(value, type, originalMessage) {\n\t\tsuper(`Value for \"${value}\" must be of type ${type}`, \"INVALID_VALUE\", originalMessage);\n\t}\n};\nvar MissingValueError = class extends FormatError {\n\tconstructor(variableId, originalMessage) {\n\t\tsuper(`The intl string context variable \"${variableId}\" was not provided to the string \"${originalMessage}\"`, \"MISSING_VALUE\", originalMessage);\n\t}\n};\n//#endregion\n//#region packages/intl-messageformat/formatters.ts\nlet PART_TYPE = /* @__PURE__ */ function(PART_TYPE) {\n\tPART_TYPE[PART_TYPE[\"literal\"] = 0] = \"literal\";\n\tPART_TYPE[PART_TYPE[\"object\"] = 1] = \"object\";\n\treturn PART_TYPE;\n}({});\nfunction mergeLiteral(parts) {\n\tif (parts.length < 2) return parts;\n\treturn parts.reduce((all, part) => {\n\t\tconst lastPart = all[all.length - 1];\n\t\tif (!lastPart || lastPart.type !== 0 || part.type !== 0) all.push(part);\n\t\telse lastPart.value += part.value;\n\t\treturn all;\n\t}, []);\n}\nfunction isFormatXMLElementFn(el) {\n\treturn typeof el === \"function\";\n}\nfunction formatToParts(els, locales, formatters, formats, values, currentPluralValue, originalMessage) {\n\tif (els.length === 1 && isLiteralElement(els[0])) return [{\n\t\ttype: 0,\n\t\tvalue: els[0].value\n\t}];\n\tconst result = [];\n\tfor (const el of els) {\n\t\tif (isLiteralElement(el)) {\n\t\t\tresult.push({\n\t\t\t\ttype: 0,\n\t\t\t\tvalue: el.value\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (isPoundElement(el)) {\n\t\t\tif (typeof currentPluralValue === \"number\") result.push({\n\t\t\t\ttype: 0,\n\t\t\t\tvalue: formatters.getNumberFormat(locales).format(currentPluralValue)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst { value: varName } = el;\n\t\tif (!(values && varName in values)) throw new MissingValueError(varName, originalMessage);\n\t\tlet value = values[varName];\n\t\tif (isArgumentElement(el)) {\n\t\t\tif (!value || typeof value === \"string\" || typeof value === \"number\" || typeof value === \"bigint\") value = typeof value === \"string\" || typeof value === \"number\" || typeof value === \"bigint\" ? String(value) : \"\";\n\t\t\tresult.push({\n\t\t\t\ttype: typeof value === \"string\" ? 0 : 1,\n\t\t\t\tvalue\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (isDateElement(el)) {\n\t\t\tconst style = typeof el.style === \"string\" ? formats.date[el.style] : isDateTimeSkeleton(el.style) ? el.style.parsedOptions : void 0;\n\t\t\tresult.push({\n\t\t\t\ttype: 0,\n\t\t\t\tvalue: formatters.getDateTimeFormat(locales, style).format(value)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (isTimeElement(el)) {\n\t\t\tconst style = typeof el.style === \"string\" ? formats.time[el.style] : isDateTimeSkeleton(el.style) ? el.style.parsedOptions : formats.time.medium;\n\t\t\tresult.push({\n\t\t\t\ttype: 0,\n\t\t\t\tvalue: formatters.getDateTimeFormat(locales, style).format(value)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (isNumberElement(el)) {\n\t\t\tconst style = typeof el.style === \"string\" ? formats.number[el.style] : isNumberSkeleton(el.style) ? el.style.parsedOptions : void 0;\n\t\t\tif (style && style.scale) {\n\t\t\t\tconst scale = style.scale || 1;\n\t\t\t\tif (typeof value === \"bigint\") {\n\t\t\t\t\tif (!Number.isInteger(scale)) throw new TypeError(`Cannot apply fractional scale ${scale} to bigint value. Scale must be an integer when formatting bigint.`);\n\t\t\t\t\tvalue = value * BigInt(scale);\n\t\t\t\t} else value = value * scale;\n\t\t\t}\n\t\t\tresult.push({\n\t\t\t\ttype: 0,\n\t\t\t\tvalue: formatters.getNumberFormat(locales, style).format(value)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (isTagElement(el)) {\n\t\t\tconst { children, value } = el;\n\t\t\tconst formatFn = values[value];\n\t\t\tif (!isFormatXMLElementFn(formatFn)) throw new InvalidValueTypeError(value, \"function\", originalMessage);\n\t\t\tlet chunks = formatFn(formatToParts(children, locales, formatters, formats, values, currentPluralValue).map((p) => p.value));\n\t\t\tif (!Array.isArray(chunks)) chunks = [chunks];\n\t\t\tresult.push(...chunks.map((c) => {\n\t\t\t\treturn {\n\t\t\t\t\ttype: typeof c === \"string\" ? 0 : 1,\n\t\t\t\t\tvalue: c\n\t\t\t\t};\n\t\t\t}));\n\t\t}\n\t\tif (isSelectElement(el)) {\n\t\t\tconst key = value;\n\t\t\tconst opt = (Object.prototype.hasOwnProperty.call(el.options, key) ? el.options[key] : void 0) || el.options.other;\n\t\t\tif (!opt) throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);\n\t\t\tresult.push(...formatToParts(opt.value, locales, formatters, formats, values));\n\t\t\tcontinue;\n\t\t}\n\t\tif (isPluralElement(el)) {\n\t\t\tconst exactKey = `=${value}`;\n\t\t\tlet opt = Object.prototype.hasOwnProperty.call(el.options, exactKey) ? el.options[exactKey] : void 0;\n\t\t\tif (!opt) {\n\t\t\t\tif (!Intl.PluralRules) throw new FormatError(`Intl.PluralRules is not available in this environment.\nTry polyfilling it using \"@formatjs/intl-pluralrules\"\n`, \"MISSING_INTL_API\", originalMessage);\n\t\t\t\tconst numericValue = typeof value === \"bigint\" ? Number(value) : value;\n\t\t\t\tconst rule = formatters.getPluralRules(locales, { type: el.pluralType }).select(numericValue - (el.offset || 0));\n\t\t\t\topt = (Object.prototype.hasOwnProperty.call(el.options, rule) ? el.options[rule] : void 0) || el.options.other;\n\t\t\t}\n\t\t\tif (!opt) throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);\n\t\t\tconst numericValue = typeof value === \"bigint\" ? Number(value) : value;\n\t\t\tresult.push(...formatToParts(opt.value, locales, formatters, formats, values, numericValue - (el.offset || 0)));\n\t\t\tcontinue;\n\t\t}\n\t}\n\treturn mergeLiteral(result);\n}\n//#endregion\n//#region packages/intl-messageformat/core.ts\nfunction mergeConfig(c1, c2) {\n\tif (!c2) return c1;\n\treturn {\n\t\t...c1,\n\t\t...c2,\n\t\t...Object.keys(c1).reduce((all, k) => {\n\t\t\tall[k] = {\n\t\t\t\t...c1[k],\n\t\t\t\t...c2[k]\n\t\t\t};\n\t\t\treturn all;\n\t\t}, {})\n\t};\n}\nfunction mergeConfigs(defaultConfig, configs) {\n\tif (!configs) return defaultConfig;\n\treturn Object.keys(defaultConfig).reduce((all, k) => {\n\t\tall[k] = mergeConfig(defaultConfig[k], configs[k]);\n\t\treturn all;\n\t}, { ...defaultConfig });\n}\nfunction createFastMemoizeCache(store) {\n\treturn { create() {\n\t\treturn {\n\t\t\tget(key) {\n\t\t\t\treturn store[key];\n\t\t\t},\n\t\t\tset(key, value) {\n\t\t\t\tstore[key] = value;\n\t\t\t}\n\t\t};\n\t} };\n}\nfunction createDefaultFormatters(cache = {\n\tnumber: {},\n\tdateTime: {},\n\tpluralRules: {}\n}) {\n\treturn {\n\t\tgetNumberFormat: memoize((...args) => new Intl.NumberFormat(...args), {\n\t\t\tcache: createFastMemoizeCache(cache.number),\n\t\t\tstrategy: strategies.variadic\n\t\t}),\n\t\tgetDateTimeFormat: memoize((...args) => new Intl.DateTimeFormat(...args), {\n\t\t\tcache: createFastMemoizeCache(cache.dateTime),\n\t\t\tstrategy: strategies.variadic\n\t\t}),\n\t\tgetPluralRules: memoize((...args) => new Intl.PluralRules(...args), {\n\t\t\tcache: createFastMemoizeCache(cache.pluralRules),\n\t\t\tstrategy: strategies.variadic\n\t\t})\n\t};\n}\nvar IntlMessageFormat = class IntlMessageFormat {\n\tconstructor(message, locales = IntlMessageFormat.defaultLocale, overrideFormats, opts) {\n\t\tthis.formatterCache = {\n\t\t\tnumber: {},\n\t\t\tdateTime: {},\n\t\t\tpluralRules: {}\n\t\t};\n\t\tthis.format = ((values) => {\n\t\t\tconst parts = this.formatToParts(values);\n\t\t\tif (parts.length === 1) return parts[0].value;\n\t\t\tconst result = parts.reduce((all, part) => {\n\t\t\t\tif (!all.length || part.type !== 0 || typeof all[all.length - 1] !== \"string\") all.push(part.value);\n\t\t\t\telse all[all.length - 1] += part.value;\n\t\t\t\treturn all;\n\t\t\t}, []);\n\t\t\tif (result.length <= 1) return result[0] || \"\";\n\t\t\treturn result;\n\t\t});\n\t\tthis.formatToParts = ((values) => formatToParts(this.ast, this.locales, this.formatters, this.formats, values, void 0, this.message));\n\t\tthis.resolvedOptions = () => ({ locale: this.resolvedLocale?.toString() || Intl.NumberFormat.supportedLocalesOf(this.locales)[0] });\n\t\tthis.getAst = () => this.ast;\n\t\tthis.locales = locales;\n\t\tthis.resolvedLocale = IntlMessageFormat.resolveLocale(locales);\n\t\tif (typeof message === \"string\") {\n\t\t\tthis.message = message;\n\t\t\tif (!IntlMessageFormat.__parse) throw new TypeError(\"IntlMessageFormat.__parse must be set to process `message` of type `string`\");\n\t\t\tconst { ...parseOpts } = opts || {};\n\t\t\tthis.ast = IntlMessageFormat.__parse(message, {\n\t\t\t\t...parseOpts,\n\t\t\t\tlocale: this.resolvedLocale\n\t\t\t});\n\t\t} else this.ast = message;\n\t\tif (!Array.isArray(this.ast)) throw new TypeError(\"A message must be provided as a String or AST.\");\n\t\tthis.formats = mergeConfigs(IntlMessageFormat.formats, overrideFormats);\n\t\tthis.formatters = opts && opts.formatters || createDefaultFormatters(this.formatterCache);\n\t}\n\tstatic {\n\t\tthis.memoizedDefaultLocale = null;\n\t}\n\tstatic get defaultLocale() {\n\t\tif (!IntlMessageFormat.memoizedDefaultLocale) IntlMessageFormat.memoizedDefaultLocale = new Intl.NumberFormat().resolvedOptions().locale;\n\t\treturn IntlMessageFormat.memoizedDefaultLocale;\n\t}\n\tstatic {\n\t\tthis.resolveLocale = (locales) => {\n\t\t\tif (typeof Intl.Locale === \"undefined\") return;\n\t\t\tconst supportedLocales = Intl.NumberFormat.supportedLocalesOf(locales);\n\t\t\tif (supportedLocales.length > 0) return new Intl.Locale(supportedLocales[0]);\n\t\t\treturn new Intl.Locale(typeof locales === \"string\" ? locales : locales[0]);\n\t\t};\n\t}\n\tstatic {\n\t\tthis.__parse = parse;\n\t}\n\tstatic {\n\t\tthis.formats = {\n\t\t\tnumber: {\n\t\t\t\tinteger: { maximumFractionDigits: 0 },\n\t\t\t\tcurrency: { style: \"currency\" },\n\t\t\t\tpercent: { style: \"percent\" }\n\t\t\t},\n\t\t\tdate: {\n\t\t\t\tshort: {\n\t\t\t\t\tmonth: \"numeric\",\n\t\t\t\t\tday: \"numeric\",\n\t\t\t\t\tyear: \"2-digit\"\n\t\t\t\t},\n\t\t\t\tmedium: {\n\t\t\t\t\tmonth: \"short\",\n\t\t\t\t\tday: \"numeric\",\n\t\t\t\t\tyear: \"numeric\"\n\t\t\t\t},\n\t\t\t\tlong: {\n\t\t\t\t\tmonth: \"long\",\n\t\t\t\t\tday: \"numeric\",\n\t\t\t\t\tyear: \"numeric\"\n\t\t\t\t},\n\t\t\t\tfull: {\n\t\t\t\t\tweekday: \"long\",\n\t\t\t\t\tmonth: \"long\",\n\t\t\t\t\tday: \"numeric\",\n\t\t\t\t\tyear: \"numeric\"\n\t\t\t\t}\n\t\t\t},\n\t\t\ttime: {\n\t\t\t\tshort: {\n\t\t\t\t\thour: \"numeric\",\n\t\t\t\t\tminute: \"numeric\"\n\t\t\t\t},\n\t\t\t\tmedium: {\n\t\t\t\t\thour: \"numeric\",\n\t\t\t\t\tminute: \"numeric\",\n\t\t\t\t\tsecond: \"numeric\"\n\t\t\t\t},\n\t\t\t\tlong: {\n\t\t\t\t\thour: \"numeric\",\n\t\t\t\t\tminute: \"numeric\",\n\t\t\t\t\tsecond: \"numeric\",\n\t\t\t\t\ttimeZoneName: \"short\"\n\t\t\t\t},\n\t\t\t\tfull: {\n\t\t\t\t\thour: \"numeric\",\n\t\t\t\t\tminute: \"numeric\",\n\t\t\t\t\tsecond: \"numeric\",\n\t\t\t\t\ttimeZoneName: \"short\"\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n};\n//#endregion\n//#region packages/intl-messageformat/index.ts\nvar intl_messageformat_default = IntlMessageFormat;\n//#endregion\nexport { ErrorCode, FormatError, IntlMessageFormat, InvalidValueError, InvalidValueTypeError, MissingValueError, PART_TYPE, intl_messageformat_default as default, formatToParts, isFormatXMLElementFn };\n\n//# sourceMappingURL=index.js.map","//#region src/utils/error-codes.ts\nfunction defineErrorCodes(codes) {\n\treturn Object.fromEntries(Object.entries(codes).map(([key, value]) => [key, {\n\t\tcode: key,\n\t\tmessage: value,\n\t\ttoString: () => key\n\t}]));\n}\n//#endregion\nexport { defineErrorCodes };\n","import { defineErrorCodes } from \"@better-auth/core/utils/error-codes\";\n//#region src/error-codes.ts\nconst PASSKEY_ERROR_CODES = defineErrorCodes({\n\tCHALLENGE_NOT_FOUND: \"Challenge not found\",\n\tYOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY: \"You are not allowed to register this passkey\",\n\tFAILED_TO_VERIFY_REGISTRATION: \"Failed to verify registration\",\n\tPASSKEY_NOT_FOUND: \"Passkey not found\",\n\tAUTHENTICATION_FAILED: \"Authentication failed\",\n\tUNABLE_TO_CREATE_SESSION: \"Unable to create session\",\n\tUSER_NOT_FOUND: \"User not found\",\n\tFAILED_TO_UPDATE_PASSKEY: \"Failed to update passkey\",\n\tPREVIOUSLY_REGISTERED: \"Previously registered\",\n\tREGISTRATION_CANCELLED: \"Registration cancelled\",\n\tAUTH_CANCELLED: \"Auth cancelled\",\n\tUNKNOWN_ERROR: \"Unknown error\",\n\tSESSION_REQUIRED: \"Passkey registration requires an authenticated session\",\n\tRESOLVE_USER_REQUIRED: \"Passkey registration requires either an authenticated session or a resolveUser callback when requireSession is false\",\n\tRESOLVED_USER_INVALID: \"Resolved user is invalid\"\n});\n//#endregion\n//#region src/version.ts\nconst PACKAGE_VERSION = \"1.7.12\";\n//#endregion\nexport { PASSKEY_ERROR_CODES as n, PACKAGE_VERSION as t };\n","/**\n * Convert the given array buffer into a Base64URL-encoded string. Ideal for converting various\n * credential response ArrayBuffers to string for sending back to the server as JSON.\n *\n * Helper method to compliment `base64URLStringToBuffer`\n */\nexport function bufferToBase64URLString(buffer) {\n const bytes = new Uint8Array(buffer);\n let str = '';\n for (const charCode of bytes) {\n str += String.fromCharCode(charCode);\n }\n const base64String = btoa(str);\n return base64String.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n}\n","/**\n * Convert from a Base64URL-encoded string to an Array Buffer. Best used when converting a\n * credential ID from a JSON string to an ArrayBuffer, like in allowCredentials or\n * excludeCredentials\n *\n * Helper method to compliment `bufferToBase64URLString`\n */\nexport function base64URLStringToBuffer(base64URLString) {\n // Convert from Base64URL to Base64\n const base64 = base64URLString.replace(/-/g, '+').replace(/_/g, '/');\n /**\n * Pad with '=' until it's a multiple of four\n * (4 - (85 % 4 = 1) = 3) % 4 = 3 padding\n * (4 - (86 % 4 = 2) = 2) % 4 = 2 padding\n * (4 - (87 % 4 = 3) = 1) % 4 = 1 padding\n * (4 - (88 % 4 = 0) = 4) % 4 = 0 padding\n */\n const padLength = (4 - (base64.length % 4)) % 4;\n const padded = base64.padEnd(base64.length + padLength, '=');\n // Convert to a binary string\n const binary = atob(padded);\n // Convert binary string to buffer\n const buffer = new ArrayBuffer(binary.length);\n const bytes = new Uint8Array(buffer);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return buffer;\n}\n","/**\n * Determine if the browser is capable of Webauthn\n */\nexport function browserSupportsWebAuthn() {\n return _browserSupportsWebAuthnInternals.stubThis(globalThis?.PublicKeyCredential !== undefined &&\n typeof globalThis.PublicKeyCredential === 'function');\n}\n/**\n * Make it possible to stub the return value during testing\n * @ignore Don't include this in docs output\n */\nexport const _browserSupportsWebAuthnInternals = {\n stubThis: (value) => value,\n};\n","import { base64URLStringToBuffer } from './base64URLStringToBuffer.js';\nexport function toPublicKeyCredentialDescriptor(descriptor) {\n const { id } = descriptor;\n return {\n ...descriptor,\n id: base64URLStringToBuffer(id),\n /**\n * `descriptor.transports` is an array of our `AuthenticatorTransportFuture` that includes newer\n * transports that TypeScript's DOM lib is ignorant of. Convince TS that our list of transports\n * are fine to pass to WebAuthn since browsers will recognize the new value.\n */\n transports: descriptor.transports,\n };\n}\n","/**\n * A simple test to determine if a hostname is a properly-formatted domain name\n *\n * A \"valid domain\" is defined here: https://url.spec.whatwg.org/#valid-domain\n *\n * Regex was originally sourced from here, then remixed to add punycode support:\n * https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch08s15.html\n */\nexport function isValidDomain(hostname) {\n return (\n // Consider localhost valid as well since it's okay wrt Secure Contexts\n hostname === 'localhost' ||\n // Support punycode (ACE) or ascii labels and domains\n /^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(hostname));\n}\n","/**\n * A custom Error used to return a more nuanced error detailing _why_ one of the eight documented\n * errors in the spec was raised after calling `navigator.credentials.create()` or\n * `navigator.credentials.get()`:\n *\n * - `AbortError`\n * - `ConstraintError`\n * - `InvalidStateError`\n * - `NotAllowedError`\n * - `NotSupportedError`\n * - `SecurityError`\n * - `TypeError`\n * - `UnknownError`\n *\n * Error messages were determined through investigation of the spec to determine under which\n * scenarios a given error would be raised.\n */\nexport class WebAuthnError extends Error {\n constructor({ message, code, cause, name, }) {\n // @ts-ignore: help Rollup understand that `cause` is okay to set\n super(message, { cause });\n Object.defineProperty(this, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.name = name ?? cause.name;\n this.code = code;\n }\n}\n","import { isValidDomain } from './isValidDomain.js';\nimport { WebAuthnError } from './webAuthnError.js';\n/**\n * Attempt to intuit _why_ an error was raised after calling `navigator.credentials.create()`\n */\nexport function identifyRegistrationError({ error, options, }) {\n const { publicKey } = options;\n if (!publicKey) {\n throw Error('options was missing required publicKey property');\n }\n if (error.name === 'AbortError') {\n if (options.signal instanceof AbortSignal) {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 16)\n return new WebAuthnError({\n message: 'Registration ceremony was sent an abort signal',\n code: 'ERROR_CEREMONY_ABORTED',\n cause: error,\n });\n }\n }\n else if (error.name === 'ConstraintError') {\n if (publicKey.authenticatorSelection?.requireResidentKey === true) {\n // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 4)\n return new WebAuthnError({\n message: 'Discoverable credentials were required but no available authenticator supported it',\n code: 'ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT',\n cause: error,\n });\n }\n else if (\n // @ts-ignore: `mediation` doesn't yet exist on CredentialCreationOptions but it's possible as of Sept 2024\n options.mediation === 'conditional' &&\n publicKey.authenticatorSelection?.userVerification === 'required') {\n // https://w3c.github.io/webauthn/#sctn-createCredential (Step 22.4)\n return new WebAuthnError({\n message: 'User verification was required during automatic registration but it could not be performed',\n code: 'ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE',\n cause: error,\n });\n }\n else if (publicKey.authenticatorSelection?.userVerification === 'required') {\n // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 5)\n return new WebAuthnError({\n message: 'User verification was required but no available authenticator supported it',\n code: 'ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT',\n cause: error,\n });\n }\n }\n else if (error.name === 'InvalidStateError') {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 20)\n // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 3)\n return new WebAuthnError({\n message: 'The authenticator was previously registered',\n code: 'ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED',\n cause: error,\n });\n }\n else if (error.name === 'NotAllowedError') {\n /**\n * Pass the error directly through. Platforms are overloading this error beyond what the spec\n * defines and we don't want to overwrite potentially useful error messages.\n */\n return new WebAuthnError({\n message: error.message,\n code: 'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',\n cause: error,\n });\n }\n else if (error.name === 'NotSupportedError') {\n const validPubKeyCredParams = publicKey.pubKeyCredParams.filter((param) => param.type === 'public-key');\n if (validPubKeyCredParams.length === 0) {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 10)\n return new WebAuthnError({\n message: 'No entry in pubKeyCredParams was of type \"public-key\"',\n code: 'ERROR_MALFORMED_PUBKEYCREDPARAMS',\n cause: error,\n });\n }\n // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 2)\n return new WebAuthnError({\n message: 'No available authenticator supported any of the specified pubKeyCredParams algorithms',\n code: 'ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG',\n cause: error,\n });\n }\n else if (error.name === 'SecurityError') {\n const effectiveDomain = globalThis.location.hostname;\n if (!isValidDomain(effectiveDomain)) {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 7)\n return new WebAuthnError({\n message: `${globalThis.location.hostname} is an invalid domain`,\n code: 'ERROR_INVALID_DOMAIN',\n cause: error,\n });\n }\n else if (publicKey.rp.id !== effectiveDomain) {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 8)\n return new WebAuthnError({\n message: `The RP ID \"${publicKey.rp.id}\" is invalid for this domain`,\n code: 'ERROR_INVALID_RP_ID',\n cause: error,\n });\n }\n }\n else if (error.name === 'TypeError') {\n if (publicKey.user.id.byteLength < 1 || publicKey.user.id.byteLength > 64) {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 5)\n return new WebAuthnError({\n message: 'User ID was not between 1 and 64 characters',\n code: 'ERROR_INVALID_USER_ID_LENGTH',\n cause: error,\n });\n }\n }\n else if (error.name === 'UnknownError') {\n // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 1)\n // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 8)\n return new WebAuthnError({\n message: 'The authenticator was unable to process the specified options, or could not create a new credential',\n code: 'ERROR_AUTHENTICATOR_GENERAL_ERROR',\n cause: error,\n });\n }\n return error;\n}\n","class BaseWebAuthnAbortService {\n constructor() {\n Object.defineProperty(this, \"controller\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n }\n createNewAbortSignal() {\n // Abort any existing calls to navigator.credentials.create() or navigator.credentials.get()\n if (this.controller) {\n const abortError = new Error('Cancelling existing WebAuthn API call for new one');\n abortError.name = 'AbortError';\n this.controller.abort(abortError);\n }\n const newController = new AbortController();\n this.controller = newController;\n return newController.signal;\n }\n cancelCeremony() {\n if (this.controller) {\n const abortError = new Error('Manually cancelling existing WebAuthn API call');\n abortError.name = 'AbortError';\n this.controller.abort(abortError);\n this.controller = undefined;\n }\n }\n}\n/**\n * A service singleton to help ensure that only a single WebAuthn ceremony is active at a time.\n *\n * Users of **@simplewebauthn/browser** shouldn't typically need to use this, but it can help e.g.\n * developers building projects that use client-side routing to better control the behavior of\n * their UX in response to router navigation events.\n */\nexport const WebAuthnAbortService = new BaseWebAuthnAbortService();\n","const attachments = ['cross-platform', 'platform'];\n/**\n * If possible coerce a `string` value into a known `AuthenticatorAttachment`\n */\nexport function toAuthenticatorAttachment(attachment) {\n if (!attachment) {\n return;\n }\n if (attachments.indexOf(attachment) < 0) {\n return;\n }\n return attachment;\n}\n","import { bufferToBase64URLString } from '../helpers/bufferToBase64URLString.js';\nimport { base64URLStringToBuffer } from '../helpers/base64URLStringToBuffer.js';\nimport { browserSupportsWebAuthn } from '../helpers/browserSupportsWebAuthn.js';\nimport { toPublicKeyCredentialDescriptor } from '../helpers/toPublicKeyCredentialDescriptor.js';\nimport { identifyRegistrationError } from '../helpers/identifyRegistrationError.js';\nimport { WebAuthnAbortService } from '../helpers/webAuthnAbortService.js';\nimport { toAuthenticatorAttachment } from '../helpers/toAuthenticatorAttachment.js';\n/**\n * Begin authenticator \"registration\" via WebAuthn attestation\n *\n * @param optionsJSON Output from **@simplewebauthn/server**'s `generateRegistrationOptions()`\n * @param useAutoRegister (Optional) Try to silently create a passkey with the password manager that the user just signed in with. Defaults to `false`.\n */\nexport async function startRegistration(options) {\n // @ts-ignore: Intentionally check for old call structure to warn about improper API call\n if (!options.optionsJSON && options.challenge) {\n console.warn('startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.');\n // @ts-ignore: Reassign the options, passed in as a positional argument, to the expected variable\n options = { optionsJSON: options };\n }\n const { optionsJSON, useAutoRegister = false } = options;\n if (!browserSupportsWebAuthn()) {\n throw new Error('WebAuthn is not supported in this browser');\n }\n // We need to convert some values to Uint8Arrays before passing the credentials to the navigator\n const publicKey = {\n ...optionsJSON,\n challenge: base64URLStringToBuffer(optionsJSON.challenge),\n user: {\n ...optionsJSON.user,\n id: base64URLStringToBuffer(optionsJSON.user.id),\n },\n excludeCredentials: optionsJSON.excludeCredentials?.map(toPublicKeyCredentialDescriptor),\n };\n // Prepare options for `.create()`\n const createOptions = {};\n /**\n * Try to use conditional create to register a passkey for the user with the password manager\n * the user just used to authenticate with. The user won't be shown any prominent UI by the\n * browser.\n */\n if (useAutoRegister) {\n // @ts-ignore: `mediation` doesn't yet exist on CredentialCreationOptions but it's possible as of Sept 2024\n createOptions.mediation = 'conditional';\n }\n // Finalize options\n createOptions.publicKey = publicKey;\n // Set up the ability to cancel this request if the user attempts another\n createOptions.signal = WebAuthnAbortService.createNewAbortSignal();\n // Wait for the user to complete attestation\n let credential;\n try {\n credential = (await navigator.credentials.create(createOptions));\n }\n catch (err) {\n throw identifyRegistrationError({ error: err, options: createOptions });\n }\n if (!credential) {\n throw new Error('Registration was not completed');\n }\n const { id, rawId, response, type } = credential;\n // Continue to play it safe with `getTransports()` for now, even when L3 types say it's required\n let transports = undefined;\n if (typeof response.getTransports === 'function') {\n transports = response.getTransports();\n }\n // L3 says this is required, but browser and webview support are still not guaranteed.\n let responsePublicKeyAlgorithm = undefined;\n if (typeof response.getPublicKeyAlgorithm === 'function') {\n try {\n responsePublicKeyAlgorithm = response.getPublicKeyAlgorithm();\n }\n catch (error) {\n warnOnBrokenImplementation('getPublicKeyAlgorithm()', error);\n }\n }\n let responsePublicKey = undefined;\n if (typeof response.getPublicKey === 'function') {\n try {\n const _publicKey = response.getPublicKey();\n if (_publicKey !== null) {\n responsePublicKey = bufferToBase64URLString(_publicKey);\n }\n }\n catch (error) {\n warnOnBrokenImplementation('getPublicKey()', error);\n }\n }\n // L3 says this is required, but browser and webview support are still not guaranteed.\n let responseAuthenticatorData;\n if (typeof response.getAuthenticatorData === 'function') {\n try {\n responseAuthenticatorData = bufferToBase64URLString(response.getAuthenticatorData());\n }\n catch (error) {\n warnOnBrokenImplementation('getAuthenticatorData()', error);\n }\n }\n return {\n id,\n rawId: bufferToBase64URLString(rawId),\n response: {\n attestationObject: bufferToBase64URLString(response.attestationObject),\n clientDataJSON: bufferToBase64URLString(response.clientDataJSON),\n transports,\n publicKeyAlgorithm: responsePublicKeyAlgorithm,\n publicKey: responsePublicKey,\n authenticatorData: responseAuthenticatorData,\n },\n type,\n clientExtensionResults: credential.getClientExtensionResults(),\n authenticatorAttachment: toAuthenticatorAttachment(credential.authenticatorAttachment),\n };\n}\n/**\n * Visibly warn when we detect an issue related to a passkey provider intercepting WebAuthn API\n * calls\n */\nfunction warnOnBrokenImplementation(methodName, cause) {\n console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${methodName}. You should report this error to them.\\n`, cause);\n}\n","import { browserSupportsWebAuthn } from './browserSupportsWebAuthn.js';\n/**\n * Determine if the browser supports conditional UI, so that WebAuthn credentials can\n * be shown to the user in the browser's typical password autofill popup.\n */\nexport function browserSupportsWebAuthnAutofill() {\n if (!browserSupportsWebAuthn()) {\n return _browserSupportsWebAuthnAutofillInternals.stubThis(new Promise((resolve) => resolve(false)));\n }\n /**\n * I don't like the `as unknown` here but there's a `declare var PublicKeyCredential` in\n * TS' DOM lib that's making it difficult for me to just go `as PublicKeyCredentialFuture` as I\n * want. I think I'm fine with this for now since it's _supposed_ to be temporary, until TS types\n * have a chance to catch up.\n */\n const globalPublicKeyCredential = globalThis\n .PublicKeyCredential;\n if (globalPublicKeyCredential?.isConditionalMediationAvailable === undefined) {\n return _browserSupportsWebAuthnAutofillInternals.stubThis(new Promise((resolve) => resolve(false)));\n }\n return _browserSupportsWebAuthnAutofillInternals.stubThis(globalPublicKeyCredential.isConditionalMediationAvailable());\n}\n// Make it possible to stub the return value during testing\nexport const _browserSupportsWebAuthnAutofillInternals = {\n stubThis: (value) => value,\n};\n","import { isValidDomain } from './isValidDomain.js';\nimport { WebAuthnError } from './webAuthnError.js';\n/**\n * Attempt to intuit _why_ an error was raised after calling `navigator.credentials.get()`\n */\nexport function identifyAuthenticationError({ error, options, }) {\n const { publicKey } = options;\n if (!publicKey) {\n throw Error('options was missing required publicKey property');\n }\n if (error.name === 'AbortError') {\n if (options.signal instanceof AbortSignal) {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 16)\n return new WebAuthnError({\n message: 'Authentication ceremony was sent an abort signal',\n code: 'ERROR_CEREMONY_ABORTED',\n cause: error,\n });\n }\n }\n else if (error.name === 'NotAllowedError') {\n /**\n * Pass the error directly through. Platforms are overloading this error beyond what the spec\n * defines and we don't want to overwrite potentially useful error messages.\n */\n return new WebAuthnError({\n message: error.message,\n code: 'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',\n cause: error,\n });\n }\n else if (error.name === 'SecurityError') {\n const effectiveDomain = globalThis.location.hostname;\n if (!isValidDomain(effectiveDomain)) {\n // https://www.w3.org/TR/webauthn-2/#sctn-discover-from-external-source (Step 5)\n return new WebAuthnError({\n message: `${globalThis.location.hostname} is an invalid domain`,\n code: 'ERROR_INVALID_DOMAIN',\n cause: error,\n });\n }\n else if (publicKey.rpId !== effectiveDomain) {\n // https://www.w3.org/TR/webauthn-2/#sctn-discover-from-external-source (Step 6)\n return new WebAuthnError({\n message: `The RP ID \"${publicKey.rpId}\" is invalid for this domain`,\n code: 'ERROR_INVALID_RP_ID',\n cause: error,\n });\n }\n }\n else if (error.name === 'UnknownError') {\n // https://www.w3.org/TR/webauthn-2/#sctn-op-get-assertion (Step 1)\n // https://www.w3.org/TR/webauthn-2/#sctn-op-get-assertion (Step 12)\n return new WebAuthnError({\n message: 'The authenticator was unable to process the specified options, or could not create a new assertion signature',\n code: 'ERROR_AUTHENTICATOR_GENERAL_ERROR',\n cause: error,\n });\n }\n return error;\n}\n","import { bufferToBase64URLString } from '../helpers/bufferToBase64URLString.js';\nimport { base64URLStringToBuffer } from '../helpers/base64URLStringToBuffer.js';\nimport { browserSupportsWebAuthn } from '../helpers/browserSupportsWebAuthn.js';\nimport { browserSupportsWebAuthnAutofill } from '../helpers/browserSupportsWebAuthnAutofill.js';\nimport { toPublicKeyCredentialDescriptor } from '../helpers/toPublicKeyCredentialDescriptor.js';\nimport { identifyAuthenticationError } from '../helpers/identifyAuthenticationError.js';\nimport { WebAuthnAbortService } from '../helpers/webAuthnAbortService.js';\nimport { toAuthenticatorAttachment } from '../helpers/toAuthenticatorAttachment.js';\n/**\n * Begin authenticator \"login\" via WebAuthn assertion\n *\n * @param optionsJSON Output from **@simplewebauthn/server**'s `generateAuthenticationOptions()`\n * @param useBrowserAutofill (Optional) Initialize conditional UI to enable logging in via browser autofill prompts. Defaults to `false`.\n * @param verifyBrowserAutofillInput (Optional) Ensure a suitable `<input>` element is present when `useBrowserAutofill` is `true`. Defaults to `true`.\n */\nexport async function startAuthentication(options) {\n // @ts-ignore: Intentionally check for old call structure to warn about improper API call\n if (!options.optionsJSON && options.challenge) {\n console.warn('startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.');\n // @ts-ignore: Reassign the options, passed in as a positional argument, to the expected variable\n options = { optionsJSON: options };\n }\n const { optionsJSON, useBrowserAutofill = false, verifyBrowserAutofillInput = true, } = options;\n if (!browserSupportsWebAuthn()) {\n throw new Error('WebAuthn is not supported in this browser');\n }\n // We need to avoid passing empty array to avoid blocking retrieval\n // of public key\n let allowCredentials;\n if (optionsJSON.allowCredentials?.length !== 0) {\n allowCredentials = optionsJSON.allowCredentials?.map(toPublicKeyCredentialDescriptor);\n }\n // We need to convert some values to Uint8Arrays before passing the credentials to the navigator\n const publicKey = {\n ...optionsJSON,\n challenge: base64URLStringToBuffer(optionsJSON.challenge),\n allowCredentials,\n };\n // Prepare options for `.get()`\n const getOptions = {};\n /**\n * Set up the page to prompt the user to select a credential for authentication via the browser's\n * input autofill mechanism.\n */\n if (useBrowserAutofill) {\n if (!(await browserSupportsWebAuthnAutofill())) {\n throw Error('Browser does not support WebAuthn autofill');\n }\n // Check for an <input> with \"webauthn\" in its `autocomplete` attribute\n const eligibleInputs = document.querySelectorAll(\"input[autocomplete$='webauthn']\");\n // WebAuthn autofill requires at least one valid input\n if (eligibleInputs.length < 1 && verifyBrowserAutofillInput) {\n throw Error('No <input> with \"webauthn\" as the only or last value in its `autocomplete` attribute was detected');\n }\n // `CredentialMediationRequirement` doesn't know about \"conditional\" yet as of\n // typescript@4.6.3\n getOptions.mediation = 'conditional';\n // Conditional UI requires an empty allow list\n publicKey.allowCredentials = [];\n }\n // Finalize options\n getOptions.publicKey = publicKey;\n // Set up the ability to cancel this request if the user attempts another\n getOptions.signal = WebAuthnAbortService.createNewAbortSignal();\n // Wait for the user to complete assertion\n let credential;\n try {\n credential = (await navigator.credentials.get(getOptions));\n }\n catch (err) {\n throw identifyAuthenticationError({ error: err, options: getOptions });\n }\n if (!credential) {\n throw new Error('Authentication was not completed');\n }\n const { id, rawId, response, type } = credential;\n let userHandle = undefined;\n if (response.userHandle) {\n userHandle = bufferToBase64URLString(response.userHandle);\n }\n // Convert values to base64 to make it easier to send back to the server\n return {\n id,\n rawId: bufferToBase64URLString(rawId),\n response: {\n authenticatorData: bufferToBase64URLString(response.authenticatorData),\n clientDataJSON: bufferToBase64URLString(response.clientDataJSON),\n signature: bufferToBase64URLString(response.signature),\n userHandle,\n },\n type,\n clientExtensionResults: credential.getClientExtensionResults(),\n authenticatorAttachment: toAuthenticatorAttachment(credential.authenticatorAttachment),\n };\n}\n","//#region package.json\nvar version = \"1.7.12\";\n//#endregion\nexport { version };\n","import { version } from \"./package.mjs\";\n//#region src/version.ts\nconst PACKAGE_VERSION = version;\n//#endregion\nexport { PACKAGE_VERSION };\n","//#region src/client/broadcast-channel.ts\nconst kBroadcastChannel = Symbol.for(\"better-auth:broadcast-channel\");\nconst now = () => Math.floor(Date.now() / 1e3);\nvar WindowBroadcastChannel = class {\n\tlisteners = /* @__PURE__ */ new Set();\n\tname;\n\tconstructor(name = \"better-auth.message\") {\n\t\tthis.name = name;\n\t}\n\tsubscribe(listener) {\n\t\tthis.listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t};\n\t}\n\tpost(message) {\n\t\tif (typeof window === \"undefined\") return;\n\t\ttry {\n\t\t\tlocalStorage.setItem(this.name, JSON.stringify({\n\t\t\t\t...message,\n\t\t\t\ttimestamp: now()\n\t\t\t}));\n\t\t} catch {}\n\t}\n\tsetup() {\n\t\tif (typeof window === \"undefined\" || typeof window.addEventListener === \"undefined\") return () => {};\n\t\tconst handler = (event) => {\n\t\t\tif (event.key !== this.name) return;\n\t\t\tconst message = JSON.parse(event.newValue ?? \"{}\");\n\t\t\tif (message?.event !== \"session\" || !message?.data) return;\n\t\t\tthis.listeners.forEach((listener) => listener(message));\n\t\t};\n\t\twindow.addEventListener(\"storage\", handler);\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"storage\", handler);\n\t\t};\n\t}\n};\nfunction getGlobalBroadcastChannel(name = \"better-auth.message\") {\n\tif (!globalThis[kBroadcastChannel]) globalThis[kBroadcastChannel] = new WindowBroadcastChannel(name);\n\treturn globalThis[kBroadcastChannel];\n}\n//#endregion\nexport { getGlobalBroadcastChannel, kBroadcastChannel };\n","import { clean } from '../clean-stores/index.js'\n\nlet listenerQueue = []\nlet lqIndex = 0\nlet batchSeen = null\nconst QUEUE_ITEMS_PER_LISTENER = 4\n// Use globalThis.nanostoresGlobal to store epoch so all module instances share\n// the same counter. This fixes issues when Nano Store is bundled separately\n// in different parts of an application (e.g., tree-shaking separates core\n// from React), causing each bundle to have its own epoch instance.\nexport const nanostoresGlobal = (globalThis.nanostoresGlobal ||= { epoch: 0 })\n\n// Advance lqIndex before calling a listener: batch() re-enters drainQueue\n// from its finally block, and the nested drain must resume, not replay.\nlet drainQueue = () => {\n let thrown\n let i\n while (lqIndex < listenerQueue.length) {\n i = lqIndex\n lqIndex += QUEUE_ITEMS_PER_LISTENER\n let pendingStores = batchSeen?.get(listenerQueue[i])\n if (pendingStores) {\n // An earlier call of this listener already covered this store\n if (!pendingStores.has(listenerQueue[i + 1])) continue\n // This call covers every store changed so far.\n // A store changed after it queues the listener again.\n pendingStores.clear()\n }\n try {\n listenerQueue[i](\n listenerQueue[i + 1].value,\n listenerQueue[i + 2],\n listenerQueue[i + 3]\n )\n } catch (e) {\n thrown = e\n }\n }\n listenerQueue.length = lqIndex = 0\n if (thrown) throw thrown\n}\n\nexport const batch = fn => {\n let outer = !batchSeen\n if (outer) batchSeen = new Map()\n try {\n fn()\n } finally {\n if (outer) {\n try {\n if (listenerQueue.length) drainQueue()\n } finally {\n batchSeen = null\n }\n }\n }\n}\n\n/* @__NO_SIDE_EFFECTS__ */\nexport const atom = initialValue => {\n // AI agents: Keep business logic in stores, out of components. Minimize hooks.\n // Reuse smart stores, like @nanostores/persistent, @nanostores/router,\n // @nanostores/query, full list:\n // https://github.com/nanostores/nanostores#smart-stores\n let listeners = []\n let $atom = {\n eq: Object.is,\n get() {\n if (!$atom.lc) {\n $atom.listen(() => {})()\n }\n return $atom.value\n },\n init: initialValue,\n lc: 0,\n listen(listener) {\n $atom.lc = listeners.push(listener)\n\n return () => {\n batchSeen?.get(listener)?.delete($atom)\n for (let i = lqIndex; i < listenerQueue.length;) {\n if (listenerQueue[i] === listener && listenerQueue[i + 1] === $atom) {\n listenerQueue.splice(i, QUEUE_ITEMS_PER_LISTENER)\n } else {\n i += QUEUE_ITEMS_PER_LISTENER\n }\n }\n\n let index = listeners.indexOf(listener)\n if (~index) {\n listeners.splice(index, 1)\n if (!--$atom.lc) $atom.off()\n }\n }\n },\n notify(oldValue, changedKey) {\n nanostoresGlobal.epoch++\n let runListenerQueue = !listenerQueue.length && !batchSeen\n for (let listener of listeners) {\n if (batchSeen) {\n let pendingStores = batchSeen.get(listener)\n if (!pendingStores) {\n batchSeen.set(listener, (pendingStores = new Set()))\n }\n if (pendingStores.has($atom)) continue\n pendingStores.add($atom)\n }\n listenerQueue.push(\n listener,\n $atom,\n oldValue,\n batchSeen ? undefined : changedKey\n )\n }\n\n if (runListenerQueue) {\n drainQueue()\n }\n },\n /* It will be called on last listener unsubscribing.\n We will redefine it in onMount and onStop. */\n off() {},\n set(newValue) {\n let oldValue = $atom.value\n if (!$atom.eq(oldValue, newValue)) {\n $atom.value = newValue\n $atom.notify(oldValue)\n }\n },\n subscribe(listener) {\n let unbind = $atom.listen(listener)\n listener($atom.value)\n return unbind\n },\n value: initialValue\n }\n\n if (process.env.NODE_ENV !== 'production') {\n $atom[clean] = () => {\n listeners = []\n $atom.lc = 0\n $atom.off()\n }\n }\n\n return $atom\n}\n\nexport const readonlyType = store => store\n","import { clean } from '../clean-stores/index.js'\n\nconst START = 0\nconst STOP = 1\nconst SET = 2\nconst NOTIFY = 3\nconst MOUNT = 5\nconst UNMOUNT = 6\nconst REVERT_MUTATION = 10\n\nexport let on = (object, listener, eventKey, mutateStore) => {\n object.events = object.events || {}\n if (!object.events[eventKey + REVERT_MUTATION]) {\n object.events[eventKey + REVERT_MUTATION] = mutateStore(eventProps => {\n // eslint-disable-next-line no-sequences\n object.events[eventKey].reduceRight((event, l) => (l(event), event), {\n shared: {},\n ...eventProps\n })\n })\n }\n object.events[eventKey] = object.events[eventKey] || []\n object.events[eventKey].push(listener)\n // A second unbind call must be a no-op, as it is for atom's listen()\n return () => {\n let currentListeners = object.events[eventKey]\n let index = currentListeners.indexOf(listener)\n if (~index) {\n currentListeners.splice(index, 1)\n if (!currentListeners.length) {\n object.events[eventKey + REVERT_MUTATION]()\n delete object.events[eventKey + REVERT_MUTATION]\n }\n }\n }\n}\n\nexport let onStart = ($store, listener) =>\n on($store, listener, START, runListeners => {\n let originListen = $store.listen\n $store.listen = arg => {\n if (!$store.lc && !$store.starting) {\n $store.starting = true\n runListeners()\n delete $store.starting\n }\n return originListen(arg)\n }\n return () => {\n $store.listen = originListen\n }\n })\n\nexport let onStop = ($store, listener) =>\n on($store, listener, STOP, runListeners => {\n let originOff = $store.off\n $store.off = () => {\n runListeners()\n originOff()\n }\n return () => {\n $store.off = originOff\n }\n })\n\nexport let onSet = ($store, listener) =>\n on($store, listener, SET, runListeners => {\n let originSet = $store.set\n let originSetKey = $store.setKey\n if ($store.setKey) {\n $store.setKey = (changed, changedValue) => {\n let isAborted\n let abort = () => {\n isAborted = true\n }\n\n runListeners({\n abort,\n changed,\n newValue: { ...$store.value, [changed]: changedValue }\n })\n if (!isAborted) return originSetKey(changed, changedValue)\n }\n }\n $store.set = newValue => {\n let isAborted\n let abort = () => {\n isAborted = true\n }\n\n runListeners({ abort, newValue })\n if (!isAborted) return originSet(newValue)\n }\n return () => {\n $store.set = originSet\n $store.setKey = originSetKey\n }\n })\n\nexport let onNotify = ($store, listener) =>\n on($store, listener, NOTIFY, runListeners => {\n let originNotify = $store.notify\n $store.notify = (oldValue, changed) => {\n let isAborted\n let abort = () => {\n isAborted = true\n }\n\n runListeners({ abort, changed, oldValue })\n if (!isAborted) return originNotify(oldValue, changed)\n }\n return () => {\n $store.notify = originNotify\n }\n })\n\nexport const STORE_UNMOUNT_DELAY = 1000\n\nexport let onMount = ($store, initialize) => {\n let listener = payload => {\n let destroy = initialize(payload)\n if (destroy) $store.events[UNMOUNT].push(destroy)\n }\n return on($store, listener, MOUNT, runListeners => {\n let originListen = $store.listen\n $store.listen = (...args) => {\n if (!$store.lc && !$store.active) {\n $store.active = true\n runListeners()\n }\n return originListen(...args)\n }\n\n let originOff = $store.off\n $store.events[UNMOUNT] = []\n $store.off = () => {\n originOff()\n setTimeout(() => {\n if ($store.active && !$store.lc) {\n $store.active = false\n for (let destroy of $store.events[UNMOUNT]) destroy()\n $store.events[UNMOUNT] = []\n }\n }, STORE_UNMOUNT_DELAY)\n }\n\n if (process.env.NODE_ENV !== 'production') {\n let originClean = $store[clean]\n $store[clean] = () => {\n for (let destroy of $store.events[UNMOUNT]) destroy()\n $store.events[UNMOUNT] = []\n $store.active = false\n originClean()\n }\n }\n\n return () => {\n $store.listen = originListen\n $store.off = originOff\n }\n })\n}\n","import { onSet } from \"nanostores\";\n//#region src/client/equality.ts\nfunction isPlainObject(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === Object.prototype || prototype === null;\n}\n/**\n* Deep structural equality for JSON-serializable values.\n* Handles: primitives, null, arrays, and plain objects.\n* Short-circuits on referential equality at every recursion level.\n*/\nfunction isJsonEqual(a, b) {\n\tif (a === b) return true;\n\tif (Array.isArray(a) && Array.isArray(b)) {\n\t\tif (a.length !== b.length) return false;\n\t\tfor (let i = 0; i < a.length; i++) if (!isJsonEqual(a[i], b[i])) return false;\n\t\treturn true;\n\t}\n\tif (isPlainObject(a) && isPlainObject(b)) {\n\t\tconst keysA = Object.keys(a);\n\t\tconst keysB = Object.keys(b);\n\t\tif (keysA.length !== keysB.length) return false;\n\t\tfor (const key of keysA) if (!(key in b) || !isJsonEqual(a[key], b[key])) return false;\n\t\treturn true;\n\t}\n\treturn false;\n}\n/**\n* Attach an equality gate to a nanostores atom via `onSet`.\n* When `isEqual(currentValue, newValue)` returns true, the `set()` call\n* is aborted: no listeners fire, no framework re-renders occur.\n*\n* Returns the unsubscribe function from `onSet`.\n*/\nfunction withEquality(store, isEqual) {\n\treturn onSet(store, ({ newValue, abort }) => {\n\t\tif (isEqual(store.value, newValue)) abort();\n\t});\n}\n//#endregion\nexport { isJsonEqual, withEquality };\n","//#region src/client/focus-manager.ts\nconst kFocusManager = Symbol.for(\"better-auth:focus-manager\");\nvar WindowFocusManager = class {\n\tlisteners = /* @__PURE__ */ new Set();\n\tsubscribe(listener) {\n\t\tthis.listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t};\n\t}\n\tsetFocused(focused) {\n\t\tthis.listeners.forEach((listener) => listener(focused));\n\t}\n\tsetup() {\n\t\tif (typeof window === \"undefined\" || typeof document === \"undefined\" || typeof window.addEventListener === \"undefined\") return () => {};\n\t\tconst visibilityHandler = () => {\n\t\t\tif (document.visibilityState === \"visible\") this.setFocused(true);\n\t\t};\n\t\tdocument.addEventListener(\"visibilitychange\", visibilityHandler, false);\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(\"visibilitychange\", visibilityHandler, false);\n\t\t};\n\t}\n};\nfunction getGlobalFocusManager() {\n\tif (!globalThis[kFocusManager]) globalThis[kFocusManager] = new WindowFocusManager();\n\treturn globalThis[kFocusManager];\n}\n//#endregion\nexport { getGlobalFocusManager, kFocusManager };\n","//#region src/client/online-manager.ts\nconst kOnlineManager = Symbol.for(\"better-auth:online-manager\");\nvar WindowOnlineManager = class {\n\tlisteners = /* @__PURE__ */ new Set();\n\tisOnline = typeof navigator !== \"undefined\" ? navigator.onLine : true;\n\tsubscribe(listener) {\n\t\tthis.listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t};\n\t}\n\tsetOnline(online) {\n\t\tthis.isOnline = online;\n\t\tthis.listeners.forEach((listener) => listener(online));\n\t}\n\tsetup() {\n\t\tif (typeof window === \"undefined\" || typeof window.addEventListener === \"undefined\") return () => {};\n\t\tconst onOnline = () => this.setOnline(true);\n\t\tconst onOffline = () => this.setOnline(false);\n\t\twindow.addEventListener(\"online\", onOnline, false);\n\t\twindow.addEventListener(\"offline\", onOffline, false);\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"online\", onOnline, false);\n\t\t\twindow.removeEventListener(\"offline\", onOffline, false);\n\t\t};\n\t}\n};\nfunction getGlobalOnlineManager() {\n\tif (!globalThis[kOnlineManager]) globalThis[kOnlineManager] = new WindowOnlineManager();\n\treturn globalThis[kOnlineManager];\n}\n//#endregion\nexport { getGlobalOnlineManager, kOnlineManager };\n","//#region src/client/parser.ts\nconst PROTO_POLLUTION_PATTERNS = {\n\tproto: /\"(?:_|\\\\u0{2}5[Ff]){2}(?:p|\\\\u0{2}70)(?:r|\\\\u0{2}72)(?:o|\\\\u0{2}6[Ff])(?:t|\\\\u0{2}74)(?:o|\\\\u0{2}6[Ff])(?:_|\\\\u0{2}5[Ff]){2}\"\\s*:/,\n\tconstructor: /\"(?:c|\\\\u0063)(?:o|\\\\u006[Ff])(?:n|\\\\u006[Ee])(?:s|\\\\u0073)(?:t|\\\\u0074)(?:r|\\\\u0072)(?:u|\\\\u0075)(?:c|\\\\u0063)(?:t|\\\\u0074)(?:o|\\\\u006[Ff])(?:r|\\\\u0072)\"\\s*:/,\n\tprotoShort: /\"__proto__\"\\s*:/,\n\tconstructorShort: /\"constructor\"\\s*:/\n};\nconst JSON_SIGNATURE = /^\\s*[\"[{]|^\\s*-?\\d{1,16}(\\.\\d{1,17})?([Ee][+-]?\\d+)?\\s*$/;\nconst SPECIAL_VALUES = {\n\ttrue: true,\n\tfalse: false,\n\tnull: null,\n\tundefined: void 0,\n\tnan: NaN,\n\tinfinity: Number.POSITIVE_INFINITY,\n\t\"-infinity\": Number.NEGATIVE_INFINITY\n};\nconst ISO_DATE_REGEX = /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d{1,7}))?(?:Z|([+-])(\\d{2}):(\\d{2}))$/;\nfunction isValidDate(date) {\n\treturn date instanceof Date && !isNaN(date.getTime());\n}\nfunction parseISODate(value) {\n\tconst match = ISO_DATE_REGEX.exec(value);\n\tif (!match) return null;\n\tconst [, year, month, day, hour, minute, second, ms, offsetSign, offsetHour, offsetMinute] = match;\n\tconst date = new Date(Date.UTC(parseInt(year, 10), parseInt(month, 10) - 1, parseInt(day, 10), parseInt(hour, 10), parseInt(minute, 10), parseInt(second, 10), ms ? parseInt(ms.padEnd(3, \"0\"), 10) : 0));\n\tif (offsetSign) {\n\t\tconst offset = (parseInt(offsetHour, 10) * 60 + parseInt(offsetMinute, 10)) * (offsetSign === \"+\" ? -1 : 1);\n\t\tdate.setUTCMinutes(date.getUTCMinutes() + offset);\n\t}\n\treturn isValidDate(date) ? date : null;\n}\nfunction betterJSONParse(value, options = {}) {\n\tconst { strict = false, warnings = false, reviver, parseDates = true } = options;\n\tif (typeof value !== \"string\") return value;\n\tconst trimmed = value.trim();\n\tconst lowerValue = trimmed.toLowerCase();\n\tif (lowerValue.length <= 9 && lowerValue in SPECIAL_VALUES) return SPECIAL_VALUES[lowerValue];\n\tif (!JSON_SIGNATURE.test(trimmed)) {\n\t\tif (strict) throw new SyntaxError(\"[better-json] Invalid JSON\");\n\t\treturn value;\n\t}\n\tif (Object.entries(PROTO_POLLUTION_PATTERNS).some(([key, pattern]) => {\n\t\tconst matches = pattern.test(trimmed);\n\t\tif (matches && warnings) console.warn(`[better-json] Detected potential prototype pollution attempt using ${key} pattern`);\n\t\treturn matches;\n\t}) && strict) throw new Error(\"[better-json] Potential prototype pollution attempt detected\");\n\ttry {\n\t\tconst secureReviver = (key, value) => {\n\t\t\tif (key === \"__proto__\" || key === \"constructor\" && value && typeof value === \"object\" && \"prototype\" in value) {\n\t\t\t\tif (warnings) console.warn(`[better-json] Dropping \"${key}\" key to prevent prototype pollution`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (parseDates && typeof value === \"string\") {\n\t\t\t\tconst date = parseISODate(value);\n\t\t\t\tif (date) return date;\n\t\t\t}\n\t\t\treturn reviver ? reviver(key, value) : value;\n\t\t};\n\t\treturn JSON.parse(trimmed, secureReviver);\n\t} catch (error) {\n\t\tif (strict) throw error;\n\t\treturn value;\n\t}\n}\nfunction parseJSON(value, options = { strict: true }) {\n\treturn betterJSONParse(value, options);\n}\n//#endregion\nexport { parseJSON };\n","import { atom } from \"nanostores\";\n//#region src/client/query-atom.ts\nconst kAuthQuery = Symbol.for(\"better-auth:auth-query\");\nfunction isAuthQueryStore(store) {\n\treturn kAuthQuery in store && store[kAuthQuery] === true;\n}\nfunction createAuthQueryAtom(initialValue) {\n\tconst queryAtom = atom(initialValue);\n\tObject.defineProperty(queryAtom, kAuthQuery, { value: true });\n\treturn queryAtom;\n}\n//#endregion\nexport { createAuthQueryAtom, isAuthQueryStore };\n","import { isJsonEqual, withEquality } from \"./equality.mjs\";\nimport { createAuthQueryAtom } from \"./query-atom.mjs\";\nimport { onMount } from \"nanostores\";\n//#region src/client/query.ts\nconst isServer = () => typeof window === \"undefined\";\nfunction isAuthQueryStateEqual(a, b) {\n\treturn isJsonEqual(a.data, b.data) && a.error === b.error && a.isPending === b.isPending && a.isRefetching === b.isRefetching && a.refetch === b.refetch;\n}\nconst useAuthQuery = (initializedAtom, path, $fetch, options) => {\n\tconst value = createAuthQueryAtom({\n\t\tdata: null,\n\t\terror: null,\n\t\tisPending: true,\n\t\tisRefetching: false,\n\t\trefetch: (queryParams) => fn(queryParams)\n\t});\n\tonMount(value, () => withEquality(value, isAuthQueryStateEqual));\n\tlet latestRequestId = 0;\n\tconst fn = async (queryParams) => {\n\t\tconst requestId = ++latestRequestId;\n\t\treturn new Promise((resolve) => {\n\t\t\tconst opts = typeof options === \"function\" ? options({\n\t\t\t\tdata: value.get().data,\n\t\t\t\terror: value.get().error,\n\t\t\t\tisPending: value.get().isPending\n\t\t\t}) : options;\n\t\t\t$fetch(path, {\n\t\t\t\t...opts,\n\t\t\t\tquery: {\n\t\t\t\t\t...opts?.query,\n\t\t\t\t\t...queryParams?.query\n\t\t\t\t},\n\t\t\t\tasync onSuccess(context) {\n\t\t\t\t\tif (requestId === latestRequestId) {\n\t\t\t\t\t\tconst current = value.get();\n\t\t\t\t\t\tconst stableData = current.data != null && context.data != null && isJsonEqual(current.data, context.data) ? current.data : context.data;\n\t\t\t\t\t\tvalue.set({\n\t\t\t\t\t\t\tdata: stableData,\n\t\t\t\t\t\t\terror: null,\n\t\t\t\t\t\t\tisPending: false,\n\t\t\t\t\t\t\tisRefetching: false,\n\t\t\t\t\t\t\trefetch: value.value.refetch\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tawait opts?.onSuccess?.(context);\n\t\t\t\t},\n\t\t\t\tasync onError(context) {\n\t\t\t\t\tconst { request } = context;\n\t\t\t\t\tconst retryAttempts = typeof request.retry === \"number\" ? request.retry : request.retry?.attempts;\n\t\t\t\t\tconst retryAttempt = request.retryAttempt || 0;\n\t\t\t\t\tif (retryAttempts && retryAttempt < retryAttempts) return;\n\t\t\t\t\tif (requestId === latestRequestId) {\n\t\t\t\t\t\tconst isUnauthorized = context.error.status === 401;\n\t\t\t\t\t\tvalue.set({\n\t\t\t\t\t\t\terror: context.error,\n\t\t\t\t\t\t\tdata: isUnauthorized ? null : value.get().data,\n\t\t\t\t\t\t\tisPending: false,\n\t\t\t\t\t\t\tisRefetching: false,\n\t\t\t\t\t\t\trefetch: value.value.refetch\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tawait opts?.onError?.(context);\n\t\t\t\t},\n\t\t\t\tasync onRequest(context) {\n\t\t\t\t\tif (requestId === latestRequestId) {\n\t\t\t\t\t\tconst currentValue = value.get();\n\t\t\t\t\t\tvalue.set({\n\t\t\t\t\t\t\tisPending: currentValue.data === null,\n\t\t\t\t\t\t\tdata: currentValue.data,\n\t\t\t\t\t\t\terror: null,\n\t\t\t\t\t\t\tisRefetching: true,\n\t\t\t\t\t\t\trefetch: value.value.refetch\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tawait opts?.onRequest?.(context);\n\t\t\t\t}\n\t\t\t}).catch((error) => {\n\t\t\t\tif (requestId !== latestRequestId) return;\n\t\t\t\tvalue.set({\n\t\t\t\t\terror,\n\t\t\t\t\tdata: value.get().data,\n\t\t\t\t\tisPending: false,\n\t\t\t\t\tisRefetching: false,\n\t\t\t\t\trefetch: value.value.refetch\n\t\t\t\t});\n\t\t\t}).finally(() => {\n\t\t\t\tresolve(void 0);\n\t\t\t});\n\t\t});\n\t};\n\tinitializedAtom = Array.isArray(initializedAtom) ? initializedAtom : [initializedAtom];\n\tlet isMountFetchPending = false;\n\tlet isMounted = false;\n\tlet shouldRefetchAfterPending = false;\n\tconst fetchOnMount = () => {\n\t\tif (isMountFetchPending) {\n\t\t\tshouldRefetchAfterPending = true;\n\t\t\treturn;\n\t\t}\n\t\tisMountFetchPending = true;\n\t\tfn().finally(() => {\n\t\t\tisMountFetchPending = false;\n\t\t\tconst shouldRefetch = shouldRefetchAfterPending && isMounted;\n\t\t\tshouldRefetchAfterPending = false;\n\t\t\tif (shouldRefetch) fetchOnMount();\n\t\t});\n\t};\n\tonMount(value, () => {\n\t\tif (isServer()) return;\n\t\tisMounted = true;\n\t\tlet isInitialized = false;\n\t\tlet timeoutId;\n\t\tconst cleanups = initializedAtom.map((initAtom) => initAtom.listen(() => {\n\t\t\tif (isInitialized) fn();\n\t\t\telse {\n\t\t\t\tisInitialized = true;\n\t\t\t\tclearTimeout(timeoutId);\n\t\t\t\tfetchOnMount();\n\t\t\t}\n\t\t}));\n\t\ttimeoutId = setTimeout(() => {\n\t\t\tisInitialized = true;\n\t\t\tfetchOnMount();\n\t\t}, 0);\n\t\treturn () => {\n\t\t\tisMounted = false;\n\t\t\tfor (const cleanup of cleanups) cleanup();\n\t\t\tclearTimeout(timeoutId);\n\t\t};\n\t});\n\treturn value;\n};\n//#endregion\nexport { useAuthQuery };\n","import { getGlobalBroadcastChannel } from \"./broadcast-channel.mjs\";\nimport { getGlobalFocusManager } from \"./focus-manager.mjs\";\nimport { getGlobalOnlineManager } from \"./online-manager.mjs\";\n//#region src/client/session-refresh.ts\nconst now = () => Math.floor(Date.now() / 1e3);\n/**\n* Rate limit: don't refetch on focus if a session request was made within this many seconds\n*/\nconst FOCUS_REFETCH_RATE_LIMIT_SECONDS = 5;\nfunction createSessionRefreshManager(opts) {\n\tconst { fetchSession, shouldPollSession = () => true, sessionSignal, options = {} } = opts;\n\tconst refetchInterval = options.sessionOptions?.refetchInterval ?? 0;\n\tconst refetchOnWindowFocus = options.sessionOptions?.refetchOnWindowFocus ?? true;\n\tconst refetchWhenOffline = options.sessionOptions?.refetchWhenOffline ?? false;\n\tconst state = {\n\t\tisInitialized: false,\n\t\tlastSessionRequest: 0\n\t};\n\tconst shouldRefetch = () => {\n\t\treturn refetchWhenOffline || getGlobalOnlineManager().isOnline;\n\t};\n\tconst triggerRefetch = (event) => {\n\t\tif (!shouldRefetch()) return;\n\t\tif (event?.event === \"storage\") {\n\t\t\tfetchSession();\n\t\t\treturn;\n\t\t}\n\t\tif (event?.event === \"poll\") {\n\t\t\tstate.lastSessionRequest = now();\n\t\t\tfetchSession();\n\t\t\treturn;\n\t\t}\n\t\tif (event?.event === \"visibilitychange\") {\n\t\t\tif (now() - state.lastSessionRequest < FOCUS_REFETCH_RATE_LIMIT_SECONDS) return;\n\t\t\tstate.lastSessionRequest = now();\n\t\t\tfetchSession();\n\t\t\treturn;\n\t\t}\n\t\tfetchSession();\n\t};\n\tconst broadcastSessionUpdate = (trigger) => {\n\t\tgetGlobalBroadcastChannel().post({\n\t\t\tevent: \"session\",\n\t\t\tdata: { trigger },\n\t\t\tclientId: Math.random().toString(36).substring(7)\n\t\t});\n\t};\n\tconst setupPolling = () => {\n\t\tif (refetchInterval && refetchInterval > 0) state.pollInterval = setInterval(() => {\n\t\t\tif (shouldPollSession()) triggerRefetch({ event: \"poll\" });\n\t\t}, refetchInterval * 1e3);\n\t};\n\tconst setupBroadcast = () => {\n\t\tstate.unsubscribeBroadcast = getGlobalBroadcastChannel().subscribe(() => {\n\t\t\ttriggerRefetch({ event: \"storage\" });\n\t\t});\n\t};\n\tconst setupFocusRefetch = () => {\n\t\tif (!refetchOnWindowFocus) return;\n\t\tstate.unsubscribeFocus = getGlobalFocusManager().subscribe(() => {\n\t\t\ttriggerRefetch({ event: \"visibilitychange\" });\n\t\t});\n\t};\n\tconst setupOnlineRefetch = () => {\n\t\tstate.unsubscribeOnline = getGlobalOnlineManager().subscribe((online) => {\n\t\t\tif (online) triggerRefetch({ event: \"visibilitychange\" });\n\t\t});\n\t};\n\tconst setupSignalSubscription = () => {\n\t\tstate.unsubscribeSignal = sessionSignal.listen(() => {\n\t\t\tfetchSession();\n\t\t});\n\t};\n\tconst init = () => {\n\t\tif (state.isInitialized) return;\n\t\tstate.isInitialized = true;\n\t\tsetupPolling();\n\t\tsetupBroadcast();\n\t\tsetupFocusRefetch();\n\t\tsetupOnlineRefetch();\n\t\tsetupSignalSubscription();\n\t\tstate.cleanupBroadcastSetup = getGlobalBroadcastChannel().setup();\n\t\tstate.cleanupFocusSetup = getGlobalFocusManager().setup();\n\t\tstate.cleanupOnlineSetup = getGlobalOnlineManager().setup();\n\t};\n\tconst cleanup = () => {\n\t\tif (!state.isInitialized) return;\n\t\tif (state.pollInterval) {\n\t\t\tclearInterval(state.pollInterval);\n\t\t\tstate.pollInterval = void 0;\n\t\t}\n\t\tif (state.unsubscribeBroadcast) {\n\t\t\tstate.unsubscribeBroadcast();\n\t\t\tstate.unsubscribeBroadcast = void 0;\n\t\t}\n\t\tif (state.unsubscribeFocus) {\n\t\t\tstate.unsubscribeFocus();\n\t\t\tstate.unsubscribeFocus = void 0;\n\t\t}\n\t\tif (state.unsubscribeOnline) {\n\t\t\tstate.unsubscribeOnline();\n\t\t\tstate.unsubscribeOnline = void 0;\n\t\t}\n\t\tif (state.unsubscribeSignal) {\n\t\t\tstate.unsubscribeSignal();\n\t\t\tstate.unsubscribeSignal = void 0;\n\t\t}\n\t\tif (state.cleanupBroadcastSetup) {\n\t\t\tstate.cleanupBroadcastSetup();\n\t\t\tstate.cleanupBroadcastSetup = void 0;\n\t\t}\n\t\tif (state.cleanupFocusSetup) {\n\t\t\tstate.cleanupFocusSetup();\n\t\t\tstate.cleanupFocusSetup = void 0;\n\t\t}\n\t\tif (state.cleanupOnlineSetup) {\n\t\t\tstate.cleanupOnlineSetup();\n\t\t\tstate.cleanupOnlineSetup = void 0;\n\t\t}\n\t\tstate.isInitialized = false;\n\t\tstate.lastSessionRequest = 0;\n\t};\n\treturn {\n\t\tinit,\n\t\tcleanup,\n\t\ttriggerRefetch,\n\t\tbroadcastSessionUpdate\n\t};\n}\n//#endregion\nexport { createSessionRefreshManager };\n","//#region src/env/env-impl.ts\nconst _envShim = Object.create(null);\nconst _getEnv = (useShim) => globalThis.process?.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (useShim ? _envShim : globalThis);\nconst env = new Proxy(_envShim, {\n\tget(_, prop) {\n\t\treturn _getEnv()[prop] ?? _envShim[prop];\n\t},\n\thas(_, prop) {\n\t\treturn prop in _getEnv() || prop in _envShim;\n\t},\n\tset(_, prop, value) {\n\t\tconst env = _getEnv(true);\n\t\tenv[prop] = value;\n\t\treturn true;\n\t},\n\tdeleteProperty(_, prop) {\n\t\tif (!prop) return false;\n\t\tconst env = _getEnv(true);\n\t\tdelete env[prop];\n\t\treturn true;\n\t},\n\townKeys() {\n\t\tconst env = _getEnv(true);\n\t\treturn Object.keys(env);\n\t}\n});\nfunction toBoolean(val) {\n\treturn val ? val !== \"false\" : false;\n}\nconst nodeENV = env.NODE_ENV ?? \"\";\n/** Detect if `NODE_ENV` environment variable is `production` */\nconst isProduction = nodeENV === \"production\";\n/** Detect if `NODE_ENV` environment variable is `dev` or `development` */\nconst isDevelopment = () => nodeENV === \"dev\" || nodeENV === \"development\";\n/** Detect if `NODE_ENV` environment variable is `test` */\nconst isTest = () => nodeENV === \"test\" || toBoolean(env.TEST);\n/**\n* Get environment variable with fallback\n*/\nfunction getEnvVar(key, fallback) {\n\tif (typeof process !== \"undefined\" && process.env) return process.env[key] ?? fallback;\n\tif (typeof Deno !== \"undefined\") return Deno.env.get(key) ?? fallback;\n\tif (typeof Bun !== \"undefined\") return Bun.env[key] ?? fallback;\n\treturn fallback;\n}\n/**\n* Get boolean environment variable\n*/\nfunction getBooleanEnvVar(key, fallback = true) {\n\tconst value = getEnvVar(key);\n\tif (!value) return fallback;\n\treturn value !== \"0\" && value.toLowerCase() !== \"false\" && value !== \"\";\n}\n/**\n* Common environment variables used in Better Auth\n*/\nconst ENV = Object.freeze({\n\tget BETTER_AUTH_SECRET() {\n\t\treturn getEnvVar(\"BETTER_AUTH_SECRET\");\n\t},\n\tget AUTH_SECRET() {\n\t\treturn getEnvVar(\"AUTH_SECRET\");\n\t},\n\tget BETTER_AUTH_TELEMETRY() {\n\t\treturn getEnvVar(\"BETTER_AUTH_TELEMETRY\");\n\t},\n\tget BETTER_AUTH_TELEMETRY_ID() {\n\t\treturn getEnvVar(\"BETTER_AUTH_TELEMETRY_ID\");\n\t},\n\tget NODE_ENV() {\n\t\treturn getEnvVar(\"NODE_ENV\", \"development\");\n\t},\n\tget PACKAGE_VERSION() {\n\t\treturn getEnvVar(\"PACKAGE_VERSION\", \"0.0.0\");\n\t},\n\tget BETTER_AUTH_TELEMETRY_ENDPOINT() {\n\t\treturn getEnvVar(\"BETTER_AUTH_TELEMETRY_ENDPOINT\", \"\");\n\t}\n});\n//#endregion\nexport { ENV, env, getBooleanEnvVar, getEnvVar, isDevelopment, isProduction, isTest, nodeENV };\n","//#region src/error.ts\nfunction isErrorStackTraceLimitWritable() {\n\tconst desc = Object.getOwnPropertyDescriptor(Error, \"stackTraceLimit\");\n\tif (desc === void 0) return Object.isExtensible(Error);\n\treturn Object.prototype.hasOwnProperty.call(desc, \"writable\") ? desc.writable : desc.set !== void 0;\n}\n/**\n* Hide internal stack frames from the error stack trace.\n*/\nfunction hideInternalStackFrames(stack) {\n\tconst lines = stack.split(\"\\n at \");\n\tif (lines.length <= 1) return stack;\n\tlines.splice(1, 1);\n\treturn lines.join(\"\\n at \");\n}\n/**\n* Creates a custom error class that hides stack frames.\n*/\nfunction makeErrorForHideStackFrame(Base, clazz) {\n\tclass HideStackFramesError extends Base {\n\t\t#hiddenStack;\n\t\tconstructor(...args) {\n\t\t\tif (isErrorStackTraceLimitWritable()) {\n\t\t\t\tconst limit = Error.stackTraceLimit;\n\t\t\t\tError.stackTraceLimit = 0;\n\t\t\t\tsuper(...args);\n\t\t\t\tError.stackTraceLimit = limit;\n\t\t\t} else super(...args);\n\t\t\tconst stack = (/* @__PURE__ */ new Error()).stack;\n\t\t\tif (stack) this.#hiddenStack = hideInternalStackFrames(stack.replace(/^Error/, this.name));\n\t\t}\n\t\tget errorStack() {\n\t\t\treturn this.#hiddenStack;\n\t\t}\n\t}\n\tObject.defineProperty(HideStackFramesError.prototype, \"constructor\", {\n\t\tget() {\n\t\t\treturn clazz;\n\t\t},\n\t\tenumerable: false,\n\t\tconfigurable: true\n\t});\n\treturn HideStackFramesError;\n}\nconst statusCodes = {\n\tOK: 200,\n\tCREATED: 201,\n\tACCEPTED: 202,\n\tNO_CONTENT: 204,\n\tMULTIPLE_CHOICES: 300,\n\tMOVED_PERMANENTLY: 301,\n\tFOUND: 302,\n\tSEE_OTHER: 303,\n\tNOT_MODIFIED: 304,\n\tTEMPORARY_REDIRECT: 307,\n\tBAD_REQUEST: 400,\n\tUNAUTHORIZED: 401,\n\tPAYMENT_REQUIRED: 402,\n\tFORBIDDEN: 403,\n\tNOT_FOUND: 404,\n\tMETHOD_NOT_ALLOWED: 405,\n\tNOT_ACCEPTABLE: 406,\n\tPROXY_AUTHENTICATION_REQUIRED: 407,\n\tREQUEST_TIMEOUT: 408,\n\tCONFLICT: 409,\n\tGONE: 410,\n\tLENGTH_REQUIRED: 411,\n\tPRECONDITION_FAILED: 412,\n\tPAYLOAD_TOO_LARGE: 413,\n\tURI_TOO_LONG: 414,\n\tUNSUPPORTED_MEDIA_TYPE: 415,\n\tRANGE_NOT_SATISFIABLE: 416,\n\tEXPECTATION_FAILED: 417,\n\t\"I'M_A_TEAPOT\": 418,\n\tMISDIRECTED_REQUEST: 421,\n\tUNPROCESSABLE_ENTITY: 422,\n\tLOCKED: 423,\n\tFAILED_DEPENDENCY: 424,\n\tTOO_EARLY: 425,\n\tUPGRADE_REQUIRED: 426,\n\tPRECONDITION_REQUIRED: 428,\n\tTOO_MANY_REQUESTS: 429,\n\tREQUEST_HEADER_FIELDS_TOO_LARGE: 431,\n\tUNAVAILABLE_FOR_LEGAL_REASONS: 451,\n\tINTERNAL_SERVER_ERROR: 500,\n\tNOT_IMPLEMENTED: 501,\n\tBAD_GATEWAY: 502,\n\tSERVICE_UNAVAILABLE: 503,\n\tGATEWAY_TIMEOUT: 504,\n\tHTTP_VERSION_NOT_SUPPORTED: 505,\n\tVARIANT_ALSO_NEGOTIATES: 506,\n\tINSUFFICIENT_STORAGE: 507,\n\tLOOP_DETECTED: 508,\n\tNOT_EXTENDED: 510,\n\tNETWORK_AUTHENTICATION_REQUIRED: 511\n};\nvar InternalAPIError = class extends Error {\n\tstatus;\n\tbody;\n\theaders;\n\tstatusCode;\n\tconstructor(status = \"INTERNAL_SERVER_ERROR\", body = void 0, headers = {}, statusCode = typeof status === \"number\" ? status : statusCodes[status]) {\n\t\tsuper(body?.message, body && \"cause\" in body ? { cause: body.cause } : void 0);\n\t\tthis.status = status;\n\t\tthis.body = body;\n\t\tthis.headers = headers;\n\t\tthis.statusCode = statusCode;\n\t\tthis.name = \"APIError\";\n\t\tthis.status = status;\n\t\tthis.headers = headers;\n\t\tthis.statusCode = statusCode;\n\t\tif (body && \"cause\" in body) {\n\t\t\tconst { cause, ...publicBody } = body;\n\t\t\tthis.body = Object.defineProperty(publicBody, \"cause\", {\n\t\t\t\tvalue: cause,\n\t\t\t\twritable: true,\n\t\t\t\tconfigurable: true\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tthis.body = body;\n\t}\n};\nvar ValidationError = class extends InternalAPIError {\n\tmessage;\n\tissues;\n\tconstructor(message, issues) {\n\t\tsuper(400, {\n\t\t\tmessage,\n\t\t\tcode: \"VALIDATION_ERROR\"\n\t\t});\n\t\tthis.message = message;\n\t\tthis.issues = issues;\n\t\tthis.issues = issues;\n\t}\n};\nvar BetterCallError = class extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = \"BetterCallError\";\n\t}\n};\nconst kAPIErrorHeaderSymbol = Symbol.for(\"better-call:api-error-headers\");\nconst APIError = makeErrorForHideStackFrame(InternalAPIError, Error);\n//#endregion\nexport { APIError, BetterCallError, ValidationError, hideInternalStackFrames, kAPIErrorHeaderSymbol, makeErrorForHideStackFrame, statusCodes };\n\n//# sourceMappingURL=error.mjs.map","import { BASE_ERROR_CODES } from \"./codes.mjs\";\nimport { APIError as APIError$1 } from \"better-call/error\";\n//#region src/error/index.ts\nvar BetterAuthError = class extends Error {\n\tconstructor(message, options) {\n\t\tsuper(message, options);\n\t\tthis.name = \"BetterAuthError\";\n\t\tthis.message = message;\n\t\tthis.stack = \"\";\n\t}\n};\nvar APIError = class APIError extends APIError$1 {\n\tconstructor(...args) {\n\t\tsuper(...args);\n\t}\n\tstatic fromStatus(status, body) {\n\t\treturn new APIError(status, body);\n\t}\n\tstatic from(status, error, options) {\n\t\tconst { code, message } = error;\n\t\tif (options?.cause === void 0) return new APIError(status, {\n\t\t\tmessage,\n\t\t\tcode\n\t\t});\n\t\treturn new APIError(status, {\n\t\t\tmessage,\n\t\t\tcode,\n\t\t\tcause: options.cause\n\t\t});\n\t}\n};\n//#endregion\nexport { APIError, BASE_ERROR_CODES, BetterAuthError };\n","import { wildcardMatch } from \"./wildcard.mjs\";\nimport { env } from \"@better-auth/core/env\";\nimport { BetterAuthError } from \"@better-auth/core/error\";\n//#region src/utils/url.ts\nconst SLASH_CHAR_CODE = \"/\".charCodeAt(0);\n/**\n* Minimal loopback check for dev scheme inference only. Reachable from\n* `client/config.ts` via `getBaseURL`, so we MUST NOT import the full\n* `@better-auth/core/utils/host` classifier here: its `utils/ip` dependency\n* on zod would leak into the client bundle (see `e2e/smoke/test/vite.spec.ts`).\n*\n* Server-side SSRF/loopback checks (oauth redirect matching, trusted-origin\n* resolution, electron fetch gate) continue to use the authoritative\n* `isLoopbackHost` from `@better-auth/core/utils/host`. This helper's only\n* job is picking `http` vs `https` for dev ergonomics.\n*/\nfunction isLoopbackForDevScheme(host) {\n\tconst hostname = host.replace(/:\\d+$/, \"\").replace(/^\\[|\\]$/g, \"\").toLowerCase();\n\treturn hostname === \"localhost\" || hostname.endsWith(\".localhost\") || hostname === \"::1\" || hostname.startsWith(\"127.\");\n}\nfunction trimTrailingSlashes(value) {\n\tlet end = value.length;\n\twhile (end > 0 && value.charCodeAt(end - 1) === SLASH_CHAR_CODE) end--;\n\treturn end === value.length ? value : value.slice(0, end);\n}\nfunction checkHasPath(url) {\n\ttry {\n\t\treturn (trimTrailingSlashes(new URL(url).pathname) || \"/\") !== \"/\";\n\t} catch {\n\t\tthrow new BetterAuthError(`Invalid base URL: ${url}. Please provide a valid base URL.`);\n\t}\n}\nfunction assertHasProtocol(url) {\n\ttry {\n\t\tconst parsedUrl = new URL(url);\n\t\tif (parsedUrl.protocol !== \"http:\" && parsedUrl.protocol !== \"https:\") throw new BetterAuthError(`Invalid base URL: ${url}. URL must include 'http://' or 'https://'`);\n\t} catch (error) {\n\t\tif (error instanceof BetterAuthError) throw error;\n\t\tthrow new BetterAuthError(`Invalid base URL: ${url}. Please provide a valid base URL.`, { cause: error });\n\t}\n}\nfunction withPath(url, path = \"/api/auth\") {\n\tassertHasProtocol(url);\n\tif (checkHasPath(url)) return url;\n\tconst trimmedUrl = trimTrailingSlashes(url);\n\tif (!path || path === \"/\") return trimmedUrl;\n\tpath = path.startsWith(\"/\") ? path : `/${path}`;\n\treturn `${trimmedUrl}${path}`;\n}\nfunction validateProxyHeader(header, type) {\n\tif (!header || header.trim() === \"\") return false;\n\tif (type === \"proto\") return header === \"http\" || header === \"https\";\n\tif (type === \"host\") {\n\t\tif ([\n\t\t\t/\\.\\./,\n\t\t\t/\\0/,\n\t\t\t/[\\s]/,\n\t\t\t/^[.]/,\n\t\t\t/[<>'\"]/,\n\t\t\t/javascript:/i,\n\t\t\t/file:/i,\n\t\t\t/data:/i\n\t\t].some((pattern) => pattern.test(header))) return false;\n\t\treturn /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(header) || /^(\\d{1,3}\\.){3}\\d{1,3}(:[0-9]{1,5})?$/.test(header) || /^\\[[0-9a-fA-F:]+\\](:[0-9]{1,5})?$/.test(header) || /^localhost(:[0-9]{1,5})?$/i.test(header);\n\t}\n\treturn false;\n}\nfunction getBaseURL(url, path, request, loadEnv, trustedProxyHeaders) {\n\tif (url) return withPath(url, path);\n\tif (loadEnv !== false) {\n\t\tconst fromEnv = env.BETTER_AUTH_URL || env.NEXT_PUBLIC_BETTER_AUTH_URL || env.PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_AUTH_URL || (env.BASE_URL !== \"/\" ? env.BASE_URL : void 0);\n\t\tif (fromEnv) return withPath(fromEnv, path);\n\t}\n\tconst fromRequest = request?.headers.get(\"x-forwarded-host\");\n\tconst fromRequestProto = request?.headers.get(\"x-forwarded-proto\");\n\tif (fromRequest && fromRequestProto && trustedProxyHeaders) {\n\t\tif (validateProxyHeader(fromRequestProto, \"proto\") && validateProxyHeader(fromRequest, \"host\")) try {\n\t\t\treturn withPath(`${fromRequestProto}://${fromRequest}`, path);\n\t\t} catch (_error) {}\n\t}\n\tif (request) {\n\t\tconst url = getOrigin(request.url);\n\t\tif (!url) throw new BetterAuthError(\"Could not get origin from request. Please provide a valid base URL.\");\n\t\treturn withPath(url, path);\n\t}\n\tif (typeof window !== \"undefined\" && window.location) return withPath(window.location.origin, path);\n}\nfunction getOrigin(url) {\n\ttry {\n\t\tconst parsedUrl = new URL(url);\n\t\treturn parsedUrl.origin === \"null\" ? null : parsedUrl.origin;\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction getProtocol(url) {\n\ttry {\n\t\treturn new URL(url).protocol;\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction getHost(url) {\n\ttry {\n\t\treturn new URL(url).host;\n\t} catch {\n\t\treturn null;\n\t}\n}\n/**\n* Checks if the baseURL config is a dynamic config object\n*/\nfunction isDynamicBaseURLConfig(config) {\n\treturn typeof config === \"object\" && config !== null && \"allowedHosts\" in config && Array.isArray(config.allowedHosts);\n}\n/**\n* Check if a value is a `Request`\n* - `instanceof`: works for native Request instances\n* - `toString`: handles where instanceof check fails but the object is still a\n* valid Request (e.g. cross-realm, polyfills). Paired with a shape check so\n* an object that only spoofs `Symbol.toStringTag` without the real shape is\n* rejected before downstream code tries to read `.headers` / `.url`.\n*\n* @param value The value to check\n* @returns `true` if the value is a Request instance\n*/\nfunction isRequestLike(value) {\n\tif (value instanceof Request) return true;\n\tif (typeof value !== \"object\" || value === null || Object.prototype.toString.call(value) !== \"[object Request]\") return false;\n\tconst v = value;\n\treturn typeof v.url === \"string\" && typeof v.headers === \"object\" && v.headers !== null && typeof v.headers.get === \"function\";\n}\n/**\n* Extracts the host from a `Request` or `Headers`.\n* Honors `x-forwarded-host` only when `trustedProxyHeaders` is enabled,\n* then falls back to the `host` header and finally the request URL.\n*/\nfunction getHostFromSource(source, trustedProxyHeaders) {\n\tconst headers = isRequestLike(source) ? source.headers : source;\n\tif (trustedProxyHeaders) {\n\t\tconst forwardedHost = headers.get(\"x-forwarded-host\");\n\t\tif (forwardedHost && validateProxyHeader(forwardedHost, \"host\")) return forwardedHost;\n\t}\n\tconst host = headers.get(\"host\");\n\tif (host && validateProxyHeader(host, \"host\")) return host;\n\tif (isRequestLike(source)) try {\n\t\treturn new URL(source.url).host;\n\t} catch {\n\t\treturn null;\n\t}\n\treturn null;\n}\n/**\n* Extracts the protocol from a `Request` or `Headers`.\n* Honors `x-forwarded-proto` only when `trustedProxyHeaders` is enabled,\n* then falls back to the request URL, then to \"https\".\n*/\nfunction getProtocolFromSource(source, configProtocol, trustedProxyHeaders) {\n\tif (configProtocol === \"http\" || configProtocol === \"https\") return configProtocol;\n\tconst headers = isRequestLike(source) ? source.headers : source;\n\tif (trustedProxyHeaders) {\n\t\tconst forwardedProto = headers.get(\"x-forwarded-proto\");\n\t\tif (forwardedProto && validateProxyHeader(forwardedProto, \"proto\")) return forwardedProto;\n\t}\n\tif (isRequestLike(source)) try {\n\t\tconst url = new URL(source.url);\n\t\tif (url.protocol === \"http:\" || url.protocol === \"https:\") return url.protocol.slice(0, -1);\n\t} catch {}\n\tconst host = getHostFromSource(source, trustedProxyHeaders);\n\tif (host && isLoopbackForDevScheme(host)) return \"http\";\n\treturn \"https\";\n}\n/**\n* Matches a hostname against a host pattern.\n* Supports wildcard patterns like `*.vercel.app` or `preview-*.myapp.com`.\n*\n* @param host The hostname to test (e.g., \"myapp.com\", \"preview-123.vercel.app\")\n* @param pattern The host pattern (e.g., \"myapp.com\", \"*.vercel.app\")\n* @returns {boolean} true if the host matches the pattern, false otherwise.\n*\n* @example\n* ```ts\n* matchesHostPattern(\"myapp.com\", \"myapp.com\") // true\n* matchesHostPattern(\"preview-123.vercel.app\", \"*.vercel.app\") // true\n* matchesHostPattern(\"preview-123.myapp.com\", \"preview-*.myapp.com\") // true\n* matchesHostPattern(\"evil.com\", \"myapp.com\") // false\n* ```\n*/\nconst matchesHostPattern = (host, pattern) => {\n\tif (!host || !pattern) return false;\n\tconst normalizedHost = host.replace(/^https?:\\/\\//, \"\").split(\"/\")[0].toLowerCase();\n\tconst normalizedPattern = pattern.replace(/^https?:\\/\\//, \"\").split(\"/\")[0].toLowerCase();\n\tif (normalizedPattern.includes(\"*\") || normalizedPattern.includes(\"?\")) return wildcardMatch(normalizedPattern)(normalizedHost);\n\treturn normalizedHost.toLowerCase() === normalizedPattern.toLowerCase();\n};\n/**\n* Resolves the base URL from a dynamic config based on the incoming request.\n* Validates the derived host against the allowedHosts allowlist.\n*\n* @param config The dynamic base URL config\n* @param request The incoming request\n* @param basePath The base path to append\n* @returns The resolved base URL with path\n* @throws BetterAuthError if host is not in allowedHosts and no fallback is set\n*/\nfunction resolveDynamicBaseURL(config, source, basePath, trustedProxyHeaders) {\n\tconst host = getHostFromSource(source, trustedProxyHeaders);\n\tif (!host) {\n\t\tif (config.fallback) return withPath(config.fallback, basePath);\n\t\tthrow new BetterAuthError(\"Could not determine host from request headers. Please provide a fallback URL in your baseURL config.\");\n\t}\n\tif (config.allowedHosts.some((pattern) => matchesHostPattern(host, pattern))) return withPath(`${getProtocolFromSource(source, config.protocol, trustedProxyHeaders)}://${host}`, basePath);\n\tif (config.fallback) return withPath(config.fallback, basePath);\n\tthrow new BetterAuthError(`Host \"${host}\" is not in the allowed hosts list. Allowed hosts: ${config.allowedHosts.join(\", \")}. Add this host to your allowedHosts config or provide a fallback URL.`);\n}\n/**\n* Resolves the base URL from any config type (static string or dynamic object).\n* This is the main entry point for base URL resolution.\n*\n* @param config The base URL config (string or object)\n* @param basePath The base path to append\n* @param request Optional request for dynamic resolution\n* @param loadEnv Whether to load from environment variables\n* @param trustedProxyHeaders Whether to trust proxy headers (for legacy behavior)\n* @returns The resolved base URL with path\n*/\nfunction resolveBaseURL(config, basePath, source, loadEnv, trustedProxyHeaders) {\n\tif (isDynamicBaseURLConfig(config)) {\n\t\tif (source) return resolveDynamicBaseURL(config, source, basePath, trustedProxyHeaders);\n\t\tif (config.fallback) return withPath(config.fallback, basePath);\n\t\treturn getBaseURL(void 0, basePath, void 0, loadEnv, trustedProxyHeaders);\n\t}\n\tconst request = isRequestLike(source) ? source : void 0;\n\tif (typeof config === \"string\") return getBaseURL(config, basePath, request, loadEnv, trustedProxyHeaders);\n\treturn getBaseURL(void 0, basePath, request, loadEnv, trustedProxyHeaders);\n}\n//#endregion\nexport { getBaseURL, getHost, getHostFromSource, getOrigin, getProtocol, getProtocolFromSource, isDynamicBaseURLConfig, isRequestLike, matchesHostPattern, resolveBaseURL, resolveDynamicBaseURL, trimTrailingSlashes };\n","//#region src/utils/url.ts\n/**\n* Normalizes a request pathname by removing the basePath prefix and trailing slashes.\n* This is useful for matching paths against configured path lists.\n*\n* @param requestUrl - The full request URL\n* @param basePath - The base path of the auth API (e.g., \"/api/auth\")\n* @returns The normalized path without basePath prefix or trailing slashes,\n* or \"/\" if URL parsing fails\n*\n* @example\n* normalizePathname(\"http://localhost:3000/api/auth/sso/saml2/callback/provider1\", \"/api/auth\")\n* // Returns: \"/sso/saml2/callback/provider1\"\n*\n* normalizePathname(\"http://localhost:3000/sso/saml2/callback/provider1/\", \"/\")\n* // Returns: \"/sso/saml2/callback/provider1\"\n*/\nfunction normalizePathname(requestUrl, basePath) {\n\tlet pathname;\n\ttry {\n\t\tpathname = new URL(requestUrl).pathname.replace(/\\/+$/, \"\") || \"/\";\n\t} catch {\n\t\treturn \"/\";\n\t}\n\tconst normalizedBasePath = basePath.replace(/\\/+$/, \"\");\n\tif (normalizedBasePath === \"\") return pathname;\n\tif (pathname === normalizedBasePath) return \"/\";\n\tif (pathname.startsWith(normalizedBasePath + \"/\")) return pathname.slice(normalizedBasePath.length).replace(/\\/+$/, \"\") || \"/\";\n\treturn pathname;\n}\nconst URL_REFERENCE_ORIGIN = \"https://better-auth.invalid\";\n/**\n* Appends query parameters before the fragment of an absolute or root-relative URL.\n* Existing query text is retained without parsing it into name-value pairs.\n*\n* This function only composes URLs. Callers must validate untrusted input.\n*\n* @throws TypeError if parsing fails or a relative input changes authority.\n*/\nfunction appendQueryParams(input, params) {\n\tconst relative = input.startsWith(\"/\");\n\tif (input.startsWith(\"//\") || input.startsWith(\"/\\\\\")) throw new TypeError(\"Expected an absolute or root-relative URL\");\n\tconst parsedURL = relative ? new URL(input, URL_REFERENCE_ORIGIN) : new URL(input);\n\tif (relative && parsedURL.origin !== URL_REFERENCE_ORIGIN) throw new TypeError(\"Expected an absolute or root-relative URL\");\n\tconst query = params.toString();\n\tif (!query) return input;\n\tconst separator = parsedURL.search.endsWith(\"&\") ? \"\" : \"&\";\n\tparsedURL.search = parsedURL.search ? `${parsedURL.search}${separator}${query}` : query;\n\treturn relative ? parsedURL.href.slice(parsedURL.origin.length) : parsedURL.href;\n}\n/**\n* Schemes that execute or embed code when navigated to or accepted as a\n* redirect target. These are never safe as an OAuth `redirect_uri` or as a\n* client-side navigation target (`window.location.href`, `location.assign`, ...).\n*/\nconst DANGEROUS_URL_SCHEMES = [\n\t\"javascript:\",\n\t\"data:\",\n\t\"vbscript:\"\n];\n/**\n* Returns `false` only when `value` is an absolute URL using a dangerous scheme\n* (`javascript:`, `data:`, `vbscript:`). Relative URLs (e.g. `/dashboard`) and\n* safe absolute schemes (`http`, `https`, custom app schemes such as\n* `myapp://`) return `true`.\n*\n* Use this to guard browser navigation sinks and any redirect target that may\n* originate from untrusted input. It is intentionally narrow: it blocks code\n* execution schemes without rejecting relative paths or mobile deep links.\n*/\nfunction isSafeUrlScheme(value) {\n\tlet parsed;\n\ttry {\n\t\tparsed = new URL(value);\n\t} catch {\n\t\treturn true;\n\t}\n\treturn !DANGEROUS_URL_SCHEMES.includes(parsed.protocol);\n}\n//#endregion\nexport { DANGEROUS_URL_SCHEMES, appendQueryParams, isSafeUrlScheme, normalizePathname };\n","import { isSafeUrlScheme } from \"@better-auth/core/utils/url\";\n//#region src/client/fetch-plugins.ts\nconst redirectPlugin = {\n\tid: \"redirect\",\n\tname: \"Redirect\",\n\thooks: { onSuccess(context) {\n\t\tif (context.data?.url && context.data?.redirect && isSafeUrlScheme(context.data.url)) {\n\t\t\tif (typeof window !== \"undefined\" && window.location) {\n\t\t\t\tif (window.location) try {\n\t\t\t\t\twindow.location.href = context.data.url;\n\t\t\t\t} catch {}\n\t\t\t}\n\t\t}\n\t} }\n};\n//#endregion\nexport { redirectPlugin };\n","import { isJsonEqual, withEquality } from \"./equality.mjs\";\nimport { createAuthQueryAtom } from \"./query-atom.mjs\";\nimport { createSessionRefreshManager } from \"./session-refresh.mjs\";\nimport { STORE_UNMOUNT_DELAY, atom, onMount } from \"nanostores\";\n//#region src/client/session-atom.ts\nconst isServer = () => typeof window === \"undefined\";\nconst SESSION_MOUNT_DEDUPE_INTERVAL = STORE_UNMOUNT_DELAY;\nfunction hydrateSessionAtom(sessionAtom, session) {\n\tif (typeof window === \"undefined\") return;\n\tconst currentSession = sessionAtom.get();\n\tif (currentSession.data !== null || session === null) return;\n\tsessionAtom.set({\n\t\t...currentSession,\n\t\tdata: session,\n\t\terror: null,\n\t\tisPending: false\n\t});\n}\n/**\n* Normalize $fetch response: `throw: true` returns data directly,\n* otherwise `{ data, error }`.\n*/\nfunction normalizeSessionResponse(res) {\n\tif (typeof res === \"object\" && res !== null && \"data\" in res && \"error\" in res) return res;\n\treturn {\n\t\tdata: res,\n\t\terror: null\n\t};\n}\nfunction normalizeSessionData(data) {\n\tif (!data) return null;\n\tif (data.session === null && data.user === null) return null;\n\treturn data;\n}\nfunction isSessionAtomEqual(a, b) {\n\treturn isJsonEqual(a.data, b.data) && a.error === b.error && a.isPending === b.isPending && a.isRefetching === b.isRefetching && a.refetch === b.refetch;\n}\nfunction getSessionAtom($fetch, options) {\n\tconst $signal = atom(false);\n\tlet flight;\n\tlet freshUntil = 0;\n\tlet sessionRevision = 0;\n\t$signal.listen(() => {\n\t\tsessionRevision++;\n\t\tfreshUntil = 0;\n\t});\n\tconst refetch = (queryParams) => fetchSession(queryParams);\n\tconst session = createAuthQueryAtom({\n\t\tdata: null,\n\t\terror: null,\n\t\tisPending: true,\n\t\tisRefetching: false,\n\t\trefetch\n\t});\n\twithEquality(session, isSessionAtomEqual);\n\tconst executeSessionFetch = async (signal, queryParams) => {\n\t\tconst current = session.value;\n\t\tsession.set({\n\t\t\t...current,\n\t\t\tisPending: current.data === null,\n\t\t\tisRefetching: true,\n\t\t\terror: null,\n\t\t\trefetch\n\t\t});\n\t\tif (signal.aborted) return \"aborted\";\n\t\ttry {\n\t\t\tconst res = await $fetch(\"/get-session\", {\n\t\t\t\tmethod: \"GET\",\n\t\t\t\tquery: queryParams?.query,\n\t\t\t\tsignal\n\t\t\t});\n\t\t\tif (signal.aborted) return \"aborted\";\n\t\t\tlet { data, error } = normalizeSessionResponse(res);\n\t\t\tlet outcome = \"fresh\";\n\t\t\tif (data?.needsRefresh) try {\n\t\t\t\tconst refreshRes = await $fetch(\"/get-session\", {\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\tsignal\n\t\t\t\t});\n\t\t\t\tif (signal.aborted) return \"aborted\";\n\t\t\t\t({data, error} = normalizeSessionResponse(refreshRes));\n\t\t\t} catch {\n\t\t\t\tif (signal.aborted) return \"aborted\";\n\t\t\t\toutcome = \"stale\";\n\t\t\t}\n\t\t\tif (error) {\n\t\t\t\tconst latest = session.value;\n\t\t\t\tconst isUnauthorized = error?.status === 401;\n\t\t\t\tsession.set({\n\t\t\t\t\tdata: isUnauthorized ? null : latest.data,\n\t\t\t\t\terror,\n\t\t\t\t\tisPending: false,\n\t\t\t\t\tisRefetching: false,\n\t\t\t\t\trefetch\n\t\t\t\t});\n\t\t\t\treturn \"failed\";\n\t\t\t}\n\t\t\tconst sessionData = normalizeSessionData(data);\n\t\t\tconst current = session.value;\n\t\t\tconst stableData = current.data != null && sessionData != null && isJsonEqual(current.data, sessionData) ? current.data : sessionData;\n\t\t\tsession.set({\n\t\t\t\tdata: stableData,\n\t\t\t\terror: null,\n\t\t\t\tisPending: false,\n\t\t\t\tisRefetching: false,\n\t\t\t\trefetch\n\t\t\t});\n\t\t\treturn outcome;\n\t\t} catch (fetchError) {\n\t\t\tif (signal.aborted) return \"aborted\";\n\t\t\tconst latest = session.value;\n\t\t\tsession.set({\n\t\t\t\tdata: latest.data,\n\t\t\t\terror: fetchError,\n\t\t\t\tisPending: false,\n\t\t\t\tisRefetching: false,\n\t\t\t\trefetch\n\t\t\t});\n\t\t\treturn \"failed\";\n\t\t}\n\t};\n\tconst getFreshUntil = () => {\n\t\tconst expiresAt = session.value.data?.session?.expiresAt;\n\t\tconst sessionExpiresAt = expiresAt instanceof Date ? expiresAt.getTime() : Number.POSITIVE_INFINITY;\n\t\treturn Math.min(Date.now() + SESSION_MOUNT_DEDUPE_INTERVAL, sessionExpiresAt);\n\t};\n\tconst fetchSession = (queryParams) => {\n\t\tfreshUntil = 0;\n\t\tflight?.cancel();\n\t\tconst controller = new AbortController();\n\t\tconst request = {\n\t\t\tcancel: () => controller.abort(),\n\t\t\tpromise: Promise.resolve().then(() => {\n\t\t\t\tif (controller.signal.aborted) return \"aborted\";\n\t\t\t\treturn executeSessionFetch(controller.signal, queryParams);\n\t\t\t}),\n\t\t\trevision: sessionRevision\n\t\t};\n\t\tflight = request;\n\t\tconst settleFlight = (outcome) => {\n\t\t\tif (flight !== request) return;\n\t\t\tflight = void 0;\n\t\t\tif (outcome === \"fresh\" && request.revision === sessionRevision) freshUntil = getFreshUntil();\n\t\t};\n\t\trequest.promise.then(settleFlight, () => settleFlight(\"failed\"));\n\t\treturn request.promise.then(() => void 0);\n\t};\n\tconst fetchSessionOnMount = () => {\n\t\tif (flight?.revision === sessionRevision) return flight.promise.then(() => void 0);\n\t\tif (Date.now() < freshUntil) return Promise.resolve();\n\t\treturn fetchSession();\n\t};\n\tlet broadcastSessionUpdate = () => {};\n\tonMount(session, () => {\n\t\tlet timeoutId;\n\t\tif (!isServer()) timeoutId = setTimeout(() => {\n\t\t\tfetchSessionOnMount();\n\t\t}, 0);\n\t\tconst refreshManager = createSessionRefreshManager({\n\t\t\tfetchSession,\n\t\t\tshouldPollSession: () => session.value.data != null,\n\t\t\tsessionSignal: $signal,\n\t\t\toptions\n\t\t});\n\t\trefreshManager.init();\n\t\tbroadcastSessionUpdate = refreshManager.broadcastSessionUpdate;\n\t\treturn () => {\n\t\t\tif (timeoutId) clearTimeout(timeoutId);\n\t\t\trefreshManager.cleanup();\n\t\t};\n\t});\n\treturn {\n\t\tsession,\n\t\t$sessionSignal: $signal,\n\t\tbroadcastSessionUpdate: (trigger) => broadcastSessionUpdate(trigger)\n\t};\n}\n//#endregion\nexport { getSessionAtom, hydrateSessionAtom };\n","function isPlainObject(value) {\n if (value === null || typeof value !== \"object\") {\n return false;\n }\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {\n return false;\n }\n if (Symbol.iterator in value) {\n return false;\n }\n if (Symbol.toStringTag in value) {\n return Object.prototype.toString.call(value) === \"[object Module]\";\n }\n return true;\n}\n\nfunction _defu(baseObject, defaults, namespace = \".\", merger) {\n if (!isPlainObject(defaults)) {\n return _defu(baseObject, {}, namespace, merger);\n }\n const object = { ...defaults };\n for (const key of Object.keys(baseObject)) {\n if (key === \"__proto__\" || key === \"constructor\") {\n continue;\n }\n const value = baseObject[key];\n if (value === null || value === void 0) {\n continue;\n }\n if (merger && merger(object, key, value, namespace)) {\n continue;\n }\n if (Array.isArray(value) && Array.isArray(object[key])) {\n object[key] = [...value, ...object[key]];\n } else if (isPlainObject(value) && isPlainObject(object[key])) {\n object[key] = _defu(\n value,\n object[key],\n (namespace ? `${namespace}.` : \"\") + key.toString(),\n merger\n );\n } else {\n object[key] = value;\n }\n }\n return object;\n}\nfunction createDefu(merger) {\n return (...arguments_) => (\n // eslint-disable-next-line unicorn/no-array-reduce\n arguments_.reduce((p, c) => _defu(p, c, \"\", merger), {})\n );\n}\nconst defu = createDefu();\nconst defuFn = createDefu((object, key, currentValue) => {\n if (object[key] !== void 0 && typeof currentValue === \"function\") {\n object[key] = currentValue(object[key]);\n return true;\n }\n});\nconst defuArrayFn = createDefu((object, key, currentValue) => {\n if (Array.isArray(object[key]) && typeof currentValue === \"function\") {\n object[key] = currentValue(object[key]);\n return true;\n }\n});\n\nexport { createDefu, defu as default, defu, defuArrayFn, defuFn };\n","//#region src/error.ts\nvar BetterFetchError = class extends Error {\n\tconstructor(status, statusText, error) {\n\t\tsuper(statusText || status.toString(), { cause: error });\n\t\tthis.status = status;\n\t\tthis.statusText = statusText;\n\t\tthis.error = error;\n\t\tError.captureStackTrace(this, this.constructor);\n\t}\n};\n//#endregion\n//#region src/plugins.ts\nconst initializePlugins = async (url, options) => {\n\tlet opts = options || {};\n\tconst hooks = {\n\t\tonRequest: [options === null || options === void 0 ? void 0 : options.onRequest],\n\t\tonResponse: [options === null || options === void 0 ? void 0 : options.onResponse],\n\t\tonSuccess: [options === null || options === void 0 ? void 0 : options.onSuccess],\n\t\tonError: [options === null || options === void 0 ? void 0 : options.onError],\n\t\tonRetry: [options === null || options === void 0 ? void 0 : options.onRetry]\n\t};\n\tif (!options || !(options === null || options === void 0 ? void 0 : options.plugins)) return {\n\t\turl,\n\t\toptions: opts,\n\t\thooks\n\t};\n\tfor (const plugin of (options === null || options === void 0 ? void 0 : options.plugins) || []) {\n\t\tvar _plugin$hooks, _plugin$hooks2, _plugin$hooks3, _plugin$hooks4, _plugin$hooks5;\n\t\tif (plugin.init) {\n\t\t\tvar _plugin$init;\n\t\t\tconst pluginRes = await ((_plugin$init = plugin.init) === null || _plugin$init === void 0 ? void 0 : _plugin$init.call(plugin, url.toString(), opts));\n\t\t\topts = pluginRes.options || opts;\n\t\t\turl = pluginRes.url;\n\t\t}\n\t\thooks.onRequest.push((_plugin$hooks = plugin.hooks) === null || _plugin$hooks === void 0 ? void 0 : _plugin$hooks.onRequest);\n\t\thooks.onResponse.push((_plugin$hooks2 = plugin.hooks) === null || _plugin$hooks2 === void 0 ? void 0 : _plugin$hooks2.onResponse);\n\t\thooks.onSuccess.push((_plugin$hooks3 = plugin.hooks) === null || _plugin$hooks3 === void 0 ? void 0 : _plugin$hooks3.onSuccess);\n\t\thooks.onError.push((_plugin$hooks4 = plugin.hooks) === null || _plugin$hooks4 === void 0 ? void 0 : _plugin$hooks4.onError);\n\t\thooks.onRetry.push((_plugin$hooks5 = plugin.hooks) === null || _plugin$hooks5 === void 0 ? void 0 : _plugin$hooks5.onRetry);\n\t}\n\treturn {\n\t\turl,\n\t\toptions: opts,\n\t\thooks\n\t};\n};\n//#endregion\n//#region src/retry.ts\nvar LinearRetryStrategy = class {\n\tconstructor(options) {\n\t\tthis.options = options;\n\t}\n\tshouldAttemptRetry(attempt, response) {\n\t\tif (this.options.shouldRetry) return Promise.resolve(attempt < this.options.attempts && this.options.shouldRetry(response));\n\t\treturn Promise.resolve(attempt < this.options.attempts);\n\t}\n\tgetDelay() {\n\t\treturn this.options.delay;\n\t}\n};\nvar ExponentialRetryStrategy = class {\n\tconstructor(options) {\n\t\tthis.options = options;\n\t}\n\tshouldAttemptRetry(attempt, response) {\n\t\tif (this.options.shouldRetry) return Promise.resolve(attempt < this.options.attempts && this.options.shouldRetry(response));\n\t\treturn Promise.resolve(attempt < this.options.attempts);\n\t}\n\tgetDelay(attempt) {\n\t\treturn Math.min(this.options.maxDelay, this.options.baseDelay * 2 ** attempt);\n\t}\n};\nfunction createRetryStrategy(options) {\n\tif (typeof options === \"number\") return new LinearRetryStrategy({\n\t\ttype: \"linear\",\n\t\tattempts: options,\n\t\tdelay: 1e3\n\t});\n\tswitch (options.type) {\n\t\tcase \"linear\": return new LinearRetryStrategy(options);\n\t\tcase \"exponential\": return new ExponentialRetryStrategy(options);\n\t\tdefault: throw new Error(\"Invalid retry strategy\");\n\t}\n}\n//#endregion\n//#region src/create-fetch/schema.ts\nconst methods = [\n\t\"get\",\n\t\"post\",\n\t\"put\",\n\t\"patch\",\n\t\"delete\"\n];\nconst createSchema = (schema, config) => {\n\treturn {\n\t\tschema,\n\t\tconfig\n\t};\n};\n//#endregion\n//#region src/method.ts\nfunction parseMethodModifier(path) {\n\tif (!path.startsWith(\"@\")) return {\n\t\tmethod: void 0,\n\t\tpath\n\t};\n\tconst separator = path.indexOf(\"/\");\n\tconst method = path.slice(1, separator === -1 ? void 0 : separator);\n\tif (!methods.includes(method)) return {\n\t\tmethod: void 0,\n\t\tpath\n\t};\n\treturn {\n\t\tmethod,\n\t\tpath: separator === -1 ? path : path.slice(separator + 1)\n\t};\n}\n//#endregion\n//#region src/url.ts\nconst isReservedPathSegment = (value) => value === \".\" || value === \"..\";\nconst encodeLiteralPathSegment = (segment) => segment.split(\":\").map((part) => encodeURIComponent(part)).join(\":\");\nfunction resolvePathSegment(segment, pathParams) {\n\tconst pathParam = pathParams.get(segment);\n\tif (pathParam === void 0) return encodeLiteralPathSegment(segment);\n\tif (isReservedPathSegment(pathParam)) throw new TypeError(\"Path parameters cannot be reserved path segments\");\n\treturn encodeURIComponent(pathParam);\n}\n/**\n* Normalize URL\n*/\nfunction getURL$1(url, option) {\n\tconst { baseURL, params, query } = option || {\n\t\tquery: {},\n\t\tparams: {},\n\t\tbaseURL: \"\"\n\t};\n\tlet basePath = url.startsWith(\"http\") ? url.split(\"/\").slice(0, 3).join(\"/\") : baseURL || \"\";\n\tconst { path: requestPath } = parseMethodModifier(url);\n\tif (requestPath !== url) url = `/${requestPath}`;\n\tif (!basePath.endsWith(\"/\")) basePath += \"/\";\n\tlet [path, urlQuery] = url.replace(basePath, \"\").split(\"?\");\n\tconst queryParams = new URLSearchParams(urlQuery);\n\tfor (const [key, value] of Object.entries(query || {})) {\n\t\tif (value == null) continue;\n\t\tlet serializedValue;\n\t\tif (typeof value === \"string\") serializedValue = value;\n\t\telse if (Array.isArray(value)) {\n\t\t\tfor (const val of value) queryParams.append(key, val);\n\t\t\tcontinue;\n\t\t} else serializedValue = JSON.stringify(value);\n\t\tqueryParams.set(key, serializedValue);\n\t}\n\tconst pathParams = /* @__PURE__ */ new Map();\n\tif (params) if (Array.isArray(params)) {\n\t\tconst paramPaths = path.split(\"/\").filter((p) => p.startsWith(\":\"));\n\t\tfor (const [index, key] of paramPaths.entries()) {\n\t\t\tconst value = params[index];\n\t\t\tpathParams.set(key, String(value));\n\t\t}\n\t} else for (const [key, value] of Object.entries(params)) pathParams.set(`:${key}`, String(value));\n\tpath = path.split(\"/\").map((segment) => resolvePathSegment(segment, pathParams)).join(\"/\");\n\tpath = path.replace(/^\\/+/, \"\");\n\tlet queryParamString = queryParams.toString();\n\tqueryParamString = queryParamString.length > 0 ? `?${queryParamString}`.replace(/\\+/g, \"%20\") : \"\";\n\tif (!basePath.startsWith(\"http\")) return `${basePath}${path}${queryParamString}`;\n\treturn new URL(`${path}${queryParamString}`, basePath);\n}\n//#endregion\n//#region src/auth.ts\nconst getAuthHeader = async (options) => {\n\tconst headers = {};\n\tconst getValue = async (value) => typeof value === \"function\" ? await value() : value;\n\tif (options === null || options === void 0 ? void 0 : options.auth) {\n\t\tif (options.auth.type === \"Bearer\") {\n\t\t\tconst token = await getValue(options.auth.token);\n\t\t\tif (!token) return headers;\n\t\t\theaders[\"authorization\"] = `Bearer ${token}`;\n\t\t} else if (options.auth.type === \"Basic\") {\n\t\t\tconst [username, password] = await Promise.all([getValue(options.auth.username), getValue(options.auth.password)]);\n\t\t\tif (!username || !password) return headers;\n\t\t\theaders[\"authorization\"] = `Basic ${btoa(`${username}:${password}`)}`;\n\t\t} else if (options.auth.type === \"Custom\") {\n\t\t\tconst [prefix, value] = await Promise.all([getValue(options.auth.prefix), getValue(options.auth.value)]);\n\t\t\tif (!value) return headers;\n\t\t\theaders[\"authorization\"] = `${prefix !== null && prefix !== void 0 ? prefix : \"\"} ${value}`;\n\t\t}\n\t}\n\treturn headers;\n};\n//#endregion\n//#region src/utils.ts\nconst JSON_RE = /^application\\/(?:[\\w!#$%&*.^`~-]*\\+)?json(;.+)?$/i;\nfunction detectResponseType(request) {\n\tconst _contentType = request.headers.get(\"content-type\");\n\tconst textTypes = /* @__PURE__ */ new Set([\n\t\t\"image/svg\",\n\t\t\"application/xml\",\n\t\t\"application/xhtml\",\n\t\t\"application/html\"\n\t]);\n\tif (!_contentType) return \"json\";\n\tconst contentType = _contentType.split(\";\").shift() || \"\";\n\tif (JSON_RE.test(contentType)) return \"json\";\n\tif (textTypes.has(contentType) || contentType.startsWith(\"text/\")) return \"text\";\n\treturn \"blob\";\n}\nfunction isJSONParsable(value) {\n\ttry {\n\t\tJSON.parse(value);\n\t\treturn true;\n\t} catch (error) {\n\t\treturn false;\n\t}\n}\nfunction isJSONSerializable(value) {\n\tif (value === void 0) return false;\n\tconst t = typeof value;\n\tif (t === \"string\" || t === \"number\" || t === \"boolean\" || t === null) return true;\n\tif (t !== \"object\") return false;\n\tif (Array.isArray(value)) return true;\n\tif (value.buffer) return false;\n\treturn value.constructor && value.constructor.name === \"Object\" || typeof value.toJSON === \"function\";\n}\nfunction jsonParse(text) {\n\ttry {\n\t\treturn JSON.parse(text);\n\t} catch (error) {\n\t\treturn text;\n\t}\n}\nfunction isFunction(value) {\n\treturn typeof value === \"function\";\n}\nfunction getFetch(options) {\n\tif (options === null || options === void 0 ? void 0 : options.customFetchImpl) return options.customFetchImpl;\n\tif (typeof globalThis !== \"undefined\" && isFunction(globalThis.fetch)) return globalThis.fetch;\n\tif (typeof window !== \"undefined\" && isFunction(window.fetch)) return window.fetch;\n\tthrow new Error(\"No fetch implementation found\");\n}\nfunction isPayloadMethod(method) {\n\tif (!method) return false;\n\treturn [\n\t\t\"POST\",\n\t\t\"PUT\",\n\t\t\"PATCH\",\n\t\t\"DELETE\"\n\t].includes(method.toUpperCase());\n}\nfunction isRouteMethod(method) {\n\tconst routeMethod = [\n\t\t\"GET\",\n\t\t\"POST\",\n\t\t\"PUT\",\n\t\t\"PATCH\",\n\t\t\"DELETE\"\n\t];\n\tif (!method) return false;\n\treturn routeMethod.includes(method.toUpperCase());\n}\nfunction mergeHeaders(...sources) {\n\tconst merged = {};\n\tfor (const source of sources) {\n\t\tif (!source) continue;\n\t\tif (source instanceof Headers) source.forEach((value, key) => {\n\t\t\tmerged[key] = value;\n\t\t});\n\t\telse {\n\t\t\tconst entries = Array.isArray(source) ? source : Object.entries(source);\n\t\t\tfor (const [key, value] of entries) if (value !== null && value !== void 0) merged[key] = value;\n\t\t}\n\t}\n\treturn merged;\n}\nasync function getHeaders(opts) {\n\tconst headers = new Headers(mergeHeaders(opts === null || opts === void 0 ? void 0 : opts.headers, await getAuthHeader(opts)));\n\tif (!headers.has(\"content-type\")) {\n\t\tconst contentType = detectContentType(opts === null || opts === void 0 ? void 0 : opts.body);\n\t\tif (contentType) headers.set(\"content-type\", contentType);\n\t}\n\treturn headers;\n}\nfunction getURL(url, options) {\n\tconst { path } = parseMethodModifier(url);\n\tif (path !== url) url = `/${path}`;\n\tlet _url;\n\ttry {\n\t\tif (url.startsWith(\"http\")) _url = url;\n\t\telse {\n\t\t\tlet baseURL = options === null || options === void 0 ? void 0 : options.baseURL;\n\t\t\tif (baseURL && !(baseURL === null || baseURL === void 0 ? void 0 : baseURL.endsWith(\"/\"))) baseURL = baseURL + \"/\";\n\t\t\tif (url.startsWith(\"/\")) _url = new URL(url.substring(1), baseURL);\n\t\t\telse _url = new URL(url, options === null || options === void 0 ? void 0 : options.baseURL);\n\t\t}\n\t} catch (e) {\n\t\tif (e instanceof TypeError) {\n\t\t\tif (!(options === null || options === void 0 ? void 0 : options.baseURL)) throw TypeError(`Invalid URL ${url}. Are you passing in a relative url but not setting the baseURL?`);\n\t\t\tthrow TypeError(`Invalid URL ${url}. Please validate that you are passing the correct input.`);\n\t\t}\n\t\tthrow e;\n\t}\n\t/**\n\t* Dynamic Parameters.\n\t*/\n\tif (options === null || options === void 0 ? void 0 : options.params) if (Array.isArray(options === null || options === void 0 ? void 0 : options.params)) {\n\t\tconst params = (options === null || options === void 0 ? void 0 : options.params) ? Array.isArray(options.params) ? `/${options.params.join(\"/\")}` : `/${Object.values(options.params).join(\"/\")}` : \"\";\n\t\t_url = _url.toString().split(\"/:\")[0];\n\t\t_url = `${_url.toString()}${params}`;\n\t} else for (const [key, value] of Object.entries(options === null || options === void 0 ? void 0 : options.params)) _url = _url.toString().replace(`:${key}`, String(value));\n\tconst __url = new URL(_url);\n\t/**\n\t* Query Parameters\n\t*/\n\tconst queryParams = options === null || options === void 0 ? void 0 : options.query;\n\tif (queryParams) for (const [key, value] of Object.entries(queryParams)) __url.searchParams.append(key, String(value));\n\treturn __url;\n}\nfunction detectContentType(body) {\n\tif (isJSONSerializable(body)) return \"application/json\";\n\treturn null;\n}\nfunction getMediaType(headers) {\n\tconst contentType = headers.get(\"content-type\");\n\treturn contentType ? contentType.split(\";\")[0].trim().toLowerCase() : null;\n}\nfunction getBody(options, headers) {\n\tconst { body } = options;\n\tif (!body) return null;\n\tif (!isJSONSerializable(body)) return body;\n\tif (typeof body === \"string\") return body;\n\tif (getMediaType(headers) === \"application/x-www-form-urlencoded\") return new URLSearchParams(body).toString();\n\treturn JSON.stringify(body);\n}\nfunction getMethod(url, options) {\n\tif (options === null || options === void 0 ? void 0 : options.method) return options.method.toUpperCase();\n\tconst { method } = parseMethodModifier(url);\n\tif (method) return method.toUpperCase();\n\treturn (options === null || options === void 0 ? void 0 : options.body) ? \"POST\" : \"GET\";\n}\nfunction getTimeout(options, controller) {\n\tlet abortTimeout;\n\tif (!(options === null || options === void 0 ? void 0 : options.signal) && (options === null || options === void 0 ? void 0 : options.timeout)) abortTimeout = setTimeout(() => controller === null || controller === void 0 ? void 0 : controller.abort(), options === null || options === void 0 ? void 0 : options.timeout);\n\treturn {\n\t\tabortTimeout,\n\t\tclearTimeout: () => {\n\t\t\tif (abortTimeout) clearTimeout(abortTimeout);\n\t\t}\n\t};\n}\nfunction bodyParser(data, responseType) {\n\tif (responseType === \"json\") return JSON.parse(data);\n\treturn data;\n}\nvar ValidationError = class ValidationError extends Error {\n\tconstructor(issues, message) {\n\t\tsuper(message || JSON.stringify(issues, null, 2));\n\t\tthis.issues = issues;\n\t\tObject.setPrototypeOf(this, ValidationError.prototype);\n\t}\n};\nasync function parseStandardSchema(schema, input) {\n\tconst result = await schema[\"~standard\"].validate(input);\n\tif (result.issues) throw new ValidationError(result.issues);\n\treturn result.value;\n}\n//#endregion\n//#region \\0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js\nfunction _typeof(o) {\n\t\"@babel/helpers - typeof\";\n\treturn _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(o) {\n\t\treturn typeof o;\n\t} : function(o) {\n\t\treturn o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n\t}, _typeof(o);\n}\n//#endregion\n//#region \\0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js\nfunction toPrimitive(t, r) {\n\tif (\"object\" != _typeof(t) || !t) return t;\n\tvar e = t[Symbol.toPrimitive];\n\tif (void 0 !== e) {\n\t\tvar i = e.call(t, r || \"default\");\n\t\tif (\"object\" != _typeof(i)) return i;\n\t\tthrow new TypeError(\"@@toPrimitive must return a primitive value.\");\n\t}\n\treturn (\"string\" === r ? String : Number)(t);\n}\n//#endregion\n//#region \\0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js\nfunction toPropertyKey(t) {\n\tvar i = toPrimitive(t, \"string\");\n\treturn \"symbol\" == _typeof(i) ? i : i + \"\";\n}\n//#endregion\n//#region \\0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js\nfunction _defineProperty(e, r, t) {\n\treturn (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n\t\tvalue: t,\n\t\tenumerable: !0,\n\t\tconfigurable: !0,\n\t\twritable: !0\n\t}) : e[r] = t, e;\n}\n//#endregion\n//#region \\0@oxc-project+runtime@0.140.0/helpers/esm/objectSpread2.js\nfunction ownKeys(e, r) {\n\tvar t = Object.keys(e);\n\tif (Object.getOwnPropertySymbols) {\n\t\tvar o = Object.getOwnPropertySymbols(e);\n\t\tr && (o = o.filter(function(r) {\n\t\t\treturn Object.getOwnPropertyDescriptor(e, r).enumerable;\n\t\t})), t.push.apply(t, o);\n\t}\n\treturn t;\n}\nfunction _objectSpread2(e) {\n\tfor (var r = 1; r < arguments.length; r++) {\n\t\tvar t = null != arguments[r] ? arguments[r] : {};\n\t\tr % 2 ? ownKeys(Object(t), !0).forEach(function(r) {\n\t\t\t_defineProperty(e, r, t[r]);\n\t\t}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {\n\t\t\tObject.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n\t\t});\n\t}\n\treturn e;\n}\n//#endregion\n//#region src/fetch.ts\nconst betterFetch = async (url, options) => {\n\tvar _opts$signal, _options$body, _options$jsonParser;\n\tconst { hooks, url: __url, options: opts } = await initializePlugins(url, options);\n\tconst fetch = getFetch(opts);\n\tconst controller = new AbortController();\n\tconst signal = (_opts$signal = opts.signal) !== null && _opts$signal !== void 0 ? _opts$signal : controller.signal;\n\tconst _url = getURL$1(__url, opts);\n\tconst headers = await getHeaders(opts);\n\tconst body = getBody(opts, headers);\n\tconst method = getMethod(__url, opts);\n\tconst context = _objectSpread2(_objectSpread2({}, opts), {}, {\n\t\turl: _url,\n\t\theaders,\n\t\tbody,\n\t\tmethod,\n\t\tsignal\n\t});\n\t/**\n\t* Run all on request hooks\n\t*/\n\tfor (const onRequest of hooks.onRequest) if (onRequest) {\n\t\tconst res = await onRequest(context);\n\t\tif (typeof res === \"object\" && res !== null) Object.assign(context, res);\n\t}\n\tif (\"pipeTo\" in context && typeof context.pipeTo === \"function\" || typeof (options === null || options === void 0 || (_options$body = options.body) === null || _options$body === void 0 ? void 0 : _options$body.pipe) === \"function\") {\n\t\tif (!(\"duplex\" in context)) context.duplex = \"half\";\n\t}\n\tconst { clearTimeout } = getTimeout(opts, controller);\n\tlet response = await fetch(context.url, context);\n\tclearTimeout();\n\tconst responseContext = {\n\t\tresponse,\n\t\trequest: context\n\t};\n\tfor (const onResponse of hooks.onResponse) if (onResponse) {\n\t\tvar _options$hookOptions;\n\t\tconst r = await onResponse(_objectSpread2(_objectSpread2({}, responseContext), {}, { response: (options === null || options === void 0 || (_options$hookOptions = options.hookOptions) === null || _options$hookOptions === void 0 ? void 0 : _options$hookOptions.cloneResponse) ? response.clone() : response }));\n\t\tif (r instanceof Response) response = r;\n\t\telse if (typeof r === \"object\" && r !== null) response = r.response;\n\t}\n\t/**\n\t* OK Branch\n\t*/\n\tif (response.ok) {\n\t\tif (!(context.method !== \"HEAD\")) return {\n\t\t\tdata: \"\",\n\t\t\terror: null\n\t\t};\n\t\tconst responseType = detectResponseType(response);\n\t\tconst successContext = {\n\t\t\tdata: null,\n\t\t\tresponse,\n\t\t\trequest: context\n\t\t};\n\t\tif (responseType === \"json\" || responseType === \"text\") {\n\t\t\tvar _context$jsonParser;\n\t\t\tconst text = await response.text();\n\t\t\tsuccessContext.data = await ((_context$jsonParser = context.jsonParser) !== null && _context$jsonParser !== void 0 ? _context$jsonParser : jsonParse)(text);\n\t\t} else successContext.data = await response[responseType]();\n\t\t/**\n\t\t* Parse the data if the output schema is defined\n\t\t*/\n\t\tif (context === null || context === void 0 ? void 0 : context.output) {\n\t\t\tif (context.output && !context.disableValidation) successContext.data = await parseStandardSchema(context.output, successContext.data);\n\t\t}\n\t\tfor (const onSuccess of hooks.onSuccess) if (onSuccess) {\n\t\t\tvar _options$hookOptions2;\n\t\t\tawait onSuccess(_objectSpread2(_objectSpread2({}, successContext), {}, { response: (options === null || options === void 0 || (_options$hookOptions2 = options.hookOptions) === null || _options$hookOptions2 === void 0 ? void 0 : _options$hookOptions2.cloneResponse) ? response.clone() : response }));\n\t\t}\n\t\tif (options === null || options === void 0 ? void 0 : options.throw) return successContext.data;\n\t\treturn {\n\t\t\tdata: successContext.data,\n\t\t\terror: null\n\t\t};\n\t}\n\tconst parser = (_options$jsonParser = options === null || options === void 0 ? void 0 : options.jsonParser) !== null && _options$jsonParser !== void 0 ? _options$jsonParser : jsonParse;\n\tconst responseText = await response.text();\n\tconst isJSONResponse = isJSONParsable(responseText);\n\tconst errorObject = isJSONResponse ? await parser(responseText) : null;\n\t/**\n\t* Error Branch\n\t*/\n\tconst errorContext = {\n\t\tresponse,\n\t\tresponseText,\n\t\trequest: context,\n\t\terror: _objectSpread2(_objectSpread2({}, errorObject), {}, {\n\t\t\tstatus: response.status,\n\t\t\tstatusText: response.statusText\n\t\t})\n\t};\n\tfor (const onError of hooks.onError) if (onError) {\n\t\tvar _options$hookOptions3;\n\t\tawait onError(_objectSpread2(_objectSpread2({}, errorContext), {}, { response: (options === null || options === void 0 || (_options$hookOptions3 = options.hookOptions) === null || _options$hookOptions3 === void 0 ? void 0 : _options$hookOptions3.cloneResponse) ? response.clone() : response }));\n\t}\n\tif (options === null || options === void 0 ? void 0 : options.retry) {\n\t\tvar _options$retryAttempt;\n\t\tconst retryStrategy = createRetryStrategy(options.retry);\n\t\tconst _retryAttempt = (_options$retryAttempt = options.retryAttempt) !== null && _options$retryAttempt !== void 0 ? _options$retryAttempt : 0;\n\t\tif (await retryStrategy.shouldAttemptRetry(_retryAttempt, response)) {\n\t\t\tfor (const onRetry of hooks.onRetry) if (onRetry) await onRetry(responseContext);\n\t\t\tconst delay = retryStrategy.getDelay(_retryAttempt);\n\t\t\tawait new Promise((resolve) => setTimeout(resolve, delay));\n\t\t\treturn await betterFetch(url, _objectSpread2(_objectSpread2({}, options), {}, { retryAttempt: _retryAttempt + 1 }));\n\t\t}\n\t}\n\tif (options === null || options === void 0 ? void 0 : options.throw) throw new BetterFetchError(response.status, response.statusText, isJSONResponse ? errorObject : responseText);\n\treturn {\n\t\tdata: null,\n\t\terror: _objectSpread2(_objectSpread2({}, errorObject), {}, {\n\t\t\tstatus: response.status,\n\t\t\tstatusText: response.statusText\n\t\t})\n\t};\n};\n//#endregion\n//#region src/create-fetch/index.ts\nconst applySchemaPlugin = (config) => ({\n\tid: \"apply-schema\",\n\tname: \"Apply Schema\",\n\tversion: \"1.0.0\",\n\tasync init(url, options) {\n\t\tvar _config$plugins;\n\t\tlet opts = _objectSpread2(_objectSpread2({}, options), config.query !== void 0 && { query: _objectSpread2(_objectSpread2({}, config.query), options === null || options === void 0 ? void 0 : options.query) });\n\t\tconst schema = ((_config$plugins = config.plugins) === null || _config$plugins === void 0 || (_config$plugins = _config$plugins.find((plugin) => {\n\t\t\tvar _plugin$schema;\n\t\t\treturn ((_plugin$schema = plugin.schema) === null || _plugin$schema === void 0 ? void 0 : _plugin$schema.config) ? url.startsWith(plugin.schema.config.baseURL || \"\") || url.startsWith(plugin.schema.config.prefix || \"\") : false;\n\t\t})) === null || _config$plugins === void 0 ? void 0 : _config$plugins.schema) || config.schema;\n\t\tif (schema) {\n\t\t\tvar _schema$config, _schema$config2;\n\t\t\tlet urlKey = url;\n\t\t\tif ((_schema$config = schema.config) === null || _schema$config === void 0 ? void 0 : _schema$config.prefix) {\n\t\t\t\tif (urlKey.startsWith(schema.config.prefix)) {\n\t\t\t\t\turlKey = urlKey.replace(schema.config.prefix, \"\");\n\t\t\t\t\tif (schema.config.baseURL) url = url.replace(schema.config.prefix, schema.config.baseURL);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ((_schema$config2 = schema.config) === null || _schema$config2 === void 0 ? void 0 : _schema$config2.baseURL) {\n\t\t\t\tif (urlKey.startsWith(schema.config.baseURL)) urlKey = urlKey.replace(schema.config.baseURL, \"\");\n\t\t\t}\n\t\t\tif (urlKey.startsWith(\"/\") && urlKey.charAt(1) === \"@\") urlKey = urlKey.substring(1);\n\t\t\tconst keySchema = schema.schema[urlKey];\n\t\t\tif (keySchema) {\n\t\t\t\tvar _keySchema$method;\n\t\t\t\tconst { method: schemaMethod, path } = parseMethodModifier(urlKey);\n\t\t\t\tif (schemaMethod) url = url.slice(0, url.length - urlKey.length) + path;\n\t\t\t\tlet validatedHeaders = options === null || options === void 0 ? void 0 : options.headers;\n\t\t\t\tif (keySchema.headers && !(options === null || options === void 0 ? void 0 : options.disableValidation)) {\n\t\t\t\t\tconst normalizedHeaders = {};\n\t\t\t\t\tif (options === null || options === void 0 ? void 0 : options.headers) {\n\t\t\t\t\t\tif (options.headers instanceof Headers) options.headers.forEach((value, key) => {\n\t\t\t\t\t\t\tnormalizedHeaders[key.toLowerCase()] = value;\n\t\t\t\t\t\t});\n\t\t\t\t\t\telse if (typeof options.headers === \"object\") {\n\t\t\t\t\t\t\tfor (const [key, value] of Object.entries(options.headers)) if (value !== null && value !== void 0) normalizedHeaders[key.toLowerCase()] = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tconst validated = await parseStandardSchema(keySchema.headers, normalizedHeaders);\n\t\t\t\t\tconst finalHeaders = {};\n\t\t\t\t\tfor (const [key, value] of Object.entries(validated)) finalHeaders[key.toLowerCase()] = value;\n\t\t\t\t\tvalidatedHeaders = finalHeaders;\n\t\t\t\t}\n\t\t\t\tconst method = (_keySchema$method = keySchema.method) !== null && _keySchema$method !== void 0 ? _keySchema$method : schemaMethod;\n\t\t\t\topts = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, opts), method !== void 0 && { method }), keySchema.output !== void 0 && { output: keySchema.output }), validatedHeaders !== void 0 && { headers: validatedHeaders });\n\t\t\t\tif (!(options === null || options === void 0 ? void 0 : options.disableValidation)) {\n\t\t\t\t\tif (keySchema.query) {\n\t\t\t\t\t\topts.query = await parseStandardSchema(keySchema.query, options === null || options === void 0 ? void 0 : options.query);\n\t\t\t\t\t\tif (opts.query !== null && typeof opts.query === \"object\") {\n\t\t\t\t\t\t\tconst defaults = _objectSpread2({}, config.query);\n\t\t\t\t\t\t\tfor (const key of Object.keys(defaults)) if ((options === null || options === void 0 ? void 0 : options.query) && Object.prototype.hasOwnProperty.call(options.query, key)) defaults[key] = options.query[key];\n\t\t\t\t\t\t\topts.query = _objectSpread2(_objectSpread2({}, defaults), opts.query);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\topts = _objectSpread2(_objectSpread2({}, opts), {}, {\n\t\t\t\t\t\tbody: keySchema.input ? await parseStandardSchema(keySchema.input, options === null || options === void 0 ? void 0 : options.body) : options === null || options === void 0 ? void 0 : options.body,\n\t\t\t\t\t\tparams: keySchema.params ? await parseStandardSchema(keySchema.params, options === null || options === void 0 ? void 0 : options.params) : options === null || options === void 0 ? void 0 : options.params\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\turl,\n\t\t\t\t\toptions: opts\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\treturn _objectSpread2({ url }, (options !== void 0 || config.query !== void 0) && { options: opts });\n\t}\n});\nconst createFetch = (config) => {\n\tasync function $fetch(url, options) {\n\t\tconst opts = _objectSpread2(_objectSpread2(_objectSpread2({}, config), options), {}, {\n\t\t\theaders: mergeHeaders(config === null || config === void 0 ? void 0 : config.headers, options === null || options === void 0 ? void 0 : options.headers),\n\t\t\tplugins: [\n\t\t\t\t...(config === null || config === void 0 ? void 0 : config.plugins) || [],\n\t\t\t\tapplySchemaPlugin(config || {}),\n\t\t\t\t...(options === null || options === void 0 ? void 0 : options.plugins) || []\n\t\t\t]\n\t\t});\n\t\tif (config === null || config === void 0 ? void 0 : config.catchAllError) try {\n\t\t\treturn await betterFetch(url, opts);\n\t\t} catch (error) {\n\t\t\treturn {\n\t\t\t\tdata: null,\n\t\t\t\terror: {\n\t\t\t\t\tstatus: 500,\n\t\t\t\t\tstatusText: \"Fetch Error\",\n\t\t\t\t\tmessage: \"Fetch related error. Captured by catchAllError option. See error property for more details.\",\n\t\t\t\t\terror\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\treturn await betterFetch(url, opts);\n\t}\n\treturn $fetch;\n};\n//#endregion\nexport { BetterFetchError, ValidationError, applySchemaPlugin, betterFetch, bodyParser, createFetch, createRetryStrategy, createSchema, detectContentType, detectResponseType, getBody, getFetch, getHeaders, getMethod, getTimeout, getURL, initializePlugins, isFunction, isJSONParsable, isJSONSerializable, isPayloadMethod, isRouteMethod, jsonParse, mergeHeaders, methods, parseStandardSchema };\n\n//# sourceMappingURL=index.js.map","import { getBaseURL } from \"../utils/url.mjs\";\nimport { parseJSON } from \"./parser.mjs\";\nimport { redirectPlugin } from \"./fetch-plugins.mjs\";\nimport { getSessionAtom, hydrateSessionAtom } from \"./session-atom.mjs\";\nimport { defu } from \"defu\";\nimport { createFetch } from \"@better-fetch/fetch\";\n//#region src/client/config.ts\nconst resolvePublicAuthUrl = (basePath) => {\n\tif (typeof process === \"undefined\") return void 0;\n\tconst path = basePath ?? \"/api/auth\";\n\tif (process.env.NEXT_PUBLIC_AUTH_URL) return process.env.NEXT_PUBLIC_AUTH_URL;\n\tif (typeof window === \"undefined\") {\n\t\tif (process.env.NEXTAUTH_URL) try {\n\t\t\treturn process.env.NEXTAUTH_URL;\n\t\t} catch {}\n\t\tif (process.env.VERCEL_URL) try {\n\t\t\tconst protocol = process.env.VERCEL_URL.startsWith(\"http\") ? \"\" : \"https://\";\n\t\t\treturn `${new URL(`${protocol}${process.env.VERCEL_URL}`).origin}${path}`;\n\t\t} catch {}\n\t}\n};\nconst matchesSessionSignal = (path) => path === \"/sign-out\" || path === \"/update-user\" || path === \"/update-session\" || path === \"/sign-up/email\" || path === \"/sign-in/email\" || path === \"/delete-user\" || path === \"/verify-email\" || path === \"/revoke-sessions\" || path === \"/revoke-session\" || path === \"/revoke-other-sessions\" || path === \"/change-email\" || path === \"/change-password\";\nconst getClientConfig = (options, loadEnv) => {\n\tconst isCredentialsSupported = \"credentials\" in Request.prototype;\n\tconst baseURL = getBaseURL(options?.baseURL, options?.basePath, void 0, loadEnv) ?? resolvePublicAuthUrl(options?.basePath) ?? \"/api/auth\";\n\tconst pluginsFetchPlugins = options?.plugins?.flatMap((plugin) => plugin.fetchPlugins).filter((pl) => pl !== void 0) || [];\n\tconst lifeCyclePlugin = {\n\t\tid: \"lifecycle-hooks\",\n\t\tname: \"lifecycle-hooks\",\n\t\thooks: {\n\t\t\tonSuccess: options?.fetchOptions?.onSuccess,\n\t\t\tonError: options?.fetchOptions?.onError,\n\t\t\tonRequest: options?.fetchOptions?.onRequest,\n\t\t\tonResponse: options?.fetchOptions?.onResponse\n\t\t}\n\t};\n\tconst { onSuccess: _onSuccess, onError: _onError, onRequest: _onRequest, onResponse: _onResponse, ...restOfFetchOptions } = options?.fetchOptions || {};\n\tconst $fetch = createFetch({\n\t\tbaseURL,\n\t\t...isCredentialsSupported ? { credentials: \"include\" } : {},\n\t\tmethod: \"GET\",\n\t\tjsonParser(text) {\n\t\t\tif (!text) return null;\n\t\t\treturn parseJSON(text, { strict: false });\n\t\t},\n\t\tcustomFetchImpl: fetch,\n\t\t...restOfFetchOptions,\n\t\tplugins: [\n\t\t\tlifeCyclePlugin,\n\t\t\t...restOfFetchOptions.plugins || [],\n\t\t\t...options?.disableDefaultFetchPlugins ? [] : [redirectPlugin],\n\t\t\t...pluginsFetchPlugins\n\t\t]\n\t});\n\tconst { $sessionSignal, session, broadcastSessionUpdate } = getSessionAtom($fetch, options);\n\tlet hasHydrated = false;\n\tconst hydrateSession = (sessionData) => {\n\t\tif (hasHydrated || sessionData === null) return;\n\t\thasHydrated = true;\n\t\thydrateSessionAtom(session, sessionData);\n\t};\n\tconst plugins = options?.plugins || [];\n\tlet pluginsActions = {};\n\tconst pluginsAtoms = {\n\t\t$sessionSignal,\n\t\tsession\n\t};\n\tconst pluginPathMethods = {\n\t\t\"/sign-out\": \"POST\",\n\t\t\"/revoke-sessions\": \"POST\",\n\t\t\"/revoke-other-sessions\": \"POST\",\n\t\t\"/delete-user\": \"POST\"\n\t};\n\tconst atomListeners = [{\n\t\tsignal: \"$sessionSignal\",\n\t\tmatcher: matchesSessionSignal,\n\t\tcallback(path) {\n\t\t\tif (path === \"/sign-out\") broadcastSessionUpdate(\"signout\");\n\t\t\telse if (path === \"/update-user\" || path === \"/update-session\") broadcastSessionUpdate(\"updateUser\");\n\t\t}\n\t}];\n\tfor (const plugin of plugins) {\n\t\tif (plugin.getAtoms) Object.assign(pluginsAtoms, plugin.getAtoms?.($fetch));\n\t\tif (plugin.pathMethods) Object.assign(pluginPathMethods, plugin.pathMethods);\n\t\tif (plugin.atomListeners) atomListeners.push(...plugin.atomListeners);\n\t}\n\tconst $store = {\n\t\tnotify: (signal) => {\n\t\t\tpluginsAtoms[signal].set(!pluginsAtoms[signal].get());\n\t\t},\n\t\tlisten: (signal, listener) => {\n\t\t\tpluginsAtoms[signal].subscribe(listener);\n\t\t},\n\t\tatoms: pluginsAtoms\n\t};\n\tfor (const plugin of plugins) if (plugin.getActions) pluginsActions = defu(plugin.getActions?.($fetch, $store, options) ?? {}, pluginsActions);\n\treturn {\n\t\tget baseURL() {\n\t\t\treturn baseURL;\n\t\t},\n\t\tpluginsActions,\n\t\tpluginsAtoms,\n\t\tpluginPathMethods,\n\t\tatomListeners,\n\t\thydrateSession,\n\t\t$sessionSignal,\n\t\t$fetch,\n\t\t$store\n\t};\n};\n//#endregion\nexport { getClientConfig, matchesSessionSignal };\n","//#region src/utils/is-atom.ts\nfunction isAtom(value) {\n\treturn typeof value === \"object\" && value !== null && \"get\" in value && typeof value.get === \"function\" && \"lc\" in value && typeof value.lc === \"number\";\n}\n//#endregion\nexport { isAtom };\n","//#region src/utils/string.ts\nfunction capitalizeFirstLetter(str) {\n\treturn str.charAt(0).toUpperCase() + str.slice(1);\n}\nconst WORD_PATTERN = /[\\p{Ll}\\d]+|\\p{Lu}+(?!\\p{Ll})|\\p{Lu}[\\p{Ll}\\d]+|\\p{Lo}+/gu;\nconst APOSTROPHE_PATTERN = /['\\u2019]/g;\nfunction splitWords(input) {\n\treturn input.replace(APOSTROPHE_PATTERN, \"\").match(WORD_PATTERN) ?? [];\n}\nfunction toSnakeCase(input) {\n\treturn splitWords(input).map((word) => word.toLowerCase()).join(\"_\");\n}\nfunction toKebabCase(input) {\n\treturn splitWords(input).map((word) => word.toLowerCase()).join(\"-\");\n}\nfunction toCamelCase(input) {\n\treturn splitWords(input).reduce((acc, word, i) => {\n\t\treturn acc + (i === 0 ? word.toLowerCase() : `${word[0].toUpperCase()}${word.slice(1)}`);\n\t}, \"\");\n}\nfunction toPascalCase(input) {\n\treturn splitWords(input).map((word) => `${word[0].toUpperCase()}${word.slice(1).toLowerCase()}`).join(\"\");\n}\n//#endregion\nexport { capitalizeFirstLetter, toCamelCase, toKebabCase, toPascalCase, toSnakeCase };\n","import { isAtom } from \"../utils/is-atom.mjs\";\nimport { toKebabCase } from \"@better-auth/core/utils/string\";\n//#region src/client/proxy.ts\nfunction getMethod(path, knownPathMethods, args) {\n\tconst method = knownPathMethods[path];\n\tconst { fetchOptions, query: _query, ...body } = args || {};\n\tif (method) return method;\n\tif (fetchOptions?.method) return fetchOptions.method;\n\tif (body && Object.keys(body).length > 0) return \"POST\";\n\treturn \"GET\";\n}\nfunction createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomListeners) {\n\tfunction createProxy(path = []) {\n\t\treturn new Proxy(function() {}, {\n\t\t\tget(_, prop) {\n\t\t\t\tif (typeof prop !== \"string\") return;\n\t\t\t\tif (prop === \"then\" || prop === \"catch\" || prop === \"finally\") return;\n\t\t\t\tconst fullPath = [...path, prop];\n\t\t\t\tlet current = routes;\n\t\t\t\tfor (const segment of fullPath) if (current && typeof current === \"object\" && segment in current) current = current[segment];\n\t\t\t\telse {\n\t\t\t\t\tcurrent = void 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (typeof current === \"function\") return current;\n\t\t\t\tif (isAtom(current)) return current;\n\t\t\t\treturn createProxy(fullPath);\n\t\t\t},\n\t\t\tapply: async (_, __, args) => {\n\t\t\t\tconst routePath = \"/\" + path.map(toKebabCase).join(\"/\");\n\t\t\t\tconst arg = args[0] || {};\n\t\t\t\tconst fetchOptions = args[1] || {};\n\t\t\t\tconst { query, fetchOptions: argFetchOptions, ...body } = arg;\n\t\t\t\tconst options = {\n\t\t\t\t\t...fetchOptions,\n\t\t\t\t\t...argFetchOptions\n\t\t\t\t};\n\t\t\t\tconst method = getMethod(routePath, knownPathMethods, arg);\n\t\t\t\treturn await client(routePath, {\n\t\t\t\t\t...options,\n\t\t\t\t\tbody: method === \"GET\" ? void 0 : {\n\t\t\t\t\t\t...body,\n\t\t\t\t\t\t...options?.body || {}\n\t\t\t\t\t},\n\t\t\t\t\tquery: query || options?.query,\n\t\t\t\t\tmethod,\n\t\t\t\t\tasync onSuccess(context) {\n\t\t\t\t\t\tawait options?.onSuccess?.(context);\n\t\t\t\t\t\tif (!atomListeners || options.disableSignal) return;\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t* We trigger listeners\n\t\t\t\t\t\t*/\n\t\t\t\t\t\tconst matches = atomListeners.filter((s) => s.matcher(routePath));\n\t\t\t\t\t\tif (!matches.length) return;\n\t\t\t\t\t\tconst visited = /* @__PURE__ */ new Set();\n\t\t\t\t\t\tfor (const match of matches) {\n\t\t\t\t\t\t\tconst signal = atoms[match.signal];\n\t\t\t\t\t\t\tif (!signal) return;\n\t\t\t\t\t\t\tif (visited.has(match.signal)) continue;\n\t\t\t\t\t\t\tvisited.add(match.signal);\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t* To avoid race conditions we set the signal in a setTimeout\n\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\tconst val = signal.get();\n\t\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\t\tsignal.set(!val);\n\t\t\t\t\t\t\t}, 10);\n\t\t\t\t\t\t\tmatch.callback?.(routePath);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\treturn createProxy();\n}\n//#endregion\nexport { createDynamicPathProxy };\n","import { getClientConfig } from \"./config.mjs\";\nimport { createDynamicPathProxy } from \"./proxy.mjs\";\nimport { capitalizeFirstLetter } from \"@better-auth/core/utils/string\";\n//#region src/client/vanilla.ts\nfunction createAuthClient(options) {\n\tconst { pluginPathMethods, pluginsActions, pluginsAtoms, hydrateSession, $fetch, atomListeners, $store } = getClientConfig(options);\n\tconst resolvedHooks = {};\n\tfor (const [key, value] of Object.entries(pluginsAtoms)) resolvedHooks[`use${capitalizeFirstLetter(key)}`] = value;\n\treturn createDynamicPathProxy({\n\t\t...pluginsActions,\n\t\t...resolvedHooks,\n\t\thydrateSession,\n\t\t$fetch,\n\t\t$store\n\t}, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);\n}\n//#endregion\nexport { createAuthClient };\n","import { n as PASSKEY_ERROR_CODES, t as PACKAGE_VERSION } from \"./version-DAM-NEJL.mjs\";\nimport { WebAuthnError, startAuthentication, startRegistration } from \"@simplewebauthn/browser\";\nimport { useAuthQuery } from \"better-auth/client\";\nimport { atom } from \"nanostores\";\n//#region src/client.ts\nconst getPasskeyActions = ($fetch, { $listPasskeys, $store }) => {\n\tconst signInPasskey = async (opts, options) => {\n\t\tconst response = await $fetch(\"/passkey/generate-authenticate-options\", {\n\t\t\tmethod: \"GET\",\n\t\t\tthrow: false\n\t\t});\n\t\tif (!response.data) return response;\n\t\tconst mergedExtensions = response.data.extensions || opts?.extensions ? {\n\t\t\t...response.data.extensions || {},\n\t\t\t...opts?.extensions || {}\n\t\t} : void 0;\n\t\tlet res;\n\t\ttry {\n\t\t\tres = await startAuthentication({\n\t\t\t\toptionsJSON: {\n\t\t\t\t\t...response.data,\n\t\t\t\t\textensions: mergedExtensions\n\t\t\t\t},\n\t\t\t\tuseBrowserAutofill: opts?.autoFill\n\t\t\t});\n\t\t} catch (err) {\n\t\t\treturn {\n\t\t\t\tdata: null,\n\t\t\t\terror: {\n\t\t\t\t\tcode: err instanceof WebAuthnError ? err.code : \"AUTH_CANCELLED\",\n\t\t\t\t\tmessage: PASSKEY_ERROR_CODES.AUTH_CANCELLED.message,\n\t\t\t\t\tstatus: 400,\n\t\t\t\t\tstatusText: \"BAD_REQUEST\"\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\ttry {\n\t\t\tconst { clientExtensionResults, ...responseBody } = res;\n\t\t\tconst verified = await $fetch(\"/passkey/verify-authentication\", {\n\t\t\t\tbody: { response: responseBody },\n\t\t\t\t...opts?.fetchOptions,\n\t\t\t\t...options,\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tthrow: false\n\t\t\t});\n\t\t\t$listPasskeys.set(Math.random());\n\t\t\t$store.notify(\"$sessionSignal\");\n\t\t\tif (opts?.returnWebAuthnResponse) return {\n\t\t\t\t...verified,\n\t\t\t\twebauthn: {\n\t\t\t\t\tresponse: res,\n\t\t\t\t\tclientExtensionResults\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn verified;\n\t\t} catch (err) {\n\t\t\tconsole.error(`[Better Auth] Error verifying passkey`, err);\n\t\t\treturn {\n\t\t\t\tdata: null,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"AUTH_CANCELLED\",\n\t\t\t\t\tmessage: PASSKEY_ERROR_CODES.AUTH_CANCELLED.message,\n\t\t\t\t\tstatus: 400,\n\t\t\t\t\tstatusText: \"BAD_REQUEST\"\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t};\n\tconst registerPasskey = async (opts, fetchOpts) => {\n\t\tconst options = await $fetch(\"/passkey/generate-register-options\", {\n\t\t\tmethod: \"GET\",\n\t\t\tquery: {\n\t\t\t\t...opts?.authenticatorAttachment && { authenticatorAttachment: opts.authenticatorAttachment },\n\t\t\t\t...opts?.name && { name: opts.name },\n\t\t\t\t...opts?.context && { context: opts.context }\n\t\t\t},\n\t\t\tthrow: false\n\t\t});\n\t\tif (!options.data) return options;\n\t\ttry {\n\t\t\tconst mergedExtensions = options.data.extensions || opts?.extensions ? {\n\t\t\t\t...options.data.extensions || {},\n\t\t\t\t...opts?.extensions || {}\n\t\t\t} : void 0;\n\t\t\tconst res = await startRegistration({\n\t\t\t\toptionsJSON: {\n\t\t\t\t\t...options.data,\n\t\t\t\t\textensions: mergedExtensions\n\t\t\t\t},\n\t\t\t\tuseAutoRegister: opts?.useAutoRegister\n\t\t\t});\n\t\t\tconst { clientExtensionResults, ...responseBody } = res;\n\t\t\tconst verified = await $fetch(\"/passkey/verify-registration\", {\n\t\t\t\t...opts?.fetchOptions,\n\t\t\t\t...fetchOpts,\n\t\t\t\tbody: {\n\t\t\t\t\tresponse: responseBody,\n\t\t\t\t\tname: opts?.name,\n\t\t\t\t\t...opts?.createSession && { createSession: true }\n\t\t\t\t},\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tthrow: false\n\t\t\t});\n\t\t\tif (!verified.data) return verified;\n\t\t\t$listPasskeys.set(Math.random());\n\t\t\tif (verified.data.session) $store.notify(\"$sessionSignal\");\n\t\t\tif (opts?.returnWebAuthnResponse) return {\n\t\t\t\t...verified,\n\t\t\t\twebauthn: {\n\t\t\t\t\tresponse: res,\n\t\t\t\t\tclientExtensionResults\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn verified;\n\t\t} catch (e) {\n\t\t\tif (e instanceof WebAuthnError) {\n\t\t\t\tif (e.code === \"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED\") return {\n\t\t\t\t\tdata: null,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: e.code,\n\t\t\t\t\t\tmessage: PASSKEY_ERROR_CODES.PREVIOUSLY_REGISTERED.message,\n\t\t\t\t\t\tstatus: 400,\n\t\t\t\t\t\tstatusText: \"BAD_REQUEST\"\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tif (e.code === \"ERROR_CEREMONY_ABORTED\") return {\n\t\t\t\t\tdata: null,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: e.code,\n\t\t\t\t\t\tmessage: PASSKEY_ERROR_CODES.REGISTRATION_CANCELLED.message,\n\t\t\t\t\t\tstatus: 400,\n\t\t\t\t\t\tstatusText: \"BAD_REQUEST\"\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\tdata: null,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: e.code,\n\t\t\t\t\t\tmessage: e.message,\n\t\t\t\t\t\tstatus: 400,\n\t\t\t\t\t\tstatusText: \"BAD_REQUEST\"\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tdata: null,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"UNKNOWN_ERROR\",\n\t\t\t\t\tmessage: e instanceof Error ? e.message : PASSKEY_ERROR_CODES.UNKNOWN_ERROR.message,\n\t\t\t\t\tstatus: 500,\n\t\t\t\t\tstatusText: \"INTERNAL_SERVER_ERROR\"\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t};\n\treturn {\n\t\tsignIn: { \n\t\t/**\n\t\t* Sign in with a registered passkey\n\t\t*/\npasskey: signInPasskey },\n\t\tpasskey: { \n\t\t/**\n\t\t* Add a passkey to the user account\n\t\t*/\naddPasskey: registerPasskey },\n\t\t/**\n\t\t* Inferred Internal Types\n\t\t*/\n\t\t$Infer: {}\n\t};\n};\nconst passkeyClient = () => {\n\tconst $listPasskeys = atom();\n\treturn {\n\t\tid: \"passkey\",\n\t\tversion: PACKAGE_VERSION,\n\t\t$InferServerPlugin: {},\n\t\tgetActions: ($fetch, $store) => getPasskeyActions($fetch, {\n\t\t\t$listPasskeys,\n\t\t\t$store\n\t\t}),\n\t\tgetAtoms($fetch) {\n\t\t\treturn {\n\t\t\t\tlistPasskeys: useAuthQuery($listPasskeys, \"/passkey/list-user-passkeys\", $fetch, { method: \"GET\" }),\n\t\t\t\t$listPasskeys\n\t\t\t};\n\t\t},\n\t\tpathMethods: {\n\t\t\t\"/passkey/register\": \"POST\",\n\t\t\t\"/passkey/authenticate\": \"POST\"\n\t\t},\n\t\tatomListeners: [{\n\t\t\tmatcher(path) {\n\t\t\t\treturn path === \"/passkey/verify-registration\" || path === \"/passkey/delete-passkey\" || path === \"/passkey/update-passkey\" || path === \"/sign-out\";\n\t\t\t},\n\t\t\tsignal: \"$listPasskeys\"\n\t\t}, {\n\t\t\tmatcher: (path) => path === \"/passkey/verify-authentication\",\n\t\t\tsignal: \"$sessionSignal\"\n\t\t}],\n\t\t$ERROR_CODES: PASSKEY_ERROR_CODES\n\t};\n};\n//#endregion\nexport { PASSKEY_ERROR_CODES, getPasskeyActions, passkeyClient };\n","import { defineErrorCodes } from \"@better-auth/core/utils/error-codes\";\n//#region src/plugins/email-otp/error-codes.ts\nconst EMAIL_OTP_ERROR_CODES = defineErrorCodes({\n\tOTP_EXPIRED: \"OTP expired\",\n\tINVALID_OTP: \"Invalid OTP\",\n\tTOO_MANY_ATTEMPTS: \"Too many attempts\"\n});\n//#endregion\nexport { EMAIL_OTP_ERROR_CODES };\n","import { PACKAGE_VERSION } from \"../../version.mjs\";\nimport { EMAIL_OTP_ERROR_CODES } from \"./error-codes.mjs\";\n//#region src/plugins/email-otp/client.ts\nconst emailOTPClient = () => {\n\treturn {\n\t\tid: \"email-otp\",\n\t\tversion: PACKAGE_VERSION,\n\t\t$InferServerPlugin: {},\n\t\tatomListeners: [{\n\t\t\tmatcher: (path) => path === \"/email-otp/verify-email\" || path === \"/sign-in/email-otp\" || path === \"/email-otp/request-email-change\",\n\t\t\tsignal: \"$sessionSignal\"\n\t\t}],\n\t\t$ERROR_CODES: EMAIL_OTP_ERROR_CODES\n\t};\n};\n//#endregion\nexport { emailOTPClient };\n","import { PACKAGE_VERSION } from \"../../version.mjs\";\n//#region src/plugins/jwt/client.ts\nconst jwtClient = (options) => {\n\tconst jwksPath = options?.jwks?.jwksPath ?? \"/jwks\";\n\treturn {\n\t\tid: \"better-auth-client\",\n\t\tversion: PACKAGE_VERSION,\n\t\t$InferServerPlugin: {},\n\t\tpathMethods: { [jwksPath]: \"GET\" },\n\t\tgetActions: ($fetch, _$store, _options) => ({ jwks: async (fetchOptions) => {\n\t\t\treturn await $fetch(jwksPath, {\n\t\t\t\tmethod: \"GET\",\n\t\t\t\t...fetchOptions\n\t\t\t});\n\t\t} })\n\t};\n};\n//#endregion\nexport { jwtClient };\n","import { defineErrorCodes } from \"@better-auth/core/utils/error-codes\";\n//#region src/plugins/two-factor/error-code.ts\nconst TWO_FACTOR_ERROR_CODES = defineErrorCodes({\n\tOTP_NOT_ENABLED: \"OTP not enabled\",\n\tOTP_NOT_CONFIGURED: \"OTP is not available\",\n\tOTP_HAS_EXPIRED: \"OTP has expired\",\n\tTOTP_NOT_ENABLED: \"TOTP not enabled\",\n\tTOTP_ALREADY_ENABLED: \"TOTP is already enabled\",\n\tTOTP_NOT_CONFIGURED: \"TOTP is not available\",\n\tTWO_FACTOR_NOT_ENABLED: \"Two factor isn't enabled\",\n\tBACKUP_CODES_NOT_ENABLED: \"Backup codes aren't enabled\",\n\tINVALID_BACKUP_CODE: \"Invalid backup code\",\n\tINVALID_CODE: \"Invalid code\",\n\tTOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: \"Too many attempts. Please request a new code.\",\n\tACCOUNT_TEMPORARILY_LOCKED: \"Too many failed verification attempts. Your account is temporarily locked. Please try again later.\",\n\tINVALID_TWO_FACTOR_COOKIE: \"Invalid two factor cookie\"\n});\n//#endregion\nexport { TWO_FACTOR_ERROR_CODES };\n","import { PACKAGE_VERSION } from \"../../version.mjs\";\nimport { TWO_FACTOR_ERROR_CODES } from \"./error-code.mjs\";\nimport { isSafeUrlScheme } from \"@better-auth/core/utils/url\";\n//#region src/plugins/two-factor/client.ts\nconst twoFactorClient = (options) => {\n\treturn {\n\t\tid: \"two-factor\",\n\t\tversion: PACKAGE_VERSION,\n\t\t$InferServerPlugin: {},\n\t\tatomListeners: [{\n\t\t\tmatcher: (path) => path.startsWith(\"/two-factor/\"),\n\t\t\tsignal: \"$sessionSignal\"\n\t\t}],\n\t\tpathMethods: {\n\t\t\t\"/two-factor/disable\": \"POST\",\n\t\t\t\"/two-factor/enable\": \"POST\",\n\t\t\t\"/two-factor/send-otp\": \"POST\",\n\t\t\t\"/two-factor/generate-backup-codes\": \"POST\",\n\t\t\t\"/two-factor/get-totp-uri\": \"POST\",\n\t\t\t\"/two-factor/verify-totp\": \"POST\",\n\t\t\t\"/two-factor/verify-otp\": \"POST\",\n\t\t\t\"/two-factor/verify-backup-code\": \"POST\"\n\t\t},\n\t\tfetchPlugins: [{\n\t\t\tid: \"two-factor\",\n\t\t\tname: \"two-factor\",\n\t\t\thooks: { async onSuccess(context) {\n\t\t\t\tif (context.data?.twoFactorRedirect) {\n\t\t\t\t\tif (options?.onTwoFactorRedirect) {\n\t\t\t\t\t\tawait options.onTwoFactorRedirect({ twoFactorMethods: context.data.twoFactorMethods });\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (options?.twoFactorPage && typeof window !== \"undefined\" && isSafeUrlScheme(options.twoFactorPage)) window.location.href = options.twoFactorPage;\n\t\t\t\t}\n\t\t\t} }\n\t\t}],\n\t\t$ERROR_CODES: TWO_FACTOR_ERROR_CODES\n\t};\n};\n//#endregion\nexport { twoFactorClient };\n","\"use client\";\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\n//#region src/QueryClientProvider.tsx\n/**\n* The context that `useQueryClient` reads from. `QueryClientProvider` is the normal way to set it.\n*/\nconst QueryClientContext = React.createContext(void 0);\n/**\n* The `useQueryClient` hook returns the current `QueryClient` instance.\n*\n* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n* be used.\n* @returns The current `QueryClient` instance.\n* @throws If no `queryClient` argument is passed and no `QueryClientProvider` is found in the component tree.\n*/\nconst useQueryClient = (queryClient) => {\n\tconst client = React.useContext(QueryClientContext);\n\tif (queryClient) return queryClient;\n\tif (!client) throw new Error(\"No QueryClient set, use QueryClientProvider to set one\");\n\treturn client;\n};\n/**\n* Use the `QueryClientProvider` component to connect and provide a `QueryClient` to your application. Also\n* calls `client.mount()`/`client.unmount()` as this component mounts/unmounts, which subscribes the client to\n* focus/online events (resuming any paused mutations and refetching as needed when the app regains focus or\n* comes back online).\n*\n* @returns The provided `children`, wrapped so they can read the `QueryClient` via `useQueryClient`.\n*\n* @example\n* ```tsx\n* import { QueryClient, QueryClientProvider } from '@tanstack/react-query'\n*\n* const queryClient = new QueryClient()\n*\n* function App() {\n* return <QueryClientProvider client={queryClient}>...</QueryClientProvider>\n* }\n* ```\n*/\nconst QueryClientProvider = ({ client, children }) => {\n\tReact.useEffect(() => {\n\t\tclient.mount();\n\t\treturn () => {\n\t\t\tclient.unmount();\n\t\t};\n\t}, [client]);\n\treturn /* @__PURE__ */ jsx(QueryClientContext.Provider, {\n\t\tvalue: client,\n\t\tchildren\n\t});\n};\n//#endregion\nexport { QueryClientContext, QueryClientProvider, useQueryClient };\n\n//# sourceMappingURL=QueryClientProvider.js.map","//#region src/timeoutManager.ts\nconst defaultTimeoutProvider = {\n\tsetTimeout: (callback, delay) => setTimeout(callback, delay),\n\tclearTimeout: (timeoutId) => clearTimeout(timeoutId),\n\tsetInterval: (callback, delay) => setInterval(callback, delay),\n\tclearInterval: (intervalId) => clearInterval(intervalId)\n};\n/**\n* Allows customization of how timeouts are created.\n*\n* @tanstack/query-core makes liberal use of timeouts to implement `staleTime`\n* and `gcTime`. The default TimeoutManager provider uses the platform's global\n* `setTimeout` implementation, which is known to have scalability issues with\n* thousands of timeouts on the event loop.\n*\n* If you hit this limitation, consider providing a custom TimeoutProvider that\n* coalesces timeouts.\n*/\nvar TimeoutManager = class {\n\t#provider = defaultTimeoutProvider;\n\t#providerCalled = false;\n\t/**\n\t* `setTimeoutProvider` can be used to set a custom implementation of the\n\t* `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval` functions,\n\t* called a `TimeoutProvider`.\n\t*\n\t* This may be useful if you notice event loop performance issues with\n\t* thousands of queries. A custom TimeoutProvider could also support timer\n\t* delays longer than the global `setTimeout` maximum delay value of about\n\t* 24 days.\n\t*\n\t* It is important to call `setTimeoutProvider` before creating a\n\t* QueryClient or queries, so that the same provider is used consistently\n\t* for all timers in the application, since different TimeoutProviders\n\t* cannot cancel each others' timers.\n\t*\n\t* @example\n\t* ```ts\n\t* import { timeoutManager, QueryClient } from '@tanstack/query-core'\n\t* import { CustomTimeoutProvider } from './CustomTimeoutProvider'\n\t*\n\t* timeoutManager.setTimeoutProvider(new CustomTimeoutProvider())\n\t*\n\t* export const queryClient = new QueryClient()\n\t* ```\n\t*/\n\tsetTimeoutProvider(provider) {\n\t\tif (process.env.NODE_ENV !== \"production\") {\n\t\t\tif (this.#providerCalled && provider !== this.#provider) console.error(`[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`, {\n\t\t\t\tprevious: this.#provider,\n\t\t\t\tprovider\n\t\t\t});\n\t\t}\n\t\tthis.#provider = provider;\n\t\tif (process.env.NODE_ENV !== \"production\") this.#providerCalled = false;\n\t}\n\t/**\n\t* `setTimeout` schedules a callback to run after approximately `delay`\n\t* milliseconds, like the global `setTimeout` function. The callback can be\n\t* canceled with `clearTimeout`.\n\t*\n\t* It returns a timer ID, which may be a number or an object that can be\n\t* coerced to a number via `Symbol.toPrimitive`.\n\t*\n\t* @example\n\t* ```ts\n\t* import { timeoutManager } from '@tanstack/query-core'\n\t*\n\t* const timeoutId = timeoutManager.setTimeout(\n\t* () => console.log('ran at:', new Date()),\n\t* 1000,\n\t* )\n\t*\n\t* const timeoutIdNumber: number = Number(timeoutId)\n\t* ```\n\t*/\n\tsetTimeout(callback, delay) {\n\t\tif (process.env.NODE_ENV !== \"production\") this.#providerCalled = true;\n\t\treturn this.#provider.setTimeout(callback, delay);\n\t}\n\t/**\n\t* `clearTimeout` cancels a timeout callback scheduled with `setTimeout`,\n\t* like the global `clearTimeout` function. It should be called with a\n\t* timer ID returned by `setTimeout`.\n\t*\n\t* @example\n\t* ```ts\n\t* import { timeoutManager } from '@tanstack/query-core'\n\t*\n\t* const timeoutId = timeoutManager.setTimeout(\n\t* () => console.log('ran at:', new Date()),\n\t* 1000,\n\t* )\n\t*\n\t* timeoutManager.clearTimeout(timeoutId)\n\t* ```\n\t*/\n\tclearTimeout(timeoutId) {\n\t\tthis.#provider.clearTimeout(timeoutId);\n\t}\n\t/**\n\t* `setInterval` schedules a callback to be called approximately every\n\t* `delay` milliseconds, like the global `setInterval` function.\n\t*\n\t* Like `setTimeout`, it returns a timer ID, which may be a number or an\n\t* object that can be coerced to a number via `Symbol.toPrimitive`.\n\t*\n\t* @example\n\t* ```ts\n\t* import { timeoutManager } from '@tanstack/query-core'\n\t*\n\t* const intervalId = timeoutManager.setInterval(\n\t* () => console.log('ran at:', new Date()),\n\t* 1000,\n\t* )\n\t* ```\n\t*/\n\tsetInterval(callback, delay) {\n\t\tif (process.env.NODE_ENV !== \"production\") this.#providerCalled = true;\n\t\treturn this.#provider.setInterval(callback, delay);\n\t}\n\t/**\n\t* `clearInterval` can be used to cancel an interval, like the global\n\t* `clearInterval` function. It should be called with an interval ID\n\t* returned by `setInterval`.\n\t*\n\t* @example\n\t* ```ts\n\t* import { timeoutManager } from '@tanstack/query-core'\n\t*\n\t* const intervalId = timeoutManager.setInterval(\n\t* () => console.log('ran at:', new Date()),\n\t* 1000,\n\t* )\n\t*\n\t* timeoutManager.clearInterval(intervalId)\n\t* ```\n\t*/\n\tclearInterval(intervalId) {\n\t\tthis.#provider.clearInterval(intervalId);\n\t}\n};\n/**\n* Singleton instance of {@link TimeoutManager}, used throughout TanStack Query to schedule and cancel timers.\n*/\nconst timeoutManager = new TimeoutManager();\n/**\n* In many cases code wants to delay to the next event loop tick; this is not\n* mediated by {@link timeoutManager}.\n*\n* This function is provided to make auditing the `tanstack/query-core` for\n* incorrect use of system `setTimeout` easier.\n*/\nfunction systemSetTimeoutZero(callback) {\n\tsetTimeout(callback, 0);\n}\n//#endregion\nexport { TimeoutManager, defaultTimeoutProvider, systemSetTimeoutZero, timeoutManager };\n\n//# sourceMappingURL=timeoutManager.js.map","import { timeoutManager } from \"./timeoutManager.js\";\n//#region src/utils.ts\n/** @deprecated\n* use `environmentManager.isServer()` instead.\n*/\nconst isServer = typeof window === \"undefined\" || \"Deno\" in globalThis;\nfunction noop() {}\nfunction functionalUpdate(updater, input) {\n\treturn typeof updater === \"function\" ? updater(input) : updater;\n}\nfunction isValidTimeout(value) {\n\treturn typeof value === \"number\" && value >= 0 && value !== Infinity;\n}\nfunction timeUntilStale(updatedAt, staleTime) {\n\treturn Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);\n}\nfunction resolveQueryValue(value, query) {\n\treturn typeof value === \"function\" ? value(query) : value;\n}\n/**\n* Checks whether a query matches the given {@link QueryFilters}.\n* Every filter that is specified must match; filters that are left unspecified are ignored.\n*\n* @example\n* ```ts\n* const queryCache = queryClient.getQueryCache()\n*\n* const matchingQueries = queryCache\n* .getAll()\n* .filter((query) => matchQuery({ queryKey: ['posts'] }, query))\n* ```\n*/\nfunction matchQuery(filters, query) {\n\tconst { type = \"all\", exact, fetchStatus, predicate, queryKey, stale } = filters;\n\tif (queryKey) {\n\t\tif (exact) {\n\t\t\tif (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) return false;\n\t\t} else if (!partialMatchKey(query.queryKey, queryKey)) return false;\n\t}\n\tif (type !== \"all\") {\n\t\tconst isActive = query.isActive();\n\t\tif (type === \"active\" && !isActive) return false;\n\t\tif (type === \"inactive\" && isActive) return false;\n\t}\n\tif (typeof stale === \"boolean\" && query.isStale() !== stale) return false;\n\tif (fetchStatus && fetchStatus !== query.state.fetchStatus) return false;\n\tif (predicate && !predicate(query)) return false;\n\treturn true;\n}\n/**\n* Checks whether a mutation matches the given {@link MutationFilters}.\n* Every filter that is specified must match; filters that are left unspecified are ignored.\n* If a `mutationKey` filter is provided but the mutation has no `mutationKey` of its own, it does not match.\n*\n* @example\n* ```ts\n* const mutationCache = queryClient.getMutationCache()\n*\n* const matchingMutations = mutationCache\n* .getAll()\n* .filter((mutation) => matchMutation({ mutationKey: ['addPost'] }, mutation))\n* ```\n*/\nfunction matchMutation(filters, mutation) {\n\tconst { exact, status, predicate, mutationKey } = filters;\n\tif (mutationKey) {\n\t\tif (!mutation.options.mutationKey) return false;\n\t\tif (exact) {\n\t\t\tif (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) return false;\n\t\t} else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) return false;\n\t}\n\tif (status && mutation.state.status !== status) return false;\n\tif (predicate && !predicate(mutation)) return false;\n\treturn true;\n}\nfunction hashQueryKeyByOptions(queryKey, options) {\n\treturn (options?.queryKeyHashFn || hashKey)(queryKey);\n}\n/**\n* Default query & mutation keys hash function.\n* Hashes the value into a stable hash.\n*\n* @example\n* ```ts\n* // Object keys are sorted, so key order doesn't affect the hash:\n* hashKey(['todos', { page: 1, filter: 'done' }]) // === '[\"todos\",{\"filter\":\"done\",\"page\":1}]'\n* ```\n*/\nfunction hashKey(queryKey) {\n\treturn JSON.stringify(queryKey, (_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {\n\t\tresult[key] = val[key];\n\t\treturn result;\n\t}, {}) : val);\n}\nfunction partialMatchKey(a, b) {\n\tif (a === b) return true;\n\tif (typeof a !== typeof b) return false;\n\tif (a && b && typeof a === \"object\" && typeof b === \"object\") {\n\t\tif (Array.isArray(a) && Array.isArray(b)) {\n\t\t\tif (b.length > a.length) return false;\n\t\t\tfor (let i = 0; i < b.length; i++) if (!partialMatchKey(a[i], b[i])) return false;\n\t\t\treturn true;\n\t\t}\n\t\tconst bKeys = Object.keys(b);\n\t\tfor (const key of bKeys) if (!partialMatchKey(a[key], b[key])) return false;\n\t\treturn true;\n\t}\n\treturn false;\n}\nconst hasOwn = Object.prototype.hasOwnProperty;\nfunction replaceEqualDeep(a, b, depth = 0) {\n\tif (a === b) return a;\n\tif (depth > 500) return b;\n\tconst array = isPlainArray(a) && isPlainArray(b);\n\tif (!array && !(isPlainObject(a) && isPlainObject(b))) return b;\n\tconst aSize = (array ? a : Object.keys(a)).length;\n\tconst bItems = array ? b : Object.keys(b);\n\tconst bSize = bItems.length;\n\tconst copy = array ? new Array(bSize) : {};\n\tlet equalItems = 0;\n\tfor (let i = 0; i < bSize; i++) {\n\t\tconst key = array ? i : bItems[i];\n\t\tconst aItem = a[key];\n\t\tconst bItem = b[key];\n\t\tif (aItem === bItem) {\n\t\t\tcopy[key] = aItem;\n\t\t\tif (array ? i < aSize : hasOwn.call(a, key)) equalItems++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (aItem === null || bItem === null || typeof aItem !== \"object\" || typeof bItem !== \"object\") {\n\t\t\tcopy[key] = bItem;\n\t\t\tcontinue;\n\t\t}\n\t\tconst v = replaceEqualDeep(aItem, bItem, depth + 1);\n\t\tcopy[key] = v;\n\t\tif (v === aItem) equalItems++;\n\t}\n\treturn aSize === bSize && equalItems === aSize ? a : copy;\n}\n/**\n* Shallow compare objects.\n*/\nfunction shallowEqualObjects(a, b) {\n\tif (!b || Object.keys(a).length !== Object.keys(b).length) return false;\n\tfor (const key in a) if (a[key] !== b[key]) return false;\n\treturn true;\n}\nfunction isPlainArray(value) {\n\treturn Array.isArray(value) && value.length === Object.keys(value).length;\n}\nfunction isPlainObject(o) {\n\tif (!hasObjectPrototype(o)) return false;\n\tconst objectPrototype = Object.getPrototypeOf(o);\n\tconst ctor = objectPrototype?.constructor;\n\tif (ctor === void 0) return true;\n\tif (typeof ctor !== \"function\") return false;\n\tconst prot = ctor.prototype;\n\tif (!hasObjectPrototype(prot)) return false;\n\tif (!prot.hasOwnProperty(\"isPrototypeOf\")) return false;\n\tif (objectPrototype !== Object.prototype) return false;\n\treturn true;\n}\nfunction hasObjectPrototype(o) {\n\treturn Object.prototype.toString.call(o) === \"[object Object]\";\n}\nfunction sleep(timeout) {\n\treturn new Promise((resolve) => {\n\t\ttimeoutManager.setTimeout(resolve, timeout);\n\t});\n}\nfunction replaceData(prevData, data, options) {\n\tif (typeof options.structuralSharing === \"function\") return options.structuralSharing(prevData, data);\n\telse if (options.structuralSharing !== false) {\n\t\tif (process.env.NODE_ENV !== \"production\") try {\n\t\t\treturn replaceEqualDeep(prevData, data);\n\t\t} catch (error) {\n\t\t\tconsole.error(`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}`);\n\t\t\tthrow error;\n\t\t}\n\t\treturn replaceEqualDeep(prevData, data);\n\t}\n\treturn data;\n}\n/**\n* Intended to be passed as a query's `placeholderData` option, for example\n* `placeholderData: keepPreviousData`. Instead of resetting the query's data to `undefined` while a new\n* query key is fetching, it keeps displaying the previously fetched data until the new data arrives.\n*\n* @example\n* ```ts\n* new QueryObserver(queryClient, {\n* queryKey: ['posts', page],\n* queryFn: () => fetchPosts(page),\n* placeholderData: keepPreviousData,\n* })\n* ```\n*/\nfunction keepPreviousData(previousData) {\n\treturn previousData;\n}\nfunction addToEnd(items, item, max = 0) {\n\tconst newItems = [...items, item];\n\treturn max && newItems.length > max ? newItems.slice(1) : newItems;\n}\nfunction addToStart(items, item, max = 0) {\n\tconst newItems = [item, ...items];\n\treturn max && newItems.length > max ? newItems.slice(0, -1) : newItems;\n}\n/**\n* Sentinel value that can be passed as a query's `queryFn` to conditionally disable the query (equivalent\n* to `enabled: false`) while preserving full type inference for the query's data. Unlike `enabled: false`,\n* a query disabled via `skipToken` cannot be triggered with `refetch`.\n*\n* @example\n* ```ts\n* new QueryObserver(queryClient, {\n* queryKey: ['post', postId],\n* queryFn: postId != null ? () => fetchPost(postId) : skipToken,\n* })\n* ```\n*/\nconst skipToken = Symbol();\nfunction ensureQueryFn(options, fetchOptions) {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tif (options.queryFn === skipToken) console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`);\n\t}\n\tif (!options.queryFn && fetchOptions?.initialPromise) return () => fetchOptions.initialPromise;\n\tif (!options.queryFn || options.queryFn === skipToken) return () => Promise.reject(/* @__PURE__ */ new Error(`Missing queryFn: '${options.queryHash}'`));\n\treturn options.queryFn;\n}\n/**\n* Resolves a `throwOnError` option to a boolean.\n* If `throwOnError` is a function, it is called with `params` (e.g. the error and, depending on the caller,\n* additional context such as the query or mutation) and its result is returned, allowing the throwing\n* behavior to be decided per error. Otherwise, `throwOnError` itself is coerced to a boolean (`undefined`\n* resolves to `false`).\n*\n* @example\n* ```ts\n* const throwOnError =\n* query.state.error && typeof options.throwOnError === 'function'\n* ? shouldThrowError(options.throwOnError, [query.state.error, query])\n* : options.throwOnError\n* ```\n*/\nfunction shouldThrowError(throwOnError, params) {\n\tif (typeof throwOnError === \"function\") return throwOnError(...params);\n\treturn !!throwOnError;\n}\nfunction addConsumeAwareSignal(object, getSignal, onCancelled) {\n\tlet consumed = false;\n\tlet signal;\n\tObject.defineProperty(object, \"signal\", {\n\t\tenumerable: true,\n\t\tget: () => {\n\t\t\tsignal ??= getSignal();\n\t\t\tif (consumed) return signal;\n\t\t\tconsumed = true;\n\t\t\tif (signal.aborted) onCancelled();\n\t\t\telse signal.addEventListener(\"abort\", onCancelled, { once: true });\n\t\t\treturn signal;\n\t\t}\n\t});\n\treturn object;\n}\n//#endregion\nexport { addConsumeAwareSignal, addToEnd, addToStart, ensureQueryFn, functionalUpdate, hashKey, hashQueryKeyByOptions, isPlainArray, isPlainObject, isServer, isValidTimeout, keepPreviousData, matchMutation, matchQuery, noop, partialMatchKey, replaceData, replaceEqualDeep, resolveQueryValue, shallowEqualObjects, shouldThrowError, skipToken, sleep, timeUntilStale };\n\n//# sourceMappingURL=utils.js.map","import { isServer as isServer$1 } from \"./utils.js\";\n//#region src/environmentManager.ts\nlet isServerFn = () => isServer$1;\n/**\n* Returns whether the current runtime should be treated as a server environment.\n*/\nconst isServer = () => isServerFn();\n/**\n* Manages how TanStack Query detects whether the current runtime should be treated as\n* server-side, which disables scheduling refetch timers and changes the default `retry` count\n* and `gcTime`. By default, the detection treats a missing `window` (or the presence of a\n* `Deno` global) as server.\n*\n* Override this for runtimes where that default detection would give the wrong answer — for\n* example, a Service Worker, where `window` is undefined even though the environment should\n* behave like a client.\n*\n* @example\n* ```ts\n* import { environmentManager } from '@tanstack/query-core'\n*\n* environmentManager.setIsServer(() => false)\n* ```\n*/\nconst environmentManager = {\n\tisServer,\n\t/**\n\t* Overrides the server check globally.\n\t*/\n\tsetIsServer(isServerValue) {\n\t\tisServerFn = isServerValue;\n\t}\n};\n//#endregion\nexport { environmentManager, isServer };\n\n//# sourceMappingURL=environmentManager.js.map","//#region src/subscribable.ts\n/**\n* The base class behind everything in Query that you can subscribe to: `QueryCache`, `MutationCache`,\n* the observers, and the `FocusManager`/`OnlineManager` behind `focusManager` and `onlineManager`.\n* Subclasses decide what a listener receives and when it is called.\n*/\nvar Subscribable = class {\n\tconstructor() {\n\t\tthis.listeners = /* @__PURE__ */ new Set();\n\t\tthis.subscribe = this.subscribe.bind(this);\n\t}\n\t/**\n\t* Registers a listener to be called on every update this object notifies about. Returns a function\n\t* that removes the listener again — call it to stop listening. The base class never drops a listener\n\t* on its own, though some subclasses clear all of theirs in `destroy()`.\n\t* @param listener - Called on each update, with whatever the subclass passes to its subscribers.\n\t* @example\n\t* ```ts\n\t* const unsubscribe = subscribable.subscribe(() => {\n\t* // react to the update\n\t* })\n\t*\n\t* unsubscribe()\n\t* ```\n\t*/\n\tsubscribe(listener) {\n\t\tthis.listeners.add(listener);\n\t\tthis.onSubscribe();\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t\tthis.onUnsubscribe();\n\t\t};\n\t}\n\t/**\n\t* Returns `true` while at least one listener is registered, `false` once they have all unsubscribed.\n\t*/\n\thasListeners() {\n\t\treturn this.listeners.size > 0;\n\t}\n\tonSubscribe() {}\n\tonUnsubscribe() {}\n};\n//#endregion\nexport { Subscribable };\n\n//# sourceMappingURL=subscribable.js.map","import { Subscribable } from \"./subscribable.js\";\n//#region src/focusManager.ts\n/**\n* The `FocusManager` manages the focus state within TanStack Query.\n*\n* It can be used to change the default event listeners or to manually change the focus state.\n*/\nvar FocusManager = class extends Subscribable {\n\t#focused;\n\t#cleanup;\n\t#setup;\n\tconstructor() {\n\t\tsuper();\n\t\tthis.#setup = (onFocus) => {\n\t\t\tif (typeof window !== \"undefined\" && window.addEventListener) {\n\t\t\t\tconst listener = () => onFocus();\n\t\t\t\twindow.addEventListener(\"visibilitychange\", listener, false);\n\t\t\t\treturn () => {\n\t\t\t\t\twindow.removeEventListener(\"visibilitychange\", listener);\n\t\t\t\t};\n\t\t\t}\n\t\t};\n\t}\n\tonSubscribe() {\n\t\tif (!this.#cleanup) this.setEventListener(this.#setup);\n\t}\n\tonUnsubscribe() {\n\t\tif (!this.hasListeners()) {\n\t\t\tthis.#cleanup?.();\n\t\t\tthis.#cleanup = void 0;\n\t\t}\n\t}\n\t/**\n\t* `setEventListener` can be used to set a custom event listener that will\n\t* be used to determine the focus state. The provided `setup` function\n\t* receives a `setFocused` callback: call it with a `boolean` to manually\n\t* set the focus state, or with no arguments to re-evaluate the current\n\t* focus state and notify subscribers.\n\t*\n\t* @example\n\t* ```ts\n\t* import { focusManager } from '@tanstack/query-core'\n\t*\n\t* focusManager.setEventListener((handleFocus) => {\n\t* const listener = () => handleFocus()\n\t* // Listen to visibilitychange\n\t* if (typeof window !== 'undefined' && window.addEventListener) {\n\t* window.addEventListener('visibilitychange', listener, false)\n\t* }\n\t*\n\t* return () => {\n\t* // Be sure to unsubscribe if a new handler is set\n\t* window.removeEventListener('visibilitychange', listener)\n\t* }\n\t* })\n\t* ```\n\t*/\n\tsetEventListener(setup) {\n\t\tthis.#setup = setup;\n\t\tthis.#cleanup?.();\n\t\tthis.#cleanup = setup((focused) => {\n\t\t\tif (typeof focused === \"boolean\") this.setFocused(focused);\n\t\t\telse this.onFocus();\n\t\t});\n\t}\n\t/**\n\t* `setFocused` can be used to manually set the focus state. Set `undefined`\n\t* to fall back to the default focus check.\n\t*\n\t* @example\n\t* ```ts\n\t* import { focusManager } from '@tanstack/query-core'\n\t*\n\t* // Set focused\n\t* focusManager.setFocused(true)\n\t*\n\t* // Set unfocused\n\t* focusManager.setFocused(false)\n\t*\n\t* // Fallback to the default focus check\n\t* focusManager.setFocused(undefined)\n\t* ```\n\t*/\n\tsetFocused(focused) {\n\t\tif (this.#focused !== focused) {\n\t\t\tthis.#focused = focused;\n\t\t\tthis.onFocus();\n\t\t}\n\t}\n\t/**\n\t* `onFocus` notifies all subscribed listeners with the current focus state.\n\t*/\n\tonFocus() {\n\t\tconst isFocused = this.isFocused();\n\t\tthis.listeners.forEach((listener) => {\n\t\t\tlistener(isFocused);\n\t\t});\n\t}\n\t/**\n\t* `isFocused` can be used to get the current focus state.\n\t*/\n\tisFocused() {\n\t\tif (typeof this.#focused === \"boolean\") return this.#focused;\n\t\treturn globalThis.document?.visibilityState !== \"hidden\";\n\t}\n};\n/**\n* Singleton instance of {@link FocusManager}, used to manage and observe the focus state within TanStack Query.\n*/\nconst focusManager = new FocusManager();\n//#endregion\nexport { FocusManager, focusManager };\n\n//# sourceMappingURL=focusManager.js.map","import { noop } from \"./utils.js\";\n//#region src/hydration.ts\nfunction tryResolveSync(promise) {\n\tlet data;\n\tpromise.then((result) => {\n\t\tdata = result;\n\t\treturn result;\n\t}, noop)?.catch?.(noop);\n\tif (data !== void 0) return { data };\n}\nfunction dehydrateMutation(mutation) {\n\treturn {\n\t\tmutationKey: mutation.options.mutationKey,\n\t\tstate: mutation.state,\n\t\t...mutation.options.scope && { scope: mutation.options.scope },\n\t\t...mutation.meta && { meta: mutation.meta }\n\t};\n}\nfunction dehydratePromise(query, serializeData, shouldRedactErrors) {\n\tconst promise = query.promise?.then(serializeData).catch((error) => {\n\t\tif (shouldRedactErrors?.(error) === false) return Promise.reject(error);\n\t\tif (process.env.NODE_ENV !== \"production\") console.error(`A query that was dehydrated as pending ended up rejecting. [${query.queryHash}]: ${error}; The error will be redacted in production builds`);\n\t\treturn Promise.reject(/* @__PURE__ */ new Error(\"redacted\"));\n\t});\n\tpromise?.catch(noop);\n\treturn promise;\n}\n/**\n* Dehydrates a single `Query` into a serializable `DehydratedQuery` snapshot. Note that most query config (e.g.\n* `queryFn`, `staleTime`) is not dehydrated but instead meant to be configured again when consuming the\n* de/rehydrated data, typically with `useQuery` on the client. If the query is still `pending`, its in-flight\n* promise is dehydrated too so it can be resumed on the other side instead of re-fetched.\n* @param query - The query to dehydrate.\n* @param serializeData - Optional transform applied to `query.state.data` before it is included in the snapshot.\n* @param shouldRedactErrors - Optional predicate; if it returns `false` for the promise's rejection error, that\n* error is kept as-is instead of being redacted.\n*/\nfunction dehydrateQuery(query, serializeData, shouldRedactErrors) {\n\treturn {\n\t\tdehydratedAt: Date.now(),\n\t\tstate: {\n\t\t\t...query.state,\n\t\t\t...query.state.data !== void 0 && { data: serializeData ? serializeData(query.state.data) : query.state.data }\n\t\t},\n\t\tqueryKey: query.queryKey,\n\t\tqueryHash: query.queryHash,\n\t\t...query.state.status === \"pending\" && { promise: dehydratePromise(query, serializeData, shouldRedactErrors) },\n\t\t...query.meta && { meta: query.meta },\n\t\t...query.queryType && { queryType: query.queryType }\n\t};\n}\n/**\n* The default `shouldDehydrateMutation` predicate used by `dehydrate`. Only dehydrates mutations that are\n* currently paused (e.g. paused by `networkMode` while offline).\n*/\nfunction defaultShouldDehydrateMutation(mutation) {\n\treturn mutation.state.isPaused;\n}\n/**\n* The default `shouldDehydrateQuery` predicate used by `dehydrate`. Only dehydrates queries whose status is\n* `'success'`.\n*/\nfunction defaultShouldDehydrateQuery(query) {\n\treturn query.state.status === \"success\";\n}\n/**\n* Dehydrates a `QueryClient`'s cache (queries and mutations) into a plain, serializable `DehydratedState`,\n* typically to embed in server-rendered markup and later restore into a client-side `QueryClient` via `hydrate`.\n* Which queries/mutations are included, and how their data/errors are transformed, is controlled by `options`,\n* falling back to the client's `dehydrate` default options, and finally to `defaultShouldDehydrateQuery` /\n* `defaultShouldDehydrateMutation`.\n* @example\n* ```ts\n* const queryClient = new QueryClient()\n*\n* await queryClient.prefetchQuery({\n* queryKey: ['posts'],\n* queryFn: getPosts,\n* })\n*\n* const dehydratedState = dehydrate(queryClient)\n* ```\n*/\nfunction dehydrate(client, options = {}) {\n\tconst filterMutation = options.shouldDehydrateMutation ?? client.getDefaultOptions().dehydrate?.shouldDehydrateMutation ?? defaultShouldDehydrateMutation;\n\tconst mutations = client.getMutationCache().getAll().flatMap((mutation) => filterMutation(mutation) ? [dehydrateMutation(mutation)] : []);\n\tconst filterQuery = options.shouldDehydrateQuery ?? client.getDefaultOptions().dehydrate?.shouldDehydrateQuery ?? defaultShouldDehydrateQuery;\n\tconst shouldRedactErrors = options.shouldRedactErrors ?? client.getDefaultOptions().dehydrate?.shouldRedactErrors;\n\tconst serializeData = options.serializeData ?? client.getDefaultOptions().dehydrate?.serializeData;\n\treturn {\n\t\tmutations,\n\t\tqueries: client.getQueryCache().getAll().flatMap((query) => filterQuery(query) ? [dehydrateQuery(query, serializeData, shouldRedactErrors)] : [])\n\t};\n}\n/**\n* Restores a `DehydratedState` (as produced by `dehydrate`) into a `QueryClient`'s cache, typically to seed the\n* client with data already fetched on the server. `mutations` and `queries` are each optional on `dehydratedState`.\n* Queries not yet in the cache are built from the dehydrated snapshot; queries that already exist are only updated\n* when the dehydrated data is newer than what's already cached. Newly built queries have their `fetchStatus` reset\n* to `'idle'` so they don't hydrate stuck in a fetching state. If a dehydrated query still had an in-flight\n* promise, it is resumed via `query.fetch()` (reusing that promise as `initialPromise`) rather than re-invoking\n* `queryFn`.\n* @example\n* ```ts\n* // dehydratedState was produced by `dehydrate` on the server\n* // and sent to the client, e.g. embedded in server-rendered markup.\n* const queryClient = new QueryClient()\n*\n* hydrate(queryClient, dehydratedState)\n* ```\n*/\nfunction hydrate(client, dehydratedState, options) {\n\tconst mutationCache = client.getMutationCache();\n\tconst queryCache = client.getQueryCache();\n\tconst deserializeData = options?.defaultOptions?.deserializeData ?? client.getDefaultOptions().hydrate?.deserializeData;\n\tdehydratedState.mutations?.forEach(({ state, ...mutationOptions }) => {\n\t\tmutationCache.build(client, {\n\t\t\t...client.getDefaultOptions().hydrate?.mutations,\n\t\t\t...options?.defaultOptions?.mutations,\n\t\t\t...mutationOptions\n\t\t}, state);\n\t});\n\tdehydratedState.queries?.forEach(({ queryKey, state, queryHash, meta, promise, dehydratedAt, queryType }) => {\n\t\tconst syncData = promise ? tryResolveSync(promise) : void 0;\n\t\tconst rawData = state.data === void 0 ? syncData?.data : state.data;\n\t\tconst data = rawData === void 0 ? rawData : deserializeData ? deserializeData(rawData) : rawData;\n\t\tlet query = queryCache.get(queryHash);\n\t\tconst existingQueryIsPending = query?.state.status === \"pending\";\n\t\tconst existingQueryIsFetching = query?.state.fetchStatus === \"fetching\";\n\t\tif (query) {\n\t\t\tconst hasNewerSyncData = syncData && dehydratedAt > query.state.dataUpdatedAt;\n\t\t\tif (state.dataUpdatedAt > query.state.dataUpdatedAt || hasNewerSyncData) {\n\t\t\t\tconst { fetchStatus: _ignored, ...serializedState } = state;\n\t\t\t\tquery.setState({\n\t\t\t\t\t...serializedState,\n\t\t\t\t\tdata,\n\t\t\t\t\t...state.status === \"pending\" && data !== void 0 && {\n\t\t\t\t\t\tstatus: \"success\",\n\t\t\t\t\t\tdataUpdatedAt: dehydratedAt,\n\t\t\t\t\t\t...!existingQueryIsFetching && { fetchStatus: \"idle\" }\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t} else query = queryCache.build(client, {\n\t\t\t...client.getDefaultOptions().hydrate?.queries,\n\t\t\t...options?.defaultOptions?.queries,\n\t\t\tqueryKey,\n\t\t\tqueryHash,\n\t\t\tmeta,\n\t\t\t_type: queryType\n\t\t}, {\n\t\t\t...state,\n\t\t\tdata,\n\t\t\tfetchStatus: \"idle\",\n\t\t\tstatus: state.status === \"pending\" && data !== void 0 ? \"success\" : state.status,\n\t\t\t...state.status === \"pending\" && data !== void 0 && { dataUpdatedAt: dehydratedAt }\n\t\t});\n\t\tif (promise && !syncData && !existingQueryIsPending && !existingQueryIsFetching && dehydratedAt > query.state.dataUpdatedAt) query.fetch(void 0, { initialPromise: Promise.resolve(promise).then(deserializeData) }).catch(noop);\n\t});\n}\n//#endregion\nexport { defaultShouldDehydrateMutation, defaultShouldDehydrateQuery, dehydrate, dehydrateQuery, hydrate };\n\n//# sourceMappingURL=hydration.js.map","import { systemSetTimeoutZero } from \"./timeoutManager.js\";\n//#region src/notifyManager.ts\n/**\n* Default scheduling function used by the notify manager.\n* Schedules the callback with the system's `setTimeout(callback, 0)`.\n*/\nconst defaultScheduler = systemSetTimeoutZero;\nfunction createNotifyManager() {\n\tlet queue = [];\n\tlet transactions = 0;\n\tlet notifyFn = (callback) => {\n\t\tcallback();\n\t};\n\tlet batchNotifyFn = (callback) => {\n\t\tcallback();\n\t};\n\tlet scheduleFn = defaultScheduler;\n\tconst schedule = (callback) => {\n\t\tif (transactions) queue.push(callback);\n\t\telse scheduleFn(() => {\n\t\t\tnotifyFn(callback);\n\t\t});\n\t};\n\tconst flush = () => {\n\t\tconst originalQueue = queue;\n\t\tqueue = [];\n\t\tif (originalQueue.length) scheduleFn(() => {\n\t\t\tbatchNotifyFn(() => {\n\t\t\t\toriginalQueue.forEach((callback) => {\n\t\t\t\t\tnotifyFn(callback);\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t};\n\treturn {\n\t\t/**\n\t\t* Batches all updates scheduled inside the passed callback.\n\t\t* This is mainly used internally to optimize query client updating.\n\t\t* Batches can be nested; the queue is only flushed once the outermost `batch` call finishes.\n\t\t* The return value of `callback` is passed through.\n\t\t*/\n\t\tbatch: (callback) => {\n\t\t\tlet result;\n\t\t\ttransactions++;\n\t\t\ttry {\n\t\t\t\tresult = callback();\n\t\t\t} finally {\n\t\t\t\ttransactions--;\n\t\t\t\tif (!transactions) flush();\n\t\t\t}\n\t\t\treturn result;\n\t\t},\n\t\t/**\n\t\t* All calls to the wrapped function will be batched.\n\t\t*/\n\t\tbatchCalls: (callback) => {\n\t\t\treturn (...args) => {\n\t\t\t\tschedule(() => {\n\t\t\t\t\tcallback(...args);\n\t\t\t\t});\n\t\t\t};\n\t\t},\n\t\t/**\n\t\t* Schedules a function to be run on the next batch.\n\t\t* By default, the batch is run with a `setTimeout`, but this can be configured via `setScheduler`.\n\t\t*/\n\t\tschedule,\n\t\t/**\n\t\t* Use this method to set a custom notify function.\n\t\t* This can be used to for example wrap notifications with `React.act` while running tests.\n\t\t*/\n\t\tsetNotifyFunction: (fn) => {\n\t\t\tnotifyFn = fn;\n\t\t},\n\t\t/**\n\t\t* Use this method to set a custom function to batch notifications together into a single tick.\n\t\t* Framework adapters use this to plug in their own batching primitive, so that a single query\n\t\t* update only triggers one re-render instead of one per subscriber.\n\t\t*\n\t\t* @example\n\t\t* ```ts\n\t\t* import { notifyManager } from '@tanstack/query-core'\n\t\t* import { batch } from 'solid-js'\n\t\t*\n\t\t* notifyManager.setBatchNotifyFunction(batch)\n\t\t* ```\n\t\t*/\n\t\tsetBatchNotifyFunction: (fn) => {\n\t\t\tbatchNotifyFn = fn;\n\t\t},\n\t\t/**\n\t\t* Configures a custom callback that schedules when the next batch runs.\n\t\t* The default behavior is `setTimeout(callback, 0)`.\n\t\t*\n\t\t* @example\n\t\t* ```ts\n\t\t* import { notifyManager } from '@tanstack/query-core'\n\t\t*\n\t\t* // Schedule batches in the next microtask\n\t\t* notifyManager.setScheduler(queueMicrotask)\n\t\t*\n\t\t* // Schedule batches before the next frame is rendered\n\t\t* notifyManager.setScheduler(requestAnimationFrame)\n\t\t*\n\t\t* // Schedule batches some time in the future\n\t\t* notifyManager.setScheduler((cb) => setTimeout(cb, 10))\n\t\t* ```\n\t\t*/\n\t\tsetScheduler: (fn) => {\n\t\t\tscheduleFn = fn;\n\t\t}\n\t};\n}\n/**\n* Handles scheduling and batching callbacks in TanStack Query.\n*/\nconst notifyManager = createNotifyManager();\n//#endregion\nexport { createNotifyManager, defaultScheduler, notifyManager };\n\n//# sourceMappingURL=notifyManager.js.map","import { Subscribable } from \"./subscribable.js\";\n//#region src/onlineManager.ts\n/**\n* The `OnlineManager` manages the online state within TanStack Query. It can\n* be used to change the default event listeners or to manually change the\n* online state.\n*\n* By default, the `onlineManager` assumes an active network connection, and\n* listens to the `online` and `offline` events on the `window` object to\n* detect changes.\n*/\nvar OnlineManager = class extends Subscribable {\n\t#online = true;\n\t#cleanup;\n\t#setup;\n\tconstructor() {\n\t\tsuper();\n\t\tthis.#setup = (onOnline) => {\n\t\t\tif (typeof window !== \"undefined\" && window.addEventListener) {\n\t\t\t\tconst onlineListener = () => onOnline(true);\n\t\t\t\tconst offlineListener = () => onOnline(false);\n\t\t\t\twindow.addEventListener(\"online\", onlineListener, false);\n\t\t\t\twindow.addEventListener(\"offline\", offlineListener, false);\n\t\t\t\treturn () => {\n\t\t\t\t\twindow.removeEventListener(\"online\", onlineListener);\n\t\t\t\t\twindow.removeEventListener(\"offline\", offlineListener);\n\t\t\t\t};\n\t\t\t}\n\t\t};\n\t}\n\tonSubscribe() {\n\t\tif (!this.#cleanup) this.setEventListener(this.#setup);\n\t}\n\tonUnsubscribe() {\n\t\tif (!this.hasListeners()) {\n\t\t\tthis.#cleanup?.();\n\t\t\tthis.#cleanup = void 0;\n\t\t}\n\t}\n\t/**\n\t* `setEventListener` can be used to set a custom event listener that will\n\t* be used to determine the online state. The provided `setup` function\n\t* receives a `setOnline` callback that should be called with a `boolean`\n\t* whenever the online state changes.\n\t*\n\t* @example\n\t* ```ts\n\t* import NetInfo from '@react-native-community/netinfo'\n\t* import { onlineManager } from '@tanstack/query-core'\n\t*\n\t* onlineManager.setEventListener((setOnline) => {\n\t* return NetInfo.addEventListener((state) => {\n\t* setOnline(!!state.isConnected)\n\t* })\n\t* })\n\t* ```\n\t*/\n\tsetEventListener(setup) {\n\t\tthis.#setup = setup;\n\t\tthis.#cleanup?.();\n\t\tthis.#cleanup = setup(this.setOnline.bind(this));\n\t}\n\t/**\n\t* `setOnline` can be used to manually set the online state.\n\t*\n\t* @example\n\t* ```ts\n\t* import { onlineManager } from '@tanstack/query-core'\n\t*\n\t* // Set to online\n\t* onlineManager.setOnline(true)\n\t*\n\t* // Set to offline\n\t* onlineManager.setOnline(false)\n\t* ```\n\t*/\n\tsetOnline(online) {\n\t\tif (this.#online !== online) {\n\t\t\tthis.#online = online;\n\t\t\tthis.listeners.forEach((listener) => {\n\t\t\t\tlistener(online);\n\t\t\t});\n\t\t}\n\t}\n\t/**\n\t* `isOnline` can be used to get the current online state.\n\t*/\n\tisOnline() {\n\t\treturn this.#online;\n\t}\n};\n/**\n* Singleton instance of {@link OnlineManager}, used to manage and observe the online state within TanStack Query.\n*/\nconst onlineManager = new OnlineManager();\n//#endregion\nexport { OnlineManager, onlineManager };\n\n//# sourceMappingURL=onlineManager.js.map","import { noop, sleep } from \"./utils.js\";\nimport { isServer } from \"./environmentManager.js\";\nimport { focusManager } from \"./focusManager.js\";\nimport { onlineManager } from \"./onlineManager.js\";\n//#region src/retryer.ts\nfunction defaultRetryDelay(failureCount) {\n\treturn Math.min(1e3 * 2 ** failureCount, 3e4);\n}\nfunction canFetch(networkMode) {\n\treturn (networkMode ?? \"online\") === \"online\" ? onlineManager.isOnline() : true;\n}\n/**\n* The error thrown by a `Retryer` (and surfaced to `query.promise`/`mutation`) when a fetch is cancelled, e.g. via\n* `query.cancel()`. `revert`, if `true`, tells the caller to restore the state the query was in before the fetch\n* started instead of surfacing the error. `silent`, if `true`, tells the caller to suppress this error and instead\n* resolve with the promise of the fetch that triggered the cancellation.\n* @example\n* ```ts\n* query.cancel()\n*\n* try {\n* await query.promise\n* } catch (error) {\n* if (error instanceof CancelledError) {\n* // the fetch was cancelled, e.g. via `query.cancel()`\n* }\n* }\n* ```\n*/\nvar CancelledError = class extends Error {\n\tconstructor(options) {\n\t\tsuper(\"CancelledError\");\n\t\tthis.revert = options?.revert;\n\t\tthis.silent = options?.silent;\n\t}\n};\n/**\n* @deprecated Use instanceof `CancelledError` instead.\n*/\nfunction isCancelledError(value) {\n\treturn value instanceof CancelledError;\n}\nfunction createRetryer(config) {\n\tlet isRetryCancelled = false;\n\tlet failureCount = 0;\n\tlet continueFn;\n\tlet status = \"pending\";\n\tlet promiseResolve;\n\tlet promiseReject;\n\tconst promise = new Promise((resolve, reject) => {\n\t\tpromiseResolve = resolve;\n\t\tpromiseReject = reject;\n\t});\n\tpromise.catch(noop);\n\tconst isResolved = () => status !== \"pending\";\n\tconst cancel = (cancelOptions) => {\n\t\tif (!isResolved()) {\n\t\t\tconst error = new CancelledError(cancelOptions);\n\t\t\treject(error);\n\t\t\tconfig.onCancel?.(error);\n\t\t}\n\t};\n\tconst cancelRetry = () => {\n\t\tisRetryCancelled = true;\n\t};\n\tconst continueRetry = () => {\n\t\tisRetryCancelled = false;\n\t};\n\tconst canContinue = () => focusManager.isFocused() && (config.networkMode === \"always\" || onlineManager.isOnline()) && config.canRun();\n\tconst canStart = () => canFetch(config.networkMode) && config.canRun();\n\tconst resolve = (value) => {\n\t\tif (!isResolved()) {\n\t\t\tcontinueFn?.();\n\t\t\tstatus = \"resolved\";\n\t\t\tpromiseResolve(value);\n\t\t}\n\t};\n\tconst reject = (value) => {\n\t\tif (!isResolved()) {\n\t\t\tcontinueFn?.();\n\t\t\tstatus = \"rejected\";\n\t\t\tpromiseReject(value);\n\t\t}\n\t};\n\tconst pause = () => {\n\t\treturn new Promise((continueResolve) => {\n\t\t\tcontinueFn = (value) => {\n\t\t\t\tif (isResolved() || canContinue()) continueResolve(value);\n\t\t\t};\n\t\t\tconfig.onPause?.();\n\t\t}).then(() => {\n\t\t\tcontinueFn = void 0;\n\t\t\tif (!isResolved()) config.onContinue?.();\n\t\t});\n\t};\n\tconst run = () => {\n\t\tif (isResolved()) return;\n\t\tlet promiseOrValue;\n\t\tconst initialPromise = failureCount === 0 ? config.initialPromise : void 0;\n\t\ttry {\n\t\t\tpromiseOrValue = initialPromise ?? config.fn();\n\t\t} catch (error) {\n\t\t\tpromiseOrValue = Promise.reject(error);\n\t\t}\n\t\tPromise.resolve(promiseOrValue).then(resolve).catch((error) => {\n\t\t\tif (isResolved()) return;\n\t\t\tconst retry = config.retry ?? (isServer() ? 0 : 3);\n\t\t\tconst retryDelay = config.retryDelay ?? defaultRetryDelay;\n\t\t\tconst delay = typeof retryDelay === \"function\" ? retryDelay(failureCount, error) : retryDelay;\n\t\t\tconst shouldRetry = retry === true || typeof retry === \"number\" && failureCount < retry || typeof retry === \"function\" && retry(failureCount, error);\n\t\t\tif (isRetryCancelled || !shouldRetry) {\n\t\t\t\treject(error);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfailureCount++;\n\t\t\tconfig.onFail?.(failureCount, error);\n\t\t\tsleep(delay).then(() => {\n\t\t\t\treturn canContinue() ? void 0 : pause();\n\t\t\t}).then(() => {\n\t\t\t\tif (isRetryCancelled) reject(error);\n\t\t\t\telse run();\n\t\t\t});\n\t\t});\n\t};\n\treturn {\n\t\tpromise,\n\t\tstatus: () => status,\n\t\tcancel,\n\t\tcontinue: () => {\n\t\t\tcontinueFn?.();\n\t\t\treturn promise;\n\t\t},\n\t\tcancelRetry,\n\t\tcontinueRetry,\n\t\tcanStart,\n\t\tstart: () => {\n\t\t\tif (canStart()) run();\n\t\t\telse pause().then(run);\n\t\t\treturn promise;\n\t\t}\n\t};\n}\n//#endregion\nexport { CancelledError, canFetch, createRetryer, isCancelledError };\n\n//# sourceMappingURL=retryer.js.map","import { timeoutManager } from \"./timeoutManager.js\";\nimport { isValidTimeout } from \"./utils.js\";\nimport { isServer } from \"./environmentManager.js\";\n//#region src/removable.ts\n/**\n* The base class for cache entries that are garbage collected once nothing is using them —\n* `Query` and `Mutation` both extend it. `gcTime` controls how long an unused entry is kept.\n*/\nvar Removable = class {\n\t#gcTimeout;\n\t/**\n\t* Clears the pending garbage collection timeout, so the entry is no longer scheduled for removal.\n\t* A subclass may override this to release what it holds on to as well — `Query` also cancels any\n\t* in-flight fetch.\n\t*/\n\tdestroy() {\n\t\tthis.clearGcTimeout();\n\t}\n\tscheduleGc() {\n\t\tthis.clearGcTimeout();\n\t\tif (isValidTimeout(this.gcTime)) this.#gcTimeout = timeoutManager.setTimeout(() => {\n\t\t\tthis.optionalRemove();\n\t\t}, this.gcTime);\n\t}\n\tupdateGcTime(newGcTime) {\n\t\tthis.gcTime = Math.max(this.gcTime || 0, newGcTime ?? (isServer() ? Infinity : 3e5));\n\t}\n\tclearGcTimeout() {\n\t\tif (this.#gcTimeout !== void 0) {\n\t\t\ttimeoutManager.clearTimeout(this.#gcTimeout);\n\t\t\tthis.#gcTimeout = void 0;\n\t\t}\n\t}\n};\n//#endregion\nexport { Removable };\n\n//# sourceMappingURL=removable.js.map","import { addConsumeAwareSignal, addToEnd, addToStart, ensureQueryFn } from \"./utils.js\";\n//#region src/infiniteQueryBehavior.ts\nfunction infiniteQueryBehavior(pages) {\n\treturn { onFetch: (context, query) => {\n\t\tconst options = context.options;\n\t\tconst direction = context.fetchOptions?.meta?.fetchMore?.direction;\n\t\tconst oldPages = context.state.data?.pages || [];\n\t\tconst oldPageParams = context.state.data?.pageParams || [];\n\t\tlet result = {\n\t\t\tpages: [],\n\t\t\tpageParams: []\n\t\t};\n\t\tlet currentPage = 0;\n\t\tconst fetchFn = async () => {\n\t\t\tlet cancelled = false;\n\t\t\tconst addSignalProperty = (object) => {\n\t\t\t\taddConsumeAwareSignal(object, () => context.signal, () => cancelled = true);\n\t\t\t};\n\t\t\tconst queryFn = ensureQueryFn(context.options, context.fetchOptions);\n\t\t\tconst fetchPage = async (data, param, previous) => {\n\t\t\t\tif (cancelled) return Promise.reject(context.signal.reason);\n\t\t\t\tif (param == null && data.pages.length) return Promise.resolve(data);\n\t\t\t\tconst createQueryFnContext = () => {\n\t\t\t\t\tconst queryFnContext = {\n\t\t\t\t\t\tclient: context.client,\n\t\t\t\t\t\tqueryKey: context.queryKey,\n\t\t\t\t\t\tpageParam: param,\n\t\t\t\t\t\tdirection: previous ? \"backward\" : \"forward\",\n\t\t\t\t\t\tmeta: context.options.meta\n\t\t\t\t\t};\n\t\t\t\t\taddSignalProperty(queryFnContext);\n\t\t\t\t\treturn queryFnContext;\n\t\t\t\t};\n\t\t\t\tconst queryFnContext = createQueryFnContext();\n\t\t\t\tconst page = await queryFn(queryFnContext);\n\t\t\t\tconst { maxPages } = context.options;\n\t\t\t\tconst addTo = previous ? addToStart : addToEnd;\n\t\t\t\treturn {\n\t\t\t\t\tpages: addTo(data.pages, page, maxPages),\n\t\t\t\t\tpageParams: addTo(data.pageParams, param, maxPages)\n\t\t\t\t};\n\t\t\t};\n\t\t\tif (direction && oldPages.length) {\n\t\t\t\tconst previous = direction === \"backward\";\n\t\t\t\tconst pageParamFn = previous ? getPreviousPageParam : getNextPageParam;\n\t\t\t\tconst oldData = {\n\t\t\t\t\tpages: oldPages,\n\t\t\t\t\tpageParams: oldPageParams\n\t\t\t\t};\n\t\t\t\tresult = await fetchPage(oldData, pageParamFn(options, oldData), previous);\n\t\t\t} else {\n\t\t\t\tconst remainingPages = pages ?? oldPages.length;\n\t\t\t\tdo {\n\t\t\t\t\tconst param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result);\n\t\t\t\t\tif (currentPage > 0 && param == null) break;\n\t\t\t\t\tresult = await fetchPage(result, param);\n\t\t\t\t\tcurrentPage++;\n\t\t\t\t} while (currentPage < remainingPages);\n\t\t\t}\n\t\t\treturn result;\n\t\t};\n\t\tif (context.options.persister) context.fetchFn = () => {\n\t\t\treturn context.options.persister?.(fetchFn, {\n\t\t\t\tclient: context.client,\n\t\t\t\tqueryKey: context.queryKey,\n\t\t\t\tmeta: context.options.meta,\n\t\t\t\tsignal: context.signal\n\t\t\t}, query);\n\t\t};\n\t\telse context.fetchFn = fetchFn;\n\t} };\n}\nfunction getNextPageParam(options, { pages, pageParams }) {\n\tconst lastIndex = pages.length - 1;\n\treturn pages.length > 0 ? options.getNextPageParam(pages[lastIndex], pages, pageParams[lastIndex], pageParams) : void 0;\n}\nfunction getPreviousPageParam(options, { pages, pageParams }) {\n\treturn pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0;\n}\n/**\n* Checks if there is a next page.\n*/\nfunction hasNextPage(options, data) {\n\tif (!data) return false;\n\treturn getNextPageParam(options, data) != null;\n}\n/**\n* Checks if there is a previous page.\n*/\nfunction hasPreviousPage(options, data) {\n\tif (!data || !options.getPreviousPageParam) return false;\n\treturn getPreviousPageParam(options, data) != null;\n}\n//#endregion\nexport { hasNextPage, hasPreviousPage, infiniteQueryBehavior };\n\n//# sourceMappingURL=infiniteQueryBehavior.js.map","import { ensureQueryFn, noop, replaceData, resolveQueryValue, skipToken, timeUntilStale } from \"./utils.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { CancelledError, canFetch, createRetryer } from \"./retryer.js\";\nimport { Removable } from \"./removable.js\";\nimport { infiniteQueryBehavior } from \"./infiniteQueryBehavior.js\";\n//#region src/query.ts\n/**\n* Represents a single cached query. A `Query` holds the query's key, options,\n* state (data/error/status), and the observers currently subscribed to it.\n*\n* Instances are created and managed internally by `QueryCache`; application\n* code typically interacts with queries indirectly through `QueryClient` or\n* a framework hook like `useQuery`. Direct access to a `Query` instance is\n* possible via `queryCache.find()`/`findAll()` for inspecting cache state.\n*\n* @example\n* ```ts\n* const queryCache = queryClient.getQueryCache()\n* const query = queryCache.find({ queryKey: ['posts'] })\n*\n* if (query) {\n* console.log(query.state.dataUpdatedAt)\n* }\n* ```\n*/\nvar Query = class extends Removable {\n\t#queryType;\n\t#initialState;\n\t#revertState;\n\t#cache;\n\t#client;\n\t#retryer;\n\t#defaultOptions;\n\t#abortSignalConsumed;\n\tconstructor(config) {\n\t\tsuper();\n\t\tthis.#abortSignalConsumed = false;\n\t\tthis.#defaultOptions = config.defaultOptions;\n\t\tthis.setOptions(config.options);\n\t\tthis.observers = [];\n\t\tthis.#client = config.client;\n\t\tthis.#cache = this.#client.getQueryCache();\n\t\tthis.queryKey = config.queryKey;\n\t\tthis.queryHash = config.queryHash;\n\t\tthis.#initialState = getDefaultState(this.options);\n\t\tthis.state = config.state ?? this.#initialState;\n\t\tthis.scheduleGc();\n\t}\n\t/**\n\t* The `meta` object passed in the query's options, if any.\n\t*/\n\tget meta() {\n\t\treturn this.options.meta;\n\t}\n\t/** @internal */\n\tget queryType() {\n\t\treturn this.#queryType;\n\t}\n\t/**\n\t* The promise for the currently in-flight fetch, if the query is fetching.\n\t* `undefined` when the query is not fetching.\n\t*/\n\tget promise() {\n\t\treturn this.#retryer?.promise;\n\t}\n\t/** @internal */\n\tsetOptions(options) {\n\t\tthis.options = {\n\t\t\t...this.#defaultOptions,\n\t\t\t...options\n\t\t};\n\t\tif (options?._type) this.#queryType = options._type;\n\t\tthis.updateGcTime(this.options.gcTime);\n\t\tif (this.state && this.state.data === void 0) {\n\t\t\tconst defaultState = getDefaultState(this.options);\n\t\t\tif (defaultState.data !== void 0) {\n\t\t\t\tthis.setState(successState(defaultState.data, defaultState.dataUpdatedAt));\n\t\t\t\tthis.#initialState = defaultState;\n\t\t\t}\n\t\t}\n\t}\n\toptionalRemove() {\n\t\tif (!this.observers.length && this.state.fetchStatus === \"idle\") this.#cache.remove(this);\n\t}\n\t/** @internal */\n\tsetData(newData, options) {\n\t\tconst data = replaceData(this.state.data, newData, this.options);\n\t\tthis.#dispatch({\n\t\t\tdata,\n\t\t\ttype: \"success\",\n\t\t\tdataUpdatedAt: options?.updatedAt,\n\t\t\tmanual: options?.manual\n\t\t});\n\t\treturn data;\n\t}\n\t/**\n\t* Merges the given partial state directly into this query's state, notifying observers. Used\n\t* by persistence and broadcast plugins to restore a state snapshot, and by devtools to let a\n\t* user manually trigger a loading/error state or edit the cached data.\n\t*/\n\tsetState(state) {\n\t\tthis.#dispatch({\n\t\t\ttype: \"setState\",\n\t\t\tstate\n\t\t});\n\t}\n\t/**\n\t* Cancels the query's currently in-flight fetch, if any.\n\t* - Returns a promise that resolves once the cancellation has settled.\n\t* - If no fetch is in progress, resolves immediately.\n\t*\n\t* @example\n\t* ```ts\n\t* await query.cancel()\n\t* ```\n\t*/\n\tcancel(options) {\n\t\tconst promise = this.#retryer?.promise;\n\t\tthis.#retryer?.cancel(options);\n\t\treturn promise ? promise.then(noop).catch(noop) : Promise.resolve();\n\t}\n\t/**\n\t* Clears the query's garbage collection timeout and silently cancels any\n\t* in-flight fetch. Called by `QueryCache` when the query is removed from\n\t* the cache.\n\t*\n\t* @see {@link Query#cancel}\n\t*/\n\tdestroy() {\n\t\tsuper.destroy();\n\t\tthis.cancel({ silent: true });\n\t}\n\t/** @internal */\n\tget resetState() {\n\t\treturn this.#initialState;\n\t}\n\t/**\n\t* Resets the query back to its initial state (the state it had when it was\n\t* first created, e.g. any `initialData`), destroying it first to cancel any\n\t* in-flight fetch.\n\t*/\n\treset() {\n\t\tthis.destroy();\n\t\tthis.setState(this.resetState);\n\t}\n\t/**\n\t* Returns `true` if the query has at least one observer for which `enabled`\n\t* does not resolve to `false`.\n\t*/\n\tisActive() {\n\t\treturn this.observers.some((observer) => resolveQueryValue(observer.options.enabled, this) !== false);\n\t}\n\t/**\n\t* Returns `true` if the query is disabled, meaning it will not fetch\n\t* automatically.\n\t* - If the query has observers, it is disabled when none of them are active\n\t* (see `isActive`).\n\t* - If the query has no observers, it is disabled when its `queryFn` is\n\t* `skipToken` or it has never been fetched.\n\t*/\n\tisDisabled() {\n\t\tif (this.getObserversCount() > 0) return !this.isActive();\n\t\treturn this.options.queryFn === skipToken || !this.isFetched();\n\t}\n\t/**\n\t* Returns `true` if the query has been fetched, i.e. it has resolved with\n\t* either data or an error at least once.\n\t*/\n\tisFetched() {\n\t\treturn this.state.dataUpdateCount + this.state.errorUpdateCount > 0;\n\t}\n\t/**\n\t* Returns `true` if the query has at least one observer configured with\n\t* `staleTime: 'static'`, meaning it is treated as never stale.\n\t*/\n\tisStatic() {\n\t\tif (this.getObserversCount() > 0) return this.observers.some((observer) => resolveQueryValue(observer.options.staleTime, this) === \"static\");\n\t\treturn false;\n\t}\n\t/**\n\t* Returns `true` if the query is stale.\n\t* - If the query has observers, defers to whether any observer's current\n\t* result reports `isStale` (which accounts for each observer's own\n\t* `staleTime` and `enabled` state).\n\t* - If the query has no observers, it is considered stale when it has no\n\t* data or has been invalidated.\n\t*\n\t* @see {@link Query#isStaleByTime}\n\t* @example\n\t* ```ts\n\t* if (query.isStale()) {\n\t* // refetch or otherwise treat the cached data as outdated\n\t* }\n\t* ```\n\t*/\n\tisStale() {\n\t\tif (this.getObserversCount() > 0) return this.observers.some((observer) => observer.getCurrentResult().isStale);\n\t\treturn this.state.data === void 0 || this.state.isInvalidated;\n\t}\n\t/**\n\t* Returns `true` if the query's data is stale relative to the given\n\t* `staleTime` (defaults to `0`).\n\t* - A query with no data is always stale.\n\t* - `staleTime: 'static'` is never stale.\n\t* - An invalidated query is always stale.\n\t* - Otherwise, staleness is based on elapsed time since `dataUpdatedAt`.\n\t*\n\t* @see {@link Query#isStale}\n\t* @example\n\t* ```ts\n\t* const isStale = query.isStaleByTime(1000 * 60)\n\t* ```\n\t*/\n\tisStaleByTime(staleTime = 0) {\n\t\tif (this.state.data === void 0) return true;\n\t\tif (staleTime === \"static\") return false;\n\t\tif (this.state.isInvalidated) return true;\n\t\treturn !timeUntilStale(this.state.dataUpdatedAt, staleTime);\n\t}\n\t/** @internal */\n\tonFocus() {\n\t\tthis.observers.find((x) => x.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: false });\n\t\tthis.#retryer?.continue();\n\t}\n\t/** @internal */\n\tonOnline() {\n\t\tthis.observers.find((x) => x.shouldFetchOnReconnect())?.refetch({ cancelRefetch: false });\n\t\tthis.#retryer?.continue();\n\t}\n\t/** @internal */\n\taddObserver(observer) {\n\t\tif (!this.observers.includes(observer)) {\n\t\t\tthis.observers.push(observer);\n\t\t\tthis.clearGcTimeout();\n\t\t\tthis.#cache.notify({\n\t\t\t\ttype: \"observerAdded\",\n\t\t\t\tquery: this,\n\t\t\t\tobserver\n\t\t\t});\n\t\t}\n\t}\n\t/** @internal */\n\tremoveObserver(observer) {\n\t\tconst index = this.observers.indexOf(observer);\n\t\tif (index !== -1) {\n\t\t\tthis.observers.splice(index, 1);\n\t\t\tif (!this.observers.length) {\n\t\t\t\tif (this.#retryer) {\n\t\t\t\t\tif (this.#abortSignalConsumed || this.state.fetchStatus === \"paused\" && this.state.status === \"pending\") this.#retryer.cancel({ revert: true });\n\t\t\t\t\telse this.#retryer.cancelRetry();\n\t\t\t\t}\n\t\t\t\tthis.scheduleGc();\n\t\t\t}\n\t\t\tthis.#cache.notify({\n\t\t\t\ttype: \"observerRemoved\",\n\t\t\t\tquery: this,\n\t\t\t\tobserver\n\t\t\t});\n\t\t}\n\t}\n\t/**\n\t* Returns the number of observers currently subscribed to this query.\n\t*\n\t* @example\n\t* ```ts\n\t* if (query.getObserversCount() === 0) {\n\t* // no component is currently watching this query\n\t* }\n\t* ```\n\t*/\n\tgetObserversCount() {\n\t\treturn this.observers.length;\n\t}\n\t/**\n\t* Marks the query as invalidated, unless it is already invalidated. This\n\t* updates `state.isInvalidated` and notifies observers, but does not by\n\t* itself trigger a refetch.\n\t*\n\t* @example\n\t* ```ts\n\t* query.invalidate()\n\t* ```\n\t*/\n\tinvalidate() {\n\t\tif (!this.state.isInvalidated) this.#dispatch({ type: \"invalidate\" });\n\t}\n\t/**\n\t* Fetches the query, i.e. runs its `queryFn` (through any configured\n\t* retryer/behavior) and updates the query's state with the result.\n\t* - If a fetch is already in flight, returns its promise instead of\n\t* starting a new one, unless `fetchOptions.cancelRefetch` is set and the\n\t* query already has data, in which case the current fetch is silently\n\t* cancelled first.\n\t* - If `options` is passed, it replaces the query's current options\n\t* before fetching.\n\t*/\n\tasync fetch(options, fetchOptions) {\n\t\tif (this.state.fetchStatus !== \"idle\" && this.#retryer?.status() !== \"rejected\") {\n\t\t\tif (this.state.data !== void 0 && fetchOptions?.cancelRefetch) this.cancel({ silent: true });\n\t\t\telse if (this.#retryer) {\n\t\t\t\tthis.#retryer.continueRetry();\n\t\t\t\treturn this.#retryer.promise;\n\t\t\t}\n\t\t}\n\t\tif (options) this.setOptions(options);\n\t\tif (!this.options.queryFn) {\n\t\t\tconst observer = this.observers.find((x) => x.options.queryFn);\n\t\t\tif (observer) this.setOptions(observer.options);\n\t\t}\n\t\tif (process.env.NODE_ENV !== \"production\") {\n\t\t\tif (!Array.isArray(this.options.queryKey)) console.error(`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']`);\n\t\t}\n\t\tconst abortController = new AbortController();\n\t\tconst addSignalProperty = (object) => {\n\t\t\tObject.defineProperty(object, \"signal\", {\n\t\t\t\tenumerable: true,\n\t\t\t\tget: () => {\n\t\t\t\t\tthis.#abortSignalConsumed = true;\n\t\t\t\t\treturn abortController.signal;\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\t\tconst fetchFn = () => {\n\t\t\tconst queryFn = ensureQueryFn(this.options, fetchOptions);\n\t\t\tconst createQueryFnContext = () => {\n\t\t\t\tconst queryFnContext = {\n\t\t\t\t\tclient: this.#client,\n\t\t\t\t\tqueryKey: this.queryKey,\n\t\t\t\t\tmeta: this.meta\n\t\t\t\t};\n\t\t\t\taddSignalProperty(queryFnContext);\n\t\t\t\treturn queryFnContext;\n\t\t\t};\n\t\t\tconst queryFnContext = createQueryFnContext();\n\t\t\tthis.#abortSignalConsumed = false;\n\t\t\tif (this.options.persister) return this.options.persister(queryFn, queryFnContext, this);\n\t\t\treturn queryFn(queryFnContext);\n\t\t};\n\t\tconst createFetchContext = () => {\n\t\t\tconst context = {\n\t\t\t\tfetchOptions,\n\t\t\t\toptions: this.options,\n\t\t\t\tqueryKey: this.queryKey,\n\t\t\t\tclient: this.#client,\n\t\t\t\tstate: this.state,\n\t\t\t\tfetchFn\n\t\t\t};\n\t\t\taddSignalProperty(context);\n\t\t\treturn context;\n\t\t};\n\t\tconst context = createFetchContext();\n\t\t(this.#queryType === \"infinite\" ? infiniteQueryBehavior(this.options.pages) : this.options.behavior)?.onFetch(context, this);\n\t\tthis.#revertState = this.state;\n\t\tif (this.state.fetchStatus === \"idle\" || this.state.fetchMeta !== context.fetchOptions?.meta) this.#dispatch({\n\t\t\ttype: \"fetch\",\n\t\t\tmeta: context.fetchOptions?.meta\n\t\t});\n\t\tconst retryer = this.#retryer = createRetryer({\n\t\t\tinitialPromise: fetchOptions?.initialPromise,\n\t\t\tfn: context.fetchFn,\n\t\t\tonCancel: (error) => {\n\t\t\t\tif (error instanceof CancelledError && error.revert) this.setState({\n\t\t\t\t\t...this.#revertState,\n\t\t\t\t\tfetchStatus: \"idle\"\n\t\t\t\t});\n\t\t\t\tabortController.abort();\n\t\t\t},\n\t\t\tonFail: (failureCount, error) => {\n\t\t\t\tthis.#dispatch({\n\t\t\t\t\ttype: \"failed\",\n\t\t\t\t\tfailureCount,\n\t\t\t\t\terror\n\t\t\t\t});\n\t\t\t},\n\t\t\tonPause: () => {\n\t\t\t\tthis.#dispatch({ type: \"pause\" });\n\t\t\t},\n\t\t\tonContinue: () => {\n\t\t\t\tthis.#dispatch({ type: \"continue\" });\n\t\t\t},\n\t\t\tretry: context.options.retry,\n\t\t\tretryDelay: context.options.retryDelay,\n\t\t\tnetworkMode: context.options.networkMode,\n\t\t\tcanRun: () => true\n\t\t});\n\t\ttry {\n\t\t\tconst data = await retryer.start();\n\t\t\tif (data === void 0) {\n\t\t\t\tif (process.env.NODE_ENV !== \"production\") console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`);\n\t\t\t\tthrow new Error(`${this.queryHash} data is undefined`);\n\t\t\t}\n\t\t\tthis.setData(data);\n\t\t\tthis.#cache.config.onSuccess?.(data, this);\n\t\t\tthis.#cache.config.onSettled?.(data, this.state.error, this);\n\t\t\treturn data;\n\t\t} catch (error) {\n\t\t\tif (error instanceof CancelledError) {\n\t\t\t\tif (error.silent) return this.#retryer.promise;\n\t\t\t\telse if (error.revert) {\n\t\t\t\t\tif (this.state.data === void 0) throw error;\n\t\t\t\t\treturn this.state.data;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.#dispatch({\n\t\t\t\ttype: \"error\",\n\t\t\t\terror\n\t\t\t});\n\t\t\tthis.#cache.config.onError?.(error, this);\n\t\t\tthis.#cache.config.onSettled?.(this.state.data, error, this);\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tif (this.#retryer === retryer) this.#retryer = void 0;\n\t\t\tthis.scheduleGc();\n\t\t}\n\t}\n\t#dispatch(action) {\n\t\tconst reducer = (state) => {\n\t\t\tswitch (action.type) {\n\t\t\t\tcase \"failed\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tfetchFailureCount: action.failureCount,\n\t\t\t\t\tfetchFailureReason: action.error\n\t\t\t\t};\n\t\t\t\tcase \"pause\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tfetchStatus: \"paused\"\n\t\t\t\t};\n\t\t\t\tcase \"continue\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tfetchStatus: \"fetching\"\n\t\t\t\t};\n\t\t\t\tcase \"fetch\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\t...fetchState(state.data, this.options),\n\t\t\t\t\tfetchMeta: action.meta ?? null\n\t\t\t\t};\n\t\t\t\tcase \"success\":\n\t\t\t\t\tconst newState = {\n\t\t\t\t\t\t...state,\n\t\t\t\t\t\t...successState(action.data, action.dataUpdatedAt),\n\t\t\t\t\t\tdataUpdateCount: state.dataUpdateCount + 1,\n\t\t\t\t\t\t...!action.manual && {\n\t\t\t\t\t\t\tfetchStatus: \"idle\",\n\t\t\t\t\t\t\tfetchFailureCount: 0,\n\t\t\t\t\t\t\tfetchFailureReason: null\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tthis.#revertState = action.manual ? newState : void 0;\n\t\t\t\t\treturn newState;\n\t\t\t\tcase \"error\":\n\t\t\t\t\tconst error = action.error;\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...state,\n\t\t\t\t\t\terror,\n\t\t\t\t\t\terrorUpdateCount: state.errorUpdateCount + 1,\n\t\t\t\t\t\terrorUpdatedAt: Date.now(),\n\t\t\t\t\t\tfetchFailureCount: state.fetchFailureCount + 1,\n\t\t\t\t\t\tfetchFailureReason: error,\n\t\t\t\t\t\tfetchStatus: \"idle\",\n\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\tisInvalidated: true\n\t\t\t\t\t};\n\t\t\t\tcase \"invalidate\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tisInvalidated: true\n\t\t\t\t};\n\t\t\t\tcase \"setState\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\t...action.state\n\t\t\t\t};\n\t\t\t}\n\t\t};\n\t\tthis.state = reducer(this.state);\n\t\tnotifyManager.batch(() => {\n\t\t\tthis.observers.slice().forEach((observer) => {\n\t\t\t\tobserver.onQueryUpdate();\n\t\t\t});\n\t\t\tthis.#cache.notify({\n\t\t\t\tquery: this,\n\t\t\t\ttype: \"updated\",\n\t\t\t\taction\n\t\t\t});\n\t\t});\n\t}\n};\nfunction fetchState(data, options) {\n\treturn {\n\t\tfetchFailureCount: 0,\n\t\tfetchFailureReason: null,\n\t\tfetchStatus: canFetch(options.networkMode) ? \"fetching\" : \"paused\",\n\t\t...data === void 0 && {\n\t\t\terror: null,\n\t\t\tstatus: \"pending\"\n\t\t}\n\t};\n}\nfunction successState(data, dataUpdatedAt) {\n\treturn {\n\t\tdata,\n\t\tdataUpdatedAt: dataUpdatedAt ?? Date.now(),\n\t\terror: null,\n\t\tisInvalidated: false,\n\t\tstatus: \"success\"\n\t};\n}\nfunction getDefaultState(options) {\n\tconst data = typeof options.initialData === \"function\" ? options.initialData() : options.initialData;\n\tconst hasData = data !== void 0;\n\tconst initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === \"function\" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;\n\treturn {\n\t\tdata,\n\t\tdataUpdateCount: 0,\n\t\tdataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,\n\t\terror: null,\n\t\terrorUpdateCount: 0,\n\t\terrorUpdatedAt: 0,\n\t\tfetchFailureCount: 0,\n\t\tfetchFailureReason: null,\n\t\tfetchMeta: null,\n\t\tisInvalidated: false,\n\t\tstatus: hasData ? \"success\" : \"pending\",\n\t\tfetchStatus: \"idle\"\n\t};\n}\n//#endregion\nexport { Query, fetchState };\n\n//# sourceMappingURL=query.js.map","import { timeoutManager } from \"./timeoutManager.js\";\nimport { isValidTimeout, noop, replaceData, resolveQueryValue, shallowEqualObjects, timeUntilStale } from \"./utils.js\";\nimport { isServer } from \"./environmentManager.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { focusManager } from \"./focusManager.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { fetchState } from \"./query.js\";\n//#region src/queryObserver.ts\n/**\n* A `QueryObserver` watches a single query in the `QueryCache` and computes a\n* `QueryObserverResult` from its state, recomputing and notifying subscribers\n* whenever the underlying query (or the observer's options) changes. It is\n* the primitive that framework adapters (e.g. `useQuery`) build their hooks\n* on top of, but it can also be used directly to observe and switch between\n* queries outside of any framework.\n*\n* @example\n* ```ts\n* const observer = new QueryObserver(queryClient, {\n* queryKey: ['posts'],\n* queryFn: fetchPosts,\n* })\n*\n* const unsubscribe = observer.subscribe((result) => {\n* console.log(result.data)\n* })\n* ```\n*/\nvar QueryObserver = class extends Subscribable {\n\t#client;\n\t#currentQuery = void 0;\n\t#currentQueryInitialState = void 0;\n\t#currentResult = void 0;\n\t#currentResultState;\n\t#currentResultOptions;\n\t#selectError;\n\t#selectFn;\n\t#selectResult;\n\t#lastQueryWithDefinedData;\n\t#staleTimeoutId;\n\t#refetchIntervalId;\n\t#currentRefetchInterval;\n\t#trackedProps = /* @__PURE__ */ new Set();\n\tconstructor(client, options) {\n\t\tsuper();\n\t\tthis.options = options;\n\t\tthis.#client = client;\n\t\tthis.#selectError = null;\n\t\tthis.bindMethods();\n\t\tthis.setOptions(options);\n\t}\n\tbindMethods() {\n\t\tthis.refetch = this.refetch.bind(this);\n\t}\n\tonSubscribe() {\n\t\tif (this.listeners.size === 1) {\n\t\t\tthis.#currentQuery.addObserver(this);\n\t\t\tif (shouldFetchOnMount(this.#currentQuery, this.options)) this.#executeFetch();\n\t\t\telse this.updateResult();\n\t\t\tthis.#updateTimers();\n\t\t}\n\t}\n\tonUnsubscribe() {\n\t\tif (!this.hasListeners()) this.destroy();\n\t}\n\t/**\n\t* Returns whether the observed query is currently stale and configured\n\t* (via the `refetchOnReconnect` option) to refetch when the network\n\t* reconnects.\n\t*/\n\tshouldFetchOnReconnect() {\n\t\treturn shouldFetchOn(this.#currentQuery, this.options, this.options.refetchOnReconnect);\n\t}\n\t/**\n\t* Returns whether the observed query is currently stale and configured\n\t* (via the `refetchOnWindowFocus` option) to refetch when the window\n\t* regains focus.\n\t*/\n\tshouldFetchOnWindowFocus() {\n\t\treturn shouldFetchOn(this.#currentQuery, this.options, this.options.refetchOnWindowFocus);\n\t}\n\t/**\n\t* Stops observing the current query: clears all listeners, cancels the\n\t* stale and refetch-interval timers, and removes this observer from the\n\t* query it was observing.\n\t*/\n\tdestroy() {\n\t\tthis.listeners = /* @__PURE__ */ new Set();\n\t\tthis.#clearStaleTimeout();\n\t\tthis.#clearRefetchInterval();\n\t\tthis.#currentQuery.removeObserver(this);\n\t}\n\t/**\n\t* Updates the observer's options. This will re-resolve the query being\n\t* observed (switching to a different query if the `queryKey` changed),\n\t* trigger a fetch if the new options require one and the observer has\n\t* subscribers, recompute the current result, and reschedule the stale and\n\t* refetch-interval timers as needed.\n\t*\n\t* @example\n\t* ```ts\n\t* observer.setOptions({ queryKey: ['posts', 1], queryFn: () => fetchPost(1) })\n\t* // later: switch to a different query, reusing the same observer\n\t* observer.setOptions({ queryKey: ['posts', 2], queryFn: () => fetchPost(2) })\n\t* ```\n\t*/\n\tsetOptions(options) {\n\t\tconst prevOptions = this.options;\n\t\tconst prevQuery = this.#currentQuery;\n\t\tthis.options = this.#client.defaultQueryOptions(options);\n\t\tif (this.options.enabled !== void 0 && typeof this.options.enabled !== \"boolean\" && typeof this.options.enabled !== \"function\" && typeof resolveQueryValue(this.options.enabled, this.#currentQuery) !== \"boolean\") throw new Error(\"Expected enabled to be a boolean or a callback that returns a boolean\");\n\t\tthis.#updateQuery();\n\t\tthis.#currentQuery.setOptions(this.options);\n\t\tif (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) this.#client.getQueryCache().notify({\n\t\t\ttype: \"observerOptionsUpdated\",\n\t\t\tquery: this.#currentQuery,\n\t\t\tobserver: this\n\t\t});\n\t\tconst mounted = this.hasListeners();\n\t\tif (mounted && shouldFetchOptionally(this.#currentQuery, prevQuery, this.options, prevOptions)) this.#executeFetch();\n\t\tthis.updateResult();\n\t\tif (mounted && (this.#currentQuery !== prevQuery || resolveQueryValue(this.options.enabled, this.#currentQuery) !== resolveQueryValue(prevOptions.enabled, this.#currentQuery) || resolveQueryValue(this.options.staleTime, this.#currentQuery) !== resolveQueryValue(prevOptions.staleTime, this.#currentQuery))) this.#updateStaleTimeout();\n\t\tconst nextRefetchInterval = this.#computeRefetchInterval();\n\t\tif (mounted && (this.#currentQuery !== prevQuery || resolveQueryValue(this.options.enabled, this.#currentQuery) !== resolveQueryValue(prevOptions.enabled, this.#currentQuery) || nextRefetchInterval !== this.#currentRefetchInterval)) this.#updateRefetchInterval(nextRefetchInterval);\n\t}\n\t/**\n\t* Computes the result the observer would produce for the given (already-defaulted) options\n\t* right now, building the underlying `Query` if it doesn't exist yet, without waiting for a\n\t* subscription callback. Called by framework adapters on every render (e.g. `useQuery`) so the\n\t* returned value is available synchronously, ahead of `setOptions` triggering an actual fetch.\n\t*/\n\tgetOptimisticResult(options) {\n\t\tconst query = this.#client.getQueryCache().build(this.#client, options);\n\t\tconst result = this.createResult(query, options);\n\t\tif (!shallowEqualObjects(this.getCurrentResult(), result)) {\n\t\t\tthis.#currentResult = result;\n\t\t\tthis.#currentResultOptions = this.options;\n\t\t\tthis.#currentResultState = this.#currentQuery.state;\n\t\t}\n\t\treturn result;\n\t}\n\t/**\n\t* Returns the most recently computed `QueryObserverResult` for the\n\t* observed query. This is a point-in-time read; to be notified of updates\n\t* as they happen, subscribe to the observer instead (its inherited\n\t* `subscribe` method).\n\t*\n\t* @example\n\t* ```ts\n\t* const result = observer.getCurrentResult()\n\t* console.log(result.status, result.data)\n\t* ```\n\t*/\n\tgetCurrentResult() {\n\t\treturn this.#currentResult;\n\t}\n\t/**\n\t* Wraps a `QueryObserverResult` in a `Proxy` that records which properties are read, via\n\t* {@link QueryObserver#trackProp} (and an optional `onPropTracked` callback). Used by framework\n\t* adapters when `notifyOnChangeProps` is not set, to implement its default \"only re-render on\n\t* properties you actually read\" behavior.\n\t*/\n\ttrackResult(result, onPropTracked) {\n\t\treturn new Proxy(result, { get: (target, key) => {\n\t\t\tthis.trackProp(key);\n\t\t\tonPropTracked?.(key);\n\t\t\treturn Reflect.get(target, key);\n\t\t} });\n\t}\n\t/**\n\t* Records that the given `QueryObserverResult` property was read, so a subsequent update only\n\t* notifies this observer if a tracked property actually changed. Normally called indirectly via\n\t* {@link QueryObserver#trackResult}'s proxy; exposed directly for adapters that track property\n\t* access themselves (e.g. through their own reactivity system) instead of via the proxy.\n\t*/\n\ttrackProp(key) {\n\t\tthis.#trackedProps.add(key);\n\t}\n\t/**\n\t* Returns the `Query` instance this observer is currently observing.\n\t*/\n\tgetCurrentQuery() {\n\t\treturn this.#currentQuery;\n\t}\n\t/**\n\t* Refetches the observed query and returns a promise that resolves with\n\t* the resulting `QueryObserverResult`.\n\t*\n\t* @example\n\t* ```ts\n\t* const result = await observer.refetch({ cancelRefetch: false })\n\t* console.log(result.data)\n\t* ```\n\t*/\n\trefetch({ ...options } = {}) {\n\t\treturn this.fetch({ ...options });\n\t}\n\t/**\n\t* Fetches a query defined by the given options without affecting this\n\t* observer's own tracked query or result, and returns a promise that\n\t* resolves with the `QueryObserverResult` for that fetch. This is useful\n\t* for prefetching data that another observer (e.g. a query about to be\n\t* navigated to) will need, ahead of time.\n\t*\n\t* @example\n\t* ```ts\n\t* const result = await observer.fetchOptimistic({\n\t* queryKey: ['posts', 2],\n\t* queryFn: () => fetchPost(2),\n\t* })\n\t* console.log(result.data)\n\t* ```\n\t*/\n\tfetchOptimistic(options) {\n\t\tconst defaultedOptions = this.#client.defaultQueryOptions(options);\n\t\tconst query = this.#client.getQueryCache().build(this.#client, defaultedOptions);\n\t\tlet unsubscribe = () => {};\n\t\tlet resolveEarly;\n\t\tconst cachePromise = new Promise((resolve) => {\n\t\t\tresolveEarly = resolve;\n\t\t\tunsubscribe = this.#client.getQueryCache().subscribe((event) => {\n\t\t\t\tif (event.type === \"updated\" && event.query.queryHash === query.queryHash && query.state.data !== void 0) {\n\t\t\t\t\tunsubscribe();\n\t\t\t\t\tresolve(this.createResult(query, defaultedOptions));\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t\treturn Promise.race([query.fetch().then(() => {\n\t\t\tconst result = this.createResult(query, defaultedOptions);\n\t\t\tresolveEarly?.(result);\n\t\t\treturn result;\n\t\t}).finally(() => {\n\t\t\tunsubscribe();\n\t\t}), cachePromise]);\n\t}\n\tfetch(fetchOptions) {\n\t\treturn this.#executeFetch({\n\t\t\t...fetchOptions,\n\t\t\tcancelRefetch: fetchOptions.cancelRefetch ?? true\n\t\t}).then(() => {\n\t\t\tthis.updateResult();\n\t\t\treturn this.#currentResult;\n\t\t});\n\t}\n\t#executeFetch(fetchOptions) {\n\t\tthis.#updateQuery();\n\t\tlet promise = this.#currentQuery.fetch(this.options, fetchOptions);\n\t\tif (!fetchOptions?.throwOnError) promise = promise.catch(noop);\n\t\treturn promise;\n\t}\n\t#shouldScheduleTimer(timeout) {\n\t\treturn !isServer() && resolveQueryValue(this.options.enabled, this.#currentQuery) !== false && isValidTimeout(timeout);\n\t}\n\t#updateStaleTimeout() {\n\t\tthis.#clearStaleTimeout();\n\t\tconst staleTime = resolveQueryValue(this.options.staleTime, this.#currentQuery);\n\t\tif (this.#currentResult.isStale || !this.#shouldScheduleTimer(staleTime)) return;\n\t\tconst timeout = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime) + 1;\n\t\tthis.#staleTimeoutId = timeoutManager.setTimeout(() => {\n\t\t\tif (!this.#currentResult.isStale) this.updateResult();\n\t\t}, timeout);\n\t}\n\t#computeRefetchInterval() {\n\t\treturn resolveQueryValue(this.options.refetchInterval, this.#currentQuery) ?? false;\n\t}\n\t#updateRefetchInterval(nextInterval) {\n\t\tthis.#clearRefetchInterval();\n\t\tthis.#currentRefetchInterval = nextInterval;\n\t\tif (this.#currentRefetchInterval === 0 || !this.#shouldScheduleTimer(this.#currentRefetchInterval)) return;\n\t\tthis.#refetchIntervalId = timeoutManager.setInterval(() => {\n\t\t\tif (this.options.refetchIntervalInBackground || focusManager.isFocused()) this.#executeFetch();\n\t\t}, this.#currentRefetchInterval);\n\t}\n\t#updateTimers() {\n\t\tthis.#updateStaleTimeout();\n\t\tthis.#updateRefetchInterval(this.#computeRefetchInterval());\n\t}\n\t#clearStaleTimeout() {\n\t\tif (this.#staleTimeoutId !== void 0) {\n\t\t\ttimeoutManager.clearTimeout(this.#staleTimeoutId);\n\t\t\tthis.#staleTimeoutId = void 0;\n\t\t}\n\t}\n\t#clearRefetchInterval() {\n\t\tif (this.#refetchIntervalId !== void 0) {\n\t\t\ttimeoutManager.clearInterval(this.#refetchIntervalId);\n\t\t\tthis.#refetchIntervalId = void 0;\n\t\t}\n\t}\n\tcreateResult(query, options) {\n\t\tconst prevQuery = this.#currentQuery;\n\t\tconst prevOptions = this.options;\n\t\tconst prevResult = this.#currentResult;\n\t\tconst prevResultState = this.#currentResultState;\n\t\tconst prevResultOptions = this.#currentResultOptions;\n\t\tconst queryInitialState = query !== prevQuery ? query.state : this.#currentQueryInitialState;\n\t\tconst { state } = query;\n\t\tlet newState = { ...state };\n\t\tlet isPlaceholderData = false;\n\t\tlet data;\n\t\tif (options._optimisticResults) {\n\t\t\tconst mounted = this.hasListeners();\n\t\t\tconst fetchOnMount = !mounted && shouldFetchOnMount(query, options);\n\t\t\tconst fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);\n\t\t\tif (fetchOnMount || fetchOptionally) newState = {\n\t\t\t\t...newState,\n\t\t\t\t...fetchState(state.data, query.options)\n\t\t\t};\n\t\t\tif (options._optimisticResults === \"isRestoring\") newState.fetchStatus = \"idle\";\n\t\t}\n\t\tlet { error, errorUpdatedAt, status } = newState;\n\t\tdata = newState.data;\n\t\tlet skipSelect = false;\n\t\tif (options.placeholderData !== void 0 && data === void 0 && status === \"pending\") {\n\t\t\tlet placeholderData;\n\t\t\tif (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) {\n\t\t\t\tplaceholderData = prevResult.data;\n\t\t\t\tskipSelect = true;\n\t\t\t} else placeholderData = typeof options.placeholderData === \"function\" ? options.placeholderData(this.#lastQueryWithDefinedData?.state.data, this.#lastQueryWithDefinedData) : options.placeholderData;\n\t\t\tif (placeholderData !== void 0) {\n\t\t\t\tstatus = \"success\";\n\t\t\t\tdata = replaceData(prevResult?.data, placeholderData, options);\n\t\t\t\tisPlaceholderData = true;\n\t\t\t}\n\t\t}\n\t\tif (options.select && data !== void 0 && !skipSelect) {\n\t\t\tif (prevResult && data === prevResultState?.data && options.select === this.#selectFn) data = this.#selectResult;\n\t\t\telse try {\n\t\t\t\tthis.#selectFn = options.select;\n\t\t\t\tdata = options.select(data);\n\t\t\t\tdata = replaceData(prevResult?.data, data, options);\n\t\t\t\tthis.#selectResult = data;\n\t\t\t\tthis.#selectError = null;\n\t\t\t} catch (selectError) {\n\t\t\t\tthis.#selectError = selectError;\n\t\t\t}\n\t\t} else if (data === void 0) this.#selectError = null;\n\t\tif (this.#selectError) {\n\t\t\terror = this.#selectError;\n\t\t\tdata = this.#selectResult;\n\t\t\terrorUpdatedAt = Date.now();\n\t\t\tstatus = \"error\";\n\t\t\tisPlaceholderData = false;\n\t\t}\n\t\tconst isFetching = newState.fetchStatus === \"fetching\";\n\t\tconst isPending = status === \"pending\";\n\t\tconst isError = status === \"error\";\n\t\tconst isLoading = isPending && isFetching;\n\t\tconst hasData = data !== void 0;\n\t\treturn {\n\t\t\tstatus,\n\t\t\tfetchStatus: newState.fetchStatus,\n\t\t\tisPending,\n\t\t\tisSuccess: status === \"success\",\n\t\t\tisError,\n\t\t\tisInitialLoading: isLoading,\n\t\t\tisLoading,\n\t\t\tdata,\n\t\t\tdataUpdatedAt: newState.dataUpdatedAt,\n\t\t\terror,\n\t\t\terrorUpdatedAt,\n\t\t\tfailureCount: newState.fetchFailureCount,\n\t\t\tfailureReason: newState.fetchFailureReason,\n\t\t\terrorUpdateCount: newState.errorUpdateCount,\n\t\t\tisFetched: query.isFetched(),\n\t\t\tisFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,\n\t\t\tisFetching,\n\t\t\tisRefetching: isFetching && !isPending,\n\t\t\tisLoadingError: isError && !hasData,\n\t\t\tisPaused: newState.fetchStatus === \"paused\",\n\t\t\tisPlaceholderData,\n\t\t\tisRefetchError: isError && hasData,\n\t\t\tisStale: isStale(query, options),\n\t\t\trefetch: this.refetch,\n\t\t\tisEnabled: resolveQueryValue(options.enabled, query) !== false\n\t\t};\n\t}\n\t/**\n\t* Recomputes and stores the current result from the current query/options, notifying listeners\n\t* if it changed. Framework adapters call this right after subscribing to make sure no query\n\t* update was missed in the gap between creating the observer and subscribing to it.\n\t*/\n\tupdateResult() {\n\t\tconst prevResult = this.#currentResult;\n\t\tconst nextResult = this.createResult(this.#currentQuery, this.options);\n\t\tthis.#currentResultState = this.#currentQuery.state;\n\t\tthis.#currentResultOptions = this.options;\n\t\tif (this.#currentResultState.data !== void 0) this.#lastQueryWithDefinedData = this.#currentQuery;\n\t\tif (shallowEqualObjects(nextResult, prevResult)) return;\n\t\tthis.#currentResult = nextResult;\n\t\tconst shouldNotifyListeners = () => {\n\t\t\tif (!prevResult) return true;\n\t\t\tconst { notifyOnChangeProps } = this.options;\n\t\t\tconst notifyOnChangePropsValue = typeof notifyOnChangeProps === \"function\" ? notifyOnChangeProps() : notifyOnChangeProps;\n\t\t\tif (notifyOnChangePropsValue === \"all\" || !notifyOnChangePropsValue && !this.#trackedProps.size) return true;\n\t\t\tconst includedProps = new Set(notifyOnChangePropsValue ?? this.#trackedProps);\n\t\t\tif (this.options.throwOnError) includedProps.add(\"error\");\n\t\t\treturn Object.keys(this.#currentResult).some((key) => {\n\t\t\t\tconst typedKey = key;\n\t\t\t\treturn this.#currentResult[typedKey] !== prevResult[typedKey] && includedProps.has(typedKey);\n\t\t\t});\n\t\t};\n\t\tconst notifyListeners = shouldNotifyListeners();\n\t\tnotifyManager.batch(() => {\n\t\t\tif (notifyListeners) this.listeners.forEach((listener) => {\n\t\t\t\tlistener(this.#currentResult);\n\t\t\t});\n\t\t\tthis.#client.getQueryCache().notify({\n\t\t\t\tquery: this.#currentQuery,\n\t\t\t\ttype: \"observerResultsUpdated\"\n\t\t\t});\n\t\t});\n\t}\n\t#updateQuery() {\n\t\tconst query = this.#client.getQueryCache().build(this.#client, this.options);\n\t\tif (query === this.#currentQuery) return;\n\t\tconst prevQuery = this.#currentQuery;\n\t\tthis.#currentQuery = query;\n\t\tthis.#currentQueryInitialState = query.state;\n\t\tif (this.hasListeners()) {\n\t\t\tprevQuery?.removeObserver(this);\n\t\t\tquery.addObserver(this);\n\t\t}\n\t}\n\t/** @internal */\n\tonQueryUpdate() {\n\t\tthis.updateResult();\n\t\tif (this.hasListeners()) this.#updateTimers();\n\t}\n};\nfunction shouldLoadOnMount(query, options) {\n\treturn resolveQueryValue(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === \"error\" && resolveQueryValue(options.retryOnMount, query) === false);\n}\nfunction shouldFetchOnMount(query, options) {\n\treturn shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);\n}\nfunction shouldFetchOn(query, options, field) {\n\tif (resolveQueryValue(options.enabled, query) !== false && resolveQueryValue(options.staleTime, query) !== \"static\") {\n\t\tconst value = resolveQueryValue(field, query);\n\t\treturn value === \"always\" || value !== false && isStale(query, options);\n\t}\n\treturn false;\n}\nfunction shouldFetchOptionally(query, prevQuery, options, prevOptions) {\n\treturn (query !== prevQuery || resolveQueryValue(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== \"error\") && isStale(query, options);\n}\nfunction isStale(query, options) {\n\treturn resolveQueryValue(options.enabled, query) !== false && query.isStaleByTime(resolveQueryValue(options.staleTime, query));\n}\n//#endregion\nexport { QueryObserver };\n\n//# sourceMappingURL=queryObserver.js.map","import { hasNextPage, hasPreviousPage } from \"./infiniteQueryBehavior.js\";\nimport { QueryObserver } from \"./queryObserver.js\";\n//#region src/infiniteQueryObserver.ts\n/**\n* An `InfiniteQueryObserver` extends `QueryObserver` to observe and switch\n* between infinite queries. It augments the base `QueryObserverResult` with\n* infinite-query-specific fields and methods, such as `hasNextPage` and\n* `fetchNextPage`, and is the primitive that framework adapters (e.g.\n* `useInfiniteQuery`) build their hooks on top of.\n*\n* @example\n* ```ts\n* const observer = new InfiniteQueryObserver(queryClient, {\n* queryKey: ['projects'],\n* queryFn: ({ pageParam }) => fetchProjects(pageParam),\n* initialPageParam: 0,\n* getNextPageParam: (lastPage) => lastPage.nextCursor,\n* })\n*\n* const unsubscribe = observer.subscribe((result) => console.log(result))\n* ```\n*/\nvar InfiniteQueryObserver = class extends QueryObserver {\n\tconstructor(client, options) {\n\t\tsuper(client, options);\n\t}\n\tbindMethods() {\n\t\tsuper.bindMethods();\n\t\tthis.fetchNextPage = this.fetchNextPage.bind(this);\n\t\tthis.fetchPreviousPage = this.fetchPreviousPage.bind(this);\n\t}\n\t/**\n\t* Updates the observer's options. Behaves the same as\n\t* `QueryObserver.setOptions`, additionally marking the options as\n\t* belonging to an infinite query before delegating to the base\n\t* implementation.\n\t*/\n\tsetOptions(options) {\n\t\toptions._type = \"infinite\";\n\t\tsuper.setOptions(options);\n\t}\n\t/**\n\t* The infinite-query counterpart of {@link QueryObserver#getOptimisticResult}, marking the\n\t* options as an infinite query before delegating to it. Called by framework adapters (e.g.\n\t* `useInfiniteQuery`) ahead of subscribing, to compute the current `InfiniteQueryObserverResult`\n\t* synchronously.\n\t*/\n\tgetOptimisticResult(options) {\n\t\toptions._type = \"infinite\";\n\t\treturn super.getOptimisticResult(options);\n\t}\n\t/**\n\t* Fetches the next page of the infinite query and returns a promise that\n\t* resolves with the resulting `InfiniteQueryObserverResult`. The page\n\t* param used for the fetch is determined by `getNextPageParam`, which\n\t* receives the current pages/page params and whose result also determines\n\t* `hasNextPage`.\n\t*\n\t* @example\n\t* ```ts\n\t* const { hasNextPage } = observer.getCurrentResult()\n\t*\n\t* if (hasNextPage) {\n\t* await observer.fetchNextPage()\n\t* }\n\t* ```\n\t*\n\t* @see {@link InfiniteQueryObserver#fetchPreviousPage}\n\t*/\n\tfetchNextPage(options) {\n\t\treturn this.fetch({\n\t\t\t...options,\n\t\t\tmeta: { fetchMore: { direction: \"forward\" } }\n\t\t});\n\t}\n\t/**\n\t* Fetches the previous page of the infinite query and returns a promise\n\t* that resolves with the resulting `InfiniteQueryObserverResult`. The page\n\t* param used for the fetch is determined by `getPreviousPageParam`, which\n\t* receives the current pages/page params and whose result also determines\n\t* `hasPreviousPage`.\n\t*\n\t* @example\n\t* ```ts\n\t* const { hasPreviousPage } = observer.getCurrentResult()\n\t*\n\t* if (hasPreviousPage) {\n\t* await observer.fetchPreviousPage()\n\t* }\n\t* ```\n\t*\n\t* @see {@link InfiniteQueryObserver#fetchNextPage}\n\t*/\n\tfetchPreviousPage(options) {\n\t\treturn this.fetch({\n\t\t\t...options,\n\t\t\tmeta: { fetchMore: { direction: \"backward\" } }\n\t\t});\n\t}\n\tcreateResult(query, options) {\n\t\tconst { state } = query;\n\t\tconst parentResult = super.createResult(query, options);\n\t\tconst { isFetching, isRefetching, isError, isRefetchError } = parentResult;\n\t\tconst fetchDirection = state.fetchMeta?.fetchMore?.direction;\n\t\tconst isFetchNextPageError = isError && fetchDirection === \"forward\";\n\t\tconst isFetchingNextPage = isFetching && fetchDirection === \"forward\";\n\t\tconst isFetchPreviousPageError = isError && fetchDirection === \"backward\";\n\t\tconst isFetchingPreviousPage = isFetching && fetchDirection === \"backward\";\n\t\treturn {\n\t\t\t...parentResult,\n\t\t\tfetchNextPage: this.fetchNextPage,\n\t\t\tfetchPreviousPage: this.fetchPreviousPage,\n\t\t\thasNextPage: hasNextPage(options, state.data),\n\t\t\thasPreviousPage: hasPreviousPage(options, state.data),\n\t\t\tisFetchNextPageError,\n\t\t\tisFetchingNextPage,\n\t\t\tisFetchPreviousPageError,\n\t\t\tisFetchingPreviousPage,\n\t\t\tisRefetchError: isRefetchError && !isFetchNextPageError && !isFetchPreviousPageError,\n\t\t\tisRefetching: isRefetching && !isFetchingNextPage && !isFetchingPreviousPage\n\t\t};\n\t}\n};\n//#endregion\nexport { InfiniteQueryObserver };\n\n//# sourceMappingURL=infiniteQueryObserver.js.map","import { notifyManager } from \"./notifyManager.js\";\nimport { createRetryer } from \"./retryer.js\";\nimport { Removable } from \"./removable.js\";\n//#region src/mutation.ts\n/**\n* Represents a single mutation attempt. A `Mutation` holds the mutation's\n* options, state (data/error/status), and the `MutationObserver`s currently\n* subscribed to it.\n*\n* Instances are created and managed internally by `MutationCache`; application\n* code typically interacts with mutations indirectly through `QueryClient` or\n* a framework hook like `useMutation`. Direct access to a `Mutation` instance\n* is possible via `mutationCache.find()`/`getAll()` for inspecting cache state.\n*\n* @example\n* ```ts\n* const mutationCache = queryClient.getMutationCache()\n*\n* const mutation = mutationCache.find({ mutationKey: ['addPost'] })\n* ```\n*/\nvar Mutation = class extends Removable {\n\t#client;\n\t#observers;\n\t#mutationCache;\n\t#retryer;\n\tconstructor(config) {\n\t\tsuper();\n\t\tthis.#client = config.client;\n\t\tthis.mutationId = config.mutationId;\n\t\tthis.#mutationCache = config.mutationCache;\n\t\tthis.#observers = [];\n\t\tthis.state = config.state || getDefaultState();\n\t\tthis.setOptions(config.options);\n\t\tthis.scheduleGc();\n\t}\n\t/** @internal */\n\tsetOptions(options) {\n\t\tthis.options = options;\n\t\tthis.updateGcTime(this.options.gcTime);\n\t}\n\t/**\n\t* The `meta` object passed in the mutation's options, if any.\n\t*/\n\tget meta() {\n\t\treturn this.options.meta;\n\t}\n\t/** @internal */\n\taddObserver(observer) {\n\t\tif (!this.#observers.includes(observer)) {\n\t\t\tthis.#observers.push(observer);\n\t\t\tthis.clearGcTimeout();\n\t\t\tthis.#mutationCache.notify({\n\t\t\t\ttype: \"observerAdded\",\n\t\t\t\tmutation: this,\n\t\t\t\tobserver\n\t\t\t});\n\t\t}\n\t}\n\t/** @internal */\n\tremoveObserver(observer) {\n\t\tthis.#observers = this.#observers.filter((x) => x !== observer);\n\t\tthis.scheduleGc();\n\t\tthis.#mutationCache.notify({\n\t\t\ttype: \"observerRemoved\",\n\t\t\tmutation: this,\n\t\t\tobserver\n\t\t});\n\t}\n\toptionalRemove() {\n\t\tif (!this.#observers.length) {\n\t\t\tif (this.state.status === \"pending\") this.scheduleGc();\n\t\t\telse this.#mutationCache.remove(this);\n\t\t}\n\t}\n\t/**\n\t* Resumes a mutation that is currently paused or was restored from a\n\t* dehydrated, still-`pending` state.\n\t*\n\t* - If this mutation has an active retryer (it paused mid-attempt, e.g. due\n\t* to the network mode or scope-based queuing), its retryer is resumed.\n\t* - Otherwise, if the mutation's status is still `pending` (e.g. it was\n\t* dehydrated while an attempt was in flight and never got a retryer in\n\t* this instance), `execute` is called again with the last known variables.\n\t* - Otherwise the mutation has already settled and this resolves immediately\n\t* without running anything again.\n\t*\n\t* @example\n\t* ```ts\n\t* // typically driven by reconnect handling, e.g. queryClient.resumePausedMutations()\n\t* const mutation = mutationCache.find({ mutationKey: ['addPost'] })\n\t* await mutation?.continue()\n\t* ```\n\t*\n\t* @see {@link Mutation#execute}\n\t*/\n\tcontinue() {\n\t\treturn this.#retryer?.continue() ?? (this.state.status === \"pending\" ? this.execute(this.state.variables) : Promise.resolve());\n\t}\n\t/**\n\t* Runs the mutation function for the given variables through a retryer, and\n\t* drives the mutation's state and lifecycle callbacks through to settlement.\n\t*\n\t* If this mutation's state is already `pending` when `execute` is called\n\t* (i.e. it was restored, still in-flight, from a dehydrated state), the\n\t* `onMutate` step is skipped and a `continue` action is dispatched to\n\t* unpause it; otherwise a `pending` action is dispatched first, then the\n\t* mutation cache's `onMutate` and the mutation's own `onMutate` option are\n\t* awaited in that order, and the resulting context is stored.\n\t*\n\t* The mutation function is then run (subject to `retry`/`retryDelay`/\n\t* `networkMode`, and to the mutation cache's scope-based serialization).\n\t* On success, the cache's `onSuccess`/`onSettled` callbacks run before the\n\t* mutation's own `onSuccess`/`onSettled` options, a `success` action is\n\t* dispatched, and the resolved data is returned. On failure, the same\n\t* cache-then-option ordering is used for `onError`/`onSettled`, but each of\n\t* those four callbacks is individually caught so that a throwing callback\n\t* cannot mask the original error; an `error` action is then dispatched and\n\t* the original error is re-thrown.\n\t*\n\t* @example\n\t* ```ts\n\t* // Called internally by `MutationObserver.mutate` and `Mutation.continue` —\n\t* // applications normally trigger mutations through those, not this method.\n\t* const data = await mutation.execute(variables)\n\t* ```\n\t*\n\t* @see {@link Mutation#continue}\n\t*/\n\tasync execute(variables) {\n\t\tconst onContinue = () => {\n\t\t\tthis.#dispatch({ type: \"continue\" });\n\t\t};\n\t\tconst mutationFnContext = {\n\t\t\tclient: this.#client,\n\t\t\tmeta: this.options.meta,\n\t\t\tmutationKey: this.options.mutationKey\n\t\t};\n\t\tconst retryer = this.#retryer = createRetryer({\n\t\t\tfn: () => {\n\t\t\t\tif (!this.options.mutationFn) return Promise.reject(/* @__PURE__ */ new Error(\"No mutationFn found\"));\n\t\t\t\treturn this.options.mutationFn(variables, mutationFnContext);\n\t\t\t},\n\t\t\tonFail: (failureCount, error) => {\n\t\t\t\tthis.#dispatch({\n\t\t\t\t\ttype: \"failed\",\n\t\t\t\t\tfailureCount,\n\t\t\t\t\terror\n\t\t\t\t});\n\t\t\t},\n\t\t\tonPause: () => {\n\t\t\t\tthis.#dispatch({ type: \"pause\" });\n\t\t\t},\n\t\t\tonContinue,\n\t\t\tretry: this.options.retry ?? 0,\n\t\t\tretryDelay: this.options.retryDelay,\n\t\t\tnetworkMode: this.options.networkMode,\n\t\t\tcanRun: () => this.#mutationCache.canRun(this)\n\t\t});\n\t\tconst restored = this.state.status === \"pending\";\n\t\tconst isPaused = !retryer.canStart();\n\t\ttry {\n\t\t\tif (restored) onContinue();\n\t\t\telse {\n\t\t\t\tthis.#dispatch({\n\t\t\t\t\ttype: \"pending\",\n\t\t\t\t\tvariables,\n\t\t\t\t\tisPaused\n\t\t\t\t});\n\t\t\t\tif (this.#mutationCache.config.onMutate) await this.#mutationCache.config.onMutate(variables, this, mutationFnContext);\n\t\t\t\tconst context = await this.options.onMutate?.(variables, mutationFnContext);\n\t\t\t\tif (context !== this.state.context) this.#dispatch({\n\t\t\t\t\ttype: \"pending\",\n\t\t\t\t\tcontext,\n\t\t\t\t\tvariables,\n\t\t\t\t\tisPaused\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst data = await retryer.start();\n\t\t\tawait this.#mutationCache.config.onSuccess?.(data, variables, this.state.context, this, mutationFnContext);\n\t\t\tawait this.options.onSuccess?.(data, variables, this.state.context, mutationFnContext);\n\t\t\tawait this.#mutationCache.config.onSettled?.(data, null, this.state.variables, this.state.context, this, mutationFnContext);\n\t\t\tawait this.options.onSettled?.(data, null, variables, this.state.context, mutationFnContext);\n\t\t\tthis.#dispatch({\n\t\t\t\ttype: \"success\",\n\t\t\t\tdata\n\t\t\t});\n\t\t\treturn data;\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\tawait this.#mutationCache.config.onError?.(error, variables, this.state.context, this, mutationFnContext);\n\t\t\t} catch (e) {\n\t\t\t\tPromise.reject(e);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait this.options.onError?.(error, variables, this.state.context, mutationFnContext);\n\t\t\t} catch (e) {\n\t\t\t\tPromise.reject(e);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait this.#mutationCache.config.onSettled?.(void 0, error, this.state.variables, this.state.context, this, mutationFnContext);\n\t\t\t} catch (e) {\n\t\t\t\tPromise.reject(e);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait this.options.onSettled?.(void 0, error, variables, this.state.context, mutationFnContext);\n\t\t\t} catch (e) {\n\t\t\t\tPromise.reject(e);\n\t\t\t}\n\t\t\tthis.#dispatch({\n\t\t\t\ttype: \"error\",\n\t\t\t\terror\n\t\t\t});\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tif (this.#retryer === retryer) this.#retryer = void 0;\n\t\t\tthis.#mutationCache.runNext(this);\n\t\t}\n\t}\n\t#dispatch(action) {\n\t\tconst reducer = (state) => {\n\t\t\tswitch (action.type) {\n\t\t\t\tcase \"failed\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tfailureCount: action.failureCount,\n\t\t\t\t\tfailureReason: action.error\n\t\t\t\t};\n\t\t\t\tcase \"pause\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tisPaused: true\n\t\t\t\t};\n\t\t\t\tcase \"continue\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tisPaused: false\n\t\t\t\t};\n\t\t\t\tcase \"pending\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tcontext: action.context,\n\t\t\t\t\tdata: void 0,\n\t\t\t\t\tfailureCount: 0,\n\t\t\t\t\tfailureReason: null,\n\t\t\t\t\terror: null,\n\t\t\t\t\tisPaused: action.isPaused,\n\t\t\t\t\tstatus: \"pending\",\n\t\t\t\t\tvariables: action.variables,\n\t\t\t\t\tsubmittedAt: Date.now()\n\t\t\t\t};\n\t\t\t\tcase \"success\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tdata: action.data,\n\t\t\t\t\tfailureCount: 0,\n\t\t\t\t\tfailureReason: null,\n\t\t\t\t\terror: null,\n\t\t\t\t\tstatus: \"success\",\n\t\t\t\t\tisPaused: false\n\t\t\t\t};\n\t\t\t\tcase \"error\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tdata: void 0,\n\t\t\t\t\terror: action.error,\n\t\t\t\t\tfailureCount: state.failureCount + 1,\n\t\t\t\t\tfailureReason: action.error,\n\t\t\t\t\tisPaused: false,\n\t\t\t\t\tstatus: \"error\"\n\t\t\t\t};\n\t\t\t}\n\t\t};\n\t\tthis.state = reducer(this.state);\n\t\tnotifyManager.batch(() => {\n\t\t\tthis.#observers.forEach((observer) => {\n\t\t\t\tobserver.onMutationUpdate(action);\n\t\t\t});\n\t\t\tthis.#mutationCache.notify({\n\t\t\t\tmutation: this,\n\t\t\t\ttype: \"updated\",\n\t\t\t\taction\n\t\t\t});\n\t\t});\n\t}\n};\nfunction getDefaultState() {\n\treturn {\n\t\tcontext: void 0,\n\t\tdata: void 0,\n\t\terror: null,\n\t\tfailureCount: 0,\n\t\tfailureReason: null,\n\t\tisPaused: false,\n\t\tstatus: \"idle\",\n\t\tvariables: void 0,\n\t\tsubmittedAt: 0\n\t};\n}\n//#endregion\nexport { Mutation, getDefaultState };\n\n//# sourceMappingURL=mutation.js.map","import { matchMutation, noop } from \"./utils.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { Mutation } from \"./mutation.js\";\n//#region src/mutationCache.ts\n/**\n* The `MutationCache` is the storage for mutations.\n*\n* Normally, you will not interact with the `MutationCache` directly and instead use a\n* `QueryClient`. You can subscribe to it (inherited from `Subscribable`) to be informed of\n* safe/known updates to the cache, such as mutations being added, removed, or updated.\n*\n* @example\n* ```ts\n* const unsubscribe = mutationCache.subscribe((event) => {\n* console.log(event.type, event.mutation)\n* })\n* ```\n*/\nvar MutationCache = class extends Subscribable {\n\t#mutations;\n\t#scopes;\n\t#mutationId;\n\tconstructor(config = {}) {\n\t\tsuper();\n\t\tthis.config = config;\n\t\tthis.#mutations = /* @__PURE__ */ new Set();\n\t\tthis.#scopes = /* @__PURE__ */ new Map();\n\t\tthis.#mutationId = 0;\n\t}\n\t/** @internal */\n\tbuild(client, options, state) {\n\t\tconst mutation = new Mutation({\n\t\t\tclient,\n\t\t\tmutationCache: this,\n\t\t\tmutationId: ++this.#mutationId,\n\t\t\toptions: client.defaultMutationOptions(options),\n\t\t\tstate\n\t\t});\n\t\tthis.add(mutation);\n\t\treturn mutation;\n\t}\n\t/** @internal */\n\tadd(mutation) {\n\t\tthis.#mutations.add(mutation);\n\t\tconst scope = scopeFor(mutation);\n\t\tif (typeof scope === \"string\") {\n\t\t\tconst scopedMutations = this.#scopes.get(scope);\n\t\t\tif (scopedMutations) scopedMutations.push(mutation);\n\t\t\telse this.#scopes.set(scope, [mutation]);\n\t\t}\n\t\tthis.notify({\n\t\t\ttype: \"added\",\n\t\t\tmutation\n\t\t});\n\t}\n\t/** @internal */\n\tremove(mutation) {\n\t\tif (this.#mutations.delete(mutation)) {\n\t\t\tconst scope = scopeFor(mutation);\n\t\t\tif (typeof scope === \"string\") {\n\t\t\t\tconst scopedMutations = this.#scopes.get(scope);\n\t\t\t\tif (scopedMutations) {\n\t\t\t\t\tif (scopedMutations.length > 1) {\n\t\t\t\t\t\tconst index = scopedMutations.indexOf(mutation);\n\t\t\t\t\t\tif (index !== -1) scopedMutations.splice(index, 1);\n\t\t\t\t\t} else if (scopedMutations[0] === mutation) this.#scopes.delete(scope);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.notify({\n\t\t\ttype: \"removed\",\n\t\t\tmutation\n\t\t});\n\t}\n\t/** @internal */\n\tcanRun(mutation) {\n\t\tconst scope = scopeFor(mutation);\n\t\tif (typeof scope === \"string\") {\n\t\t\tconst firstPendingMutation = this.#scopes.get(scope)?.find((m) => m.state.status === \"pending\");\n\t\t\treturn !firstPendingMutation || firstPendingMutation === mutation;\n\t\t} else return true;\n\t}\n\t/** @internal */\n\trunNext(mutation) {\n\t\tconst scope = scopeFor(mutation);\n\t\tif (typeof scope === \"string\") return (this.#scopes.get(scope)?.find((m) => m !== mutation && m.state.isPaused))?.continue() ?? Promise.resolve();\n\t\telse return Promise.resolve();\n\t}\n\t/**\n\t* Removes all mutations from the cache.\n\t*\n\t* @example\n\t* ```ts\n\t* const mutationCache = queryClient.getMutationCache()\n\t*\n\t* mutationCache.clear()\n\t* ```\n\t*/\n\tclear() {\n\t\tnotifyManager.batch(() => {\n\t\t\tthis.#mutations.forEach((mutation) => {\n\t\t\t\tthis.notify({\n\t\t\t\t\ttype: \"removed\",\n\t\t\t\t\tmutation\n\t\t\t\t});\n\t\t\t});\n\t\t\tthis.#mutations.clear();\n\t\t\tthis.#scopes.clear();\n\t\t});\n\t}\n\t/**\n\t* Returns all mutations within the cache.\n\t*\n\t* This is not typically needed for most applications, but can come in handy when needing more\n\t* information about a mutation in rare scenarios.\n\t*\n\t* @example\n\t* ```ts\n\t* const mutationCache = queryClient.getMutationCache()\n\t*\n\t* const mutations = mutationCache.getAll()\n\t* ```\n\t*/\n\tgetAll() {\n\t\treturn Array.from(this.#mutations);\n\t}\n\t/**\n\t* A slightly more advanced method that can be used to get an existing mutation instance from\n\t* the cache. If the mutation does not exist, `undefined` is returned.\n\t*\n\t* This is not typically needed for most applications, but can come in handy when needing more\n\t* information about a mutation in rare scenarios.\n\t*\n\t* @see {@link MutationCache#findAll}\n\t* @example\n\t* ```ts\n\t* const mutationCache = queryClient.getMutationCache()\n\t*\n\t* const mutation = mutationCache.find({ mutationKey: ['addPost'] })\n\t* ```\n\t*/\n\tfind(filters) {\n\t\tconst defaultedFilters = {\n\t\t\texact: true,\n\t\t\t...filters\n\t\t};\n\t\treturn this.getAll().find((mutation) => matchMutation(defaultedFilters, mutation));\n\t}\n\t/**\n\t* An even more advanced method that can be used to get existing mutation instances from the\n\t* cache that match the given filters. If no mutations match, an empty array is returned.\n\t*\n\t* This is not typically needed for most applications, but can come in handy when needing more\n\t* information about mutations in rare scenarios.\n\t*\n\t* @see {@link MutationCache#find}\n\t* @example\n\t* ```ts\n\t* const mutationCache = queryClient.getMutationCache()\n\t*\n\t* const mutations = mutationCache.findAll({ mutationKey: ['addPost'] })\n\t* ```\n\t*/\n\tfindAll(filters = {}) {\n\t\treturn this.getAll().filter((mutation) => matchMutation(filters, mutation));\n\t}\n\t/** @internal */\n\tnotify(event) {\n\t\tnotifyManager.batch(() => {\n\t\t\tthis.listeners.forEach((listener) => {\n\t\t\t\tlistener(event);\n\t\t\t});\n\t\t});\n\t}\n\t/** @internal */\n\tresumePausedMutations() {\n\t\tconst pausedMutations = this.getAll().filter((x) => x.state.isPaused);\n\t\treturn notifyManager.batch(() => Promise.all(pausedMutations.map((mutation) => mutation.continue().catch(noop))));\n\t}\n};\nfunction scopeFor(mutation) {\n\treturn mutation.options.scope?.id;\n}\n//#endregion\nexport { MutationCache };\n\n//# sourceMappingURL=mutationCache.js.map","import { hashKey, shallowEqualObjects } from \"./utils.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { getDefaultState } from \"./mutation.js\";\n//#region src/mutationObserver.ts\n/**\n* Observes a single mutation and derives a `MutationObserverResult` from it.\n* A framework hook like `useMutation` creates one `MutationObserver` per hook\n* call, keeps it stable across re-renders, calls `setOptions` when the options\n* passed to the hook change, subscribes to it to re-render on updates, and\n* reads `getCurrentResult()` for the value to return. Calling `mutate()`\n* builds a new underlying `Mutation` in the `MutationCache` and executes it.\n*\n* @example\n* ```ts\n* const observer = new MutationObserver(queryClient, {\n* mutationFn: (variables: { title: string }) => addPost(variables),\n* })\n* ```\n*/\nvar MutationObserver = class extends Subscribable {\n\t#client;\n\t#currentResult = void 0;\n\t#currentMutation;\n\t#mutateOptions;\n\tconstructor(client, options) {\n\t\tsuper();\n\t\tthis.#client = client;\n\t\tthis.setOptions(options);\n\t\tthis.bindMethods();\n\t\tthis.#updateResult();\n\t}\n\tbindMethods() {\n\t\tthis.mutate = this.mutate.bind(this);\n\t\tthis.reset = this.reset.bind(this);\n\t}\n\t/**\n\t* Updates the observer's options.\n\t*\n\t* If the new `mutationKey` differs from the previous one (and both were\n\t* defined), the observer is reset, detaching it from the mutation it was\n\t* observing. Otherwise, if the currently observed mutation is still\n\t* `pending`, its options are updated in place as well.\n\t*\n\t* @example\n\t* ```ts\n\t* observer.setOptions({\n\t* mutationFn: (variables: { title: string }) => addPost(variables),\n\t* onSuccess: (data) => console.log(data),\n\t* })\n\t* ```\n\t*/\n\tsetOptions(options) {\n\t\tconst prevOptions = this.options;\n\t\tthis.options = this.#client.defaultMutationOptions(options);\n\t\tif (!shallowEqualObjects(this.options, prevOptions)) this.#client.getMutationCache().notify({\n\t\t\ttype: \"observerOptionsUpdated\",\n\t\t\tmutation: this.#currentMutation,\n\t\t\tobserver: this\n\t\t});\n\t\tif (prevOptions?.mutationKey && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) this.reset();\n\t\telse if (this.#currentMutation?.state.status === \"pending\") this.#currentMutation.setOptions(this.options);\n\t}\n\tonSubscribe() {\n\t\tif (this.listeners.size === 1 && this.#currentMutation) {\n\t\t\tthis.#currentMutation.addObserver(this);\n\t\t\tthis.#updateResult();\n\t\t}\n\t}\n\tonUnsubscribe() {\n\t\tif (!this.hasListeners()) this.#currentMutation?.removeObserver(this);\n\t}\n\t/** @internal */\n\tonMutationUpdate(action) {\n\t\tthis.#updateResult();\n\t\tthis.#notify(action);\n\t}\n\t/**\n\t* Returns the observer's current result, derived from the observed\n\t* mutation's state (or the default, `idle` state if no mutation has been\n\t* built yet, e.g. before the first `mutate()` call or after `reset()`).\n\t*/\n\tgetCurrentResult() {\n\t\treturn this.#currentResult;\n\t}\n\t/**\n\t* Detaches the observer from the mutation it is currently observing (if\n\t* any) and resets the observed result back to its default, `idle` state.\n\t*\n\t* This does not cancel an in-flight mutation; the mutation itself keeps\n\t* running to completion and its own callbacks still fire, but this\n\t* observer stops reflecting its state and a subsequent `mutate()` call\n\t* will build a brand new mutation.\n\t*\n\t* @example\n\t* ```ts\n\t* observer.reset()\n\t* ```\n\t*\n\t* @see {@link MutationObserver#mutate}\n\t*/\n\treset() {\n\t\tthis.#currentMutation?.removeObserver(this);\n\t\tthis.#currentMutation = void 0;\n\t\tthis.#updateResult();\n\t\tthis.#notify();\n\t}\n\t/**\n\t* Builds a new `Mutation` in the `MutationCache` using the observer's\n\t* current options, detaches this observer from any previously observed\n\t* mutation, attaches it to the new one, and executes it with the given\n\t* variables.\n\t*\n\t* The optional per-call `options` (`onSuccess`/`onError`/`onSettled`) are\n\t* invoked once the mutation settles, in addition to any callbacks defined\n\t* on the observer's own options.\n\t*\n\t* @example\n\t* ```ts\n\t* await observer.mutate(\n\t* { title: 'New post' },\n\t* { onSuccess: (data) => console.log(data) },\n\t* )\n\t* ```\n\t*/\n\tmutate(variables, options) {\n\t\tthis.#mutateOptions = options;\n\t\tthis.#currentMutation?.removeObserver(this);\n\t\tthis.#currentMutation = this.#client.getMutationCache().build(this.#client, this.options);\n\t\tthis.#currentMutation.addObserver(this);\n\t\treturn this.#currentMutation.execute(variables);\n\t}\n\t#updateResult() {\n\t\tconst state = this.#currentMutation?.state ?? getDefaultState();\n\t\tthis.#currentResult = {\n\t\t\t...state,\n\t\t\tisPending: state.status === \"pending\",\n\t\t\tisSuccess: state.status === \"success\",\n\t\t\tisError: state.status === \"error\",\n\t\t\tisIdle: state.status === \"idle\",\n\t\t\tmutate: this.mutate,\n\t\t\treset: this.reset\n\t\t};\n\t}\n\t#notify(action) {\n\t\tnotifyManager.batch(() => {\n\t\t\tif (this.#mutateOptions && this.hasListeners()) {\n\t\t\t\tconst variables = this.#currentResult.variables;\n\t\t\t\tconst onMutateResult = this.#currentResult.context;\n\t\t\t\tconst context = {\n\t\t\t\t\tclient: this.#client,\n\t\t\t\t\tmeta: this.options.meta,\n\t\t\t\t\tmutationKey: this.options.mutationKey\n\t\t\t\t};\n\t\t\t\tif (action?.type === \"success\") {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.#mutateOptions.onSuccess?.(action.data, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.#mutateOptions.onSettled?.(action.data, null, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t} else if (action?.type === \"error\") {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.#mutateOptions.onError?.(action.error, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.#mutateOptions.onSettled?.(void 0, action.error, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.listeners.forEach((listener) => {\n\t\t\t\tlistener(this.#currentResult);\n\t\t\t});\n\t\t});\n\t}\n};\n//#endregion\nexport { MutationObserver };\n\n//# sourceMappingURL=mutationObserver.js.map","import { replaceEqualDeep, shallowEqualObjects } from \"./utils.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { QueryObserver } from \"./queryObserver.js\";\n//#region src/queriesObserver.ts\nfunction difference(array1, array2) {\n\tconst excludeSet = new Set(array2);\n\treturn array1.filter((x) => !excludeSet.has(x));\n}\n/**\n* A `QueriesObserver` watches an array of queries at once, exposing them as\n* a single array of `QueryObserverResult`s (or, when a `combine` option is\n* given, as a combined value derived from that array). It manages one\n* internal `QueryObserver` per query, and is the primitive that framework\n* adapters (e.g. `useQueries`) build their hooks on top of.\n*\n* @example\n* ```ts\n* const observer = new QueriesObserver(queryClient, [\n* { queryKey: ['post', 1], queryFn: fetchPost },\n* { queryKey: ['post', 2], queryFn: fetchPost },\n* ])\n*\n* const unsubscribe = observer.subscribe((result) => {\n* console.log(result)\n* })\n* ```\n*/\nvar QueriesObserver = class extends Subscribable {\n\t#client;\n\t#result;\n\t#queries;\n\t#options;\n\t#observers;\n\t#combinedResult;\n\t#lastCombine;\n\t#lastResult;\n\t#lastQueryHashes;\n\t#observerMatches = [];\n\tconstructor(client, queries, options) {\n\t\tsuper();\n\t\tthis.#client = client;\n\t\tthis.#options = options;\n\t\tthis.#queries = [];\n\t\tthis.#observers = [];\n\t\tthis.#result = [];\n\t\tthis.setQueries(queries);\n\t}\n\tonSubscribe() {\n\t\tif (this.listeners.size === 1) this.#observers.forEach((observer) => {\n\t\t\tobserver.subscribe((result) => {\n\t\t\t\tthis.#onUpdate(observer, result);\n\t\t\t});\n\t\t});\n\t}\n\tonUnsubscribe() {\n\t\tif (!this.listeners.size) this.destroy();\n\t}\n\t/**\n\t* Stops observing all queries: clears all listeners and destroys every\n\t* underlying `QueryObserver` this observer manages.\n\t*/\n\tdestroy() {\n\t\tthis.listeners = /* @__PURE__ */ new Set();\n\t\tthis.#observers.forEach((observer) => {\n\t\t\tobserver.destroy();\n\t\t});\n\t}\n\t/**\n\t* Replaces the set of queries being observed. Existing `QueryObserver`s\n\t* are reused for queries that match an already-observed query hash;\n\t* observers for queries that are no longer present are destroyed, and new\n\t* observers are created and subscribed to for newly added queries.\n\t*\n\t* @example\n\t* ```ts\n\t* observer.setQueries([\n\t* { queryKey: ['post', 1], queryFn: fetchPost },\n\t* { queryKey: ['post', 3], queryFn: fetchPost },\n\t* ])\n\t* ```\n\t*/\n\tsetQueries(queries, options) {\n\t\tthis.#queries = queries;\n\t\tthis.#options = options;\n\t\tif (process.env.NODE_ENV !== \"production\") {\n\t\t\tconst queryHashes = queries.map((query) => this.#client.defaultQueryOptions(query).queryHash);\n\t\t\tif (new Set(queryHashes).size !== queryHashes.length) console.warn(\"[QueriesObserver]: Duplicate Queries found. This might result in unexpected behavior.\");\n\t\t}\n\t\tnotifyManager.batch(() => {\n\t\t\tconst prevObservers = this.#observers;\n\t\t\tconst newObserverMatches = this.#findMatchingObservers(this.#queries);\n\t\t\tnewObserverMatches.forEach((match) => match.observer.setOptions(match.defaultedQueryOptions));\n\t\t\tconst newObservers = newObserverMatches.map((match) => match.observer);\n\t\t\tconst newResult = newObservers.map((observer) => observer.getCurrentResult());\n\t\t\tconst hasLengthChange = prevObservers.length !== newObservers.length;\n\t\t\tconst hasIndexChange = newObservers.some((observer, index) => observer !== prevObservers[index]);\n\t\t\tconst hasStructuralChange = hasLengthChange || hasIndexChange;\n\t\t\tconst hasResultChange = hasStructuralChange ? true : newResult.some((result, index) => {\n\t\t\t\tconst prev = this.#result[index];\n\t\t\t\treturn !prev || !shallowEqualObjects(result, prev);\n\t\t\t});\n\t\t\tif (!hasStructuralChange && !hasResultChange) return;\n\t\t\tif (hasStructuralChange) {\n\t\t\t\tthis.#observerMatches = newObserverMatches;\n\t\t\t\tthis.#observers = newObservers;\n\t\t\t}\n\t\t\tthis.#result = newResult;\n\t\t\tif (!this.hasListeners()) return;\n\t\t\tif (hasStructuralChange) {\n\t\t\t\tdifference(prevObservers, newObservers).forEach((observer) => {\n\t\t\t\t\tobserver.destroy();\n\t\t\t\t});\n\t\t\t\tdifference(newObservers, prevObservers).forEach((observer) => {\n\t\t\t\t\tobserver.subscribe((result) => {\n\t\t\t\t\t\tthis.#onUpdate(observer, result);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis.#notify();\n\t\t});\n\t}\n\t/**\n\t* Returns the most recently computed array of `QueryObserverResult`s, one\n\t* per observed query, in the same order as the queries passed to the\n\t* constructor or `setQueries`.\n\t*\n\t* @example\n\t* ```ts\n\t* const results = observer.getCurrentResult()\n\t* const data = results.map((result) => result.data)\n\t* ```\n\t*/\n\tgetCurrentResult() {\n\t\treturn this.#result;\n\t}\n\t/**\n\t* Returns the underlying `Query` instances currently being observed, in\n\t* the same order as the queries passed to the constructor or `setQueries`.\n\t*/\n\tgetQueries() {\n\t\treturn this.#observers.map((observer) => observer.getCurrentQuery());\n\t}\n\t/**\n\t* Returns the underlying `QueryObserver` instances this observer manages,\n\t* in the same order as the queries passed to the constructor or\n\t* `setQueries`.\n\t*/\n\tgetObservers() {\n\t\treturn this.#observers;\n\t}\n\t/**\n\t* The `QueriesObserver` counterpart of {@link QueryObserver#getOptimisticResult} — computes\n\t* the result for the given (already-defaulted) queries right now, synchronously. Called by\n\t* framework adapters (e.g. `useQueries`) ahead of subscribing, returning a tuple of the raw\n\t* per-query results, a function to compute the combined result from them, and a function to\n\t* wrap the results for property-access tracking.\n\t*/\n\tgetOptimisticResult(queries, combine) {\n\t\tconst matches = this.#findMatchingObservers(queries);\n\t\tconst result = matches.map((match) => match.observer.getOptimisticResult(match.defaultedQueryOptions));\n\t\tconst queryHashes = matches.map((match) => match.defaultedQueryOptions.queryHash);\n\t\treturn [\n\t\t\tresult,\n\t\t\t(r) => {\n\t\t\t\treturn this.#combineResult(r ?? result, combine, queryHashes);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\treturn this.#trackResult(result, matches);\n\t\t\t}\n\t\t];\n\t}\n\t#trackResult(result, matches) {\n\t\tconst trackedProps = /* @__PURE__ */ new Set();\n\t\treturn matches.map((match, index) => {\n\t\t\tconst observerResult = result[index];\n\t\t\treturn !match.defaultedQueryOptions.notifyOnChangeProps ? match.observer.trackResult(observerResult, (accessedProp) => {\n\t\t\t\tif (!trackedProps.has(accessedProp)) {\n\t\t\t\t\ttrackedProps.add(accessedProp);\n\t\t\t\t\tmatches.forEach((m) => {\n\t\t\t\t\t\tm.observer.trackProp(accessedProp);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}) : observerResult;\n\t\t});\n\t}\n\t#combineResult(input, combine, queryHashes) {\n\t\tif (combine) {\n\t\t\tconst lastHashes = this.#lastQueryHashes;\n\t\t\tconst queryHashesChanged = queryHashes !== void 0 && lastHashes !== void 0 && (lastHashes.length !== queryHashes.length || queryHashes.some((hash, i) => hash !== lastHashes[i]));\n\t\t\tif (this.#result !== this.#lastResult || queryHashesChanged || combine !== this.#lastCombine) {\n\t\t\t\tthis.#lastCombine = combine;\n\t\t\t\tthis.#lastResult = this.#result;\n\t\t\t\tif (queryHashes !== void 0) this.#lastQueryHashes = queryHashes;\n\t\t\t\tthis.#combinedResult = replaceEqualDeep(this.#combinedResult, combine(input));\n\t\t\t}\n\t\t\treturn this.#combinedResult;\n\t\t}\n\t\treturn input;\n\t}\n\t#shouldSkipCombine() {\n\t\treturn !this.#options?.combine || this.#observers.some((observer, index) => {\n\t\t\treturn observer.options.suspense && this.#result[index]?.data === void 0;\n\t\t});\n\t}\n\t#findMatchingObservers(queries) {\n\t\tconst prevObserversMap = /* @__PURE__ */ new Map();\n\t\tthis.#observers.forEach((observer) => {\n\t\t\tconst key = observer.options.queryHash;\n\t\t\tif (!key) return;\n\t\t\tconst previousObservers = prevObserversMap.get(key);\n\t\t\tif (previousObservers) previousObservers.push(observer);\n\t\t\telse prevObserversMap.set(key, [observer]);\n\t\t});\n\t\tconst observers = [];\n\t\tqueries.forEach((options) => {\n\t\t\tconst defaultedOptions = this.#client.defaultQueryOptions(options);\n\t\t\tconst observer = prevObserversMap.get(defaultedOptions.queryHash)?.shift() ?? new QueryObserver(this.#client, defaultedOptions);\n\t\t\tobservers.push({\n\t\t\t\tdefaultedQueryOptions: defaultedOptions,\n\t\t\t\tobserver\n\t\t\t});\n\t\t});\n\t\treturn observers;\n\t}\n\t#onUpdate(observer, result) {\n\t\tconst index = this.#observers.indexOf(observer);\n\t\tif (index !== -1) {\n\t\t\tthis.#result = this.#result.slice();\n\t\t\tthis.#result[index] = result;\n\t\t\tthis.#notify();\n\t\t}\n\t}\n\t#notify() {\n\t\tif (this.hasListeners()) {\n\t\t\tconst shouldSkipCombine = this.#shouldSkipCombine();\n\t\t\tconst previousResult = this.#combinedResult;\n\t\t\tconst newResult = shouldSkipCombine ? previousResult : this.#combineResult(this.#trackResult(this.#result, this.#observerMatches), this.#options?.combine);\n\t\t\tif (shouldSkipCombine || previousResult !== newResult) notifyManager.batch(() => {\n\t\t\t\tthis.listeners.forEach((listener) => {\n\t\t\t\t\tlistener(this.#result);\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\t}\n};\n//#endregion\nexport { QueriesObserver };\n\n//# sourceMappingURL=queriesObserver.js.map","import { hashQueryKeyByOptions, matchQuery } from \"./utils.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { Query } from \"./query.js\";\n//#region src/queryCache.ts\n/**\n* The `QueryCache` is the storage mechanism for TanStack Query. It stores all the data, meta\n* information, and state of the queries it contains.\n*\n* Normally, you will not interact with the `QueryCache` directly and instead use a `QueryClient`\n* for a specific cache. You can subscribe to it (inherited from `Subscribable`) to be informed of\n* safe/known updates to the cache, such as queries being added, removed, or updated — updates made\n* outside of the cache's own tracked mechanisms (e.g. mutating a query's state object directly) do\n* not notify subscribers.\n*\n* @example\n* ```ts\n* const unsubscribe = queryCache.subscribe((event) => {\n* console.log(event.type, event.query)\n* })\n* ```\n*/\nvar QueryCache = class extends Subscribable {\n\t#queries;\n\tconstructor(config = {}) {\n\t\tsuper();\n\t\tthis.config = config;\n\t\tthis.#queries = /* @__PURE__ */ new Map();\n\t}\n\t/**\n\t* Returns the existing `Query` instance for the given options' `queryKey`/`queryHash`, or\n\t* builds and adds a new one to the cache if none exists yet. Used by framework adapters and\n\t* plugins (e.g. broadcast/persistence) that need to get-or-create a `Query` directly, bypassing\n\t* the reactive `QueryObserver` machinery.\n\t*\n\t* @example\n\t* ```ts\n\t* const queryCache = queryClient.getQueryCache()\n\t*\n\t* const query = queryCache.build(queryClient, {\n\t* queryKey: ['posts'],\n\t* queryFn: fetchPosts,\n\t* })\n\t* ```\n\t*/\n\tbuild(client, options, state) {\n\t\tconst queryKey = options.queryKey;\n\t\tconst queryHash = options.queryHash ?? hashQueryKeyByOptions(queryKey, options);\n\t\tlet query = this.get(queryHash);\n\t\tif (!query) {\n\t\t\tquery = new Query({\n\t\t\t\tclient,\n\t\t\t\tqueryKey,\n\t\t\t\tqueryHash,\n\t\t\t\toptions: client.defaultQueryOptions(options),\n\t\t\t\tstate,\n\t\t\t\tdefaultOptions: client.getQueryDefaults(queryKey)\n\t\t\t});\n\t\t\tthis.add(query);\n\t\t}\n\t\treturn query;\n\t}\n\t/** @internal */\n\tadd(query) {\n\t\tif (!this.#queries.has(query.queryHash)) {\n\t\t\tthis.#queries.set(query.queryHash, query);\n\t\t\tthis.notify({\n\t\t\t\ttype: \"added\",\n\t\t\t\tquery\n\t\t\t});\n\t\t}\n\t}\n\t/**\n\t* Destroys the given `Query` and removes it from the cache, notifying subscribers with a\n\t* `'removed'` event. A no-op if the query is no longer the one currently stored under its hash\n\t* (e.g. it was already replaced). Used by plugins (e.g. the broadcast client) that mirror\n\t* removals across `QueryCache` instances.\n\t*\n\t* @example\n\t* ```ts\n\t* const queryCache = queryClient.getQueryCache()\n\t* const query = queryCache.find({ queryKey: ['posts'] })\n\t*\n\t* if (query) {\n\t* queryCache.remove(query)\n\t* }\n\t* ```\n\t*/\n\tremove(query) {\n\t\tif (this.#queries.get(query.queryHash) === query) {\n\t\t\tquery.destroy();\n\t\t\tthis.#queries.delete(query.queryHash);\n\t\t\tthis.notify({\n\t\t\t\ttype: \"removed\",\n\t\t\t\tquery\n\t\t\t});\n\t\t}\n\t}\n\t/**\n\t* Removes all queries from the cache.\n\t*\n\t* @example\n\t* ```ts\n\t* const queryCache = queryClient.getQueryCache()\n\t*\n\t* queryCache.clear()\n\t* ```\n\t*/\n\tclear() {\n\t\tnotifyManager.batch(() => {\n\t\t\tthis.getAll().forEach((query) => {\n\t\t\t\tthis.remove(query);\n\t\t\t});\n\t\t});\n\t}\n\t/**\n\t* Returns the `Query` instance stored under the given `queryHash`, or `undefined` if none\n\t* exists. Unlike {@link QueryCache#find}, this looks up by the already-computed hash rather\n\t* than by `QueryFilters`. Used by plugins (e.g. broadcast/hydration) that already have a hash\n\t* to look up directly.\n\t*\n\t* @example\n\t* ```ts\n\t* const queryCache = queryClient.getQueryCache()\n\t* const queryHash = hashKey(['posts'])\n\t*\n\t* const query = queryCache.get(queryHash)\n\t* ```\n\t*/\n\tget(queryHash) {\n\t\treturn this.#queries.get(queryHash);\n\t}\n\t/**\n\t* Returns all queries within the cache.\n\t*\n\t* @example\n\t* ```ts\n\t* const queryCache = queryClient.getQueryCache()\n\t*\n\t* const queries = queryCache.getAll()\n\t* ```\n\t*/\n\tgetAll() {\n\t\treturn [...this.#queries.values()];\n\t}\n\t/**\n\t* A slightly more advanced method that can be used to get an existing query instance from the\n\t* cache. This instance not only contains all the state for the query, but all of the instances,\n\t* and underlying guts of the query as well. If the query does not exist, `undefined` is\n\t* returned.\n\t*\n\t* This is not typically needed for most applications, but can come in handy when needing more\n\t* information about a query in rare scenarios (e.g. looking at `query.state.dataUpdatedAt` to\n\t* decide whether a query is fresh enough to be used as an initial value).\n\t*\n\t* @see {@link QueryCache#findAll}\n\t* @example\n\t* ```ts\n\t* const queryCache = queryClient.getQueryCache()\n\t*\n\t* const query = queryCache.find({ queryKey: ['posts'] })\n\t* ```\n\t*/\n\tfind(filters) {\n\t\tconst defaultedFilters = {\n\t\t\texact: true,\n\t\t\t...filters\n\t\t};\n\t\treturn this.getAll().find((query) => matchQuery(defaultedFilters, query));\n\t}\n\t/**\n\t* An even more advanced method that can be used to get existing query instances from the cache\n\t* that partially match a query key. If no queries match, an empty array is returned.\n\t*\n\t* This is not typically needed for most applications, but can come in handy when needing more\n\t* information about queries in rare scenarios.\n\t*\n\t* @see {@link QueryCache#find}\n\t* @example\n\t* ```ts\n\t* const queryCache = queryClient.getQueryCache()\n\t*\n\t* const queries = queryCache.findAll({ queryKey: ['posts'] })\n\t* ```\n\t*/\n\tfindAll(filters = {}) {\n\t\tconst queries = this.getAll();\n\t\treturn Object.keys(filters).length > 0 ? queries.filter((query) => matchQuery(filters, query)) : queries;\n\t}\n\t/** @internal */\n\tnotify(event) {\n\t\tnotifyManager.batch(() => {\n\t\t\tthis.listeners.forEach((listener) => {\n\t\t\t\tlistener(event);\n\t\t\t});\n\t\t});\n\t}\n\t/** @internal */\n\tonFocus() {\n\t\tnotifyManager.batch(() => {\n\t\t\tthis.getAll().forEach((query) => {\n\t\t\t\tquery.onFocus();\n\t\t\t});\n\t\t});\n\t}\n\t/** @internal */\n\tonOnline() {\n\t\tnotifyManager.batch(() => {\n\t\t\tthis.getAll().forEach((query) => {\n\t\t\t\tquery.onOnline();\n\t\t\t});\n\t\t});\n\t}\n};\n//#endregion\nexport { QueryCache };\n\n//# sourceMappingURL=queryCache.js.map","import { functionalUpdate, hashKey, hashQueryKeyByOptions, noop, partialMatchKey, resolveQueryValue, skipToken } from \"./utils.js\";\nimport { focusManager } from \"./focusManager.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { onlineManager } from \"./onlineManager.js\";\nimport { MutationCache } from \"./mutationCache.js\";\nimport { QueryCache } from \"./queryCache.js\";\n//#region src/queryClient.ts\n/**\n* `QueryClient` is used to interact with a cache of queries and mutations. It owns a\n* `QueryCache` and a `MutationCache` (creating default ones if none are passed in) and holds\n* the default options that are applied to queries and mutations created through it.\n*\n* @example\n* ```ts\n* const queryClient = new QueryClient({\n* defaultOptions: {\n* queries: {\n* staleTime: Infinity,\n* },\n* },\n* })\n*\n* await queryClient.query({ queryKey: ['posts'], queryFn: fetchPosts })\n* ```\n*/\nvar QueryClient = class {\n\t#queryCache;\n\t#mutationCache;\n\t#defaultOptions;\n\t#queryDefaults;\n\t#mutationDefaults;\n\t#mountCount;\n\t#unsubscribeFocus;\n\t#unsubscribeOnline;\n\tconstructor(config = {}) {\n\t\tthis.#queryCache = config.queryCache || new QueryCache();\n\t\tthis.#mutationCache = config.mutationCache || new MutationCache();\n\t\tthis.#defaultOptions = config.defaultOptions || {};\n\t\tthis.#queryDefaults = /* @__PURE__ */ new Map();\n\t\tthis.#mutationDefaults = /* @__PURE__ */ new Map();\n\t\tthis.#mountCount = 0;\n\t}\n\t/**\n\t* Called by a framework adapter's `QueryClientProvider`-equivalent when it mounts, to start\n\t* listening for focus/online events and resume paused mutations. Ref-counted via an internal\n\t* mount count, so nested or multiple providers sharing the same `QueryClient` don't tear down\n\t* the shared listeners until the last one unmounts.\n\t*/\n\tmount() {\n\t\tthis.#mountCount++;\n\t\tif (this.#mountCount !== 1) return;\n\t\tthis.#unsubscribeFocus = focusManager.subscribe(async (focused) => {\n\t\t\tif (focused) {\n\t\t\t\tawait this.resumePausedMutations();\n\t\t\t\tthis.#queryCache.onFocus();\n\t\t\t}\n\t\t});\n\t\tthis.#unsubscribeOnline = onlineManager.subscribe(async (online) => {\n\t\t\tif (online) {\n\t\t\t\tawait this.resumePausedMutations();\n\t\t\t\tthis.#queryCache.onOnline();\n\t\t\t}\n\t\t});\n\t}\n\t/**\n\t* The inverse of {@link QueryClient#mount} — called by a framework adapter's\n\t* `QueryClientProvider`-equivalent when it unmounts. Only tears down the focus/online\n\t* listeners once the mount count returns to `0`.\n\t*/\n\tunmount() {\n\t\tthis.#mountCount--;\n\t\tif (this.#mountCount !== 0) return;\n\t\tthis.#unsubscribeFocus?.();\n\t\tthis.#unsubscribeFocus = void 0;\n\t\tthis.#unsubscribeOnline?.();\n\t\tthis.#unsubscribeOnline = void 0;\n\t}\n\t/**\n\t* Returns the number of queries in the cache that are currently fetching, optionally\n\t* matching a set of filters. This includes background-fetching, loading new pages, and\n\t* loading more infinite query results.\n\t*\n\t* @example\n\t* ```ts\n\t* if (queryClient.isFetching()) {\n\t* console.log('At least one query is fetching!')\n\t* }\n\t* ```\n\t*/\n\tisFetching(filters) {\n\t\treturn this.#queryCache.findAll({\n\t\t\t...filters,\n\t\t\tfetchStatus: \"fetching\"\n\t\t}).length;\n\t}\n\t/**\n\t* Returns the number of mutations in the cache that are currently pending, optionally\n\t* matching a set of filters.\n\t*\n\t* @example\n\t* ```ts\n\t* if (queryClient.isMutating()) {\n\t* console.log('At least one mutation is pending!')\n\t* }\n\t* ```\n\t*/\n\tisMutating(filters) {\n\t\treturn this.#mutationCache.findAll({\n\t\t\t...filters,\n\t\t\tstatus: \"pending\"\n\t\t}).length;\n\t}\n\t/**\n\t* Imperative (non-reactive) way to retrieve data for a QueryKey.\n\t* Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.\n\t*\n\t* Hint: Do not use this function inside a component, because it won't receive updates.\n\t* Use `useQuery` to create a `QueryObserver` that subscribes to changes.\n\t*\n\t* @returns The cached data for the query, or `undefined` if no query with this key has been observed yet.\n\t* @see {@link QueryClient#getQueriesData}\n\t*/\n\tgetQueryData(queryKey) {\n\t\tconst options = this.defaultQueryOptions({ queryKey });\n\t\treturn this.#queryCache.get(options.queryHash)?.state.data;\n\t}\n\t/**\n\t* @deprecated Use queryClient.query({ ...options, staleTime: 'static' }) instead. This method will be removed in the next major version.\n\t*/\n\tensureQueryData(options) {\n\t\tconst defaultedOptions = this.defaultQueryOptions(options);\n\t\tconst query = this.#queryCache.build(this, defaultedOptions);\n\t\tconst cachedData = query.state.data;\n\t\tif (cachedData === void 0) return this.fetchQuery(options);\n\t\tif (options.revalidateIfStale && query.isStaleByTime(resolveQueryValue(defaultedOptions.staleTime, query))) this.prefetchQuery(defaultedOptions);\n\t\treturn Promise.resolve(cachedData);\n\t}\n\t/**\n\t* Imperative (non-reactive) way to retrieve the cached data of multiple queries at once.\n\t* Only queries matching the given filters are returned; if none match, an empty array is\n\t* returned.\n\t*\n\t* Because the matched queries can hold data of different shapes (e.g. a broad filter can match\n\t* queries with unrelated data types), the `TQueryFnData` generic defaults to `unknown` rather\n\t* than being inferred. Passing a more specific type is a convenience for call sites that know\n\t* every matched query holds the same shape — it is not checked against the actual cache\n\t* contents.\n\t*\n\t* @returns An array of query key and data pairs. The data is `undefined` for a query with no cached data.\n\t* @see {@link QueryClient#getQueryData}\n\t* @example\n\t* ```ts\n\t* const data = queryClient.getQueriesData({ queryKey: ['posts'] })\n\t* ```\n\t*/\n\tgetQueriesData(filters) {\n\t\treturn this.#queryCache.findAll(filters).map(({ queryKey, state }) => {\n\t\t\treturn [queryKey, state.data];\n\t\t});\n\t}\n\t/**\n\t* Synchronous way to immediately update a query's cached data. If the updater (or the value\n\t* passed) resolves to `undefined`, the cache is left untouched and no query is created;\n\t* otherwise, if the query does not exist yet, it will be created. To update multiple queries\n\t* at once by partially matching query keys, use {@link QueryClient#setQueriesData} instead.\n\t*\n\t* Updates must be performed immutably: do not mutate `oldData`, or data previously retrieved\n\t* via {@link QueryClient#getQueryData}, in place.\n\t*\n\t* @param queryKey - The query key to set data for.\n\t* @param updater - Either the new data, or a function that receives the current data (which\n\t* may be `undefined`) and returns the new data.\n\t* @param options - Set `updatedAt` to override the timestamp the written data is recorded with.\n\t* @returns The data that was written, or `undefined` if the updater returned `undefined` — in that case\n\t* the write is skipped and the cache is left unchanged.\n\t*\n\t* @example\n\t* ```ts\n\t* queryClient.setQueryData(['posts'], newPosts)\n\t*\n\t* // Or, using an updater function that receives the current data:\n\t* queryClient.setQueryData(['posts'], (oldPosts) => [...oldPosts, newPost])\n\t* ```\n\t*/\n\tsetQueryData(queryKey, updater, options) {\n\t\tconst defaultedOptions = this.defaultQueryOptions({ queryKey });\n\t\tconst prevData = this.#queryCache.get(defaultedOptions.queryHash)?.state.data;\n\t\tconst data = functionalUpdate(updater, prevData);\n\t\tif (data === void 0) return;\n\t\treturn this.#queryCache.build(this, defaultedOptions).setData(data, {\n\t\t\t...options,\n\t\t\tmanual: true\n\t\t});\n\t}\n\t/**\n\t* Synchronous way to immediately update the cached data of multiple queries at once, using\n\t* filters or partial query key matching. Only queries that already exist and match the given\n\t* filters are updated; no new cache entries are created. Internally this calls\n\t* {@link QueryClient#setQueryData} for each matching query.\n\t*\n\t* @returns One `[queryKey, data]` tuple per matched query, in the same shape and with the same\n\t* `undefined` case as {@link QueryClient#setQueryData}.\n\t* @example\n\t* ```ts\n\t* queryClient.setQueriesData({ queryKey: ['posts'] }, (oldPosts) =>\n\t* oldPosts ? oldPosts.filter((post) => post.id !== deletedId) : oldPosts,\n\t* )\n\t* ```\n\t*/\n\tsetQueriesData(filters, updater, options) {\n\t\treturn notifyManager.batch(() => this.#queryCache.findAll(filters).map(({ queryKey }) => [queryKey, this.setQueryData(queryKey, updater, options)]));\n\t}\n\t/**\n\t* Imperative (non-reactive) way to retrieve an existing query's state. If the query does not\n\t* exist, `undefined` is returned.\n\t*\n\t* @example\n\t* ```ts\n\t* const state = queryClient.getQueryState(['posts'])\n\t* console.log(state?.dataUpdatedAt)\n\t* ```\n\t*/\n\tgetQueryState(queryKey) {\n\t\tconst options = this.defaultQueryOptions({ queryKey });\n\t\treturn this.#queryCache.get(options.queryHash)?.state;\n\t}\n\t/**\n\t* Removes queries from the cache that match the given filters. Unlike\n\t* {@link QueryClient#invalidateQueries} or {@link QueryClient#refetchQueries}, this removes\n\t* matching queries from the cache instead of refetching them. Without filters, every query in\n\t* the cache is removed.\n\t*\n\t* @example\n\t* ```ts\n\t* queryClient.removeQueries({ queryKey: ['posts'], exact: true })\n\t* ```\n\t*/\n\tremoveQueries(filters) {\n\t\tconst queryCache = this.#queryCache;\n\t\tnotifyManager.batch(() => {\n\t\t\tqueryCache.findAll(filters).forEach((query) => {\n\t\t\t\tqueryCache.remove(query);\n\t\t\t});\n\t\t});\n\t}\n\t/**\n\t* Resets queries matching the given filters back to their initial state (e.g. any\n\t* `initialData`), notifying subscribers rather than removing them. Active queries among the\n\t* matched set are then refetched, and the returned promise resolves once that refetch settles.\n\t*\n\t* @example\n\t* ```ts\n\t* await queryClient.resetQueries({ queryKey: ['posts'], exact: true })\n\t* ```\n\t*/\n\tresetQueries(filters, options) {\n\t\tconst queryCache = this.#queryCache;\n\t\treturn notifyManager.batch(() => {\n\t\t\tconst matched = queryCache.findAll(filters);\n\t\t\tconst queriesToRefetch = new Set(matched);\n\t\t\tmatched.forEach((query) => {\n\t\t\t\tquery.reset();\n\t\t\t});\n\t\t\treturn this.refetchQueries({\n\t\t\t\ttype: \"active\",\n\t\t\t\tpredicate: (query) => queriesToRefetch.has(query)\n\t\t\t}, options);\n\t\t});\n\t}\n\t/**\n\t* Cancels outgoing fetches for queries matching the given filters. Most useful when performing\n\t* optimistic updates, since any outgoing refetch that resolves afterwards would otherwise\n\t* overwrite the optimistic update. By default (`revert: true`), a cancelled query's data is\n\t* reverted to its state before the outgoing fetch started.\n\t*\n\t* The returned promise never rejects, even if individual cancellations fail.\n\t*\n\t* @example\n\t* ```ts\n\t* await queryClient.cancelQueries({ queryKey: ['posts'], exact: true })\n\t* ```\n\t*/\n\tcancelQueries(filters, cancelOptions = {}) {\n\t\tconst defaultedCancelOptions = {\n\t\t\trevert: true,\n\t\t\t...cancelOptions\n\t\t};\n\t\tconst promises = notifyManager.batch(() => this.#queryCache.findAll(filters).map((query) => query.cancel(defaultedCancelOptions)));\n\t\treturn Promise.all(promises).then(noop).catch(noop);\n\t}\n\t/**\n\t* Marks queries matching the given filters as invalidated. Unlike\n\t* {@link QueryClient#removeQueries}, invalidated queries stay in the cache.\n\t*\n\t* Unless `filters.refetchType` is `'none'`, matching queries are then refetched via\n\t* {@link QueryClient#refetchQueries}, using `filters.refetchType` if set, otherwise\n\t* `filters.type`, otherwise `'active'`.\n\t*\n\t* @example\n\t* ```ts\n\t* await queryClient.invalidateQueries({ queryKey: ['posts'], refetchType: 'active' })\n\t* ```\n\t*/\n\tinvalidateQueries(filters, options = {}) {\n\t\treturn notifyManager.batch(() => {\n\t\t\tthis.#queryCache.findAll(filters).forEach((query) => {\n\t\t\t\tquery.invalidate();\n\t\t\t});\n\t\t\tif (filters?.refetchType === \"none\") return Promise.resolve();\n\t\t\treturn this.refetchQueries({\n\t\t\t\t...filters,\n\t\t\t\ttype: filters?.refetchType ?? filters?.type ?? \"active\"\n\t\t\t}, options);\n\t\t});\n\t}\n\t/**\n\t* Refetches queries matching the given filters, regardless of whether they are stale. Without\n\t* filters, every query in the cache is refetched. Queries that are disabled, or static (only\n\t* have observers with a static `staleTime`), are never refetched.\n\t*\n\t* By default (`cancelRefetch: true`), a currently running fetch is cancelled before the new\n\t* one starts. The returned promise resolves once all matching queries have settled; it does\n\t* not reject on individual query failures unless `throwOnError` is set.\n\t*\n\t* @example\n\t* ```ts\n\t* // refetch all active queries partially matching a query key:\n\t* await queryClient.refetchQueries({ queryKey: ['posts'], type: 'active' })\n\t* ```\n\t*/\n\trefetchQueries(filters, options = {}) {\n\t\tconst fetchOptions = {\n\t\t\t...options,\n\t\t\tcancelRefetch: options.cancelRefetch ?? true\n\t\t};\n\t\tconst promises = notifyManager.batch(() => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled() && !query.isStatic()).map((query) => {\n\t\t\tlet promise = query.fetch(void 0, fetchOptions);\n\t\t\tif (!fetchOptions.throwOnError) promise = promise.catch(noop);\n\t\t\treturn query.state.fetchStatus === \"paused\" ? Promise.resolve() : promise;\n\t\t}));\n\t\treturn Promise.all(promises).then(noop);\n\t}\n\t/**\n\t* Asynchronous method to fetch and cache a query, resolving with the data or throwing with\n\t* the error.\n\t*\n\t* If the query already exists in the cache and its data is not stale (per the given\n\t* `staleTime`), the cached data is returned without fetching. Otherwise, the query is fetched\n\t* and the promise resolves once the fetch settles. If a `select` function is provided, it is\n\t* applied to the data in both cases (cached or freshly fetched) before it is returned.\n\t*\n\t* Unlike a reactive observer, retries are disabled by default here (`retry: false`) unless\n\t* explicitly configured, since there is no component to catch a thrown error and retry through\n\t* re-render.\n\t*\n\t* The accepted options are `QueryObserverOptions` minus the fields that only make sense for a\n\t* reactive observer — `enabled`, `refetchInterval`, `refetchIntervalInBackground`,\n\t* `refetchOnWindowFocus`, `refetchOnReconnect`, `refetchOnMount`, `retryOnMount`,\n\t* `notifyOnChangeProps`, `throwOnError`, `suspense`, and `placeholderData` are not part of this\n\t* method's options.\n\t*\n\t* This method replaces the deprecated `fetchQuery`, and — combined with\n\t* `{ staleTime: 'static' }` — the deprecated `ensureQueryData`.\n\t*\n\t* @example\n\t* ```ts\n\t* try {\n\t* const data = await queryClient.query({ queryKey, queryFn, staleTime: 10000 })\n\t* } catch (error) {\n\t* console.log(error)\n\t* }\n\t* ```\n\t*/\n\tasync query(options) {\n\t\tconst defaultedOptions = this.defaultQueryOptions(options);\n\t\tif (defaultedOptions.retry === void 0) defaultedOptions.retry = false;\n\t\tconst query = this.#queryCache.build(this, defaultedOptions);\n\t\tconst queryData = query.isStaleByTime(resolveQueryValue(defaultedOptions.staleTime, query)) ? await query.fetch(defaultedOptions) : query.state.data;\n\t\tconst select = defaultedOptions.select;\n\t\tif (select) return select(queryData);\n\t\treturn queryData;\n\t}\n\t/**\n\t* @deprecated Use queryClient.query(options) instead. This method will be removed in the next major version.\n\t*/\n\tfetchQuery(options) {\n\t\tconst defaultedOptions = this.defaultQueryOptions(options);\n\t\tif (defaultedOptions.retry === void 0) defaultedOptions.retry = false;\n\t\tconst query = this.#queryCache.build(this, defaultedOptions);\n\t\treturn query.isStaleByTime(resolveQueryValue(defaultedOptions.staleTime, query)) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);\n\t}\n\t/**\n\t* @deprecated Use queryClient.query(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.\n\t*/\n\tprefetchQuery(options) {\n\t\treturn this.fetchQuery(options).then(noop).catch(noop);\n\t}\n\t/**\n\t* Asynchronous method to fetch and cache an infinite query, resolving with an\n\t* {@link InfiniteData} object or throwing with the error.\n\t*\n\t* Behaves like {@link QueryClient#query}, accepting the same options (minus\n\t* `initialPageParam`), plus the required `initialPageParam`, and an optional `pages` /\n\t* `getNextPageParam` pair used to refetch a fixed number of pages from the start.\n\t*\n\t* This method replaces the deprecated `fetchInfiniteQuery`, and — combined with\n\t* `{ staleTime: 'static' }` — the deprecated `ensureInfiniteQueryData`.\n\t*\n\t* @example\n\t* ```ts\n\t* try {\n\t* const data = await queryClient.infiniteQuery({ queryKey, queryFn, initialPageParam: 0 })\n\t* console.log(data.pages)\n\t* } catch (error) {\n\t* console.log(error)\n\t* }\n\t* ```\n\t*/\n\tinfiniteQuery(options) {\n\t\toptions._type = \"infinite\";\n\t\treturn this.query(options);\n\t}\n\t/**\n\t* @deprecated Use queryClient.infiniteQuery(options) instead. This method will be removed in the next major version.\n\t*/\n\tfetchInfiniteQuery(options) {\n\t\toptions._type = \"infinite\";\n\t\treturn this.fetchQuery(options);\n\t}\n\t/**\n\t* @deprecated Use queryClient.infiniteQuery(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.\n\t*/\n\tprefetchInfiniteQuery(options) {\n\t\treturn this.fetchInfiniteQuery(options).then(noop).catch(noop);\n\t}\n\t/**\n\t* @deprecated Use queryClient.infiniteQuery({ ...options, staleTime: 'static' }) instead. This method will be removed in the next major version.\n\t*/\n\tensureInfiniteQueryData(options) {\n\t\toptions._type = \"infinite\";\n\t\treturn this.ensureQueryData(options);\n\t}\n\t/**\n\t* Resumes mutations that were paused because there was no network connection. Does nothing\n\t* (resolving immediately) if the client is currently offline.\n\t*\n\t* @example\n\t* ```ts\n\t* import { QueryClient } from '@tanstack/query-core'\n\t*\n\t* const queryClient = new QueryClient()\n\t* await queryClient.resumePausedMutations()\n\t* ```\n\t*/\n\tresumePausedMutations() {\n\t\tif (onlineManager.isOnline()) return this.#mutationCache.resumePausedMutations();\n\t\treturn Promise.resolve();\n\t}\n\t/**\n\t* Returns the query cache this client is connected to.\n\t*\n\t* @example\n\t* ```ts\n\t* import { QueryClient } from '@tanstack/query-core'\n\t*\n\t* const queryClient = new QueryClient()\n\t* const queryCache = queryClient.getQueryCache()\n\t* const queries = queryCache.findAll({ queryKey: ['posts'] })\n\t* ```\n\t*/\n\tgetQueryCache() {\n\t\treturn this.#queryCache;\n\t}\n\t/**\n\t* Returns the mutation cache this client is connected to.\n\t*\n\t* @example\n\t* ```ts\n\t* import { QueryClient } from '@tanstack/query-core'\n\t*\n\t* const queryClient = new QueryClient()\n\t* const mutationCache = queryClient.getMutationCache()\n\t* const mutations = mutationCache.findAll({ status: 'pending' })\n\t* ```\n\t*/\n\tgetMutationCache() {\n\t\treturn this.#mutationCache;\n\t}\n\t/**\n\t* Returns the default options that were set when creating the client, or via\n\t* {@link QueryClient#setDefaultOptions}.\n\t*\n\t* @example\n\t* ```ts\n\t* import { QueryClient } from '@tanstack/query-core'\n\t*\n\t* const queryClient = new QueryClient()\n\t* const defaultOptions = queryClient.getDefaultOptions()\n\t* ```\n\t*/\n\tgetDefaultOptions() {\n\t\treturn this.#defaultOptions;\n\t}\n\t/**\n\t* Dynamically sets the default options for this client, overwriting any previously defined\n\t* default options.\n\t*\n\t* @see {@link QueryClient#getDefaultOptions}\n\t* @example\n\t* ```ts\n\t* import { QueryClient } from '@tanstack/query-core'\n\t*\n\t* const queryClient = new QueryClient()\n\t* queryClient.setDefaultOptions({\n\t* queries: {\n\t* staleTime: Infinity,\n\t* },\n\t* })\n\t* ```\n\t*/\n\tsetDefaultOptions(options) {\n\t\tthis.#defaultOptions = options;\n\t}\n\t/**\n\t* Sets default options for queries whose query key partially matches the given `queryKey`.\n\t*\n\t* If several registered query defaults match a given query key, they are merged together in\n\t* registration order by {@link QueryClient#getQueryDefaults}, so register defaults from the\n\t* most generic key to the least generic one — more specific defaults should be registered\n\t* after more generic ones so they take precedence.\n\t*\n\t* @example\n\t* ```ts\n\t* queryClient.setQueryDefaults(['posts'], { queryFn: fetchPosts })\n\t*\n\t* await queryClient.query({ queryKey: ['posts'] })\n\t* ```\n\t*/\n\tsetQueryDefaults(queryKey, options) {\n\t\tthis.#queryDefaults.set(hashKey(queryKey), {\n\t\t\tqueryKey,\n\t\t\tdefaultOptions: options\n\t\t});\n\t}\n\t/**\n\t* Returns the default options registered for queries whose query key partially matches the\n\t* given `queryKey`, via {@link QueryClient#setQueryDefaults}. If multiple registered defaults\n\t* match, they are merged together in registration order.\n\t*\n\t* @example\n\t* ```ts\n\t* const defaultOptions = queryClient.getQueryDefaults(['posts'])\n\t* ```\n\t*/\n\tgetQueryDefaults(queryKey) {\n\t\tconst defaults = [...this.#queryDefaults.values()];\n\t\tconst result = {};\n\t\tdefaults.forEach((queryDefault) => {\n\t\t\tif (partialMatchKey(queryKey, queryDefault.queryKey)) Object.assign(result, queryDefault.defaultOptions);\n\t\t});\n\t\treturn result;\n\t}\n\t/**\n\t* Sets default options for mutations whose mutation key partially matches the given\n\t* `mutationKey`. As with {@link QueryClient#setQueryDefaults}, the order of registration\n\t* matters when several registered defaults match the same mutation key.\n\t*\n\t* @see {@link QueryClient#getMutationDefaults}\n\t* @example\n\t* ```ts\n\t* queryClient.setMutationDefaults(['addPost'], { mutationFn: addPost })\n\t* ```\n\t*/\n\tsetMutationDefaults(mutationKey, options) {\n\t\tthis.#mutationDefaults.set(hashKey(mutationKey), {\n\t\t\tmutationKey,\n\t\t\tdefaultOptions: options\n\t\t});\n\t}\n\t/**\n\t* Returns the default options registered for mutations whose mutation key partially matches\n\t* the given `mutationKey`, via {@link QueryClient#setMutationDefaults}. If multiple registered\n\t* defaults match, they are merged together in registration order.\n\t*\n\t* @example\n\t* ```ts\n\t* const defaultOptions = queryClient.getMutationDefaults(['addPost'])\n\t* ```\n\t*/\n\tgetMutationDefaults(mutationKey) {\n\t\tconst defaults = [...this.#mutationDefaults.values()];\n\t\tconst result = {};\n\t\tdefaults.forEach((queryDefault) => {\n\t\t\tif (partialMatchKey(mutationKey, queryDefault.mutationKey)) Object.assign(result, queryDefault.defaultOptions);\n\t\t});\n\t\treturn result;\n\t}\n\t/**\n\t* Called by framework adapters (e.g. inside `useQuery`) to resolve the options passed by the\n\t* caller into their final, defaulted form: merging `queryClient.setQueryDefaults` for the\n\t* given `queryKey`, then the client's own `defaultOptions.queries`, then the caller's options\n\t* on top. A no-op if the options are already defaulted (`_defaulted: true`).\n\t*/\n\tdefaultQueryOptions(options) {\n\t\tif (options._defaulted) return options;\n\t\tconst defaultedOptions = {\n\t\t\t...this.#defaultOptions.queries,\n\t\t\t...this.getQueryDefaults(options.queryKey),\n\t\t\t...options,\n\t\t\t_defaulted: true\n\t\t};\n\t\tif (!defaultedOptions.queryHash) defaultedOptions.queryHash = hashQueryKeyByOptions(defaultedOptions.queryKey, defaultedOptions);\n\t\tif (defaultedOptions.refetchOnReconnect === void 0) defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== \"always\";\n\t\tif (defaultedOptions.throwOnError === void 0) defaultedOptions.throwOnError = !!defaultedOptions.suspense;\n\t\tif (!defaultedOptions.networkMode && defaultedOptions.persister) defaultedOptions.networkMode = \"offlineFirst\";\n\t\tif (defaultedOptions.queryFn === skipToken) defaultedOptions.enabled = false;\n\t\treturn defaultedOptions;\n\t}\n\t/**\n\t* The mutation counterpart of {@link QueryClient#defaultQueryOptions}. Called by framework\n\t* adapters (e.g. inside `useMutation`) to merge `queryClient.setMutationDefaults` for the\n\t* given `mutationKey`, then the client's `defaultOptions.mutations`, then the caller's options\n\t* on top. A no-op if the options are already defaulted (`_defaulted: true`).\n\t*/\n\tdefaultMutationOptions(options) {\n\t\tif (options?._defaulted) return options;\n\t\treturn {\n\t\t\t...this.#defaultOptions.mutations,\n\t\t\t...options?.mutationKey && this.getMutationDefaults(options.mutationKey),\n\t\t\t...options,\n\t\t\t_defaulted: true\n\t\t};\n\t}\n\t/**\n\t* Clears both the query cache and the mutation cache this client is connected to.\n\t*\n\t* @example\n\t* ```ts\n\t* import { QueryClient } from '@tanstack/query-core'\n\t*\n\t* const queryClient = new QueryClient()\n\t* queryClient.clear()\n\t* ```\n\t*/\n\tclear() {\n\t\tthis.#queryCache.clear();\n\t\tthis.#mutationCache.clear();\n\t}\n};\n//#endregion\nexport { QueryClient };\n\n//# sourceMappingURL=queryClient.js.map","\"use client\";\nimport * as React from \"react\";\n//#region src/IsRestoringProvider.ts\nconst IsRestoringContext = React.createContext(false);\n/**\n* If you are using `PersistQueryClientProvider`, you can also use the `useIsRestoring` hook alongside it to\n* check if a restore is currently in progress. `useQuery` and friends also check this internally to avoid\n* race conditions between the restore and mounting queries.\n*\n* @returns `true` while a persisted client is being restored, `false` otherwise.\n*/\nconst useIsRestoring = () => React.useContext(IsRestoringContext);\n/**\n* The Provider that `PersistQueryClientProvider` uses to signal whether a persisted client is currently\n* being restored, read by `useIsRestoring`.\n*/\nconst IsRestoringProvider = IsRestoringContext.Provider;\n//#endregion\nexport { IsRestoringProvider, useIsRestoring };\n\n//# sourceMappingURL=IsRestoringProvider.js.map","\"use client\";\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\n//#region src/QueryErrorResetBoundary.tsx\n/**\n* Resets any query errors within the boundary, so queries know they can try again.\n*/\nfunction createValue() {\n\tlet isReset = false;\n\treturn {\n\t\t/**\n\t\t* Clears the reset state, so queries know not to try again until the boundary is reset again.\n\t\t*/\n\t\tclearReset: () => {\n\t\t\tisReset = false;\n\t\t},\n\t\t/**\n\t\t* Resets any query errors within the boundary, so queries know they can try again.\n\t\t*/\n\t\treset: () => {\n\t\t\tisReset = true;\n\t\t},\n\t\t/**\n\t\t* Returns whether the boundary has been reset and not yet cleared.\n\t\t*/\n\t\tisReset: () => {\n\t\t\treturn isReset;\n\t\t}\n\t};\n}\nconst QueryErrorResetBoundaryContext = React.createContext(createValue());\n/**\n* This hook will reset any query errors within the closest `QueryErrorResetBoundary`. If there is no boundary\n* defined it will reset them globally.\n*\n* @returns The boundary's {@link QueryErrorResetBoundaryValue}.\n*\n* @example\n* ```tsx\n* import { ErrorBoundary } from 'react-error-boundary'\n* import { useQueryErrorResetBoundary } from '@tanstack/react-query'\n*\n* function App({ children }: { children: React.ReactNode }) {\n* const { reset } = useQueryErrorResetBoundary()\n*\n* return (\n* <ErrorBoundary\n* onReset={reset}\n* fallbackRender={({ resetErrorBoundary }) => (\n* <div>\n* There was an error!\n* <button onClick={() => resetErrorBoundary()}>Try again</button>\n* </div>\n* )}\n* >\n* {children}\n* </ErrorBoundary>\n* )\n* }\n* ```\n*/\nconst useQueryErrorResetBoundary = () => React.useContext(QueryErrorResetBoundaryContext);\n/**\n* When using `suspense` or `throwOnError` in your queries, you need a way to let queries know that you want to\n* try again when re-rendering after some error occurred. With the `QueryErrorResetBoundary` component you can\n* reset any query errors within the boundaries of the component.\n*\n* @returns The `children`, rendered as-is, or called with the boundary's {@link QueryErrorResetBoundaryValue}\n* if `children` is a function.\n*\n* @example\n* ```tsx\n* import { ErrorBoundary } from 'react-error-boundary'\n* import { QueryErrorResetBoundary } from '@tanstack/react-query'\n*\n* function App() {\n* return (\n* <QueryErrorResetBoundary>\n* {({ reset }) => (\n* <ErrorBoundary\n* onReset={reset}\n* fallbackRender={({ resetErrorBoundary }) => (\n* <div>\n* There was an error!\n* <button onClick={() => resetErrorBoundary()}>Try again</button>\n* </div>\n* )}\n* >\n* <Page />\n* </ErrorBoundary>\n* )}\n* </QueryErrorResetBoundary>\n* )\n* }\n* ```\n*/\nconst QueryErrorResetBoundary = ({ children }) => {\n\tconst [value] = React.useState(() => createValue());\n\treturn /* @__PURE__ */ jsx(QueryErrorResetBoundaryContext.Provider, {\n\t\tvalue,\n\t\tchildren: typeof children === \"function\" ? children(value) : children\n\t});\n};\n//#endregion\nexport { QueryErrorResetBoundary, useQueryErrorResetBoundary };\n\n//# sourceMappingURL=QueryErrorResetBoundary.js.map","\"use client\";\nimport * as React from \"react\";\nimport { shouldThrowError } from \"@tanstack/query-core\";\n//#region src/errorBoundaryUtils.ts\nconst ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => {\n\tconst throwOnError = query?.state.error && typeof options.throwOnError === \"function\" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError;\n\tif (options.suspense || throwOnError) {\n\t\tif (!errorResetBoundary.isReset()) options.retryOnMount = false;\n\t}\n};\nconst useClearResetErrorBoundary = (errorResetBoundary) => {\n\tReact.useEffect(() => {\n\t\terrorResetBoundary.clearReset();\n\t}, [errorResetBoundary]);\n};\nconst getHasError = ({ result, errorResetBoundary, throwOnError, query, suspense }) => {\n\treturn result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query]));\n};\n//#endregion\nexport { ensurePreventErrorBoundaryRetry, getHasError, useClearResetErrorBoundary };\n\n//# sourceMappingURL=errorBoundaryUtils.js.map","//#region src/suspense.ts\nconst defaultThrowOnError = (_error, query) => query.state.data === void 0;\nconst ensureSuspenseTimers = (defaultedOptions) => {\n\tif (defaultedOptions.suspense) {\n\t\tconst MIN_SUSPENSE_TIME_MS = 1e3;\n\t\tconst clamp = (value) => value === \"static\" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS);\n\t\tconst originalStaleTime = defaultedOptions.staleTime;\n\t\tdefaultedOptions.staleTime = typeof originalStaleTime === \"function\" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime);\n\t\tif (typeof defaultedOptions.gcTime === \"number\") defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, MIN_SUSPENSE_TIME_MS);\n\t}\n};\nconst shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending;\nconst fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {\n\terrorResetBoundary.clearReset();\n});\n//#endregion\nexport { defaultThrowOnError, ensureSuspenseTimers, fetchOptimistic, shouldSuspend };\n\n//# sourceMappingURL=suspense.js.map","\"use client\";\nimport { useQueryClient } from \"./QueryClientProvider.js\";\nimport { useIsRestoring } from \"./IsRestoringProvider.js\";\nimport { useQueryErrorResetBoundary } from \"./QueryErrorResetBoundary.js\";\nimport { ensurePreventErrorBoundaryRetry, getHasError, useClearResetErrorBoundary } from \"./errorBoundaryUtils.js\";\nimport { ensureSuspenseTimers, fetchOptimistic, shouldSuspend } from \"./suspense.js\";\nimport * as React from \"react\";\nimport { QueriesObserver, QueryObserver, noop, notifyManager } from \"@tanstack/query-core\";\n//#region src/useQueries.ts\n/**\n* The `useQueries` hook can be used to fetch a variable number of queries.\n*\n* The `queries` key accepts an array with query option objects mostly identical to `useQuery` — the top-level\n* `subscribed` option isn't accepted per query (see `placeholderData` below for another difference). A custom\n* `QueryClient` is supplied once, as `useQueries`' own top-level second argument, rather than per query.\n*\n* Having the same query key more than once in the array of query objects may cause some data to be shared\n* between queries. To avoid this, consider de-duplicating the queries and map the results back to the desired\n* structure.\n*\n* The `combine` option can be used to combine the results of the queries into a single value. The result will\n* be structurally shared to be as referentially stable as possible.\n*\n* @remarks The `combine` function only re-runs if it changed referentially, or if any of the query results\n* changed. An inlined `combine` function, as shown in the example below, therefore runs on every render — wrap\n* it in `useCallback`, or extract it to a stable function reference if it doesn't have any dependencies, to\n* avoid that.\n*\n* Unlike `useQuery`, `useQueries` cannot infer the `data` argument of an _inline_ `select` from its sibling\n* `queryFn`. Because `useQueries` infers the type of the whole `queries` array at once, the `select` parameter\n* of a query object written inline cannot be contextually typed from that same object's `queryFn`, so it falls\n* back to `unknown` — a [known TypeScript limitation](https://github.com/TanStack/query/issues/6556). Annotate\n* the `select` parameter explicitly, or define the query with {@link queryOptions}, which resolves its types in\n* a single object _before_ it reaches `useQueries`, to work around this — see the example below. The same\n* limitation applies to {@link useSuspenseQueries}.\n*\n* `placeholderData` is supported here too, but unlike `useQuery`, it doesn't receive information from\n* previously rendered queries, because the number of queries can differ between renders.\n* @param queryClient - Use this to provide a custom `QueryClient`. Otherwise, the one from the nearest context\n* will be used.\n* @returns The combined result. Without `combine`, this is an array with all the query results, in the same\n* order as the input. When `combine` is provided, this is the value returned by `combine` instead.\n*\n* @example\n* ```tsx\n* import { useQueries } from '@tanstack/react-query'\n*\n* function Posts({ ids }: { ids: Array<number> }) {\n* const postQueries = useQueries({\n* queries: ids.map((id) => ({\n* queryKey: ['post', id],\n* queryFn: () => fetchPost(id),\n* staleTime: Infinity,\n* })),\n* })\n*\n* return (\n* <ul>\n* {postQueries.map((query, index) => {\n* if (query.isPending) return <li key={ids[index]}>Loading...</li>\n* if (query.isError) return <li key={ids[index]}>Error: {query.error.message}</li>\n* return <li key={ids[index]}>{query.data.title}</li>\n* })}\n* </ul>\n* )\n* }\n* ```\n*\n* @example\n* Combining results into a single value:\n* ```tsx\n* import { useQueries } from '@tanstack/react-query'\n*\n* function Posts({ ids }: { ids: Array<number> }) {\n* const { data, isPending, isError } = useQueries({\n* queries: ids.map((id) => ({\n* queryKey: ['post', id],\n* queryFn: () => fetchPost(id),\n* })),\n* combine: (postQueries) => {\n* return {\n* data: postQueries.map((query) => query.data),\n* isPending: postQueries.some((query) => query.isPending),\n* isError: postQueries.some((query) => query.isError),\n* }\n* },\n* })\n*\n* if (isPending) return 'Loading...'\n* if (isError) return 'Error loading posts'\n*\n* return (\n* <ul>\n* {data.map((post) => (\n* <li key={post?.id}>{post?.title}</li>\n* ))}\n* </ul>\n* )\n* }\n* ```\n*\n* @example\n* Typing `select` via {@link queryOptions}. Note that spreading a `queryOptions` result and overriding\n* `select` inline still falls back to `unknown` — wrap the spread in `queryOptions` again so the override is\n* resolved before it reaches `useQueries`:\n* ```tsx\n* import { queryOptions, useQueries } from '@tanstack/react-query'\n*\n* const postOptions = (id: number) =>\n* queryOptions({\n* queryKey: ['post', id],\n* queryFn: () => fetchPost(id),\n* })\n*\n* function PostTitle({ id }: { id: number }) {\n* const [{ data: broken }] = useQueries({\n* queries: [\n* {\n* ...postOptions(id),\n* // ❌ `data` is `unknown` here\n* select: (data) => data.title,\n* },\n* ],\n* })\n*\n* const [{ data: fixed }] = useQueries({\n* queries: [\n* queryOptions({\n* ...postOptions(id),\n* // ✅ `data` is `Post`\n* select: (data) => data.title,\n* }),\n* ],\n* })\n*\n* return <h1>{fixed}</h1>\n* }\n* ```\n*/\nfunction useQueries({ queries, ...options }, queryClient) {\n\tconst client = useQueryClient(queryClient);\n\tconst isRestoring = useIsRestoring();\n\tconst errorResetBoundary = useQueryErrorResetBoundary();\n\tconst subscribed = options.subscribed !== false;\n\tconst defaultedQueries = React.useMemo(() => queries.map((opts) => {\n\t\tconst defaultedOptions = client.defaultQueryOptions(opts);\n\t\tdefaultedOptions._optimisticResults = isRestoring ? \"isRestoring\" : subscribed ? \"optimistic\" : void 0;\n\t\treturn defaultedOptions;\n\t}), [\n\t\tqueries,\n\t\tclient,\n\t\tisRestoring,\n\t\tsubscribed\n\t]);\n\tdefaultedQueries.forEach((queryOptions) => {\n\t\tensureSuspenseTimers(queryOptions);\n\t\tconst query = client.getQueryCache().get(queryOptions.queryHash);\n\t\tensurePreventErrorBoundaryRetry(queryOptions, errorResetBoundary, query);\n\t});\n\tuseClearResetErrorBoundary(errorResetBoundary);\n\tconst [observer] = React.useState(() => new QueriesObserver(client, defaultedQueries, options));\n\tconst [optimisticResult, getCombinedResult, trackResult] = observer.getOptimisticResult(defaultedQueries, options.combine);\n\tconst shouldSubscribe = !isRestoring && subscribed;\n\tReact.useSyncExternalStore(React.useCallback((onStoreChange) => shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop, [observer, shouldSubscribe]), () => observer.getCurrentResult(), () => observer.getCurrentResult());\n\tReact.useEffect(() => {\n\t\tobserver.setQueries(defaultedQueries, options);\n\t}, [\n\t\tdefaultedQueries,\n\t\toptions,\n\t\tobserver\n\t]);\n\tconst suspensePromises = optimisticResult.some((result, index) => shouldSuspend(defaultedQueries[index], result)) ? optimisticResult.flatMap((result, index) => {\n\t\tconst opts = defaultedQueries[index];\n\t\tif (opts && shouldSuspend(opts, result)) {\n\t\t\tconst queryObserver = new QueryObserver(client, opts);\n\t\t\treturn fetchOptimistic(opts, queryObserver, errorResetBoundary);\n\t\t}\n\t\treturn [];\n\t}) : [];\n\tif (suspensePromises.length > 0) throw Promise.all(suspensePromises);\n\tconst firstSingleResultWhichShouldThrow = optimisticResult.find((result, index) => {\n\t\tconst query = defaultedQueries[index];\n\t\treturn query && getHasError({\n\t\t\tresult,\n\t\t\terrorResetBoundary,\n\t\t\tthrowOnError: query.throwOnError,\n\t\t\tquery: client.getQueryCache().get(query.queryHash),\n\t\t\tsuspense: query.suspense\n\t\t});\n\t});\n\tif (firstSingleResultWhichShouldThrow) throw firstSingleResultWhichShouldThrow.error;\n\treturn getCombinedResult(trackResult());\n}\n//#endregion\nexport { useQueries };\n\n//# sourceMappingURL=useQueries.js.map","\"use client\";\nimport { useQueryClient } from \"./QueryClientProvider.js\";\nimport { useIsRestoring } from \"./IsRestoringProvider.js\";\nimport { useQueryErrorResetBoundary } from \"./QueryErrorResetBoundary.js\";\nimport { ensurePreventErrorBoundaryRetry, getHasError, useClearResetErrorBoundary } from \"./errorBoundaryUtils.js\";\nimport { ensureSuspenseTimers, fetchOptimistic, shouldSuspend } from \"./suspense.js\";\nimport * as React from \"react\";\nimport { noop, notifyManager } from \"@tanstack/query-core\";\n//#region src/useBaseQuery.ts\nfunction useBaseQuery(options, Observer, queryClient) {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tif (typeof options !== \"object\" || Array.isArray(options)) throw new Error(\"Bad argument type. Starting with v5, only the \\\"Object\\\" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object\");\n\t}\n\tconst isRestoring = useIsRestoring();\n\tconst errorResetBoundary = useQueryErrorResetBoundary();\n\tconst client = useQueryClient(queryClient);\n\tconst defaultedOptions = client.defaultQueryOptions(options);\n\tconst query = client.getQueryCache().get(defaultedOptions.queryHash);\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tif (!defaultedOptions.queryFn) console.error(`[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`);\n\t}\n\tconst subscribed = options.subscribed !== false;\n\tdefaultedOptions._optimisticResults = isRestoring ? \"isRestoring\" : subscribed ? \"optimistic\" : void 0;\n\tensureSuspenseTimers(defaultedOptions);\n\tensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query);\n\tuseClearResetErrorBoundary(errorResetBoundary);\n\tconst [observer] = React.useState(() => new Observer(client, defaultedOptions));\n\tconst result = observer.getOptimisticResult(defaultedOptions);\n\tconst shouldSubscribe = !isRestoring && subscribed;\n\tReact.useSyncExternalStore(React.useCallback((onStoreChange) => {\n\t\tconst unsubscribe = shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop;\n\t\tobserver.updateResult();\n\t\treturn unsubscribe;\n\t}, [observer, shouldSubscribe]), () => observer.getCurrentResult(), () => observer.getCurrentResult());\n\tReact.useEffect(() => {\n\t\tobserver.setOptions(defaultedOptions);\n\t}, [defaultedOptions, observer]);\n\tif (shouldSuspend(defaultedOptions, result)) throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);\n\tif (getHasError({\n\t\tresult,\n\t\terrorResetBoundary,\n\t\tthrowOnError: defaultedOptions.throwOnError,\n\t\tquery,\n\t\tsuspense: defaultedOptions.suspense\n\t})) throw result.error;\n\treturn !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;\n}\n//#endregion\nexport { useBaseQuery };\n\n//# sourceMappingURL=useBaseQuery.js.map","\"use client\";\nimport { useBaseQuery } from \"./useBaseQuery.js\";\nimport { QueryObserver } from \"@tanstack/query-core\";\n//#region src/useQuery.ts\nfunction useQuery(options, queryClient) {\n\treturn useBaseQuery(options, QueryObserver, queryClient);\n}\n//#endregion\nexport { useQuery };\n\n//# sourceMappingURL=useQuery.js.map","\"use client\";\nimport { useQueryClient } from \"./QueryClientProvider.js\";\nimport * as React from \"react\";\nimport { notifyManager } from \"@tanstack/query-core\";\n//#region src/useIsFetching.ts\n/**\n* The `useIsFetching` hook returns the `number` of the queries that your application is loading or fetching in\n* the background (useful for app-wide loading indicators).\n*\n* @param filters - The {@link QueryFilters} to narrow down the matched queries.\n* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n* be used.\n* @returns Will be the `number` of the queries that your application is currently loading or fetching in the\n* background.\n*\n* @example\n* ```tsx\n* import { useIsFetching } from '@tanstack/react-query'\n*\n* function PostsFetchingIndicator() {\n* // How many queries matching the posts prefix are fetching?\n* const isFetchingPosts = useIsFetching({ queryKey: ['posts'] })\n*\n* return isFetchingPosts ? <span>Refreshing posts...</span> : null\n* }\n* ```\n*\n* @example\n* A global loading indicator for any query fetching in the background, not just the ones on screen:\n* ```tsx\n* import { useIsFetching } from '@tanstack/react-query'\n*\n* function GlobalLoadingIndicator() {\n* const isFetching = useIsFetching()\n*\n* return isFetching ? (\n* <div>Queries are fetching in the background...</div>\n* ) : null\n* }\n* ```\n*/\nfunction useIsFetching(filters, queryClient) {\n\tconst client = useQueryClient(queryClient);\n\tconst queryCache = client.getQueryCache();\n\treturn React.useSyncExternalStore(React.useCallback((onStoreChange) => queryCache.subscribe(notifyManager.batchCalls(onStoreChange)), [queryCache]), () => client.isFetching(filters), () => client.isFetching(filters));\n}\n//#endregion\nexport { useIsFetching };\n\n//# sourceMappingURL=useIsFetching.js.map","\"use client\";\nimport { useQueryClient } from \"./QueryClientProvider.js\";\nimport * as React from \"react\";\nimport { MutationObserver, noop, notifyManager, shouldThrowError } from \"@tanstack/query-core\";\n//#region src/useMutation.ts\n/**\n* Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.\n* `useMutation` is the hook for that.\n*\n* @see {@link mutationOptions} to share these options across multiple `useMutation` call sites, or to look\n* the mutation up elsewhere via its `mutationKey` (e.g. with `useMutationState`).\n* @param options - The {@link UseMutationOptions} to use — everything you can pass to `useMutation`.\n* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n* be used.\n* @returns `mutate`/`mutateAsync` also accept per-call `onSuccess`/`onError`/`onSettled` callbacks as a second\n* argument, useful for triggering call-site side effects (e.g. navigation) without coupling them to the shared\n* mutation definition. Hook-level callbacks (passed to `options`) fire for every mutation; per-call callbacks\n* fire only for the latest call you've made, and only while the component is still mounted — unmounting before\n* the mutation settles removes the subscription and prevents them from firing.\n*\n* @example\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodo() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* return (\n* <button\n* onClick={() =>\n* addMutation.mutate('Item', {\n* onError: (error) => console.error('Failed to add item:', error),\n* })\n* }\n* >\n* Add\n* </button>\n* )\n* }\n* ```\n*\n* @example\n* Rendering the mutation's own state, rather than just firing it off:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodo() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* return (\n* <div>\n* {addMutation.isPending ? (\n* 'Adding todo...'\n* ) : (\n* <>\n* {addMutation.isError ? (\n* <div>An error occurred: {addMutation.error.message}</div>\n* ) : null}\n* <button onClick={() => addMutation.mutate('Item')}>Add</button>\n* </>\n* )}\n* </div>\n* )\n* }\n* ```\n*\n* @example\n* Optimistic update via `onMutate`, rolling back on `onError`:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodo() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onMutate: async (newTodo) => {\n* await queryClient.cancelQueries({ queryKey: ['todos'] })\n* const previousTodos = queryClient.getQueryData<Array<string>>(['todos'])\n*\n* queryClient.setQueryData<Array<string>>(['todos'], (old) => [\n* ...(old ?? []),\n* newTodo,\n* ])\n*\n* // Passed to `onError` as `onMutateResult` if the mutation fails.\n* return { previousTodos }\n* },\n* onError: (_err, _newTodo, onMutateResult) => {\n* queryClient.setQueryData(['todos'], onMutateResult?.previousTodos)\n* },\n* onSettled: () => {\n* queryClient.invalidateQueries({ queryKey: ['todos'] })\n* },\n* })\n*\n* return (\n* <button onClick={() => addMutation.mutate('Item')}>Add</button>\n* )\n* }\n* ```\n*\n* @example\n* Callbacks passed per call to `mutate` only fire for the last call — `mutateAsync` gives you a\n* promise per call instead, so you can wait for all of them when they succeed:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodos() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* async function handleAddAll(todos: Array<string>) {\n* try {\n* await Promise.all(todos.map((todo) => addMutation.mutateAsync(todo)))\n* } catch (error) {\n* console.error('Failed to add todos:', error)\n* }\n* }\n*\n* return (\n* <button onClick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>\n* Add all\n* </button>\n* )\n* }\n* ```\n*\n* @example\n* If some of the mutations above can fail independently of the others, and you want to know which ones\n* did — rather than losing that information the moment the first one rejects — swap `Promise.all` for\n* `Promise.allSettled`:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodos() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* async function handleAddAll(todos: Array<string>) {\n* const addResults = await Promise.allSettled(\n* todos.map((todo) => addMutation.mutateAsync(todo)),\n* )\n*\n* addResults.forEach((addResult, index) => {\n* if (addResult.status === 'rejected') {\n* console.error(`Failed to add \"${todos[index]}\":`, addResult.reason)\n* }\n* })\n* }\n*\n* return (\n* <button onClick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>\n* Add all\n* </button>\n* )\n* }\n* ```\n*/\nfunction useMutation(options, queryClient) {\n\tconst client = useQueryClient(queryClient);\n\tconst [observer] = React.useState(() => new MutationObserver(client, options));\n\tReact.useEffect(() => {\n\t\tobserver.setOptions(options);\n\t}, [observer, options]);\n\tconst result = React.useSyncExternalStore(React.useCallback((onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer]), () => observer.getCurrentResult(), () => observer.getCurrentResult());\n\tconst mutate = React.useCallback((...args) => {\n\t\tobserver.mutate(args[0], args[1]).catch(noop);\n\t}, [observer]);\n\tif (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) throw result.error;\n\treturn {\n\t\t...result,\n\t\tmutate,\n\t\tmutateAsync: result.mutate\n\t};\n}\n//#endregion\nexport { useMutation };\n\n//# sourceMappingURL=useMutation.js.map","\"use client\";\nimport { useBaseQuery } from \"./useBaseQuery.js\";\nimport { InfiniteQueryObserver } from \"@tanstack/query-core\";\n//#region src/useInfiniteQuery.ts\nfunction useInfiniteQuery(options, queryClient) {\n\treturn useBaseQuery(options, InfiniteQueryObserver, queryClient);\n}\n//#endregion\nexport { useInfiniteQuery };\n\n//# sourceMappingURL=useInfiniteQuery.js.map","var QrCodeDataType = /* @__PURE__ */ ((QrCodeDataType2) => {\n QrCodeDataType2[QrCodeDataType2[\"Border\"] = -1] = \"Border\";\n QrCodeDataType2[QrCodeDataType2[\"Data\"] = 0] = \"Data\";\n QrCodeDataType2[QrCodeDataType2[\"Function\"] = 1] = \"Function\";\n QrCodeDataType2[QrCodeDataType2[\"Position\"] = 2] = \"Position\";\n QrCodeDataType2[QrCodeDataType2[\"Timing\"] = 3] = \"Timing\";\n QrCodeDataType2[QrCodeDataType2[\"Alignment\"] = 4] = \"Alignment\";\n return QrCodeDataType2;\n})(QrCodeDataType || {});\n\nconst LOW = [0, 1];\nconst MEDIUM = [1, 0];\nconst QUARTILE = [2, 3];\nconst HIGH = [3, 2];\nconst EccMap = {\n L: LOW,\n M: MEDIUM,\n Q: QUARTILE,\n H: HIGH\n};\nconst NUMERIC_REGEX = /^\\d*$/;\nconst ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+./:-]*$/;\nconst ALPHANUMERIC_CHARSET = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:\";\nconst MIN_VERSION = 1;\nconst MAX_VERSION = 40;\nconst PENALTY_N1 = 3;\nconst PENALTY_N2 = 3;\nconst PENALTY_N3 = 40;\nconst PENALTY_N4 = 10;\nconst ECC_CODEWORDS_PER_BLOCK = [\n // Version: (note that index 0 is for padding, and is set to an illegal value)\n // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level\n [-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],\n // Low\n [-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28],\n // Medium\n [-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],\n // Quartile\n [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]\n // High\n];\nconst NUM_ERROR_CORRECTION_BLOCKS = [\n // Version: (note that index 0 is for padding, and is set to an illegal value)\n // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level\n [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],\n // Low\n [-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49],\n // Medium\n [-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68],\n // Quartile\n [-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]\n // High\n];\nclass QrCode {\n /* -- Constructor (low level) and fields -- */\n // Creates a new QR Code with the given version number,\n // error correction level, data codeword bytes, and mask number.\n // This is a low-level API that most users should not use directly.\n // A mid-level API is the encodeSegments() function.\n constructor(version, ecc, dataCodewords, msk) {\n this.version = version;\n this.ecc = ecc;\n if (version < MIN_VERSION || version > MAX_VERSION)\n throw new RangeError(\"Version value out of range\");\n if (msk < -1 || msk > 7)\n throw new RangeError(\"Mask value out of range\");\n this.size = version * 4 + 17;\n const row = Array.from({ length: this.size }).fill(false);\n for (let i = 0; i < this.size; i++) {\n this.modules.push(row.slice());\n this.types.push(row.map(() => 0));\n }\n this.drawFunctionPatterns();\n const allCodewords = this.addEccAndInterleave(dataCodewords);\n this.drawCodewords(allCodewords);\n if (msk === -1) {\n let minPenalty = 1e9;\n for (let i = 0; i < 8; i++) {\n this.applyMask(i);\n this.drawFormatBits(i);\n const penalty = this.getPenaltyScore();\n if (penalty < minPenalty) {\n msk = i;\n minPenalty = penalty;\n }\n this.applyMask(i);\n }\n }\n this.mask = msk;\n this.applyMask(msk);\n this.drawFormatBits(msk);\n }\n /* -- Fields -- */\n // The width and height of this QR Code, measured in modules, between\n // 21 and 177 (inclusive). This is equal to version * 4 + 17.\n size;\n // The index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive).\n // Even if a QR Code is created with automatic masking requested (mask = -1),\n // the resulting object still has a mask value between 0 and 7.\n mask;\n // The modules of this QR Code (false = light, true = dark).\n // Immutable after constructor finishes. Accessed through getModule().\n modules = [];\n types = [];\n /* -- Accessor methods -- */\n // Returns the color of the module (pixel) at the given coordinates, which is false\n // for light or true for dark. The top left corner has the coordinates (x=0, y=0).\n // If the given coordinates are out of bounds, then false (light) is returned.\n getModule(x, y) {\n return x >= 0 && x < this.size && y >= 0 && y < this.size && this.modules[y][x];\n }\n /* -- Private helper methods for constructor: Drawing function modules -- */\n // Reads this object's version field, and draws and marks all function modules.\n drawFunctionPatterns() {\n for (let i = 0; i < this.size; i++) {\n this.setFunctionModule(6, i, i % 2 === 0, QrCodeDataType.Timing);\n this.setFunctionModule(i, 6, i % 2 === 0, QrCodeDataType.Timing);\n }\n this.drawFinderPattern(3, 3);\n this.drawFinderPattern(this.size - 4, 3);\n this.drawFinderPattern(3, this.size - 4);\n const alignPatPos = this.getAlignmentPatternPositions();\n const numAlign = alignPatPos.length;\n for (let i = 0; i < numAlign; i++) {\n for (let j = 0; j < numAlign; j++) {\n if (!(i === 0 && j === 0 || i === 0 && j === numAlign - 1 || i === numAlign - 1 && j === 0))\n this.drawAlignmentPattern(alignPatPos[i], alignPatPos[j]);\n }\n }\n this.drawFormatBits(0);\n this.drawVersion();\n }\n // Draws two copies of the format bits (with its own error correction code)\n // based on the given mask and this object's error correction level field.\n drawFormatBits(mask) {\n const data = this.ecc[1] << 3 | mask;\n let rem = data;\n for (let i = 0; i < 10; i++)\n rem = rem << 1 ^ (rem >>> 9) * 1335;\n const bits = (data << 10 | rem) ^ 21522;\n for (let i = 0; i <= 5; i++)\n this.setFunctionModule(8, i, getBit(bits, i));\n this.setFunctionModule(8, 7, getBit(bits, 6));\n this.setFunctionModule(8, 8, getBit(bits, 7));\n this.setFunctionModule(7, 8, getBit(bits, 8));\n for (let i = 9; i < 15; i++)\n this.setFunctionModule(14 - i, 8, getBit(bits, i));\n for (let i = 0; i < 8; i++)\n this.setFunctionModule(this.size - 1 - i, 8, getBit(bits, i));\n for (let i = 8; i < 15; i++)\n this.setFunctionModule(8, this.size - 15 + i, getBit(bits, i));\n this.setFunctionModule(8, this.size - 8, true);\n }\n // Draws two copies of the version bits (with its own error correction code),\n // based on this object's version field, iff 7 <= version <= 40.\n drawVersion() {\n if (this.version < 7)\n return;\n let rem = this.version;\n for (let i = 0; i < 12; i++)\n rem = rem << 1 ^ (rem >>> 11) * 7973;\n const bits = this.version << 12 | rem;\n for (let i = 0; i < 18; i++) {\n const color = getBit(bits, i);\n const a = this.size - 11 + i % 3;\n const b = Math.floor(i / 3);\n this.setFunctionModule(a, b, color);\n this.setFunctionModule(b, a, color);\n }\n }\n // Draws a 9*9 finder pattern including the border separator,\n // with the center module at (x, y). Modules can be out of bounds.\n drawFinderPattern(x, y) {\n for (let dy = -4; dy <= 4; dy++) {\n for (let dx = -4; dx <= 4; dx++) {\n const dist = Math.max(Math.abs(dx), Math.abs(dy));\n const xx = x + dx;\n const yy = y + dy;\n if (xx >= 0 && xx < this.size && yy >= 0 && yy < this.size)\n this.setFunctionModule(xx, yy, dist !== 2 && dist !== 4, QrCodeDataType.Position);\n }\n }\n }\n // Draws a 5*5 alignment pattern, with the center module\n // at (x, y). All modules must be in bounds.\n drawAlignmentPattern(x, y) {\n for (let dy = -2; dy <= 2; dy++) {\n for (let dx = -2; dx <= 2; dx++) {\n this.setFunctionModule(\n x + dx,\n y + dy,\n Math.max(Math.abs(dx), Math.abs(dy)) !== 1,\n QrCodeDataType.Alignment\n );\n }\n }\n }\n // Sets the color of a module and marks it as a function module.\n // Only used by the constructor. Coordinates must be in bounds.\n setFunctionModule(x, y, isDark, type = QrCodeDataType.Function) {\n this.modules[y][x] = isDark;\n this.types[y][x] = type;\n }\n /* -- Private helper methods for constructor: Codewords and masking -- */\n // Returns a new byte string representing the given data with the appropriate error correction\n // codewords appended to it, based on this object's version and error correction level.\n addEccAndInterleave(data) {\n const ver = this.version;\n const ecl = this.ecc;\n if (data.length !== getNumDataCodewords(ver, ecl))\n throw new RangeError(\"Invalid argument\");\n const numBlocks = NUM_ERROR_CORRECTION_BLOCKS[ecl[0]][ver];\n const blockEccLen = ECC_CODEWORDS_PER_BLOCK[ecl[0]][ver];\n const rawCodewords = Math.floor(getNumRawDataModules(ver) / 8);\n const numShortBlocks = numBlocks - rawCodewords % numBlocks;\n const shortBlockLen = Math.floor(rawCodewords / numBlocks);\n const blocks = [];\n const rsDiv = reedSolomonComputeDivisor(blockEccLen);\n for (let i = 0, k = 0; i < numBlocks; i++) {\n const dat = data.slice(k, k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1));\n k += dat.length;\n const ecc = reedSolomonComputeRemainder(dat, rsDiv);\n if (i < numShortBlocks)\n dat.push(0);\n blocks.push(dat.concat(ecc));\n }\n const result = [];\n for (let i = 0; i < blocks[0].length; i++) {\n blocks.forEach((block, j) => {\n if (i !== shortBlockLen - blockEccLen || j >= numShortBlocks)\n result.push(block[i]);\n });\n }\n return result;\n }\n // Draws the given sequence of 8-bit codewords (data and error correction) onto the entire\n // data area of this QR Code. Function modules need to be marked off before this is called.\n drawCodewords(data) {\n if (data.length !== Math.floor(getNumRawDataModules(this.version) / 8))\n throw new RangeError(\"Invalid argument\");\n let i = 0;\n for (let right = this.size - 1; right >= 1; right -= 2) {\n if (right === 6)\n right = 5;\n for (let vert = 0; vert < this.size; vert++) {\n for (let j = 0; j < 2; j++) {\n const x = right - j;\n const upward = (right + 1 & 2) === 0;\n const y = upward ? this.size - 1 - vert : vert;\n if (!this.types[y][x] && i < data.length * 8) {\n this.modules[y][x] = getBit(data[i >>> 3], 7 - (i & 7));\n i++;\n }\n }\n }\n }\n }\n // XORs the codeword modules in this QR Code with the given mask pattern.\n // The function modules must be marked and the codeword bits must be drawn\n // before masking. Due to the arithmetic of XOR, calling applyMask() with\n // the same mask value a second time will undo the mask. A final well-formed\n // QR Code needs exactly one (not zero, two, etc.) mask applied.\n applyMask(mask) {\n if (mask < 0 || mask > 7)\n throw new RangeError(\"Mask value out of range\");\n for (let y = 0; y < this.size; y++) {\n for (let x = 0; x < this.size; x++) {\n let invert;\n switch (mask) {\n case 0:\n invert = (x + y) % 2 === 0;\n break;\n case 1:\n invert = y % 2 === 0;\n break;\n case 2:\n invert = x % 3 === 0;\n break;\n case 3:\n invert = (x + y) % 3 === 0;\n break;\n case 4:\n invert = (Math.floor(x / 3) + Math.floor(y / 2)) % 2 === 0;\n break;\n case 5:\n invert = x * y % 2 + x * y % 3 === 0;\n break;\n case 6:\n invert = (x * y % 2 + x * y % 3) % 2 === 0;\n break;\n case 7:\n invert = ((x + y) % 2 + x * y % 3) % 2 === 0;\n break;\n default:\n throw new Error(\"Unreachable\");\n }\n if (!this.types[y][x] && invert)\n this.modules[y][x] = !this.modules[y][x];\n }\n }\n }\n // Calculates and returns the penalty score based on state of this QR Code's current modules.\n // This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.\n getPenaltyScore() {\n let result = 0;\n for (let y = 0; y < this.size; y++) {\n let runColor = false;\n let runX = 0;\n const runHistory = [0, 0, 0, 0, 0, 0, 0];\n for (let x = 0; x < this.size; x++) {\n if (this.modules[y][x] === runColor) {\n runX++;\n if (runX === 5)\n result += PENALTY_N1;\n else if (runX > 5)\n result++;\n } else {\n this.finderPenaltyAddHistory(runX, runHistory);\n if (!runColor)\n result += this.finderPenaltyCountPatterns(runHistory) * PENALTY_N3;\n runColor = this.modules[y][x];\n runX = 1;\n }\n }\n result += this.finderPenaltyTerminateAndCount(runColor, runX, runHistory) * PENALTY_N3;\n }\n for (let x = 0; x < this.size; x++) {\n let runColor = false;\n let runY = 0;\n const runHistory = [0, 0, 0, 0, 0, 0, 0];\n for (let y = 0; y < this.size; y++) {\n if (this.modules[y][x] === runColor) {\n runY++;\n if (runY === 5)\n result += PENALTY_N1;\n else if (runY > 5)\n result++;\n } else {\n this.finderPenaltyAddHistory(runY, runHistory);\n if (!runColor)\n result += this.finderPenaltyCountPatterns(runHistory) * PENALTY_N3;\n runColor = this.modules[y][x];\n runY = 1;\n }\n }\n result += this.finderPenaltyTerminateAndCount(runColor, runY, runHistory) * PENALTY_N3;\n }\n for (let y = 0; y < this.size - 1; y++) {\n for (let x = 0; x < this.size - 1; x++) {\n const color = this.modules[y][x];\n if (color === this.modules[y][x + 1] && color === this.modules[y + 1][x] && color === this.modules[y + 1][x + 1]) {\n result += PENALTY_N2;\n }\n }\n }\n let dark = 0;\n for (const row of this.modules)\n dark = row.reduce((sum, color) => sum + (color ? 1 : 0), dark);\n const total = this.size * this.size;\n const k = Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1;\n result += k * PENALTY_N4;\n return result;\n }\n /* -- Private helper functions -- */\n // Returns an ascending list of positions of alignment patterns for this version number.\n // Each position is in the range [0,177), and are used on both the x and y axes.\n // This could be implemented as lookup table of 40 variable-length lists of integers.\n getAlignmentPatternPositions() {\n if (this.version === 1) {\n return [];\n } else {\n const numAlign = Math.floor(this.version / 7) + 2;\n const step = this.version === 32 ? 26 : Math.ceil((this.version * 4 + 4) / (numAlign * 2 - 2)) * 2;\n const result = [6];\n for (let pos = this.size - 7; result.length < numAlign; pos -= step)\n result.splice(1, 0, pos);\n return result;\n }\n }\n // Can only be called immediately after a light run is added, and\n // returns either 0, 1, or 2. A helper function for getPenaltyScore().\n finderPenaltyCountPatterns(runHistory) {\n const n = runHistory[1];\n const core = n > 0 && runHistory[2] === n && runHistory[3] === n * 3 && runHistory[4] === n && runHistory[5] === n;\n return (core && runHistory[0] >= n * 4 && runHistory[6] >= n ? 1 : 0) + (core && runHistory[6] >= n * 4 && runHistory[0] >= n ? 1 : 0);\n }\n // Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().\n finderPenaltyTerminateAndCount(currentRunColor, currentRunLength, runHistory) {\n if (currentRunColor) {\n this.finderPenaltyAddHistory(currentRunLength, runHistory);\n currentRunLength = 0;\n }\n currentRunLength += this.size;\n this.finderPenaltyAddHistory(currentRunLength, runHistory);\n return this.finderPenaltyCountPatterns(runHistory);\n }\n // Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().\n finderPenaltyAddHistory(currentRunLength, runHistory) {\n if (runHistory[0] === 0)\n currentRunLength += this.size;\n runHistory.pop();\n runHistory.unshift(currentRunLength);\n }\n}\nfunction appendBits(val, len, bb) {\n if (len < 0 || len > 31 || val >>> len !== 0)\n throw new RangeError(\"Value out of range\");\n for (let i = len - 1; i >= 0; i--)\n bb.push(val >>> i & 1);\n}\nfunction getBit(x, i) {\n return (x >>> i & 1) !== 0;\n}\nclass QrSegment {\n // Creates a new QR Code segment with the given attributes and data.\n // The character count (numChars) must agree with the mode and the bit buffer length,\n // but the constraint isn't checked. The given bit buffer is cloned and stored.\n constructor(mode, numChars, bitData) {\n this.mode = mode;\n this.numChars = numChars;\n this.bitData = bitData;\n if (numChars < 0)\n throw new RangeError(\"Invalid argument\");\n this.bitData = bitData.slice();\n }\n /* -- Methods -- */\n // Returns a new copy of the data bits of this segment.\n getData() {\n return this.bitData.slice();\n }\n}\nconst MODE_NUMERIC = [1, 10, 12, 14];\nconst MODE_ALPHANUMERIC = [2, 9, 11, 13];\nconst MODE_BYTE = [4, 8, 16, 16];\nfunction numCharCountBits(mode, ver) {\n return mode[Math.floor((ver + 7) / 17) + 1];\n}\nfunction makeBytes(data) {\n const bb = [];\n for (const b of data)\n appendBits(b, 8, bb);\n return new QrSegment(MODE_BYTE, data.length, bb);\n}\nfunction makeNumeric(digits) {\n if (!isNumeric(digits))\n throw new RangeError(\"String contains non-numeric characters\");\n const bb = [];\n for (let i = 0; i < digits.length; ) {\n const n = Math.min(digits.length - i, 3);\n appendBits(Number.parseInt(digits.substring(i, i + n), 10), n * 3 + 1, bb);\n i += n;\n }\n return new QrSegment(MODE_NUMERIC, digits.length, bb);\n}\nfunction makeAlphanumeric(text) {\n if (!isAlphanumeric(text))\n throw new RangeError(\"String contains unencodable characters in alphanumeric mode\");\n const bb = [];\n let i;\n for (i = 0; i + 2 <= text.length; i += 2) {\n let temp = ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)) * 45;\n temp += ALPHANUMERIC_CHARSET.indexOf(text.charAt(i + 1));\n appendBits(temp, 11, bb);\n }\n if (i < text.length)\n appendBits(ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)), 6, bb);\n return new QrSegment(MODE_ALPHANUMERIC, text.length, bb);\n}\nfunction makeSegments(text) {\n if (text === \"\")\n return [];\n else if (isNumeric(text))\n return [makeNumeric(text)];\n else if (isAlphanumeric(text))\n return [makeAlphanumeric(text)];\n else\n return [makeBytes(toUtf8ByteArray(text))];\n}\nfunction isNumeric(text) {\n return NUMERIC_REGEX.test(text);\n}\nfunction isAlphanumeric(text) {\n return ALPHANUMERIC_REGEX.test(text);\n}\nfunction getTotalBits(segs, version) {\n let result = 0;\n for (const seg of segs) {\n const ccbits = numCharCountBits(seg.mode, version);\n if (seg.numChars >= 1 << ccbits)\n return Number.POSITIVE_INFINITY;\n result += 4 + ccbits + seg.bitData.length;\n }\n return result;\n}\nfunction toUtf8ByteArray(str) {\n str = encodeURI(str);\n const result = [];\n for (let i = 0; i < str.length; i++) {\n if (str.charAt(i) !== \"%\") {\n result.push(str.charCodeAt(i));\n } else {\n result.push(Number.parseInt(str.substring(i + 1, i + 3), 16));\n i += 2;\n }\n }\n return result;\n}\nfunction getNumRawDataModules(ver) {\n if (ver < MIN_VERSION || ver > MAX_VERSION)\n throw new RangeError(\"Version number out of range\");\n let result = (16 * ver + 128) * ver + 64;\n if (ver >= 2) {\n const numAlign = Math.floor(ver / 7) + 2;\n result -= (25 * numAlign - 10) * numAlign - 55;\n if (ver >= 7)\n result -= 36;\n }\n return result;\n}\nfunction getNumDataCodewords(ver, ecl) {\n return Math.floor(getNumRawDataModules(ver) / 8) - ECC_CODEWORDS_PER_BLOCK[ecl[0]][ver] * NUM_ERROR_CORRECTION_BLOCKS[ecl[0]][ver];\n}\nfunction reedSolomonComputeDivisor(degree) {\n if (degree < 1 || degree > 255)\n throw new RangeError(\"Degree out of range\");\n const result = [];\n for (let i = 0; i < degree - 1; i++)\n result.push(0);\n result.push(1);\n let root = 1;\n for (let i = 0; i < degree; i++) {\n for (let j = 0; j < result.length; j++) {\n result[j] = reedSolomonMultiply(result[j], root);\n if (j + 1 < result.length)\n result[j] ^= result[j + 1];\n }\n root = reedSolomonMultiply(root, 2);\n }\n return result;\n}\nfunction reedSolomonComputeRemainder(data, divisor) {\n const result = divisor.map((_) => 0);\n for (const b of data) {\n const factor = b ^ result.shift();\n result.push(0);\n divisor.forEach((coef, i) => result[i] ^= reedSolomonMultiply(coef, factor));\n }\n return result;\n}\nfunction reedSolomonMultiply(x, y) {\n if (x >>> 8 !== 0 || y >>> 8 !== 0)\n throw new RangeError(\"Byte out of range\");\n let z = 0;\n for (let i = 7; i >= 0; i--) {\n z = z << 1 ^ (z >>> 7) * 285;\n z ^= (y >>> i & 1) * x;\n }\n return z;\n}\nfunction encodeSegments(segs, ecl, minVersion = 1, maxVersion = 40, mask = -1, boostEcl = true) {\n if (!(MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= MAX_VERSION) || mask < -1 || mask > 7) {\n throw new RangeError(\"Invalid value\");\n }\n let version;\n let dataUsedBits;\n for (version = minVersion; ; version++) {\n const dataCapacityBits2 = getNumDataCodewords(version, ecl) * 8;\n const usedBits = getTotalBits(segs, version);\n if (usedBits <= dataCapacityBits2) {\n dataUsedBits = usedBits;\n break;\n }\n if (version >= maxVersion)\n throw new RangeError(\"Data too long\");\n }\n for (const newEcl of [MEDIUM, QUARTILE, HIGH]) {\n if (boostEcl && dataUsedBits <= getNumDataCodewords(version, newEcl) * 8)\n ecl = newEcl;\n }\n const bb = [];\n for (const seg of segs) {\n appendBits(seg.mode[0], 4, bb);\n appendBits(seg.numChars, numCharCountBits(seg.mode, version), bb);\n for (const b of seg.getData())\n bb.push(b);\n }\n const dataCapacityBits = getNumDataCodewords(version, ecl) * 8;\n appendBits(0, Math.min(4, dataCapacityBits - bb.length), bb);\n appendBits(0, (8 - bb.length % 8) % 8, bb);\n for (let padByte = 236; bb.length < dataCapacityBits; padByte ^= 236 ^ 17)\n appendBits(padByte, 8, bb);\n const dataCodewords = Array.from({ length: Math.ceil(bb.length / 8) }, () => 0);\n bb.forEach((b, i) => dataCodewords[i >>> 3] |= b << 7 - (i & 7));\n return new QrCode(version, ecl, dataCodewords, mask);\n}\n\nfunction encode(data, options) {\n const {\n ecc = \"L\",\n boostEcc = false,\n minVersion = 1,\n maxVersion = 40,\n maskPattern = -1,\n border = 1\n } = options || {};\n const segment = typeof data === \"string\" ? makeSegments(data) : Array.isArray(data) ? [makeBytes(data)] : void 0;\n if (!segment)\n throw new Error(`uqr only supports encoding string and binary data, but got: ${typeof data}`);\n const qr = encodeSegments(\n segment,\n EccMap[ecc],\n minVersion,\n maxVersion,\n maskPattern,\n boostEcc\n );\n const result = addBorder({\n version: qr.version,\n maskPattern: qr.mask,\n size: qr.size,\n data: qr.modules,\n types: qr.types\n }, border);\n if (options?.invert)\n result.data = result.data.map((row) => row.map((mod) => !mod));\n options?.onEncoded?.(result);\n return result;\n}\nfunction addBorder(input, border = 1) {\n if (!border)\n return input;\n const { size } = input;\n const newSize = size + border * 2;\n input.size = newSize;\n input.data.forEach((row) => {\n for (let i = 0; i < border; i++) {\n row.unshift(false);\n row.push(false);\n }\n });\n for (let i = 0; i < border; i++) {\n input.data.unshift(Array.from({ length: newSize }, (_) => false));\n input.data.push(Array.from({ length: newSize }, (_) => false));\n }\n const b = QrCodeDataType.Border;\n input.types.forEach((row) => {\n for (let i = 0; i < border; i++) {\n row.unshift(b);\n row.push(b);\n }\n });\n for (let i = 0; i < border; i++) {\n input.types.unshift(Array.from({ length: newSize }, (_) => b));\n input.types.push(Array.from({ length: newSize }, (_) => b));\n }\n return input;\n}\nfunction getDataAt(data, x, y, defaults = false) {\n if (x < 0 || y < 0 || x >= data.length || y >= data.length)\n return defaults;\n return data[y][x];\n}\n\nfunction renderUnicode(data, options = {}) {\n const {\n whiteChar = \"\\u2588\",\n blackChar = \"\\u2591\"\n } = options;\n const result = encode(data, options);\n return result.data.map((row) => {\n return row.map((mod) => mod ? blackChar : whiteChar).join(\"\");\n }).join(\"\\n\");\n}\nfunction renderANSI(data, options = {}) {\n return renderUnicode(data, {\n ...options,\n blackChar: \"\\x1B[40m\\u3000\\x1B[0m\",\n whiteChar: \"\\x1B[47m\\u3000\\x1B[0m\"\n });\n}\nfunction renderUnicodeCompact(data, options = {}) {\n const palette = {\n WHITE_ALL: \"\\u2588\",\n WHITE_BLACK: \"\\u2580\",\n BLACK_WHITE: \"\\u2584\",\n BLACK_ALL: \" \"\n };\n const result = encode(data, options);\n const WHITE = false;\n const BLACK = true;\n const at = (x, y) => getDataAt(result.data, x, y, true);\n const lines = [];\n let line = \"\";\n for (let row = 0; row < result.size; row += 2) {\n for (let col = 0; col < result.size; col++) {\n if (at(col, row) === WHITE && at(col, row + 1) === WHITE)\n line += palette.WHITE_ALL;\n else if (at(col, row) === WHITE && at(col, row + 1) === BLACK)\n line += palette.WHITE_BLACK;\n else if (at(col, row) === BLACK && at(col, row + 1) === WHITE)\n line += palette.BLACK_WHITE;\n else\n line += palette.BLACK_ALL;\n }\n lines.push(line);\n line = \"\";\n }\n return lines.join(\"\\n\");\n}\n\nfunction escapeAttr(value) {\n return value.replace(/&/g, \"&amp;\").replace(/\"/g, \"&quot;\").replace(/</g, \"&lt;\").replace(/>/g, \"&gt;\");\n}\nfunction renderSVG(data, options = {}) {\n const result = encode(data, options);\n const {\n pixelSize = 10,\n whiteColor = \"white\",\n blackColor = \"black\"\n } = options;\n const height = result.size * pixelSize;\n const width = result.size * pixelSize;\n let svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 ${width} ${height}\">`;\n const paths = [];\n for (let row = 0; row < result.size; row++) {\n for (let col = 0; col < result.size; col++) {\n const x = col * pixelSize;\n const y = row * pixelSize;\n if (result.data[row][col])\n paths.push(`M${x},${y}h${pixelSize}v${pixelSize}h-${pixelSize}z`);\n }\n }\n svg += `<rect fill=\"${escapeAttr(whiteColor)}\" width=\"${width}\" height=\"${height}\"/>`;\n svg += `<path fill=\"${escapeAttr(blackColor)}\" d=\"${paths.join(\"\")}\"/>`;\n svg += \"</svg>\";\n return svg;\n}\n\nexport { QrCodeDataType, encode, renderANSI, renderSVG, renderUnicode, renderUnicodeCompact };\n","/**\n * Encodes an RGBA image to a ThumbHash. RGB should not be premultiplied by A.\n *\n * @param w The width of the input image. Must be ≤100px.\n * @param h The height of the input image. Must be ≤100px.\n * @param rgba The pixels in the input image, row-by-row. Must have w*h*4 elements.\n * @returns The ThumbHash as a Uint8Array.\n */\nexport function rgbaToThumbHash(w, h, rgba) {\n // Encoding an image larger than 100x100 is slow with no benefit\n if (w > 100 || h > 100) throw new Error(`${w}x${h} doesn't fit in 100x100`)\n let { PI, round, max, cos, abs } = Math\n\n // Determine the average color\n let avg_r = 0, avg_g = 0, avg_b = 0, avg_a = 0\n for (let i = 0, j = 0; i < w * h; i++, j += 4) {\n let alpha = rgba[j + 3] / 255\n avg_r += alpha / 255 * rgba[j]\n avg_g += alpha / 255 * rgba[j + 1]\n avg_b += alpha / 255 * rgba[j + 2]\n avg_a += alpha\n }\n if (avg_a) {\n avg_r /= avg_a\n avg_g /= avg_a\n avg_b /= avg_a\n }\n\n let hasAlpha = avg_a < w * h\n let l_limit = hasAlpha ? 5 : 7 // Use fewer luminance bits if there's alpha\n let lx = max(1, round(l_limit * w / max(w, h)))\n let ly = max(1, round(l_limit * h / max(w, h)))\n let l = [] // luminance\n let p = [] // yellow - blue\n let q = [] // red - green\n let a = [] // alpha\n\n // Convert the image from RGBA to LPQA (composite atop the average color)\n for (let i = 0, j = 0; i < w * h; i++, j += 4) {\n let alpha = rgba[j + 3] / 255\n let r = avg_r * (1 - alpha) + alpha / 255 * rgba[j]\n let g = avg_g * (1 - alpha) + alpha / 255 * rgba[j + 1]\n let b = avg_b * (1 - alpha) + alpha / 255 * rgba[j + 2]\n l[i] = (r + g + b) / 3\n p[i] = (r + g) / 2 - b\n q[i] = r - g\n a[i] = alpha\n }\n\n // Encode using the DCT into DC (constant) and normalized AC (varying) terms\n let encodeChannel = (channel, nx, ny) => {\n let dc = 0, ac = [], scale = 0, fx = []\n for (let cy = 0; cy < ny; cy++) {\n for (let cx = 0; cx * ny < nx * (ny - cy); cx++) {\n let f = 0\n for (let x = 0; x < w; x++)\n fx[x] = cos(PI / w * cx * (x + 0.5))\n for (let y = 0; y < h; y++)\n for (let x = 0, fy = cos(PI / h * cy * (y + 0.5)); x < w; x++)\n f += channel[x + y * w] * fx[x] * fy\n f /= w * h\n if (cx || cy) {\n ac.push(f)\n scale = max(scale, abs(f))\n } else {\n dc = f\n }\n }\n }\n if (scale)\n for (let i = 0; i < ac.length; i++)\n ac[i] = 0.5 + 0.5 / scale * ac[i]\n return [dc, ac, scale]\n }\n let [l_dc, l_ac, l_scale] = encodeChannel(l, max(3, lx), max(3, ly))\n let [p_dc, p_ac, p_scale] = encodeChannel(p, 3, 3)\n let [q_dc, q_ac, q_scale] = encodeChannel(q, 3, 3)\n let [a_dc, a_ac, a_scale] = hasAlpha ? encodeChannel(a, 5, 5) : []\n\n // Write the constants\n let isLandscape = w > h\n let header24 = round(63 * l_dc) | (round(31.5 + 31.5 * p_dc) << 6) | (round(31.5 + 31.5 * q_dc) << 12) | (round(31 * l_scale) << 18) | (hasAlpha << 23)\n let header16 = (isLandscape ? ly : lx) | (round(63 * p_scale) << 3) | (round(63 * q_scale) << 9) | (isLandscape << 15)\n let hash = [header24 & 255, (header24 >> 8) & 255, header24 >> 16, header16 & 255, header16 >> 8]\n let ac_start = hasAlpha ? 6 : 5\n let ac_index = 0\n if (hasAlpha) hash.push(round(15 * a_dc) | (round(15 * a_scale) << 4))\n\n // Write the varying factors\n for (let ac of hasAlpha ? [l_ac, p_ac, q_ac, a_ac] : [l_ac, p_ac, q_ac])\n for (let f of ac)\n hash[ac_start + (ac_index >> 1)] |= round(15 * f) << ((ac_index++ & 1) << 2)\n return new Uint8Array(hash)\n}\n\n/**\n * Decodes a ThumbHash to an RGBA image. RGB is not be premultiplied by A.\n *\n * @param hash The bytes of the ThumbHash.\n * @returns The width, height, and pixels of the rendered placeholder image.\n */\nexport function thumbHashToRGBA(hash) {\n let { PI, min, max, cos, round } = Math\n\n // Read the constants\n let header24 = hash[0] | (hash[1] << 8) | (hash[2] << 16)\n let header16 = hash[3] | (hash[4] << 8)\n let l_dc = (header24 & 63) / 63\n let p_dc = ((header24 >> 6) & 63) / 31.5 - 1\n let q_dc = ((header24 >> 12) & 63) / 31.5 - 1\n let l_scale = ((header24 >> 18) & 31) / 31\n let hasAlpha = header24 >> 23\n let p_scale = ((header16 >> 3) & 63) / 63\n let q_scale = ((header16 >> 9) & 63) / 63\n let isLandscape = header16 >> 15\n let lx = max(3, isLandscape ? hasAlpha ? 5 : 7 : header16 & 7)\n let ly = max(3, isLandscape ? header16 & 7 : hasAlpha ? 5 : 7)\n let a_dc = hasAlpha ? (hash[5] & 15) / 15 : 1\n let a_scale = (hash[5] >> 4) / 15\n\n // Read the varying factors (boost saturation by 1.25x to compensate for quantization)\n let ac_start = hasAlpha ? 6 : 5\n let ac_index = 0\n let decodeChannel = (nx, ny, scale) => {\n let ac = []\n for (let cy = 0; cy < ny; cy++)\n for (let cx = cy ? 0 : 1; cx * ny < nx * (ny - cy); cx++)\n ac.push((((hash[ac_start + (ac_index >> 1)] >> ((ac_index++ & 1) << 2)) & 15) / 7.5 - 1) * scale)\n return ac\n }\n let l_ac = decodeChannel(lx, ly, l_scale)\n let p_ac = decodeChannel(3, 3, p_scale * 1.25)\n let q_ac = decodeChannel(3, 3, q_scale * 1.25)\n let a_ac = hasAlpha && decodeChannel(5, 5, a_scale)\n\n // Decode using the DCT into RGB\n let ratio = thumbHashToApproximateAspectRatio(hash)\n let w = round(ratio > 1 ? 32 : 32 * ratio)\n let h = round(ratio > 1 ? 32 / ratio : 32)\n let rgba = new Uint8Array(w * h * 4), fx = [], fy = []\n for (let y = 0, i = 0; y < h; y++) {\n for (let x = 0; x < w; x++, i += 4) {\n let l = l_dc, p = p_dc, q = q_dc, a = a_dc\n\n // Precompute the coefficients\n for (let cx = 0, n = max(lx, hasAlpha ? 5 : 3); cx < n; cx++)\n fx[cx] = cos(PI / w * (x + 0.5) * cx)\n for (let cy = 0, n = max(ly, hasAlpha ? 5 : 3); cy < n; cy++)\n fy[cy] = cos(PI / h * (y + 0.5) * cy)\n\n // Decode L\n for (let cy = 0, j = 0; cy < ly; cy++)\n for (let cx = cy ? 0 : 1, fy2 = fy[cy] * 2; cx * ly < lx * (ly - cy); cx++, j++)\n l += l_ac[j] * fx[cx] * fy2\n\n // Decode P and Q\n for (let cy = 0, j = 0; cy < 3; cy++) {\n for (let cx = cy ? 0 : 1, fy2 = fy[cy] * 2; cx < 3 - cy; cx++, j++) {\n let f = fx[cx] * fy2\n p += p_ac[j] * f\n q += q_ac[j] * f\n }\n }\n\n // Decode A\n if (hasAlpha)\n for (let cy = 0, j = 0; cy < 5; cy++)\n for (let cx = cy ? 0 : 1, fy2 = fy[cy] * 2; cx < 5 - cy; cx++, j++)\n a += a_ac[j] * fx[cx] * fy2\n\n // Convert to RGB\n let b = l - 2 / 3 * p\n let r = (3 * l - b + q) / 2\n let g = r - q\n rgba[i] = max(0, 255 * min(1, r))\n rgba[i + 1] = max(0, 255 * min(1, g))\n rgba[i + 2] = max(0, 255 * min(1, b))\n rgba[i + 3] = max(0, 255 * min(1, a))\n }\n }\n return { w, h, rgba }\n}\n\n/**\n * Extracts the average color from a ThumbHash. RGB is not be premultiplied by A.\n *\n * @param hash The bytes of the ThumbHash.\n * @returns The RGBA values for the average color. Each value ranges from 0 to 1.\n */\nexport function thumbHashToAverageRGBA(hash) {\n let { min, max } = Math\n let header = hash[0] | (hash[1] << 8) | (hash[2] << 16)\n let l = (header & 63) / 63\n let p = ((header >> 6) & 63) / 31.5 - 1\n let q = ((header >> 12) & 63) / 31.5 - 1\n let hasAlpha = header >> 23\n let a = hasAlpha ? (hash[5] & 15) / 15 : 1\n let b = l - 2 / 3 * p\n let r = (3 * l - b + q) / 2\n let g = r - q\n return {\n r: max(0, min(1, r)),\n g: max(0, min(1, g)),\n b: max(0, min(1, b)),\n a\n }\n}\n\n/**\n * Extracts the approximate aspect ratio of the original image.\n *\n * @param hash The bytes of the ThumbHash.\n * @returns The approximate aspect ratio (i.e. width / height).\n */\nexport function thumbHashToApproximateAspectRatio(hash) {\n let header = hash[3]\n let hasAlpha = hash[2] & 0x80\n let isLandscape = hash[4] & 0x80\n let lx = isLandscape ? hasAlpha ? 5 : 7 : header & 7\n let ly = isLandscape ? header & 7 : hasAlpha ? 5 : 7\n return lx / ly\n}\n\n/**\n * Encodes an RGBA image to a PNG data URL. RGB should not be premultiplied by\n * A. This is optimized for speed and simplicity and does not optimize for size\n * at all. This doesn't do any compression (all values are stored uncompressed).\n *\n * @param w The width of the input image. Must be ≤100px.\n * @param h The height of the input image. Must be ≤100px.\n * @param rgba The pixels in the input image, row-by-row. Must have w*h*4 elements.\n * @returns A data URL containing a PNG for the input image.\n */\nexport function rgbaToDataURL(w, h, rgba) {\n let row = w * 4 + 1\n let idat = 6 + h * (5 + row)\n let bytes = [\n 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0,\n w >> 8, w & 255, 0, 0, h >> 8, h & 255, 8, 6, 0, 0, 0, 0, 0, 0, 0,\n idat >>> 24, (idat >> 16) & 255, (idat >> 8) & 255, idat & 255,\n 73, 68, 65, 84, 120, 1\n ]\n let table = [\n 0, 498536548, 997073096, 651767980, 1994146192, 1802195444, 1303535960,\n 1342533948, -306674912, -267414716, -690576408, -882789492, -1687895376,\n -2032938284, -1609899400, -1111625188\n ]\n let a = 1, b = 0\n for (let y = 0, i = 0, end = row - 1; y < h; y++, end += row - 1) {\n bytes.push(y + 1 < h ? 0 : 1, row & 255, row >> 8, ~row & 255, (row >> 8) ^ 255, 0)\n for (b = (b + a) % 65521; i < end; i++) {\n let u = rgba[i] & 255\n bytes.push(u)\n a = (a + u) % 65521\n b = (b + a) % 65521\n }\n }\n bytes.push(\n b >> 8, b & 255, a >> 8, a & 255, 0, 0, 0, 0,\n 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130\n )\n for (let [start, end] of [[12, 29], [37, 41 + idat]]) {\n let c = ~0\n for (let i = start; i < end; i++) {\n c ^= bytes[i]\n c = (c >>> 4) ^ table[c & 15]\n c = (c >>> 4) ^ table[c & 15]\n }\n c = ~c\n bytes[end++] = c >>> 24\n bytes[end++] = (c >> 16) & 255\n bytes[end++] = (c >> 8) & 255\n bytes[end++] = c & 255\n }\n return 'data:image/png;base64,' + btoa(String.fromCharCode(...bytes))\n}\n\n/**\n * Decodes a ThumbHash to a PNG data URL. This is a convenience function that\n * just calls \"thumbHashToRGBA\" followed by \"rgbaToDataURL\".\n *\n * @param hash The bytes of the ThumbHash.\n * @returns A data URL containing a PNG for the rendered ThumbHash.\n */\nexport function thumbHashToDataURL(hash) {\n let image = thumbHashToRGBA(hash)\n return rgbaToDataURL(image.w, image.h, image.rgba)\n}\n"],"ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134],"mappings":"2jBACA,IAAMiB,GAAc,EAAM,EAAS,EAAM,KAAU,CAClD,OACA,UACA,OACA,MACD,GAGMC,GAAY,EAAG,IAAM,CAC1B,IAAIC,EAAM,MAAM,KAAK,CAAE,OAAQC,EAAE,OAAS,CAAE,GAAI,EAAG,IAAMC,CAAC,EAC1D,IAAK,IAAIA,EAAI,EAAGA,GAAKT,EAAE,OAAQ,IAAK,CACnC,IAAMU,EAAO,CAACD,CAAC,EACf,IAAK,IAAIE,EAAI,EAAGA,GAAKH,EAAE,OAAQ,IAAK,CACnC,IAAMI,EAAOZ,EAAES,EAAI,KAAOD,EAAEG,EAAI,GAAK,EAAI,EACzC,EAAKA,GAAK,KAAK,IAAIJ,EAAII,GAAK,EAAGD,EAAKC,EAAI,GAAK,EAAGJ,EAAII,EAAI,GAAKC,CAAI,CAClE,CACA,EAAMF,CACP,CACA,OAAOH,EAAIC,EAAE,OACd,EAEMK,GAAW,EAAM,IAAe,CACrC,IAAMC,EAAQ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C/B,MAAO,CAAC,EAAEV,GAAM,OAAOA,GAAO,UAAYA,EAAG,OAAS,EACvD,CAgBA,IAAMW,GAAwB,+CACxBC,GAA0B,4QAG1BC,GAAW,CAChB,MAAO,CAAC,IAAK,GAAG,EAChB,IAAO,CACN,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,GAAG,EACVC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,KACA,KACA,IACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,GAAG,EACVC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,KAAM,GAAG,EAChBC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,GAAG,EACVC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,GAAG,EACVC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,GAAG,EACVC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,KACA,KACA,IACA,GACD,EACAC,GAAM,CAAC,GAAG,EACVC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,GAAG,EACVC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CAAC,KAAM,GAAG,EAChBC,GAAM,CAAC,GAAG,EACVC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,IACA,GACD,EACAC,GAAM,CACL,KACA,KACA,IACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,KACA,IACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,GAAG,EACVC,GAAM,CACL,KACA,KACA,IACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,KACA,KACA,IACA,GACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,GAAG,EACVC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CAAC,GAAG,EACVC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CAAC,GAAG,EACVC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,GAAG,EACVC,GAAM,CAAC,GAAG,EACVC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,KACA,KACA,IACA,GACD,EACAC,GAAM,CACL,KACA,KACA,IACA,GACD,EACAC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CACL,KACA,KACA,IACA,GACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACf,QAAS,CACR,IACA,IACA,KACA,IACD,EACA,SAAU,CACT,IACA,KACA,KACA,GACD,EACA,QAAS,CACR,IACA,IACA,IACD,EACA,SAAU,CACT,IACA,KACA,IACA,IACD,EACA,QAAS,CACR,IACA,KACA,IACA,IACD,EACA,QAAS,CACR,IACA,IACA,KACA,IACD,EACA,QAAS,CACR,IACA,KACA,IACA,IACD,EACA,QAAS,CACR,IACA,IACA,KACA,IACD,EACA,QAAS,CACR,IACA,IACA,KACA,IACD,EACA,QAAS,CACR,IACA,IACA,KACA,IACD,EACA,QAAS,CACR,IACA,IACA,IACD,EACA,QAAS,CACR,IACA,IACA,IACD,EACA,QAAS,CACR,KACA,KACA,IACA,GACD,EACA,QAAS,CACR,KACA,IACA,GACD,EACA,QAAS,CACR,IACA,IACA,IACD,EACA,QAAS,CACR,IACA,IACA,IACD,EACA,QAAS,CACR,KACA,IACA,GACD,EACA,QAAS,CAAC,IAAK,IAAI,EACnB,QAAS,CACR,KACA,IACA,GACD,EACA,QAAS,CACR,KACA,KACA,IACA,GACD,EACA,QAAS,CACR,KACA,KACA,IACA,GACD,EACA,QAAS,CACR,KACA,IACA,KACA,GACD,EACA,QAAS,CACR,KACA,IACA,GACD,EACA,QAAS,CACR,IACA,KACA,KACA,GACD,CACD,EAUA,SAASC,GAAe,EAAU,EAAQ,CACzC,IAAIC,EAAe,GACnB,IAAK,IAAIC,EAAa,EAAGA,EAAarU,EAAS,OAAQ,IAAc,CACpE,IAAMsU,EAActU,EAAS,OAAOqU,CAAU,EAC9C,GAAIC,IAAgB,IAAK,CACxB,IAAIC,EAAc,EAClB,KAAOF,EAAa,EAAIrU,EAAS,QAAUA,EAAS,OAAOqU,EAAa,CAAC,IAAMC,GAC9E,IACA,IAED,IAAIE,EAAU,GAAKD,EAAc,GAC7BE,EAAeF,EAAc,EAAI,EAAI,GAAKA,GAAe,GAEzDG,EAAWC,GAA+BC,CAAM,EAEpD,KADIF,GAAY,KAAOA,GAAY,OAAK,EAAe,GAChD,IAAiB,GAAG,GAAgB,IAC3C,KAAO,IAAY,GAAG,EAAeA,EAAWN,CACjD,KAAO,CACFA,GADME,IAAgB,IAAqB,IAC3B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D,EAAK,IAAK,CACtC,IAAIy6D,EAAIX,EAAK,GAAK,IAClBr7B,EAAM,KAAKg8B,CAAC,EACZ,GAAKz9D,EAAIy9D,GAAK,MACd,GAAKj9D,EAAIR,GAAK,KAChB,CAEFyhC,EAAM,KACJjhC,GAAK,EAAGA,EAAI,IAAKR,GAAK,EAAGA,EAAI,IAAK,EAAG,EAAG,EAAG,EAC3C,EAAG,EAAG,EAAG,EAAG,GAAI,GAAI,GAAI,GAAI,IAAK,GAAI,GAAI,GAC3C,EACA,IAAK,GAAI,CAAC+C,EAAOC,IAAQ,CAAC,CAAC,GAAI,EAAE,EAAG,CAAC,GAAI,GAAKu6D,CAAI,CAAC,EAAG,CACpD,IAAIj4D,EAAI,GACR,IAAK,IAAI7E,EAAIsC,EAAOtC,EAAIuC,EAAK,IAC3B,GAAKy+B,EAAMhhC,GACX,EAAK6E,IAAM,EAAKk4D,EAAMl4D,EAAI,IAC1B,EAAKA,IAAM,EAAKk4D,EAAMl4D,EAAI,IAE5B,EAAI,CAACA,EACL,EAAM,KAASA,IAAM,GACrB,EAAM,KAAUA,GAAK,GAAM,IAC3B,EAAM,KAAUA,GAAK,EAAK,IAC1B,EAAM,KAASA,EAAI,GACrB,CACA,MAAO,yBAA2B,KAAK,OAAO,aAAa,GAAGm8B,CAAK,CAAC,CACtE,CASA,SAAgBi8B,GAAmB,EAAM,CACvC,IAAIC,EAAQ7C,GAAgBpL,CAAI,EAChC,OAAO4N,GAAcK,EAAM,EAAGA,EAAM,EAAGA,EAAM,IAAI,CACnD","debugId":"d01f2c81-9353-4638-9bec-d9b1758751f7"}
1
+ {"version":3,"file":"vendor-t7Q7QbPu.js","names":["isValidDate","PACKAGE_VERSION","now","isPlainObject","isServer","isServer","isPlainObject","getMethod","PACKAGE_VERSION","isServer","getDefaultState","n","a","t","__toESM","require_react","require_jsx_runtime","diagnostic","distance","row","b","i","next","j","cost","suggest","lower","name","best","candidates","candidate","joinSpans","daysIn","month","year","isValidDate$1","match","text","day","isValidTimestamp","hour","minute","second","offsetHour","offsetMinute","unitSeconds","timestampMillis","durationText","durationSeconds","timestampShape","dateShape","dateTail","hexShape","numberShape","at","shape","source","scanNumeric","timestamp","start","end","hex","isDelimiter","extensions","simple","hexDigits","from","length","escape","char","lengths","code","octal","scanString","quote","errors","value","result","punctuation","keywords","afterNow","rparen","lparen","tokens","lex","special","push","surrogate","scan","twoChars","offsetPlus","ParseAbort","error","abort","message","hint","span","peek","c","offset","token","eat","kind","describe","expect","what","withDepth","run","segmentKinds","parseMember","first","path","part","isIndex","durationFrom","operandKinds$1","isOperand$1","node","parseCall","args","parseArg","parseOperand","number","raw","member","composite","open","inner","primary","startsOperand","left","nowOffset","isNow","allowed","op","right","parseRight","arg","comparators","termStarts","group","items","item","sync","depth","parseRestriction","star","parseSimple","parseExpression","parseTerm","following","negativeNumber","parseTermRecovering","parseFactor","parseSequence","parseFilter","maxLength","options","lexed","parts","stray","defined","ast","findField","fields","alias","spec","resolveMember","head","found","ctx","usable","s","close","filterable","segment","problem","expected","textOf$1","numeric","compatible","wanted","actual","checkValue","type","isOperandArg","checkArg","param","resolved","checked","checkOperand","checkCall","functions","call","fn","min","expectedCount","p","arithmetic$1","literalTypes","ordered","checkSubject","operatorError","checkRight","subject","checkCompare","wildcard","checkHas","checkExpr","checkFilter","escapes","literal","isNegative","printOperand","printArg","isExpr","printFilter","operandKinds","grouped","parent","Decimal","int","scale","other","plain","parseDecimal","fraction","numericText","doubleOf","decimalOf","globMatch","resume","pattern","isDuration","literalValue","secondsOf","millisOf","textOf","verdict","order","numbers","x","y","againstString","millis","seconds","compareValue","resolvePath","current","record","step","elements","values","maxDepth","leaves","defaultSearch","needle","leaf","isOperand","arithmetic","sign","callValue","operandValue","evaluateExpr","matches","convertFor","evaluateCompare","evaluateHas","key","evaluateFilter","tokenize","parseOrderBy","pos","fail","skipItem","parseItem","last","word","direction","after","find","field","checkOrderBy","schema","f","sortable","failed","require_constants","__commonJSMin","require_debug","require_re","debug","re","safeRe","src","safeSrc","R","LETTERDASHNUMBER","safeRegexReplacements","MAX_LENGTH","MAX_SAFE_BUILD_LENGTH","makeSafeRegex","max","createToken","safe","index","isGlobal","MAX_SAFE_COMPONENT_LENGTH","require_parse_options","looseOption","emptyOpts","require_identifiers","compareIdentifiers","anum","bnum","require_semver$1","parseOptions","isPrereleaseIdentifier","identifiers","identifier","prerelease","SemVer","version","m","MAX_SAFE_INTEGER","id","num","release","identifierBase","base","prereleaseBase","require_parse","er","throwErrors","require_valid$1","parse","v","require_clean","require_inc","require_diff","v1","version1","v2","version2","comparison","v1Higher","highVersion","lowVersion","highHasPre","prefix","require_major","loose","require_minor","require_patch","require_prerelease","parsed","require_compare","require_rcompare","compare","require_compare_loose","require_compare_build","versionA","versionB","require_sort","compareBuild","list","require_rsort","require_gt","require_lt","require_eq","require_neq","require_gte","require_lte","require_cmp","eq","neq","gt","gte","lt","lte","require_coerce","coerceRtlRegex","major","require_truncate","constants","truncate","truncation","clonedVersion","cloneInputVersion","doTruncation","isPrerelease","require_lrucache","firstKey","require_range","SPACE_CHARACTERS","Range","range","Comparator","r","isNullSet","isAny","comps","k","BUILDSTRIPRE","memoKey","FLAG_INCLUDE_PRERELEASE","FLAG_LOOSE","cached","cache","hr","hyphenReplace","comparatorTrimReplace","tildeTrimReplace","caretTrimReplace","rangeList","parseComparator","comp","replaceGTE0","rangeMap","isSatisfiable","thisComparators","rangeComparators","thisComparator","rangeComparator","testSet","require_comparator","remainingComparators","testComparator","otherComparator","replaceCarets","replaceTildes","replaceXRanges","replaceStars","isX","invalidXRangeOrder","M","replaceTilde","z","_","pr","ret","replaceCaret","replaceXRange","gtlt","xM","xm","xp","anyX","fM","fm","incPr","fp","fpr","to","tM","tm","tp","tpr","set","ANY","cmp","require_satisfies","require_to_comparators","require_max_satisfying","maxSV","rangeObj","versions","require_min_satisfying","minSV","require_min_version","minver","setMin","compver","comparator","require_valid","require_outside","satisfies","gtfn","ltefn","ltfn","ecomp","hilo","high","low","require_gtr","outside","require_ltr","require_intersects","r1","r2","require_simplify","prev","ranges","simplified","original","require_subset","subset","sub","dom","sawNonNull","simpleSub","simpleDom","isSub","simpleSubset","minimumVersionWithPreRelease","minimumVersion","eqSet","higherGT","lowerLT","gtltComp","higher","hasDomLT","hasDomGT","needDomLTPre","needDomGTPre","require_semver","internalRe","ParseError","LF","CR","SPACE","MAX_FIELD_PREFIX_LENGTH","createParser","config","pendingFragments","pendingFragmentsLength","bomPrefix","data","dataLines","eventType","terminated","skippingLine","skipNextLineFeed","feed","chunk","resumeAfterSkip","trailing","processLines","storeTrailing","checkForBufferOverflow","shouldBufferTrailing","input","crIndex","lfIndex","lineEnd","parseLine","firstCharCode","onComment","isPotentialField","maxBufferSize","onError","searchIndex","onId","onEvent","isDataPrefix","valueStart","isEventPrefix","dispatchEvent","line","fieldSeparatorIndex","processField","onRetry","reset","incompleteLine","memoize","cacheDefault","serializer","serializerDefault","strategyDefault","isPrimitive","monadic","cacheKey","computedValue","variadic","assemble","strategy","context","serialize","strategyVariadic","strategyMonadic","ObjectWithoutPrototypeCache","strategies","DATE_TIME_REGEX","parseDateTimeSkeleton","skeleton","len","WHITE_SPACE_REGEX","parseNumberSkeletonFromString","stringTokens","stringToken","stemAndOptions","stem","option","icuUnitToEcma","unit","FRACTION_PRECISION_REGEX","SIGNIFICANT_PRECISION_REGEX","INTEGER_WIDTH_REGEX","CONCISE_INTEGER_WIDTH_REGEX","parseSignificantPrecision","str","g2","g1","parseSign","parseConciseScientificAndEngineeringStem","signDisplay","parseNotationOptions","opt","parseNumberSkeleton","all","g3","g4","g5","signOpts","conciseScientificAndEngineeringOpts","ErrorKind","\"EXPECT_ARGUMENT_CLOSING_BRACE\"","\"EMPTY_ARGUMENT\"","\"MALFORMED_ARGUMENT\"","\"EXPECT_ARGUMENT_TYPE\"","\"INVALID_ARGUMENT_TYPE\"","\"EXPECT_ARGUMENT_STYLE\"","\"INVALID_NUMBER_SKELETON\"","\"INVALID_DATE_TIME_SKELETON\"","\"EXPECT_NUMBER_SKELETON\"","\"EXPECT_DATE_TIME_SKELETON\"","\"UNCLOSED_QUOTE_IN_ARGUMENT_STYLE\"","\"EXPECT_SELECT_ARGUMENT_OPTIONS\"","\"EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE\"","\"INVALID_PLURAL_ARGUMENT_OFFSET_VALUE\"","\"EXPECT_SELECT_ARGUMENT_SELECTOR\"","\"EXPECT_PLURAL_ARGUMENT_SELECTOR\"","\"EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\"","\"EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT\"","\"INVALID_PLURAL_ARGUMENT_SELECTOR\"","\"DUPLICATE_PLURAL_ARGUMENT_SELECTOR\"","\"DUPLICATE_SELECT_ARGUMENT_SELECTOR\"","\"MISSING_OTHER_CLAUSE\"","\"INVALID_TAG\"","\"INVALID_TAG_NAME\"","\"UNMATCHED_CLOSING_TAG\"","\"UNCLOSED_TAG\"","isLiteralElement","el","isArgumentElement","isNumberElement","isDateElement","isTimeElement","isSelectElement","isPluralElement","isPoundElement","isTagElement","isNumberSkeleton","isDateTimeSkeleton","SPACE_SEPARATOR_REGEX","IDENTIFIER_PREFIX_REGEX","timeData","\"AC\"","\"AD\"","\"AE\"","\"AF\"","\"AG\"","\"AI\"","\"AL\"","\"AM\"","\"AO\"","\"AR\"","\"AS\"","\"AT\"","\"AU\"","\"AW\"","\"AX\"","\"AZ\"","\"BA\"","\"BB\"","\"BD\"","\"BE\"","\"BF\"","\"BG\"","\"BH\"","\"BI\"","\"BJ\"","\"BL\"","\"BM\"","\"BN\"","\"BO\"","\"BQ\"","\"BR\"","\"BS\"","\"BT\"","\"BW\"","\"BY\"","\"BZ\"","\"CA\"","\"CC\"","\"CD\"","\"CF\"","\"CG\"","\"CH\"","\"CI\"","\"CK\"","\"CL\"","\"CM\"","\"CN\"","\"CO\"","\"CP\"","\"CR\"","\"CU\"","\"CV\"","\"CW\"","\"CX\"","\"CY\"","\"CZ\"","\"DE\"","\"DG\"","\"DJ\"","\"DK\"","\"DM\"","\"DO\"","\"DZ\"","\"EA\"","\"EC\"","\"EE\"","\"EG\"","\"EH\"","\"ER\"","\"ES\"","\"ET\"","\"FI\"","\"FJ\"","\"FK\"","\"FM\"","\"FO\"","\"FR\"","\"GA\"","\"GB\"","\"GD\"","\"GE\"","\"GF\"","\"GG\"","\"GH\"","\"GI\"","\"GL\"","\"GM\"","\"GN\"","\"GP\"","\"GQ\"","\"GR\"","\"GS\"","\"GT\"","\"GU\"","\"GW\"","\"GY\"","\"HK\"","\"HN\"","\"HR\"","\"HU\"","\"IC\"","\"ID\"","\"IE\"","\"IL\"","\"IM\"","\"IN\"","\"IO\"","\"IQ\"","\"IR\"","\"IS\"","\"IT\"","\"JE\"","\"JM\"","\"JO\"","\"JP\"","\"KE\"","\"KG\"","\"KH\"","\"KI\"","\"KM\"","\"KN\"","\"KP\"","\"KR\"","\"KW\"","\"KY\"","\"KZ\"","\"LA\"","\"LB\"","\"LC\"","\"LI\"","\"LK\"","\"LR\"","\"LS\"","\"LT\"","\"LU\"","\"LV\"","\"LY\"","\"MA\"","\"MC\"","\"MD\"","\"ME\"","\"MF\"","\"MG\"","\"MH\"","\"MK\"","\"ML\"","\"MM\"","\"MN\"","\"MO\"","\"MP\"","\"MQ\"","\"MR\"","\"MS\"","\"MT\"","\"MU\"","\"MV\"","\"MW\"","\"MX\"","\"MY\"","\"MZ\"","\"NA\"","\"NC\"","\"NE\"","\"NF\"","\"NG\"","\"NI\"","\"NL\"","\"NO\"","\"NP\"","\"NR\"","\"NU\"","\"NZ\"","\"OM\"","\"PA\"","\"PE\"","\"PF\"","\"PG\"","\"PH\"","\"PK\"","\"PL\"","\"PM\"","\"PN\"","\"PR\"","\"PS\"","\"PT\"","\"PW\"","\"PY\"","\"QA\"","\"RE\"","\"RO\"","\"RS\"","\"RU\"","\"RW\"","\"SA\"","\"SB\"","\"SC\"","\"SD\"","\"SE\"","\"SG\"","\"SH\"","\"SI\"","\"SJ\"","\"SK\"","\"SL\"","\"SM\"","\"SN\"","\"SO\"","\"SR\"","\"SS\"","\"ST\"","\"SV\"","\"SX\"","\"SY\"","\"SZ\"","\"TA\"","\"TC\"","\"TD\"","\"TF\"","\"TG\"","\"TH\"","\"TJ\"","\"TL\"","\"TM\"","\"TN\"","\"TO\"","\"TR\"","\"TT\"","\"TW\"","\"TZ\"","\"UA\"","\"UG\"","\"UM\"","\"US\"","\"UY\"","\"UZ\"","\"VA\"","\"VC\"","\"VE\"","\"VG\"","\"VI\"","\"VN\"","\"VU\"","\"WF\"","\"WS\"","\"XK\"","\"YE\"","\"YT\"","\"ZA\"","\"ZM\"","\"ZW\"","getBestPattern","skeletonCopy","patternPos","patternChar","extraLength","hourLen","dayPeriodLen","hourChar","getDefaultHourSymbolFromLocale","locale","hourCycle","localeWithHourCycles","languageTag","regionTag","SPACE_SEPARATOR_START_REGEX","SPACE_SEPARATOR_END_REGEX","createLocation","hasNativeFromEntries","hasTrimStart","hasTrimEnd","fromEntries","obj","entries","trimStart","trimEnd","IDENTIFIER_PREFIX_RE","createIdentifierPrefixRegex","regex","matchIdentifierAtIndex","plainTopLevelEndPosition","column","Parser","firstCode","plainEndPosition","nestingLevel","expectingCloseTag","parentArgType","position","_isAlpha","startPosition","tagName","childrenResult","children","endTagStartPosition","closingTagNameStartPosition","startOffset","_isPotentialElementNameChar","parseQuoteResult","parseUnquotedResult","parseLeftAngleResult","location","_isAlphaOrSlash","codePoints","ch","openingBracePosition","startingPosition","endOffset","typeStartPosition","argType","typeEndPosition","styleAndLocation","styleStartPosition","style","argCloseResult","dateTimePattern","identifierAndLocation","pluralOffset","optionsResult","nestedBraces","apostrophePosition","hasOtherClause","parsedSelectors","selector","selectorLocation","parsedFirstIdentifier","fragmentResult","expectCloseTag","hasDigits","decimal","invalidNumberError","expectNumberError","currentOffset","targetOffset","_isWhiteSpace","codepoint","pruneLocation","els","opts","FormatError","msg","originalMessage","InvalidValueError","variableId","InvalidValueTypeError","MissingValueError","mergeLiteral","lastPart","isFormatXMLElementFn","formatToParts","currentPluralValue","formatters","locales","varName","formats","formatFn","chunks","exactKey","numericValue","rule","mergeConfig","c2","c1","mergeConfigs","configs","defaultConfig","createFastMemoizeCache","store","createDefaultFormatters","IntlMessageFormat","parseOpts","overrideFormats","supportedLocales","scriptRel","assetsURL","dep","seen","isCssPreloadUrl","url","__vitePreload","promise","deps","preloadedHrefs","cspNonceMeta","cspNonce","allSettled","promises","importMetaResolve","specifier","depString","importerUrl","isCss","links","link","res","rej","handlePreloadError","e","err","baseModule","defineErrorCodes","codes","PASSKEY_ERROR_CODES","PACKAGE_VERSION$1","bufferToBase64URLString","bytes","buffer","charCode","base64URLStringToBuffer","base64","base64URLString","padLength","padded","binary","browserSupportsWebAuthn","_browserSupportsWebAuthnInternals","toPublicKeyCredentialDescriptor","descriptor","isValidDomain","hostname","WebAuthnError","cause","identifyRegistrationError","publicKey","effectiveDomain","WebAuthnAbortService","abortError","newController","attachments","toAuthenticatorAttachment","attachment","startRegistration","optionsJSON","createOptions","useAutoRegister","credential","transports","response","responsePublicKeyAlgorithm","warnOnBrokenImplementation","responsePublicKey","_publicKey","responseAuthenticatorData","rawId","methodName","browserSupportsWebAuthnAutofill","_browserSupportsWebAuthnAutofillInternals","resolve","globalPublicKeyCredential","identifyAuthenticationError","startAuthentication","allowCredentials","getOptions","useBrowserAutofill","verifyBrowserAutofillInput","userHandle","PACKAGE_VERSION","kBroadcastChannel","now$1","WindowBroadcastChannel","listener","handler","event","getGlobalBroadcastChannel","listenerQueue","lqIndex","batchSeen","QUEUE_ITEMS_PER_LISTENER","nanostoresGlobal","drainQueue","thrown","pendingStores","atom","listeners","$atom","initialValue","runListenerQueue","oldValue","changedKey","newValue","unbind","SET","MOUNT","UNMOUNT","REVERT_MUTATION","on","object","eventKey","mutateStore","l","eventProps","currentListeners","onSet","$store","originSet","originSetKey","isAborted","runListeners","changed","changedValue","STORE_UNMOUNT_DELAY","onMount","destroy","initialize","payload","originListen","originOff","isPlainObject$2","prototype","isJsonEqual","keysA","keysB","withEquality","isEqual","kFocusManager","WindowFocusManager","focused","visibilityHandler","getGlobalFocusManager","kOnlineManager","WindowOnlineManager","online","onOnline","onOffline","getGlobalOnlineManager","PROTO_POLLUTION_PATTERNS","JSON_SIGNATURE","SPECIAL_VALUES","ISO_DATE_REGEX","isValidDate","date","parseISODate","ms","offsetSign","betterJSONParse","trimmed","lowerValue","strict","warnings","parseDates","reviver","parseJSON","kAuthQuery","createAuthQueryAtom","queryAtom","isServer$3","isAuthQueryStateEqual","useAuthQuery","queryParams","latestRequestId","requestId","$fetch","stableData","retryAttempts","request","retryAttempt","isUnauthorized","currentValue","initializedAtom","isMountFetchPending","isMounted","shouldRefetchAfterPending","fetchOnMount","shouldRefetch","isInitialized","timeoutId","cleanups","initAtom","cleanup","now","FOCUS_REFETCH_RATE_LIMIT_SECONDS","createSessionRefreshManager","refetchInterval","refetchOnWindowFocus","refetchWhenOffline","state","triggerRefetch","fetchSession","broadcastSessionUpdate","setupPolling","shouldPollSession","setupBroadcast","setupFocusRefetch","setupOnlineRefetch","setupSignalSubscription","sessionSignal","_envShim","_getEnv","env","prop","getEnvVar","fallback","isErrorStackTraceLimitWritable","desc","hideInternalStackFrames","lines","stack","makeErrorForHideStackFrame","HideStackFramesError","Base","limit","#hiddenStack","clazz","statusCodes","status","body","headers","statusCode","publicBody","BetterAuthError","SLASH_CHAR_CODE","trimTrailingSlashes","checkHasPath","assertHasProtocol","parsedUrl","withPath","trimmedUrl","validateProxyHeader","header","getBaseURL","loadEnv","fromEnv","fromRequest","fromRequestProto","trustedProxyHeaders","getOrigin","DANGEROUS_URL_SCHEMES","isSafeUrlScheme","redirectPlugin","isServer$2","SESSION_MOUNT_DEDUPE_INTERVAL","hydrateSessionAtom","currentSession","sessionAtom","session","normalizeSessionResponse","normalizeSessionData","isSessionAtomEqual","getSessionAtom","$signal","flight","freshUntil","sessionRevision","refetch","executeSessionFetch","signal","outcome","refreshRes","latest","sessionData","fetchError","getFreshUntil","expiresAt","sessionExpiresAt","controller","settleFlight","fetchSessionOnMount","refreshManager","trigger","isPlainObject$1","_defu","defaults","baseObject","namespace","merger","createDefu","arguments_","defu","BetterFetchError","statusText","initializePlugins","hooks","plugin","pluginRes","LinearRetryStrategy","attempt","ExponentialRetryStrategy","createRetryStrategy","methods","parseMethodModifier","separator","method","isReservedPathSegment","encodeLiteralPathSegment","resolvePathSegment","pathParam","pathParams","getURL$1","basePath","baseURL","requestPath","urlQuery","query","serializedValue","val","params","paramPaths","queryParamString","getAuthHeader","getValue","\"authorization\"","username","password","JSON_RE","detectResponseType","_contentType","textTypes","contentType","isJSONParsable","isJSONSerializable","jsonParse","isFunction","getFetch","mergeHeaders","sources","merged","getHeaders","detectContentType","getMediaType","getBody","getMethod$1","getTimeout","abortTimeout","ValidationError","issues","parseStandardSchema","_typeof","o","toPrimitive","toPropertyKey","_defineProperty","ownKeys","_objectSpread2","betterFetch","_options$body","__url","fetch","_url","onRequest","clearTimeout","responseContext","onResponse","_options$hookOptions","responseType","successContext","onSuccess","_options$hookOptions2","parser","responseText","isJSONResponse","errorObject","errorContext","_options$hookOptions3","retryStrategy","_retryAttempt","delay","applySchemaPlugin","_config$plugins","urlKey","keySchema","schemaMethod","validatedHeaders","normalizedHeaders","validated","finalHeaders","createFetch","resolvePublicAuthUrl","protocol","matchesSessionSignal","getClientConfig","isCredentialsSupported","pluginsFetchPlugins","pl","lifeCyclePlugin","_onSuccess","_onError","_onRequest","_onResponse","restOfFetchOptions","hasHydrated","hydrateSession","plugins","pluginsActions","pluginsAtoms","pluginPathMethods","atomListeners","isAtom","capitalizeFirstLetter","WORD_PATTERN","APOSTROPHE_PATTERN","splitWords","toKebabCase","getMethod","knownPathMethods","_query","fetchOptions","createDynamicPathProxy","createProxy","fullPath","routes","routePath","argFetchOptions","client","visited","atoms","createAuthClient","resolvedHooks","getPasskeyActions","mergedExtensions","responseBody","verified","$listPasskeys","fetchOpts","passkeyClient","EMAIL_OTP_ERROR_CODES","emailOTPClient","jwtClient","jwksPath","TWO_FACTOR_ERROR_CODES","twoFactorClient","import_react","import_jsx_runtime","QueryClientContext","useQueryClient","queryClient","QueryClientProvider","defaultTimeoutProvider","callback","intervalId","timeoutManager","#provider","provider","systemSetTimeoutZero","isServer$1","noop","functionalUpdate","updater","isValidTimeout","timeUntilStale","updatedAt","staleTime","resolveQueryValue","matchQuery","filters","queryKey","exact","hashQueryKeyByOptions","partialMatchKey","isActive","stale","fetchStatus","predicate","matchMutation","mutationKey","mutation","hashKey","isPlainObject","bKeys","hasOwn","replaceEqualDeep","array","isPlainArray","aSize","bItems","bSize","copy","equalItems","aItem","bItem","shallowEqualObjects","hasObjectPrototype","objectPrototype","ctor","prot","sleep","timeout","replaceData","prevData","keepPreviousData","previousData","addToEnd","newItems","addToStart","skipToken","ensureQueryFn","shouldThrowError","throwOnError","addConsumeAwareSignal","consumed","getSignal","onCancelled","isServerFn","isServer","Subscribable","focusManager","#setup","onFocus","#cleanup","setup","#focused","isFocused","tryResolveSync","dehydrateMutation","dehydratePromise","serializeData","shouldRedactErrors","dehydrateQuery","defaultShouldDehydrateMutation","defaultShouldDehydrateQuery","dehydrate","filterMutation","mutations","filterQuery","hydrate","mutationCache","queryCache","deserializeData","dehydratedState","mutationOptions","syncData","rawData","queryHash","existingQueryIsPending","existingQueryIsFetching","hasNewerSyncData","dehydratedAt","_ignored","serializedState","queryType","defaultScheduler","createNotifyManager","queue","transactions","notifyFn","batchNotifyFn","scheduleFn","schedule","flush","originalQueue","notifyManager","onlineManager","onlineListener","offlineListener","#online","defaultRetryDelay","failureCount","canFetch","networkMode","CancelledError","createRetryer","isRetryCancelled","continueFn","promiseResolve","promiseReject","reject","isResolved","cancel","cancelOptions","cancelRetry","continueRetry","canContinue","canStart","pause","continueResolve","promiseOrValue","initialPromise","retry","retryDelay","shouldRetry","Removable","#gcTimeout","newGcTime","infiniteQueryBehavior","oldPages","oldPageParams","currentPage","fetchFn","cancelled","addSignalProperty","queryFn","fetchPage","queryFnContext","previous","page","addTo","maxPages","pageParamFn","getPreviousPageParam","getNextPageParam","oldData","remainingPages","pages","lastIndex","pageParams","hasNextPage","hasPreviousPage","Query","#abortSignalConsumed","#defaultOptions","#client","#cache","#initialState","getDefaultState$1","#queryType","#retryer","defaultState","successState","newData","#dispatch","observer","abortController","#revertState","retryer","reducer","action","fetchState","newState","dataUpdatedAt","hasData","initialDataUpdatedAt","QueryObserver","#selectError","#currentQuery","shouldFetchOnMount","#executeFetch","#updateTimers","shouldFetchOn","#clearStaleTimeout","#clearRefetchInterval","prevOptions","prevQuery","#updateQuery","mounted","shouldFetchOptionally","#updateStaleTimeout","nextRefetchInterval","#computeRefetchInterval","#currentRefetchInterval","#updateRefetchInterval","#currentResult","#currentResultOptions","#currentResultState","onPropTracked","target","#trackedProps","defaultedOptions","unsubscribe","resolveEarly","cachePromise","#shouldScheduleTimer","#staleTimeoutId","nextInterval","#refetchIntervalId","prevResult","prevResultState","prevResultOptions","queryInitialState","#currentQueryInitialState","isPlaceholderData","fetchOptionally","skipSelect","placeholderData","#lastQueryWithDefinedData","#selectFn","#selectResult","selectError","isFetching","isPending","isError","isLoading","isStale","nextResult","notifyListeners","notifyOnChangePropsValue","notifyOnChangeProps","includedProps","typedKey","shouldLoadOnMount","InfiniteQueryObserver","parentResult","fetchDirection","isFetchNextPageError","isFetchingNextPage","isFetchPreviousPageError","isFetchingPreviousPage","isRefetchError","isRefetching","Mutation","#mutationCache","#observers","getDefaultState","onContinue","mutationFnContext","variables","restored","isPaused","MutationCache","#mutations","#scopes","#mutationId","scope","scopeFor","scopedMutations","firstPendingMutation","defaultedFilters","pausedMutations","MutationObserver","#updateResult","#currentMutation","#notify","#mutateOptions","onMutateResult","difference","excludeSet","array2","array1","QueriesObserver","#options","#queries","#result","queries","#onUpdate","prevObservers","newObserverMatches","#findMatchingObservers","newObservers","newResult","hasLengthChange","hasIndexChange","hasStructuralChange","hasResultChange","#observerMatches","queryHashes","#combineResult","combine","#trackResult","trackedProps","observerResult","accessedProp","lastHashes","#lastQueryHashes","queryHashesChanged","hash","#lastResult","#lastCombine","#combinedResult","prevObserversMap","previousObservers","observers","shouldSkipCombine","#shouldSkipCombine","previousResult","QueryCache","QueryClient","#queryCache","#queryDefaults","#mutationDefaults","#mountCount","#unsubscribeFocus","#unsubscribeOnline","cachedData","matched","queriesToRefetch","defaultedCancelOptions","queryData","select","queryDefault","IsRestoringContext","useIsRestoring","createValue","isReset","QueryErrorResetBoundaryContext","useQueryErrorResetBoundary","ensurePreventErrorBoundaryRetry","errorResetBoundary","useClearResetErrorBoundary","getHasError","suspense","ensureSuspenseTimers","MIN_SUSPENSE_TIME_MS","clamp","originalStaleTime","shouldSuspend","fetchOptimistic","useQueries","isRestoring","subscribed","defaultedQueries","queryOptions","optimisticResult","getCombinedResult","trackResult","shouldSubscribe","onStoreChange","suspensePromises","firstSingleResultWhichShouldThrow","useBaseQuery","Observer","useQuery","useIsFetching","useMutation","mutate","useInfiniteQuery","QrCodeDataType","\"Border\"","\"Data\"","\"Function\"","\"Position\"","\"Timing\"","\"Alignment\"","QrCodeDataType2","LOW","MEDIUM","QUARTILE","HIGH","EccMap","NUMERIC_REGEX","ALPHANUMERIC_REGEX","ALPHANUMERIC_CHARSET","MIN_VERSION","MAX_VERSION","PENALTY_N1","PENALTY_N2","PENALTY_N3","PENALTY_N4","ECC_CODEWORDS_PER_BLOCK","NUM_ERROR_CORRECTION_BLOCKS","QrCode","ecc","msk","allCodewords","dataCodewords","minPenalty","penalty","alignPatPos","numAlign","mask","rem","bits","getBit","color","dy","dx","dist","xx","yy","isDark","ver","ecl","getNumDataCodewords","numBlocks","blockEccLen","rawCodewords","getNumRawDataModules","numShortBlocks","shortBlockLen","blocks","rsDiv","reedSolomonComputeDivisor","dat","reedSolomonComputeRemainder","block","vert","invert","runColor","runX","runHistory","runY","dark","sum","total","core","currentRunColor","currentRunLength","appendBits","bb","QrSegment","mode","numChars","bitData","MODE_NUMERIC","MODE_ALPHANUMERIC","MODE_BYTE","numCharCountBits","makeBytes","makeNumeric","isNumeric","digits","makeAlphanumeric","isAlphanumeric","temp","makeSegments","toUtf8ByteArray","getTotalBits","seg","segs","ccbits","degree","root","reedSolomonMultiply","divisor","factor","coef","encodeSegments","minVersion","maxVersion","dataUsedBits","dataCapacityBits2","usedBits","newEcl","boostEcl","dataCapacityBits","padByte","encode","qr","maskPattern","boostEcc","addBorder","border","mod","newSize","size","thumbHashToRGBA","header24","header16","l_dc","p_dc","q_dc","l_scale","hasAlpha","p_scale","q_scale","isLandscape","lx","ly","a_dc","a_scale","ac_start","ac_index","decodeChannel","ac","cy","ny","cx","nx","l_ac","p_ac","q_ac","a_ac","ratio","thumbHashToApproximateAspectRatio","w","round","h","rgba","fx","fy","q","cos","PI","fy2","g","rgbaToDataURL","idat","table","u","thumbHashToDataURL","image"],"sources":["../../../../../node_modules/.bun/aip-parsers@1.0.0/node_modules/aip-parsers/dist/suggest-DaQ79xMY.js","../../../../../node_modules/.bun/aip-parsers@1.0.0/node_modules/aip-parsers/dist/filter-CnhA37_F.js","../../../../../node_modules/.bun/aip-parsers@1.0.0/node_modules/aip-parsers/dist/order-by-aYK3GUpT.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/internal/constants.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/internal/debug.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/internal/re.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/internal/parse-options.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/internal/identifiers.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/classes/semver.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/parse.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/valid.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/clean.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/inc.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/diff.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/major.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/minor.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/patch.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/prerelease.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/compare.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/rcompare.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/compare-loose.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/compare-build.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/sort.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/rsort.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/gt.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/lt.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/eq.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/neq.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/gte.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/lte.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/cmp.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/coerce.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/truncate.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/internal/lrucache.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/classes/range.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/classes/comparator.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/functions/satisfies.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/to-comparators.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/max-satisfying.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/min-satisfying.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/min-version.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/valid.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/outside.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/gtr.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/ltr.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/intersects.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/simplify.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/ranges/subset.js","../../../../../node_modules/.bun/semver@7.8.5/node_modules/semver/index.js","../../../../../node_modules/.bun/eventsource-parser@4.1.3/node_modules/eventsource-parser/dist/errors.js","../../../../../node_modules/.bun/eventsource-parser@4.1.3/node_modules/eventsource-parser/dist/parse.js","../../../../../node_modules/.bun/@formatjs+fast-memoize@3.1.7/node_modules/@formatjs/fast-memoize/index.js","../../../../../node_modules/.bun/@formatjs+icu-skeleton-parser@2.1.12/node_modules/@formatjs/icu-skeleton-parser/index.js","../../../../../node_modules/.bun/@formatjs+icu-messageformat-parser@3.5.22/node_modules/@formatjs/icu-messageformat-parser/index.js","../../../../../node_modules/.bun/intl-messageformat@12.1.4/node_modules/intl-messageformat/index.js","../../../../../node_modules/.bun/@better-auth+core@1.7.12+d8c37f950c8f0cf7/node_modules/@better-auth/core/dist/utils/error-codes.mjs","../../../../../node_modules/.bun/@better-auth+passkey@1.7.12+8eaedbcd779c7282/node_modules/@better-auth/passkey/dist/version-DAM-NEJL.mjs","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/bufferToBase64URLString.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/base64URLStringToBuffer.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthn.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/toPublicKeyCredentialDescriptor.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/isValidDomain.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/webAuthnError.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/identifyRegistrationError.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/webAuthnAbortService.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/toAuthenticatorAttachment.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/methods/startRegistration.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthnAutofill.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/identifyAuthenticationError.js","../../../../../node_modules/.bun/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/methods/startAuthentication.js","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/package.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/version.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/broadcast-channel.mjs","../../../../../node_modules/.bun/nanostores@1.5.5/node_modules/nanostores/atom/index.js","../../../../../node_modules/.bun/nanostores@1.5.5/node_modules/nanostores/lifecycle/index.js","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/equality.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/focus-manager.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/online-manager.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/parser.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/query-atom.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/query.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/session-refresh.mjs","../../../../../node_modules/.bun/@better-auth+core@1.7.12+d8c37f950c8f0cf7/node_modules/@better-auth/core/dist/env/env-impl.mjs","../../../../../node_modules/.bun/better-call@1.4.4+fff7ddf946fac095/node_modules/better-call/dist/error.mjs","../../../../../node_modules/.bun/@better-auth+core@1.7.12+d8c37f950c8f0cf7/node_modules/@better-auth/core/dist/error/index.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/utils/url.mjs","../../../../../node_modules/.bun/@better-auth+core@1.7.12+d8c37f950c8f0cf7/node_modules/@better-auth/core/dist/utils/url.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/fetch-plugins.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/session-atom.mjs","../../../../../node_modules/.bun/defu@6.1.7/node_modules/defu/dist/defu.mjs","../../../../../node_modules/.bun/@better-fetch+fetch@1.3.2/node_modules/@better-fetch/fetch/dist/index.js","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/config.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/utils/is-atom.mjs","../../../../../node_modules/.bun/@better-auth+core@1.7.12+d8c37f950c8f0cf7/node_modules/@better-auth/core/dist/utils/string.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/proxy.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/client/vanilla.mjs","../../../../../node_modules/.bun/@better-auth+passkey@1.7.12+8eaedbcd779c7282/node_modules/@better-auth/passkey/dist/client.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/plugins/email-otp/error-codes.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/plugins/email-otp/client.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/plugins/jwt/client.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/plugins/two-factor/error-code.mjs","../../../../../node_modules/.bun/better-auth@1.7.12+3898993756fadf95/node_modules/better-auth/dist/plugins/two-factor/client.mjs","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/timeoutManager.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/utils.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/environmentManager.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/subscribable.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/focusManager.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/hydration.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/notifyManager.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/onlineManager.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/retryer.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/removable.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/query.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/queryObserver.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/mutation.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/mutationCache.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/mutationObserver.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/queriesObserver.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/queryCache.js","../../../../../node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/queryClient.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/suspense.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/useQueries.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/useQuery.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/useIsFetching.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/useMutation.js","../../../../../node_modules/.bun/@tanstack+react-query@5.104.1+62547eec5a2188e3/node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.js","../../../../../node_modules/.bun/uqr@0.1.3/node_modules/uqr/dist/index.mjs","../../../../../node_modules/.bun/thumbhash@0.1.1/node_modules/thumbhash/thumbhash.js"],"sourcesContent":["//#region src/shared/diagnostic.ts\nconst diagnostic = (code, message, hint, span) => ({\n\tcode,\n\tmessage,\n\thint,\n\tspan\n});\n//#endregion\n//#region src/shared/suggest.ts\nconst distance = (a, b) => {\n\tlet row = Array.from({ length: b.length + 1 }, (_, i) => i);\n\tfor (let i = 1; i <= a.length; i++) {\n\t\tconst next = [i];\n\t\tfor (let j = 1; j <= b.length; j++) {\n\t\t\tconst cost = a[i - 1] === b[j - 1] ? 0 : 1;\n\t\t\tnext[j] = Math.min(row[j] + 1, next[j - 1] + 1, row[j - 1] + cost);\n\t\t}\n\t\trow = next;\n\t}\n\treturn row[b.length];\n};\n/** The closest candidate to `name`, if any is close enough to be a likely typo. */\nconst suggest = (name, candidates) => {\n\tconst lower = name.toLowerCase();\n\tconst best = candidates.map((candidate) => ({\n\t\tcandidate,\n\t\tscore: distance(lower, candidate.toLowerCase())\n\t})).sort((a, b) => a.score - b.score)[0];\n\treturn best && best.score <= Math.max(2, Math.floor(name.length / 3)) ? best.candidate : void 0;\n};\n//#endregion\nexport { diagnostic as n, suggest as t };\n","import { n as diagnostic, t as suggest } from \"./suggest-DaQ79xMY.js\";\n//#region src/filter/errors.ts\nvar FilterSyntaxError = class extends Error {\n\terrors;\n\tconstructor(errors) {\n\t\tsuper(errors[0].message);\n\t\tthis.errors = errors;\n\t}\n};\n//#endregion\n//#region src/shared/span.ts\nconst joinSpans = (a, b) => ({\n\tstart: a.start,\n\tend: b.end\n});\n/** 1-based line and column of an offset, for editors and error messages. */\nconst lineColumn = (source, offset) => {\n\tconst before = source.slice(0, offset);\n\treturn {\n\t\tline: before.split(\"\\n\").length,\n\t\tcolumn: offset - (before.lastIndexOf(\"\\n\") + 1) + 1\n\t};\n};\n//#endregion\n//#region src/filter/datetime.ts\nconst daysIn = (year, month) => {\n\tif (month === 2) return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0) ? 29 : 28;\n\treturn [\n\t\t4,\n\t\t6,\n\t\t9,\n\t\t11\n\t].includes(month) ? 30 : 31;\n};\nconst isValidDate = (text) => {\n\tconst match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(text);\n\tif (!match) return false;\n\tconst [year, month, day] = [\n\t\tNumber(match[1]),\n\t\tNumber(match[2]),\n\t\tNumber(match[3])\n\t];\n\treturn month >= 1 && month <= 12 && day >= 1 && day <= daysIn(year, month);\n};\nconst isValidTimestamp = (text) => {\n\tconst match = /^(\\d{4}-\\d{2}-\\d{2})[Tt](\\d{2}):(\\d{2}):(\\d{2})(?:\\.\\d+)?(?:[Zz]|[+-](\\d{2}):(\\d{2}))$/.exec(text);\n\tif (!match) return false;\n\tconst [hour, minute, second] = [\n\t\tNumber(match[2]),\n\t\tNumber(match[3]),\n\t\tNumber(match[4])\n\t];\n\tconst [offsetHour, offsetMinute] = [Number(match[5] ?? 0), Number(match[6] ?? 0)];\n\treturn isValidDate(match[1]) && hour <= 23 && minute <= 59 && second <= 59 && offsetHour <= 23 && offsetMinute <= 59;\n};\nconst unitSeconds = {\n\ts: 1,\n\tm: 60,\n\th: 3600,\n\td: 86400,\n\tw: 604800\n};\n/** Milliseconds since the epoch, or undefined when the text is not a valid RFC-3339 timestamp. */\nconst timestampMillis = (text) => isValidTimestamp(text) ? Date.parse(text.toUpperCase()) : void 0;\nconst durationText = /^(\\d+(?:\\.\\d+)?)(s|m|h|d|w)$/;\n/** Seconds for texts like `30s` or `1.5h` (units beyond `s` are an extension). */\nconst durationSeconds = (text) => {\n\tconst match = durationText.exec(text);\n\treturn match ? Number(match[1]) * unitSeconds[match[2]] : void 0;\n};\n//#endregion\n//#region src/filter/lexer/number.ts\nconst timestampShape = /\\d{4}-\\d{2}-\\d{2}[Tt]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:[Zz]|[+-]\\d{2}:\\d{2})/y;\nconst dateShape = /\\d{4}-\\d{2}-\\d{2}/y;\nconst dateTail = /[TtZz0-9:.+-]*/y;\nconst hexShape = /0[xX][0-9a-fA-F]+/y;\nconst numberShape = /\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?/y;\nconst match = (shape, source, at) => {\n\tshape.lastIndex = at;\n\treturn shape.exec(source)?.[0];\n};\n/**\n* Scans a token that starts with a digit. Returns undefined when the digits are just the\n* start of ordinary text (for example `3rd` or `30d` without the durationUnits extension).\n*/\nconst scanNumeric = (source, start, isDelimiter, extensions) => {\n\tconst timestamp = match(timestampShape, source, start);\n\tif (timestamp && isValidTimestamp(timestamp)) return {\n\t\tkind: \"timestamp\",\n\t\tend: start + timestamp.length\n\t};\n\tif (timestamp || match(dateShape, source, start)) {\n\t\tconst end = start + (match(dateTail, source, start) ?? \"\").length;\n\t\treturn {\n\t\t\tkind: \"error\",\n\t\t\tend,\n\t\t\terror: diagnostic(\"invalid-timestamp\", `\"${source.slice(start, end)}\" is not a valid RFC-3339 timestamp`, \"Use a full timestamp like 2012-04-21T11:30:00Z, or quote a plain date: \\\"2012-04-21\\\"\", {\n\t\t\t\tstart,\n\t\t\t\tend\n\t\t\t})\n\t\t};\n\t}\n\tconst hex = match(hexShape, source, start);\n\tif (hex) return isDelimiter(source[start + hex.length]) ? {\n\t\tkind: \"number\",\n\t\tend: start + hex.length\n\t} : void 0;\n\tconst end = start + match(numberShape, source, start).length;\n\tif ((extensions.durationUnits ? \"smhdw\" : \"s\").includes(source[end] ?? \" \") && isDelimiter(source[end + 1])) return {\n\t\tkind: \"duration\",\n\t\tend: end + 1\n\t};\n\treturn isDelimiter(source[end]) ? {\n\t\tkind: \"number\",\n\t\tend\n\t} : void 0;\n};\n//#endregion\n//#region src/filter/lexer/string.ts\nconst simple = {\n\ta: \"\\x07\",\n\tb: \"\\b\",\n\tf: \"\\f\",\n\tn: \"\\n\",\n\tr: \"\\r\",\n\tt: \"\t\",\n\tv: \"\\v\",\n\t\"'\": \"'\",\n\t\"\\\"\": \"\\\"\",\n\t\"\\\\\": \"\\\\\",\n\t\"?\": \"?\",\n\t\"`\": \"`\"\n};\nconst hexDigits = (source, from, length) => {\n\tconst text = source.slice(from, from + length);\n\treturn text.length === length && /^[0-9a-fA-F]+$/.test(text) ? parseInt(text, 16) : void 0;\n};\nconst escape = (source, at) => {\n\tconst char = source[at + 1];\n\tif (char === void 0) return {\n\t\terror: \"a backslash at the end\",\n\t\tend: at + 1\n\t};\n\tif (Object.hasOwn(simple, char)) return {\n\t\ttext: simple[char],\n\t\tend: at + 2\n\t};\n\tconst lengths = {\n\t\tx: 2,\n\t\tu: 4,\n\t\tU: 8\n\t};\n\tif (Object.hasOwn(lengths, char)) {\n\t\tconst code = hexDigits(source, at + 2, lengths[char]);\n\t\tconst end = at + 2 + lengths[char];\n\t\treturn code !== void 0 && code <= 1114111 && !(code >= 55296 && code <= 57343) ? {\n\t\t\ttext: String.fromCodePoint(code),\n\t\t\tend\n\t\t} : {\n\t\t\terror: `\\\\${char} needs ${lengths[char]} hex digits naming a Unicode scalar value`,\n\t\t\tend: at + 2\n\t\t};\n\t}\n\tconst octal = /^[0-3][0-7]{2}/.exec(source.slice(at + 1, at + 4));\n\tif (octal) return {\n\t\ttext: String.fromCharCode(parseInt(octal[0], 8)),\n\t\tend: at + 4\n\t};\n\treturn {\n\t\terror: `the escape \"\\\\${char}\"`,\n\t\tend: at + 2\n\t};\n};\nconst scanString = (source, start) => {\n\tconst quote = source[start];\n\tconst errors = [];\n\tlet value = \"\";\n\tlet i = start + 1;\n\twhile (i < source.length) {\n\t\tconst char = source[i];\n\t\tif (char === quote) return {\n\t\t\tend: i + 1,\n\t\t\tvalue,\n\t\t\terrors\n\t\t};\n\t\tif (char !== \"\\\\\") {\n\t\t\tvalue += char;\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tconst result = escape(source, i);\n\t\tif (\"text\" in result) value += result.text;\n\t\telse errors.push(diagnostic(\"invalid-escape\", `Invalid escape: ${result.error}`, \"Valid escapes: \\\\a \\\\b \\\\f \\\\n \\\\r \\\\t \\\\v \\\\' \\\\\\\" \\\\\\\\ \\\\? \\\\` \\\\xHH \\\\uXXXX \\\\UXXXXXXXX \\\\ooo\", {\n\t\t\tstart: i,\n\t\t\tend: result.end\n\t\t}));\n\t\ti = result.end;\n\t}\n\terrors.push(diagnostic(\"unterminated-string\", \"String is missing its closing quote\", `Add a closing ${quote}`, {\n\t\tstart,\n\t\tend: source.length\n\t}));\n\treturn {\n\t\tend: source.length,\n\t\tvalue: void 0,\n\t\terrors\n\t};\n};\n//#endregion\n//#region src/filter/lexer/lexer.ts\nconst punctuation = {\n\t\"(\": \"lparen\",\n\t\")\": \"rparen\",\n\t\",\": \"comma\",\n\t\".\": \"dot\",\n\t\":\": \"has\",\n\t\"=\": \"eq\",\n\t\"<\": \"lt\",\n\t\">\": \"gt\",\n\t\"-\": \"minus\"\n};\nconst keywords = {\n\tAND: \"and\",\n\tOR: \"or\",\n\tNOT: \"not\"\n};\nconst afterNow = (tokens) => {\n\tconst [rparen, lparen, name] = [\n\t\ttokens.at(-1),\n\t\ttokens.at(-2),\n\t\ttokens.at(-3)\n\t];\n\treturn rparen?.kind === \"rparen\" && lparen?.kind === \"lparen\" && name?.text === \"now\";\n};\nconst lex = (source, extensions = {}) => {\n\tconst tokens = [];\n\tconst errors = [];\n\tconst special = (char) => char !== void 0 && (char in punctuation || char === \"!\" || extensions.arithmetic === true && char === \"+\");\n\tconst isDelimiter = (char) => char === void 0 || /\\s/.test(char) || special(char) || char === \"\\\"\" || char === \"'\";\n\tconst push = (kind, start, end, value = source.slice(start, end)) => tokens.push({\n\t\tkind,\n\t\ttext: source.slice(start, end),\n\t\tvalue,\n\t\tspan: {\n\t\t\tstart,\n\t\t\tend\n\t\t}\n\t});\n\tconst surrogate = source.isWellFormed() ? -1 : source.search(/[\\ud800-\\udbff](?![\\udc00-\\udfff])|(?<![\\ud800-\\udbff])[\\udc00-\\udfff]/);\n\tif (surrogate >= 0) errors.push(diagnostic(\"invalid-unicode\", \"The filter contains an unpaired surrogate\", \"Use well-formed UTF-16 text\", {\n\t\tstart: surrogate,\n\t\tend: surrogate + 1\n\t}));\n\tlet i = 0;\n\twhile (i < source.length) {\n\t\tconst char = source[i];\n\t\tif (/\\s/.test(char)) {\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === \"\\\"\" || char === \"'\") {\n\t\t\tconst scan = scanString(source, i);\n\t\t\terrors.push(...scan.errors);\n\t\t\tif (scan.value !== void 0) push(\"string\", i, scan.end, scan.value);\n\t\t\ti = scan.end;\n\t\t\tcontinue;\n\t\t}\n\t\tif (/[0-9]/.test(char)) {\n\t\t\tconst scan = scanNumeric(source, i, isDelimiter, extensions);\n\t\t\tif (scan?.kind === \"error\") errors.push(scan.error);\n\t\t\telse if (scan) push(scan.kind, i, scan.end);\n\t\t\tif (scan) {\n\t\t\t\ti = scan.end;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tif (char === \"!\" || char === \"<\" || char === \">\") {\n\t\t\tconst twoChars = source[i + 1] === \"=\";\n\t\t\tif (char === \"!\" && !twoChars) {\n\t\t\t\terrors.push(diagnostic(\"unexpected-character\", \"Unexpected character \\\"!\\\"\", \"Use != for \\\"not equal\\\" or NOT / - for negation\", {\n\t\t\t\t\tstart: i,\n\t\t\t\t\tend: i + 1\n\t\t\t\t}));\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tpush(char === \"!\" ? \"ne\" : char === \"<\" ? twoChars ? \"le\" : \"lt\" : twoChars ? \"ge\" : \"gt\", i, i + (twoChars ? 2 : 1));\n\t\t\ti += twoChars ? 2 : 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (Object.hasOwn(punctuation, char)) {\n\t\t\tpush(punctuation[char], i, i + 1);\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tconst offsetPlus = extensions.arithmetic === \"now-offset\" && afterNow(tokens);\n\t\tif (char === \"+\" && (extensions.arithmetic === true || offsetPlus)) {\n\t\t\tpush(\"plus\", i, i + 1);\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tlet end = i + 1;\n\t\twhile (!isDelimiter(source[end])) end++;\n\t\tconst text = source.slice(i, end);\n\t\tpush(Object.hasOwn(keywords, text) ? keywords[text] : \"text\", i, end);\n\t\ti = end;\n\t}\n\tpush(\"eof\", source.length, source.length);\n\treturn {\n\t\ttokens,\n\t\terrors\n\t};\n};\n//#endregion\n//#region src/filter/parser/cursor.ts\nvar ParseAbort = class extends Error {\n\terror;\n\tconstructor(error) {\n\t\tsuper(error.message);\n\t\tthis.error = error;\n\t}\n};\nconst abort = (code, message, hint, span) => {\n\tthrow new ParseAbort(diagnostic(code, message, hint, span));\n};\nconst peek = (c, offset = 0) => c.tokens[Math.min(c.pos + offset, c.tokens.length - 1)];\nconst next = (c) => {\n\tconst token = peek(c);\n\tif (token.kind !== \"eof\") c.pos++;\n\treturn token;\n};\nconst eat = (c, kind) => peek(c).kind === kind ? next(c) : void 0;\nconst describe = (token) => token.kind === \"eof\" ? \"end of input\" : `\"${token.text}\"`;\nconst expect = (c, kind, what, hint) => eat(c, kind) ?? abort(\"expected-token\", `Expected ${what} but found ${describe(peek(c))}`, hint, peek(c).span);\nconst withDepth = (c, span, run) => {\n\tif (c.depth >= c.maxDepth) abort(\"too-deep\", \"The filter is nested too deeply\", `Nest at most ${c.maxDepth} levels`, span);\n\tc.depth++;\n\ttry {\n\t\treturn run();\n\t} finally {\n\t\tc.depth--;\n\t}\n};\nconst segmentKinds = [\n\t\"text\",\n\t\"and\",\n\t\"or\",\n\t\"not\"\n];\nconst parseMember = (c) => {\n\tconst first = expect(c, \"text\", \"a field name or value\", \"Text may not contain spaces or the characters ( ) - . = : < > ! ,\");\n\tconst path = [first.text];\n\tlet span = first.span;\n\tfor (;;) {\n\t\tif (peek(c).kind !== \"dot\") break;\n\t\tconst part = peek(c, 1);\n\t\tconst isIndex = part.kind === \"number\" && /^\\d+(\\.\\d+)?$/.test(part.text);\n\t\tif (!segmentKinds.includes(part.kind) && !isIndex) abort(\"expected-token\", `Expected a field name after \".\" but found ${describe(part)}`, \"Write traversals like customer.country\", part.span);\n\t\tnext(c);\n\t\tnext(c);\n\t\tpath.push(...isIndex ? part.text.split(\".\") : [part.text]);\n\t\tspan = joinSpans(span, part.span);\n\t}\n\treturn {\n\t\tkind: \"member\",\n\t\tpath,\n\t\tspan\n\t};\n};\n//#endregion\n//#region src/filter/parser/duration.ts\nconst durationFrom = (token) => ({\n\tkind: \"duration\",\n\tamount: Number(token.text.slice(0, -1)),\n\tunit: token.text.slice(-1),\n\tspan: token.span\n});\n//#endregion\n//#region src/filter/parser/operand.ts\nconst operandKinds$1 = [\n\t\"member\",\n\t\"string\",\n\t\"number\",\n\t\"boolean\",\n\t\"duration\",\n\t\"timestamp\",\n\t\"call\",\n\t\"binary\"\n];\nconst isOperand$1 = (node) => operandKinds$1.includes(node.kind);\nconst parseCall = (c, name, start) => withDepth(c, start, () => {\n\tnext(c);\n\tconst args = [];\n\tif (peek(c).kind !== \"rparen\") do\n\t\targs.push(parseArg(c));\n\twhile (eat(c, \"comma\"));\n\tconst close = expect(c, \"rparen\", \"\\\")\\\"\", `Close the call to ${name}() with \")\"`);\n\treturn {\n\t\tkind: \"call\",\n\t\tname,\n\t\targs,\n\t\tspan: joinSpans(start, close.span)\n\t};\n});\n/** A single value, member or function call; arithmetic and groups are handled by parseArg. */\nconst parseOperand = (c) => {\n\tconst token = peek(c);\n\tswitch (token.kind) {\n\t\tcase \"string\":\n\t\t\tnext(c);\n\t\t\treturn {\n\t\t\t\tkind: \"string\",\n\t\t\t\tvalue: token.value,\n\t\t\t\tspan: token.span\n\t\t\t};\n\t\tcase \"number\":\n\t\t\tnext(c);\n\t\t\treturn {\n\t\t\t\tkind: \"number\",\n\t\t\t\tvalue: Number(token.text),\n\t\t\t\traw: token.text,\n\t\t\t\tspan: token.span\n\t\t\t};\n\t\tcase \"duration\":\n\t\t\tnext(c);\n\t\t\treturn durationFrom(token);\n\t\tcase \"timestamp\":\n\t\t\tnext(c);\n\t\t\treturn {\n\t\t\t\tkind: \"timestamp\",\n\t\t\t\tvalue: token.text,\n\t\t\t\tspan: token.span\n\t\t\t};\n\t\tcase \"minus\": {\n\t\t\tconst number = peek(c, 1);\n\t\t\tif (number.kind !== \"number\" || number.span.start !== token.span.end) abort(\"unexpected-token\", `Expected a number after \"-\" but found ${describe(number)}`, \"Write negative numbers as -5, without a space\", number.span);\n\t\t\tnext(c);\n\t\t\tnext(c);\n\t\t\tconst raw = `-${number.text}`;\n\t\t\treturn {\n\t\t\t\tkind: \"number\",\n\t\t\t\tvalue: -Number(number.text),\n\t\t\t\traw,\n\t\t\t\tspan: joinSpans(token.span, number.span)\n\t\t\t};\n\t\t}\n\t\tcase \"text\": {\n\t\t\tif ((token.text === \"true\" || token.text === \"false\") && peek(c, 1).kind !== \"dot\" && !(peek(c, 1).kind === \"lparen\" && peek(c, 1).span.start === token.span.end)) {\n\t\t\t\tnext(c);\n\t\t\t\treturn {\n\t\t\t\t\tkind: \"boolean\",\n\t\t\t\t\tvalue: token.text === \"true\",\n\t\t\t\t\tspan: token.span\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst member = parseMember(c);\n\t\t\treturn peek(c).kind === \"lparen\" && peek(c).span.start === member.span.end ? parseCall(c, member.path.join(\".\"), member.span) : member;\n\t\t}\n\t\tdefault: return abort(\"unexpected-token\", `Expected a value but found ${describe(token)}`, \"Values are text, \\\"strings\\\", numbers, true/false, durations, timestamps or function calls\", token.span);\n\t}\n};\nconst composite = (c) => {\n\tconst open = next(c);\n\treturn withDepth(c, open.span, () => {\n\t\tconst inner = c.expression(c);\n\t\texpect(c, \"rparen\", \"\\\")\\\"\", \"Close the group opened here\");\n\t\tif (!inner) return abort(\"unexpected-token\", \"Empty group\", \"Put an expression inside the parentheses\", open.span);\n\t\treturn inner.kind === \"global\" ? inner.value : inner;\n\t});\n};\nconst primary = (c) => peek(c).kind === \"lparen\" ? composite(c) : parseOperand(c);\nconst startsOperand = (c) => [\n\t\"text\",\n\t\"string\",\n\t\"number\",\n\t\"duration\",\n\t\"timestamp\",\n\t\"lparen\",\n\t\"minus\"\n].includes(peek(c, 1).kind);\nconst parseArg = (c) => {\n\tconst first = primary(c);\n\tif (!c.extensions.arithmetic || !isOperand$1(first)) return first;\n\tlet left = first;\n\tconst nowOffset = c.extensions.arithmetic === \"now-offset\";\n\tconst isNow = () => left.kind === \"call\" && left.name === \"now\" && left.args.length === 0;\n\tconst allowed = () => !nowOffset || isNow() && peek(c, 1).kind === \"duration\";\n\tif (nowOffset && isNow() && (peek(c).kind === \"plus\" || peek(c).kind === \"minus\") && peek(c, 1).kind !== \"duration\") return abort(\"expected-token\", `Expected a duration after \"${peek(c).text}\" but found ${describe(peek(c, 1))}`, \"Durations need a unit, for example now() - 30d\", peek(c, 1).span);\n\twhile ((peek(c).kind === \"plus\" || peek(c).kind === \"minus\") && startsOperand(c) && allowed()) {\n\t\tconst op = next(c).kind === \"plus\" ? \"+\" : \"-\";\n\t\tconst right = primary(c);\n\t\tif (!isOperand$1(right)) return abort(\"unexpected-token\", \"Arithmetic needs values, not conditions\", \"Use values on both sides of + and -\", right.span);\n\t\tleft = {\n\t\t\tkind: \"binary\",\n\t\t\top,\n\t\t\tleft,\n\t\t\tright,\n\t\t\tspan: joinSpans(left.span, right.span)\n\t\t};\n\t}\n\treturn left;\n};\nconst parseRight = (c) => {\n\tconst start = peek(c);\n\tconst arg = parseArg(c);\n\tif (!isOperand$1(arg)) abort(\"unexpected-token\", \"A comparison needs a value on the right\", \"Write field = value\", start.span);\n\treturn arg;\n};\n//#endregion\n//#region src/filter/parser/expression.ts\nconst comparators = {\n\teq: \"=\",\n\tne: \"!=\",\n\tlt: \"<\",\n\tle: \"<=\",\n\tgt: \">\",\n\tge: \">=\"\n};\nconst termStarts = [\n\t\"text\",\n\t\"string\",\n\t\"number\",\n\t\"duration\",\n\t\"timestamp\",\n\t\"not\",\n\t\"minus\",\n\t\"lparen\"\n];\nconst group = (kind, items) => {\n\tconst args = items.filter((item) => item !== void 0);\n\tif (args.length <= 1) return args[0];\n\treturn {\n\t\tkind,\n\t\targs,\n\t\tspan: joinSpans(args[0].span, args[args.length - 1].span)\n\t};\n};\nconst sync = (c) => {\n\tlet depth = 0;\n\tfor (;;) {\n\t\tconst { kind } = peek(c);\n\t\tif (kind === \"eof\") return;\n\t\tif (depth === 0 && (kind === \"and\" || kind === \"or\" || kind === \"rparen\")) return;\n\t\tif (kind === \"lparen\") depth++;\n\t\tif (kind === \"rparen\") depth--;\n\t\tnext(c);\n\t}\n};\nconst parseRestriction = (c) => {\n\tconst left = parseOperand(c);\n\tconst token = peek(c);\n\tif (token.kind === \"has\") {\n\t\tnext(c);\n\t\tconst star = peek(c);\n\t\tif (star.kind === \"text\" && star.text === \"*\") {\n\t\t\tnext(c);\n\t\t\treturn {\n\t\t\t\tkind: \"present\",\n\t\t\t\tleft,\n\t\t\t\tspan: joinSpans(left.span, star.span)\n\t\t\t};\n\t\t}\n\t\tconst right = parseRight(c);\n\t\treturn {\n\t\t\tkind: \"has\",\n\t\t\tleft,\n\t\t\tright,\n\t\t\tspan: joinSpans(left.span, right.span)\n\t\t};\n\t}\n\tconst op = comparators[token.kind];\n\tif (op) {\n\t\tnext(c);\n\t\tconst right = parseRight(c);\n\t\treturn {\n\t\t\tkind: \"compare\",\n\t\t\top,\n\t\t\tleft,\n\t\t\tright,\n\t\t\tspan: joinSpans(left.span, right.span)\n\t\t};\n\t}\n\treturn left.kind === \"call\" ? left : {\n\t\tkind: \"global\",\n\t\tvalue: left,\n\t\tspan: left.span\n\t};\n};\nconst parseSimple = (c) => {\n\tconst open = peek(c);\n\tif (open.kind !== \"lparen\") return parseRestriction(c);\n\tnext(c);\n\treturn withDepth(c, open.span, () => {\n\t\tconst inner = parseExpression(c);\n\t\tif (!eat(c, \"rparen\")) c.errors.push(diagnostic(\"expected-token\", `Expected \")\" but found ${describe(peek(c))}`, \"Close the group opened here\", open.span));\n\t\treturn inner;\n\t});\n};\nconst parseTerm = (c) => {\n\tconst token = peek(c);\n\tif (token.kind !== \"not\" && token.kind !== \"minus\") {\n\t\tif (!termStarts.includes(token.kind)) return abort(\"unexpected-token\", `Unexpected ${describe(token)}`, \"Expected a field, a value or \\\"(\\\"\", token.span);\n\t\treturn withDepth(c, token.span, () => parseSimple(c));\n\t}\n\tnext(c);\n\tconst following = peek(c);\n\tconst negativeNumber = following.kind === \"minus\" && peek(c, 1).kind === \"number\" && peek(c, 1).span.start === following.span.end;\n\tif (following.kind === \"not\" || following.kind === \"minus\" && !negativeNumber) abort(\"unexpected-token\", \"Negations cannot be stacked\", \"Group the inner one: NOT (NOT a)\", following.span);\n\tconst arg = withDepth(c, token.span, () => parseSimple(c));\n\tif (!arg) return void 0;\n\tconst span = joinSpans(token.span, arg.span);\n\tif (token.kind === \"minus\" && arg.kind === \"global\" && arg.value.kind === \"number\" && !arg.value.raw.startsWith(\"-\")) {\n\t\tconst { raw, value } = arg.value;\n\t\treturn {\n\t\t\tkind: \"global\",\n\t\t\tvalue: {\n\t\t\t\tkind: \"number\",\n\t\t\t\tvalue: -value,\n\t\t\t\traw: `-${raw}`,\n\t\t\t\tspan\n\t\t\t},\n\t\t\tspan\n\t\t};\n\t}\n\treturn {\n\t\tkind: \"not\",\n\t\targ,\n\t\tspan\n\t};\n};\nconst parseTermRecovering = (c) => {\n\ttry {\n\t\treturn parseTerm(c);\n\t} catch (error) {\n\t\tif (!(error instanceof ParseAbort)) throw error;\n\t\tc.errors.push(error.error);\n\t\tsync(c);\n\t\treturn;\n\t}\n};\nconst parseFactor = (c) => {\n\tconst items = [parseTermRecovering(c)];\n\twhile (eat(c, \"or\")) items.push(parseTermRecovering(c));\n\treturn group(\"or\", items);\n};\nconst parseSequence = (c) => {\n\tconst items = [parseFactor(c)];\n\twhile (termStarts.includes(peek(c).kind)) items.push(parseFactor(c));\n\treturn group(\"sequence\", items);\n};\nconst parseExpression = (c) => {\n\tconst items = [parseSequence(c)];\n\twhile (eat(c, \"and\")) items.push(parseSequence(c));\n\treturn group(\"and\", items);\n};\n//#endregion\n//#region src/filter/parser/parse.ts\nconst parseFilter = (source, options = {}) => {\n\tconst maxLength = options.maxLength ?? 1e4;\n\tif (source.length > maxLength) return {\n\t\tok: false,\n\t\tast: void 0,\n\t\terrors: [diagnostic(\"too-long\", `The filter is longer than ${maxLength} characters`, \"Shorten the filter\", {\n\t\t\tstart: maxLength,\n\t\t\tend: source.length\n\t\t})]\n\t};\n\tconst extensions = options.extensions ?? {};\n\tconst lexed = lex(source, extensions);\n\tconst c = {\n\t\ttokens: lexed.tokens,\n\t\tpos: 0,\n\t\terrors: lexed.errors,\n\t\tdepth: 0,\n\t\tmaxDepth: options.maxDepth ?? 64,\n\t\textensions,\n\t\texpression: parseExpression\n\t};\n\tconst parts = [];\n\twhile (peek(c).kind !== \"eof\") {\n\t\tif (peek(c).kind === \"rparen\") {\n\t\t\tconst stray = next(c);\n\t\t\tc.errors.push(diagnostic(\"unexpected-token\", \"Unmatched \\\")\\\"\", \"Remove it or add a matching \\\"(\\\"\", stray.span));\n\t\t\tcontinue;\n\t\t}\n\t\tparts.push(parseExpression(c));\n\t}\n\tconst defined = parts.filter((part) => part !== void 0);\n\tconst ast = defined.length <= 1 ? defined[0] : {\n\t\tkind: \"and\",\n\t\targs: defined,\n\t\tspan: {\n\t\t\tstart: defined[0].span.start,\n\t\t\tend: defined[defined.length - 1].span.end\n\t\t}\n\t};\n\tconst errors = [...c.errors].sort((a, b) => a.span.start - b.span.start);\n\treturn errors.length === 0 ? {\n\t\tok: true,\n\t\tast,\n\t\terrors: []\n\t} : {\n\t\tok: false,\n\t\tast,\n\t\terrors\n\t};\n};\n/** Returns undefined for an empty filter. */\nconst parseFilterOrThrow = (source, options) => {\n\tconst result = parseFilter(source, options);\n\tif (!result.ok) throw new FilterSyntaxError(result.errors);\n\treturn result.ast;\n};\n//#endregion\n//#region src/filter/check/field.ts\nconst findField = (fields, name) => {\n\tif (Object.hasOwn(fields, name)) return {\n\t\tname,\n\t\tspec: fields[name]\n\t};\n\tconst alias = Object.entries(fields).find(([, spec]) => spec.aliases?.includes(name));\n\treturn alias && {\n\t\tname: alias[0],\n\t\tspec: alias[1]\n\t};\n};\n/**\n* Resolves a member against the schema, following message fields and map keys. Aliases are\n* replaced by the real field name in the returned member.\n*/\nconst resolveMember = (ctx, member) => {\n\tconst head = member.path[0];\n\tconst found = findField(ctx.schema.fields, head);\n\tif (!found) {\n\t\tconst usable = Object.entries(ctx.schema.fields).filter(([, s]) => s.filterable !== false).map(([name]) => name);\n\t\tconst close = suggest(head, usable);\n\t\tctx.errors.push(diagnostic(\"unknown-field\", `Unknown field \"${head}\"`, close ? `Did you mean \"${close}\"?` : `Available fields: ${usable.join(\", \")}`, member.span));\n\t\treturn;\n\t}\n\tconst path = [found.name];\n\tlet spec = found.spec;\n\tlet filterable = spec.filterable !== false;\n\tfor (const segment of member.path.slice(1)) {\n\t\tconst inner = spec.type === \"message\" ? spec.fields?.[segment] : spec.type === \"map\" ? spec.value : spec.type === \"any\" ? spec : void 0;\n\t\tif (!inner || spec.type === \"message\" && !Object.hasOwn(spec.fields ?? {}, segment)) {\n\t\t\tctx.errors.push(diagnostic(\"invalid-traversal\", `Cannot traverse into \"${segment}\" of \"${path.join(\".\")}\"`, spec.type === \"message\" ? `Available fields: ${Object.keys(spec.fields ?? {}).join(\", \")}` : \"Only message, map and any fields can be traversed\", member.span));\n\t\t\treturn;\n\t\t}\n\t\tpath.push(segment);\n\t\tspec = inner;\n\t\tfilterable &&= spec.filterable !== false;\n\t}\n\tif (!filterable) {\n\t\tctx.errors.push(diagnostic(\"not-filterable\", `Field \"${path.join(\".\")}\" cannot be filtered on`, \"Mark it filterable in the schema\", member.span));\n\t\treturn;\n\t}\n\treturn {\n\t\t...member,\n\t\tpath,\n\t\tfield: {\n\t\t\tname: path.join(\".\"),\n\t\t\tspec\n\t\t}\n\t};\n};\n//#endregion\n//#region src/filter/check/value.ts\nconst problem = (message, hint) => ({\n\tmessage,\n\thint\n});\nconst expected = (what, hint) => problem(`Expected ${what}`, hint);\nconst textOf$1 = (node) => node.kind === \"string\" ? node.value : node.kind === \"member\" ? node.path.join(\".\") : void 0;\nconst numeric = {\n\tinteger: /^-?(\\d+|0[xX][0-9a-fA-F]+)$/,\n\tnumber: /^-?\\d+(\\.\\d+)?([eE][+-]?\\d+)?$|^-?0[xX][0-9a-fA-F]+$/\n};\n/** Whether a value of type `actual` can be compared with a field of type `wanted`. */\nconst compatible = (wanted, actual) => wanted === actual || wanted === \"any\" || actual === \"any\" || [\"integer\", \"number\"].includes(wanted) && [\"integer\", \"number\"].includes(actual);\n/** Checks a literal or text against a type. Calls and arithmetic are checked by their return type. */\nconst checkValue = (type, spec, node) => {\n\tconst text = textOf$1(node);\n\tswitch (type) {\n\t\tcase \"any\": return;\n\t\tcase \"string\": return text !== void 0 ? void 0 : expected(\"a string\", \"Quote text values: \\\"...\\\"\");\n\t\tcase \"enum\":\n\t\t\tif (text !== void 0 && spec?.values?.includes(text)) return void 0;\n\t\t\treturn problem(\"Invalid enum value\", `Allowed values: ${(spec?.values ?? []).join(\", \")}`);\n\t\tcase \"integer\":\n\t\tcase \"number\": {\n\t\t\tconst raw = node.kind === \"number\" ? node.raw : text;\n\t\t\tif (raw !== void 0 && numeric[type].test(raw)) return void 0;\n\t\t\treturn expected(type === \"integer\" ? \"an integer\" : \"a number\", \"Write 42, -1.5 or 2.5e3, or quote a numeric string\");\n\t\t}\n\t\tcase \"boolean\":\n\t\t\tif (node.kind === \"boolean\" || text === \"true\" || text === \"false\") return void 0;\n\t\t\treturn expected(\"true or false\", \"Write true or false\");\n\t\tcase \"timestamp\":\n\t\t\tif (node.kind === \"timestamp\" || text !== void 0 && isValidTimestamp(text)) return void 0;\n\t\t\treturn expected(\"an RFC-3339 timestamp\", \"Use \\\"2012-04-21T11:30:00Z\\\"\");\n\t\tcase \"duration\":\n\t\t\tif (node.kind === \"duration\" || text !== void 0 && durationSeconds(text) !== void 0) return void 0;\n\t\t\treturn expected(\"a duration\", \"Use a number with a unit, for example 20s or 1.5s\");\n\t\tcase \"map\":\n\t\tcase \"message\": return problem(`${type} fields cannot be compared`, \"Compare a nested field, or use field:key\");\n\t}\n};\n//#endregion\n//#region src/filter/check/call.ts\nconst isOperandArg = (arg) => [\n\t\"member\",\n\t\"string\",\n\t\"number\",\n\t\"boolean\",\n\t\"duration\",\n\t\"timestamp\",\n\t\"call\",\n\t\"binary\"\n].includes(arg.kind);\nconst checkArg = (ctx, param, arg, checkOperand) => {\n\tif (!isOperandArg(arg)) {\n\t\tctx.errors.push(diagnostic(\"wrong-argument\", `Argument \"${param.name}\" must be a value`, \"Pass a field, literal or function call\", arg.span));\n\t\treturn;\n\t}\n\tif (param.type === \"field\") {\n\t\tif (arg.kind !== \"member\") {\n\t\t\tctx.errors.push(diagnostic(\"wrong-argument\", `Argument \"${param.name}\" must be a field`, \"Pass a field name without quotes\", arg.span));\n\t\t\treturn;\n\t\t}\n\t\tconst resolved = resolveMember(ctx, arg);\n\t\tif (resolved && param.of && !param.of.includes(resolved.field.spec.type)) {\n\t\t\tctx.errors.push(diagnostic(\"wrong-argument\", `Argument \"${param.name}\" cannot be a ${resolved.field.spec.type} field`, `Accepted field types: ${param.of.join(\", \")}`, arg.span));\n\t\t\treturn;\n\t\t}\n\t\treturn resolved;\n\t}\n\tconst checked = checkOperand(ctx, arg);\n\tif (!checked) return void 0;\n\tif (param.type === \"any\") return checked.node;\n\tconst problem = checked.type && (arg.kind === \"call\" || arg.kind === \"binary\") ? compatible(param.type, checked.type) ? void 0 : {\n\t\tmessage: `Expected ${param.type}`,\n\t\thint: `Argument \"${param.name}\" is ${checked.type}`\n\t} : checkValue(param.type, void 0, checked.node);\n\tif (problem) ctx.errors.push(diagnostic(\"wrong-argument\", problem.message, problem.hint, arg.span));\n\treturn problem ? void 0 : checked.node;\n};\nconst checkCall = (ctx, call, checkOperand) => {\n\tconst functions = ctx.schema.functions ?? {};\n\tif (!Object.hasOwn(functions, call.name)) {\n\t\tconst close = suggest(call.name, Object.keys(functions));\n\t\tctx.errors.push(diagnostic(\"unknown-function\", `Unknown function \"${call.name}\"`, close ? `Did you mean \"${close}\"?` : `Available functions: ${Object.keys(functions).join(\", \") || \"none\"}`, call.span));\n\t\treturn;\n\t}\n\tconst fn = functions[call.name];\n\tconst min = fn.params.length;\n\tif (call.args.length < min || !fn.rest && call.args.length > min) {\n\t\tconst expectedCount = fn.rest ? `at least ${min}` : String(min);\n\t\tctx.errors.push(diagnostic(\"wrong-arity\", `${call.name}() takes ${expectedCount} argument(s) but got ${call.args.length}`, `Usage: ${call.name}(${[...fn.params, ...fn.rest ? [fn.rest] : []].map((p) => p.name).join(\", \")})`, call.span));\n\t\treturn;\n\t}\n\tconst args = call.args.map((arg, i) => checkArg(ctx, fn.params[i] ?? fn.rest, arg, checkOperand));\n\tif (args.some((arg) => arg === void 0)) return void 0;\n\treturn {\n\t\tcall: {\n\t\t\t...call,\n\t\t\targs\n\t\t},\n\t\treturns: fn.returns ?? \"boolean\"\n\t};\n};\n//#endregion\n//#region src/filter/check/operand.ts\nconst arithmetic$1 = (left, right, op) => {\n\tif (left === \"timestamp\" && right === \"duration\") return \"timestamp\";\n\tif (left === \"timestamp\" && right === \"timestamp\" && op === \"-\") return \"duration\";\n\tif (left === \"duration\" && right === \"duration\") return \"duration\";\n\tif ((left === \"integer\" || left === \"number\") && (right === \"integer\" || right === \"number\")) return left === \"integer\" && right === \"integer\" ? \"integer\" : \"number\";\n};\nconst literalTypes = {\n\tnumber: \"number\",\n\tboolean: \"boolean\",\n\tduration: \"duration\",\n\ttimestamp: \"timestamp\"\n};\n/**\n* Checks a value operand (never a field reference): calls are validated against the registry,\n* arithmetic against operand types. Literals and text keep an undefined type until compared.\n*/\nconst checkOperand = (ctx, node) => {\n\tswitch (node.kind) {\n\t\tcase \"call\": {\n\t\t\tconst checked = checkCall(ctx, node, checkOperand);\n\t\t\treturn checked && {\n\t\t\t\tnode: checked.call,\n\t\t\t\ttype: checked.returns\n\t\t\t};\n\t\t}\n\t\tcase \"binary\": {\n\t\t\tconst left = checkOperand(ctx, node.left);\n\t\t\tconst right = checkOperand(ctx, node.right);\n\t\t\tif (!left || !right) return void 0;\n\t\t\tconst type = left.type && right.type ? arithmetic$1(left.type, right.type, node.op) : left.type ?? right.type ?? \"number\";\n\t\t\tif (!type) {\n\t\t\t\tctx.errors.push(diagnostic(\"invalid-value\", `Cannot apply \"${node.op}\" to ${left.type} and ${right.type}`, \"Add a duration to a timestamp, or combine numbers\", node.span));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tnode: {\n\t\t\t\t\t...node,\n\t\t\t\t\tleft: left.node,\n\t\t\t\t\tright: right.node\n\t\t\t\t},\n\t\t\t\ttype\n\t\t\t};\n\t\t}\n\t\tcase \"number\":\n\t\tcase \"boolean\":\n\t\tcase \"duration\":\n\t\tcase \"timestamp\": return {\n\t\t\tnode,\n\t\t\ttype: literalTypes[node.kind]\n\t\t};\n\t\tdefault: return {\n\t\t\tnode,\n\t\t\ttype: void 0\n\t\t};\n\t}\n};\n//#endregion\n//#region src/filter/check/check.ts\nconst ordered = [\n\t\"string\",\n\t\"integer\",\n\t\"number\",\n\t\"timestamp\",\n\t\"duration\",\n\t\"any\"\n];\nconst checkSubject = (ctx, node) => {\n\tif (node.kind === \"member\") {\n\t\tconst resolved = resolveMember(ctx, node);\n\t\treturn resolved && {\n\t\t\tnode: resolved,\n\t\t\ttype: resolved.field.spec.type,\n\t\t\tspec: resolved.field.spec\n\t\t};\n\t}\n\tconst checked = checkOperand(ctx, node);\n\treturn checked && {\n\t\t...checked,\n\t\tspec: void 0\n\t};\n};\nconst operatorError = (ctx, message, hint, node) => {\n\tctx.errors.push(diagnostic(\"operator-not-allowed\", message, hint, node.span));\n};\nconst checkRight = (ctx, subject, node) => {\n\tif (!subject.type) return checkOperand(ctx, node)?.node;\n\tconst checked = checkOperand(ctx, node);\n\tif (!checked) return void 0;\n\tconst problem = checked.type && (node.kind === \"call\" || node.kind === \"binary\") ? compatible(subject.type, checked.type) ? void 0 : {\n\t\tmessage: `Expected ${subject.type} but got ${checked.type}`,\n\t\thint: \"Compare values of the same type\"\n\t} : checkValue(subject.type, subject.spec, checked.node);\n\tif (problem) ctx.errors.push(diagnostic(\"invalid-value\", problem.message, problem.hint, node.span));\n\treturn problem ? void 0 : checked.node;\n};\nconst checkCompare = (ctx, node) => {\n\tconst subject = checkSubject(ctx, node.left);\n\tif (!subject) return void 0;\n\tconst type = subject.type;\n\tif (subject.spec?.repeated) return operatorError(ctx, `\"${node.op}\" is not supported on repeated fields`, \"Use field:value to test membership\", node);\n\tif (type === \"map\" || type === \"message\") return operatorError(ctx, `${type} fields cannot be compared`, \"Use field:key, or compare a nested field\", node);\n\tif (type && ![\"=\", \"!=\"].includes(node.op) && !ordered.includes(type)) return operatorError(ctx, `\"${node.op}\" is not supported for ${type} fields`, \"Supported: = !=\", node);\n\tconst wildcard = (node.op === \"=\" || node.op === \"!=\") && node.right.kind === \"string\" && node.right.value.includes(\"*\");\n\tif (wildcard && type && type !== \"string\" && type !== \"any\") {\n\t\tctx.errors.push(diagnostic(\"wildcard-not-allowed\", `Wildcards are only supported on string fields, not ${type}`, \"Remove the \\\"*\\\"\", node.right.span));\n\t\treturn;\n\t}\n\tconst right = wildcard ? node.right : checkRight(ctx, subject, node.right);\n\treturn right && {\n\t\t...node,\n\t\tleft: subject.node,\n\t\tright\n\t};\n};\nconst checkHas = (ctx, node) => {\n\tconst subject = checkSubject(ctx, node.left);\n\tif (!subject) return void 0;\n\tconst { type, spec } = subject;\n\tconst element = !spec?.repeated && (type === \"map\" || type === \"message\") ? {\n\t\t...subject,\n\t\ttype: \"string\"\n\t} : subject;\n\tconst right = checkRight(ctx, element, node.right);\n\treturn right && {\n\t\t...node,\n\t\tleft: subject.node,\n\t\tright\n\t};\n};\nconst checkExpr = (ctx, node) => {\n\tswitch (node.kind) {\n\t\tcase \"sequence\":\n\t\tcase \"and\":\n\t\tcase \"or\": {\n\t\t\tconst args = node.args.map((arg) => checkExpr(ctx, arg));\n\t\t\treturn args.every((arg) => arg) ? {\n\t\t\t\t...node,\n\t\t\t\targs\n\t\t\t} : void 0;\n\t\t}\n\t\tcase \"not\": {\n\t\t\tconst arg = checkExpr(ctx, node.arg);\n\t\t\treturn arg && {\n\t\t\t\t...node,\n\t\t\t\targ\n\t\t\t};\n\t\t}\n\t\tcase \"compare\": return checkCompare(ctx, node);\n\t\tcase \"has\": return checkHas(ctx, node);\n\t\tcase \"present\": {\n\t\t\tconst subject = checkSubject(ctx, node.left);\n\t\t\treturn subject && {\n\t\t\t\t...node,\n\t\t\t\tleft: subject.node\n\t\t\t};\n\t\t}\n\t\tcase \"global\": return node;\n\t\tcase \"call\": {\n\t\t\tconst checked = checkCall(ctx, node, checkOperand);\n\t\t\tif (checked && checked.returns !== \"boolean\") {\n\t\t\t\tctx.errors.push(diagnostic(\"not-boolean\", `${node.name}() returns ${checked.returns}, not a condition`, \"Compare its result: f(x) > 1\", node.span));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn checked?.call;\n\t\t}\n\t}\n};\n/**\n* Returns the tree with members resolved (`member.field`) and aliases canonicalised, or every\n* error found.\n*/\nconst checkFilter = (ast, schema) => {\n\tconst ctx = {\n\t\tschema,\n\t\terrors: []\n\t};\n\tconst checked = checkExpr(ctx, ast);\n\tif (!checked || ctx.errors.length > 0) return {\n\t\tok: false,\n\t\terrors: [...ctx.errors].sort((a, b) => a.span.start - b.span.start)\n\t};\n\treturn {\n\t\tok: true,\n\t\tast: checked\n\t};\n};\n//#endregion\n//#region src/filter/print/quote.ts\nconst escapes = {\n\t\"\\\\\": \"\\\\\\\\\",\n\t\"\\\"\": \"\\\\\\\"\",\n\t\"\\n\": \"\\\\n\",\n\t\"\\r\": \"\\\\r\",\n\t\"\t\": \"\\\\t\",\n\t\"\\x07\": \"\\\\a\",\n\t\"\\b\": \"\\\\b\",\n\t\"\\f\": \"\\\\f\",\n\t\"\\v\": \"\\\\v\"\n};\n/** Double-quoted string with backslashes, quotes and control characters escaped. */\nconst quote = (value) => {\n\tif (!value.isWellFormed()) throw new Error(\"Strings with unpaired surrogates cannot be printed\");\n\treturn `\"${value.replace(/[\\\\\"\\u0000-\\u001f\\u007f-\\u009f]/g, (char) => escapes[char] ?? `\\\\u${char.charCodeAt(0).toString(16).padStart(4, \"0\")}`)}\"`;\n};\n//#endregion\n//#region src/filter/print/print.ts\nconst literal = (node) => {\n\tswitch (node.kind) {\n\t\tcase \"string\": return quote(node.value);\n\t\tcase \"number\": return node.raw;\n\t\tcase \"boolean\": return String(node.value);\n\t\tcase \"duration\": return `${node.amount}${node.unit}`;\n\t\tcase \"timestamp\": return node.value;\n\t}\n};\nconst isNegative = (node) => node.kind === \"number\" && node.raw.startsWith(\"-\");\nconst printOperand = (node) => {\n\tswitch (node.kind) {\n\t\tcase \"member\": return node.path.join(\".\");\n\t\tcase \"call\": return `${node.name}(${node.args.map(printArg).join(\", \")})`;\n\t\tcase \"binary\":\n\t\t\tif (node.right.kind === \"binary\") throw new Error(\"Arithmetic is left-associative; a binary on the right cannot be printed\");\n\t\t\treturn `${printOperand(node.left)} ${node.op} ${printOperand(node.right)}`;\n\t\tdefault: return literal(node);\n\t}\n};\nconst printArg = (node) => isExpr(node) ? `(${printFilter(node)})` : printOperand(node);\nconst operandKinds = [\n\t\"member\",\n\t\"string\",\n\t\"number\",\n\t\"boolean\",\n\t\"duration\",\n\t\"timestamp\",\n\t\"binary\"\n];\nconst isExpr = (node) => !operandKinds.includes(node.kind) && node.kind !== \"call\";\nconst left = (node) => {\n\tif (isNegative(node)) throw new Error(\"A negative number cannot start a comparison; \\\"-5 = x\\\" parses as a negation\");\n\treturn printOperand(node);\n};\nconst grouped = (parent, node) => {\n\treturn {\n\t\tand: [\"and\", \"or\"],\n\t\tsequence: [\n\t\t\t\"and\",\n\t\t\t\"or\",\n\t\t\t\"sequence\"\n\t\t],\n\t\tor: [\n\t\t\t\"and\",\n\t\t\t\"or\",\n\t\t\t\"sequence\"\n\t\t],\n\t\tnot: [\n\t\t\t\"and\",\n\t\t\t\"or\",\n\t\t\t\"sequence\",\n\t\t\t\"not\"\n\t\t]\n\t}[parent].includes(node.kind) ? `(${printFilter(node)})` : printFilter(node);\n};\n/**\n* Canonical text: AND/OR/NOT keywords (never \"-\"), double-quoted strings, and parentheses\n* around every OR, AND or sequence nested inside another group.\n*/\nconst printFilter = (node) => {\n\tswitch (node.kind) {\n\t\tcase \"and\": return node.args.map((arg) => grouped(\"and\", arg)).join(\" AND \");\n\t\tcase \"or\": return node.args.map((arg) => grouped(\"or\", arg)).join(\" OR \");\n\t\tcase \"sequence\": return node.args.map((arg) => grouped(\"sequence\", arg)).join(\" \");\n\t\tcase \"not\": return `NOT ${grouped(\"not\", node.arg)}`;\n\t\tcase \"compare\": return `${left(node.left)} ${node.op} ${printOperand(node.right)}`;\n\t\tcase \"has\": return `${left(node.left)}:${printOperand(node.right)}`;\n\t\tcase \"present\": return `${left(node.left)}:*`;\n\t\tcase \"global\": return printOperand(node.value);\n\t\tcase \"call\": return printOperand(node);\n\t}\n};\n//#endregion\n//#region src/filter/evaluate/decimal.ts\n/** Exact decimal number, so values beyond double precision compare correctly. */\nvar Decimal = class {\n\tint;\n\tscale;\n\tconstructor(int, scale) {\n\t\tthis.int = int;\n\t\tthis.scale = scale;\n\t}\n\tcompare(other) {\n\t\tconst scale = Math.max(this.scale, other.scale);\n\t\tconst a = this.int * 10n ** BigInt(scale - this.scale);\n\t\tconst b = other.int * 10n ** BigInt(scale - other.scale);\n\t\treturn a < b ? -1 : a > b ? 1 : 0;\n\t}\n\ttoNumber() {\n\t\treturn Number(`${this.int}e-${this.scale}`);\n\t}\n};\nconst plain = /^(-?)(\\d+)(?:\\.(\\d+))?$/;\n/** Parses plain decimal text such as `-12.50`; undefined for exponents, hex and other text. */\nconst parseDecimal = (text) => {\n\tconst match = plain.exec(text);\n\tif (!match) return void 0;\n\tconst fraction = match[3] ?? \"\";\n\treturn new Decimal(BigInt(`${match[1]}${match[2]}${fraction}`), fraction.length);\n};\nconst numericText = /^-?(?:\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?|0[xX][0-9a-fA-F]+)$/;\n/** Double value of a number, decimal or numeric text, including exponent and hex forms. */\nconst doubleOf = (value) => {\n\tif (typeof value === \"number\") return value;\n\tif (typeof value === \"bigint\") return Number(value);\n\tif (value instanceof Decimal) return value.toNumber();\n\tif (typeof value !== \"string\" || !numericText.test(value)) return void 0;\n\treturn value.startsWith(\"-\") ? -Number(value.slice(1)) : Number(value);\n};\nconst decimalOf = (value) => {\n\tif (typeof value === \"bigint\") return new Decimal(value, 0);\n\tif (typeof value === \"number\") return Number.isFinite(value) ? parseDecimal(String(value)) : void 0;\n\tif (typeof value === \"string\") return parseDecimal(value);\n\treturn value instanceof Decimal ? value : void 0;\n};\n//#endregion\n//#region src/filter/evaluate/glob.ts\n/**\n* Whole-string match where each `*` matches any run of characters (including none).\n* Linear scan with backtracking to the last star, so hostile patterns cannot blow up.\n*/\nconst globMatch = (pattern, text) => {\n\tlet p = 0;\n\tlet t = 0;\n\tlet star = -1;\n\tlet resume = 0;\n\twhile (t < text.length) if (p < pattern.length && pattern[p] === \"*\") {\n\t\tstar = p++;\n\t\tresume = t;\n\t} else if (p < pattern.length && pattern[p] === text[t]) {\n\t\tp++;\n\t\tt++;\n\t} else if (star >= 0) {\n\t\tp = star + 1;\n\t\tt = ++resume;\n\t} else return false;\n\twhile (pattern[p] === \"*\") p++;\n\treturn p === pattern.length;\n};\n//#endregion\n//#region src/filter/evaluate/values.ts\nconst isDuration = (value) => typeof value === \"object\" && value !== null && !(value instanceof Date) && !(value instanceof Decimal) && \"seconds\" in value && typeof value.seconds === \"number\";\n/** Evaluated value of a literal; numbers keep full precision when written as plain decimals. */\nconst literalValue = (node) => {\n\tswitch (node.kind) {\n\t\tcase \"string\": return node.value;\n\t\tcase \"number\": return parseDecimal(node.raw) ?? node.value;\n\t\tcase \"boolean\": return node.value;\n\t\tcase \"duration\": return { seconds: node.amount * unitSeconds[node.unit] };\n\t\tcase \"timestamp\": return new Date(timestampMillis(node.value) ?? NaN);\n\t}\n};\nconst secondsOf = (value) => {\n\tif (isDuration(value)) return value.seconds;\n\tif (typeof value === \"number\") return value;\n\treturn typeof value === \"string\" ? durationSeconds(value) : void 0;\n};\nconst millisOf = (value) => {\n\tif (value instanceof Date) return value.getTime();\n\treturn typeof value === \"string\" ? timestampMillis(value) : void 0;\n};\n/** Source-like text of a value, used for search terms and key lookups. */\nconst textOf = (node) => {\n\tswitch (node.kind) {\n\t\tcase \"string\": return node.value;\n\t\tcase \"member\": return node.path.join(\".\");\n\t\tcase \"number\": return node.raw;\n\t\tcase \"boolean\": return String(node.value);\n\t\tcase \"duration\": return `${node.amount}${node.unit}`;\n\t\tcase \"timestamp\": return node.value;\n\t\tdefault: return;\n\t}\n};\n//#endregion\n//#region src/filter/evaluate/compare.ts\nconst verdict = (op, order) => {\n\tswitch (op) {\n\t\tcase \"=\": return order === 0;\n\t\tcase \"!=\": return order !== 0;\n\t\tcase \"<\": return order < 0;\n\t\tcase \"<=\": return order <= 0;\n\t\tcase \">\": return order > 0;\n\t\tcase \">=\": return order >= 0;\n\t}\n};\nconst order = (a, b) => a < b ? -1 : a > b ? 1 : 0;\nconst numbers = (actual, expected) => {\n\tconst a = decimalOf(actual);\n\tconst b = decimalOf(expected);\n\tif (a && b) return a.compare(b);\n\tconst x = doubleOf(actual);\n\tconst y = doubleOf(expected);\n\treturn x === void 0 || y === void 0 || Number.isNaN(x) || Number.isNaN(y) ? void 0 : order(x, y);\n};\nconst againstString = (op, actual, expected) => {\n\tconst wildcard = (op === \"=\" || op === \"!=\") && expected.includes(\"*\");\n\tif (typeof actual === \"string\") return wildcard ? verdict(op, globMatch(expected, actual) ? 0 : 1) : verdict(op, order(actual, expected));\n\tif (typeof actual === \"number\" || typeof actual === \"bigint\") {\n\t\tconst result = numbers(actual, expected);\n\t\treturn result === void 0 ? void 0 : verdict(op, result);\n\t}\n\tif (actual instanceof Date) {\n\t\tconst millis = millisOf(expected);\n\t\treturn millis === void 0 ? void 0 : verdict(op, order(actual.getTime(), millis));\n\t}\n\tif (typeof actual === \"boolean\") return expected === \"true\" || expected === \"false\" ? verdict(op, order(String(actual), expected)) : void 0;\n\tif (isDuration(actual)) {\n\t\tconst seconds = secondsOf(expected);\n\t\treturn seconds === void 0 ? void 0 : verdict(op, order(actual.seconds, seconds));\n\t}\n};\n/**\n* Compares one actual value with the evaluated right-hand value. Incomparable pairs are\n* false for every operator, including `!=`; the caller turns `!=` into NOT(`=`).\n*/\nconst compareValue = (op, actual, expected) => {\n\tif (actual === null || actual === void 0) return false;\n\tif (typeof expected === \"string\") return againstString(op, actual, expected) ?? false;\n\tif (expected instanceof Decimal || typeof expected === \"number\" || typeof expected === \"bigint\") {\n\t\tconst result = numbers(actual, expected);\n\t\treturn result === void 0 ? false : verdict(op, result);\n\t}\n\tif (typeof expected === \"boolean\") {\n\t\tconst value = typeof actual === \"string\" ? actual === \"true\" ? true : actual === \"false\" ? false : void 0 : actual;\n\t\treturn typeof value === \"boolean\" ? verdict(op, order(String(value), String(expected))) : false;\n\t}\n\tif (expected instanceof Date) {\n\t\tconst millis = millisOf(actual);\n\t\treturn millis === void 0 || Number.isNaN(expected.getTime()) ? false : verdict(op, order(millis, expected.getTime()));\n\t}\n\tif (isDuration(expected)) {\n\t\tconst seconds = secondsOf(actual);\n\t\treturn seconds === void 0 ? false : verdict(op, order(seconds, expected.seconds));\n\t}\n\treturn false;\n};\n//#endregion\n//#region src/filter/evaluate/resolve.ts\n/**\n* Values found at a dotted path. Arrays on the way are traversed element-wise, so a path\n* through repeated fields can yield several values; a missing path yields none.\n*/\nconst resolvePath = (record, path) => {\n\tlet current = [record];\n\tfor (const segment of path) current = current.flatMap((value) => {\n\t\tif (Array.isArray(value)) return value.flatMap((item) => step(item, segment));\n\t\treturn step(value, segment);\n\t});\n\treturn current.filter((value) => value !== void 0 && value !== null);\n};\nconst step = (value, segment) => {\n\tif (typeof value !== \"object\" || value === null) return [];\n\tif (value instanceof Map) return value.has(segment) ? [value.get(segment)] : [];\n\treturn Object.hasOwn(value, segment) ? [value[segment]] : [];\n};\n/** One level of array flattening, so repeated fields compare per element. */\nconst elements = (values) => values.flatMap((value) => Array.isArray(value) ? value : [value]);\n//#endregion\n//#region src/filter/evaluate/search.ts\nconst maxDepth = 32;\nconst leaves = (value, depth) => {\n\tif (depth > maxDepth || value === null || value === void 0) return [];\n\tif (typeof value === \"string\") return [value];\n\tif (typeof value === \"number\" || typeof value === \"boolean\" || typeof value === \"bigint\") return [String(value)];\n\tif (value instanceof Date) return [value.toISOString()];\n\tif (Array.isArray(value)) return value.flatMap((item) => leaves(item, depth + 1));\n\tif (value instanceof Map) return [...value.values()].flatMap((item) => leaves(item, depth + 1));\n\tif (typeof value === \"object\") return Object.values(value).flatMap((item) => leaves(item, depth + 1));\n\treturn [];\n};\n/** Default global restriction: case-insensitive substring over every string and number in the record. */\nconst defaultSearch = (text, record) => {\n\tconst needle = text.toLowerCase();\n\treturn leaves(record, 0).some((leaf) => leaf.toLowerCase().includes(needle));\n};\n//#endregion\n//#region src/filter/evaluate/evaluate.ts\nconst isOperand = (node) => [\n\t\"member\",\n\t\"string\",\n\t\"number\",\n\t\"boolean\",\n\t\"duration\",\n\t\"timestamp\",\n\t\"call\",\n\t\"binary\"\n].includes(node.kind);\nconst arithmetic = (op, left, right) => {\n\tconst sign = op === \"+\" ? 1 : -1;\n\tif (left instanceof Date && isDuration(right)) return new Date(left.getTime() + sign * right.seconds * 1e3);\n\tif (left instanceof Date && right instanceof Date && op === \"-\") return { seconds: (left.getTime() - right.getTime()) / 1e3 };\n\tif (isDuration(left) && isDuration(right)) return { seconds: left.seconds + sign * right.seconds };\n\tconst a = left instanceof Decimal ? left.toNumber() : left;\n\tconst b = right instanceof Decimal ? right.toNumber() : right;\n\treturn typeof a === \"number\" && typeof b === \"number\" ? a + sign * b : void 0;\n};\nconst callValue = (call, ctx) => {\n\tconst fn = ctx.options.functions?.[call.name];\n\tif (!fn?.evaluate) throw new Error(`Function \"${call.name}\" has no evaluate implementation`);\n\tconst args = call.args.map((arg, i) => {\n\t\tconst param = fn.params[i] ?? fn.rest;\n\t\tif (arg.kind === \"member\" && param?.type === \"field\") return elements(resolvePath(ctx.record, arg.path));\n\t\treturn isOperand(arg) ? operandValue(arg, ctx) : evaluateExpr(arg, ctx);\n\t});\n\treturn fn.evaluate(...args);\n};\nconst operandValue = (node, ctx) => {\n\tswitch (node.kind) {\n\t\tcase \"member\": return node.path.join(\".\");\n\t\tcase \"call\": return callValue(node, ctx);\n\t\tcase \"binary\": return arithmetic(node.op, operandValue(node.left, ctx), operandValue(node.right, ctx));\n\t\tdefault: return literalValue(node);\n\t}\n};\nconst candidates = (node, ctx) => node.kind === \"member\" ? resolvePath(ctx.record, node.path) : [operandValue(node, ctx)];\nconst matches = (op, values, expected) => elements(values).some((value) => compareValue(op, value, expected));\nconst convertFor = (left, expected) => {\n\tconst type = left.kind === \"member\" ? left.field?.spec.type : void 0;\n\tif (typeof expected !== \"string\" || !type) return expected;\n\tif (type === \"timestamp\") return millisOf(expected) === void 0 ? expected : new Date(millisOf(expected));\n\tif (type === \"duration\") return secondsOf(expected) === void 0 ? expected : { seconds: secondsOf(expected) };\n\tif (type === \"integer\" || type === \"number\") return decimalOf(expected) ?? expected;\n\tif (type === \"boolean\") return expected === \"true\" ? true : expected === \"false\" ? false : expected;\n\treturn expected;\n};\nconst evaluateCompare = (node, ctx) => {\n\tconst expected = convertFor(node.left, operandValue(node.right, ctx));\n\tconst values = candidates(node.left, ctx);\n\tif (node.op === \"!=\") return !matches(\"=\", values, expected);\n\treturn matches(node.op, values, expected);\n};\nconst evaluateHas = (node, ctx) => {\n\tconst expected = operandValue(node.right, ctx);\n\tconst key = textOf(node.right);\n\treturn candidates(node.left, ctx).some((value) => {\n\t\tif (Array.isArray(value)) return value.some((item) => compareValue(\"=\", item, expected));\n\t\tif (value instanceof Map) return key !== void 0 && value.has(key);\n\t\tif (typeof value === \"object\" && value !== null && !(value instanceof Date) && !isDuration(value) && !(value instanceof Decimal)) return key !== void 0 && Object.hasOwn(value, key);\n\t\treturn compareValue(\"=\", value, expected);\n\t});\n};\nconst evaluateExpr = (node, ctx) => {\n\tswitch (node.kind) {\n\t\tcase \"sequence\":\n\t\tcase \"and\": return node.args.every((arg) => evaluateExpr(arg, ctx));\n\t\tcase \"or\": return node.args.some((arg) => evaluateExpr(arg, ctx));\n\t\tcase \"not\": return !evaluateExpr(node.arg, ctx);\n\t\tcase \"compare\": return evaluateCompare(node, ctx);\n\t\tcase \"has\": return evaluateHas(node, ctx);\n\t\tcase \"present\": return candidates(node.left, ctx).some((value) => value !== void 0 && value !== null);\n\t\tcase \"global\": return (ctx.options.search ?? defaultSearch)(textOf(node.value) ?? String(operandValue(node.value, ctx)), ctx.record);\n\t\tcase \"call\": return callValue(node, ctx) === true;\n\t}\n};\n/**\n* Pass a checked filter so field types decide how quoted values convert.\n* Throws when a called function has no `evaluate` implementation.\n*/\nconst evaluateFilter = (ast, record, options = {}) => evaluateExpr(ast, {\n\trecord,\n\toptions\n});\n//#endregion\nexport { checkFilter as a, lineColumn as c, quote as i, FilterSyntaxError as l, printFilter as n, parseFilter as o, printOperand as r, parseFilterOrThrow as s, evaluateFilter as t };\n","import { n as diagnostic, t as suggest } from \"./suggest-DaQ79xMY.js\";\n//#region src/order-by/parse.ts\nconst tokenize = (source) => {\n\tconst tokens = [];\n\tfor (const match of source.matchAll(/,|\\.|[^\\s,.]+/g)) {\n\t\tconst start = match.index;\n\t\tconst kind = match[0] === \",\" ? \"comma\" : match[0] === \".\" ? \"dot\" : \"word\";\n\t\ttokens.push({\n\t\t\tkind,\n\t\t\ttext: match[0],\n\t\t\tspan: {\n\t\t\t\tstart,\n\t\t\t\tend: start + match[0].length\n\t\t\t}\n\t\t});\n\t}\n\treturn tokens;\n};\n/** Accepts `asc` as well as the spec's `desc` suffix. Reports every error found. */\nconst parseOrderBy = (source) => {\n\tconst tokens = tokenize(source);\n\tconst errors = [];\n\tconst items = [];\n\tconst end = {\n\t\tstart: source.length,\n\t\tend: source.length\n\t};\n\tlet pos = 0;\n\tconst fail = (code, message, hint, span) => errors.push(diagnostic(code, message, hint, span));\n\tconst skipItem = () => {\n\t\twhile (pos < tokens.length && tokens[pos].kind !== \"comma\") pos++;\n\t\tpos++;\n\t};\n\tconst parseItem = () => {\n\t\tconst first = tokens[pos];\n\t\tif (!first || first.kind !== \"word\") {\n\t\t\tfail(\"expected-field\", `Expected a field name but found ${first ? `\"${first.text}\"` : \"end of input\"}`, \"Write order_by like: createdAt desc, total\", first?.span ?? end);\n\t\t\treturn false;\n\t\t}\n\t\tconst path = [first.text];\n\t\tlet last = first;\n\t\tpos++;\n\t\twhile (tokens[pos]?.kind === \"dot\") {\n\t\t\tconst part = tokens[pos + 1];\n\t\t\tif (part?.kind !== \"word\") {\n\t\t\t\tfail(\"expected-field\", \"Expected a field name after \\\".\\\"\", \"Write subfields like address.street\", part?.span ?? end);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tpath.push(part.text);\n\t\t\tlast = part;\n\t\t\tpos += 2;\n\t\t}\n\t\tconst word = tokens[pos];\n\t\tlet direction = \"asc\";\n\t\tif (word?.kind === \"word\") {\n\t\t\tif (word.text !== \"asc\" && word.text !== \"desc\") {\n\t\t\t\tfail(\"unexpected-token\", `Expected \"desc\" or \",\" but found \"${word.text}\"`, \"Separate fields with commas; append \\\" desc\\\" for descending order\", word.span);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tdirection = word.text;\n\t\t\tlast = word;\n\t\t\tpos++;\n\t\t}\n\t\tconst after = tokens[pos];\n\t\tif (after && after.kind !== \"comma\") {\n\t\t\tfail(\"unexpected-token\", `Expected \",\" but found \"${after.text}\"`, \"Separate fields with commas\", after.span);\n\t\t\treturn false;\n\t\t}\n\t\titems.push({\n\t\t\tpath,\n\t\t\tdirection,\n\t\t\tspan: {\n\t\t\t\tstart: first.span.start,\n\t\t\t\tend: last.span.end\n\t\t\t}\n\t\t});\n\t\treturn true;\n\t};\n\twhile (pos < tokens.length) {\n\t\tif (!parseItem()) {\n\t\t\tskipItem();\n\t\t\tcontinue;\n\t\t}\n\t\tif (tokens[pos]?.kind === \"comma\") {\n\t\t\tpos++;\n\t\t\tif (pos >= tokens.length) fail(\"expected-field\", \"Expected a field name after \\\",\\\"\", \"Remove the trailing comma\", end);\n\t\t}\n\t}\n\treturn errors.length === 0 ? {\n\t\tok: true,\n\t\titems,\n\t\terrors: []\n\t} : {\n\t\tok: false,\n\t\titems,\n\t\terrors\n\t};\n};\n//#endregion\n//#region src/order-by/print.ts\n/** Canonical order_by: `foo desc, bar`; ascending is implicit. */\nconst printOrderBy = (items) => items.map((item) => item.path.join(\".\") + (item.direction === \"desc\" ? \" desc\" : \"\")).join(\", \");\n//#endregion\n//#region src/order-by/check.ts\nconst find = (fields, name) => {\n\tif (Object.hasOwn(fields, name)) return {\n\t\tname,\n\t\tfield: fields[name]\n\t};\n\tconst alias = Object.entries(fields).find(([, field]) => field.aliases?.includes(name));\n\treturn alias && {\n\t\tname: alias[0],\n\t\tfield: alias[1]\n\t};\n};\n/** Replaces aliases with the real field names. Fields are sortable unless `sortable: false`. */\nconst checkOrderBy = (items, schema) => {\n\tconst errors = [];\n\tconst checked = [];\n\tfor (const item of items) {\n\t\tconst found = find(schema.fields, item.path[0]);\n\t\tif (!found) {\n\t\t\tconst usable = Object.entries(schema.fields).filter(([, f]) => f.sortable !== false).map(([name]) => name);\n\t\t\tconst close = suggest(item.path[0], usable);\n\t\t\terrors.push(diagnostic(\"unknown-field\", `Unknown field \"${item.path[0]}\"`, close ? `Did you mean \"${close}\"?` : `Available fields: ${usable.join(\", \")}`, item.span));\n\t\t\tcontinue;\n\t\t}\n\t\tconst path = [found.name];\n\t\tlet field = found.field;\n\t\tlet sortable = field.sortable !== false;\n\t\tlet failed = false;\n\t\tfor (const segment of item.path.slice(1)) {\n\t\t\tconst inner = field.fields ? find(field.fields, segment)?.field : field.value;\n\t\t\tif (!inner) {\n\t\t\t\terrors.push(diagnostic(\"invalid-traversal\", `Cannot sort by \"${segment}\" inside \"${path.join(\".\")}\"`, \"Only nested message fields and map values can be traversed\", item.span));\n\t\t\t\tfailed = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tpath.push(field.fields ? find(field.fields, segment).name : segment);\n\t\t\tfield = inner;\n\t\t\tsortable &&= field.sortable !== false;\n\t\t}\n\t\tif (failed) continue;\n\t\tif (!sortable) {\n\t\t\terrors.push(diagnostic(\"not-sortable\", `Field \"${path.join(\".\")}\" cannot be sorted on`, \"Mark it sortable in the schema\", item.span));\n\t\t\tcontinue;\n\t\t}\n\t\tchecked.push({\n\t\t\t...item,\n\t\t\tpath\n\t\t});\n\t}\n\treturn errors.length === 0 ? {\n\t\tok: true,\n\t\titems: checked\n\t} : {\n\t\tok: false,\n\t\terrors\n\t};\n};\n//#endregion\nexport { printOrderBy as n, parseOrderBy as r, checkOrderBy as t };\n","'use strict'\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0'\n\nconst MAX_LENGTH = 256\nconst MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n/* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16\n\n// Max safe length for a build identifier. The max length minus 6 characters for\n// the shortest version with a build 0.0.0+BUILD.\nconst MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6\n\nconst RELEASE_TYPES = [\n 'major',\n 'premajor',\n 'minor',\n 'preminor',\n 'patch',\n 'prepatch',\n 'prerelease',\n]\n\nmodule.exports = {\n MAX_LENGTH,\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_SAFE_INTEGER,\n RELEASE_TYPES,\n SEMVER_SPEC_VERSION,\n FLAG_INCLUDE_PRERELEASE: 0b001,\n FLAG_LOOSE: 0b010,\n}\n","'use strict'\n\nconst debug = (\n typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)\n) ? (...args) => console.error('SEMVER', ...args)\n : () => {}\n\nmodule.exports = debug\n","'use strict'\n\nconst {\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_LENGTH,\n} = require('./constants')\nconst debug = require('./debug')\nexports = module.exports = {}\n\n// The actual regexps go on exports.re\nconst re = exports.re = []\nconst safeRe = exports.safeRe = []\nconst src = exports.src = []\nconst safeSrc = exports.safeSrc = []\nconst t = exports.t = {}\nlet R = 0\n\nconst LETTERDASHNUMBER = '[a-zA-Z0-9-]'\n\n// Replace some greedy regex tokens to prevent regex dos issues. These regex are\n// used internally via the safeRe object since all inputs in this library get\n// normalized first to trim and collapse all extra whitespace. The original\n// regexes are exported for userland consumption and lower level usage. A\n// future breaking change could export the safer regex only with a note that\n// all input should have extra whitespace removed.\nconst safeRegexReplacements = [\n ['\\\\s', 1],\n ['\\\\d', MAX_LENGTH],\n [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],\n]\n\nconst makeSafeRegex = (value) => {\n for (const [token, max] of safeRegexReplacements) {\n value = value\n .split(`${token}*`).join(`${token}{0,${max}}`)\n .split(`${token}+`).join(`${token}{1,${max}}`)\n }\n return value\n}\n\nconst createToken = (name, value, isGlobal) => {\n const safe = makeSafeRegex(value)\n const index = R++\n debug(name, index, value)\n t[name] = index\n src[index] = value\n safeSrc[index] = safe\n re[index] = new RegExp(value, isGlobal ? 'g' : undefined)\n safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)\n}\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\ncreateToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*')\ncreateToken('NUMERICIDENTIFIERLOOSE', '\\\\d+')\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\ncreateToken('NONNUMERICIDENTIFIER', `\\\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\ncreateToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n// Non-numeric identifiers include numeric identifiers but can be longer.\n// Therefore non-numeric identifiers must go first.\n\ncreateToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\ncreateToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`)\n\ncreateToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\ncreateToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\ncreateToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]\n}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`)\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups. The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\ncreateToken('FULLPLAIN', `v?${src[t.MAINVERSION]\n}${src[t.PRERELEASE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('FULL', `^${src[t.FULLPLAIN]}$`)\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\ncreateToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]\n}${src[t.PRERELEASELOOSE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)\n\ncreateToken('GTLT', '((?:<|>)?=?)')\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifier, meaning \"any version\"\n// Only the first item is strictly required.\ncreateToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`)\ncreateToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`)\n\ncreateToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:${src[t.PRERELEASE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:${src[t.PRERELEASELOOSE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`)\ncreateToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\ncreateToken('COERCEPLAIN', `${'(^|[^\\\\d])' +\n '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)\ncreateToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\\\d])`)\ncreateToken('COERCEFULL', src[t.COERCEPLAIN] +\n `(?:${src[t.PRERELEASE]})?` +\n `(?:${src[t.BUILD]})?` +\n `(?:$|[^\\\\d])`)\ncreateToken('COERCERTL', src[t.COERCE], true)\ncreateToken('COERCERTLFULL', src[t.COERCEFULL], true)\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\ncreateToken('LONETILDE', '(?:~>?)')\n\ncreateToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true)\nexports.tildeTrimReplace = '$1~'\n\ncreateToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\ncreateToken('LONECARET', '(?:\\\\^)')\n\ncreateToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true)\nexports.caretTrimReplace = '$1^'\n\ncreateToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\ncreateToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`)\ncreateToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`)\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\ncreateToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]\n}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)\nexports.comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\ncreateToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAIN]})` +\n `\\\\s*$`)\n\ncreateToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s*$`)\n\n// Star ranges basically just allow anything at all.\ncreateToken('STAR', '(<|>)?=?\\\\s*\\\\*')\n// >=0.0.0 is like a star\ncreateToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$')\ncreateToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$')\n","'use strict'\n\n// parse out just the options we care about\nconst looseOption = Object.freeze({ loose: true })\nconst emptyOpts = Object.freeze({ })\nconst parseOptions = options => {\n if (!options) {\n return emptyOpts\n }\n\n if (typeof options !== 'object') {\n return looseOption\n }\n\n return options\n}\nmodule.exports = parseOptions\n","'use strict'\n\nconst numeric = /^[0-9]+$/\nconst compareIdentifiers = (a, b) => {\n if (typeof a === 'number' && typeof b === 'number') {\n return a === b ? 0 : a < b ? -1 : 1\n }\n\n const anum = numeric.test(a)\n const bnum = numeric.test(b)\n\n if (anum && bnum) {\n a = +a\n b = +b\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n}\n\nconst rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)\n\nmodule.exports = {\n compareIdentifiers,\n rcompareIdentifiers,\n}\n","'use strict'\n\nconst debug = require('../internal/debug')\nconst { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst parseOptions = require('../internal/parse-options')\nconst { compareIdentifiers } = require('../internal/identifiers')\n\nconst isPrereleaseIdentifier = (prerelease, identifier) => {\n const identifiers = identifier.split('.')\n if (identifiers.length > prerelease.length) {\n return false\n }\n\n for (let i = 0; i < identifiers.length; i++) {\n if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) {\n return false\n }\n }\n\n return true\n}\n\nclass SemVer {\n constructor (version, options) {\n options = parseOptions(options)\n\n if (version instanceof SemVer) {\n if (version.loose === !!options.loose &&\n version.includePrerelease === !!options.includePrerelease) {\n return version\n } else {\n version = version.version\n }\n } else if (typeof version !== 'string') {\n throw new TypeError(`Invalid version. Must be a string. Got type \"${typeof version}\".`)\n }\n\n if (version.length > MAX_LENGTH) {\n throw new TypeError(\n `version is longer than ${MAX_LENGTH} characters`\n )\n }\n\n debug('SemVer', version, options)\n this.options = options\n this.loose = !!options.loose\n // this isn't actually relevant for versions, but keep it so that we\n // don't run into trouble passing this.options around.\n this.includePrerelease = !!options.includePrerelease\n\n const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])\n\n if (!m) {\n throw new TypeError(`Invalid Version: ${version}`)\n }\n\n this.raw = version\n\n // these are actually numbers\n this.major = +m[1]\n this.minor = +m[2]\n this.patch = +m[3]\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = []\n } else {\n this.prerelease = m[4].split('.').map((id) => {\n if (/^[0-9]+$/.test(id)) {\n const num = +id\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n })\n }\n\n this.build = m[5] ? m[5].split('.') : []\n this.format()\n }\n\n format () {\n this.version = `${this.major}.${this.minor}.${this.patch}`\n if (this.prerelease.length) {\n this.version += `-${this.prerelease.join('.')}`\n }\n return this.version\n }\n\n toString () {\n return this.version\n }\n\n compare (other) {\n debug('SemVer.compare', this.version, this.options, other)\n if (!(other instanceof SemVer)) {\n if (typeof other === 'string' && other === this.version) {\n return 0\n }\n other = new SemVer(other, this.options)\n }\n\n if (other.version === this.version) {\n return 0\n }\n\n return this.compareMain(other) || this.comparePre(other)\n }\n\n compareMain (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n if (this.major < other.major) {\n return -1\n }\n if (this.major > other.major) {\n return 1\n }\n if (this.minor < other.minor) {\n return -1\n }\n if (this.minor > other.minor) {\n return 1\n }\n if (this.patch < other.patch) {\n return -1\n }\n if (this.patch > other.patch) {\n return 1\n }\n return 0\n }\n\n comparePre (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n let i = 0\n do {\n const a = this.prerelease[i]\n const b = other.prerelease[i]\n debug('prerelease compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n compareBuild (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n let i = 0\n do {\n const a = this.build[i]\n const b = other.build[i]\n debug('build compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n // preminor will bump the version up to the next minor release, and immediately\n // down to pre-release. premajor and prepatch work the same way.\n inc (release, identifier, identifierBase) {\n if (release.startsWith('pre')) {\n if (!identifier && identifierBase === false) {\n throw new Error('invalid increment argument: identifier is empty')\n }\n // Avoid an invalid semver results\n if (identifier) {\n const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])\n if (!match || match[1] !== identifier) {\n throw new Error(`invalid identifier: ${identifier}`)\n }\n }\n }\n\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor = 0\n this.major++\n this.inc('pre', identifier, identifierBase)\n break\n case 'preminor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor++\n this.inc('pre', identifier, identifierBase)\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0\n this.inc('patch', identifier, identifierBase)\n this.inc('pre', identifier, identifierBase)\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier, identifierBase)\n }\n this.inc('pre', identifier, identifierBase)\n break\n case 'release':\n if (this.prerelease.length === 0) {\n throw new Error(`version ${this.raw} is not a prerelease`)\n }\n this.prerelease.length = 0\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (\n this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0\n ) {\n this.major++\n }\n this.minor = 0\n this.patch = 0\n this.prerelease = []\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++\n }\n this.patch = 0\n this.prerelease = []\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++\n }\n this.prerelease = []\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n case 'pre': {\n const base = Number(identifierBase) ? 1 : 0\n\n if (this.prerelease.length === 0) {\n this.prerelease = [base]\n } else {\n let i = this.prerelease.length\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++\n i = -2\n }\n }\n if (i === -1) {\n // didn't increment anything\n if (identifier === this.prerelease.join('.') && identifierBase === false) {\n throw new Error('invalid increment argument: identifier already exists')\n }\n this.prerelease.push(base)\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n let prerelease = [identifier, base]\n if (identifierBase === false) {\n prerelease = [identifier]\n }\n if (isPrereleaseIdentifier(this.prerelease, identifier)) {\n const prereleaseBase = this.prerelease[identifier.split('.').length]\n if (isNaN(prereleaseBase)) {\n this.prerelease = prerelease\n }\n } else {\n this.prerelease = prerelease\n }\n }\n break\n }\n default:\n throw new Error(`invalid increment argument: ${release}`)\n }\n this.raw = this.format()\n if (this.build.length) {\n this.raw += `+${this.build.join('.')}`\n }\n return this\n }\n}\n\nmodule.exports = SemVer\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst parse = (version, options, throwErrors = false) => {\n if (version instanceof SemVer) {\n return version\n }\n try {\n return new SemVer(version, options)\n } catch (er) {\n if (!throwErrors) {\n return null\n }\n throw er\n }\n}\n\nmodule.exports = parse\n","'use strict'\n\nconst parse = require('./parse')\nconst valid = (version, options) => {\n const v = parse(version, options)\n return v ? v.version : null\n}\nmodule.exports = valid\n","'use strict'\n\nconst parse = require('./parse')\nconst clean = (version, options) => {\n const s = parse(version.trim().replace(/^[=v]+/, ''), options)\n return s ? s.version : null\n}\nmodule.exports = clean\n","'use strict'\n\nconst SemVer = require('../classes/semver')\n\nconst inc = (version, release, options, identifier, identifierBase) => {\n if (typeof (options) === 'string') {\n identifierBase = identifier\n identifier = options\n options = undefined\n }\n\n try {\n return new SemVer(\n version instanceof SemVer ? version.version : version,\n options\n ).inc(release, identifier, identifierBase).version\n } catch (er) {\n return null\n }\n}\nmodule.exports = inc\n","'use strict'\n\nconst parse = require('./parse.js')\n\nconst diff = (version1, version2) => {\n const v1 = parse(version1, null, true)\n const v2 = parse(version2, null, true)\n const comparison = v1.compare(v2)\n\n if (comparison === 0) {\n return null\n }\n\n const v1Higher = comparison > 0\n const highVersion = v1Higher ? v1 : v2\n const lowVersion = v1Higher ? v2 : v1\n const highHasPre = !!highVersion.prerelease.length\n const lowHasPre = !!lowVersion.prerelease.length\n\n if (lowHasPre && !highHasPre) {\n // Going from prerelease -> no prerelease requires some special casing\n\n // If the low version has only a major, then it will always be a major\n // Some examples:\n // 1.0.0-1 -> 1.0.0\n // 1.0.0-1 -> 1.1.1\n // 1.0.0-1 -> 2.0.0\n if (!lowVersion.patch && !lowVersion.minor) {\n return 'major'\n }\n\n // If the main part has no difference\n if (lowVersion.compareMain(highVersion) === 0) {\n if (lowVersion.minor && !lowVersion.patch) {\n return 'minor'\n }\n return 'patch'\n }\n }\n\n // add the `pre` prefix if we are going to a prerelease version\n const prefix = highHasPre ? 'pre' : ''\n\n if (v1.major !== v2.major) {\n return prefix + 'major'\n }\n\n if (v1.minor !== v2.minor) {\n return prefix + 'minor'\n }\n\n if (v1.patch !== v2.patch) {\n return prefix + 'patch'\n }\n\n // high and low are prereleases\n return 'prerelease'\n}\n\nmodule.exports = diff\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst major = (a, loose) => new SemVer(a, loose).major\nmodule.exports = major\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst minor = (a, loose) => new SemVer(a, loose).minor\nmodule.exports = minor\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst patch = (a, loose) => new SemVer(a, loose).patch\nmodule.exports = patch\n","'use strict'\n\nconst parse = require('./parse')\nconst prerelease = (version, options) => {\n const parsed = parse(version, options)\n return (parsed && parsed.prerelease.length) ? parsed.prerelease : null\n}\nmodule.exports = prerelease\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst compare = (a, b, loose) =>\n new SemVer(a, loose).compare(new SemVer(b, loose))\n\nmodule.exports = compare\n","'use strict'\n\nconst compare = require('./compare')\nconst rcompare = (a, b, loose) => compare(b, a, loose)\nmodule.exports = rcompare\n","'use strict'\n\nconst compare = require('./compare')\nconst compareLoose = (a, b) => compare(a, b, true)\nmodule.exports = compareLoose\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst compareBuild = (a, b, loose) => {\n const versionA = new SemVer(a, loose)\n const versionB = new SemVer(b, loose)\n return versionA.compare(versionB) || versionA.compareBuild(versionB)\n}\nmodule.exports = compareBuild\n","'use strict'\n\nconst compareBuild = require('./compare-build')\nconst sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))\nmodule.exports = sort\n","'use strict'\n\nconst compareBuild = require('./compare-build')\nconst rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))\nmodule.exports = rsort\n","'use strict'\n\nconst compare = require('./compare')\nconst gt = (a, b, loose) => compare(a, b, loose) > 0\nmodule.exports = gt\n","'use strict'\n\nconst compare = require('./compare')\nconst lt = (a, b, loose) => compare(a, b, loose) < 0\nmodule.exports = lt\n","'use strict'\n\nconst compare = require('./compare')\nconst eq = (a, b, loose) => compare(a, b, loose) === 0\nmodule.exports = eq\n","'use strict'\n\nconst compare = require('./compare')\nconst neq = (a, b, loose) => compare(a, b, loose) !== 0\nmodule.exports = neq\n","'use strict'\n\nconst compare = require('./compare')\nconst gte = (a, b, loose) => compare(a, b, loose) >= 0\nmodule.exports = gte\n","'use strict'\n\nconst compare = require('./compare')\nconst lte = (a, b, loose) => compare(a, b, loose) <= 0\nmodule.exports = lte\n","'use strict'\n\nconst eq = require('./eq')\nconst neq = require('./neq')\nconst gt = require('./gt')\nconst gte = require('./gte')\nconst lt = require('./lt')\nconst lte = require('./lte')\n\nconst cmp = (a, op, b, loose) => {\n switch (op) {\n case '===':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a === b\n\n case '!==':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a !== b\n\n case '':\n case '=':\n case '==':\n return eq(a, b, loose)\n\n case '!=':\n return neq(a, b, loose)\n\n case '>':\n return gt(a, b, loose)\n\n case '>=':\n return gte(a, b, loose)\n\n case '<':\n return lt(a, b, loose)\n\n case '<=':\n return lte(a, b, loose)\n\n default:\n throw new TypeError(`Invalid operator: ${op}`)\n }\n}\nmodule.exports = cmp\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst parse = require('./parse')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst coerce = (version, options) => {\n if (version instanceof SemVer) {\n return version\n }\n\n if (typeof version === 'number') {\n version = String(version)\n }\n\n if (typeof version !== 'string') {\n return null\n }\n\n options = options || {}\n\n let match = null\n if (!options.rtl) {\n match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE])\n } else {\n // Find the right-most coercible string that does not share\n // a terminus with a more left-ward coercible string.\n // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'\n // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'\n //\n // Walk through the string checking with a /g regexp\n // Manually set the index so as to pick up overlapping matches.\n // Stop when we get a match that ends at the string end, since no\n // coercible string can be more right-ward without the same terminus.\n const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL]\n let next\n while ((next = coerceRtlRegex.exec(version)) &&\n (!match || match.index + match[0].length !== version.length)\n ) {\n if (!match ||\n next.index + next[0].length !== match.index + match[0].length) {\n match = next\n }\n coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length\n }\n // leave it in a clean state\n coerceRtlRegex.lastIndex = -1\n }\n\n if (match === null) {\n return null\n }\n\n const major = match[2]\n const minor = match[3] || '0'\n const patch = match[4] || '0'\n const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : ''\n const build = options.includePrerelease && match[6] ? `+${match[6]}` : ''\n\n return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)\n}\nmodule.exports = coerce\n","'use strict'\n\nconst parse = require('./parse')\nconst constants = require('../internal/constants')\nconst SemVer = require('../classes/semver')\n\nconst truncate = (version, truncation, options) => {\n if (!constants.RELEASE_TYPES.includes(truncation)) {\n return null\n }\n\n const clonedVersion = cloneInputVersion(version, options)\n return clonedVersion && doTruncation(clonedVersion, truncation)\n}\n\nconst cloneInputVersion = (version, options) => {\n const versionStringToParse = (\n version instanceof SemVer ? version.version : version\n )\n\n return parse(versionStringToParse, options)\n}\n\nconst doTruncation = (version, truncation) => {\n if (isPrerelease(truncation)) {\n return version.version\n }\n\n version.prerelease = []\n\n switch (truncation) {\n case 'major':\n version.minor = 0\n version.patch = 0\n break\n case 'minor':\n version.patch = 0\n break\n }\n\n return version.format()\n}\n\nconst isPrerelease = (type) => {\n return type.startsWith('pre')\n}\n\nmodule.exports = truncate\n","'use strict'\n\nclass LRUCache {\n constructor () {\n this.max = 1000\n this.map = new Map()\n }\n\n get (key) {\n const value = this.map.get(key)\n if (value === undefined) {\n return undefined\n } else {\n // Remove the key from the map and add it to the end\n this.map.delete(key)\n this.map.set(key, value)\n return value\n }\n }\n\n delete (key) {\n return this.map.delete(key)\n }\n\n set (key, value) {\n const deleted = this.delete(key)\n\n if (!deleted && value !== undefined) {\n // If cache is full, delete the least recently used item\n if (this.map.size >= this.max) {\n const firstKey = this.map.keys().next().value\n this.delete(firstKey)\n }\n\n this.map.set(key, value)\n }\n\n return this\n }\n}\n\nmodule.exports = LRUCache\n","'use strict'\n\nconst SPACE_CHARACTERS = /\\s+/g\n\n// hoisted class for cyclic dependency\nclass Range {\n constructor (range, options) {\n options = parseOptions(options)\n\n if (range instanceof Range) {\n if (\n range.loose === !!options.loose &&\n range.includePrerelease === !!options.includePrerelease\n ) {\n return range\n } else {\n return new Range(range.raw, options)\n }\n }\n\n if (range instanceof Comparator) {\n // just put it in the set and return\n this.raw = range.value\n this.set = [[range]]\n this.formatted = undefined\n return this\n }\n\n this.options = options\n this.loose = !!options.loose\n this.includePrerelease = !!options.includePrerelease\n\n // First reduce all whitespace as much as possible so we do not have to rely\n // on potentially slow regexes like \\s*. This is then stored and used for\n // future error messages as well.\n this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')\n\n // First, split on ||\n this.set = this.raw\n .split('||')\n // map the range to a 2d array of comparators\n .map(r => this.parseRange(r.trim()))\n // throw out any comparator lists that are empty\n // this generally means that it was not a valid range, which is allowed\n // in loose mode, but will still throw if the WHOLE range is invalid.\n .filter(c => c.length)\n\n if (!this.set.length) {\n throw new TypeError(`Invalid SemVer Range: ${this.raw}`)\n }\n\n // if we have any that are not the null set, throw out null sets.\n if (this.set.length > 1) {\n // keep the first one, in case they're all null sets\n const first = this.set[0]\n this.set = this.set.filter(c => !isNullSet(c[0]))\n if (this.set.length === 0) {\n this.set = [first]\n } else if (this.set.length > 1) {\n // if we have any that are *, then the range is just *\n for (const c of this.set) {\n if (c.length === 1 && isAny(c[0])) {\n this.set = [c]\n break\n }\n }\n }\n }\n\n this.formatted = undefined\n }\n\n get range () {\n if (this.formatted === undefined) {\n this.formatted = ''\n for (let i = 0; i < this.set.length; i++) {\n if (i > 0) {\n this.formatted += '||'\n }\n const comps = this.set[i]\n for (let k = 0; k < comps.length; k++) {\n if (k > 0) {\n this.formatted += ' '\n }\n this.formatted += comps[k].toString().trim()\n }\n }\n }\n return this.formatted\n }\n\n format () {\n return this.range\n }\n\n toString () {\n return this.range\n }\n\n parseRange (range) {\n // strip build metadata so it can't bleed into the version\n range = range.replace(BUILDSTRIPRE, '')\n\n // memoize range parsing for performance.\n // this is a very hot path, and fully deterministic.\n const memoOpts =\n (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |\n (this.options.loose && FLAG_LOOSE)\n const memoKey = memoOpts + ':' + range\n const cached = cache.get(memoKey)\n if (cached) {\n return cached\n }\n\n const loose = this.options.loose\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]\n range = range.replace(hr, hyphenReplace(this.options.includePrerelease))\n debug('hyphen replace', range)\n\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)\n debug('comparator trim', range)\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[t.TILDETRIM], tildeTrimReplace)\n debug('tilde trim', range)\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[t.CARETTRIM], caretTrimReplace)\n debug('caret trim', range)\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n let rangeList = range\n .split(' ')\n .map(comp => parseComparator(comp, this.options))\n .join(' ')\n .split(/\\s+/)\n // >=0.0.0 is equivalent to *\n .map(comp => replaceGTE0(comp, this.options))\n\n if (loose) {\n // in loose mode, throw out any that are not valid comparators\n rangeList = rangeList.filter(comp => {\n debug('loose invalid filter', comp, this.options)\n return !!comp.match(re[t.COMPARATORLOOSE])\n })\n }\n debug('range list', rangeList)\n\n // if any comparators are the null set, then replace with JUST null set\n // if more than one comparator, remove any * comparators\n // also, don't include the same comparator more than once\n const rangeMap = new Map()\n const comparators = rangeList.map(comp => new Comparator(comp, this.options))\n for (const comp of comparators) {\n if (isNullSet(comp)) {\n return [comp]\n }\n rangeMap.set(comp.value, comp)\n }\n if (rangeMap.size > 1 && rangeMap.has('')) {\n rangeMap.delete('')\n }\n\n const result = [...rangeMap.values()]\n cache.set(memoKey, result)\n return result\n }\n\n intersects (range, options) {\n if (!(range instanceof Range)) {\n throw new TypeError('a Range is required')\n }\n\n return this.set.some((thisComparators) => {\n return (\n isSatisfiable(thisComparators, options) &&\n range.set.some((rangeComparators) => {\n return (\n isSatisfiable(rangeComparators, options) &&\n thisComparators.every((thisComparator) => {\n return rangeComparators.every((rangeComparator) => {\n return thisComparator.intersects(rangeComparator, options)\n })\n })\n )\n })\n )\n })\n }\n\n // if ANY of the sets match ALL of its comparators, then pass\n test (version) {\n if (!version) {\n return false\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n for (let i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version, this.options)) {\n return true\n }\n }\n return false\n }\n}\n\nmodule.exports = Range\n\nconst LRU = require('../internal/lrucache')\nconst cache = new LRU()\n\nconst parseOptions = require('../internal/parse-options')\nconst Comparator = require('./comparator')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst {\n safeRe: re,\n src,\n t,\n comparatorTrimReplace,\n tildeTrimReplace,\n caretTrimReplace,\n} = require('../internal/re')\nconst { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')\n\n// unbounded global build-metadata stripper used by parseRange\nconst BUILDSTRIPRE = new RegExp(src[t.BUILD], 'g')\n\nconst isNullSet = c => c.value === '<0.0.0-0'\nconst isAny = c => c.value === ''\n\n// take a set of comparators and determine whether there\n// exists a version which can satisfy it\nconst isSatisfiable = (comparators, options) => {\n let result = true\n const remainingComparators = comparators.slice()\n let testComparator = remainingComparators.pop()\n\n while (result && remainingComparators.length) {\n result = remainingComparators.every((otherComparator) => {\n return testComparator.intersects(otherComparator, options)\n })\n\n testComparator = remainingComparators.pop()\n }\n\n return result\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nconst parseComparator = (comp, options) => {\n comp = comp.replace(re[t.BUILD], '')\n debug('comp', comp, options)\n comp = replaceCarets(comp, options)\n debug('caret', comp)\n comp = replaceTildes(comp, options)\n debug('tildes', comp)\n comp = replaceXRanges(comp, options)\n debug('xrange', comp)\n comp = replaceStars(comp, options)\n debug('stars', comp)\n return comp\n}\n\nconst isX = id => !id || id.toLowerCase() === 'x' || id === '*'\n\nconst invalidXRangeOrder = (M, m, p) => (\n (isX(M) && !isX(m)) ||\n (isX(m) && p && !isX(p))\n)\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n// ~0.0.1 --> >=0.0.1 <0.1.0-0\nconst replaceTildes = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceTilde(c, options))\n .join(' ')\n}\n\nconst replaceTilde = (comp, options) => {\n const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]\n // if we're including prereleases in the match, then the lower bound is\n // -0, the lowest possible prerelease value, just like x-ranges and carets.\n // this keeps `~1.2` equivalent to the `1.2.x` x-range it's documented as.\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('tilde', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n // ~1.2 == >=1.2.0 <1.3.0-0\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else if (pr) {\n debug('replaceTilde pr', pr)\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n } else {\n // ~1.2.3 == >=1.2.3 <1.3.0-0\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('tilde return', ret)\n return ret\n })\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n// ^1.2.3 --> >=1.2.3 <2.0.0-0\n// ^1.2.0 --> >=1.2.0 <2.0.0-0\n// ^0.0.1 --> >=0.0.1 <0.0.2-0\n// ^0.1.0 --> >=0.1.0 <0.2.0-0\nconst replaceCarets = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceCaret(c, options))\n .join(' ')\n}\n\nconst replaceCaret = (comp, options) => {\n debug('caret', comp, options)\n const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('caret', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n if (M === '0') {\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else {\n ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`\n }\n } else if (pr) {\n debug('replaceCaret pr', pr)\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${+M + 1}.0.0-0`\n }\n } else {\n debug('no pr')\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p\n } <${+M + 1}.0.0-0`\n }\n }\n\n debug('caret return', ret)\n return ret\n })\n}\n\nconst replaceXRanges = (comp, options) => {\n debug('replaceXRanges', comp, options)\n return comp\n .split(/\\s+/)\n .map((c) => replaceXRange(c, options))\n .join(' ')\n}\n\nconst replaceXRange = (comp, options) => {\n comp = comp.trim()\n const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]\n return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n debug('xRange', comp, ret, gtlt, M, m, p, pr)\n if (invalidXRangeOrder(M, m, p)) {\n return comp\n }\n\n const xM = isX(M)\n const xm = xM || isX(m)\n const xp = xm || isX(p)\n const anyX = xp\n\n if (gtlt === '=' && anyX) {\n gtlt = ''\n }\n\n // if we're including prereleases in the match, then we need\n // to fix this to -0, the lowest possible prerelease value\n pr = options.includePrerelease ? '-0' : ''\n\n if (xM) {\n if (gtlt === '>' || gtlt === '<') {\n // nothing is allowed\n ret = '<0.0.0-0'\n } else {\n // nothing is forbidden\n ret = '*'\n }\n } else if (gtlt && anyX) {\n // we know patch is an x, because we have any x at all.\n // replace X with 0\n if (xm) {\n m = 0\n }\n p = 0\n\n if (gtlt === '>') {\n // >1 => >=2.0.0\n // >1.2 => >=1.3.0\n gtlt = '>='\n if (xm) {\n M = +M + 1\n m = 0\n p = 0\n } else {\n m = +m + 1\n p = 0\n }\n } else if (gtlt === '<=') {\n // <=0.7.x is actually <0.8.0, since any 0.7.x should\n // pass. Similarly, <=7.x is actually <8.0.0, etc.\n gtlt = '<'\n if (xm) {\n M = +M + 1\n } else {\n m = +m + 1\n }\n }\n\n if (gtlt === '<') {\n pr = '-0'\n }\n\n ret = `${gtlt + M}.${m}.${p}${pr}`\n } else if (xm) {\n ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`\n } else if (xp) {\n ret = `>=${M}.${m}.0${pr\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('xRange return', ret)\n\n return ret\n })\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nconst replaceStars = (comp, options) => {\n debug('replaceStars', comp, options)\n // Looseness is ignored here. star is always as loose as it gets!\n return comp\n .trim()\n .replace(re[t.STAR], '')\n}\n\nconst replaceGTE0 = (comp, options) => {\n debug('replaceGTE0', comp, options)\n return comp\n .trim()\n .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')\n}\n\n// This function is passed to string.replace(re[t.HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0 <3.5.0-0\n// TODO build?\nconst hyphenReplace = incPr => ($0,\n from, fM, fm, fp, fpr, fb,\n to, tM, tm, tp, tpr) => {\n if (isX(fM)) {\n from = ''\n } else if (isX(fm)) {\n from = `>=${fM}.0.0${incPr ? '-0' : ''}`\n } else if (isX(fp)) {\n from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`\n } else if (fpr) {\n from = `>=${from}`\n } else {\n from = `>=${from}${incPr ? '-0' : ''}`\n }\n\n if (isX(tM)) {\n to = ''\n } else if (isX(tm)) {\n to = `<${+tM + 1}.0.0-0`\n } else if (isX(tp)) {\n to = `<${tM}.${+tm + 1}.0-0`\n } else if (tpr) {\n to = `<=${tM}.${tm}.${tp}-${tpr}`\n } else if (incPr) {\n to = `<${tM}.${tm}.${+tp + 1}-0`\n } else {\n to = `<=${to}`\n }\n\n return `${from} ${to}`.trim()\n}\n\nconst testSet = (set, version, options) => {\n for (let i = 0; i < set.length; i++) {\n if (!set[i].test(version)) {\n return false\n }\n }\n\n if (version.prerelease.length && !options.includePrerelease) {\n // Find the set of versions that are allowed to have prereleases\n // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n // That should allow `1.2.3-pr.2` to pass.\n // However, `1.2.4-alpha.notready` should NOT be allowed,\n // even though it's within the range set by the comparators.\n for (let i = 0; i < set.length; i++) {\n debug(set[i].semver)\n if (set[i].semver === Comparator.ANY) {\n continue\n }\n\n if (set[i].semver.prerelease.length > 0) {\n const allowed = set[i].semver\n if (allowed.major === version.major &&\n allowed.minor === version.minor &&\n allowed.patch === version.patch) {\n return true\n }\n }\n }\n\n // Version has a -pre, but it's not one of the ones we like.\n return false\n }\n\n return true\n}\n","'use strict'\n\nconst ANY = Symbol('SemVer ANY')\n// hoisted class for cyclic dependency\nclass Comparator {\n static get ANY () {\n return ANY\n }\n\n constructor (comp, options) {\n options = parseOptions(options)\n\n if (comp instanceof Comparator) {\n if (comp.loose === !!options.loose) {\n return comp\n } else {\n comp = comp.value\n }\n }\n\n comp = comp.trim().split(/\\s+/).join(' ')\n debug('comparator', comp, options)\n this.options = options\n this.loose = !!options.loose\n this.parse(comp)\n\n if (this.semver === ANY) {\n this.value = ''\n } else {\n this.value = this.operator + this.semver.version\n }\n\n debug('comp', this)\n }\n\n parse (comp) {\n const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]\n const m = comp.match(r)\n\n if (!m) {\n throw new TypeError(`Invalid comparator: ${comp}`)\n }\n\n this.operator = m[1] !== undefined ? m[1] : ''\n if (this.operator === '=') {\n this.operator = ''\n }\n\n // if it literally is just '>' or '' then allow anything.\n if (!m[2]) {\n this.semver = ANY\n } else {\n this.semver = new SemVer(m[2], this.options.loose)\n }\n }\n\n toString () {\n return this.value\n }\n\n test (version) {\n debug('Comparator.test', version, this.options.loose)\n\n if (this.semver === ANY || version === ANY) {\n return true\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n return cmp(version, this.operator, this.semver, this.options)\n }\n\n intersects (comp, options) {\n if (!(comp instanceof Comparator)) {\n throw new TypeError('a Comparator is required')\n }\n\n if (this.operator === '') {\n if (this.value === '') {\n return true\n }\n return new Range(comp.value, options).test(this.value)\n } else if (comp.operator === '') {\n if (comp.value === '') {\n return true\n }\n return new Range(this.value, options).test(comp.semver)\n }\n\n options = parseOptions(options)\n\n // Special cases where nothing can possibly be lower\n if (options.includePrerelease &&\n (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {\n return false\n }\n if (!options.includePrerelease &&\n (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {\n return false\n }\n\n // Same direction increasing (> or >=)\n if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {\n return true\n }\n // Same direction decreasing (< or <=)\n if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {\n return true\n }\n // same SemVer and both sides are inclusive (<= or >=)\n if (\n (this.semver.version === comp.semver.version) &&\n this.operator.includes('=') && comp.operator.includes('=')) {\n return true\n }\n // opposite directions less than\n if (cmp(this.semver, '<', comp.semver, options) &&\n this.operator.startsWith('>') && comp.operator.startsWith('<')) {\n return true\n }\n // opposite directions greater than\n if (cmp(this.semver, '>', comp.semver, options) &&\n this.operator.startsWith('<') && comp.operator.startsWith('>')) {\n return true\n }\n return false\n }\n}\n\nmodule.exports = Comparator\n\nconst parseOptions = require('../internal/parse-options')\nconst { safeRe: re, t } = require('../internal/re')\nconst cmp = require('../functions/cmp')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst Range = require('./range')\n","'use strict'\n\nconst Range = require('../classes/range')\nconst satisfies = (version, range, options) => {\n try {\n range = new Range(range, options)\n } catch (er) {\n return false\n }\n return range.test(version)\n}\nmodule.exports = satisfies\n","'use strict'\n\nconst Range = require('../classes/range')\n\n// Mostly just for testing and legacy API reasons\nconst toComparators = (range, options) =>\n new Range(range, options).set\n .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))\n\nmodule.exports = toComparators\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\n\nconst maxSatisfying = (versions, range, options) => {\n let max = null\n let maxSV = null\n let rangeObj = null\n try {\n rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!max || maxSV.compare(v) === -1) {\n // compare(max, v, true)\n max = v\n maxSV = new SemVer(max, options)\n }\n }\n })\n return max\n}\nmodule.exports = maxSatisfying\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst minSatisfying = (versions, range, options) => {\n let min = null\n let minSV = null\n let rangeObj = null\n try {\n rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!min || minSV.compare(v) === 1) {\n // compare(min, v, true)\n min = v\n minSV = new SemVer(min, options)\n }\n }\n })\n return min\n}\nmodule.exports = minSatisfying\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst gt = require('../functions/gt')\n\nconst minVersion = (range, loose) => {\n range = new Range(range, loose)\n\n let minver = new SemVer('0.0.0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = new SemVer('0.0.0-0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = null\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i]\n\n let setMin = null\n comparators.forEach((comparator) => {\n // Clone to avoid manipulating the comparator's semver object.\n const compver = new SemVer(comparator.semver.version)\n switch (comparator.operator) {\n case '>':\n if (compver.prerelease.length === 0) {\n compver.patch++\n } else {\n compver.prerelease.push(0)\n }\n compver.raw = compver.format()\n /* fallthrough */\n case '':\n case '>=':\n if (!setMin || gt(compver, setMin)) {\n setMin = compver\n }\n break\n case '<':\n case '<=':\n /* Ignore maximum versions */\n break\n /* istanbul ignore next */\n default:\n throw new Error(`Unexpected operation: ${comparator.operator}`)\n }\n })\n if (setMin && (!minver || gt(minver, setMin))) {\n minver = setMin\n }\n }\n\n if (minver && range.test(minver)) {\n return minver\n }\n\n return null\n}\nmodule.exports = minVersion\n","'use strict'\n\nconst Range = require('../classes/range')\nconst validRange = (range, options) => {\n try {\n // Return '*' instead of '' so that truthiness works.\n // This will throw if it's invalid anyway\n return new Range(range, options).range || '*'\n } catch (er) {\n return null\n }\n}\nmodule.exports = validRange\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Comparator = require('../classes/comparator')\nconst { ANY } = Comparator\nconst Range = require('../classes/range')\nconst satisfies = require('../functions/satisfies')\nconst gt = require('../functions/gt')\nconst lt = require('../functions/lt')\nconst lte = require('../functions/lte')\nconst gte = require('../functions/gte')\n\nconst outside = (version, range, hilo, options) => {\n version = new SemVer(version, options)\n range = new Range(range, options)\n\n let gtfn, ltefn, ltfn, comp, ecomp\n switch (hilo) {\n case '>':\n gtfn = gt\n ltefn = lte\n ltfn = lt\n comp = '>'\n ecomp = '>='\n break\n case '<':\n gtfn = lt\n ltefn = gte\n ltfn = gt\n comp = '<'\n ecomp = '<='\n break\n default:\n throw new TypeError('Must provide a hilo val of \"<\" or \">\"')\n }\n\n // If it satisfies the range it is not outside\n if (satisfies(version, range, options)) {\n return false\n }\n\n // From now on, variable terms are as if we're in \"gtr\" mode.\n // but note that everything is flipped for the \"ltr\" function.\n\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i]\n\n let high = null\n let low = null\n\n comparators.forEach((comparator) => {\n if (comparator.semver === ANY) {\n comparator = new Comparator('>=0.0.0')\n }\n high = high || comparator\n low = low || comparator\n if (gtfn(comparator.semver, high.semver, options)) {\n high = comparator\n } else if (ltfn(comparator.semver, low.semver, options)) {\n low = comparator\n }\n })\n\n // If the edge version comparator has a operator then our version\n // isn't outside it\n if (high.operator === comp || high.operator === ecomp) {\n return false\n }\n\n // If the lowest version comparator has an operator and our version\n // is less than it then it isn't higher than the range\n if ((!low.operator || low.operator === comp) &&\n ltefn(version, low.semver)) {\n return false\n } else if (low.operator === ecomp && ltfn(version, low.semver)) {\n return false\n }\n }\n return true\n}\n\nmodule.exports = outside\n","'use strict'\n\n// Determine if version is greater than all the versions possible in the range.\nconst outside = require('./outside')\nconst gtr = (version, range, options) => outside(version, range, '>', options)\nmodule.exports = gtr\n","'use strict'\n\nconst outside = require('./outside')\n// Determine if version is less than all the versions possible in the range\nconst ltr = (version, range, options) => outside(version, range, '<', options)\nmodule.exports = ltr\n","'use strict'\n\nconst Range = require('../classes/range')\nconst intersects = (r1, r2, options) => {\n r1 = new Range(r1, options)\n r2 = new Range(r2, options)\n return r1.intersects(r2, options)\n}\nmodule.exports = intersects\n","'use strict'\n\n// given a set of versions and a range, create a \"simplified\" range\n// that includes the same versions that the original range does\n// If the original range is shorter than the simplified one, return that.\nconst satisfies = require('../functions/satisfies.js')\nconst compare = require('../functions/compare.js')\nmodule.exports = (versions, range, options) => {\n const set = []\n let first = null\n let prev = null\n const v = versions.sort((a, b) => compare(a, b, options))\n for (const version of v) {\n const included = satisfies(version, range, options)\n if (included) {\n prev = version\n if (!first) {\n first = version\n }\n } else {\n if (prev) {\n set.push([first, prev])\n }\n prev = null\n first = null\n }\n }\n if (first) {\n set.push([first, null])\n }\n\n const ranges = []\n for (const [min, max] of set) {\n if (min === max) {\n ranges.push(min)\n } else if (!max && min === v[0]) {\n ranges.push('*')\n } else if (!max) {\n ranges.push(`>=${min}`)\n } else if (min === v[0]) {\n ranges.push(`<=${max}`)\n } else {\n ranges.push(`${min} - ${max}`)\n }\n }\n const simplified = ranges.join(' || ')\n const original = typeof range.raw === 'string' ? range.raw : String(range)\n return simplified.length < original.length ? simplified : range\n}\n","'use strict'\n\nconst Range = require('../classes/range.js')\nconst Comparator = require('../classes/comparator.js')\nconst { ANY } = Comparator\nconst satisfies = require('../functions/satisfies.js')\nconst compare = require('../functions/compare.js')\n\n// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:\n// - Every simple range `r1, r2, ...` is a null set, OR\n// - Every simple range `r1, r2, ...` which is not a null set is a subset of\n// some `R1, R2, ...`\n//\n// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:\n// - If c is only the ANY comparator\n// - If C is only the ANY comparator, return true\n// - Else if in prerelease mode, return false\n// - else replace c with `[>=0.0.0]`\n// - If C is only the ANY comparator\n// - if in prerelease mode, return true\n// - else replace C with `[>=0.0.0]`\n// - Let EQ be the set of = comparators in c\n// - If EQ is more than one, return true (null set)\n// - Let GT be the highest > or >= comparator in c\n// - Let LT be the lowest < or <= comparator in c\n// - If GT and LT, and GT.semver > LT.semver, return true (null set)\n// - If any C is a = range, and GT or LT are set, return false\n// - If EQ\n// - If GT, and EQ does not satisfy GT, return true (null set)\n// - If LT, and EQ does not satisfy LT, return true (null set)\n// - If EQ satisfies every C, return true\n// - Else return false\n// - If GT\n// - If GT.semver is lower than any > or >= comp in C, return false\n// - If GT is >=, and GT.semver does not satisfy every C, return false\n// - If GT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the GT.semver tuple, return false\n// - If LT\n// - If LT.semver is greater than any < or <= comp in C, return false\n// - If LT is <=, and LT.semver does not satisfy every C, return false\n// - If LT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the LT.semver tuple, return false\n// - Else return true\n\nconst subset = (sub, dom, options = {}) => {\n if (sub === dom) {\n return true\n }\n\n sub = new Range(sub, options)\n dom = new Range(dom, options)\n let sawNonNull = false\n\n OUTER: for (const simpleSub of sub.set) {\n for (const simpleDom of dom.set) {\n const isSub = simpleSubset(simpleSub, simpleDom, options)\n sawNonNull = sawNonNull || isSub !== null\n if (isSub) {\n continue OUTER\n }\n }\n // the null set is a subset of everything, but null simple ranges in\n // a complex range should be ignored. so if we saw a non-null range,\n // then we know this isn't a subset, but if EVERY simple range was null,\n // then it is a subset.\n if (sawNonNull) {\n return false\n }\n }\n return true\n}\n\nconst minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')]\nconst minimumVersion = [new Comparator('>=0.0.0')]\n\nconst simpleSubset = (sub, dom, options) => {\n if (sub === dom) {\n return true\n }\n\n if (sub.length === 1 && sub[0].semver === ANY) {\n if (dom.length === 1 && dom[0].semver === ANY) {\n return true\n } else if (options.includePrerelease) {\n sub = minimumVersionWithPreRelease\n } else {\n sub = minimumVersion\n }\n }\n\n if (dom.length === 1 && dom[0].semver === ANY) {\n if (options.includePrerelease) {\n return true\n } else {\n dom = minimumVersion\n }\n }\n\n const eqSet = new Set()\n let gt, lt\n for (const c of sub) {\n if (c.operator === '>' || c.operator === '>=') {\n gt = higherGT(gt, c, options)\n } else if (c.operator === '<' || c.operator === '<=') {\n lt = lowerLT(lt, c, options)\n } else {\n eqSet.add(c.semver)\n }\n }\n\n if (eqSet.size > 1) {\n return null\n }\n\n let gtltComp\n if (gt && lt) {\n gtltComp = compare(gt.semver, lt.semver, options)\n if (gtltComp > 0) {\n return null\n } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {\n return null\n }\n }\n\n // will iterate one or zero times\n for (const eq of eqSet) {\n if (gt && !satisfies(eq, String(gt), options)) {\n return null\n }\n\n if (lt && !satisfies(eq, String(lt), options)) {\n return null\n }\n\n for (const c of dom) {\n if (!satisfies(eq, String(c), options)) {\n return false\n }\n }\n\n return true\n }\n\n let higher, lower\n let hasDomLT, hasDomGT\n // if the subset has a prerelease, we need a comparator in the superset\n // with the same tuple and a prerelease, or it's not a subset\n let needDomLTPre = lt &&\n !options.includePrerelease &&\n lt.semver.prerelease.length ? lt.semver : false\n let needDomGTPre = gt &&\n !options.includePrerelease &&\n gt.semver.prerelease.length ? gt.semver : false\n // exception: <1.2.3-0 is the same as <1.2.3\n if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&\n lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {\n needDomLTPre = false\n }\n\n for (const c of dom) {\n hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='\n hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='\n if (gt) {\n if (needDomGTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomGTPre.major &&\n c.semver.minor === needDomGTPre.minor &&\n c.semver.patch === needDomGTPre.patch) {\n needDomGTPre = false\n }\n }\n if (c.operator === '>' || c.operator === '>=') {\n higher = higherGT(gt, c, options)\n if (higher === c && higher !== gt) {\n return false\n }\n } else if (gt.operator === '>=' && !c.test(gt.semver)) {\n return false\n }\n }\n if (lt) {\n if (needDomLTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomLTPre.major &&\n c.semver.minor === needDomLTPre.minor &&\n c.semver.patch === needDomLTPre.patch) {\n needDomLTPre = false\n }\n }\n if (c.operator === '<' || c.operator === '<=') {\n lower = lowerLT(lt, c, options)\n if (lower === c && lower !== lt) {\n return false\n }\n } else if (lt.operator === '<=' && !c.test(lt.semver)) {\n return false\n }\n }\n if (!c.operator && (lt || gt) && gtltComp !== 0) {\n return false\n }\n }\n\n // if there was a < or >, and nothing in the dom, then must be false\n // UNLESS it was limited by another range in the other direction.\n // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0\n if (gt && hasDomLT && !lt && gtltComp !== 0) {\n return false\n }\n\n if (lt && hasDomGT && !gt && gtltComp !== 0) {\n return false\n }\n\n // we needed a prerelease range in a specific tuple, but didn't get one\n // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,\n // because it includes prereleases in the 1.2.3 tuple\n if (needDomGTPre || needDomLTPre) {\n return false\n }\n\n return true\n}\n\n// >=1.2.3 is lower than >1.2.3\nconst higherGT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options)\n return comp > 0 ? a\n : comp < 0 ? b\n : b.operator === '>' && a.operator === '>=' ? b\n : a\n}\n\n// <=1.2.3 is higher than <1.2.3\nconst lowerLT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options)\n return comp < 0 ? a\n : comp > 0 ? b\n : b.operator === '<' && a.operator === '<=' ? b\n : a\n}\n\nmodule.exports = subset\n","'use strict'\n\n// just pre-load all the stuff that index.js lazily exports\nconst internalRe = require('./internal/re')\nconst constants = require('./internal/constants')\nconst SemVer = require('./classes/semver')\nconst identifiers = require('./internal/identifiers')\nconst parse = require('./functions/parse')\nconst valid = require('./functions/valid')\nconst clean = require('./functions/clean')\nconst inc = require('./functions/inc')\nconst diff = require('./functions/diff')\nconst major = require('./functions/major')\nconst minor = require('./functions/minor')\nconst patch = require('./functions/patch')\nconst prerelease = require('./functions/prerelease')\nconst compare = require('./functions/compare')\nconst rcompare = require('./functions/rcompare')\nconst compareLoose = require('./functions/compare-loose')\nconst compareBuild = require('./functions/compare-build')\nconst sort = require('./functions/sort')\nconst rsort = require('./functions/rsort')\nconst gt = require('./functions/gt')\nconst lt = require('./functions/lt')\nconst eq = require('./functions/eq')\nconst neq = require('./functions/neq')\nconst gte = require('./functions/gte')\nconst lte = require('./functions/lte')\nconst cmp = require('./functions/cmp')\nconst coerce = require('./functions/coerce')\nconst truncate = require('./functions/truncate')\nconst Comparator = require('./classes/comparator')\nconst Range = require('./classes/range')\nconst satisfies = require('./functions/satisfies')\nconst toComparators = require('./ranges/to-comparators')\nconst maxSatisfying = require('./ranges/max-satisfying')\nconst minSatisfying = require('./ranges/min-satisfying')\nconst minVersion = require('./ranges/min-version')\nconst validRange = require('./ranges/valid')\nconst outside = require('./ranges/outside')\nconst gtr = require('./ranges/gtr')\nconst ltr = require('./ranges/ltr')\nconst intersects = require('./ranges/intersects')\nconst simplifyRange = require('./ranges/simplify')\nconst subset = require('./ranges/subset')\nmodule.exports = {\n parse,\n valid,\n clean,\n inc,\n diff,\n major,\n minor,\n patch,\n prerelease,\n compare,\n rcompare,\n compareLoose,\n compareBuild,\n sort,\n rsort,\n gt,\n lt,\n eq,\n neq,\n gte,\n lte,\n cmp,\n coerce,\n truncate,\n Comparator,\n Range,\n satisfies,\n toComparators,\n maxSatisfying,\n minSatisfying,\n minVersion,\n validRange,\n outside,\n gtr,\n ltr,\n intersects,\n simplifyRange,\n subset,\n SemVer,\n re: internalRe.re,\n src: internalRe.src,\n tokens: internalRe.t,\n SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,\n RELEASE_TYPES: constants.RELEASE_TYPES,\n compareIdentifiers: identifiers.compareIdentifiers,\n rcompareIdentifiers: identifiers.rcompareIdentifiers,\n}\n","/**\n * Error thrown when encountering an issue during parsing.\n *\n * @public\n */\nexport class ParseError extends Error {\n constructor(message, options) {\n super(message);\n this.name = 'ParseError';\n this.type = options.type;\n this.field = options.field;\n this.value = options.value;\n this.line = options.line;\n }\n}\n//# sourceMappingURL=errors.js.map","/**\n * EventSource/Server-Sent Events parser\n * @see https://html.spec.whatwg.org/multipage/server-sent-events.html\n */\nimport { ParseError } from './errors.js';\n// ASCII codes used in the hot parsing paths.\nconst LF = 10;\nconst CR = 13;\nconst SPACE = 32;\nconst MAX_FIELD_PREFIX_LENGTH = 6;\n/**\n * Creates a new EventSource parser.\n *\n * @param config - Parser configuration. Accepts callbacks (see {@link ParserCallbacks})\n * and options like `maxBufferSize` (see {@link ParserConfig}).\n *\n * @returns A new EventSource parser, with `feed` and `reset` methods.\n * @public\n */\nexport function createParser(config) {\n if (typeof config === 'function') {\n throw new TypeError('`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?');\n }\n const { maxBufferSize, onComment, onError, onEvent, onId, onRetry } = config;\n // Trailing bytes from prior `feed()` calls that did not yet form a complete line.\n // Stored as an array of fragments and only joined when a line terminator arrives.\n // Concatenating per-feed (`prefix + chunk`) is O(N²) when a single SSE line spans\n // many chunks (e.g. a large `data:` payload streamed in tiny slices, or an MCP-style\n // server that emits one giant content block). Buffering as fragments + joining once\n // makes the same workload linear.\n const pendingFragments = [];\n // Running total of `pendingFragments` lengths, kept in sync with the array so the\n // `maxBufferSize` check doesn't have to walk the fragment list on every feed.\n let pendingFragmentsLength = 0;\n // Empty or partial leading BOM; undefined once the BOM check is complete.\n let bomPrefix = '';\n let id;\n let data = '';\n let dataLines = 0;\n let eventType;\n // Set after a `maxBufferSize` overflow. Once tripped, `feed()` throws until\n // `reset()` is called — see the comment on `maxBufferSize` in `ParserConfig`.\n let terminated = false;\n let skippingLine = false;\n // Set when a line (parsed or discarded) was terminated by a trailing `\\r` at the very\n // end of a chunk. That `\\r` is ambiguous: it may be a bare-CR terminator or the first\n // half of a `\\r\\n` whose `\\n` lands in the next chunk. The line itself is complete\n // either way, but we must remember to swallow a single leading `\\n` from the next\n // chunk so the pair is treated as one terminator rather than a blank line (which\n // would dispatch an event prematurely).\n let skipNextLineFeed = false;\n /**\n * Feeds a chunk of the SSE stream to the parser. Any trailing bytes that do\n * not yet form a complete line are held back and prepended to the next chunk,\n * so callers can pass arbitrary slices of the stream without worrying about\n * line boundaries.\n *\n * Per the SSE spec, one leading UTF-8 BOM is stripped before parsing,\n * even when split across chunks. This handles both the raw 3-byte form (0xEF 0xBB\n * 0xBF) and a single decoded U+FEFF, so a leading BOM is ignored regardless of\n * how the caller decoded the bytes.\n *\n * @see https://html.spec.whatwg.org/multipage/server-sent-events.html#parsing-an-event-stream\n */\n function feed(chunk) {\n if (terminated) {\n throw new Error('Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.');\n }\n if (bomPrefix !== undefined) {\n chunk = bomPrefix + chunk;\n // Wait only while the input could still be a raw BOM. Empty chunks must\n // not finish the check, and a mismatched prefix must remain ordinary input.\n if (chunk === '' || chunk === '\\xEF' || chunk === '\\xEF\\xBB') {\n bomPrefix = chunk;\n return;\n }\n bomPrefix = undefined;\n // Strip exactly one leading BOM, in decoded or raw byte-valued form.\n chunk = chunk.replace(/^(?:\\uFEFF|\\xEF\\xBB\\xBF)/, '');\n }\n // Rare resume states from a prior chunk boundary: a pending `\\r\\n` split or a\n // line being discarded. Single combined check keeps the hot path to one branch;\n // the actual handling lives out-of-line in `resumeAfterSkip`.\n if (skippingLine || skipNextLineFeed) {\n chunk = resumeAfterSkip(chunk);\n if (!chunk) {\n return;\n }\n }\n // Hot path: no buffered prefix from a prior partial line. Hand the chunk\n // straight to `processLines`, exactly like the original implementation.\n // Zero new work in the common case (every chunk ends with `\\n\\n`).\n if (!pendingFragments.length) {\n const trailing = processLines(chunk);\n if (trailing !== '') {\n storeTrailing(trailing);\n }\n checkForBufferOverflow();\n return;\n }\n // We have a buffered prefix. If this chunk also has no terminator, append\n // to the buffer without concatenating — that's the O(N²) trap we're\n // avoiding (large single `data:` payload split across many tiny chunks).\n if (chunk.indexOf('\\n') === -1 && chunk.indexOf('\\r') === -1) {\n if (pendingFragmentsLength < MAX_FIELD_PREFIX_LENGTH) {\n const head = pendingFragments.join('') +\n chunk.slice(0, MAX_FIELD_PREFIX_LENGTH - pendingFragmentsLength);\n if (!shouldBufferTrailing(head)) {\n pendingFragments.length = 0;\n pendingFragmentsLength = 0;\n skippingLine = true;\n return;\n }\n }\n pendingFragments.push(chunk);\n pendingFragmentsLength += chunk.length;\n checkForBufferOverflow();\n return;\n }\n // Terminator arrived. Join the accumulated fragments + this chunk once,\n // process, and buffer any new trailing partial line.\n pendingFragments.push(chunk);\n const input = pendingFragments.join('');\n pendingFragments.length = 0;\n pendingFragmentsLength = 0;\n storeTrailing(processLines(input));\n checkForBufferOverflow();\n }\n // Out-of-line handler for the rare post-boundary states. `skipNextLineFeed` means a\n // line (parsed or discarded) ended with a trailing `\\r` at the previous chunk boundary,\n // so a single leading `\\n` must be swallowed to consume a split `\\r\\n` as one terminator.\n // `skippingLine` means we are discarding an invalid line until its terminator arrives.\n // The two states are mutually exclusive. Returns the remaining chunk to parse ('' if\n // this chunk was fully consumed).\n function resumeAfterSkip(chunk) {\n if (chunk.length === 0) {\n return chunk;\n }\n if (skipNextLineFeed) {\n skipNextLineFeed = false;\n return chunk.charCodeAt(0) === LF ? chunk.slice(1) : chunk;\n }\n const crIndex = chunk.indexOf('\\r');\n const lfIndex = chunk.indexOf('\\n');\n const lineEnd = crIndex === -1 ? lfIndex : lfIndex === -1 ? crIndex : crIndex < lfIndex ? crIndex : lfIndex;\n if (lineEnd === -1) {\n return '';\n }\n // Trailing `\\r` at the very end of the chunk: defer the CRLF/CR decision to the\n // next chunk (see `skipNextLineFeed`) rather than greedily consuming just the `\\r`.\n if (lineEnd === chunk.length - 1 && chunk.charCodeAt(lineEnd) === CR) {\n skippingLine = false;\n skipNextLineFeed = true;\n return '';\n }\n skippingLine = false;\n return chunk.slice(lineEnd + (chunk.charCodeAt(lineEnd) === CR && chunk.charCodeAt(lineEnd + 1) === LF ? 2 : 1));\n }\n function storeTrailing(trailing) {\n if (!trailing)\n return;\n // A trailing that ends with `\\r` is not a partial line: the `\\r` terminates it,\n // and only the CRLF-vs-CR ambiguity remains (the matching `\\n` may start the next\n // chunk). Parse the completed line now — buffering it could grow unbounded through\n // the no-terminator append path, and discarding it would eat the terminator and\n // make skip mode swallow the next line.\n if (trailing.charCodeAt(trailing.length - 1) === CR) {\n parseLine(trailing, 0, trailing.length - 1);\n if (checkForBufferOverflow())\n return;\n skipNextLineFeed = true;\n return;\n }\n if (shouldBufferTrailing(trailing)) {\n pendingFragments.push(trailing);\n pendingFragmentsLength = trailing.length;\n return;\n }\n skippingLine = true;\n }\n function shouldBufferTrailing(trailing) {\n const firstCharCode = trailing.charCodeAt(0);\n return ((firstCharCode === 58 && !!onComment) ||\n (firstCharCode === 100 && isPotentialField(trailing, 'data')) ||\n (firstCharCode === 101 && isPotentialField(trailing, 'event')) ||\n (firstCharCode === 105 && isPotentialField(trailing, 'id')) ||\n (firstCharCode === 114 && isPotentialField(trailing, 'retry')));\n }\n // Returns true when parsing must stop for the current chunk (the parser was already\n // terminated or has just overflowed), and false when processing can continue.\n function checkForBufferOverflow() {\n if (terminated)\n return true;\n if (maxBufferSize === undefined)\n return false;\n if (pendingFragmentsLength + data.length <= maxBufferSize)\n return false;\n terminated = true;\n pendingFragments.length = 0;\n pendingFragmentsLength = 0;\n id = undefined;\n data = '';\n dataLines = 0;\n eventType = undefined;\n skippingLine = false;\n skipNextLineFeed = false;\n onError === null || onError === void 0 ? void 0 : onError(new ParseError(`Buffered data exceeded max buffer size of ${maxBufferSize} characters`, {\n type: 'max-buffer-size-exceeded',\n }));\n return true;\n }\n /**\n * Splits `chunk` into SSE lines and dispatches each to the appropriate handler.\n * Returns any trailing bytes that did not terminate with a line break, so the\n * caller can prepend them to the next chunk.\n *\n * The SSE spec permits three line terminators: `\\n`, `\\r`, and `\\r\\n`. Real-world\n * streams almost always use plain `\\n`, so we take a fast path when no `\\r` is\n * present in the chunk. The slow path is spec-correct but does more work per line.\n */\n function processLines(chunk) {\n let searchIndex = 0;\n // Fast path: LF-only chunk (the common case for typical SSE servers).\n // We can scan forward with a single `indexOf('\\n')` per line and inline\n // the hot-path branches for `data:` and `event:` without the CR bookkeeping\n // the slow path needs.\n if (chunk.indexOf('\\r') === -1) {\n let lfIndex = chunk.indexOf('\\n', searchIndex);\n while (lfIndex !== -1) {\n // Blank line: end-of-event marker. Dispatch the accumulated event (if any)\n // and reset the buffered fields. This is hoisted out of `parseLine` because\n // it's the single most common line shape after `data:` lines.\n if (searchIndex === lfIndex) {\n if (id !== undefined) {\n onId === null || onId === void 0 ? void 0 : onId(id);\n }\n if (dataLines > 0) {\n onEvent === null || onEvent === void 0 ? void 0 : onEvent({ id, event: eventType, data });\n }\n id = undefined;\n data = '';\n dataLines = 0;\n eventType = undefined;\n searchIndex = lfIndex + 1;\n lfIndex = chunk.indexOf('\\n', searchIndex);\n continue;\n }\n const firstCharCode = chunk.charCodeAt(searchIndex);\n if (isDataPrefix(chunk, searchIndex, firstCharCode)) {\n // `data:` line — append the value to the event's data buffer.\n // 'data:'.length === 5, 'data: '.length === 6\n const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5;\n const value = chunk.slice(valueStart, lfIndex);\n // Fast path within a fast path: if this is the first data line AND the\n // next char is another LF (i.e. `data:foo\\n\\n`), dispatch immediately\n // without ever writing to the `data` buffer. This is the shape of a\n // typical single-line SSE event (ChatGPT-style streams, etc.) and is\n // hot enough to be worth the duplication.\n if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {\n if (id !== undefined) {\n onId === null || onId === void 0 ? void 0 : onId(id);\n }\n onEvent === null || onEvent === void 0 ? void 0 : onEvent({ id, event: eventType, data: value });\n id = undefined;\n data = '';\n eventType = undefined;\n searchIndex = lfIndex + 2;\n lfIndex = chunk.indexOf('\\n', searchIndex);\n continue;\n }\n // Multi-line data: concatenate with newline separator per spec.\n data = dataLines === 0 ? value : `${data}\\n${value}`;\n dataLines++;\n }\n else if (isEventPrefix(chunk, searchIndex, firstCharCode)) {\n // `event:` line — set the event type for the next dispatch. Per spec,\n // an empty value resets `event type` to its default (undefined here).\n // 'event:'.length === 6, 'event: '.length === 7\n eventType =\n chunk.slice(chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6, lfIndex) || undefined;\n }\n else {\n // Everything else: `id:`, `retry:`, comment lines (`:` prefix), unknown\n // fields, or malformed lines. These are rarer and go through the full\n // per-line parser, which handles the SSE field grammar in detail.\n parseLine(chunk, searchIndex, lfIndex);\n }\n if (checkForBufferOverflow())\n return '';\n searchIndex = lfIndex + 1;\n lfIndex = chunk.indexOf('\\n', searchIndex);\n }\n return chunk.slice(searchIndex);\n }\n // Slow path: the chunk contains at least one `\\r`, so lines may be terminated\n // by `\\r`, `\\n`, or `\\r\\n`. We locate the next terminator by looking at both\n // the nearest `\\r` and `\\n` and picking whichever comes first.\n let crIndex = chunk.indexOf('\\r', searchIndex);\n let lfIndex = chunk.indexOf('\\n', searchIndex);\n while (searchIndex < chunk.length) {\n let lineEnd = -1;\n if (crIndex !== -1 && lfIndex !== -1) {\n lineEnd = crIndex < lfIndex ? crIndex : lfIndex;\n }\n else if (crIndex !== -1) {\n // A trailing `\\r` at the very end of the chunk is ambiguous: it could be\n // a bare-CR terminator, or the first half of a `\\r\\n` whose `\\n` arrives\n // in the next chunk. Defer until we see more input.\n if (crIndex === chunk.length - 1) {\n lineEnd = -1;\n }\n else {\n lineEnd = crIndex;\n }\n }\n else if (lfIndex !== -1) {\n lineEnd = lfIndex;\n }\n if (lineEnd === -1) {\n break;\n }\n parseLine(chunk, searchIndex, lineEnd);\n if (checkForBufferOverflow())\n return '';\n searchIndex = lineEnd + 1;\n // If we just consumed a `\\r` and the next char is `\\n`, skip it so the\n // pair is treated as a single terminator rather than an empty line.\n if (chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF) {\n searchIndex++;\n }\n // Reuse unconsumed matches and failed searches instead of rescanning the suffix.\n if (crIndex !== -1 && crIndex < searchIndex) {\n crIndex = chunk.indexOf('\\r', searchIndex);\n }\n if (lfIndex !== -1 && lfIndex < searchIndex) {\n lfIndex = chunk.indexOf('\\n', searchIndex);\n }\n }\n return chunk.slice(searchIndex);\n }\n function parseLine(chunk, start, end) {\n if (start === end) {\n dispatchEvent();\n return;\n }\n const firstCharCode = chunk.charCodeAt(start);\n if (isDataPrefix(chunk, start, firstCharCode)) {\n // 'data:'.length === 5, 'data: '.length === 6\n const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5;\n const value = chunk.slice(valueStart, end);\n data = dataLines === 0 ? value : `${data}\\n${value}`;\n dataLines++;\n return;\n }\n if (isEventPrefix(chunk, start, firstCharCode)) {\n // 'event:'.length === 6, 'event: '.length === 7\n eventType =\n chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || undefined;\n return;\n }\n // Fast path for \"id:\" — 'i' = 105, 'd' = 100, ':' = 58\n if (firstCharCode === 105 &&\n chunk.charCodeAt(start + 1) === 100 &&\n chunk.charCodeAt(start + 2) === 58) {\n // 'id:'.length === 3, 'id: '.length === 4\n const value = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);\n // If the field value does not contain U+0000 NULL, then set the `ID` buffer to\n // the field value. Otherwise, ignore the field.\n if (!value.includes('\\0'))\n id = value;\n return;\n }\n // Comment line — ':' = 58\n if (firstCharCode === 58) {\n if (onComment) {\n const line = chunk.slice(start, end);\n // skip ':' (+1), or ': ' (+2) when a space follows\n onComment(line.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1));\n }\n return;\n }\n const line = chunk.slice(start, end);\n const fieldSeparatorIndex = line.indexOf(':');\n if (fieldSeparatorIndex === -1) {\n processField(line, '', line);\n return;\n }\n const field = line.slice(0, fieldSeparatorIndex);\n // skip ':' (+1), or ': ' (+2) when a space follows\n const offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1;\n const value = line.slice(fieldSeparatorIndex + offset);\n processField(field, value, line);\n }\n function processField(field, value, line) {\n // Field names must be compared literally, with no case folding performed.\n switch (field) {\n case 'event':\n // Set the `event type` buffer to field value\n eventType = value || undefined;\n break;\n case 'data':\n data = dataLines === 0 ? value : `${data}\\n${value}`;\n dataLines++;\n break;\n case 'id':\n // If the field value does not contain U+0000 NULL, then set the `ID` buffer to\n // the field value. Otherwise, ignore the field.\n if (!value.includes('\\0'))\n id = value;\n break;\n case 'retry':\n // If the field value consists of only ASCII digits, then interpret the field value as an\n // integer in base ten, and set the event stream's reconnection time to that integer.\n // Otherwise, ignore the field.\n if (/^\\d+$/.test(value)) {\n onRetry === null || onRetry === void 0 ? void 0 : onRetry(parseInt(value, 10));\n }\n else {\n onError === null || onError === void 0 ? void 0 : onError(new ParseError(`Invalid \\`retry\\` value: \"${value}\"`, {\n type: 'invalid-retry',\n value,\n line,\n }));\n }\n break;\n default:\n // Otherwise, the field is ignored.\n onError === null || onError === void 0 ? void 0 : onError(new ParseError(`Unknown field \"${field.length > 20 ? `${field.slice(0, 20)}…` : field}\"`, { type: 'unknown-field', field, value, line }));\n break;\n }\n }\n function dispatchEvent() {\n if (id !== undefined) {\n onId === null || onId === void 0 ? void 0 : onId(id);\n }\n if (dataLines > 0) {\n onEvent === null || onEvent === void 0 ? void 0 : onEvent({\n id,\n event: eventType,\n data,\n });\n }\n id = undefined;\n data = '';\n dataLines = 0;\n eventType = undefined;\n }\n function reset(options = {}) {\n if (options.consume && pendingFragments.length > 0) {\n const incompleteLine = pendingFragments.join('');\n parseLine(incompleteLine, 0, incompleteLine.length);\n }\n bomPrefix = '';\n id = undefined;\n data = '';\n dataLines = 0;\n eventType = undefined;\n pendingFragments.length = 0;\n pendingFragmentsLength = 0;\n terminated = false;\n skippingLine = false;\n skipNextLineFeed = false;\n }\n return { feed, reset };\n}\n/**\n * Checks if `chunk` starts with the literal `data:` at index `i`.\n *\n * Equivalent to `chunk.startsWith('data:', i)`, but benchmarks show this\n * hand-unrolled char-code comparison is ~20% faster on common event types.\n * The caller passes `firstCharCode` (the code at `i`) so it can be reused\n * across prefix checks.\n *\n * ASCII: 'd' = 100, 'a' = 97, 't' = 116, 'a' = 97, ':' = 58\n */\nfunction isDataPrefix(chunk, i, firstCharCode) {\n return (firstCharCode === 100 &&\n chunk.charCodeAt(i + 1) === 97 &&\n chunk.charCodeAt(i + 2) === 116 &&\n chunk.charCodeAt(i + 3) === 97 &&\n chunk.charCodeAt(i + 4) === 58);\n}\n/**\n * Checks if `chunk` starts with the literal `event:` at index `i`.\n *\n * See {@link isDataPrefix} for why this is hand-unrolled rather than using\n * `String.prototype.startsWith`.\n *\n * ASCII: 'e' = 101, 'v' = 118, 'e' = 101, 'n' = 110, 't' = 116, ':' = 58\n */\nfunction isEventPrefix(chunk, i, firstCharCode) {\n return (firstCharCode === 101 &&\n chunk.charCodeAt(i + 1) === 118 &&\n chunk.charCodeAt(i + 2) === 101 &&\n chunk.charCodeAt(i + 3) === 110 &&\n chunk.charCodeAt(i + 4) === 116 &&\n chunk.charCodeAt(i + 5) === 58);\n}\nfunction isPotentialField(line, field) {\n let i = 1;\n while (i < line.length && i < field.length) {\n if (line.charCodeAt(i) !== field.charCodeAt(i)) {\n return false;\n }\n i++;\n }\n return line.length <= field.length || line.charCodeAt(field.length) === 58;\n}\n//# sourceMappingURL=parse.js.map","//#region packages/fast-memoize/index.ts\nfunction memoize(fn, options) {\n\tconst cache = options && options.cache ? options.cache : cacheDefault;\n\tconst serializer = options && options.serializer ? options.serializer : serializerDefault;\n\treturn (options && options.strategy ? options.strategy : strategyDefault)(fn, {\n\t\tcache,\n\t\tserializer\n\t});\n}\nfunction isPrimitive(value) {\n\treturn value == null || typeof value === \"number\" || typeof value === \"boolean\";\n}\nfunction monadic(fn, cache, serializer, arg) {\n\tconst cacheKey = isPrimitive(arg) ? arg : serializer(arg);\n\tlet computedValue = cache.get(cacheKey);\n\tif (typeof computedValue === \"undefined\") {\n\t\tcomputedValue = fn.call(this, arg);\n\t\tcache.set(cacheKey, computedValue);\n\t}\n\treturn computedValue;\n}\nfunction variadic(fn, cache, serializer) {\n\tconst args = Array.prototype.slice.call(arguments, 3);\n\tconst cacheKey = serializer(args);\n\tlet computedValue = cache.get(cacheKey);\n\tif (typeof computedValue === \"undefined\") {\n\t\tcomputedValue = fn.apply(this, args);\n\t\tcache.set(cacheKey, computedValue);\n\t}\n\treturn computedValue;\n}\nfunction assemble(fn, context, strategy, cache, serialize) {\n\treturn strategy.bind(context, fn, cache, serialize);\n}\nfunction strategyDefault(fn, options) {\n\tconst strategy = fn.length === 1 ? monadic : variadic;\n\treturn assemble(fn, this, strategy, options.cache.create(), options.serializer);\n}\nfunction strategyVariadic(fn, options) {\n\treturn assemble(fn, this, variadic, options.cache.create(), options.serializer);\n}\nfunction strategyMonadic(fn, options) {\n\treturn assemble(fn, this, monadic, options.cache.create(), options.serializer);\n}\nconst serializerDefault = function() {\n\treturn JSON.stringify(arguments);\n};\nvar ObjectWithoutPrototypeCache = class {\n\tconstructor() {\n\t\tthis.cache = Object.create(null);\n\t}\n\tget(key) {\n\t\treturn this.cache[key];\n\t}\n\tset(key, value) {\n\t\tthis.cache[key] = value;\n\t}\n};\nconst cacheDefault = { create: function create() {\n\treturn new ObjectWithoutPrototypeCache();\n} };\nconst strategies = {\n\tvariadic: strategyVariadic,\n\tmonadic: strategyMonadic\n};\n//#endregion\nexport { memoize, strategies };\n\n//# sourceMappingURL=index.js.map","//#region packages/icu-skeleton-parser/date-time.ts\n/**\n* https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n* Credit: https://github.com/caridy/intl-datetimeformat-pattern/blob/master/index.js\n* with some tweaks\n*/\nconst DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;\n/**\n* Parse Date time skeleton into Intl.DateTimeFormatOptions\n* Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n* @public\n* @param skeleton skeleton string\n*/\nfunction parseDateTimeSkeleton(skeleton) {\n\tconst result = {};\n\tskeleton.replace(DATE_TIME_REGEX, (match) => {\n\t\tconst len = match.length;\n\t\tswitch (match[0]) {\n\t\t\tcase \"G\":\n\t\t\t\tresult.era = len === 4 ? \"long\" : len === 5 ? \"narrow\" : \"short\";\n\t\t\t\tbreak;\n\t\t\tcase \"y\":\n\t\t\t\tresult.year = len === 2 ? \"2-digit\" : \"numeric\";\n\t\t\t\tbreak;\n\t\t\tcase \"Y\":\n\t\t\tcase \"u\":\n\t\t\tcase \"U\":\n\t\t\tcase \"r\": throw new RangeError(\"`Y/u/U/r` (year) patterns are not supported, use `y` instead\");\n\t\t\tcase \"q\":\n\t\t\tcase \"Q\": throw new RangeError(\"`q/Q` (quarter) patterns are not supported\");\n\t\t\tcase \"M\":\n\t\t\tcase \"L\":\n\t\t\t\tresult.month = [\n\t\t\t\t\t\"numeric\",\n\t\t\t\t\t\"2-digit\",\n\t\t\t\t\t\"short\",\n\t\t\t\t\t\"long\",\n\t\t\t\t\t\"narrow\"\n\t\t\t\t][len - 1];\n\t\t\t\tbreak;\n\t\t\tcase \"w\":\n\t\t\tcase \"W\": throw new RangeError(\"`w/W` (week) patterns are not supported\");\n\t\t\tcase \"d\":\n\t\t\t\tresult.day = [\"numeric\", \"2-digit\"][len - 1];\n\t\t\t\tbreak;\n\t\t\tcase \"D\":\n\t\t\tcase \"F\":\n\t\t\tcase \"g\": throw new RangeError(\"`D/F/g` (day) patterns are not supported, use `d` instead\");\n\t\t\tcase \"E\":\n\t\t\t\tresult.weekday = len === 4 ? \"long\" : len === 5 ? \"narrow\" : \"short\";\n\t\t\t\tbreak;\n\t\t\tcase \"e\":\n\t\t\t\tif (len < 4) throw new RangeError(\"`e..eee` (weekday) patterns are not supported\");\n\t\t\t\tresult.weekday = [\n\t\t\t\t\t\"short\",\n\t\t\t\t\t\"long\",\n\t\t\t\t\t\"narrow\",\n\t\t\t\t\t\"short\"\n\t\t\t\t][len - 3];\n\t\t\t\tbreak;\n\t\t\tcase \"c\":\n\t\t\t\tif (len < 4) throw new RangeError(\"`c..ccc` (weekday) patterns are not supported\");\n\t\t\t\tresult.weekday = [\n\t\t\t\t\t\"short\",\n\t\t\t\t\t\"long\",\n\t\t\t\t\t\"narrow\",\n\t\t\t\t\t\"short\"\n\t\t\t\t][len - 3];\n\t\t\t\tbreak;\n\t\t\tcase \"a\":\n\t\t\t\tresult.hour12 = true;\n\t\t\t\tbreak;\n\t\t\tcase \"b\":\n\t\t\tcase \"B\": throw new RangeError(\"`b/B` (period) patterns are not supported, use `a` instead\");\n\t\t\tcase \"h\":\n\t\t\t\tresult.hourCycle = \"h12\";\n\t\t\t\tresult.hour = [\"numeric\", \"2-digit\"][len - 1];\n\t\t\t\tbreak;\n\t\t\tcase \"H\":\n\t\t\t\tresult.hourCycle = \"h23\";\n\t\t\t\tresult.hour = [\"numeric\", \"2-digit\"][len - 1];\n\t\t\t\tbreak;\n\t\t\tcase \"K\":\n\t\t\t\tresult.hourCycle = \"h11\";\n\t\t\t\tresult.hour = [\"numeric\", \"2-digit\"][len - 1];\n\t\t\t\tbreak;\n\t\t\tcase \"k\":\n\t\t\t\tresult.hourCycle = \"h24\";\n\t\t\t\tresult.hour = [\"numeric\", \"2-digit\"][len - 1];\n\t\t\t\tbreak;\n\t\t\tcase \"j\":\n\t\t\tcase \"J\":\n\t\t\tcase \"C\": throw new RangeError(\"`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead\");\n\t\t\tcase \"m\":\n\t\t\t\tresult.minute = [\"numeric\", \"2-digit\"][len - 1];\n\t\t\t\tbreak;\n\t\t\tcase \"s\":\n\t\t\t\tresult.second = [\"numeric\", \"2-digit\"][len - 1];\n\t\t\t\tbreak;\n\t\t\tcase \"S\":\n\t\t\tcase \"A\": throw new RangeError(\"`S/A` (second) patterns are not supported, use `s` instead\");\n\t\t\tcase \"z\":\n\t\t\t\tresult.timeZoneName = len < 4 ? \"short\" : \"long\";\n\t\t\t\tbreak;\n\t\t\tcase \"Z\":\n\t\t\tcase \"O\":\n\t\t\tcase \"v\":\n\t\t\tcase \"V\":\n\t\t\tcase \"X\":\n\t\t\tcase \"x\": throw new RangeError(\"`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead\");\n\t\t}\n\t\treturn \"\";\n\t});\n\treturn result;\n}\n//#endregion\n//#region node_modules/.aspect_rules_js/@formatjs_generated+unicode@0.0.0/node_modules/@formatjs_generated/unicode/icu-skeleton-parser-regex.js\nconst WHITE_SPACE_REGEX = /[\\t-\\r \\x85\\u200E\\u200F\\u2028\\u2029]/i;\n//#endregion\n//#region packages/icu-skeleton-parser/number.ts\nfunction parseNumberSkeletonFromString(skeleton) {\n\tif (skeleton.length === 0) throw new Error(\"Number skeleton cannot be empty\");\n\tconst stringTokens = skeleton.split(WHITE_SPACE_REGEX).filter((x) => x.length > 0);\n\tconst tokens = [];\n\tfor (const stringToken of stringTokens) {\n\t\tlet stemAndOptions = stringToken.split(\"/\");\n\t\tif (stemAndOptions.length === 0) throw new Error(\"Invalid number skeleton\");\n\t\tconst [stem, ...options] = stemAndOptions;\n\t\tfor (const option of options) if (option.length === 0) throw new Error(\"Invalid number skeleton\");\n\t\ttokens.push({\n\t\t\tstem,\n\t\t\toptions\n\t\t});\n\t}\n\treturn tokens;\n}\nfunction icuUnitToEcma(unit) {\n\treturn unit.replace(/^(.*?)-/, \"\");\n}\nconst FRACTION_PRECISION_REGEX = /^\\.(?:(0+)(\\*)?|(#+)|(0+)(#+))$/g;\nconst SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\\+|#+)?[rs]?$/g;\nconst INTEGER_WIDTH_REGEX = /(\\*)(0+)|(#+)(0+)|(0+)/g;\nconst CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;\nfunction parseSignificantPrecision(str) {\n\tconst result = {};\n\tif (str[str.length - 1] === \"r\") result.roundingPriority = \"morePrecision\";\n\telse if (str[str.length - 1] === \"s\") result.roundingPriority = \"lessPrecision\";\n\tstr.replace(SIGNIFICANT_PRECISION_REGEX, function(_, g1, g2) {\n\t\tif (typeof g2 !== \"string\") {\n\t\t\tresult.minimumSignificantDigits = g1.length;\n\t\t\tresult.maximumSignificantDigits = g1.length;\n\t\t} else if (g2 === \"+\") result.minimumSignificantDigits = g1.length;\n\t\telse if (g1[0] === \"#\") result.maximumSignificantDigits = g1.length;\n\t\telse {\n\t\t\tresult.minimumSignificantDigits = g1.length;\n\t\t\tresult.maximumSignificantDigits = g1.length + (typeof g2 === \"string\" ? g2.length : 0);\n\t\t}\n\t\treturn \"\";\n\t});\n\treturn result;\n}\nfunction parseSign(str) {\n\tswitch (str) {\n\t\tcase \"sign-auto\": return { signDisplay: \"auto\" };\n\t\tcase \"sign-accounting\":\n\t\tcase \"()\": return { currencySign: \"accounting\" };\n\t\tcase \"sign-always\":\n\t\tcase \"+!\": return { signDisplay: \"always\" };\n\t\tcase \"sign-accounting-always\":\n\t\tcase \"()!\": return {\n\t\t\tsignDisplay: \"always\",\n\t\t\tcurrencySign: \"accounting\"\n\t\t};\n\t\tcase \"sign-except-zero\":\n\t\tcase \"+?\": return { signDisplay: \"exceptZero\" };\n\t\tcase \"sign-accounting-except-zero\":\n\t\tcase \"()?\": return {\n\t\t\tsignDisplay: \"exceptZero\",\n\t\t\tcurrencySign: \"accounting\"\n\t\t};\n\t\tcase \"sign-never\":\n\t\tcase \"+_\": return { signDisplay: \"never\" };\n\t}\n}\nfunction parseConciseScientificAndEngineeringStem(stem) {\n\tlet result;\n\tif (stem[0] === \"E\" && stem[1] === \"E\") {\n\t\tresult = { notation: \"engineering\" };\n\t\tstem = stem.slice(2);\n\t} else if (stem[0] === \"E\") {\n\t\tresult = { notation: \"scientific\" };\n\t\tstem = stem.slice(1);\n\t}\n\tif (result) {\n\t\tconst signDisplay = stem.slice(0, 2);\n\t\tif (signDisplay === \"+!\") {\n\t\t\tresult.signDisplay = \"always\";\n\t\t\tstem = stem.slice(2);\n\t\t} else if (signDisplay === \"+?\") {\n\t\t\tresult.signDisplay = \"exceptZero\";\n\t\t\tstem = stem.slice(2);\n\t\t}\n\t\tif (!CONCISE_INTEGER_WIDTH_REGEX.test(stem)) throw new Error(\"Malformed concise eng/scientific notation\");\n\t\tresult.minimumIntegerDigits = stem.length;\n\t}\n\treturn result;\n}\nfunction parseNotationOptions(opt) {\n\tconst result = {};\n\tconst signOpts = parseSign(opt);\n\tif (signOpts) return signOpts;\n\treturn result;\n}\n/**\n* https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md#skeleton-stems-and-options\n*/\nfunction parseNumberSkeleton(tokens) {\n\tlet result = {};\n\tfor (const token of tokens) {\n\t\tswitch (token.stem) {\n\t\t\tcase \"percent\":\n\t\t\tcase \"%\":\n\t\t\t\tresult.style = \"percent\";\n\t\t\t\tcontinue;\n\t\t\tcase \"%x100\":\n\t\t\t\tresult.style = \"percent\";\n\t\t\t\tresult.scale = 100;\n\t\t\t\tcontinue;\n\t\t\tcase \"currency\":\n\t\t\t\tresult.style = \"currency\";\n\t\t\t\tresult.currency = token.options[0];\n\t\t\t\tcontinue;\n\t\t\tcase \"group-off\":\n\t\t\tcase \",_\":\n\t\t\t\tresult.useGrouping = false;\n\t\t\t\tcontinue;\n\t\t\tcase \"precision-integer\":\n\t\t\tcase \".\":\n\t\t\t\tresult.maximumFractionDigits = 0;\n\t\t\t\tcontinue;\n\t\t\tcase \"measure-unit\":\n\t\t\tcase \"unit\":\n\t\t\t\tresult.style = \"unit\";\n\t\t\t\tresult.unit = icuUnitToEcma(token.options[0]);\n\t\t\t\tcontinue;\n\t\t\tcase \"compact-short\":\n\t\t\tcase \"K\":\n\t\t\t\tresult.notation = \"compact\";\n\t\t\t\tresult.compactDisplay = \"short\";\n\t\t\t\tcontinue;\n\t\t\tcase \"compact-long\":\n\t\t\tcase \"KK\":\n\t\t\t\tresult.notation = \"compact\";\n\t\t\t\tresult.compactDisplay = \"long\";\n\t\t\t\tcontinue;\n\t\t\tcase \"scientific\":\n\t\t\t\tresult = {\n\t\t\t\t\t...result,\n\t\t\t\t\tnotation: \"scientific\",\n\t\t\t\t\t...token.options.reduce((all, opt) => ({\n\t\t\t\t\t\t...all,\n\t\t\t\t\t\t...parseNotationOptions(opt)\n\t\t\t\t\t}), {})\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\tcase \"engineering\":\n\t\t\t\tresult = {\n\t\t\t\t\t...result,\n\t\t\t\t\tnotation: \"engineering\",\n\t\t\t\t\t...token.options.reduce((all, opt) => ({\n\t\t\t\t\t\t...all,\n\t\t\t\t\t\t...parseNotationOptions(opt)\n\t\t\t\t\t}), {})\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\tcase \"notation-simple\":\n\t\t\t\tresult.notation = \"standard\";\n\t\t\t\tcontinue;\n\t\t\tcase \"unit-width-narrow\":\n\t\t\t\tresult.currencyDisplay = \"narrowSymbol\";\n\t\t\t\tresult.unitDisplay = \"narrow\";\n\t\t\t\tcontinue;\n\t\t\tcase \"unit-width-short\":\n\t\t\t\tresult.currencyDisplay = \"code\";\n\t\t\t\tresult.unitDisplay = \"short\";\n\t\t\t\tcontinue;\n\t\t\tcase \"unit-width-full-name\":\n\t\t\t\tresult.currencyDisplay = \"name\";\n\t\t\t\tresult.unitDisplay = \"long\";\n\t\t\t\tcontinue;\n\t\t\tcase \"unit-width-iso-code\":\n\t\t\t\tresult.currencyDisplay = \"symbol\";\n\t\t\t\tcontinue;\n\t\t\tcase \"scale\":\n\t\t\t\tresult.scale = parseFloat(token.options[0]);\n\t\t\t\tcontinue;\n\t\t\tcase \"rounding-mode-floor\":\n\t\t\t\tresult.roundingMode = \"floor\";\n\t\t\t\tcontinue;\n\t\t\tcase \"rounding-mode-ceiling\":\n\t\t\t\tresult.roundingMode = \"ceil\";\n\t\t\t\tcontinue;\n\t\t\tcase \"rounding-mode-down\":\n\t\t\t\tresult.roundingMode = \"trunc\";\n\t\t\t\tcontinue;\n\t\t\tcase \"rounding-mode-up\":\n\t\t\t\tresult.roundingMode = \"expand\";\n\t\t\t\tcontinue;\n\t\t\tcase \"rounding-mode-half-even\":\n\t\t\t\tresult.roundingMode = \"halfEven\";\n\t\t\t\tcontinue;\n\t\t\tcase \"rounding-mode-half-down\":\n\t\t\t\tresult.roundingMode = \"halfTrunc\";\n\t\t\t\tcontinue;\n\t\t\tcase \"rounding-mode-half-up\":\n\t\t\t\tresult.roundingMode = \"halfExpand\";\n\t\t\t\tcontinue;\n\t\t\tcase \"integer-width\":\n\t\t\t\tif (token.options.length > 1) throw new RangeError(\"integer-width stems only accept a single optional option\");\n\t\t\t\ttoken.options[0].replace(INTEGER_WIDTH_REGEX, function(_, g1, g2, g3, g4, g5) {\n\t\t\t\t\tif (g1) result.minimumIntegerDigits = g2.length;\n\t\t\t\t\telse if (g3 && g4) throw new Error(\"We currently do not support maximum integer digits\");\n\t\t\t\t\telse if (g5) throw new Error(\"We currently do not support exact integer digits\");\n\t\t\t\t\treturn \"\";\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t}\n\t\tif (CONCISE_INTEGER_WIDTH_REGEX.test(token.stem)) {\n\t\t\tresult.minimumIntegerDigits = token.stem.length;\n\t\t\tcontinue;\n\t\t}\n\t\tif (FRACTION_PRECISION_REGEX.test(token.stem)) {\n\t\t\tif (token.options.length > 1) throw new RangeError(\"Fraction-precision stems only accept a single optional option\");\n\t\t\ttoken.stem.replace(FRACTION_PRECISION_REGEX, function(_, g1, g2, g3, g4, g5) {\n\t\t\t\tif (g2 === \"*\") result.minimumFractionDigits = g1.length;\n\t\t\t\telse if (g3 && g3[0] === \"#\") result.maximumFractionDigits = g3.length;\n\t\t\t\telse if (g4 && g5) {\n\t\t\t\t\tresult.minimumFractionDigits = g4.length;\n\t\t\t\t\tresult.maximumFractionDigits = g4.length + g5.length;\n\t\t\t\t} else {\n\t\t\t\t\tresult.minimumFractionDigits = g1.length;\n\t\t\t\t\tresult.maximumFractionDigits = g1.length;\n\t\t\t\t}\n\t\t\t\treturn \"\";\n\t\t\t});\n\t\t\tconst opt = token.options[0];\n\t\t\tif (opt === \"w\") result = {\n\t\t\t\t...result,\n\t\t\t\ttrailingZeroDisplay: \"stripIfInteger\"\n\t\t\t};\n\t\t\telse if (opt) result = {\n\t\t\t\t...result,\n\t\t\t\t...parseSignificantPrecision(opt)\n\t\t\t};\n\t\t\tcontinue;\n\t\t}\n\t\tif (SIGNIFICANT_PRECISION_REGEX.test(token.stem)) {\n\t\t\tresult = {\n\t\t\t\t...result,\n\t\t\t\t...parseSignificantPrecision(token.stem)\n\t\t\t};\n\t\t\tcontinue;\n\t\t}\n\t\tconst signOpts = parseSign(token.stem);\n\t\tif (signOpts) result = {\n\t\t\t...result,\n\t\t\t...signOpts\n\t\t};\n\t\tconst conciseScientificAndEngineeringOpts = parseConciseScientificAndEngineeringStem(token.stem);\n\t\tif (conciseScientificAndEngineeringOpts) result = {\n\t\t\t...result,\n\t\t\t...conciseScientificAndEngineeringOpts\n\t\t};\n\t}\n\treturn result;\n}\n//#endregion\nexport { parseDateTimeSkeleton, parseNumberSkeleton, parseNumberSkeletonFromString };\n\n//# sourceMappingURL=index.js.map","import { parseDateTimeSkeleton, parseNumberSkeleton, parseNumberSkeletonFromString } from \"@formatjs/icu-skeleton-parser\";\n//#region packages/icu-messageformat-parser/error.ts\nlet ErrorKind = /* @__PURE__ */ function(ErrorKind) {\n\t/** Argument is unclosed (e.g. `{0`) */\n\tErrorKind[ErrorKind[\"EXPECT_ARGUMENT_CLOSING_BRACE\"] = 1] = \"EXPECT_ARGUMENT_CLOSING_BRACE\";\n\t/** Argument is empty (e.g. `{}`). */\n\tErrorKind[ErrorKind[\"EMPTY_ARGUMENT\"] = 2] = \"EMPTY_ARGUMENT\";\n\t/** Argument is malformed (e.g. `{foo!}``) */\n\tErrorKind[ErrorKind[\"MALFORMED_ARGUMENT\"] = 3] = \"MALFORMED_ARGUMENT\";\n\t/** Expect an argument type (e.g. `{foo,}`) */\n\tErrorKind[ErrorKind[\"EXPECT_ARGUMENT_TYPE\"] = 4] = \"EXPECT_ARGUMENT_TYPE\";\n\t/** Unsupported argument type (e.g. `{foo,foo}`) */\n\tErrorKind[ErrorKind[\"INVALID_ARGUMENT_TYPE\"] = 5] = \"INVALID_ARGUMENT_TYPE\";\n\t/** Expect an argument style (e.g. `{foo, number, }`) */\n\tErrorKind[ErrorKind[\"EXPECT_ARGUMENT_STYLE\"] = 6] = \"EXPECT_ARGUMENT_STYLE\";\n\t/** The number skeleton is invalid. */\n\tErrorKind[ErrorKind[\"INVALID_NUMBER_SKELETON\"] = 7] = \"INVALID_NUMBER_SKELETON\";\n\t/** The date time skeleton is invalid. */\n\tErrorKind[ErrorKind[\"INVALID_DATE_TIME_SKELETON\"] = 8] = \"INVALID_DATE_TIME_SKELETON\";\n\t/** Exepct a number skeleton following the `::` (e.g. `{foo, number, ::}`) */\n\tErrorKind[ErrorKind[\"EXPECT_NUMBER_SKELETON\"] = 9] = \"EXPECT_NUMBER_SKELETON\";\n\t/** Exepct a date time skeleton following the `::` (e.g. `{foo, date, ::}`) */\n\tErrorKind[ErrorKind[\"EXPECT_DATE_TIME_SKELETON\"] = 10] = \"EXPECT_DATE_TIME_SKELETON\";\n\t/** Unmatched apostrophes in the argument style (e.g. `{foo, number, 'test`) */\n\tErrorKind[ErrorKind[\"UNCLOSED_QUOTE_IN_ARGUMENT_STYLE\"] = 11] = \"UNCLOSED_QUOTE_IN_ARGUMENT_STYLE\";\n\t/** Missing select argument options (e.g. `{foo, select}`) */\n\tErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_OPTIONS\"] = 12] = \"EXPECT_SELECT_ARGUMENT_OPTIONS\";\n\t/** Expecting an offset value in `plural` or `selectordinal` argument (e.g `{foo, plural, offset}`) */\n\tErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE\"] = 13] = \"EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE\";\n\t/** Offset value in `plural` or `selectordinal` is invalid (e.g. `{foo, plural, offset: x}`) */\n\tErrorKind[ErrorKind[\"INVALID_PLURAL_ARGUMENT_OFFSET_VALUE\"] = 14] = \"INVALID_PLURAL_ARGUMENT_OFFSET_VALUE\";\n\t/** Expecting a selector in `select` argument (e.g `{foo, select}`) */\n\tErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_SELECTOR\"] = 15] = \"EXPECT_SELECT_ARGUMENT_SELECTOR\";\n\t/** Expecting a selector in `plural` or `selectordinal` argument (e.g `{foo, plural}`) */\n\tErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_SELECTOR\"] = 16] = \"EXPECT_PLURAL_ARGUMENT_SELECTOR\";\n\t/** Expecting a message fragment after the `select` selector (e.g. `{foo, select, apple}`) */\n\tErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\"] = 17] = \"EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\";\n\t/**\n\t* Expecting a message fragment after the `plural` or `selectordinal` selector\n\t* (e.g. `{foo, plural, one}`)\n\t*/\n\tErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT\"] = 18] = \"EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT\";\n\t/** Selector in `plural` or `selectordinal` is malformed (e.g. `{foo, plural, =x {#}}`) */\n\tErrorKind[ErrorKind[\"INVALID_PLURAL_ARGUMENT_SELECTOR\"] = 19] = \"INVALID_PLURAL_ARGUMENT_SELECTOR\";\n\t/**\n\t* Duplicate selectors in `plural` or `selectordinal` argument.\n\t* (e.g. {foo, plural, one {#} one {#}})\n\t*/\n\tErrorKind[ErrorKind[\"DUPLICATE_PLURAL_ARGUMENT_SELECTOR\"] = 20] = \"DUPLICATE_PLURAL_ARGUMENT_SELECTOR\";\n\t/** Duplicate selectors in `select` argument.\n\t* (e.g. {foo, select, apple {apple} apple {apple}})\n\t*/\n\tErrorKind[ErrorKind[\"DUPLICATE_SELECT_ARGUMENT_SELECTOR\"] = 21] = \"DUPLICATE_SELECT_ARGUMENT_SELECTOR\";\n\t/** Plural or select argument option must have `other` clause. */\n\tErrorKind[ErrorKind[\"MISSING_OTHER_CLAUSE\"] = 22] = \"MISSING_OTHER_CLAUSE\";\n\t/** The tag is malformed. (e.g. `<bold!>foo</bold!>) */\n\tErrorKind[ErrorKind[\"INVALID_TAG\"] = 23] = \"INVALID_TAG\";\n\t/** The tag name is invalid. (e.g. `<123>foo</123>`) */\n\tErrorKind[ErrorKind[\"INVALID_TAG_NAME\"] = 25] = \"INVALID_TAG_NAME\";\n\t/** The closing tag does not match the opening tag. (e.g. `<bold>foo</italic>`) */\n\tErrorKind[ErrorKind[\"UNMATCHED_CLOSING_TAG\"] = 26] = \"UNMATCHED_CLOSING_TAG\";\n\t/** The opening tag has unmatched closing tag. (e.g. `<bold>foo`) */\n\tErrorKind[ErrorKind[\"UNCLOSED_TAG\"] = 27] = \"UNCLOSED_TAG\";\n\treturn ErrorKind;\n}({});\n//#endregion\n//#region packages/icu-messageformat-parser/types.ts\nlet TYPE = /* @__PURE__ */ function(TYPE) {\n\t/**\n\t* Raw text\n\t*/\n\tTYPE[TYPE[\"literal\"] = 0] = \"literal\";\n\t/**\n\t* Variable w/o any format, e.g `var` in `this is a {var}`\n\t*/\n\tTYPE[TYPE[\"argument\"] = 1] = \"argument\";\n\t/**\n\t* Variable w/ number format\n\t*/\n\tTYPE[TYPE[\"number\"] = 2] = \"number\";\n\t/**\n\t* Variable w/ date format\n\t*/\n\tTYPE[TYPE[\"date\"] = 3] = \"date\";\n\t/**\n\t* Variable w/ time format\n\t*/\n\tTYPE[TYPE[\"time\"] = 4] = \"time\";\n\t/**\n\t* Variable w/ select format\n\t*/\n\tTYPE[TYPE[\"select\"] = 5] = \"select\";\n\t/**\n\t* Variable w/ plural format\n\t*/\n\tTYPE[TYPE[\"plural\"] = 6] = \"plural\";\n\t/**\n\t* Only possible within plural argument.\n\t* This is the `#` symbol that will be substituted with the count.\n\t*/\n\tTYPE[TYPE[\"pound\"] = 7] = \"pound\";\n\t/**\n\t* XML-like tag\n\t*/\n\tTYPE[TYPE[\"tag\"] = 8] = \"tag\";\n\treturn TYPE;\n}({});\nlet SKELETON_TYPE = /* @__PURE__ */ function(SKELETON_TYPE) {\n\tSKELETON_TYPE[SKELETON_TYPE[\"number\"] = 0] = \"number\";\n\tSKELETON_TYPE[SKELETON_TYPE[\"dateTime\"] = 1] = \"dateTime\";\n\treturn SKELETON_TYPE;\n}({});\n/**\n* Type Guards\n*/\nfunction isLiteralElement(el) {\n\treturn el.type === 0;\n}\nfunction isArgumentElement(el) {\n\treturn el.type === 1;\n}\nfunction isNumberElement(el) {\n\treturn el.type === 2;\n}\nfunction isDateElement(el) {\n\treturn el.type === 3;\n}\nfunction isTimeElement(el) {\n\treturn el.type === 4;\n}\nfunction isSelectElement(el) {\n\treturn el.type === 5;\n}\nfunction isPluralElement(el) {\n\treturn el.type === 6;\n}\nfunction isPoundElement(el) {\n\treturn el.type === 7;\n}\nfunction isTagElement(el) {\n\treturn el.type === 8;\n}\nfunction isNumberSkeleton(el) {\n\treturn !!(el && typeof el === \"object\" && el.type === 0);\n}\nfunction isDateTimeSkeleton(el) {\n\treturn !!(el && typeof el === \"object\" && el.type === 1);\n}\nfunction createLiteralElement(value) {\n\treturn {\n\t\ttype: 0,\n\t\tvalue\n\t};\n}\nfunction createNumberElement(value, style) {\n\treturn {\n\t\ttype: 2,\n\t\tvalue,\n\t\tstyle\n\t};\n}\n//#endregion\n//#region node_modules/.aspect_rules_js/@formatjs_generated+unicode@0.0.0/node_modules/@formatjs_generated/unicode/icu-messageformat-parser-regex.js\nconst SPACE_SEPARATOR_REGEX = /[ \\xA0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000]/;\nconst IDENTIFIER_PREFIX_REGEX = /([^\\t-\\r -\\/:-@\\[-\\^`\\{-~\\x85\\xA0-\\xA7\\xA9\\xAB\\xAC\\xAE\\xB0\\xB1\\xB6\\xBB\\xBF\\xD7\\xF7\\u1680\\u2000-\\u200A\\u2010-\\u2029\\u202F-\\u203E\\u2041-\\u2053\\u2055-\\u205F\\u2190-\\u245F\\u2500-\\u2775\\u2794-\\u2BFF\\u2E00-\\u2E7F\\u3000-\\u3003\\u3008-\\u3020\\u3030\\uFD3E\\uFD3F\\uFE45\\uFE46]*)/g;\n//#endregion\n//#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.core@0.0.0/node_modules/@formatjs_generated/cldr.core/time-data.js\nconst timeData = {\n\t\"001\": [\"H\", \"h\"],\n\t\"419\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"AC\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"AD\": [\"H\", \"hB\"],\n\t\"AE\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"AF\": [\n\t\t\"H\",\n\t\t\"hb\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"AG\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"AI\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"AL\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"AM\": [\"H\", \"hB\"],\n\t\"AO\": [\"H\", \"hB\"],\n\t\"AR\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"AS\": [\"h\", \"H\"],\n\t\"AT\": [\"H\", \"hB\"],\n\t\"AU\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"AW\": [\"H\", \"hB\"],\n\t\"AX\": [\"H\"],\n\t\"AZ\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"BA\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"BB\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"BD\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"H\"\n\t],\n\t\"BE\": [\"H\", \"hB\"],\n\t\"BF\": [\"H\", \"hB\"],\n\t\"BG\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"BH\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"BI\": [\"H\", \"h\"],\n\t\"BJ\": [\"H\", \"hB\"],\n\t\"BL\": [\"H\", \"hB\"],\n\t\"BM\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"BN\": [\n\t\t\"hb\",\n\t\t\"hB\",\n\t\t\"h\",\n\t\t\"H\"\n\t],\n\t\"BO\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"BQ\": [\"H\"],\n\t\"BR\": [\"H\", \"hB\"],\n\t\"BS\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"BT\": [\"h\", \"H\"],\n\t\"BW\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"BY\": [\"H\", \"h\"],\n\t\"BZ\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"CA\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"CC\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"CD\": [\"hB\", \"H\"],\n\t\"CF\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"CG\": [\"H\", \"hB\"],\n\t\"CH\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"CI\": [\"H\", \"hB\"],\n\t\"CK\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"CL\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"CM\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"CN\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"h\"\n\t],\n\t\"CO\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"CP\": [\"H\"],\n\t\"CR\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"CU\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"CV\": [\"H\", \"hB\"],\n\t\"CW\": [\"H\", \"hB\"],\n\t\"CX\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"CY\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"CZ\": [\"H\"],\n\t\"DE\": [\"H\", \"hB\"],\n\t\"DG\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"DJ\": [\"h\", \"H\"],\n\t\"DK\": [\"H\"],\n\t\"DM\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"DO\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"DZ\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"EA\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"EC\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"EE\": [\"H\", \"hB\"],\n\t\"EG\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"EH\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"ER\": [\"h\", \"H\"],\n\t\"ES\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\",\n\t\t\"hb\"\n\t],\n\t\"ET\": [\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"h\",\n\t\t\"H\"\n\t],\n\t\"FI\": [\"H\"],\n\t\"FJ\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"FK\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"FM\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"FO\": [\"H\", \"h\"],\n\t\"FR\": [\"H\", \"hB\"],\n\t\"GA\": [\"H\", \"hB\"],\n\t\"GB\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"GD\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"GE\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"GF\": [\"H\", \"hB\"],\n\t\"GG\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"GH\": [\"h\", \"H\"],\n\t\"GI\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"GL\": [\"H\", \"h\"],\n\t\"GM\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"GN\": [\"H\", \"hB\"],\n\t\"GP\": [\"H\", \"hB\"],\n\t\"GQ\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\",\n\t\t\"hb\"\n\t],\n\t\"GR\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"GS\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"GT\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"GU\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"GW\": [\"H\", \"hB\"],\n\t\"GY\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"HK\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"HN\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"HR\": [\"H\", \"hB\"],\n\t\"HU\": [\"H\", \"h\"],\n\t\"IC\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"ID\": [\"H\"],\n\t\"IE\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"IL\": [\"H\", \"hB\"],\n\t\"IM\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"IN\": [\"h\", \"H\"],\n\t\"IO\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"IQ\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"IR\": [\"hB\", \"H\"],\n\t\"IS\": [\"H\"],\n\t\"IT\": [\"H\", \"hB\"],\n\t\"JE\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"JM\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"JO\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"JP\": [\n\t\t\"H\",\n\t\t\"K\",\n\t\t\"h\"\n\t],\n\t\"KE\": [\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"h\"\n\t],\n\t\"KG\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"KH\": [\n\t\t\"hB\",\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hb\"\n\t],\n\t\"KI\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"KM\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"KN\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"KP\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"KR\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"KW\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"KY\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"KZ\": [\"H\", \"hB\"],\n\t\"LA\": [\n\t\t\"H\",\n\t\t\"hb\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"LB\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"LC\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"LI\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"LK\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"LR\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"LS\": [\"h\", \"H\"],\n\t\"LT\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"LU\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"LV\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"h\"\n\t],\n\t\"LY\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"MA\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"MC\": [\"H\", \"hB\"],\n\t\"MD\": [\"H\", \"hB\"],\n\t\"ME\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"MF\": [\"H\", \"hB\"],\n\t\"MG\": [\"H\", \"h\"],\n\t\"MH\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"MK\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"ML\": [\"H\"],\n\t\"MM\": [\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"h\"\n\t],\n\t\"MN\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"MO\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"MP\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"MQ\": [\"H\", \"hB\"],\n\t\"MR\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"MS\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"MT\": [\"H\", \"h\"],\n\t\"MU\": [\"H\", \"h\"],\n\t\"MV\": [\"H\", \"h\"],\n\t\"MW\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"MX\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"MY\": [\n\t\t\"hb\",\n\t\t\"hB\",\n\t\t\"h\",\n\t\t\"H\"\n\t],\n\t\"MZ\": [\"H\", \"hB\"],\n\t\"NA\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"NC\": [\"H\", \"hB\"],\n\t\"NE\": [\"H\"],\n\t\"NF\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"NG\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"NI\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"NL\": [\"H\", \"hB\"],\n\t\"NO\": [\"H\", \"h\"],\n\t\"NP\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"NR\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"NU\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"NZ\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"OM\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"PA\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"PE\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"PF\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"PG\": [\"h\", \"H\"],\n\t\"PH\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"PK\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"H\"\n\t],\n\t\"PL\": [\"H\", \"h\"],\n\t\"PM\": [\"H\", \"hB\"],\n\t\"PN\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"PR\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"PS\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"PT\": [\"H\", \"hB\"],\n\t\"PW\": [\"h\", \"H\"],\n\t\"PY\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"QA\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"RE\": [\"H\", \"hB\"],\n\t\"RO\": [\"H\", \"hB\"],\n\t\"RS\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"RU\": [\"H\"],\n\t\"RW\": [\"H\", \"h\"],\n\t\"SA\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"SB\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"SC\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"SD\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"SE\": [\"H\"],\n\t\"SG\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"SH\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"SI\": [\"H\", \"hB\"],\n\t\"SJ\": [\"H\"],\n\t\"SK\": [\"H\"],\n\t\"SL\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"SM\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"SN\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"SO\": [\"h\", \"H\"],\n\t\"SR\": [\"H\", \"hB\"],\n\t\"SS\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"ST\": [\"H\", \"hB\"],\n\t\"SV\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"SX\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"SY\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"SZ\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"TA\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"TC\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"TD\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"TF\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"TG\": [\"H\", \"hB\"],\n\t\"TH\": [\"H\", \"h\"],\n\t\"TJ\": [\"H\", \"h\"],\n\t\"TL\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"h\"\n\t],\n\t\"TM\": [\"H\", \"h\"],\n\t\"TN\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"TO\": [\"h\", \"H\"],\n\t\"TR\": [\"H\", \"hB\"],\n\t\"TT\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"TW\": [\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"h\",\n\t\t\"H\"\n\t],\n\t\"TZ\": [\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"h\"\n\t],\n\t\"UA\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"UG\": [\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"h\"\n\t],\n\t\"UM\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"US\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"UY\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"UZ\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"VA\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"VC\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"VE\": [\n\t\t\"h\",\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"VG\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"VI\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"VN\": [\"H\", \"h\"],\n\t\"VU\": [\"h\", \"H\"],\n\t\"WF\": [\"H\", \"hB\"],\n\t\"WS\": [\"h\", \"H\"],\n\t\"XK\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"h\"\n\t],\n\t\"YE\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"YT\": [\"H\", \"hB\"],\n\t\"ZA\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"ZM\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"ZW\": [\"H\", \"h\"],\n\t\"af-ZA\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"ar-001\": [\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"ca-ES\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"en-001\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"en-HK\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"en-IL\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"hB\"\n\t],\n\t\"en-MY\": [\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\",\n\t\t\"hB\"\n\t],\n\t\"es-BR\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"es-ES\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"es-GQ\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\",\n\t\t\"hb\"\n\t],\n\t\"fr-CA\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"gl-ES\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"gu-IN\": [\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"h\",\n\t\t\"H\"\n\t],\n\t\"hi-IN\": [\n\t\t\"hB\",\n\t\t\"h\",\n\t\t\"H\"\n\t],\n\t\"it-CH\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"it-IT\": [\n\t\t\"H\",\n\t\t\"h\",\n\t\t\"hB\"\n\t],\n\t\"kn-IN\": [\n\t\t\"hB\",\n\t\t\"h\",\n\t\t\"H\"\n\t],\n\t\"ku-SY\": [\"H\", \"hB\"],\n\t\"ml-IN\": [\n\t\t\"hB\",\n\t\t\"h\",\n\t\t\"H\"\n\t],\n\t\"mr-IN\": [\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"h\",\n\t\t\"H\"\n\t],\n\t\"pa-IN\": [\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"h\",\n\t\t\"H\"\n\t],\n\t\"ta-IN\": [\n\t\t\"hB\",\n\t\t\"h\",\n\t\t\"hb\",\n\t\t\"H\"\n\t],\n\t\"te-IN\": [\n\t\t\"hB\",\n\t\t\"h\",\n\t\t\"H\"\n\t],\n\t\"zu-ZA\": [\n\t\t\"H\",\n\t\t\"hB\",\n\t\t\"hb\",\n\t\t\"h\"\n\t]\n};\n//#endregion\n//#region packages/icu-messageformat-parser/date-time-pattern-generator.ts\n/**\n* Returns the best matching date time pattern if a date time skeleton\n* pattern is provided with a locale. Follows the Unicode specification:\n* https://www.unicode.org/reports/tr35/tr35-dates.html#table-mapping-requested-time-skeletons-to-patterns\n* @param skeleton date time skeleton pattern that possibly includes j, J or C\n* @param locale\n*/\nfunction getBestPattern(skeleton, locale) {\n\tlet skeletonCopy = \"\";\n\tfor (let patternPos = 0; patternPos < skeleton.length; patternPos++) {\n\t\tconst patternChar = skeleton.charAt(patternPos);\n\t\tif (patternChar === \"j\") {\n\t\t\tlet extraLength = 0;\n\t\t\twhile (patternPos + 1 < skeleton.length && skeleton.charAt(patternPos + 1) === patternChar) {\n\t\t\t\textraLength++;\n\t\t\t\tpatternPos++;\n\t\t\t}\n\t\t\tlet hourLen = 1 + (extraLength & 1);\n\t\t\tlet dayPeriodLen = extraLength < 2 ? 1 : 3 + (extraLength >> 1);\n\t\t\tlet dayPeriodChar = \"a\";\n\t\t\tlet hourChar = getDefaultHourSymbolFromLocale(locale);\n\t\t\tif (hourChar == \"H\" || hourChar == \"k\") dayPeriodLen = 0;\n\t\t\twhile (dayPeriodLen-- > 0) skeletonCopy += dayPeriodChar;\n\t\t\twhile (hourLen-- > 0) skeletonCopy = hourChar + skeletonCopy;\n\t\t} else if (patternChar === \"J\") skeletonCopy += \"H\";\n\t\telse skeletonCopy += patternChar;\n\t}\n\treturn skeletonCopy;\n}\n/**\n* Maps the [hour cycle type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/hourCycle)\n* of the given `locale` to the corresponding time pattern.\n* @param locale\n*/\nfunction getDefaultHourSymbolFromLocale(locale) {\n\tlet hourCycle = locale.hourCycle;\n\tif (hourCycle === void 0) {\n\t\tconst localeWithHourCycles = locale;\n\t\thourCycle = localeWithHourCycles.getHourCycles?.()[0] ?? localeWithHourCycles.hourCycles?.[0];\n\t}\n\tif (hourCycle) switch (hourCycle) {\n\t\tcase \"h24\": return \"k\";\n\t\tcase \"h23\": return \"H\";\n\t\tcase \"h12\": return \"h\";\n\t\tcase \"h11\": return \"K\";\n\t\tdefault: throw new Error(\"Invalid hourCycle\");\n\t}\n\tconst languageTag = locale.language;\n\tlet regionTag;\n\tif (languageTag !== \"root\") regionTag = locale.maximize().region;\n\treturn (timeData[`${languageTag}-${regionTag}`] || timeData[regionTag || \"\"] || timeData[languageTag || \"\"] || timeData[`${languageTag}-001`] || timeData[\"001\"])[0].charAt(0);\n}\n//#endregion\n//#region packages/icu-messageformat-parser/parser.ts\nconst SPACE_SEPARATOR_START_REGEX = new RegExp(`^${SPACE_SEPARATOR_REGEX.source}*`);\nconst SPACE_SEPARATOR_END_REGEX = new RegExp(`${SPACE_SEPARATOR_REGEX.source}*$`);\nfunction createLocation(start, end) {\n\treturn {\n\t\tstart,\n\t\tend\n\t};\n}\nconst hasNativeFromEntries = !!Object.fromEntries;\nconst hasTrimStart = !!String.prototype.trimStart;\nconst hasTrimEnd = !!String.prototype.trimEnd;\nconst fromEntries = hasNativeFromEntries ? Object.fromEntries : function fromEntries(entries) {\n\tconst obj = {};\n\tfor (const [k, v] of entries) obj[k] = v;\n\treturn obj;\n};\nconst trimStart = hasTrimStart ? function trimStart(s) {\n\treturn s.trimStart();\n} : function trimStart(s) {\n\treturn s.replace(SPACE_SEPARATOR_START_REGEX, \"\");\n};\nconst trimEnd = hasTrimEnd ? function trimEnd(s) {\n\treturn s.trimEnd();\n} : function trimEnd(s) {\n\treturn s.replace(SPACE_SEPARATOR_END_REGEX, \"\");\n};\nlet IDENTIFIER_PREFIX_RE = createIdentifierPrefixRegex();\nfunction createIdentifierPrefixRegex() {\n\ttry {\n\t\tconst regex = new RegExp(\"([^\\\\p{White_Space}\\\\p{Pattern_Syntax}]*)\", \"yu\");\n\t\tif (regex.exec(\"a \")?.[1] === \"a\") return regex;\n\t} catch {}\n\treturn IDENTIFIER_PREFIX_REGEX;\n}\nfunction matchIdentifierAtIndex(s, index) {\n\tIDENTIFIER_PREFIX_RE.lastIndex = index;\n\treturn IDENTIFIER_PREFIX_RE.exec(s)[1] ?? \"\";\n}\nfunction plainTopLevelEndPosition(message) {\n\tif (message.length === 0) return null;\n\tlet line = 1;\n\tlet column = 1;\n\tfor (let offset = 0; offset < message.length;) {\n\t\tconst code = message.charCodeAt(offset);\n\t\tswitch (code) {\n\t\t\tcase 35:\n\t\t\tcase 39:\n\t\t\tcase 60:\n\t\t\tcase 123:\n\t\t\tcase 125: return null;\n\t\t}\n\t\tif (code === 10) {\n\t\t\tline++;\n\t\t\tcolumn = 1;\n\t\t\toffset++;\n\t\t} else {\n\t\t\tcolumn++;\n\t\t\tif (code >= 55296 && code <= 56319 && offset + 1 < message.length) {\n\t\t\t\tconst next = message.charCodeAt(offset + 1);\n\t\t\t\toffset += next >= 56320 && next <= 57343 ? 2 : 1;\n\t\t\t} else offset++;\n\t\t}\n\t}\n\treturn {\n\t\toffset: message.length,\n\t\tline,\n\t\tcolumn\n\t};\n}\nvar Parser = class {\n\tconstructor(message, options = {}) {\n\t\tthis.message = message;\n\t\tthis.position = {\n\t\t\toffset: 0,\n\t\t\tline: 1,\n\t\t\tcolumn: 1\n\t\t};\n\t\tthis.ignoreTag = !!options.ignoreTag;\n\t\tthis.locale = options.locale;\n\t\tthis.requiresOtherClause = !!options.requiresOtherClause;\n\t\tthis.shouldParseSkeletons = !!options.shouldParseSkeletons;\n\t}\n\tparse() {\n\t\tif (this.offset() !== 0) throw Error(\"parser can only be used once\");\n\t\tif (this.message.length > 0) {\n\t\t\tconst firstCode = this.message.charCodeAt(0);\n\t\t\tif (firstCode !== 35 && firstCode !== 39 && firstCode !== 60 && firstCode !== 123 && firstCode !== 125) {\n\t\t\t\tconst plainEndPosition = plainTopLevelEndPosition(this.message);\n\t\t\t\tif (plainEndPosition) {\n\t\t\t\t\tconst start = this.clonePosition();\n\t\t\t\t\tthis.position = plainEndPosition;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tval: [{\n\t\t\t\t\t\t\ttype: 0,\n\t\t\t\t\t\t\tvalue: this.message,\n\t\t\t\t\t\t\tlocation: createLocation(start, this.clonePosition())\n\t\t\t\t\t\t}],\n\t\t\t\t\t\terr: null\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this.parseMessage(0, \"\", false);\n\t}\n\tparseMessage(nestingLevel, parentArgType, expectingCloseTag) {\n\t\tlet elements = [];\n\t\twhile (!this.isEOF()) {\n\t\t\tconst char = this.char();\n\t\t\tif (char === 123) {\n\t\t\t\tconst result = this.parseArgument(nestingLevel, expectingCloseTag);\n\t\t\t\tif (result.err) return result;\n\t\t\t\telements.push(result.val);\n\t\t\t} else if (char === 125 && nestingLevel > 0) break;\n\t\t\telse if (char === 35 && (parentArgType === \"plural\" || parentArgType === \"selectordinal\")) {\n\t\t\t\tconst position = this.clonePosition();\n\t\t\t\tthis.bump();\n\t\t\t\telements.push({\n\t\t\t\t\ttype: 7,\n\t\t\t\t\tlocation: createLocation(position, this.clonePosition())\n\t\t\t\t});\n\t\t\t} else if (char === 60 && !this.ignoreTag && this.peek() === 47) {\n\t\t\t\tif (expectingCloseTag) break;\n\t\t\t\telse return this.error(26, createLocation(this.clonePosition(), this.clonePosition()));\n\t\t\t} else if (char === 60 && !this.ignoreTag && _isAlpha(this.peek() || 0)) {\n\t\t\t\tconst result = this.parseTag(nestingLevel, parentArgType);\n\t\t\t\tif (result.err) return result;\n\t\t\t\telements.push(result.val);\n\t\t\t} else {\n\t\t\t\tconst result = this.parseLiteral(nestingLevel, parentArgType);\n\t\t\t\tif (result.err) return result;\n\t\t\t\telements.push(result.val);\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\tval: elements,\n\t\t\terr: null\n\t\t};\n\t}\n\t/**\n\t* A tag name must start with an ASCII lower/upper case letter. The grammar is based on the\n\t* [custom element name][] except that a dash is NOT always mandatory and uppercase letters\n\t* are accepted:\n\t*\n\t* ```\n\t* tag ::= \"<\" tagName (whitespace)* \"/>\" | \"<\" tagName (whitespace)* \">\" message \"</\" tagName (whitespace)* \">\"\n\t* tagName ::= [a-z] (PENChar)*\n\t* PENChar ::=\n\t* \"-\" | \".\" | [0-9] | \"_\" | [a-z] | [A-Z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] |\n\t* [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] |\n\t* [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]\n\t* ```\n\t*\n\t* [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name\n\t* NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do\n\t* since other tag-based engines like React allow it\n\t*/\n\tparseTag(nestingLevel, parentArgType) {\n\t\tconst startPosition = this.clonePosition();\n\t\tthis.bump();\n\t\tconst tagName = this.parseTagName();\n\t\tthis.bumpSpace();\n\t\tif (this.bumpIf(\"/>\")) return {\n\t\t\tval: {\n\t\t\t\ttype: 0,\n\t\t\t\tvalue: `<${tagName}/>`,\n\t\t\t\tlocation: createLocation(startPosition, this.clonePosition())\n\t\t\t},\n\t\t\terr: null\n\t\t};\n\t\telse if (this.bumpIf(\">\")) {\n\t\t\tconst childrenResult = this.parseMessage(nestingLevel + 1, parentArgType, true);\n\t\t\tif (childrenResult.err) return childrenResult;\n\t\t\tconst children = childrenResult.val;\n\t\t\tconst endTagStartPosition = this.clonePosition();\n\t\t\tif (this.bumpIf(\"</\")) {\n\t\t\t\tif (this.isEOF() || !_isAlpha(this.char())) return this.error(23, createLocation(endTagStartPosition, this.clonePosition()));\n\t\t\t\tconst closingTagNameStartPosition = this.clonePosition();\n\t\t\t\tif (tagName !== this.parseTagName()) return this.error(26, createLocation(closingTagNameStartPosition, this.clonePosition()));\n\t\t\t\tthis.bumpSpace();\n\t\t\t\tif (!this.bumpIf(\">\")) return this.error(23, createLocation(endTagStartPosition, this.clonePosition()));\n\t\t\t\treturn {\n\t\t\t\t\tval: {\n\t\t\t\t\t\ttype: 8,\n\t\t\t\t\t\tvalue: tagName,\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t\tlocation: createLocation(startPosition, this.clonePosition())\n\t\t\t\t\t},\n\t\t\t\t\terr: null\n\t\t\t\t};\n\t\t\t} else return this.error(27, createLocation(startPosition, this.clonePosition()));\n\t\t} else return this.error(23, createLocation(startPosition, this.clonePosition()));\n\t}\n\t/**\n\t* This method assumes that the caller has peeked ahead for the first tag character.\n\t*/\n\tparseTagName() {\n\t\tconst startOffset = this.offset();\n\t\tthis.bump();\n\t\twhile (!this.isEOF() && _isPotentialElementNameChar(this.char())) this.bump();\n\t\treturn this.message.slice(startOffset, this.offset());\n\t}\n\tparseLiteral(nestingLevel, parentArgType) {\n\t\tconst start = this.clonePosition();\n\t\tlet value = \"\";\n\t\twhile (true) {\n\t\t\tconst parseQuoteResult = this.tryParseQuote(parentArgType);\n\t\t\tif (parseQuoteResult) {\n\t\t\t\tvalue += parseQuoteResult;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst parseUnquotedResult = this.tryParseUnquoted(nestingLevel, parentArgType);\n\t\t\tif (parseUnquotedResult) {\n\t\t\t\tvalue += parseUnquotedResult;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst parseLeftAngleResult = this.tryParseLeftAngleBracket();\n\t\t\tif (parseLeftAngleResult) {\n\t\t\t\tvalue += parseLeftAngleResult;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tconst location = createLocation(start, this.clonePosition());\n\t\treturn {\n\t\t\tval: {\n\t\t\t\ttype: 0,\n\t\t\t\tvalue,\n\t\t\t\tlocation\n\t\t\t},\n\t\t\terr: null\n\t\t};\n\t}\n\ttryParseLeftAngleBracket() {\n\t\tif (!this.isEOF() && this.char() === 60 && (this.ignoreTag || !_isAlphaOrSlash(this.peek() || 0))) {\n\t\t\tthis.bump();\n\t\t\treturn \"<\";\n\t\t}\n\t\treturn null;\n\t}\n\t/**\n\t* Starting with ICU 4.8, an ASCII apostrophe only starts quoted text if it immediately precedes\n\t* a character that requires quoting (that is, \"only where needed\"), and works the same in\n\t* nested messages as on the top level of the pattern. The new behavior is otherwise compatible.\n\t*/\n\ttryParseQuote(parentArgType) {\n\t\tif (this.isEOF() || this.char() !== 39) return null;\n\t\tswitch (this.peek()) {\n\t\t\tcase 39:\n\t\t\t\tthis.bump();\n\t\t\t\tthis.bump();\n\t\t\t\treturn \"'\";\n\t\t\tcase 123:\n\t\t\tcase 60:\n\t\t\tcase 62:\n\t\t\tcase 125: break;\n\t\t\tcase 35:\n\t\t\t\tif (parentArgType === \"plural\" || parentArgType === \"selectordinal\") break;\n\t\t\t\treturn null;\n\t\t\tdefault: return null;\n\t\t}\n\t\tthis.bump();\n\t\tconst codePoints = [this.char()];\n\t\tthis.bump();\n\t\twhile (!this.isEOF()) {\n\t\t\tconst ch = this.char();\n\t\t\tif (ch === 39) {\n\t\t\t\tif (this.peek() === 39) {\n\t\t\t\t\tcodePoints.push(39);\n\t\t\t\t\tthis.bump();\n\t\t\t\t} else {\n\t\t\t\t\tthis.bump();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else codePoints.push(ch);\n\t\t\tthis.bump();\n\t\t}\n\t\treturn String.fromCodePoint(...codePoints);\n\t}\n\ttryParseUnquoted(nestingLevel, parentArgType) {\n\t\tif (this.isEOF()) return null;\n\t\tconst ch = this.char();\n\t\tif (ch === 60 || ch === 123 || ch === 35 && (parentArgType === \"plural\" || parentArgType === \"selectordinal\") || ch === 125 && nestingLevel > 0) return null;\n\t\telse {\n\t\t\tthis.bump();\n\t\t\treturn String.fromCodePoint(ch);\n\t\t}\n\t}\n\tparseArgument(nestingLevel, expectingCloseTag) {\n\t\tconst openingBracePosition = this.clonePosition();\n\t\tthis.bump();\n\t\tthis.bumpSpace();\n\t\tif (this.isEOF()) return this.error(1, createLocation(openingBracePosition, this.clonePosition()));\n\t\tif (this.char() === 125) {\n\t\t\tthis.bump();\n\t\t\treturn this.error(2, createLocation(openingBracePosition, this.clonePosition()));\n\t\t}\n\t\tlet value = this.parseIdentifierIfPossible().value;\n\t\tif (!value) return this.error(3, createLocation(openingBracePosition, this.clonePosition()));\n\t\tthis.bumpSpace();\n\t\tif (this.isEOF()) return this.error(1, createLocation(openingBracePosition, this.clonePosition()));\n\t\tswitch (this.char()) {\n\t\t\tcase 125:\n\t\t\t\tthis.bump();\n\t\t\t\treturn {\n\t\t\t\t\tval: {\n\t\t\t\t\t\ttype: 1,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tlocation: createLocation(openingBracePosition, this.clonePosition())\n\t\t\t\t\t},\n\t\t\t\t\terr: null\n\t\t\t\t};\n\t\t\tcase 44:\n\t\t\t\tthis.bump();\n\t\t\t\tthis.bumpSpace();\n\t\t\t\tif (this.isEOF()) return this.error(1, createLocation(openingBracePosition, this.clonePosition()));\n\t\t\t\treturn this.parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition);\n\t\t\tdefault: return this.error(3, createLocation(openingBracePosition, this.clonePosition()));\n\t\t}\n\t}\n\t/**\n\t* Advance the parser until the end of the identifier, if it is currently on\n\t* an identifier character. Return an empty string otherwise.\n\t*/\n\tparseIdentifierIfPossible() {\n\t\tconst startingPosition = this.clonePosition();\n\t\tconst startOffset = this.offset();\n\t\tconst value = matchIdentifierAtIndex(this.message, startOffset);\n\t\tconst endOffset = startOffset + value.length;\n\t\tthis.bumpTo(endOffset);\n\t\treturn {\n\t\t\tvalue,\n\t\t\tlocation: createLocation(startingPosition, this.clonePosition())\n\t\t};\n\t}\n\tparseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition) {\n\t\tlet typeStartPosition = this.clonePosition();\n\t\tlet argType = this.parseIdentifierIfPossible().value;\n\t\tlet typeEndPosition = this.clonePosition();\n\t\tswitch (argType) {\n\t\t\tcase \"\": return this.error(4, createLocation(typeStartPosition, typeEndPosition));\n\t\t\tcase \"number\":\n\t\t\tcase \"date\":\n\t\t\tcase \"time\": {\n\t\t\t\tthis.bumpSpace();\n\t\t\t\tlet styleAndLocation = null;\n\t\t\t\tif (this.bumpIf(\",\")) {\n\t\t\t\t\tthis.bumpSpace();\n\t\t\t\t\tconst styleStartPosition = this.clonePosition();\n\t\t\t\t\tconst result = this.parseSimpleArgStyleIfPossible();\n\t\t\t\t\tif (result.err) return result;\n\t\t\t\t\tconst style = trimEnd(result.val);\n\t\t\t\t\tif (style.length === 0) return this.error(6, createLocation(this.clonePosition(), this.clonePosition()));\n\t\t\t\t\tstyleAndLocation = {\n\t\t\t\t\t\tstyle,\n\t\t\t\t\t\tstyleLocation: createLocation(styleStartPosition, this.clonePosition())\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tconst argCloseResult = this.tryParseArgumentClose(openingBracePosition);\n\t\t\t\tif (argCloseResult.err) return argCloseResult;\n\t\t\t\tconst location = createLocation(openingBracePosition, this.clonePosition());\n\t\t\t\tif (styleAndLocation && styleAndLocation.style.startsWith(\"::\")) {\n\t\t\t\t\tlet skeleton = trimStart(styleAndLocation.style.slice(2));\n\t\t\t\t\tif (argType === \"number\") {\n\t\t\t\t\t\tconst result = this.parseNumberSkeletonFromString(skeleton, styleAndLocation.styleLocation);\n\t\t\t\t\t\tif (result.err) return result;\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tval: {\n\t\t\t\t\t\t\t\ttype: 2,\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\tstyle: result.val\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\terr: null\n\t\t\t\t\t\t};\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (skeleton.length === 0) return this.error(10, location);\n\t\t\t\t\t\tlet dateTimePattern = skeleton;\n\t\t\t\t\t\tif (this.locale) dateTimePattern = getBestPattern(skeleton, this.locale);\n\t\t\t\t\t\tconst style = {\n\t\t\t\t\t\t\ttype: 1,\n\t\t\t\t\t\t\tpattern: dateTimePattern,\n\t\t\t\t\t\t\tlocation: styleAndLocation.styleLocation,\n\t\t\t\t\t\t\tparsedOptions: this.shouldParseSkeletons ? parseDateTimeSkeleton(dateTimePattern) : {}\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tval: {\n\t\t\t\t\t\t\t\ttype: argType === \"date\" ? 3 : 4,\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\tstyle\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\terr: null\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tval: {\n\t\t\t\t\t\ttype: argType === \"number\" ? 2 : argType === \"date\" ? 3 : 4,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tlocation,\n\t\t\t\t\t\tstyle: styleAndLocation?.style ?? null\n\t\t\t\t\t},\n\t\t\t\t\terr: null\n\t\t\t\t};\n\t\t\t}\n\t\t\tcase \"plural\":\n\t\t\tcase \"selectordinal\":\n\t\t\tcase \"select\": {\n\t\t\t\tconst typeEndPosition = this.clonePosition();\n\t\t\t\tthis.bumpSpace();\n\t\t\t\tif (!this.bumpIf(\",\")) return this.error(12, createLocation(typeEndPosition, { ...typeEndPosition }));\n\t\t\t\tthis.bumpSpace();\n\t\t\t\tlet identifierAndLocation = this.parseIdentifierIfPossible();\n\t\t\t\tlet pluralOffset = 0;\n\t\t\t\tif (argType !== \"select\" && identifierAndLocation.value === \"offset\") {\n\t\t\t\t\tif (!this.bumpIf(\":\")) return this.error(13, createLocation(this.clonePosition(), this.clonePosition()));\n\t\t\t\t\tthis.bumpSpace();\n\t\t\t\t\tconst result = this.tryParseDecimalInteger(13, 14);\n\t\t\t\t\tif (result.err) return result;\n\t\t\t\t\tthis.bumpSpace();\n\t\t\t\t\tidentifierAndLocation = this.parseIdentifierIfPossible();\n\t\t\t\t\tpluralOffset = result.val;\n\t\t\t\t}\n\t\t\t\tconst optionsResult = this.tryParsePluralOrSelectOptions(nestingLevel, argType, expectingCloseTag, identifierAndLocation);\n\t\t\t\tif (optionsResult.err) return optionsResult;\n\t\t\t\tconst argCloseResult = this.tryParseArgumentClose(openingBracePosition);\n\t\t\t\tif (argCloseResult.err) return argCloseResult;\n\t\t\t\tconst location = createLocation(openingBracePosition, this.clonePosition());\n\t\t\t\tif (argType === \"select\") return {\n\t\t\t\t\tval: {\n\t\t\t\t\t\ttype: 5,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\toptions: fromEntries(optionsResult.val),\n\t\t\t\t\t\tlocation\n\t\t\t\t\t},\n\t\t\t\t\terr: null\n\t\t\t\t};\n\t\t\t\telse return {\n\t\t\t\t\tval: {\n\t\t\t\t\t\ttype: 6,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\toptions: fromEntries(optionsResult.val),\n\t\t\t\t\t\toffset: pluralOffset,\n\t\t\t\t\t\tpluralType: argType === \"plural\" ? \"cardinal\" : \"ordinal\",\n\t\t\t\t\t\tlocation\n\t\t\t\t\t},\n\t\t\t\t\terr: null\n\t\t\t\t};\n\t\t\t}\n\t\t\tdefault: return this.error(5, createLocation(typeStartPosition, typeEndPosition));\n\t\t}\n\t}\n\ttryParseArgumentClose(openingBracePosition) {\n\t\tif (this.isEOF() || this.char() !== 125) return this.error(1, createLocation(openingBracePosition, this.clonePosition()));\n\t\tthis.bump();\n\t\treturn {\n\t\t\tval: true,\n\t\t\terr: null\n\t\t};\n\t}\n\t/**\n\t* See: https://github.com/unicode-org/icu/blob/af7ed1f6d2298013dc303628438ec4abe1f16479/icu4c/source/common/messagepattern.cpp#L659\n\t*/\n\tparseSimpleArgStyleIfPossible() {\n\t\tlet nestedBraces = 0;\n\t\tconst startPosition = this.clonePosition();\n\t\twhile (!this.isEOF()) switch (this.char()) {\n\t\t\tcase 39: {\n\t\t\t\tthis.bump();\n\t\t\t\tlet apostrophePosition = this.clonePosition();\n\t\t\t\tif (!this.bumpUntil(\"'\")) return this.error(11, createLocation(apostrophePosition, this.clonePosition()));\n\t\t\t\tthis.bump();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 123:\n\t\t\t\tnestedBraces += 1;\n\t\t\t\tthis.bump();\n\t\t\t\tbreak;\n\t\t\tcase 125:\n\t\t\t\tif (nestedBraces > 0) nestedBraces -= 1;\n\t\t\t\telse return {\n\t\t\t\t\tval: this.message.slice(startPosition.offset, this.offset()),\n\t\t\t\t\terr: null\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\tdefault: this.bump();\n\t\t}\n\t\treturn {\n\t\t\tval: this.message.slice(startPosition.offset, this.offset()),\n\t\t\terr: null\n\t\t};\n\t}\n\tparseNumberSkeletonFromString(skeleton, location) {\n\t\tlet tokens = [];\n\t\ttry {\n\t\t\ttokens = parseNumberSkeletonFromString(skeleton);\n\t\t} catch {\n\t\t\treturn this.error(7, location);\n\t\t}\n\t\treturn {\n\t\t\tval: {\n\t\t\t\ttype: 0,\n\t\t\t\ttokens,\n\t\t\t\tlocation,\n\t\t\t\tparsedOptions: this.shouldParseSkeletons ? parseNumberSkeleton(tokens) : {}\n\t\t\t},\n\t\t\terr: null\n\t\t};\n\t}\n\t/**\n\t* @param nesting_level The current nesting level of messages.\n\t* This can be positive when parsing message fragment in select or plural argument options.\n\t* @param parent_arg_type The parent argument's type.\n\t* @param parsed_first_identifier If provided, this is the first identifier-like selector of\n\t* the argument. It is a by-product of a previous parsing attempt.\n\t* @param expecting_close_tag If true, this message is directly or indirectly nested inside\n\t* between a pair of opening and closing tags. The nested message will not parse beyond\n\t* the closing tag boundary.\n\t*/\n\ttryParsePluralOrSelectOptions(nestingLevel, parentArgType, expectCloseTag, parsedFirstIdentifier) {\n\t\tlet hasOtherClause = false;\n\t\tconst options = [];\n\t\tconst parsedSelectors = /* @__PURE__ */ new Set();\n\t\tlet { value: selector, location: selectorLocation } = parsedFirstIdentifier;\n\t\twhile (true) {\n\t\t\tif (selector.length === 0) {\n\t\t\t\tconst startPosition = this.clonePosition();\n\t\t\t\tif (parentArgType !== \"select\" && this.bumpIf(\"=\")) {\n\t\t\t\t\tconst result = this.tryParseDecimalInteger(16, 19);\n\t\t\t\t\tif (result.err) return result;\n\t\t\t\t\tselectorLocation = createLocation(startPosition, this.clonePosition());\n\t\t\t\t\tselector = this.message.slice(startPosition.offset, this.offset());\n\t\t\t\t} else break;\n\t\t\t}\n\t\t\tif (parsedSelectors.has(selector)) return this.error(parentArgType === \"select\" ? 21 : 20, selectorLocation);\n\t\t\tif (selector === \"other\") hasOtherClause = true;\n\t\t\tthis.bumpSpace();\n\t\t\tconst openingBracePosition = this.clonePosition();\n\t\t\tif (!this.bumpIf(\"{\")) return this.error(parentArgType === \"select\" ? 17 : 18, createLocation(this.clonePosition(), this.clonePosition()));\n\t\t\tconst fragmentResult = this.parseMessage(nestingLevel + 1, parentArgType, expectCloseTag);\n\t\t\tif (fragmentResult.err) return fragmentResult;\n\t\t\tconst argCloseResult = this.tryParseArgumentClose(openingBracePosition);\n\t\t\tif (argCloseResult.err) return argCloseResult;\n\t\t\toptions.push([selector, {\n\t\t\t\tvalue: fragmentResult.val,\n\t\t\t\tlocation: createLocation(openingBracePosition, this.clonePosition())\n\t\t\t}]);\n\t\t\tparsedSelectors.add(selector);\n\t\t\tthis.bumpSpace();\n\t\t\t({value: selector, location: selectorLocation} = this.parseIdentifierIfPossible());\n\t\t}\n\t\tif (options.length === 0) return this.error(parentArgType === \"select\" ? 15 : 16, createLocation(this.clonePosition(), this.clonePosition()));\n\t\tif (this.requiresOtherClause && !hasOtherClause) return this.error(22, createLocation(this.clonePosition(), this.clonePosition()));\n\t\treturn {\n\t\t\tval: options,\n\t\t\terr: null\n\t\t};\n\t}\n\ttryParseDecimalInteger(expectNumberError, invalidNumberError) {\n\t\tlet sign = 1;\n\t\tconst startingPosition = this.clonePosition();\n\t\tif (this.bumpIf(\"+\")) {} else if (this.bumpIf(\"-\")) sign = -1;\n\t\tlet hasDigits = false;\n\t\tlet decimal = 0;\n\t\twhile (!this.isEOF()) {\n\t\t\tconst ch = this.char();\n\t\t\tif (ch >= 48 && ch <= 57) {\n\t\t\t\thasDigits = true;\n\t\t\t\tdecimal = decimal * 10 + (ch - 48);\n\t\t\t\tthis.bump();\n\t\t\t} else break;\n\t\t}\n\t\tconst location = createLocation(startingPosition, this.clonePosition());\n\t\tif (!hasDigits) return this.error(expectNumberError, location);\n\t\tdecimal *= sign;\n\t\tif (!Number.isSafeInteger(decimal)) return this.error(invalidNumberError, location);\n\t\treturn {\n\t\t\tval: decimal,\n\t\t\terr: null\n\t\t};\n\t}\n\toffset() {\n\t\treturn this.position.offset;\n\t}\n\tisEOF() {\n\t\treturn this.offset() === this.message.length;\n\t}\n\tclonePosition() {\n\t\treturn {\n\t\t\toffset: this.position.offset,\n\t\t\tline: this.position.line,\n\t\t\tcolumn: this.position.column\n\t\t};\n\t}\n\t/**\n\t* Return the code point at the current position of the parser.\n\t* Throws if the index is out of bound.\n\t*/\n\tchar() {\n\t\tconst offset = this.position.offset;\n\t\tif (offset >= this.message.length) throw Error(\"out of bound\");\n\t\tconst code = this.message.codePointAt(offset);\n\t\tif (code === void 0) throw Error(`Offset ${offset} is at invalid UTF-16 code unit boundary`);\n\t\treturn code;\n\t}\n\terror(kind, location) {\n\t\treturn {\n\t\t\tval: null,\n\t\t\terr: {\n\t\t\t\tkind,\n\t\t\t\tmessage: this.message,\n\t\t\t\tlocation\n\t\t\t}\n\t\t};\n\t}\n\t/** Bump the parser to the next UTF-16 code unit. */\n\tbump() {\n\t\tif (this.isEOF()) return;\n\t\tconst code = this.char();\n\t\tif (code === 10) {\n\t\t\tthis.position.line += 1;\n\t\t\tthis.position.column = 1;\n\t\t\tthis.position.offset += 1;\n\t\t} else {\n\t\t\tthis.position.column += 1;\n\t\t\tthis.position.offset += code < 65536 ? 1 : 2;\n\t\t}\n\t}\n\t/**\n\t* If the substring starting at the current position of the parser has\n\t* the given prefix, then bump the parser to the character immediately\n\t* following the prefix and return true. Otherwise, don't bump the parser\n\t* and return false.\n\t*/\n\tbumpIf(prefix) {\n\t\tconst offset = this.offset();\n\t\tif (this.message.slice(offset, offset + prefix.length) === prefix) {\n\t\t\tfor (let i = 0; i < prefix.length; i++) this.bump();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\t/**\n\t* Bump the parser until the pattern character is found and return `true`.\n\t* Otherwise bump to the end of the file and return `false`.\n\t*/\n\tbumpUntil(pattern) {\n\t\tconst currentOffset = this.offset();\n\t\tconst index = this.message.indexOf(pattern, currentOffset);\n\t\tif (index >= 0) {\n\t\t\tthis.bumpTo(index);\n\t\t\treturn true;\n\t\t} else {\n\t\t\tthis.bumpTo(this.message.length);\n\t\t\treturn false;\n\t\t}\n\t}\n\t/**\n\t* Bump the parser to the target offset.\n\t* If target offset is beyond the end of the input, bump the parser to the end of the input.\n\t*/\n\tbumpTo(targetOffset) {\n\t\tif (this.offset() > targetOffset) throw Error(`targetOffset ${targetOffset} must be greater than or equal to the current offset ${this.offset()}`);\n\t\ttargetOffset = Math.min(targetOffset, this.message.length);\n\t\twhile (true) {\n\t\t\tconst offset = this.offset();\n\t\t\tif (offset === targetOffset) break;\n\t\t\tif (offset > targetOffset) throw Error(`targetOffset ${targetOffset} is at invalid UTF-16 code unit boundary`);\n\t\t\tthis.bump();\n\t\t\tif (this.isEOF()) break;\n\t\t}\n\t}\n\t/** advance the parser through all whitespace to the next non-whitespace code unit. */\n\tbumpSpace() {\n\t\twhile (!this.isEOF() && _isWhiteSpace(this.char())) this.bump();\n\t}\n\t/**\n\t* Peek at the *next* Unicode codepoint in the input without advancing the parser.\n\t* If the input has been exhausted, then this returns null.\n\t*/\n\tpeek() {\n\t\tif (this.isEOF()) return null;\n\t\tconst code = this.char();\n\t\tconst offset = this.offset();\n\t\treturn this.message.charCodeAt(offset + (code >= 65536 ? 2 : 1)) ?? null;\n\t}\n};\n/**\n* This check if codepoint is alphabet (lower & uppercase)\n* @param codepoint\n* @returns\n*/\nfunction _isAlpha(codepoint) {\n\treturn codepoint >= 97 && codepoint <= 122 || codepoint >= 65 && codepoint <= 90;\n}\nfunction _isAlphaOrSlash(codepoint) {\n\treturn _isAlpha(codepoint) || codepoint === 47;\n}\n/** See `parseTag` function docs. */\nfunction _isPotentialElementNameChar(c) {\n\treturn c === 45 || c === 46 || c >= 48 && c <= 57 || c === 95 || c >= 97 && c <= 122 || c >= 65 && c <= 90 || c == 183 || c >= 192 && c <= 214 || c >= 216 && c <= 246 || c >= 248 && c <= 893 || c >= 895 && c <= 8191 || c >= 8204 && c <= 8205 || c >= 8255 && c <= 8256 || c >= 8304 && c <= 8591 || c >= 11264 && c <= 12271 || c >= 12289 && c <= 55295 || c >= 63744 && c <= 64975 || c >= 65008 && c <= 65533 || c >= 65536 && c <= 983039;\n}\n/**\n* Code point equivalent of regex `\\p{White_Space}`.\n* From: https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt\n*/\nfunction _isWhiteSpace(c) {\n\treturn c >= 9 && c <= 13 || c === 32 || c === 133 || c >= 8206 && c <= 8207 || c === 8232 || c === 8233;\n}\n//#endregion\n//#region packages/icu-messageformat-parser/manipulator.ts\n/**\n* Collect variable types, allowing shared date/time arguments.\n* @param ast AST to collect variables from\n* @param vars Map of variable names to type sets\n*/\nfunction collectVariables(ast, vars = /* @__PURE__ */ new Map()) {\n\tast.forEach((el) => {\n\t\tif (isArgumentElement(el) || isDateElement(el) || isTimeElement(el) || isNumberElement(el)) {\n\t\t\tif (vars.has(el.value)) {\n\t\t\t\tconst existingTypes = vars.get(el.value);\n\t\t\t\tif (!existingTypes.has(el.type) && !existingTypes.has(6) && !existingTypes.has(5)) {\n\t\t\t\t\tif ((el.type === 3 || el.type === 4) && Array.from(existingTypes).every((type) => type === 3 || type === 4)) existingTypes.add(el.type);\n\t\t\t\t\telse throw new Error(`Variable ${el.value} has conflicting types`);\n\t\t\t\t}\n\t\t\t} else vars.set(el.value, /* @__PURE__ */ new Set([el.type]));\n\t\t}\n\t\tif (isPluralElement(el) || isSelectElement(el)) {\n\t\t\tvars.set(el.value, /* @__PURE__ */ new Set([el.type]));\n\t\t\tObject.keys(el.options).forEach((k) => {\n\t\t\t\tcollectVariables(el.options[k].value, vars);\n\t\t\t});\n\t\t}\n\t\tif (isTagElement(el)) {\n\t\t\tvars.set(el.value, /* @__PURE__ */ new Set([el.type]));\n\t\t\tcollectVariables(el.children, vars);\n\t\t}\n\t});\n}\n/**\n* Check if 2 ASTs are structurally the same. This primarily means that\n* they have the same variables with the same type\n* @param a\n* @param b\n* @returns\n*/\nfunction isStructurallySame(a, b) {\n\tconst aVars = /* @__PURE__ */ new Map();\n\tconst bVars = /* @__PURE__ */ new Map();\n\tcollectVariables(a, aVars);\n\tcollectVariables(b, bVars);\n\tif (aVars.size !== bVars.size) return {\n\t\tsuccess: false,\n\t\terror: /* @__PURE__ */ new Error(`Different number of variables: [${Array.from(aVars.keys()).join(\", \")}] vs [${Array.from(bVars.keys()).join(\", \")}]`)\n\t};\n\treturn Array.from(aVars.entries()).reduce((result, [key, type]) => {\n\t\tif (!result.success) return result;\n\t\tconst bType = bVars.get(key);\n\t\tif (bType == null) return {\n\t\t\tsuccess: false,\n\t\t\terror: /* @__PURE__ */ new Error(`Missing variable ${key} in message`)\n\t\t};\n\t\tif (bType.size !== type.size || !Array.from(type).every((t) => bType.has(t))) return {\n\t\t\tsuccess: false,\n\t\t\terror: /* @__PURE__ */ new Error(`Variable ${key} has conflicting types: ${Array.from(type, (t) => TYPE[t]).join(\", \")} vs ${Array.from(bType, (t) => TYPE[t]).join(\", \")}`)\n\t\t};\n\t\treturn result;\n\t}, { success: true });\n}\n//#endregion\n//#region packages/icu-messageformat-parser/index.ts\nfunction pruneLocation(els) {\n\tels.forEach((el) => {\n\t\tdelete el.location;\n\t\tif (isSelectElement(el) || isPluralElement(el)) for (const k in el.options) {\n\t\t\tdelete el.options[k].location;\n\t\t\tpruneLocation(el.options[k].value);\n\t\t}\n\t\telse if (isNumberElement(el) && isNumberSkeleton(el.style)) delete el.style.location;\n\t\telse if ((isDateElement(el) || isTimeElement(el)) && isDateTimeSkeleton(el.style)) delete el.style.location;\n\t\telse if (isTagElement(el)) pruneLocation(el.children);\n\t});\n}\nfunction parse(message, opts = {}) {\n\topts = {\n\t\tshouldParseSkeletons: true,\n\t\trequiresOtherClause: true,\n\t\t...opts\n\t};\n\tconst result = new Parser(message, opts).parse();\n\tif (result.err) {\n\t\tconst error = SyntaxError(ErrorKind[result.err.kind]);\n\t\terror.location = result.err.location;\n\t\terror.originalMessage = result.err.message;\n\t\tthrow error;\n\t}\n\tif (!opts?.captureLocation) pruneLocation(result.val);\n\treturn result.val;\n}\nconst _Parser = Parser;\n//#endregion\nexport { SKELETON_TYPE, TYPE, _Parser, createLiteralElement, createNumberElement, isArgumentElement, isDateElement, isDateTimeSkeleton, isLiteralElement, isNumberElement, isNumberSkeleton, isPluralElement, isPoundElement, isSelectElement, isStructurallySame, isTagElement, isTimeElement, parse };\n\n//# sourceMappingURL=index.js.map","import { memoize, strategies } from \"@formatjs/fast-memoize\";\nimport { isArgumentElement, isDateElement, isDateTimeSkeleton, isLiteralElement, isNumberElement, isNumberSkeleton, isPluralElement, isPoundElement, isSelectElement, isTagElement, isTimeElement, parse } from \"@formatjs/icu-messageformat-parser\";\n//#region packages/intl-messageformat/error.ts\nlet ErrorCode = /* @__PURE__ */ function(ErrorCode) {\n\tErrorCode[\"MISSING_VALUE\"] = \"MISSING_VALUE\";\n\tErrorCode[\"INVALID_VALUE\"] = \"INVALID_VALUE\";\n\tErrorCode[\"MISSING_INTL_API\"] = \"MISSING_INTL_API\";\n\treturn ErrorCode;\n}({});\nvar FormatError = class extends Error {\n\tconstructor(msg, code, originalMessage) {\n\t\tsuper(msg);\n\t\tthis.code = code;\n\t\tthis.originalMessage = originalMessage;\n\t}\n\ttoString() {\n\t\treturn `[formatjs Error: ${this.code}] ${this.message}`;\n\t}\n};\nvar InvalidValueError = class extends FormatError {\n\tconstructor(variableId, value, options, originalMessage) {\n\t\tsuper(`Invalid values for \"${variableId}\": \"${value}\". Options are \"${Object.keys(options).join(\"\\\", \\\"\")}\"`, \"INVALID_VALUE\", originalMessage);\n\t}\n};\nvar InvalidValueTypeError = class extends FormatError {\n\tconstructor(value, type, originalMessage) {\n\t\tsuper(`Value for \"${value}\" must be of type ${type}`, \"INVALID_VALUE\", originalMessage);\n\t}\n};\nvar MissingValueError = class extends FormatError {\n\tconstructor(variableId, originalMessage) {\n\t\tsuper(`The intl string context variable \"${variableId}\" was not provided to the string \"${originalMessage}\"`, \"MISSING_VALUE\", originalMessage);\n\t}\n};\n//#endregion\n//#region packages/intl-messageformat/formatters.ts\nlet PART_TYPE = /* @__PURE__ */ function(PART_TYPE) {\n\tPART_TYPE[PART_TYPE[\"literal\"] = 0] = \"literal\";\n\tPART_TYPE[PART_TYPE[\"object\"] = 1] = \"object\";\n\treturn PART_TYPE;\n}({});\nfunction mergeLiteral(parts) {\n\tif (parts.length < 2) return parts;\n\treturn parts.reduce((all, part) => {\n\t\tconst lastPart = all[all.length - 1];\n\t\tif (!lastPart || lastPart.type !== 0 || part.type !== 0) all.push(part);\n\t\telse lastPart.value += part.value;\n\t\treturn all;\n\t}, []);\n}\nfunction isFormatXMLElementFn(el) {\n\treturn typeof el === \"function\";\n}\nfunction formatToParts(els, locales, formatters, formats, values, currentPluralValue, originalMessage) {\n\tif (els.length === 1 && isLiteralElement(els[0])) return [{\n\t\ttype: 0,\n\t\tvalue: els[0].value\n\t}];\n\tconst result = [];\n\tfor (const el of els) {\n\t\tif (isLiteralElement(el)) {\n\t\t\tresult.push({\n\t\t\t\ttype: 0,\n\t\t\t\tvalue: el.value\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (isPoundElement(el)) {\n\t\t\tif (typeof currentPluralValue === \"number\") result.push({\n\t\t\t\ttype: 0,\n\t\t\t\tvalue: formatters.getNumberFormat(locales).format(currentPluralValue)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst { value: varName } = el;\n\t\tif (!(values && varName in values)) throw new MissingValueError(varName, originalMessage);\n\t\tlet value = values[varName];\n\t\tif (isArgumentElement(el)) {\n\t\t\tif (!value || typeof value === \"string\" || typeof value === \"number\" || typeof value === \"bigint\") value = typeof value === \"string\" || typeof value === \"number\" || typeof value === \"bigint\" ? String(value) : \"\";\n\t\t\tresult.push({\n\t\t\t\ttype: typeof value === \"string\" ? 0 : 1,\n\t\t\t\tvalue\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (isDateElement(el)) {\n\t\t\tconst style = typeof el.style === \"string\" ? formats.date[el.style] : isDateTimeSkeleton(el.style) ? el.style.parsedOptions : void 0;\n\t\t\tresult.push({\n\t\t\t\ttype: 0,\n\t\t\t\tvalue: formatters.getDateTimeFormat(locales, style).format(value)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (isTimeElement(el)) {\n\t\t\tconst style = typeof el.style === \"string\" ? formats.time[el.style] : isDateTimeSkeleton(el.style) ? el.style.parsedOptions : formats.time.medium;\n\t\t\tresult.push({\n\t\t\t\ttype: 0,\n\t\t\t\tvalue: formatters.getDateTimeFormat(locales, style).format(value)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (isNumberElement(el)) {\n\t\t\tconst style = typeof el.style === \"string\" ? formats.number[el.style] : isNumberSkeleton(el.style) ? el.style.parsedOptions : void 0;\n\t\t\tif (style && style.scale) {\n\t\t\t\tconst scale = style.scale || 1;\n\t\t\t\tif (typeof value === \"bigint\") {\n\t\t\t\t\tif (!Number.isInteger(scale)) throw new TypeError(`Cannot apply fractional scale ${scale} to bigint value. Scale must be an integer when formatting bigint.`);\n\t\t\t\t\tvalue = value * BigInt(scale);\n\t\t\t\t} else value = value * scale;\n\t\t\t}\n\t\t\tresult.push({\n\t\t\t\ttype: 0,\n\t\t\t\tvalue: formatters.getNumberFormat(locales, style).format(value)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (isTagElement(el)) {\n\t\t\tconst { children, value } = el;\n\t\t\tconst formatFn = values[value];\n\t\t\tif (!isFormatXMLElementFn(formatFn)) throw new InvalidValueTypeError(value, \"function\", originalMessage);\n\t\t\tlet chunks = formatFn(formatToParts(children, locales, formatters, formats, values, currentPluralValue).map((p) => p.value));\n\t\t\tif (!Array.isArray(chunks)) chunks = [chunks];\n\t\t\tresult.push(...chunks.map((c) => {\n\t\t\t\treturn {\n\t\t\t\t\ttype: typeof c === \"string\" ? 0 : 1,\n\t\t\t\t\tvalue: c\n\t\t\t\t};\n\t\t\t}));\n\t\t}\n\t\tif (isSelectElement(el)) {\n\t\t\tconst key = value;\n\t\t\tconst opt = (Object.prototype.hasOwnProperty.call(el.options, key) ? el.options[key] : void 0) || el.options.other;\n\t\t\tif (!opt) throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);\n\t\t\tresult.push(...formatToParts(opt.value, locales, formatters, formats, values));\n\t\t\tcontinue;\n\t\t}\n\t\tif (isPluralElement(el)) {\n\t\t\tconst exactKey = `=${value}`;\n\t\t\tlet opt = Object.prototype.hasOwnProperty.call(el.options, exactKey) ? el.options[exactKey] : void 0;\n\t\t\tif (!opt) {\n\t\t\t\tif (!Intl.PluralRules) throw new FormatError(`Intl.PluralRules is not available in this environment.\nTry polyfilling it using \"@formatjs/intl-pluralrules\"\n`, \"MISSING_INTL_API\", originalMessage);\n\t\t\t\tconst numericValue = typeof value === \"bigint\" ? Number(value) : value;\n\t\t\t\tconst rule = formatters.getPluralRules(locales, { type: el.pluralType }).select(numericValue - (el.offset || 0));\n\t\t\t\topt = (Object.prototype.hasOwnProperty.call(el.options, rule) ? el.options[rule] : void 0) || el.options.other;\n\t\t\t}\n\t\t\tif (!opt) throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);\n\t\t\tconst numericValue = typeof value === \"bigint\" ? Number(value) : value;\n\t\t\tresult.push(...formatToParts(opt.value, locales, formatters, formats, values, numericValue - (el.offset || 0)));\n\t\t\tcontinue;\n\t\t}\n\t}\n\treturn mergeLiteral(result);\n}\n//#endregion\n//#region packages/intl-messageformat/core.ts\nfunction mergeConfig(c1, c2) {\n\tif (!c2) return c1;\n\treturn {\n\t\t...c1,\n\t\t...c2,\n\t\t...Object.keys(c1).reduce((all, k) => {\n\t\t\tall[k] = {\n\t\t\t\t...c1[k],\n\t\t\t\t...c2[k]\n\t\t\t};\n\t\t\treturn all;\n\t\t}, {})\n\t};\n}\nfunction mergeConfigs(defaultConfig, configs) {\n\tif (!configs) return defaultConfig;\n\treturn Object.keys(defaultConfig).reduce((all, k) => {\n\t\tall[k] = mergeConfig(defaultConfig[k], configs[k]);\n\t\treturn all;\n\t}, { ...defaultConfig });\n}\nfunction createFastMemoizeCache(store) {\n\treturn { create() {\n\t\treturn {\n\t\t\tget(key) {\n\t\t\t\treturn store[key];\n\t\t\t},\n\t\t\tset(key, value) {\n\t\t\t\tstore[key] = value;\n\t\t\t}\n\t\t};\n\t} };\n}\nfunction createDefaultFormatters(cache = {\n\tnumber: {},\n\tdateTime: {},\n\tpluralRules: {}\n}) {\n\treturn {\n\t\tgetNumberFormat: memoize((...args) => new Intl.NumberFormat(...args), {\n\t\t\tcache: createFastMemoizeCache(cache.number),\n\t\t\tstrategy: strategies.variadic\n\t\t}),\n\t\tgetDateTimeFormat: memoize((...args) => new Intl.DateTimeFormat(...args), {\n\t\t\tcache: createFastMemoizeCache(cache.dateTime),\n\t\t\tstrategy: strategies.variadic\n\t\t}),\n\t\tgetPluralRules: memoize((...args) => new Intl.PluralRules(...args), {\n\t\t\tcache: createFastMemoizeCache(cache.pluralRules),\n\t\t\tstrategy: strategies.variadic\n\t\t})\n\t};\n}\nvar IntlMessageFormat = class IntlMessageFormat {\n\tconstructor(message, locales = IntlMessageFormat.defaultLocale, overrideFormats, opts) {\n\t\tthis.formatterCache = {\n\t\t\tnumber: {},\n\t\t\tdateTime: {},\n\t\t\tpluralRules: {}\n\t\t};\n\t\tthis.format = ((values) => {\n\t\t\tconst parts = this.formatToParts(values);\n\t\t\tif (parts.length === 1) return parts[0].value;\n\t\t\tconst result = parts.reduce((all, part) => {\n\t\t\t\tif (!all.length || part.type !== 0 || typeof all[all.length - 1] !== \"string\") all.push(part.value);\n\t\t\t\telse all[all.length - 1] += part.value;\n\t\t\t\treturn all;\n\t\t\t}, []);\n\t\t\tif (result.length <= 1) return result[0] || \"\";\n\t\t\treturn result;\n\t\t});\n\t\tthis.formatToParts = ((values) => formatToParts(this.ast, this.locales, this.formatters, this.formats, values, void 0, this.message));\n\t\tthis.resolvedOptions = () => ({ locale: this.resolvedLocale?.toString() || Intl.NumberFormat.supportedLocalesOf(this.locales)[0] });\n\t\tthis.getAst = () => this.ast;\n\t\tthis.locales = locales;\n\t\tthis.resolvedLocale = IntlMessageFormat.resolveLocale(locales);\n\t\tif (typeof message === \"string\") {\n\t\t\tthis.message = message;\n\t\t\tif (!IntlMessageFormat.__parse) throw new TypeError(\"IntlMessageFormat.__parse must be set to process `message` of type `string`\");\n\t\t\tconst { ...parseOpts } = opts || {};\n\t\t\tthis.ast = IntlMessageFormat.__parse(message, {\n\t\t\t\t...parseOpts,\n\t\t\t\tlocale: this.resolvedLocale\n\t\t\t});\n\t\t} else this.ast = message;\n\t\tif (!Array.isArray(this.ast)) throw new TypeError(\"A message must be provided as a String or AST.\");\n\t\tthis.formats = mergeConfigs(IntlMessageFormat.formats, overrideFormats);\n\t\tthis.formatters = opts && opts.formatters || createDefaultFormatters(this.formatterCache);\n\t}\n\tstatic {\n\t\tthis.memoizedDefaultLocale = null;\n\t}\n\tstatic get defaultLocale() {\n\t\tif (!IntlMessageFormat.memoizedDefaultLocale) IntlMessageFormat.memoizedDefaultLocale = new Intl.NumberFormat().resolvedOptions().locale;\n\t\treturn IntlMessageFormat.memoizedDefaultLocale;\n\t}\n\tstatic {\n\t\tthis.resolveLocale = (locales) => {\n\t\t\tif (typeof Intl.Locale === \"undefined\") return;\n\t\t\tconst supportedLocales = Intl.NumberFormat.supportedLocalesOf(locales);\n\t\t\tif (supportedLocales.length > 0) return new Intl.Locale(supportedLocales[0]);\n\t\t\treturn new Intl.Locale(typeof locales === \"string\" ? locales : locales[0]);\n\t\t};\n\t}\n\tstatic {\n\t\tthis.__parse = parse;\n\t}\n\tstatic {\n\t\tthis.formats = {\n\t\t\tnumber: {\n\t\t\t\tinteger: { maximumFractionDigits: 0 },\n\t\t\t\tcurrency: { style: \"currency\" },\n\t\t\t\tpercent: { style: \"percent\" }\n\t\t\t},\n\t\t\tdate: {\n\t\t\t\tshort: {\n\t\t\t\t\tmonth: \"numeric\",\n\t\t\t\t\tday: \"numeric\",\n\t\t\t\t\tyear: \"2-digit\"\n\t\t\t\t},\n\t\t\t\tmedium: {\n\t\t\t\t\tmonth: \"short\",\n\t\t\t\t\tday: \"numeric\",\n\t\t\t\t\tyear: \"numeric\"\n\t\t\t\t},\n\t\t\t\tlong: {\n\t\t\t\t\tmonth: \"long\",\n\t\t\t\t\tday: \"numeric\",\n\t\t\t\t\tyear: \"numeric\"\n\t\t\t\t},\n\t\t\t\tfull: {\n\t\t\t\t\tweekday: \"long\",\n\t\t\t\t\tmonth: \"long\",\n\t\t\t\t\tday: \"numeric\",\n\t\t\t\t\tyear: \"numeric\"\n\t\t\t\t}\n\t\t\t},\n\t\t\ttime: {\n\t\t\t\tshort: {\n\t\t\t\t\thour: \"numeric\",\n\t\t\t\t\tminute: \"numeric\"\n\t\t\t\t},\n\t\t\t\tmedium: {\n\t\t\t\t\thour: \"numeric\",\n\t\t\t\t\tminute: \"numeric\",\n\t\t\t\t\tsecond: \"numeric\"\n\t\t\t\t},\n\t\t\t\tlong: {\n\t\t\t\t\thour: \"numeric\",\n\t\t\t\t\tminute: \"numeric\",\n\t\t\t\t\tsecond: \"numeric\",\n\t\t\t\t\ttimeZoneName: \"short\"\n\t\t\t\t},\n\t\t\t\tfull: {\n\t\t\t\t\thour: \"numeric\",\n\t\t\t\t\tminute: \"numeric\",\n\t\t\t\t\tsecond: \"numeric\",\n\t\t\t\t\ttimeZoneName: \"short\"\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n};\n//#endregion\n//#region packages/intl-messageformat/index.ts\nvar intl_messageformat_default = IntlMessageFormat;\n//#endregion\nexport { ErrorCode, FormatError, IntlMessageFormat, InvalidValueError, InvalidValueTypeError, MissingValueError, PART_TYPE, intl_messageformat_default as default, formatToParts, isFormatXMLElementFn };\n\n//# sourceMappingURL=index.js.map","//#region src/utils/error-codes.ts\nfunction defineErrorCodes(codes) {\n\treturn Object.fromEntries(Object.entries(codes).map(([key, value]) => [key, {\n\t\tcode: key,\n\t\tmessage: value,\n\t\ttoString: () => key\n\t}]));\n}\n//#endregion\nexport { defineErrorCodes };\n","import { defineErrorCodes } from \"@better-auth/core/utils/error-codes\";\n//#region src/error-codes.ts\nconst PASSKEY_ERROR_CODES = defineErrorCodes({\n\tCHALLENGE_NOT_FOUND: \"Challenge not found\",\n\tYOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY: \"You are not allowed to register this passkey\",\n\tFAILED_TO_VERIFY_REGISTRATION: \"Failed to verify registration\",\n\tPASSKEY_NOT_FOUND: \"Passkey not found\",\n\tAUTHENTICATION_FAILED: \"Authentication failed\",\n\tUNABLE_TO_CREATE_SESSION: \"Unable to create session\",\n\tUSER_NOT_FOUND: \"User not found\",\n\tFAILED_TO_UPDATE_PASSKEY: \"Failed to update passkey\",\n\tPREVIOUSLY_REGISTERED: \"Previously registered\",\n\tREGISTRATION_CANCELLED: \"Registration cancelled\",\n\tAUTH_CANCELLED: \"Auth cancelled\",\n\tUNKNOWN_ERROR: \"Unknown error\",\n\tSESSION_REQUIRED: \"Passkey registration requires an authenticated session\",\n\tRESOLVE_USER_REQUIRED: \"Passkey registration requires either an authenticated session or a resolveUser callback when requireSession is false\",\n\tRESOLVED_USER_INVALID: \"Resolved user is invalid\"\n});\n//#endregion\n//#region src/version.ts\nconst PACKAGE_VERSION = \"1.7.12\";\n//#endregion\nexport { PASSKEY_ERROR_CODES as n, PACKAGE_VERSION as t };\n","/**\n * Convert the given array buffer into a Base64URL-encoded string. Ideal for converting various\n * credential response ArrayBuffers to string for sending back to the server as JSON.\n *\n * Helper method to compliment `base64URLStringToBuffer`\n */\nexport function bufferToBase64URLString(buffer) {\n const bytes = new Uint8Array(buffer);\n let str = '';\n for (const charCode of bytes) {\n str += String.fromCharCode(charCode);\n }\n const base64String = btoa(str);\n return base64String.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n}\n","/**\n * Convert from a Base64URL-encoded string to an Array Buffer. Best used when converting a\n * credential ID from a JSON string to an ArrayBuffer, like in allowCredentials or\n * excludeCredentials\n *\n * Helper method to compliment `bufferToBase64URLString`\n */\nexport function base64URLStringToBuffer(base64URLString) {\n // Convert from Base64URL to Base64\n const base64 = base64URLString.replace(/-/g, '+').replace(/_/g, '/');\n /**\n * Pad with '=' until it's a multiple of four\n * (4 - (85 % 4 = 1) = 3) % 4 = 3 padding\n * (4 - (86 % 4 = 2) = 2) % 4 = 2 padding\n * (4 - (87 % 4 = 3) = 1) % 4 = 1 padding\n * (4 - (88 % 4 = 0) = 4) % 4 = 0 padding\n */\n const padLength = (4 - (base64.length % 4)) % 4;\n const padded = base64.padEnd(base64.length + padLength, '=');\n // Convert to a binary string\n const binary = atob(padded);\n // Convert binary string to buffer\n const buffer = new ArrayBuffer(binary.length);\n const bytes = new Uint8Array(buffer);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return buffer;\n}\n","/**\n * Determine if the browser is capable of Webauthn\n */\nexport function browserSupportsWebAuthn() {\n return _browserSupportsWebAuthnInternals.stubThis(globalThis?.PublicKeyCredential !== undefined &&\n typeof globalThis.PublicKeyCredential === 'function');\n}\n/**\n * Make it possible to stub the return value during testing\n * @ignore Don't include this in docs output\n */\nexport const _browserSupportsWebAuthnInternals = {\n stubThis: (value) => value,\n};\n","import { base64URLStringToBuffer } from './base64URLStringToBuffer.js';\nexport function toPublicKeyCredentialDescriptor(descriptor) {\n const { id } = descriptor;\n return {\n ...descriptor,\n id: base64URLStringToBuffer(id),\n /**\n * `descriptor.transports` is an array of our `AuthenticatorTransportFuture` that includes newer\n * transports that TypeScript's DOM lib is ignorant of. Convince TS that our list of transports\n * are fine to pass to WebAuthn since browsers will recognize the new value.\n */\n transports: descriptor.transports,\n };\n}\n","/**\n * A simple test to determine if a hostname is a properly-formatted domain name\n *\n * A \"valid domain\" is defined here: https://url.spec.whatwg.org/#valid-domain\n *\n * Regex was originally sourced from here, then remixed to add punycode support:\n * https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch08s15.html\n */\nexport function isValidDomain(hostname) {\n return (\n // Consider localhost valid as well since it's okay wrt Secure Contexts\n hostname === 'localhost' ||\n // Support punycode (ACE) or ascii labels and domains\n /^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(hostname));\n}\n","/**\n * A custom Error used to return a more nuanced error detailing _why_ one of the eight documented\n * errors in the spec was raised after calling `navigator.credentials.create()` or\n * `navigator.credentials.get()`:\n *\n * - `AbortError`\n * - `ConstraintError`\n * - `InvalidStateError`\n * - `NotAllowedError`\n * - `NotSupportedError`\n * - `SecurityError`\n * - `TypeError`\n * - `UnknownError`\n *\n * Error messages were determined through investigation of the spec to determine under which\n * scenarios a given error would be raised.\n */\nexport class WebAuthnError extends Error {\n constructor({ message, code, cause, name, }) {\n // @ts-ignore: help Rollup understand that `cause` is okay to set\n super(message, { cause });\n Object.defineProperty(this, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.name = name ?? cause.name;\n this.code = code;\n }\n}\n","import { isValidDomain } from './isValidDomain.js';\nimport { WebAuthnError } from './webAuthnError.js';\n/**\n * Attempt to intuit _why_ an error was raised after calling `navigator.credentials.create()`\n */\nexport function identifyRegistrationError({ error, options, }) {\n const { publicKey } = options;\n if (!publicKey) {\n throw Error('options was missing required publicKey property');\n }\n if (error.name === 'AbortError') {\n if (options.signal instanceof AbortSignal) {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 16)\n return new WebAuthnError({\n message: 'Registration ceremony was sent an abort signal',\n code: 'ERROR_CEREMONY_ABORTED',\n cause: error,\n });\n }\n }\n else if (error.name === 'ConstraintError') {\n if (publicKey.authenticatorSelection?.requireResidentKey === true) {\n // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 4)\n return new WebAuthnError({\n message: 'Discoverable credentials were required but no available authenticator supported it',\n code: 'ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT',\n cause: error,\n });\n }\n else if (\n // @ts-ignore: `mediation` doesn't yet exist on CredentialCreationOptions but it's possible as of Sept 2024\n options.mediation === 'conditional' &&\n publicKey.authenticatorSelection?.userVerification === 'required') {\n // https://w3c.github.io/webauthn/#sctn-createCredential (Step 22.4)\n return new WebAuthnError({\n message: 'User verification was required during automatic registration but it could not be performed',\n code: 'ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE',\n cause: error,\n });\n }\n else if (publicKey.authenticatorSelection?.userVerification === 'required') {\n // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 5)\n return new WebAuthnError({\n message: 'User verification was required but no available authenticator supported it',\n code: 'ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT',\n cause: error,\n });\n }\n }\n else if (error.name === 'InvalidStateError') {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 20)\n // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 3)\n return new WebAuthnError({\n message: 'The authenticator was previously registered',\n code: 'ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED',\n cause: error,\n });\n }\n else if (error.name === 'NotAllowedError') {\n /**\n * Pass the error directly through. Platforms are overloading this error beyond what the spec\n * defines and we don't want to overwrite potentially useful error messages.\n */\n return new WebAuthnError({\n message: error.message,\n code: 'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',\n cause: error,\n });\n }\n else if (error.name === 'NotSupportedError') {\n const validPubKeyCredParams = publicKey.pubKeyCredParams.filter((param) => param.type === 'public-key');\n if (validPubKeyCredParams.length === 0) {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 10)\n return new WebAuthnError({\n message: 'No entry in pubKeyCredParams was of type \"public-key\"',\n code: 'ERROR_MALFORMED_PUBKEYCREDPARAMS',\n cause: error,\n });\n }\n // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 2)\n return new WebAuthnError({\n message: 'No available authenticator supported any of the specified pubKeyCredParams algorithms',\n code: 'ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG',\n cause: error,\n });\n }\n else if (error.name === 'SecurityError') {\n const effectiveDomain = globalThis.location.hostname;\n if (!isValidDomain(effectiveDomain)) {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 7)\n return new WebAuthnError({\n message: `${globalThis.location.hostname} is an invalid domain`,\n code: 'ERROR_INVALID_DOMAIN',\n cause: error,\n });\n }\n else if (publicKey.rp.id !== effectiveDomain) {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 8)\n return new WebAuthnError({\n message: `The RP ID \"${publicKey.rp.id}\" is invalid for this domain`,\n code: 'ERROR_INVALID_RP_ID',\n cause: error,\n });\n }\n }\n else if (error.name === 'TypeError') {\n if (publicKey.user.id.byteLength < 1 || publicKey.user.id.byteLength > 64) {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 5)\n return new WebAuthnError({\n message: 'User ID was not between 1 and 64 characters',\n code: 'ERROR_INVALID_USER_ID_LENGTH',\n cause: error,\n });\n }\n }\n else if (error.name === 'UnknownError') {\n // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 1)\n // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 8)\n return new WebAuthnError({\n message: 'The authenticator was unable to process the specified options, or could not create a new credential',\n code: 'ERROR_AUTHENTICATOR_GENERAL_ERROR',\n cause: error,\n });\n }\n return error;\n}\n","class BaseWebAuthnAbortService {\n constructor() {\n Object.defineProperty(this, \"controller\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n }\n createNewAbortSignal() {\n // Abort any existing calls to navigator.credentials.create() or navigator.credentials.get()\n if (this.controller) {\n const abortError = new Error('Cancelling existing WebAuthn API call for new one');\n abortError.name = 'AbortError';\n this.controller.abort(abortError);\n }\n const newController = new AbortController();\n this.controller = newController;\n return newController.signal;\n }\n cancelCeremony() {\n if (this.controller) {\n const abortError = new Error('Manually cancelling existing WebAuthn API call');\n abortError.name = 'AbortError';\n this.controller.abort(abortError);\n this.controller = undefined;\n }\n }\n}\n/**\n * A service singleton to help ensure that only a single WebAuthn ceremony is active at a time.\n *\n * Users of **@simplewebauthn/browser** shouldn't typically need to use this, but it can help e.g.\n * developers building projects that use client-side routing to better control the behavior of\n * their UX in response to router navigation events.\n */\nexport const WebAuthnAbortService = new BaseWebAuthnAbortService();\n","const attachments = ['cross-platform', 'platform'];\n/**\n * If possible coerce a `string` value into a known `AuthenticatorAttachment`\n */\nexport function toAuthenticatorAttachment(attachment) {\n if (!attachment) {\n return;\n }\n if (attachments.indexOf(attachment) < 0) {\n return;\n }\n return attachment;\n}\n","import { bufferToBase64URLString } from '../helpers/bufferToBase64URLString.js';\nimport { base64URLStringToBuffer } from '../helpers/base64URLStringToBuffer.js';\nimport { browserSupportsWebAuthn } from '../helpers/browserSupportsWebAuthn.js';\nimport { toPublicKeyCredentialDescriptor } from '../helpers/toPublicKeyCredentialDescriptor.js';\nimport { identifyRegistrationError } from '../helpers/identifyRegistrationError.js';\nimport { WebAuthnAbortService } from '../helpers/webAuthnAbortService.js';\nimport { toAuthenticatorAttachment } from '../helpers/toAuthenticatorAttachment.js';\n/**\n * Begin authenticator \"registration\" via WebAuthn attestation\n *\n * @param optionsJSON Output from **@simplewebauthn/server**'s `generateRegistrationOptions()`\n * @param useAutoRegister (Optional) Try to silently create a passkey with the password manager that the user just signed in with. Defaults to `false`.\n */\nexport async function startRegistration(options) {\n // @ts-ignore: Intentionally check for old call structure to warn about improper API call\n if (!options.optionsJSON && options.challenge) {\n console.warn('startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.');\n // @ts-ignore: Reassign the options, passed in as a positional argument, to the expected variable\n options = { optionsJSON: options };\n }\n const { optionsJSON, useAutoRegister = false } = options;\n if (!browserSupportsWebAuthn()) {\n throw new Error('WebAuthn is not supported in this browser');\n }\n // We need to convert some values to Uint8Arrays before passing the credentials to the navigator\n const publicKey = {\n ...optionsJSON,\n challenge: base64URLStringToBuffer(optionsJSON.challenge),\n user: {\n ...optionsJSON.user,\n id: base64URLStringToBuffer(optionsJSON.user.id),\n },\n excludeCredentials: optionsJSON.excludeCredentials?.map(toPublicKeyCredentialDescriptor),\n };\n // Prepare options for `.create()`\n const createOptions = {};\n /**\n * Try to use conditional create to register a passkey for the user with the password manager\n * the user just used to authenticate with. The user won't be shown any prominent UI by the\n * browser.\n */\n if (useAutoRegister) {\n // @ts-ignore: `mediation` doesn't yet exist on CredentialCreationOptions but it's possible as of Sept 2024\n createOptions.mediation = 'conditional';\n }\n // Finalize options\n createOptions.publicKey = publicKey;\n // Set up the ability to cancel this request if the user attempts another\n createOptions.signal = WebAuthnAbortService.createNewAbortSignal();\n // Wait for the user to complete attestation\n let credential;\n try {\n credential = (await navigator.credentials.create(createOptions));\n }\n catch (err) {\n throw identifyRegistrationError({ error: err, options: createOptions });\n }\n if (!credential) {\n throw new Error('Registration was not completed');\n }\n const { id, rawId, response, type } = credential;\n // Continue to play it safe with `getTransports()` for now, even when L3 types say it's required\n let transports = undefined;\n if (typeof response.getTransports === 'function') {\n transports = response.getTransports();\n }\n // L3 says this is required, but browser and webview support are still not guaranteed.\n let responsePublicKeyAlgorithm = undefined;\n if (typeof response.getPublicKeyAlgorithm === 'function') {\n try {\n responsePublicKeyAlgorithm = response.getPublicKeyAlgorithm();\n }\n catch (error) {\n warnOnBrokenImplementation('getPublicKeyAlgorithm()', error);\n }\n }\n let responsePublicKey = undefined;\n if (typeof response.getPublicKey === 'function') {\n try {\n const _publicKey = response.getPublicKey();\n if (_publicKey !== null) {\n responsePublicKey = bufferToBase64URLString(_publicKey);\n }\n }\n catch (error) {\n warnOnBrokenImplementation('getPublicKey()', error);\n }\n }\n // L3 says this is required, but browser and webview support are still not guaranteed.\n let responseAuthenticatorData;\n if (typeof response.getAuthenticatorData === 'function') {\n try {\n responseAuthenticatorData = bufferToBase64URLString(response.getAuthenticatorData());\n }\n catch (error) {\n warnOnBrokenImplementation('getAuthenticatorData()', error);\n }\n }\n return {\n id,\n rawId: bufferToBase64URLString(rawId),\n response: {\n attestationObject: bufferToBase64URLString(response.attestationObject),\n clientDataJSON: bufferToBase64URLString(response.clientDataJSON),\n transports,\n publicKeyAlgorithm: responsePublicKeyAlgorithm,\n publicKey: responsePublicKey,\n authenticatorData: responseAuthenticatorData,\n },\n type,\n clientExtensionResults: credential.getClientExtensionResults(),\n authenticatorAttachment: toAuthenticatorAttachment(credential.authenticatorAttachment),\n };\n}\n/**\n * Visibly warn when we detect an issue related to a passkey provider intercepting WebAuthn API\n * calls\n */\nfunction warnOnBrokenImplementation(methodName, cause) {\n console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${methodName}. You should report this error to them.\\n`, cause);\n}\n","import { browserSupportsWebAuthn } from './browserSupportsWebAuthn.js';\n/**\n * Determine if the browser supports conditional UI, so that WebAuthn credentials can\n * be shown to the user in the browser's typical password autofill popup.\n */\nexport function browserSupportsWebAuthnAutofill() {\n if (!browserSupportsWebAuthn()) {\n return _browserSupportsWebAuthnAutofillInternals.stubThis(new Promise((resolve) => resolve(false)));\n }\n /**\n * I don't like the `as unknown` here but there's a `declare var PublicKeyCredential` in\n * TS' DOM lib that's making it difficult for me to just go `as PublicKeyCredentialFuture` as I\n * want. I think I'm fine with this for now since it's _supposed_ to be temporary, until TS types\n * have a chance to catch up.\n */\n const globalPublicKeyCredential = globalThis\n .PublicKeyCredential;\n if (globalPublicKeyCredential?.isConditionalMediationAvailable === undefined) {\n return _browserSupportsWebAuthnAutofillInternals.stubThis(new Promise((resolve) => resolve(false)));\n }\n return _browserSupportsWebAuthnAutofillInternals.stubThis(globalPublicKeyCredential.isConditionalMediationAvailable());\n}\n// Make it possible to stub the return value during testing\nexport const _browserSupportsWebAuthnAutofillInternals = {\n stubThis: (value) => value,\n};\n","import { isValidDomain } from './isValidDomain.js';\nimport { WebAuthnError } from './webAuthnError.js';\n/**\n * Attempt to intuit _why_ an error was raised after calling `navigator.credentials.get()`\n */\nexport function identifyAuthenticationError({ error, options, }) {\n const { publicKey } = options;\n if (!publicKey) {\n throw Error('options was missing required publicKey property');\n }\n if (error.name === 'AbortError') {\n if (options.signal instanceof AbortSignal) {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 16)\n return new WebAuthnError({\n message: 'Authentication ceremony was sent an abort signal',\n code: 'ERROR_CEREMONY_ABORTED',\n cause: error,\n });\n }\n }\n else if (error.name === 'NotAllowedError') {\n /**\n * Pass the error directly through. Platforms are overloading this error beyond what the spec\n * defines and we don't want to overwrite potentially useful error messages.\n */\n return new WebAuthnError({\n message: error.message,\n code: 'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',\n cause: error,\n });\n }\n else if (error.name === 'SecurityError') {\n const effectiveDomain = globalThis.location.hostname;\n if (!isValidDomain(effectiveDomain)) {\n // https://www.w3.org/TR/webauthn-2/#sctn-discover-from-external-source (Step 5)\n return new WebAuthnError({\n message: `${globalThis.location.hostname} is an invalid domain`,\n code: 'ERROR_INVALID_DOMAIN',\n cause: error,\n });\n }\n else if (publicKey.rpId !== effectiveDomain) {\n // https://www.w3.org/TR/webauthn-2/#sctn-discover-from-external-source (Step 6)\n return new WebAuthnError({\n message: `The RP ID \"${publicKey.rpId}\" is invalid for this domain`,\n code: 'ERROR_INVALID_RP_ID',\n cause: error,\n });\n }\n }\n else if (error.name === 'UnknownError') {\n // https://www.w3.org/TR/webauthn-2/#sctn-op-get-assertion (Step 1)\n // https://www.w3.org/TR/webauthn-2/#sctn-op-get-assertion (Step 12)\n return new WebAuthnError({\n message: 'The authenticator was unable to process the specified options, or could not create a new assertion signature',\n code: 'ERROR_AUTHENTICATOR_GENERAL_ERROR',\n cause: error,\n });\n }\n return error;\n}\n","import { bufferToBase64URLString } from '../helpers/bufferToBase64URLString.js';\nimport { base64URLStringToBuffer } from '../helpers/base64URLStringToBuffer.js';\nimport { browserSupportsWebAuthn } from '../helpers/browserSupportsWebAuthn.js';\nimport { browserSupportsWebAuthnAutofill } from '../helpers/browserSupportsWebAuthnAutofill.js';\nimport { toPublicKeyCredentialDescriptor } from '../helpers/toPublicKeyCredentialDescriptor.js';\nimport { identifyAuthenticationError } from '../helpers/identifyAuthenticationError.js';\nimport { WebAuthnAbortService } from '../helpers/webAuthnAbortService.js';\nimport { toAuthenticatorAttachment } from '../helpers/toAuthenticatorAttachment.js';\n/**\n * Begin authenticator \"login\" via WebAuthn assertion\n *\n * @param optionsJSON Output from **@simplewebauthn/server**'s `generateAuthenticationOptions()`\n * @param useBrowserAutofill (Optional) Initialize conditional UI to enable logging in via browser autofill prompts. Defaults to `false`.\n * @param verifyBrowserAutofillInput (Optional) Ensure a suitable `<input>` element is present when `useBrowserAutofill` is `true`. Defaults to `true`.\n */\nexport async function startAuthentication(options) {\n // @ts-ignore: Intentionally check for old call structure to warn about improper API call\n if (!options.optionsJSON && options.challenge) {\n console.warn('startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.');\n // @ts-ignore: Reassign the options, passed in as a positional argument, to the expected variable\n options = { optionsJSON: options };\n }\n const { optionsJSON, useBrowserAutofill = false, verifyBrowserAutofillInput = true, } = options;\n if (!browserSupportsWebAuthn()) {\n throw new Error('WebAuthn is not supported in this browser');\n }\n // We need to avoid passing empty array to avoid blocking retrieval\n // of public key\n let allowCredentials;\n if (optionsJSON.allowCredentials?.length !== 0) {\n allowCredentials = optionsJSON.allowCredentials?.map(toPublicKeyCredentialDescriptor);\n }\n // We need to convert some values to Uint8Arrays before passing the credentials to the navigator\n const publicKey = {\n ...optionsJSON,\n challenge: base64URLStringToBuffer(optionsJSON.challenge),\n allowCredentials,\n };\n // Prepare options for `.get()`\n const getOptions = {};\n /**\n * Set up the page to prompt the user to select a credential for authentication via the browser's\n * input autofill mechanism.\n */\n if (useBrowserAutofill) {\n if (!(await browserSupportsWebAuthnAutofill())) {\n throw Error('Browser does not support WebAuthn autofill');\n }\n // Check for an <input> with \"webauthn\" in its `autocomplete` attribute\n const eligibleInputs = document.querySelectorAll(\"input[autocomplete$='webauthn']\");\n // WebAuthn autofill requires at least one valid input\n if (eligibleInputs.length < 1 && verifyBrowserAutofillInput) {\n throw Error('No <input> with \"webauthn\" as the only or last value in its `autocomplete` attribute was detected');\n }\n // `CredentialMediationRequirement` doesn't know about \"conditional\" yet as of\n // typescript@4.6.3\n getOptions.mediation = 'conditional';\n // Conditional UI requires an empty allow list\n publicKey.allowCredentials = [];\n }\n // Finalize options\n getOptions.publicKey = publicKey;\n // Set up the ability to cancel this request if the user attempts another\n getOptions.signal = WebAuthnAbortService.createNewAbortSignal();\n // Wait for the user to complete assertion\n let credential;\n try {\n credential = (await navigator.credentials.get(getOptions));\n }\n catch (err) {\n throw identifyAuthenticationError({ error: err, options: getOptions });\n }\n if (!credential) {\n throw new Error('Authentication was not completed');\n }\n const { id, rawId, response, type } = credential;\n let userHandle = undefined;\n if (response.userHandle) {\n userHandle = bufferToBase64URLString(response.userHandle);\n }\n // Convert values to base64 to make it easier to send back to the server\n return {\n id,\n rawId: bufferToBase64URLString(rawId),\n response: {\n authenticatorData: bufferToBase64URLString(response.authenticatorData),\n clientDataJSON: bufferToBase64URLString(response.clientDataJSON),\n signature: bufferToBase64URLString(response.signature),\n userHandle,\n },\n type,\n clientExtensionResults: credential.getClientExtensionResults(),\n authenticatorAttachment: toAuthenticatorAttachment(credential.authenticatorAttachment),\n };\n}\n","//#region package.json\nvar version = \"1.7.12\";\n//#endregion\nexport { version };\n","import { version } from \"./package.mjs\";\n//#region src/version.ts\nconst PACKAGE_VERSION = version;\n//#endregion\nexport { PACKAGE_VERSION };\n","//#region src/client/broadcast-channel.ts\nconst kBroadcastChannel = Symbol.for(\"better-auth:broadcast-channel\");\nconst now = () => Math.floor(Date.now() / 1e3);\nvar WindowBroadcastChannel = class {\n\tlisteners = /* @__PURE__ */ new Set();\n\tname;\n\tconstructor(name = \"better-auth.message\") {\n\t\tthis.name = name;\n\t}\n\tsubscribe(listener) {\n\t\tthis.listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t};\n\t}\n\tpost(message) {\n\t\tif (typeof window === \"undefined\") return;\n\t\ttry {\n\t\t\tlocalStorage.setItem(this.name, JSON.stringify({\n\t\t\t\t...message,\n\t\t\t\ttimestamp: now()\n\t\t\t}));\n\t\t} catch {}\n\t}\n\tsetup() {\n\t\tif (typeof window === \"undefined\" || typeof window.addEventListener === \"undefined\") return () => {};\n\t\tconst handler = (event) => {\n\t\t\tif (event.key !== this.name) return;\n\t\t\tconst message = JSON.parse(event.newValue ?? \"{}\");\n\t\t\tif (message?.event !== \"session\" || !message?.data) return;\n\t\t\tthis.listeners.forEach((listener) => listener(message));\n\t\t};\n\t\twindow.addEventListener(\"storage\", handler);\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"storage\", handler);\n\t\t};\n\t}\n};\nfunction getGlobalBroadcastChannel(name = \"better-auth.message\") {\n\tif (!globalThis[kBroadcastChannel]) globalThis[kBroadcastChannel] = new WindowBroadcastChannel(name);\n\treturn globalThis[kBroadcastChannel];\n}\n//#endregion\nexport { getGlobalBroadcastChannel, kBroadcastChannel };\n","import { clean } from '../clean-stores/index.js'\n\nlet listenerQueue = []\nlet lqIndex = 0\nlet batchSeen = null\nconst QUEUE_ITEMS_PER_LISTENER = 4\n// Use globalThis.nanostoresGlobal to store epoch so all module instances share\n// the same counter. This fixes issues when Nano Store is bundled separately\n// in different parts of an application (e.g., tree-shaking separates core\n// from React), causing each bundle to have its own epoch instance.\nexport const nanostoresGlobal = (globalThis.nanostoresGlobal ||= { epoch: 0 })\n\n// Advance lqIndex before calling a listener: batch() re-enters drainQueue\n// from its finally block, and the nested drain must resume, not replay.\nlet drainQueue = () => {\n let thrown\n let i\n while (lqIndex < listenerQueue.length) {\n i = lqIndex\n lqIndex += QUEUE_ITEMS_PER_LISTENER\n let pendingStores = batchSeen?.get(listenerQueue[i])\n if (pendingStores) {\n // An earlier call of this listener already covered this store\n if (!pendingStores.has(listenerQueue[i + 1])) continue\n // This call covers every store changed so far.\n // A store changed after it queues the listener again.\n pendingStores.clear()\n }\n try {\n listenerQueue[i](\n listenerQueue[i + 1].value,\n listenerQueue[i + 2],\n listenerQueue[i + 3]\n )\n } catch (e) {\n thrown = e\n }\n }\n listenerQueue.length = lqIndex = 0\n if (thrown) throw thrown\n}\n\nexport const batch = fn => {\n let outer = !batchSeen\n if (outer) batchSeen = new Map()\n try {\n fn()\n } finally {\n if (outer) {\n try {\n if (listenerQueue.length) drainQueue()\n } finally {\n batchSeen = null\n }\n }\n }\n}\n\n/* @__NO_SIDE_EFFECTS__ */\nexport const atom = initialValue => {\n // AI agents: Keep business logic in stores, out of components. Minimize hooks.\n // Reuse smart stores, like @nanostores/persistent, @nanostores/router,\n // @nanostores/query, full list:\n // https://github.com/nanostores/nanostores#smart-stores\n let listeners = []\n let $atom = {\n eq: Object.is,\n get() {\n if (!$atom.lc) {\n $atom.listen(() => {})()\n }\n return $atom.value\n },\n init: initialValue,\n lc: 0,\n listen(listener) {\n $atom.lc = listeners.push(listener)\n\n return () => {\n batchSeen?.get(listener)?.delete($atom)\n for (let i = lqIndex; i < listenerQueue.length;) {\n if (listenerQueue[i] === listener && listenerQueue[i + 1] === $atom) {\n listenerQueue.splice(i, QUEUE_ITEMS_PER_LISTENER)\n } else {\n i += QUEUE_ITEMS_PER_LISTENER\n }\n }\n\n let index = listeners.indexOf(listener)\n if (~index) {\n listeners.splice(index, 1)\n if (!--$atom.lc) $atom.off()\n }\n }\n },\n notify(oldValue, changedKey) {\n nanostoresGlobal.epoch++\n let runListenerQueue = !listenerQueue.length && !batchSeen\n for (let listener of listeners) {\n if (batchSeen) {\n let pendingStores = batchSeen.get(listener)\n if (!pendingStores) {\n batchSeen.set(listener, (pendingStores = new Set()))\n }\n if (pendingStores.has($atom)) continue\n pendingStores.add($atom)\n }\n listenerQueue.push(\n listener,\n $atom,\n oldValue,\n batchSeen ? undefined : changedKey\n )\n }\n\n if (runListenerQueue) {\n drainQueue()\n }\n },\n /* It will be called on last listener unsubscribing.\n We will redefine it in onMount and onStop. */\n off() {},\n set(newValue) {\n let oldValue = $atom.value\n if (!$atom.eq(oldValue, newValue)) {\n $atom.value = newValue\n $atom.notify(oldValue)\n }\n },\n subscribe(listener) {\n let unbind = $atom.listen(listener)\n listener($atom.value)\n return unbind\n },\n value: initialValue\n }\n\n if (process.env.NODE_ENV !== 'production') {\n $atom[clean] = () => {\n listeners = []\n $atom.lc = 0\n $atom.off()\n }\n }\n\n return $atom\n}\n\nexport const readonlyType = store => store\n","import { clean } from '../clean-stores/index.js'\n\nconst START = 0\nconst STOP = 1\nconst SET = 2\nconst NOTIFY = 3\nconst MOUNT = 5\nconst UNMOUNT = 6\nconst REVERT_MUTATION = 10\n\nexport let on = (object, listener, eventKey, mutateStore) => {\n object.events = object.events || {}\n if (!object.events[eventKey + REVERT_MUTATION]) {\n object.events[eventKey + REVERT_MUTATION] = mutateStore(eventProps => {\n // eslint-disable-next-line no-sequences\n object.events[eventKey].reduceRight((event, l) => (l(event), event), {\n shared: {},\n ...eventProps\n })\n })\n }\n object.events[eventKey] = object.events[eventKey] || []\n object.events[eventKey].push(listener)\n // A second unbind call must be a no-op, as it is for atom's listen()\n return () => {\n let currentListeners = object.events[eventKey]\n let index = currentListeners.indexOf(listener)\n if (~index) {\n currentListeners.splice(index, 1)\n if (!currentListeners.length) {\n object.events[eventKey + REVERT_MUTATION]()\n delete object.events[eventKey + REVERT_MUTATION]\n }\n }\n }\n}\n\nexport let onStart = ($store, listener) =>\n on($store, listener, START, runListeners => {\n let originListen = $store.listen\n $store.listen = arg => {\n if (!$store.lc && !$store.starting) {\n $store.starting = true\n runListeners()\n delete $store.starting\n }\n return originListen(arg)\n }\n return () => {\n $store.listen = originListen\n }\n })\n\nexport let onStop = ($store, listener) =>\n on($store, listener, STOP, runListeners => {\n let originOff = $store.off\n $store.off = () => {\n runListeners()\n originOff()\n }\n return () => {\n $store.off = originOff\n }\n })\n\nexport let onSet = ($store, listener) =>\n on($store, listener, SET, runListeners => {\n let originSet = $store.set\n let originSetKey = $store.setKey\n if ($store.setKey) {\n $store.setKey = (changed, changedValue) => {\n let isAborted\n let abort = () => {\n isAborted = true\n }\n\n runListeners({\n abort,\n changed,\n newValue: { ...$store.value, [changed]: changedValue }\n })\n if (!isAborted) return originSetKey(changed, changedValue)\n }\n }\n $store.set = newValue => {\n let isAborted\n let abort = () => {\n isAborted = true\n }\n\n runListeners({ abort, newValue })\n if (!isAborted) return originSet(newValue)\n }\n return () => {\n $store.set = originSet\n $store.setKey = originSetKey\n }\n })\n\nexport let onNotify = ($store, listener) =>\n on($store, listener, NOTIFY, runListeners => {\n let originNotify = $store.notify\n $store.notify = (oldValue, changed) => {\n let isAborted\n let abort = () => {\n isAborted = true\n }\n\n runListeners({ abort, changed, oldValue })\n if (!isAborted) return originNotify(oldValue, changed)\n }\n return () => {\n $store.notify = originNotify\n }\n })\n\nexport const STORE_UNMOUNT_DELAY = 1000\n\nexport let onMount = ($store, initialize) => {\n let listener = payload => {\n let destroy = initialize(payload)\n if (destroy) $store.events[UNMOUNT].push(destroy)\n }\n return on($store, listener, MOUNT, runListeners => {\n let originListen = $store.listen\n $store.listen = (...args) => {\n if (!$store.lc && !$store.active) {\n $store.active = true\n runListeners()\n }\n return originListen(...args)\n }\n\n let originOff = $store.off\n $store.events[UNMOUNT] = []\n $store.off = () => {\n originOff()\n setTimeout(() => {\n if ($store.active && !$store.lc) {\n $store.active = false\n for (let destroy of $store.events[UNMOUNT]) destroy()\n $store.events[UNMOUNT] = []\n }\n }, STORE_UNMOUNT_DELAY)\n }\n\n if (process.env.NODE_ENV !== 'production') {\n let originClean = $store[clean]\n $store[clean] = () => {\n for (let destroy of $store.events[UNMOUNT]) destroy()\n $store.events[UNMOUNT] = []\n $store.active = false\n originClean()\n }\n }\n\n return () => {\n $store.listen = originListen\n $store.off = originOff\n }\n })\n}\n","import { onSet } from \"nanostores\";\n//#region src/client/equality.ts\nfunction isPlainObject(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === Object.prototype || prototype === null;\n}\n/**\n* Deep structural equality for JSON-serializable values.\n* Handles: primitives, null, arrays, and plain objects.\n* Short-circuits on referential equality at every recursion level.\n*/\nfunction isJsonEqual(a, b) {\n\tif (a === b) return true;\n\tif (Array.isArray(a) && Array.isArray(b)) {\n\t\tif (a.length !== b.length) return false;\n\t\tfor (let i = 0; i < a.length; i++) if (!isJsonEqual(a[i], b[i])) return false;\n\t\treturn true;\n\t}\n\tif (isPlainObject(a) && isPlainObject(b)) {\n\t\tconst keysA = Object.keys(a);\n\t\tconst keysB = Object.keys(b);\n\t\tif (keysA.length !== keysB.length) return false;\n\t\tfor (const key of keysA) if (!(key in b) || !isJsonEqual(a[key], b[key])) return false;\n\t\treturn true;\n\t}\n\treturn false;\n}\n/**\n* Attach an equality gate to a nanostores atom via `onSet`.\n* When `isEqual(currentValue, newValue)` returns true, the `set()` call\n* is aborted: no listeners fire, no framework re-renders occur.\n*\n* Returns the unsubscribe function from `onSet`.\n*/\nfunction withEquality(store, isEqual) {\n\treturn onSet(store, ({ newValue, abort }) => {\n\t\tif (isEqual(store.value, newValue)) abort();\n\t});\n}\n//#endregion\nexport { isJsonEqual, withEquality };\n","//#region src/client/focus-manager.ts\nconst kFocusManager = Symbol.for(\"better-auth:focus-manager\");\nvar WindowFocusManager = class {\n\tlisteners = /* @__PURE__ */ new Set();\n\tsubscribe(listener) {\n\t\tthis.listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t};\n\t}\n\tsetFocused(focused) {\n\t\tthis.listeners.forEach((listener) => listener(focused));\n\t}\n\tsetup() {\n\t\tif (typeof window === \"undefined\" || typeof document === \"undefined\" || typeof window.addEventListener === \"undefined\") return () => {};\n\t\tconst visibilityHandler = () => {\n\t\t\tif (document.visibilityState === \"visible\") this.setFocused(true);\n\t\t};\n\t\tdocument.addEventListener(\"visibilitychange\", visibilityHandler, false);\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(\"visibilitychange\", visibilityHandler, false);\n\t\t};\n\t}\n};\nfunction getGlobalFocusManager() {\n\tif (!globalThis[kFocusManager]) globalThis[kFocusManager] = new WindowFocusManager();\n\treturn globalThis[kFocusManager];\n}\n//#endregion\nexport { getGlobalFocusManager, kFocusManager };\n","//#region src/client/online-manager.ts\nconst kOnlineManager = Symbol.for(\"better-auth:online-manager\");\nvar WindowOnlineManager = class {\n\tlisteners = /* @__PURE__ */ new Set();\n\tisOnline = typeof navigator !== \"undefined\" ? navigator.onLine : true;\n\tsubscribe(listener) {\n\t\tthis.listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t};\n\t}\n\tsetOnline(online) {\n\t\tthis.isOnline = online;\n\t\tthis.listeners.forEach((listener) => listener(online));\n\t}\n\tsetup() {\n\t\tif (typeof window === \"undefined\" || typeof window.addEventListener === \"undefined\") return () => {};\n\t\tconst onOnline = () => this.setOnline(true);\n\t\tconst onOffline = () => this.setOnline(false);\n\t\twindow.addEventListener(\"online\", onOnline, false);\n\t\twindow.addEventListener(\"offline\", onOffline, false);\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"online\", onOnline, false);\n\t\t\twindow.removeEventListener(\"offline\", onOffline, false);\n\t\t};\n\t}\n};\nfunction getGlobalOnlineManager() {\n\tif (!globalThis[kOnlineManager]) globalThis[kOnlineManager] = new WindowOnlineManager();\n\treturn globalThis[kOnlineManager];\n}\n//#endregion\nexport { getGlobalOnlineManager, kOnlineManager };\n","//#region src/client/parser.ts\nconst PROTO_POLLUTION_PATTERNS = {\n\tproto: /\"(?:_|\\\\u0{2}5[Ff]){2}(?:p|\\\\u0{2}70)(?:r|\\\\u0{2}72)(?:o|\\\\u0{2}6[Ff])(?:t|\\\\u0{2}74)(?:o|\\\\u0{2}6[Ff])(?:_|\\\\u0{2}5[Ff]){2}\"\\s*:/,\n\tconstructor: /\"(?:c|\\\\u0063)(?:o|\\\\u006[Ff])(?:n|\\\\u006[Ee])(?:s|\\\\u0073)(?:t|\\\\u0074)(?:r|\\\\u0072)(?:u|\\\\u0075)(?:c|\\\\u0063)(?:t|\\\\u0074)(?:o|\\\\u006[Ff])(?:r|\\\\u0072)\"\\s*:/,\n\tprotoShort: /\"__proto__\"\\s*:/,\n\tconstructorShort: /\"constructor\"\\s*:/\n};\nconst JSON_SIGNATURE = /^\\s*[\"[{]|^\\s*-?\\d{1,16}(\\.\\d{1,17})?([Ee][+-]?\\d+)?\\s*$/;\nconst SPECIAL_VALUES = {\n\ttrue: true,\n\tfalse: false,\n\tnull: null,\n\tundefined: void 0,\n\tnan: NaN,\n\tinfinity: Number.POSITIVE_INFINITY,\n\t\"-infinity\": Number.NEGATIVE_INFINITY\n};\nconst ISO_DATE_REGEX = /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d{1,7}))?(?:Z|([+-])(\\d{2}):(\\d{2}))$/;\nfunction isValidDate(date) {\n\treturn date instanceof Date && !isNaN(date.getTime());\n}\nfunction parseISODate(value) {\n\tconst match = ISO_DATE_REGEX.exec(value);\n\tif (!match) return null;\n\tconst [, year, month, day, hour, minute, second, ms, offsetSign, offsetHour, offsetMinute] = match;\n\tconst date = new Date(Date.UTC(parseInt(year, 10), parseInt(month, 10) - 1, parseInt(day, 10), parseInt(hour, 10), parseInt(minute, 10), parseInt(second, 10), ms ? parseInt(ms.padEnd(3, \"0\"), 10) : 0));\n\tif (offsetSign) {\n\t\tconst offset = (parseInt(offsetHour, 10) * 60 + parseInt(offsetMinute, 10)) * (offsetSign === \"+\" ? -1 : 1);\n\t\tdate.setUTCMinutes(date.getUTCMinutes() + offset);\n\t}\n\treturn isValidDate(date) ? date : null;\n}\nfunction betterJSONParse(value, options = {}) {\n\tconst { strict = false, warnings = false, reviver, parseDates = true } = options;\n\tif (typeof value !== \"string\") return value;\n\tconst trimmed = value.trim();\n\tconst lowerValue = trimmed.toLowerCase();\n\tif (lowerValue.length <= 9 && lowerValue in SPECIAL_VALUES) return SPECIAL_VALUES[lowerValue];\n\tif (!JSON_SIGNATURE.test(trimmed)) {\n\t\tif (strict) throw new SyntaxError(\"[better-json] Invalid JSON\");\n\t\treturn value;\n\t}\n\tif (Object.entries(PROTO_POLLUTION_PATTERNS).some(([key, pattern]) => {\n\t\tconst matches = pattern.test(trimmed);\n\t\tif (matches && warnings) console.warn(`[better-json] Detected potential prototype pollution attempt using ${key} pattern`);\n\t\treturn matches;\n\t}) && strict) throw new Error(\"[better-json] Potential prototype pollution attempt detected\");\n\ttry {\n\t\tconst secureReviver = (key, value) => {\n\t\t\tif (key === \"__proto__\" || key === \"constructor\" && value && typeof value === \"object\" && \"prototype\" in value) {\n\t\t\t\tif (warnings) console.warn(`[better-json] Dropping \"${key}\" key to prevent prototype pollution`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (parseDates && typeof value === \"string\") {\n\t\t\t\tconst date = parseISODate(value);\n\t\t\t\tif (date) return date;\n\t\t\t}\n\t\t\treturn reviver ? reviver(key, value) : value;\n\t\t};\n\t\treturn JSON.parse(trimmed, secureReviver);\n\t} catch (error) {\n\t\tif (strict) throw error;\n\t\treturn value;\n\t}\n}\nfunction parseJSON(value, options = { strict: true }) {\n\treturn betterJSONParse(value, options);\n}\n//#endregion\nexport { parseJSON };\n","import { atom } from \"nanostores\";\n//#region src/client/query-atom.ts\nconst kAuthQuery = Symbol.for(\"better-auth:auth-query\");\nfunction isAuthQueryStore(store) {\n\treturn kAuthQuery in store && store[kAuthQuery] === true;\n}\nfunction createAuthQueryAtom(initialValue) {\n\tconst queryAtom = atom(initialValue);\n\tObject.defineProperty(queryAtom, kAuthQuery, { value: true });\n\treturn queryAtom;\n}\n//#endregion\nexport { createAuthQueryAtom, isAuthQueryStore };\n","import { isJsonEqual, withEquality } from \"./equality.mjs\";\nimport { createAuthQueryAtom } from \"./query-atom.mjs\";\nimport { onMount } from \"nanostores\";\n//#region src/client/query.ts\nconst isServer = () => typeof window === \"undefined\";\nfunction isAuthQueryStateEqual(a, b) {\n\treturn isJsonEqual(a.data, b.data) && a.error === b.error && a.isPending === b.isPending && a.isRefetching === b.isRefetching && a.refetch === b.refetch;\n}\nconst useAuthQuery = (initializedAtom, path, $fetch, options) => {\n\tconst value = createAuthQueryAtom({\n\t\tdata: null,\n\t\terror: null,\n\t\tisPending: true,\n\t\tisRefetching: false,\n\t\trefetch: (queryParams) => fn(queryParams)\n\t});\n\tonMount(value, () => withEquality(value, isAuthQueryStateEqual));\n\tlet latestRequestId = 0;\n\tconst fn = async (queryParams) => {\n\t\tconst requestId = ++latestRequestId;\n\t\treturn new Promise((resolve) => {\n\t\t\tconst opts = typeof options === \"function\" ? options({\n\t\t\t\tdata: value.get().data,\n\t\t\t\terror: value.get().error,\n\t\t\t\tisPending: value.get().isPending\n\t\t\t}) : options;\n\t\t\t$fetch(path, {\n\t\t\t\t...opts,\n\t\t\t\tquery: {\n\t\t\t\t\t...opts?.query,\n\t\t\t\t\t...queryParams?.query\n\t\t\t\t},\n\t\t\t\tasync onSuccess(context) {\n\t\t\t\t\tif (requestId === latestRequestId) {\n\t\t\t\t\t\tconst current = value.get();\n\t\t\t\t\t\tconst stableData = current.data != null && context.data != null && isJsonEqual(current.data, context.data) ? current.data : context.data;\n\t\t\t\t\t\tvalue.set({\n\t\t\t\t\t\t\tdata: stableData,\n\t\t\t\t\t\t\terror: null,\n\t\t\t\t\t\t\tisPending: false,\n\t\t\t\t\t\t\tisRefetching: false,\n\t\t\t\t\t\t\trefetch: value.value.refetch\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tawait opts?.onSuccess?.(context);\n\t\t\t\t},\n\t\t\t\tasync onError(context) {\n\t\t\t\t\tconst { request } = context;\n\t\t\t\t\tconst retryAttempts = typeof request.retry === \"number\" ? request.retry : request.retry?.attempts;\n\t\t\t\t\tconst retryAttempt = request.retryAttempt || 0;\n\t\t\t\t\tif (retryAttempts && retryAttempt < retryAttempts) return;\n\t\t\t\t\tif (requestId === latestRequestId) {\n\t\t\t\t\t\tconst isUnauthorized = context.error.status === 401;\n\t\t\t\t\t\tvalue.set({\n\t\t\t\t\t\t\terror: context.error,\n\t\t\t\t\t\t\tdata: isUnauthorized ? null : value.get().data,\n\t\t\t\t\t\t\tisPending: false,\n\t\t\t\t\t\t\tisRefetching: false,\n\t\t\t\t\t\t\trefetch: value.value.refetch\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tawait opts?.onError?.(context);\n\t\t\t\t},\n\t\t\t\tasync onRequest(context) {\n\t\t\t\t\tif (requestId === latestRequestId) {\n\t\t\t\t\t\tconst currentValue = value.get();\n\t\t\t\t\t\tvalue.set({\n\t\t\t\t\t\t\tisPending: currentValue.data === null,\n\t\t\t\t\t\t\tdata: currentValue.data,\n\t\t\t\t\t\t\terror: null,\n\t\t\t\t\t\t\tisRefetching: true,\n\t\t\t\t\t\t\trefetch: value.value.refetch\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tawait opts?.onRequest?.(context);\n\t\t\t\t}\n\t\t\t}).catch((error) => {\n\t\t\t\tif (requestId !== latestRequestId) return;\n\t\t\t\tvalue.set({\n\t\t\t\t\terror,\n\t\t\t\t\tdata: value.get().data,\n\t\t\t\t\tisPending: false,\n\t\t\t\t\tisRefetching: false,\n\t\t\t\t\trefetch: value.value.refetch\n\t\t\t\t});\n\t\t\t}).finally(() => {\n\t\t\t\tresolve(void 0);\n\t\t\t});\n\t\t});\n\t};\n\tinitializedAtom = Array.isArray(initializedAtom) ? initializedAtom : [initializedAtom];\n\tlet isMountFetchPending = false;\n\tlet isMounted = false;\n\tlet shouldRefetchAfterPending = false;\n\tconst fetchOnMount = () => {\n\t\tif (isMountFetchPending) {\n\t\t\tshouldRefetchAfterPending = true;\n\t\t\treturn;\n\t\t}\n\t\tisMountFetchPending = true;\n\t\tfn().finally(() => {\n\t\t\tisMountFetchPending = false;\n\t\t\tconst shouldRefetch = shouldRefetchAfterPending && isMounted;\n\t\t\tshouldRefetchAfterPending = false;\n\t\t\tif (shouldRefetch) fetchOnMount();\n\t\t});\n\t};\n\tonMount(value, () => {\n\t\tif (isServer()) return;\n\t\tisMounted = true;\n\t\tlet isInitialized = false;\n\t\tlet timeoutId;\n\t\tconst cleanups = initializedAtom.map((initAtom) => initAtom.listen(() => {\n\t\t\tif (isInitialized) fn();\n\t\t\telse {\n\t\t\t\tisInitialized = true;\n\t\t\t\tclearTimeout(timeoutId);\n\t\t\t\tfetchOnMount();\n\t\t\t}\n\t\t}));\n\t\ttimeoutId = setTimeout(() => {\n\t\t\tisInitialized = true;\n\t\t\tfetchOnMount();\n\t\t}, 0);\n\t\treturn () => {\n\t\t\tisMounted = false;\n\t\t\tfor (const cleanup of cleanups) cleanup();\n\t\t\tclearTimeout(timeoutId);\n\t\t};\n\t});\n\treturn value;\n};\n//#endregion\nexport { useAuthQuery };\n","import { getGlobalBroadcastChannel } from \"./broadcast-channel.mjs\";\nimport { getGlobalFocusManager } from \"./focus-manager.mjs\";\nimport { getGlobalOnlineManager } from \"./online-manager.mjs\";\n//#region src/client/session-refresh.ts\nconst now = () => Math.floor(Date.now() / 1e3);\n/**\n* Rate limit: don't refetch on focus if a session request was made within this many seconds\n*/\nconst FOCUS_REFETCH_RATE_LIMIT_SECONDS = 5;\nfunction createSessionRefreshManager(opts) {\n\tconst { fetchSession, shouldPollSession = () => true, sessionSignal, options = {} } = opts;\n\tconst refetchInterval = options.sessionOptions?.refetchInterval ?? 0;\n\tconst refetchOnWindowFocus = options.sessionOptions?.refetchOnWindowFocus ?? true;\n\tconst refetchWhenOffline = options.sessionOptions?.refetchWhenOffline ?? false;\n\tconst state = {\n\t\tisInitialized: false,\n\t\tlastSessionRequest: 0\n\t};\n\tconst shouldRefetch = () => {\n\t\treturn refetchWhenOffline || getGlobalOnlineManager().isOnline;\n\t};\n\tconst triggerRefetch = (event) => {\n\t\tif (!shouldRefetch()) return;\n\t\tif (event?.event === \"storage\") {\n\t\t\tfetchSession();\n\t\t\treturn;\n\t\t}\n\t\tif (event?.event === \"poll\") {\n\t\t\tstate.lastSessionRequest = now();\n\t\t\tfetchSession();\n\t\t\treturn;\n\t\t}\n\t\tif (event?.event === \"visibilitychange\") {\n\t\t\tif (now() - state.lastSessionRequest < FOCUS_REFETCH_RATE_LIMIT_SECONDS) return;\n\t\t\tstate.lastSessionRequest = now();\n\t\t\tfetchSession();\n\t\t\treturn;\n\t\t}\n\t\tfetchSession();\n\t};\n\tconst broadcastSessionUpdate = (trigger) => {\n\t\tgetGlobalBroadcastChannel().post({\n\t\t\tevent: \"session\",\n\t\t\tdata: { trigger },\n\t\t\tclientId: Math.random().toString(36).substring(7)\n\t\t});\n\t};\n\tconst setupPolling = () => {\n\t\tif (refetchInterval && refetchInterval > 0) state.pollInterval = setInterval(() => {\n\t\t\tif (shouldPollSession()) triggerRefetch({ event: \"poll\" });\n\t\t}, refetchInterval * 1e3);\n\t};\n\tconst setupBroadcast = () => {\n\t\tstate.unsubscribeBroadcast = getGlobalBroadcastChannel().subscribe(() => {\n\t\t\ttriggerRefetch({ event: \"storage\" });\n\t\t});\n\t};\n\tconst setupFocusRefetch = () => {\n\t\tif (!refetchOnWindowFocus) return;\n\t\tstate.unsubscribeFocus = getGlobalFocusManager().subscribe(() => {\n\t\t\ttriggerRefetch({ event: \"visibilitychange\" });\n\t\t});\n\t};\n\tconst setupOnlineRefetch = () => {\n\t\tstate.unsubscribeOnline = getGlobalOnlineManager().subscribe((online) => {\n\t\t\tif (online) triggerRefetch({ event: \"visibilitychange\" });\n\t\t});\n\t};\n\tconst setupSignalSubscription = () => {\n\t\tstate.unsubscribeSignal = sessionSignal.listen(() => {\n\t\t\tfetchSession();\n\t\t});\n\t};\n\tconst init = () => {\n\t\tif (state.isInitialized) return;\n\t\tstate.isInitialized = true;\n\t\tsetupPolling();\n\t\tsetupBroadcast();\n\t\tsetupFocusRefetch();\n\t\tsetupOnlineRefetch();\n\t\tsetupSignalSubscription();\n\t\tstate.cleanupBroadcastSetup = getGlobalBroadcastChannel().setup();\n\t\tstate.cleanupFocusSetup = getGlobalFocusManager().setup();\n\t\tstate.cleanupOnlineSetup = getGlobalOnlineManager().setup();\n\t};\n\tconst cleanup = () => {\n\t\tif (!state.isInitialized) return;\n\t\tif (state.pollInterval) {\n\t\t\tclearInterval(state.pollInterval);\n\t\t\tstate.pollInterval = void 0;\n\t\t}\n\t\tif (state.unsubscribeBroadcast) {\n\t\t\tstate.unsubscribeBroadcast();\n\t\t\tstate.unsubscribeBroadcast = void 0;\n\t\t}\n\t\tif (state.unsubscribeFocus) {\n\t\t\tstate.unsubscribeFocus();\n\t\t\tstate.unsubscribeFocus = void 0;\n\t\t}\n\t\tif (state.unsubscribeOnline) {\n\t\t\tstate.unsubscribeOnline();\n\t\t\tstate.unsubscribeOnline = void 0;\n\t\t}\n\t\tif (state.unsubscribeSignal) {\n\t\t\tstate.unsubscribeSignal();\n\t\t\tstate.unsubscribeSignal = void 0;\n\t\t}\n\t\tif (state.cleanupBroadcastSetup) {\n\t\t\tstate.cleanupBroadcastSetup();\n\t\t\tstate.cleanupBroadcastSetup = void 0;\n\t\t}\n\t\tif (state.cleanupFocusSetup) {\n\t\t\tstate.cleanupFocusSetup();\n\t\t\tstate.cleanupFocusSetup = void 0;\n\t\t}\n\t\tif (state.cleanupOnlineSetup) {\n\t\t\tstate.cleanupOnlineSetup();\n\t\t\tstate.cleanupOnlineSetup = void 0;\n\t\t}\n\t\tstate.isInitialized = false;\n\t\tstate.lastSessionRequest = 0;\n\t};\n\treturn {\n\t\tinit,\n\t\tcleanup,\n\t\ttriggerRefetch,\n\t\tbroadcastSessionUpdate\n\t};\n}\n//#endregion\nexport { createSessionRefreshManager };\n","//#region src/env/env-impl.ts\nconst _envShim = Object.create(null);\nconst _getEnv = (useShim) => globalThis.process?.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (useShim ? _envShim : globalThis);\nconst env = new Proxy(_envShim, {\n\tget(_, prop) {\n\t\treturn _getEnv()[prop] ?? _envShim[prop];\n\t},\n\thas(_, prop) {\n\t\treturn prop in _getEnv() || prop in _envShim;\n\t},\n\tset(_, prop, value) {\n\t\tconst env = _getEnv(true);\n\t\tenv[prop] = value;\n\t\treturn true;\n\t},\n\tdeleteProperty(_, prop) {\n\t\tif (!prop) return false;\n\t\tconst env = _getEnv(true);\n\t\tdelete env[prop];\n\t\treturn true;\n\t},\n\townKeys() {\n\t\tconst env = _getEnv(true);\n\t\treturn Object.keys(env);\n\t}\n});\nfunction toBoolean(val) {\n\treturn val ? val !== \"false\" : false;\n}\nconst nodeENV = env.NODE_ENV ?? \"\";\n/** Detect if `NODE_ENV` environment variable is `production` */\nconst isProduction = nodeENV === \"production\";\n/** Detect if `NODE_ENV` environment variable is `dev` or `development` */\nconst isDevelopment = () => nodeENV === \"dev\" || nodeENV === \"development\";\n/** Detect if `NODE_ENV` environment variable is `test` */\nconst isTest = () => nodeENV === \"test\" || toBoolean(env.TEST);\n/**\n* Get environment variable with fallback\n*/\nfunction getEnvVar(key, fallback) {\n\tif (typeof process !== \"undefined\" && process.env) return process.env[key] ?? fallback;\n\tif (typeof Deno !== \"undefined\") return Deno.env.get(key) ?? fallback;\n\tif (typeof Bun !== \"undefined\") return Bun.env[key] ?? fallback;\n\treturn fallback;\n}\n/**\n* Get boolean environment variable\n*/\nfunction getBooleanEnvVar(key, fallback = true) {\n\tconst value = getEnvVar(key);\n\tif (!value) return fallback;\n\treturn value !== \"0\" && value.toLowerCase() !== \"false\" && value !== \"\";\n}\n/**\n* Common environment variables used in Better Auth\n*/\nconst ENV = Object.freeze({\n\tget BETTER_AUTH_SECRET() {\n\t\treturn getEnvVar(\"BETTER_AUTH_SECRET\");\n\t},\n\tget AUTH_SECRET() {\n\t\treturn getEnvVar(\"AUTH_SECRET\");\n\t},\n\tget BETTER_AUTH_TELEMETRY() {\n\t\treturn getEnvVar(\"BETTER_AUTH_TELEMETRY\");\n\t},\n\tget BETTER_AUTH_TELEMETRY_ID() {\n\t\treturn getEnvVar(\"BETTER_AUTH_TELEMETRY_ID\");\n\t},\n\tget NODE_ENV() {\n\t\treturn getEnvVar(\"NODE_ENV\", \"development\");\n\t},\n\tget PACKAGE_VERSION() {\n\t\treturn getEnvVar(\"PACKAGE_VERSION\", \"0.0.0\");\n\t},\n\tget BETTER_AUTH_TELEMETRY_ENDPOINT() {\n\t\treturn getEnvVar(\"BETTER_AUTH_TELEMETRY_ENDPOINT\", \"\");\n\t}\n});\n//#endregion\nexport { ENV, env, getBooleanEnvVar, getEnvVar, isDevelopment, isProduction, isTest, nodeENV };\n","//#region src/error.ts\nfunction isErrorStackTraceLimitWritable() {\n\tconst desc = Object.getOwnPropertyDescriptor(Error, \"stackTraceLimit\");\n\tif (desc === void 0) return Object.isExtensible(Error);\n\treturn Object.prototype.hasOwnProperty.call(desc, \"writable\") ? desc.writable : desc.set !== void 0;\n}\n/**\n* Hide internal stack frames from the error stack trace.\n*/\nfunction hideInternalStackFrames(stack) {\n\tconst lines = stack.split(\"\\n at \");\n\tif (lines.length <= 1) return stack;\n\tlines.splice(1, 1);\n\treturn lines.join(\"\\n at \");\n}\n/**\n* Creates a custom error class that hides stack frames.\n*/\nfunction makeErrorForHideStackFrame(Base, clazz) {\n\tclass HideStackFramesError extends Base {\n\t\t#hiddenStack;\n\t\tconstructor(...args) {\n\t\t\tif (isErrorStackTraceLimitWritable()) {\n\t\t\t\tconst limit = Error.stackTraceLimit;\n\t\t\t\tError.stackTraceLimit = 0;\n\t\t\t\tsuper(...args);\n\t\t\t\tError.stackTraceLimit = limit;\n\t\t\t} else super(...args);\n\t\t\tconst stack = (/* @__PURE__ */ new Error()).stack;\n\t\t\tif (stack) this.#hiddenStack = hideInternalStackFrames(stack.replace(/^Error/, this.name));\n\t\t}\n\t\tget errorStack() {\n\t\t\treturn this.#hiddenStack;\n\t\t}\n\t}\n\tObject.defineProperty(HideStackFramesError.prototype, \"constructor\", {\n\t\tget() {\n\t\t\treturn clazz;\n\t\t},\n\t\tenumerable: false,\n\t\tconfigurable: true\n\t});\n\treturn HideStackFramesError;\n}\nconst statusCodes = {\n\tOK: 200,\n\tCREATED: 201,\n\tACCEPTED: 202,\n\tNO_CONTENT: 204,\n\tMULTIPLE_CHOICES: 300,\n\tMOVED_PERMANENTLY: 301,\n\tFOUND: 302,\n\tSEE_OTHER: 303,\n\tNOT_MODIFIED: 304,\n\tTEMPORARY_REDIRECT: 307,\n\tBAD_REQUEST: 400,\n\tUNAUTHORIZED: 401,\n\tPAYMENT_REQUIRED: 402,\n\tFORBIDDEN: 403,\n\tNOT_FOUND: 404,\n\tMETHOD_NOT_ALLOWED: 405,\n\tNOT_ACCEPTABLE: 406,\n\tPROXY_AUTHENTICATION_REQUIRED: 407,\n\tREQUEST_TIMEOUT: 408,\n\tCONFLICT: 409,\n\tGONE: 410,\n\tLENGTH_REQUIRED: 411,\n\tPRECONDITION_FAILED: 412,\n\tPAYLOAD_TOO_LARGE: 413,\n\tURI_TOO_LONG: 414,\n\tUNSUPPORTED_MEDIA_TYPE: 415,\n\tRANGE_NOT_SATISFIABLE: 416,\n\tEXPECTATION_FAILED: 417,\n\t\"I'M_A_TEAPOT\": 418,\n\tMISDIRECTED_REQUEST: 421,\n\tUNPROCESSABLE_ENTITY: 422,\n\tLOCKED: 423,\n\tFAILED_DEPENDENCY: 424,\n\tTOO_EARLY: 425,\n\tUPGRADE_REQUIRED: 426,\n\tPRECONDITION_REQUIRED: 428,\n\tTOO_MANY_REQUESTS: 429,\n\tREQUEST_HEADER_FIELDS_TOO_LARGE: 431,\n\tUNAVAILABLE_FOR_LEGAL_REASONS: 451,\n\tINTERNAL_SERVER_ERROR: 500,\n\tNOT_IMPLEMENTED: 501,\n\tBAD_GATEWAY: 502,\n\tSERVICE_UNAVAILABLE: 503,\n\tGATEWAY_TIMEOUT: 504,\n\tHTTP_VERSION_NOT_SUPPORTED: 505,\n\tVARIANT_ALSO_NEGOTIATES: 506,\n\tINSUFFICIENT_STORAGE: 507,\n\tLOOP_DETECTED: 508,\n\tNOT_EXTENDED: 510,\n\tNETWORK_AUTHENTICATION_REQUIRED: 511\n};\nvar InternalAPIError = class extends Error {\n\tstatus;\n\tbody;\n\theaders;\n\tstatusCode;\n\tconstructor(status = \"INTERNAL_SERVER_ERROR\", body = void 0, headers = {}, statusCode = typeof status === \"number\" ? status : statusCodes[status]) {\n\t\tsuper(body?.message, body && \"cause\" in body ? { cause: body.cause } : void 0);\n\t\tthis.status = status;\n\t\tthis.body = body;\n\t\tthis.headers = headers;\n\t\tthis.statusCode = statusCode;\n\t\tthis.name = \"APIError\";\n\t\tthis.status = status;\n\t\tthis.headers = headers;\n\t\tthis.statusCode = statusCode;\n\t\tif (body && \"cause\" in body) {\n\t\t\tconst { cause, ...publicBody } = body;\n\t\t\tthis.body = Object.defineProperty(publicBody, \"cause\", {\n\t\t\t\tvalue: cause,\n\t\t\t\twritable: true,\n\t\t\t\tconfigurable: true\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tthis.body = body;\n\t}\n};\nvar ValidationError = class extends InternalAPIError {\n\tmessage;\n\tissues;\n\tconstructor(message, issues) {\n\t\tsuper(400, {\n\t\t\tmessage,\n\t\t\tcode: \"VALIDATION_ERROR\"\n\t\t});\n\t\tthis.message = message;\n\t\tthis.issues = issues;\n\t\tthis.issues = issues;\n\t}\n};\nvar BetterCallError = class extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = \"BetterCallError\";\n\t}\n};\nconst kAPIErrorHeaderSymbol = Symbol.for(\"better-call:api-error-headers\");\nconst APIError = makeErrorForHideStackFrame(InternalAPIError, Error);\n//#endregion\nexport { APIError, BetterCallError, ValidationError, hideInternalStackFrames, kAPIErrorHeaderSymbol, makeErrorForHideStackFrame, statusCodes };\n\n//# sourceMappingURL=error.mjs.map","import { BASE_ERROR_CODES } from \"./codes.mjs\";\nimport { APIError as APIError$1 } from \"better-call/error\";\n//#region src/error/index.ts\nvar BetterAuthError = class extends Error {\n\tconstructor(message, options) {\n\t\tsuper(message, options);\n\t\tthis.name = \"BetterAuthError\";\n\t\tthis.message = message;\n\t\tthis.stack = \"\";\n\t}\n};\nvar APIError = class APIError extends APIError$1 {\n\tconstructor(...args) {\n\t\tsuper(...args);\n\t}\n\tstatic fromStatus(status, body) {\n\t\treturn new APIError(status, body);\n\t}\n\tstatic from(status, error, options) {\n\t\tconst { code, message } = error;\n\t\tif (options?.cause === void 0) return new APIError(status, {\n\t\t\tmessage,\n\t\t\tcode\n\t\t});\n\t\treturn new APIError(status, {\n\t\t\tmessage,\n\t\t\tcode,\n\t\t\tcause: options.cause\n\t\t});\n\t}\n};\n//#endregion\nexport { APIError, BASE_ERROR_CODES, BetterAuthError };\n","import { wildcardMatch } from \"./wildcard.mjs\";\nimport { env } from \"@better-auth/core/env\";\nimport { BetterAuthError } from \"@better-auth/core/error\";\n//#region src/utils/url.ts\nconst SLASH_CHAR_CODE = \"/\".charCodeAt(0);\n/**\n* Minimal loopback check for dev scheme inference only. Reachable from\n* `client/config.ts` via `getBaseURL`, so we MUST NOT import the full\n* `@better-auth/core/utils/host` classifier here: its `utils/ip` dependency\n* on zod would leak into the client bundle (see `e2e/smoke/test/vite.spec.ts`).\n*\n* Server-side SSRF/loopback checks (oauth redirect matching, trusted-origin\n* resolution, electron fetch gate) continue to use the authoritative\n* `isLoopbackHost` from `@better-auth/core/utils/host`. This helper's only\n* job is picking `http` vs `https` for dev ergonomics.\n*/\nfunction isLoopbackForDevScheme(host) {\n\tconst hostname = host.replace(/:\\d+$/, \"\").replace(/^\\[|\\]$/g, \"\").toLowerCase();\n\treturn hostname === \"localhost\" || hostname.endsWith(\".localhost\") || hostname === \"::1\" || hostname.startsWith(\"127.\");\n}\nfunction trimTrailingSlashes(value) {\n\tlet end = value.length;\n\twhile (end > 0 && value.charCodeAt(end - 1) === SLASH_CHAR_CODE) end--;\n\treturn end === value.length ? value : value.slice(0, end);\n}\nfunction checkHasPath(url) {\n\ttry {\n\t\treturn (trimTrailingSlashes(new URL(url).pathname) || \"/\") !== \"/\";\n\t} catch {\n\t\tthrow new BetterAuthError(`Invalid base URL: ${url}. Please provide a valid base URL.`);\n\t}\n}\nfunction assertHasProtocol(url) {\n\ttry {\n\t\tconst parsedUrl = new URL(url);\n\t\tif (parsedUrl.protocol !== \"http:\" && parsedUrl.protocol !== \"https:\") throw new BetterAuthError(`Invalid base URL: ${url}. URL must include 'http://' or 'https://'`);\n\t} catch (error) {\n\t\tif (error instanceof BetterAuthError) throw error;\n\t\tthrow new BetterAuthError(`Invalid base URL: ${url}. Please provide a valid base URL.`, { cause: error });\n\t}\n}\nfunction withPath(url, path = \"/api/auth\") {\n\tassertHasProtocol(url);\n\tif (checkHasPath(url)) return url;\n\tconst trimmedUrl = trimTrailingSlashes(url);\n\tif (!path || path === \"/\") return trimmedUrl;\n\tpath = path.startsWith(\"/\") ? path : `/${path}`;\n\treturn `${trimmedUrl}${path}`;\n}\nfunction validateProxyHeader(header, type) {\n\tif (!header || header.trim() === \"\") return false;\n\tif (type === \"proto\") return header === \"http\" || header === \"https\";\n\tif (type === \"host\") {\n\t\tif ([\n\t\t\t/\\.\\./,\n\t\t\t/\\0/,\n\t\t\t/[\\s]/,\n\t\t\t/^[.]/,\n\t\t\t/[<>'\"]/,\n\t\t\t/javascript:/i,\n\t\t\t/file:/i,\n\t\t\t/data:/i\n\t\t].some((pattern) => pattern.test(header))) return false;\n\t\treturn /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(header) || /^(\\d{1,3}\\.){3}\\d{1,3}(:[0-9]{1,5})?$/.test(header) || /^\\[[0-9a-fA-F:]+\\](:[0-9]{1,5})?$/.test(header) || /^localhost(:[0-9]{1,5})?$/i.test(header);\n\t}\n\treturn false;\n}\nfunction getBaseURL(url, path, request, loadEnv, trustedProxyHeaders) {\n\tif (url) return withPath(url, path);\n\tif (loadEnv !== false) {\n\t\tconst fromEnv = env.BETTER_AUTH_URL || env.NEXT_PUBLIC_BETTER_AUTH_URL || env.PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_AUTH_URL || (env.BASE_URL !== \"/\" ? env.BASE_URL : void 0);\n\t\tif (fromEnv) return withPath(fromEnv, path);\n\t}\n\tconst fromRequest = request?.headers.get(\"x-forwarded-host\");\n\tconst fromRequestProto = request?.headers.get(\"x-forwarded-proto\");\n\tif (fromRequest && fromRequestProto && trustedProxyHeaders) {\n\t\tif (validateProxyHeader(fromRequestProto, \"proto\") && validateProxyHeader(fromRequest, \"host\")) try {\n\t\t\treturn withPath(`${fromRequestProto}://${fromRequest}`, path);\n\t\t} catch (_error) {}\n\t}\n\tif (request) {\n\t\tconst url = getOrigin(request.url);\n\t\tif (!url) throw new BetterAuthError(\"Could not get origin from request. Please provide a valid base URL.\");\n\t\treturn withPath(url, path);\n\t}\n\tif (typeof window !== \"undefined\" && window.location) return withPath(window.location.origin, path);\n}\nfunction getOrigin(url) {\n\ttry {\n\t\tconst parsedUrl = new URL(url);\n\t\treturn parsedUrl.origin === \"null\" ? null : parsedUrl.origin;\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction getProtocol(url) {\n\ttry {\n\t\treturn new URL(url).protocol;\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction getHost(url) {\n\ttry {\n\t\treturn new URL(url).host;\n\t} catch {\n\t\treturn null;\n\t}\n}\n/**\n* Checks if the baseURL config is a dynamic config object\n*/\nfunction isDynamicBaseURLConfig(config) {\n\treturn typeof config === \"object\" && config !== null && \"allowedHosts\" in config && Array.isArray(config.allowedHosts);\n}\n/**\n* Check if a value is a `Request`\n* - `instanceof`: works for native Request instances\n* - `toString`: handles where instanceof check fails but the object is still a\n* valid Request (e.g. cross-realm, polyfills). Paired with a shape check so\n* an object that only spoofs `Symbol.toStringTag` without the real shape is\n* rejected before downstream code tries to read `.headers` / `.url`.\n*\n* @param value The value to check\n* @returns `true` if the value is a Request instance\n*/\nfunction isRequestLike(value) {\n\tif (value instanceof Request) return true;\n\tif (typeof value !== \"object\" || value === null || Object.prototype.toString.call(value) !== \"[object Request]\") return false;\n\tconst v = value;\n\treturn typeof v.url === \"string\" && typeof v.headers === \"object\" && v.headers !== null && typeof v.headers.get === \"function\";\n}\n/**\n* Extracts the host from a `Request` or `Headers`.\n* Honors `x-forwarded-host` only when `trustedProxyHeaders` is enabled,\n* then falls back to the `host` header and finally the request URL.\n*/\nfunction getHostFromSource(source, trustedProxyHeaders) {\n\tconst headers = isRequestLike(source) ? source.headers : source;\n\tif (trustedProxyHeaders) {\n\t\tconst forwardedHost = headers.get(\"x-forwarded-host\");\n\t\tif (forwardedHost && validateProxyHeader(forwardedHost, \"host\")) return forwardedHost;\n\t}\n\tconst host = headers.get(\"host\");\n\tif (host && validateProxyHeader(host, \"host\")) return host;\n\tif (isRequestLike(source)) try {\n\t\treturn new URL(source.url).host;\n\t} catch {\n\t\treturn null;\n\t}\n\treturn null;\n}\n/**\n* Extracts the protocol from a `Request` or `Headers`.\n* Honors `x-forwarded-proto` only when `trustedProxyHeaders` is enabled,\n* then falls back to the request URL, then to \"https\".\n*/\nfunction getProtocolFromSource(source, configProtocol, trustedProxyHeaders) {\n\tif (configProtocol === \"http\" || configProtocol === \"https\") return configProtocol;\n\tconst headers = isRequestLike(source) ? source.headers : source;\n\tif (trustedProxyHeaders) {\n\t\tconst forwardedProto = headers.get(\"x-forwarded-proto\");\n\t\tif (forwardedProto && validateProxyHeader(forwardedProto, \"proto\")) return forwardedProto;\n\t}\n\tif (isRequestLike(source)) try {\n\t\tconst url = new URL(source.url);\n\t\tif (url.protocol === \"http:\" || url.protocol === \"https:\") return url.protocol.slice(0, -1);\n\t} catch {}\n\tconst host = getHostFromSource(source, trustedProxyHeaders);\n\tif (host && isLoopbackForDevScheme(host)) return \"http\";\n\treturn \"https\";\n}\n/**\n* Matches a hostname against a host pattern.\n* Supports wildcard patterns like `*.vercel.app` or `preview-*.myapp.com`.\n*\n* @param host The hostname to test (e.g., \"myapp.com\", \"preview-123.vercel.app\")\n* @param pattern The host pattern (e.g., \"myapp.com\", \"*.vercel.app\")\n* @returns {boolean} true if the host matches the pattern, false otherwise.\n*\n* @example\n* ```ts\n* matchesHostPattern(\"myapp.com\", \"myapp.com\") // true\n* matchesHostPattern(\"preview-123.vercel.app\", \"*.vercel.app\") // true\n* matchesHostPattern(\"preview-123.myapp.com\", \"preview-*.myapp.com\") // true\n* matchesHostPattern(\"evil.com\", \"myapp.com\") // false\n* ```\n*/\nconst matchesHostPattern = (host, pattern) => {\n\tif (!host || !pattern) return false;\n\tconst normalizedHost = host.replace(/^https?:\\/\\//, \"\").split(\"/\")[0].toLowerCase();\n\tconst normalizedPattern = pattern.replace(/^https?:\\/\\//, \"\").split(\"/\")[0].toLowerCase();\n\tif (normalizedPattern.includes(\"*\") || normalizedPattern.includes(\"?\")) return wildcardMatch(normalizedPattern)(normalizedHost);\n\treturn normalizedHost.toLowerCase() === normalizedPattern.toLowerCase();\n};\n/**\n* Resolves the base URL from a dynamic config based on the incoming request.\n* Validates the derived host against the allowedHosts allowlist.\n*\n* @param config The dynamic base URL config\n* @param request The incoming request\n* @param basePath The base path to append\n* @returns The resolved base URL with path\n* @throws BetterAuthError if host is not in allowedHosts and no fallback is set\n*/\nfunction resolveDynamicBaseURL(config, source, basePath, trustedProxyHeaders) {\n\tconst host = getHostFromSource(source, trustedProxyHeaders);\n\tif (!host) {\n\t\tif (config.fallback) return withPath(config.fallback, basePath);\n\t\tthrow new BetterAuthError(\"Could not determine host from request headers. Please provide a fallback URL in your baseURL config.\");\n\t}\n\tif (config.allowedHosts.some((pattern) => matchesHostPattern(host, pattern))) return withPath(`${getProtocolFromSource(source, config.protocol, trustedProxyHeaders)}://${host}`, basePath);\n\tif (config.fallback) return withPath(config.fallback, basePath);\n\tthrow new BetterAuthError(`Host \"${host}\" is not in the allowed hosts list. Allowed hosts: ${config.allowedHosts.join(\", \")}. Add this host to your allowedHosts config or provide a fallback URL.`);\n}\n/**\n* Resolves the base URL from any config type (static string or dynamic object).\n* This is the main entry point for base URL resolution.\n*\n* @param config The base URL config (string or object)\n* @param basePath The base path to append\n* @param request Optional request for dynamic resolution\n* @param loadEnv Whether to load from environment variables\n* @param trustedProxyHeaders Whether to trust proxy headers (for legacy behavior)\n* @returns The resolved base URL with path\n*/\nfunction resolveBaseURL(config, basePath, source, loadEnv, trustedProxyHeaders) {\n\tif (isDynamicBaseURLConfig(config)) {\n\t\tif (source) return resolveDynamicBaseURL(config, source, basePath, trustedProxyHeaders);\n\t\tif (config.fallback) return withPath(config.fallback, basePath);\n\t\treturn getBaseURL(void 0, basePath, void 0, loadEnv, trustedProxyHeaders);\n\t}\n\tconst request = isRequestLike(source) ? source : void 0;\n\tif (typeof config === \"string\") return getBaseURL(config, basePath, request, loadEnv, trustedProxyHeaders);\n\treturn getBaseURL(void 0, basePath, request, loadEnv, trustedProxyHeaders);\n}\n//#endregion\nexport { getBaseURL, getHost, getHostFromSource, getOrigin, getProtocol, getProtocolFromSource, isDynamicBaseURLConfig, isRequestLike, matchesHostPattern, resolveBaseURL, resolveDynamicBaseURL, trimTrailingSlashes };\n","//#region src/utils/url.ts\n/**\n* Normalizes a request pathname by removing the basePath prefix and trailing slashes.\n* This is useful for matching paths against configured path lists.\n*\n* @param requestUrl - The full request URL\n* @param basePath - The base path of the auth API (e.g., \"/api/auth\")\n* @returns The normalized path without basePath prefix or trailing slashes,\n* or \"/\" if URL parsing fails\n*\n* @example\n* normalizePathname(\"http://localhost:3000/api/auth/sso/saml2/callback/provider1\", \"/api/auth\")\n* // Returns: \"/sso/saml2/callback/provider1\"\n*\n* normalizePathname(\"http://localhost:3000/sso/saml2/callback/provider1/\", \"/\")\n* // Returns: \"/sso/saml2/callback/provider1\"\n*/\nfunction normalizePathname(requestUrl, basePath) {\n\tlet pathname;\n\ttry {\n\t\tpathname = new URL(requestUrl).pathname.replace(/\\/+$/, \"\") || \"/\";\n\t} catch {\n\t\treturn \"/\";\n\t}\n\tconst normalizedBasePath = basePath.replace(/\\/+$/, \"\");\n\tif (normalizedBasePath === \"\") return pathname;\n\tif (pathname === normalizedBasePath) return \"/\";\n\tif (pathname.startsWith(normalizedBasePath + \"/\")) return pathname.slice(normalizedBasePath.length).replace(/\\/+$/, \"\") || \"/\";\n\treturn pathname;\n}\nconst URL_REFERENCE_ORIGIN = \"https://better-auth.invalid\";\n/**\n* Appends query parameters before the fragment of an absolute or root-relative URL.\n* Existing query text is retained without parsing it into name-value pairs.\n*\n* This function only composes URLs. Callers must validate untrusted input.\n*\n* @throws TypeError if parsing fails or a relative input changes authority.\n*/\nfunction appendQueryParams(input, params) {\n\tconst relative = input.startsWith(\"/\");\n\tif (input.startsWith(\"//\") || input.startsWith(\"/\\\\\")) throw new TypeError(\"Expected an absolute or root-relative URL\");\n\tconst parsedURL = relative ? new URL(input, URL_REFERENCE_ORIGIN) : new URL(input);\n\tif (relative && parsedURL.origin !== URL_REFERENCE_ORIGIN) throw new TypeError(\"Expected an absolute or root-relative URL\");\n\tconst query = params.toString();\n\tif (!query) return input;\n\tconst separator = parsedURL.search.endsWith(\"&\") ? \"\" : \"&\";\n\tparsedURL.search = parsedURL.search ? `${parsedURL.search}${separator}${query}` : query;\n\treturn relative ? parsedURL.href.slice(parsedURL.origin.length) : parsedURL.href;\n}\n/**\n* Schemes that execute or embed code when navigated to or accepted as a\n* redirect target. These are never safe as an OAuth `redirect_uri` or as a\n* client-side navigation target (`window.location.href`, `location.assign`, ...).\n*/\nconst DANGEROUS_URL_SCHEMES = [\n\t\"javascript:\",\n\t\"data:\",\n\t\"vbscript:\"\n];\n/**\n* Returns `false` only when `value` is an absolute URL using a dangerous scheme\n* (`javascript:`, `data:`, `vbscript:`). Relative URLs (e.g. `/dashboard`) and\n* safe absolute schemes (`http`, `https`, custom app schemes such as\n* `myapp://`) return `true`.\n*\n* Use this to guard browser navigation sinks and any redirect target that may\n* originate from untrusted input. It is intentionally narrow: it blocks code\n* execution schemes without rejecting relative paths or mobile deep links.\n*/\nfunction isSafeUrlScheme(value) {\n\tlet parsed;\n\ttry {\n\t\tparsed = new URL(value);\n\t} catch {\n\t\treturn true;\n\t}\n\treturn !DANGEROUS_URL_SCHEMES.includes(parsed.protocol);\n}\n//#endregion\nexport { DANGEROUS_URL_SCHEMES, appendQueryParams, isSafeUrlScheme, normalizePathname };\n","import { isSafeUrlScheme } from \"@better-auth/core/utils/url\";\n//#region src/client/fetch-plugins.ts\nconst redirectPlugin = {\n\tid: \"redirect\",\n\tname: \"Redirect\",\n\thooks: { onSuccess(context) {\n\t\tif (context.data?.url && context.data?.redirect && isSafeUrlScheme(context.data.url)) {\n\t\t\tif (typeof window !== \"undefined\" && window.location) {\n\t\t\t\tif (window.location) try {\n\t\t\t\t\twindow.location.href = context.data.url;\n\t\t\t\t} catch {}\n\t\t\t}\n\t\t}\n\t} }\n};\n//#endregion\nexport { redirectPlugin };\n","import { isJsonEqual, withEquality } from \"./equality.mjs\";\nimport { createAuthQueryAtom } from \"./query-atom.mjs\";\nimport { createSessionRefreshManager } from \"./session-refresh.mjs\";\nimport { STORE_UNMOUNT_DELAY, atom, onMount } from \"nanostores\";\n//#region src/client/session-atom.ts\nconst isServer = () => typeof window === \"undefined\";\nconst SESSION_MOUNT_DEDUPE_INTERVAL = STORE_UNMOUNT_DELAY;\nfunction hydrateSessionAtom(sessionAtom, session) {\n\tif (typeof window === \"undefined\") return;\n\tconst currentSession = sessionAtom.get();\n\tif (currentSession.data !== null || session === null) return;\n\tsessionAtom.set({\n\t\t...currentSession,\n\t\tdata: session,\n\t\terror: null,\n\t\tisPending: false\n\t});\n}\n/**\n* Normalize $fetch response: `throw: true` returns data directly,\n* otherwise `{ data, error }`.\n*/\nfunction normalizeSessionResponse(res) {\n\tif (typeof res === \"object\" && res !== null && \"data\" in res && \"error\" in res) return res;\n\treturn {\n\t\tdata: res,\n\t\terror: null\n\t};\n}\nfunction normalizeSessionData(data) {\n\tif (!data) return null;\n\tif (data.session === null && data.user === null) return null;\n\treturn data;\n}\nfunction isSessionAtomEqual(a, b) {\n\treturn isJsonEqual(a.data, b.data) && a.error === b.error && a.isPending === b.isPending && a.isRefetching === b.isRefetching && a.refetch === b.refetch;\n}\nfunction getSessionAtom($fetch, options) {\n\tconst $signal = atom(false);\n\tlet flight;\n\tlet freshUntil = 0;\n\tlet sessionRevision = 0;\n\t$signal.listen(() => {\n\t\tsessionRevision++;\n\t\tfreshUntil = 0;\n\t});\n\tconst refetch = (queryParams) => fetchSession(queryParams);\n\tconst session = createAuthQueryAtom({\n\t\tdata: null,\n\t\terror: null,\n\t\tisPending: true,\n\t\tisRefetching: false,\n\t\trefetch\n\t});\n\twithEquality(session, isSessionAtomEqual);\n\tconst executeSessionFetch = async (signal, queryParams) => {\n\t\tconst current = session.value;\n\t\tsession.set({\n\t\t\t...current,\n\t\t\tisPending: current.data === null,\n\t\t\tisRefetching: true,\n\t\t\terror: null,\n\t\t\trefetch\n\t\t});\n\t\tif (signal.aborted) return \"aborted\";\n\t\ttry {\n\t\t\tconst res = await $fetch(\"/get-session\", {\n\t\t\t\tmethod: \"GET\",\n\t\t\t\tquery: queryParams?.query,\n\t\t\t\tsignal\n\t\t\t});\n\t\t\tif (signal.aborted) return \"aborted\";\n\t\t\tlet { data, error } = normalizeSessionResponse(res);\n\t\t\tlet outcome = \"fresh\";\n\t\t\tif (data?.needsRefresh) try {\n\t\t\t\tconst refreshRes = await $fetch(\"/get-session\", {\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\tsignal\n\t\t\t\t});\n\t\t\t\tif (signal.aborted) return \"aborted\";\n\t\t\t\t({data, error} = normalizeSessionResponse(refreshRes));\n\t\t\t} catch {\n\t\t\t\tif (signal.aborted) return \"aborted\";\n\t\t\t\toutcome = \"stale\";\n\t\t\t}\n\t\t\tif (error) {\n\t\t\t\tconst latest = session.value;\n\t\t\t\tconst isUnauthorized = error?.status === 401;\n\t\t\t\tsession.set({\n\t\t\t\t\tdata: isUnauthorized ? null : latest.data,\n\t\t\t\t\terror,\n\t\t\t\t\tisPending: false,\n\t\t\t\t\tisRefetching: false,\n\t\t\t\t\trefetch\n\t\t\t\t});\n\t\t\t\treturn \"failed\";\n\t\t\t}\n\t\t\tconst sessionData = normalizeSessionData(data);\n\t\t\tconst current = session.value;\n\t\t\tconst stableData = current.data != null && sessionData != null && isJsonEqual(current.data, sessionData) ? current.data : sessionData;\n\t\t\tsession.set({\n\t\t\t\tdata: stableData,\n\t\t\t\terror: null,\n\t\t\t\tisPending: false,\n\t\t\t\tisRefetching: false,\n\t\t\t\trefetch\n\t\t\t});\n\t\t\treturn outcome;\n\t\t} catch (fetchError) {\n\t\t\tif (signal.aborted) return \"aborted\";\n\t\t\tconst latest = session.value;\n\t\t\tsession.set({\n\t\t\t\tdata: latest.data,\n\t\t\t\terror: fetchError,\n\t\t\t\tisPending: false,\n\t\t\t\tisRefetching: false,\n\t\t\t\trefetch\n\t\t\t});\n\t\t\treturn \"failed\";\n\t\t}\n\t};\n\tconst getFreshUntil = () => {\n\t\tconst expiresAt = session.value.data?.session?.expiresAt;\n\t\tconst sessionExpiresAt = expiresAt instanceof Date ? expiresAt.getTime() : Number.POSITIVE_INFINITY;\n\t\treturn Math.min(Date.now() + SESSION_MOUNT_DEDUPE_INTERVAL, sessionExpiresAt);\n\t};\n\tconst fetchSession = (queryParams) => {\n\t\tfreshUntil = 0;\n\t\tflight?.cancel();\n\t\tconst controller = new AbortController();\n\t\tconst request = {\n\t\t\tcancel: () => controller.abort(),\n\t\t\tpromise: Promise.resolve().then(() => {\n\t\t\t\tif (controller.signal.aborted) return \"aborted\";\n\t\t\t\treturn executeSessionFetch(controller.signal, queryParams);\n\t\t\t}),\n\t\t\trevision: sessionRevision\n\t\t};\n\t\tflight = request;\n\t\tconst settleFlight = (outcome) => {\n\t\t\tif (flight !== request) return;\n\t\t\tflight = void 0;\n\t\t\tif (outcome === \"fresh\" && request.revision === sessionRevision) freshUntil = getFreshUntil();\n\t\t};\n\t\trequest.promise.then(settleFlight, () => settleFlight(\"failed\"));\n\t\treturn request.promise.then(() => void 0);\n\t};\n\tconst fetchSessionOnMount = () => {\n\t\tif (flight?.revision === sessionRevision) return flight.promise.then(() => void 0);\n\t\tif (Date.now() < freshUntil) return Promise.resolve();\n\t\treturn fetchSession();\n\t};\n\tlet broadcastSessionUpdate = () => {};\n\tonMount(session, () => {\n\t\tlet timeoutId;\n\t\tif (!isServer()) timeoutId = setTimeout(() => {\n\t\t\tfetchSessionOnMount();\n\t\t}, 0);\n\t\tconst refreshManager = createSessionRefreshManager({\n\t\t\tfetchSession,\n\t\t\tshouldPollSession: () => session.value.data != null,\n\t\t\tsessionSignal: $signal,\n\t\t\toptions\n\t\t});\n\t\trefreshManager.init();\n\t\tbroadcastSessionUpdate = refreshManager.broadcastSessionUpdate;\n\t\treturn () => {\n\t\t\tif (timeoutId) clearTimeout(timeoutId);\n\t\t\trefreshManager.cleanup();\n\t\t};\n\t});\n\treturn {\n\t\tsession,\n\t\t$sessionSignal: $signal,\n\t\tbroadcastSessionUpdate: (trigger) => broadcastSessionUpdate(trigger)\n\t};\n}\n//#endregion\nexport { getSessionAtom, hydrateSessionAtom };\n","function isPlainObject(value) {\n if (value === null || typeof value !== \"object\") {\n return false;\n }\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {\n return false;\n }\n if (Symbol.iterator in value) {\n return false;\n }\n if (Symbol.toStringTag in value) {\n return Object.prototype.toString.call(value) === \"[object Module]\";\n }\n return true;\n}\n\nfunction _defu(baseObject, defaults, namespace = \".\", merger) {\n if (!isPlainObject(defaults)) {\n return _defu(baseObject, {}, namespace, merger);\n }\n const object = { ...defaults };\n for (const key of Object.keys(baseObject)) {\n if (key === \"__proto__\" || key === \"constructor\") {\n continue;\n }\n const value = baseObject[key];\n if (value === null || value === void 0) {\n continue;\n }\n if (merger && merger(object, key, value, namespace)) {\n continue;\n }\n if (Array.isArray(value) && Array.isArray(object[key])) {\n object[key] = [...value, ...object[key]];\n } else if (isPlainObject(value) && isPlainObject(object[key])) {\n object[key] = _defu(\n value,\n object[key],\n (namespace ? `${namespace}.` : \"\") + key.toString(),\n merger\n );\n } else {\n object[key] = value;\n }\n }\n return object;\n}\nfunction createDefu(merger) {\n return (...arguments_) => (\n // eslint-disable-next-line unicorn/no-array-reduce\n arguments_.reduce((p, c) => _defu(p, c, \"\", merger), {})\n );\n}\nconst defu = createDefu();\nconst defuFn = createDefu((object, key, currentValue) => {\n if (object[key] !== void 0 && typeof currentValue === \"function\") {\n object[key] = currentValue(object[key]);\n return true;\n }\n});\nconst defuArrayFn = createDefu((object, key, currentValue) => {\n if (Array.isArray(object[key]) && typeof currentValue === \"function\") {\n object[key] = currentValue(object[key]);\n return true;\n }\n});\n\nexport { createDefu, defu as default, defu, defuArrayFn, defuFn };\n","//#region src/error.ts\nvar BetterFetchError = class extends Error {\n\tconstructor(status, statusText, error) {\n\t\tsuper(statusText || status.toString(), { cause: error });\n\t\tthis.status = status;\n\t\tthis.statusText = statusText;\n\t\tthis.error = error;\n\t\tError.captureStackTrace(this, this.constructor);\n\t}\n};\n//#endregion\n//#region src/plugins.ts\nconst initializePlugins = async (url, options) => {\n\tlet opts = options || {};\n\tconst hooks = {\n\t\tonRequest: [options === null || options === void 0 ? void 0 : options.onRequest],\n\t\tonResponse: [options === null || options === void 0 ? void 0 : options.onResponse],\n\t\tonSuccess: [options === null || options === void 0 ? void 0 : options.onSuccess],\n\t\tonError: [options === null || options === void 0 ? void 0 : options.onError],\n\t\tonRetry: [options === null || options === void 0 ? void 0 : options.onRetry]\n\t};\n\tif (!options || !(options === null || options === void 0 ? void 0 : options.plugins)) return {\n\t\turl,\n\t\toptions: opts,\n\t\thooks\n\t};\n\tfor (const plugin of (options === null || options === void 0 ? void 0 : options.plugins) || []) {\n\t\tvar _plugin$hooks, _plugin$hooks2, _plugin$hooks3, _plugin$hooks4, _plugin$hooks5;\n\t\tif (plugin.init) {\n\t\t\tvar _plugin$init;\n\t\t\tconst pluginRes = await ((_plugin$init = plugin.init) === null || _plugin$init === void 0 ? void 0 : _plugin$init.call(plugin, url.toString(), opts));\n\t\t\topts = pluginRes.options || opts;\n\t\t\turl = pluginRes.url;\n\t\t}\n\t\thooks.onRequest.push((_plugin$hooks = plugin.hooks) === null || _plugin$hooks === void 0 ? void 0 : _plugin$hooks.onRequest);\n\t\thooks.onResponse.push((_plugin$hooks2 = plugin.hooks) === null || _plugin$hooks2 === void 0 ? void 0 : _plugin$hooks2.onResponse);\n\t\thooks.onSuccess.push((_plugin$hooks3 = plugin.hooks) === null || _plugin$hooks3 === void 0 ? void 0 : _plugin$hooks3.onSuccess);\n\t\thooks.onError.push((_plugin$hooks4 = plugin.hooks) === null || _plugin$hooks4 === void 0 ? void 0 : _plugin$hooks4.onError);\n\t\thooks.onRetry.push((_plugin$hooks5 = plugin.hooks) === null || _plugin$hooks5 === void 0 ? void 0 : _plugin$hooks5.onRetry);\n\t}\n\treturn {\n\t\turl,\n\t\toptions: opts,\n\t\thooks\n\t};\n};\n//#endregion\n//#region src/retry.ts\nvar LinearRetryStrategy = class {\n\tconstructor(options) {\n\t\tthis.options = options;\n\t}\n\tshouldAttemptRetry(attempt, response) {\n\t\tif (this.options.shouldRetry) return Promise.resolve(attempt < this.options.attempts && this.options.shouldRetry(response));\n\t\treturn Promise.resolve(attempt < this.options.attempts);\n\t}\n\tgetDelay() {\n\t\treturn this.options.delay;\n\t}\n};\nvar ExponentialRetryStrategy = class {\n\tconstructor(options) {\n\t\tthis.options = options;\n\t}\n\tshouldAttemptRetry(attempt, response) {\n\t\tif (this.options.shouldRetry) return Promise.resolve(attempt < this.options.attempts && this.options.shouldRetry(response));\n\t\treturn Promise.resolve(attempt < this.options.attempts);\n\t}\n\tgetDelay(attempt) {\n\t\treturn Math.min(this.options.maxDelay, this.options.baseDelay * 2 ** attempt);\n\t}\n};\nfunction createRetryStrategy(options) {\n\tif (typeof options === \"number\") return new LinearRetryStrategy({\n\t\ttype: \"linear\",\n\t\tattempts: options,\n\t\tdelay: 1e3\n\t});\n\tswitch (options.type) {\n\t\tcase \"linear\": return new LinearRetryStrategy(options);\n\t\tcase \"exponential\": return new ExponentialRetryStrategy(options);\n\t\tdefault: throw new Error(\"Invalid retry strategy\");\n\t}\n}\n//#endregion\n//#region src/create-fetch/schema.ts\nconst methods = [\n\t\"get\",\n\t\"post\",\n\t\"put\",\n\t\"patch\",\n\t\"delete\"\n];\nconst createSchema = (schema, config) => {\n\treturn {\n\t\tschema,\n\t\tconfig\n\t};\n};\n//#endregion\n//#region src/method.ts\nfunction parseMethodModifier(path) {\n\tif (!path.startsWith(\"@\")) return {\n\t\tmethod: void 0,\n\t\tpath\n\t};\n\tconst separator = path.indexOf(\"/\");\n\tconst method = path.slice(1, separator === -1 ? void 0 : separator);\n\tif (!methods.includes(method)) return {\n\t\tmethod: void 0,\n\t\tpath\n\t};\n\treturn {\n\t\tmethod,\n\t\tpath: separator === -1 ? path : path.slice(separator + 1)\n\t};\n}\n//#endregion\n//#region src/url.ts\nconst isReservedPathSegment = (value) => value === \".\" || value === \"..\";\nconst encodeLiteralPathSegment = (segment) => segment.split(\":\").map((part) => encodeURIComponent(part)).join(\":\");\nfunction resolvePathSegment(segment, pathParams) {\n\tconst pathParam = pathParams.get(segment);\n\tif (pathParam === void 0) return encodeLiteralPathSegment(segment);\n\tif (isReservedPathSegment(pathParam)) throw new TypeError(\"Path parameters cannot be reserved path segments\");\n\treturn encodeURIComponent(pathParam);\n}\n/**\n* Normalize URL\n*/\nfunction getURL$1(url, option) {\n\tconst { baseURL, params, query } = option || {\n\t\tquery: {},\n\t\tparams: {},\n\t\tbaseURL: \"\"\n\t};\n\tlet basePath = url.startsWith(\"http\") ? url.split(\"/\").slice(0, 3).join(\"/\") : baseURL || \"\";\n\tconst { path: requestPath } = parseMethodModifier(url);\n\tif (requestPath !== url) url = `/${requestPath}`;\n\tif (!basePath.endsWith(\"/\")) basePath += \"/\";\n\tlet [path, urlQuery] = url.replace(basePath, \"\").split(\"?\");\n\tconst queryParams = new URLSearchParams(urlQuery);\n\tfor (const [key, value] of Object.entries(query || {})) {\n\t\tif (value == null) continue;\n\t\tlet serializedValue;\n\t\tif (typeof value === \"string\") serializedValue = value;\n\t\telse if (Array.isArray(value)) {\n\t\t\tfor (const val of value) queryParams.append(key, val);\n\t\t\tcontinue;\n\t\t} else serializedValue = JSON.stringify(value);\n\t\tqueryParams.set(key, serializedValue);\n\t}\n\tconst pathParams = /* @__PURE__ */ new Map();\n\tif (params) if (Array.isArray(params)) {\n\t\tconst paramPaths = path.split(\"/\").filter((p) => p.startsWith(\":\"));\n\t\tfor (const [index, key] of paramPaths.entries()) {\n\t\t\tconst value = params[index];\n\t\t\tpathParams.set(key, String(value));\n\t\t}\n\t} else for (const [key, value] of Object.entries(params)) pathParams.set(`:${key}`, String(value));\n\tpath = path.split(\"/\").map((segment) => resolvePathSegment(segment, pathParams)).join(\"/\");\n\tpath = path.replace(/^\\/+/, \"\");\n\tlet queryParamString = queryParams.toString();\n\tqueryParamString = queryParamString.length > 0 ? `?${queryParamString}`.replace(/\\+/g, \"%20\") : \"\";\n\tif (!basePath.startsWith(\"http\")) return `${basePath}${path}${queryParamString}`;\n\treturn new URL(`${path}${queryParamString}`, basePath);\n}\n//#endregion\n//#region src/auth.ts\nconst getAuthHeader = async (options) => {\n\tconst headers = {};\n\tconst getValue = async (value) => typeof value === \"function\" ? await value() : value;\n\tif (options === null || options === void 0 ? void 0 : options.auth) {\n\t\tif (options.auth.type === \"Bearer\") {\n\t\t\tconst token = await getValue(options.auth.token);\n\t\t\tif (!token) return headers;\n\t\t\theaders[\"authorization\"] = `Bearer ${token}`;\n\t\t} else if (options.auth.type === \"Basic\") {\n\t\t\tconst [username, password] = await Promise.all([getValue(options.auth.username), getValue(options.auth.password)]);\n\t\t\tif (!username || !password) return headers;\n\t\t\theaders[\"authorization\"] = `Basic ${btoa(`${username}:${password}`)}`;\n\t\t} else if (options.auth.type === \"Custom\") {\n\t\t\tconst [prefix, value] = await Promise.all([getValue(options.auth.prefix), getValue(options.auth.value)]);\n\t\t\tif (!value) return headers;\n\t\t\theaders[\"authorization\"] = `${prefix !== null && prefix !== void 0 ? prefix : \"\"} ${value}`;\n\t\t}\n\t}\n\treturn headers;\n};\n//#endregion\n//#region src/utils.ts\nconst JSON_RE = /^application\\/(?:[\\w!#$%&*.^`~-]*\\+)?json(;.+)?$/i;\nfunction detectResponseType(request) {\n\tconst _contentType = request.headers.get(\"content-type\");\n\tconst textTypes = /* @__PURE__ */ new Set([\n\t\t\"image/svg\",\n\t\t\"application/xml\",\n\t\t\"application/xhtml\",\n\t\t\"application/html\"\n\t]);\n\tif (!_contentType) return \"json\";\n\tconst contentType = _contentType.split(\";\").shift() || \"\";\n\tif (JSON_RE.test(contentType)) return \"json\";\n\tif (textTypes.has(contentType) || contentType.startsWith(\"text/\")) return \"text\";\n\treturn \"blob\";\n}\nfunction isJSONParsable(value) {\n\ttry {\n\t\tJSON.parse(value);\n\t\treturn true;\n\t} catch (error) {\n\t\treturn false;\n\t}\n}\nfunction isJSONSerializable(value) {\n\tif (value === void 0) return false;\n\tconst t = typeof value;\n\tif (t === \"string\" || t === \"number\" || t === \"boolean\" || t === null) return true;\n\tif (t !== \"object\") return false;\n\tif (Array.isArray(value)) return true;\n\tif (value.buffer) return false;\n\treturn value.constructor && value.constructor.name === \"Object\" || typeof value.toJSON === \"function\";\n}\nfunction jsonParse(text) {\n\ttry {\n\t\treturn JSON.parse(text);\n\t} catch (error) {\n\t\treturn text;\n\t}\n}\nfunction isFunction(value) {\n\treturn typeof value === \"function\";\n}\nfunction getFetch(options) {\n\tif (options === null || options === void 0 ? void 0 : options.customFetchImpl) return options.customFetchImpl;\n\tif (typeof globalThis !== \"undefined\" && isFunction(globalThis.fetch)) return globalThis.fetch;\n\tif (typeof window !== \"undefined\" && isFunction(window.fetch)) return window.fetch;\n\tthrow new Error(\"No fetch implementation found\");\n}\nfunction isPayloadMethod(method) {\n\tif (!method) return false;\n\treturn [\n\t\t\"POST\",\n\t\t\"PUT\",\n\t\t\"PATCH\",\n\t\t\"DELETE\"\n\t].includes(method.toUpperCase());\n}\nfunction isRouteMethod(method) {\n\tconst routeMethod = [\n\t\t\"GET\",\n\t\t\"POST\",\n\t\t\"PUT\",\n\t\t\"PATCH\",\n\t\t\"DELETE\"\n\t];\n\tif (!method) return false;\n\treturn routeMethod.includes(method.toUpperCase());\n}\nfunction mergeHeaders(...sources) {\n\tconst merged = {};\n\tfor (const source of sources) {\n\t\tif (!source) continue;\n\t\tif (source instanceof Headers) source.forEach((value, key) => {\n\t\t\tmerged[key] = value;\n\t\t});\n\t\telse {\n\t\t\tconst entries = Array.isArray(source) ? source : Object.entries(source);\n\t\t\tfor (const [key, value] of entries) if (value !== null && value !== void 0) merged[key] = value;\n\t\t}\n\t}\n\treturn merged;\n}\nasync function getHeaders(opts) {\n\tconst headers = new Headers(mergeHeaders(opts === null || opts === void 0 ? void 0 : opts.headers, await getAuthHeader(opts)));\n\tif (!headers.has(\"content-type\")) {\n\t\tconst contentType = detectContentType(opts === null || opts === void 0 ? void 0 : opts.body);\n\t\tif (contentType) headers.set(\"content-type\", contentType);\n\t}\n\treturn headers;\n}\nfunction getURL(url, options) {\n\tconst { path } = parseMethodModifier(url);\n\tif (path !== url) url = `/${path}`;\n\tlet _url;\n\ttry {\n\t\tif (url.startsWith(\"http\")) _url = url;\n\t\telse {\n\t\t\tlet baseURL = options === null || options === void 0 ? void 0 : options.baseURL;\n\t\t\tif (baseURL && !(baseURL === null || baseURL === void 0 ? void 0 : baseURL.endsWith(\"/\"))) baseURL = baseURL + \"/\";\n\t\t\tif (url.startsWith(\"/\")) _url = new URL(url.substring(1), baseURL);\n\t\t\telse _url = new URL(url, options === null || options === void 0 ? void 0 : options.baseURL);\n\t\t}\n\t} catch (e) {\n\t\tif (e instanceof TypeError) {\n\t\t\tif (!(options === null || options === void 0 ? void 0 : options.baseURL)) throw TypeError(`Invalid URL ${url}. Are you passing in a relative url but not setting the baseURL?`);\n\t\t\tthrow TypeError(`Invalid URL ${url}. Please validate that you are passing the correct input.`);\n\t\t}\n\t\tthrow e;\n\t}\n\t/**\n\t* Dynamic Parameters.\n\t*/\n\tif (options === null || options === void 0 ? void 0 : options.params) if (Array.isArray(options === null || options === void 0 ? void 0 : options.params)) {\n\t\tconst params = (options === null || options === void 0 ? void 0 : options.params) ? Array.isArray(options.params) ? `/${options.params.join(\"/\")}` : `/${Object.values(options.params).join(\"/\")}` : \"\";\n\t\t_url = _url.toString().split(\"/:\")[0];\n\t\t_url = `${_url.toString()}${params}`;\n\t} else for (const [key, value] of Object.entries(options === null || options === void 0 ? void 0 : options.params)) _url = _url.toString().replace(`:${key}`, String(value));\n\tconst __url = new URL(_url);\n\t/**\n\t* Query Parameters\n\t*/\n\tconst queryParams = options === null || options === void 0 ? void 0 : options.query;\n\tif (queryParams) for (const [key, value] of Object.entries(queryParams)) __url.searchParams.append(key, String(value));\n\treturn __url;\n}\nfunction detectContentType(body) {\n\tif (isJSONSerializable(body)) return \"application/json\";\n\treturn null;\n}\nfunction getMediaType(headers) {\n\tconst contentType = headers.get(\"content-type\");\n\treturn contentType ? contentType.split(\";\")[0].trim().toLowerCase() : null;\n}\nfunction getBody(options, headers) {\n\tconst { body } = options;\n\tif (!body) return null;\n\tif (!isJSONSerializable(body)) return body;\n\tif (typeof body === \"string\") return body;\n\tif (getMediaType(headers) === \"application/x-www-form-urlencoded\") return new URLSearchParams(body).toString();\n\treturn JSON.stringify(body);\n}\nfunction getMethod(url, options) {\n\tif (options === null || options === void 0 ? void 0 : options.method) return options.method.toUpperCase();\n\tconst { method } = parseMethodModifier(url);\n\tif (method) return method.toUpperCase();\n\treturn (options === null || options === void 0 ? void 0 : options.body) ? \"POST\" : \"GET\";\n}\nfunction getTimeout(options, controller) {\n\tlet abortTimeout;\n\tif (!(options === null || options === void 0 ? void 0 : options.signal) && (options === null || options === void 0 ? void 0 : options.timeout)) abortTimeout = setTimeout(() => controller === null || controller === void 0 ? void 0 : controller.abort(), options === null || options === void 0 ? void 0 : options.timeout);\n\treturn {\n\t\tabortTimeout,\n\t\tclearTimeout: () => {\n\t\t\tif (abortTimeout) clearTimeout(abortTimeout);\n\t\t}\n\t};\n}\nfunction bodyParser(data, responseType) {\n\tif (responseType === \"json\") return JSON.parse(data);\n\treturn data;\n}\nvar ValidationError = class ValidationError extends Error {\n\tconstructor(issues, message) {\n\t\tsuper(message || JSON.stringify(issues, null, 2));\n\t\tthis.issues = issues;\n\t\tObject.setPrototypeOf(this, ValidationError.prototype);\n\t}\n};\nasync function parseStandardSchema(schema, input) {\n\tconst result = await schema[\"~standard\"].validate(input);\n\tif (result.issues) throw new ValidationError(result.issues);\n\treturn result.value;\n}\n//#endregion\n//#region \\0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js\nfunction _typeof(o) {\n\t\"@babel/helpers - typeof\";\n\treturn _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(o) {\n\t\treturn typeof o;\n\t} : function(o) {\n\t\treturn o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n\t}, _typeof(o);\n}\n//#endregion\n//#region \\0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js\nfunction toPrimitive(t, r) {\n\tif (\"object\" != _typeof(t) || !t) return t;\n\tvar e = t[Symbol.toPrimitive];\n\tif (void 0 !== e) {\n\t\tvar i = e.call(t, r || \"default\");\n\t\tif (\"object\" != _typeof(i)) return i;\n\t\tthrow new TypeError(\"@@toPrimitive must return a primitive value.\");\n\t}\n\treturn (\"string\" === r ? String : Number)(t);\n}\n//#endregion\n//#region \\0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js\nfunction toPropertyKey(t) {\n\tvar i = toPrimitive(t, \"string\");\n\treturn \"symbol\" == _typeof(i) ? i : i + \"\";\n}\n//#endregion\n//#region \\0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js\nfunction _defineProperty(e, r, t) {\n\treturn (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n\t\tvalue: t,\n\t\tenumerable: !0,\n\t\tconfigurable: !0,\n\t\twritable: !0\n\t}) : e[r] = t, e;\n}\n//#endregion\n//#region \\0@oxc-project+runtime@0.140.0/helpers/esm/objectSpread2.js\nfunction ownKeys(e, r) {\n\tvar t = Object.keys(e);\n\tif (Object.getOwnPropertySymbols) {\n\t\tvar o = Object.getOwnPropertySymbols(e);\n\t\tr && (o = o.filter(function(r) {\n\t\t\treturn Object.getOwnPropertyDescriptor(e, r).enumerable;\n\t\t})), t.push.apply(t, o);\n\t}\n\treturn t;\n}\nfunction _objectSpread2(e) {\n\tfor (var r = 1; r < arguments.length; r++) {\n\t\tvar t = null != arguments[r] ? arguments[r] : {};\n\t\tr % 2 ? ownKeys(Object(t), !0).forEach(function(r) {\n\t\t\t_defineProperty(e, r, t[r]);\n\t\t}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {\n\t\t\tObject.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n\t\t});\n\t}\n\treturn e;\n}\n//#endregion\n//#region src/fetch.ts\nconst betterFetch = async (url, options) => {\n\tvar _opts$signal, _options$body, _options$jsonParser;\n\tconst { hooks, url: __url, options: opts } = await initializePlugins(url, options);\n\tconst fetch = getFetch(opts);\n\tconst controller = new AbortController();\n\tconst signal = (_opts$signal = opts.signal) !== null && _opts$signal !== void 0 ? _opts$signal : controller.signal;\n\tconst _url = getURL$1(__url, opts);\n\tconst headers = await getHeaders(opts);\n\tconst body = getBody(opts, headers);\n\tconst method = getMethod(__url, opts);\n\tconst context = _objectSpread2(_objectSpread2({}, opts), {}, {\n\t\turl: _url,\n\t\theaders,\n\t\tbody,\n\t\tmethod,\n\t\tsignal\n\t});\n\t/**\n\t* Run all on request hooks\n\t*/\n\tfor (const onRequest of hooks.onRequest) if (onRequest) {\n\t\tconst res = await onRequest(context);\n\t\tif (typeof res === \"object\" && res !== null) Object.assign(context, res);\n\t}\n\tif (\"pipeTo\" in context && typeof context.pipeTo === \"function\" || typeof (options === null || options === void 0 || (_options$body = options.body) === null || _options$body === void 0 ? void 0 : _options$body.pipe) === \"function\") {\n\t\tif (!(\"duplex\" in context)) context.duplex = \"half\";\n\t}\n\tconst { clearTimeout } = getTimeout(opts, controller);\n\tlet response = await fetch(context.url, context);\n\tclearTimeout();\n\tconst responseContext = {\n\t\tresponse,\n\t\trequest: context\n\t};\n\tfor (const onResponse of hooks.onResponse) if (onResponse) {\n\t\tvar _options$hookOptions;\n\t\tconst r = await onResponse(_objectSpread2(_objectSpread2({}, responseContext), {}, { response: (options === null || options === void 0 || (_options$hookOptions = options.hookOptions) === null || _options$hookOptions === void 0 ? void 0 : _options$hookOptions.cloneResponse) ? response.clone() : response }));\n\t\tif (r instanceof Response) response = r;\n\t\telse if (typeof r === \"object\" && r !== null) response = r.response;\n\t}\n\t/**\n\t* OK Branch\n\t*/\n\tif (response.ok) {\n\t\tif (!(context.method !== \"HEAD\")) return {\n\t\t\tdata: \"\",\n\t\t\terror: null\n\t\t};\n\t\tconst responseType = detectResponseType(response);\n\t\tconst successContext = {\n\t\t\tdata: null,\n\t\t\tresponse,\n\t\t\trequest: context\n\t\t};\n\t\tif (responseType === \"json\" || responseType === \"text\") {\n\t\t\tvar _context$jsonParser;\n\t\t\tconst text = await response.text();\n\t\t\tsuccessContext.data = await ((_context$jsonParser = context.jsonParser) !== null && _context$jsonParser !== void 0 ? _context$jsonParser : jsonParse)(text);\n\t\t} else successContext.data = await response[responseType]();\n\t\t/**\n\t\t* Parse the data if the output schema is defined\n\t\t*/\n\t\tif (context === null || context === void 0 ? void 0 : context.output) {\n\t\t\tif (context.output && !context.disableValidation) successContext.data = await parseStandardSchema(context.output, successContext.data);\n\t\t}\n\t\tfor (const onSuccess of hooks.onSuccess) if (onSuccess) {\n\t\t\tvar _options$hookOptions2;\n\t\t\tawait onSuccess(_objectSpread2(_objectSpread2({}, successContext), {}, { response: (options === null || options === void 0 || (_options$hookOptions2 = options.hookOptions) === null || _options$hookOptions2 === void 0 ? void 0 : _options$hookOptions2.cloneResponse) ? response.clone() : response }));\n\t\t}\n\t\tif (options === null || options === void 0 ? void 0 : options.throw) return successContext.data;\n\t\treturn {\n\t\t\tdata: successContext.data,\n\t\t\terror: null\n\t\t};\n\t}\n\tconst parser = (_options$jsonParser = options === null || options === void 0 ? void 0 : options.jsonParser) !== null && _options$jsonParser !== void 0 ? _options$jsonParser : jsonParse;\n\tconst responseText = await response.text();\n\tconst isJSONResponse = isJSONParsable(responseText);\n\tconst errorObject = isJSONResponse ? await parser(responseText) : null;\n\t/**\n\t* Error Branch\n\t*/\n\tconst errorContext = {\n\t\tresponse,\n\t\tresponseText,\n\t\trequest: context,\n\t\terror: _objectSpread2(_objectSpread2({}, errorObject), {}, {\n\t\t\tstatus: response.status,\n\t\t\tstatusText: response.statusText\n\t\t})\n\t};\n\tfor (const onError of hooks.onError) if (onError) {\n\t\tvar _options$hookOptions3;\n\t\tawait onError(_objectSpread2(_objectSpread2({}, errorContext), {}, { response: (options === null || options === void 0 || (_options$hookOptions3 = options.hookOptions) === null || _options$hookOptions3 === void 0 ? void 0 : _options$hookOptions3.cloneResponse) ? response.clone() : response }));\n\t}\n\tif (options === null || options === void 0 ? void 0 : options.retry) {\n\t\tvar _options$retryAttempt;\n\t\tconst retryStrategy = createRetryStrategy(options.retry);\n\t\tconst _retryAttempt = (_options$retryAttempt = options.retryAttempt) !== null && _options$retryAttempt !== void 0 ? _options$retryAttempt : 0;\n\t\tif (await retryStrategy.shouldAttemptRetry(_retryAttempt, response)) {\n\t\t\tfor (const onRetry of hooks.onRetry) if (onRetry) await onRetry(responseContext);\n\t\t\tconst delay = retryStrategy.getDelay(_retryAttempt);\n\t\t\tawait new Promise((resolve) => setTimeout(resolve, delay));\n\t\t\treturn await betterFetch(url, _objectSpread2(_objectSpread2({}, options), {}, { retryAttempt: _retryAttempt + 1 }));\n\t\t}\n\t}\n\tif (options === null || options === void 0 ? void 0 : options.throw) throw new BetterFetchError(response.status, response.statusText, isJSONResponse ? errorObject : responseText);\n\treturn {\n\t\tdata: null,\n\t\terror: _objectSpread2(_objectSpread2({}, errorObject), {}, {\n\t\t\tstatus: response.status,\n\t\t\tstatusText: response.statusText\n\t\t})\n\t};\n};\n//#endregion\n//#region src/create-fetch/index.ts\nconst applySchemaPlugin = (config) => ({\n\tid: \"apply-schema\",\n\tname: \"Apply Schema\",\n\tversion: \"1.0.0\",\n\tasync init(url, options) {\n\t\tvar _config$plugins;\n\t\tlet opts = _objectSpread2(_objectSpread2({}, options), config.query !== void 0 && { query: _objectSpread2(_objectSpread2({}, config.query), options === null || options === void 0 ? void 0 : options.query) });\n\t\tconst schema = ((_config$plugins = config.plugins) === null || _config$plugins === void 0 || (_config$plugins = _config$plugins.find((plugin) => {\n\t\t\tvar _plugin$schema;\n\t\t\treturn ((_plugin$schema = plugin.schema) === null || _plugin$schema === void 0 ? void 0 : _plugin$schema.config) ? url.startsWith(plugin.schema.config.baseURL || \"\") || url.startsWith(plugin.schema.config.prefix || \"\") : false;\n\t\t})) === null || _config$plugins === void 0 ? void 0 : _config$plugins.schema) || config.schema;\n\t\tif (schema) {\n\t\t\tvar _schema$config, _schema$config2;\n\t\t\tlet urlKey = url;\n\t\t\tif ((_schema$config = schema.config) === null || _schema$config === void 0 ? void 0 : _schema$config.prefix) {\n\t\t\t\tif (urlKey.startsWith(schema.config.prefix)) {\n\t\t\t\t\turlKey = urlKey.replace(schema.config.prefix, \"\");\n\t\t\t\t\tif (schema.config.baseURL) url = url.replace(schema.config.prefix, schema.config.baseURL);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ((_schema$config2 = schema.config) === null || _schema$config2 === void 0 ? void 0 : _schema$config2.baseURL) {\n\t\t\t\tif (urlKey.startsWith(schema.config.baseURL)) urlKey = urlKey.replace(schema.config.baseURL, \"\");\n\t\t\t}\n\t\t\tif (urlKey.startsWith(\"/\") && urlKey.charAt(1) === \"@\") urlKey = urlKey.substring(1);\n\t\t\tconst keySchema = schema.schema[urlKey];\n\t\t\tif (keySchema) {\n\t\t\t\tvar _keySchema$method;\n\t\t\t\tconst { method: schemaMethod, path } = parseMethodModifier(urlKey);\n\t\t\t\tif (schemaMethod) url = url.slice(0, url.length - urlKey.length) + path;\n\t\t\t\tlet validatedHeaders = options === null || options === void 0 ? void 0 : options.headers;\n\t\t\t\tif (keySchema.headers && !(options === null || options === void 0 ? void 0 : options.disableValidation)) {\n\t\t\t\t\tconst normalizedHeaders = {};\n\t\t\t\t\tif (options === null || options === void 0 ? void 0 : options.headers) {\n\t\t\t\t\t\tif (options.headers instanceof Headers) options.headers.forEach((value, key) => {\n\t\t\t\t\t\t\tnormalizedHeaders[key.toLowerCase()] = value;\n\t\t\t\t\t\t});\n\t\t\t\t\t\telse if (typeof options.headers === \"object\") {\n\t\t\t\t\t\t\tfor (const [key, value] of Object.entries(options.headers)) if (value !== null && value !== void 0) normalizedHeaders[key.toLowerCase()] = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tconst validated = await parseStandardSchema(keySchema.headers, normalizedHeaders);\n\t\t\t\t\tconst finalHeaders = {};\n\t\t\t\t\tfor (const [key, value] of Object.entries(validated)) finalHeaders[key.toLowerCase()] = value;\n\t\t\t\t\tvalidatedHeaders = finalHeaders;\n\t\t\t\t}\n\t\t\t\tconst method = (_keySchema$method = keySchema.method) !== null && _keySchema$method !== void 0 ? _keySchema$method : schemaMethod;\n\t\t\t\topts = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, opts), method !== void 0 && { method }), keySchema.output !== void 0 && { output: keySchema.output }), validatedHeaders !== void 0 && { headers: validatedHeaders });\n\t\t\t\tif (!(options === null || options === void 0 ? void 0 : options.disableValidation)) {\n\t\t\t\t\tif (keySchema.query) {\n\t\t\t\t\t\topts.query = await parseStandardSchema(keySchema.query, options === null || options === void 0 ? void 0 : options.query);\n\t\t\t\t\t\tif (opts.query !== null && typeof opts.query === \"object\") {\n\t\t\t\t\t\t\tconst defaults = _objectSpread2({}, config.query);\n\t\t\t\t\t\t\tfor (const key of Object.keys(defaults)) if ((options === null || options === void 0 ? void 0 : options.query) && Object.prototype.hasOwnProperty.call(options.query, key)) defaults[key] = options.query[key];\n\t\t\t\t\t\t\topts.query = _objectSpread2(_objectSpread2({}, defaults), opts.query);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\topts = _objectSpread2(_objectSpread2({}, opts), {}, {\n\t\t\t\t\t\tbody: keySchema.input ? await parseStandardSchema(keySchema.input, options === null || options === void 0 ? void 0 : options.body) : options === null || options === void 0 ? void 0 : options.body,\n\t\t\t\t\t\tparams: keySchema.params ? await parseStandardSchema(keySchema.params, options === null || options === void 0 ? void 0 : options.params) : options === null || options === void 0 ? void 0 : options.params\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\turl,\n\t\t\t\t\toptions: opts\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\treturn _objectSpread2({ url }, (options !== void 0 || config.query !== void 0) && { options: opts });\n\t}\n});\nconst createFetch = (config) => {\n\tasync function $fetch(url, options) {\n\t\tconst opts = _objectSpread2(_objectSpread2(_objectSpread2({}, config), options), {}, {\n\t\t\theaders: mergeHeaders(config === null || config === void 0 ? void 0 : config.headers, options === null || options === void 0 ? void 0 : options.headers),\n\t\t\tplugins: [\n\t\t\t\t...(config === null || config === void 0 ? void 0 : config.plugins) || [],\n\t\t\t\tapplySchemaPlugin(config || {}),\n\t\t\t\t...(options === null || options === void 0 ? void 0 : options.plugins) || []\n\t\t\t]\n\t\t});\n\t\tif (config === null || config === void 0 ? void 0 : config.catchAllError) try {\n\t\t\treturn await betterFetch(url, opts);\n\t\t} catch (error) {\n\t\t\treturn {\n\t\t\t\tdata: null,\n\t\t\t\terror: {\n\t\t\t\t\tstatus: 500,\n\t\t\t\t\tstatusText: \"Fetch Error\",\n\t\t\t\t\tmessage: \"Fetch related error. Captured by catchAllError option. See error property for more details.\",\n\t\t\t\t\terror\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\treturn await betterFetch(url, opts);\n\t}\n\treturn $fetch;\n};\n//#endregion\nexport { BetterFetchError, ValidationError, applySchemaPlugin, betterFetch, bodyParser, createFetch, createRetryStrategy, createSchema, detectContentType, detectResponseType, getBody, getFetch, getHeaders, getMethod, getTimeout, getURL, initializePlugins, isFunction, isJSONParsable, isJSONSerializable, isPayloadMethod, isRouteMethod, jsonParse, mergeHeaders, methods, parseStandardSchema };\n\n//# sourceMappingURL=index.js.map","import { getBaseURL } from \"../utils/url.mjs\";\nimport { parseJSON } from \"./parser.mjs\";\nimport { redirectPlugin } from \"./fetch-plugins.mjs\";\nimport { getSessionAtom, hydrateSessionAtom } from \"./session-atom.mjs\";\nimport { defu } from \"defu\";\nimport { createFetch } from \"@better-fetch/fetch\";\n//#region src/client/config.ts\nconst resolvePublicAuthUrl = (basePath) => {\n\tif (typeof process === \"undefined\") return void 0;\n\tconst path = basePath ?? \"/api/auth\";\n\tif (process.env.NEXT_PUBLIC_AUTH_URL) return process.env.NEXT_PUBLIC_AUTH_URL;\n\tif (typeof window === \"undefined\") {\n\t\tif (process.env.NEXTAUTH_URL) try {\n\t\t\treturn process.env.NEXTAUTH_URL;\n\t\t} catch {}\n\t\tif (process.env.VERCEL_URL) try {\n\t\t\tconst protocol = process.env.VERCEL_URL.startsWith(\"http\") ? \"\" : \"https://\";\n\t\t\treturn `${new URL(`${protocol}${process.env.VERCEL_URL}`).origin}${path}`;\n\t\t} catch {}\n\t}\n};\nconst matchesSessionSignal = (path) => path === \"/sign-out\" || path === \"/update-user\" || path === \"/update-session\" || path === \"/sign-up/email\" || path === \"/sign-in/email\" || path === \"/delete-user\" || path === \"/verify-email\" || path === \"/revoke-sessions\" || path === \"/revoke-session\" || path === \"/revoke-other-sessions\" || path === \"/change-email\" || path === \"/change-password\";\nconst getClientConfig = (options, loadEnv) => {\n\tconst isCredentialsSupported = \"credentials\" in Request.prototype;\n\tconst baseURL = getBaseURL(options?.baseURL, options?.basePath, void 0, loadEnv) ?? resolvePublicAuthUrl(options?.basePath) ?? \"/api/auth\";\n\tconst pluginsFetchPlugins = options?.plugins?.flatMap((plugin) => plugin.fetchPlugins).filter((pl) => pl !== void 0) || [];\n\tconst lifeCyclePlugin = {\n\t\tid: \"lifecycle-hooks\",\n\t\tname: \"lifecycle-hooks\",\n\t\thooks: {\n\t\t\tonSuccess: options?.fetchOptions?.onSuccess,\n\t\t\tonError: options?.fetchOptions?.onError,\n\t\t\tonRequest: options?.fetchOptions?.onRequest,\n\t\t\tonResponse: options?.fetchOptions?.onResponse\n\t\t}\n\t};\n\tconst { onSuccess: _onSuccess, onError: _onError, onRequest: _onRequest, onResponse: _onResponse, ...restOfFetchOptions } = options?.fetchOptions || {};\n\tconst $fetch = createFetch({\n\t\tbaseURL,\n\t\t...isCredentialsSupported ? { credentials: \"include\" } : {},\n\t\tmethod: \"GET\",\n\t\tjsonParser(text) {\n\t\t\tif (!text) return null;\n\t\t\treturn parseJSON(text, { strict: false });\n\t\t},\n\t\tcustomFetchImpl: fetch,\n\t\t...restOfFetchOptions,\n\t\tplugins: [\n\t\t\tlifeCyclePlugin,\n\t\t\t...restOfFetchOptions.plugins || [],\n\t\t\t...options?.disableDefaultFetchPlugins ? [] : [redirectPlugin],\n\t\t\t...pluginsFetchPlugins\n\t\t]\n\t});\n\tconst { $sessionSignal, session, broadcastSessionUpdate } = getSessionAtom($fetch, options);\n\tlet hasHydrated = false;\n\tconst hydrateSession = (sessionData) => {\n\t\tif (hasHydrated || sessionData === null) return;\n\t\thasHydrated = true;\n\t\thydrateSessionAtom(session, sessionData);\n\t};\n\tconst plugins = options?.plugins || [];\n\tlet pluginsActions = {};\n\tconst pluginsAtoms = {\n\t\t$sessionSignal,\n\t\tsession\n\t};\n\tconst pluginPathMethods = {\n\t\t\"/sign-out\": \"POST\",\n\t\t\"/revoke-sessions\": \"POST\",\n\t\t\"/revoke-other-sessions\": \"POST\",\n\t\t\"/delete-user\": \"POST\"\n\t};\n\tconst atomListeners = [{\n\t\tsignal: \"$sessionSignal\",\n\t\tmatcher: matchesSessionSignal,\n\t\tcallback(path) {\n\t\t\tif (path === \"/sign-out\") broadcastSessionUpdate(\"signout\");\n\t\t\telse if (path === \"/update-user\" || path === \"/update-session\") broadcastSessionUpdate(\"updateUser\");\n\t\t}\n\t}];\n\tfor (const plugin of plugins) {\n\t\tif (plugin.getAtoms) Object.assign(pluginsAtoms, plugin.getAtoms?.($fetch));\n\t\tif (plugin.pathMethods) Object.assign(pluginPathMethods, plugin.pathMethods);\n\t\tif (plugin.atomListeners) atomListeners.push(...plugin.atomListeners);\n\t}\n\tconst $store = {\n\t\tnotify: (signal) => {\n\t\t\tpluginsAtoms[signal].set(!pluginsAtoms[signal].get());\n\t\t},\n\t\tlisten: (signal, listener) => {\n\t\t\tpluginsAtoms[signal].subscribe(listener);\n\t\t},\n\t\tatoms: pluginsAtoms\n\t};\n\tfor (const plugin of plugins) if (plugin.getActions) pluginsActions = defu(plugin.getActions?.($fetch, $store, options) ?? {}, pluginsActions);\n\treturn {\n\t\tget baseURL() {\n\t\t\treturn baseURL;\n\t\t},\n\t\tpluginsActions,\n\t\tpluginsAtoms,\n\t\tpluginPathMethods,\n\t\tatomListeners,\n\t\thydrateSession,\n\t\t$sessionSignal,\n\t\t$fetch,\n\t\t$store\n\t};\n};\n//#endregion\nexport { getClientConfig, matchesSessionSignal };\n","//#region src/utils/is-atom.ts\nfunction isAtom(value) {\n\treturn typeof value === \"object\" && value !== null && \"get\" in value && typeof value.get === \"function\" && \"lc\" in value && typeof value.lc === \"number\";\n}\n//#endregion\nexport { isAtom };\n","//#region src/utils/string.ts\nfunction capitalizeFirstLetter(str) {\n\treturn str.charAt(0).toUpperCase() + str.slice(1);\n}\nconst WORD_PATTERN = /[\\p{Ll}\\d]+|\\p{Lu}+(?!\\p{Ll})|\\p{Lu}[\\p{Ll}\\d]+|\\p{Lo}+/gu;\nconst APOSTROPHE_PATTERN = /['\\u2019]/g;\nfunction splitWords(input) {\n\treturn input.replace(APOSTROPHE_PATTERN, \"\").match(WORD_PATTERN) ?? [];\n}\nfunction toSnakeCase(input) {\n\treturn splitWords(input).map((word) => word.toLowerCase()).join(\"_\");\n}\nfunction toKebabCase(input) {\n\treturn splitWords(input).map((word) => word.toLowerCase()).join(\"-\");\n}\nfunction toCamelCase(input) {\n\treturn splitWords(input).reduce((acc, word, i) => {\n\t\treturn acc + (i === 0 ? word.toLowerCase() : `${word[0].toUpperCase()}${word.slice(1)}`);\n\t}, \"\");\n}\nfunction toPascalCase(input) {\n\treturn splitWords(input).map((word) => `${word[0].toUpperCase()}${word.slice(1).toLowerCase()}`).join(\"\");\n}\n//#endregion\nexport { capitalizeFirstLetter, toCamelCase, toKebabCase, toPascalCase, toSnakeCase };\n","import { isAtom } from \"../utils/is-atom.mjs\";\nimport { toKebabCase } from \"@better-auth/core/utils/string\";\n//#region src/client/proxy.ts\nfunction getMethod(path, knownPathMethods, args) {\n\tconst method = knownPathMethods[path];\n\tconst { fetchOptions, query: _query, ...body } = args || {};\n\tif (method) return method;\n\tif (fetchOptions?.method) return fetchOptions.method;\n\tif (body && Object.keys(body).length > 0) return \"POST\";\n\treturn \"GET\";\n}\nfunction createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomListeners) {\n\tfunction createProxy(path = []) {\n\t\treturn new Proxy(function() {}, {\n\t\t\tget(_, prop) {\n\t\t\t\tif (typeof prop !== \"string\") return;\n\t\t\t\tif (prop === \"then\" || prop === \"catch\" || prop === \"finally\") return;\n\t\t\t\tconst fullPath = [...path, prop];\n\t\t\t\tlet current = routes;\n\t\t\t\tfor (const segment of fullPath) if (current && typeof current === \"object\" && segment in current) current = current[segment];\n\t\t\t\telse {\n\t\t\t\t\tcurrent = void 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (typeof current === \"function\") return current;\n\t\t\t\tif (isAtom(current)) return current;\n\t\t\t\treturn createProxy(fullPath);\n\t\t\t},\n\t\t\tapply: async (_, __, args) => {\n\t\t\t\tconst routePath = \"/\" + path.map(toKebabCase).join(\"/\");\n\t\t\t\tconst arg = args[0] || {};\n\t\t\t\tconst fetchOptions = args[1] || {};\n\t\t\t\tconst { query, fetchOptions: argFetchOptions, ...body } = arg;\n\t\t\t\tconst options = {\n\t\t\t\t\t...fetchOptions,\n\t\t\t\t\t...argFetchOptions\n\t\t\t\t};\n\t\t\t\tconst method = getMethod(routePath, knownPathMethods, arg);\n\t\t\t\treturn await client(routePath, {\n\t\t\t\t\t...options,\n\t\t\t\t\tbody: method === \"GET\" ? void 0 : {\n\t\t\t\t\t\t...body,\n\t\t\t\t\t\t...options?.body || {}\n\t\t\t\t\t},\n\t\t\t\t\tquery: query || options?.query,\n\t\t\t\t\tmethod,\n\t\t\t\t\tasync onSuccess(context) {\n\t\t\t\t\t\tawait options?.onSuccess?.(context);\n\t\t\t\t\t\tif (!atomListeners || options.disableSignal) return;\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t* We trigger listeners\n\t\t\t\t\t\t*/\n\t\t\t\t\t\tconst matches = atomListeners.filter((s) => s.matcher(routePath));\n\t\t\t\t\t\tif (!matches.length) return;\n\t\t\t\t\t\tconst visited = /* @__PURE__ */ new Set();\n\t\t\t\t\t\tfor (const match of matches) {\n\t\t\t\t\t\t\tconst signal = atoms[match.signal];\n\t\t\t\t\t\t\tif (!signal) return;\n\t\t\t\t\t\t\tif (visited.has(match.signal)) continue;\n\t\t\t\t\t\t\tvisited.add(match.signal);\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t* To avoid race conditions we set the signal in a setTimeout\n\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\tconst val = signal.get();\n\t\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\t\tsignal.set(!val);\n\t\t\t\t\t\t\t}, 10);\n\t\t\t\t\t\t\tmatch.callback?.(routePath);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\treturn createProxy();\n}\n//#endregion\nexport { createDynamicPathProxy };\n","import { getClientConfig } from \"./config.mjs\";\nimport { createDynamicPathProxy } from \"./proxy.mjs\";\nimport { capitalizeFirstLetter } from \"@better-auth/core/utils/string\";\n//#region src/client/vanilla.ts\nfunction createAuthClient(options) {\n\tconst { pluginPathMethods, pluginsActions, pluginsAtoms, hydrateSession, $fetch, atomListeners, $store } = getClientConfig(options);\n\tconst resolvedHooks = {};\n\tfor (const [key, value] of Object.entries(pluginsAtoms)) resolvedHooks[`use${capitalizeFirstLetter(key)}`] = value;\n\treturn createDynamicPathProxy({\n\t\t...pluginsActions,\n\t\t...resolvedHooks,\n\t\thydrateSession,\n\t\t$fetch,\n\t\t$store\n\t}, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);\n}\n//#endregion\nexport { createAuthClient };\n","import { n as PASSKEY_ERROR_CODES, t as PACKAGE_VERSION } from \"./version-DAM-NEJL.mjs\";\nimport { WebAuthnError, startAuthentication, startRegistration } from \"@simplewebauthn/browser\";\nimport { useAuthQuery } from \"better-auth/client\";\nimport { atom } from \"nanostores\";\n//#region src/client.ts\nconst getPasskeyActions = ($fetch, { $listPasskeys, $store }) => {\n\tconst signInPasskey = async (opts, options) => {\n\t\tconst response = await $fetch(\"/passkey/generate-authenticate-options\", {\n\t\t\tmethod: \"GET\",\n\t\t\tthrow: false\n\t\t});\n\t\tif (!response.data) return response;\n\t\tconst mergedExtensions = response.data.extensions || opts?.extensions ? {\n\t\t\t...response.data.extensions || {},\n\t\t\t...opts?.extensions || {}\n\t\t} : void 0;\n\t\tlet res;\n\t\ttry {\n\t\t\tres = await startAuthentication({\n\t\t\t\toptionsJSON: {\n\t\t\t\t\t...response.data,\n\t\t\t\t\textensions: mergedExtensions\n\t\t\t\t},\n\t\t\t\tuseBrowserAutofill: opts?.autoFill\n\t\t\t});\n\t\t} catch (err) {\n\t\t\treturn {\n\t\t\t\tdata: null,\n\t\t\t\terror: {\n\t\t\t\t\tcode: err instanceof WebAuthnError ? err.code : \"AUTH_CANCELLED\",\n\t\t\t\t\tmessage: PASSKEY_ERROR_CODES.AUTH_CANCELLED.message,\n\t\t\t\t\tstatus: 400,\n\t\t\t\t\tstatusText: \"BAD_REQUEST\"\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\ttry {\n\t\t\tconst { clientExtensionResults, ...responseBody } = res;\n\t\t\tconst verified = await $fetch(\"/passkey/verify-authentication\", {\n\t\t\t\tbody: { response: responseBody },\n\t\t\t\t...opts?.fetchOptions,\n\t\t\t\t...options,\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tthrow: false\n\t\t\t});\n\t\t\t$listPasskeys.set(Math.random());\n\t\t\t$store.notify(\"$sessionSignal\");\n\t\t\tif (opts?.returnWebAuthnResponse) return {\n\t\t\t\t...verified,\n\t\t\t\twebauthn: {\n\t\t\t\t\tresponse: res,\n\t\t\t\t\tclientExtensionResults\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn verified;\n\t\t} catch (err) {\n\t\t\tconsole.error(`[Better Auth] Error verifying passkey`, err);\n\t\t\treturn {\n\t\t\t\tdata: null,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"AUTH_CANCELLED\",\n\t\t\t\t\tmessage: PASSKEY_ERROR_CODES.AUTH_CANCELLED.message,\n\t\t\t\t\tstatus: 400,\n\t\t\t\t\tstatusText: \"BAD_REQUEST\"\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t};\n\tconst registerPasskey = async (opts, fetchOpts) => {\n\t\tconst options = await $fetch(\"/passkey/generate-register-options\", {\n\t\t\tmethod: \"GET\",\n\t\t\tquery: {\n\t\t\t\t...opts?.authenticatorAttachment && { authenticatorAttachment: opts.authenticatorAttachment },\n\t\t\t\t...opts?.name && { name: opts.name },\n\t\t\t\t...opts?.context && { context: opts.context }\n\t\t\t},\n\t\t\tthrow: false\n\t\t});\n\t\tif (!options.data) return options;\n\t\ttry {\n\t\t\tconst mergedExtensions = options.data.extensions || opts?.extensions ? {\n\t\t\t\t...options.data.extensions || {},\n\t\t\t\t...opts?.extensions || {}\n\t\t\t} : void 0;\n\t\t\tconst res = await startRegistration({\n\t\t\t\toptionsJSON: {\n\t\t\t\t\t...options.data,\n\t\t\t\t\textensions: mergedExtensions\n\t\t\t\t},\n\t\t\t\tuseAutoRegister: opts?.useAutoRegister\n\t\t\t});\n\t\t\tconst { clientExtensionResults, ...responseBody } = res;\n\t\t\tconst verified = await $fetch(\"/passkey/verify-registration\", {\n\t\t\t\t...opts?.fetchOptions,\n\t\t\t\t...fetchOpts,\n\t\t\t\tbody: {\n\t\t\t\t\tresponse: responseBody,\n\t\t\t\t\tname: opts?.name,\n\t\t\t\t\t...opts?.createSession && { createSession: true }\n\t\t\t\t},\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tthrow: false\n\t\t\t});\n\t\t\tif (!verified.data) return verified;\n\t\t\t$listPasskeys.set(Math.random());\n\t\t\tif (verified.data.session) $store.notify(\"$sessionSignal\");\n\t\t\tif (opts?.returnWebAuthnResponse) return {\n\t\t\t\t...verified,\n\t\t\t\twebauthn: {\n\t\t\t\t\tresponse: res,\n\t\t\t\t\tclientExtensionResults\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn verified;\n\t\t} catch (e) {\n\t\t\tif (e instanceof WebAuthnError) {\n\t\t\t\tif (e.code === \"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED\") return {\n\t\t\t\t\tdata: null,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: e.code,\n\t\t\t\t\t\tmessage: PASSKEY_ERROR_CODES.PREVIOUSLY_REGISTERED.message,\n\t\t\t\t\t\tstatus: 400,\n\t\t\t\t\t\tstatusText: \"BAD_REQUEST\"\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tif (e.code === \"ERROR_CEREMONY_ABORTED\") return {\n\t\t\t\t\tdata: null,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: e.code,\n\t\t\t\t\t\tmessage: PASSKEY_ERROR_CODES.REGISTRATION_CANCELLED.message,\n\t\t\t\t\t\tstatus: 400,\n\t\t\t\t\t\tstatusText: \"BAD_REQUEST\"\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\tdata: null,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: e.code,\n\t\t\t\t\t\tmessage: e.message,\n\t\t\t\t\t\tstatus: 400,\n\t\t\t\t\t\tstatusText: \"BAD_REQUEST\"\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tdata: null,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"UNKNOWN_ERROR\",\n\t\t\t\t\tmessage: e instanceof Error ? e.message : PASSKEY_ERROR_CODES.UNKNOWN_ERROR.message,\n\t\t\t\t\tstatus: 500,\n\t\t\t\t\tstatusText: \"INTERNAL_SERVER_ERROR\"\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t};\n\treturn {\n\t\tsignIn: { \n\t\t/**\n\t\t* Sign in with a registered passkey\n\t\t*/\npasskey: signInPasskey },\n\t\tpasskey: { \n\t\t/**\n\t\t* Add a passkey to the user account\n\t\t*/\naddPasskey: registerPasskey },\n\t\t/**\n\t\t* Inferred Internal Types\n\t\t*/\n\t\t$Infer: {}\n\t};\n};\nconst passkeyClient = () => {\n\tconst $listPasskeys = atom();\n\treturn {\n\t\tid: \"passkey\",\n\t\tversion: PACKAGE_VERSION,\n\t\t$InferServerPlugin: {},\n\t\tgetActions: ($fetch, $store) => getPasskeyActions($fetch, {\n\t\t\t$listPasskeys,\n\t\t\t$store\n\t\t}),\n\t\tgetAtoms($fetch) {\n\t\t\treturn {\n\t\t\t\tlistPasskeys: useAuthQuery($listPasskeys, \"/passkey/list-user-passkeys\", $fetch, { method: \"GET\" }),\n\t\t\t\t$listPasskeys\n\t\t\t};\n\t\t},\n\t\tpathMethods: {\n\t\t\t\"/passkey/register\": \"POST\",\n\t\t\t\"/passkey/authenticate\": \"POST\"\n\t\t},\n\t\tatomListeners: [{\n\t\t\tmatcher(path) {\n\t\t\t\treturn path === \"/passkey/verify-registration\" || path === \"/passkey/delete-passkey\" || path === \"/passkey/update-passkey\" || path === \"/sign-out\";\n\t\t\t},\n\t\t\tsignal: \"$listPasskeys\"\n\t\t}, {\n\t\t\tmatcher: (path) => path === \"/passkey/verify-authentication\",\n\t\t\tsignal: \"$sessionSignal\"\n\t\t}],\n\t\t$ERROR_CODES: PASSKEY_ERROR_CODES\n\t};\n};\n//#endregion\nexport { PASSKEY_ERROR_CODES, getPasskeyActions, passkeyClient };\n","import { defineErrorCodes } from \"@better-auth/core/utils/error-codes\";\n//#region src/plugins/email-otp/error-codes.ts\nconst EMAIL_OTP_ERROR_CODES = defineErrorCodes({\n\tOTP_EXPIRED: \"OTP expired\",\n\tINVALID_OTP: \"Invalid OTP\",\n\tTOO_MANY_ATTEMPTS: \"Too many attempts\"\n});\n//#endregion\nexport { EMAIL_OTP_ERROR_CODES };\n","import { PACKAGE_VERSION } from \"../../version.mjs\";\nimport { EMAIL_OTP_ERROR_CODES } from \"./error-codes.mjs\";\n//#region src/plugins/email-otp/client.ts\nconst emailOTPClient = () => {\n\treturn {\n\t\tid: \"email-otp\",\n\t\tversion: PACKAGE_VERSION,\n\t\t$InferServerPlugin: {},\n\t\tatomListeners: [{\n\t\t\tmatcher: (path) => path === \"/email-otp/verify-email\" || path === \"/sign-in/email-otp\" || path === \"/email-otp/request-email-change\",\n\t\t\tsignal: \"$sessionSignal\"\n\t\t}],\n\t\t$ERROR_CODES: EMAIL_OTP_ERROR_CODES\n\t};\n};\n//#endregion\nexport { emailOTPClient };\n","import { PACKAGE_VERSION } from \"../../version.mjs\";\n//#region src/plugins/jwt/client.ts\nconst jwtClient = (options) => {\n\tconst jwksPath = options?.jwks?.jwksPath ?? \"/jwks\";\n\treturn {\n\t\tid: \"better-auth-client\",\n\t\tversion: PACKAGE_VERSION,\n\t\t$InferServerPlugin: {},\n\t\tpathMethods: { [jwksPath]: \"GET\" },\n\t\tgetActions: ($fetch, _$store, _options) => ({ jwks: async (fetchOptions) => {\n\t\t\treturn await $fetch(jwksPath, {\n\t\t\t\tmethod: \"GET\",\n\t\t\t\t...fetchOptions\n\t\t\t});\n\t\t} })\n\t};\n};\n//#endregion\nexport { jwtClient };\n","import { defineErrorCodes } from \"@better-auth/core/utils/error-codes\";\n//#region src/plugins/two-factor/error-code.ts\nconst TWO_FACTOR_ERROR_CODES = defineErrorCodes({\n\tOTP_NOT_ENABLED: \"OTP not enabled\",\n\tOTP_NOT_CONFIGURED: \"OTP is not available\",\n\tOTP_HAS_EXPIRED: \"OTP has expired\",\n\tTOTP_NOT_ENABLED: \"TOTP not enabled\",\n\tTOTP_ALREADY_ENABLED: \"TOTP is already enabled\",\n\tTOTP_NOT_CONFIGURED: \"TOTP is not available\",\n\tTWO_FACTOR_NOT_ENABLED: \"Two factor isn't enabled\",\n\tBACKUP_CODES_NOT_ENABLED: \"Backup codes aren't enabled\",\n\tINVALID_BACKUP_CODE: \"Invalid backup code\",\n\tINVALID_CODE: \"Invalid code\",\n\tTOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: \"Too many attempts. Please request a new code.\",\n\tACCOUNT_TEMPORARILY_LOCKED: \"Too many failed verification attempts. Your account is temporarily locked. Please try again later.\",\n\tINVALID_TWO_FACTOR_COOKIE: \"Invalid two factor cookie\"\n});\n//#endregion\nexport { TWO_FACTOR_ERROR_CODES };\n","import { PACKAGE_VERSION } from \"../../version.mjs\";\nimport { TWO_FACTOR_ERROR_CODES } from \"./error-code.mjs\";\nimport { isSafeUrlScheme } from \"@better-auth/core/utils/url\";\n//#region src/plugins/two-factor/client.ts\nconst twoFactorClient = (options) => {\n\treturn {\n\t\tid: \"two-factor\",\n\t\tversion: PACKAGE_VERSION,\n\t\t$InferServerPlugin: {},\n\t\tatomListeners: [{\n\t\t\tmatcher: (path) => path.startsWith(\"/two-factor/\"),\n\t\t\tsignal: \"$sessionSignal\"\n\t\t}],\n\t\tpathMethods: {\n\t\t\t\"/two-factor/disable\": \"POST\",\n\t\t\t\"/two-factor/enable\": \"POST\",\n\t\t\t\"/two-factor/send-otp\": \"POST\",\n\t\t\t\"/two-factor/generate-backup-codes\": \"POST\",\n\t\t\t\"/two-factor/get-totp-uri\": \"POST\",\n\t\t\t\"/two-factor/verify-totp\": \"POST\",\n\t\t\t\"/two-factor/verify-otp\": \"POST\",\n\t\t\t\"/two-factor/verify-backup-code\": \"POST\"\n\t\t},\n\t\tfetchPlugins: [{\n\t\t\tid: \"two-factor\",\n\t\t\tname: \"two-factor\",\n\t\t\thooks: { async onSuccess(context) {\n\t\t\t\tif (context.data?.twoFactorRedirect) {\n\t\t\t\t\tif (options?.onTwoFactorRedirect) {\n\t\t\t\t\t\tawait options.onTwoFactorRedirect({ twoFactorMethods: context.data.twoFactorMethods });\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (options?.twoFactorPage && typeof window !== \"undefined\" && isSafeUrlScheme(options.twoFactorPage)) window.location.href = options.twoFactorPage;\n\t\t\t\t}\n\t\t\t} }\n\t\t}],\n\t\t$ERROR_CODES: TWO_FACTOR_ERROR_CODES\n\t};\n};\n//#endregion\nexport { twoFactorClient };\n","\"use client\";\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\n//#region src/QueryClientProvider.tsx\n/**\n* The context that `useQueryClient` reads from. `QueryClientProvider` is the normal way to set it.\n*/\nconst QueryClientContext = React.createContext(void 0);\n/**\n* The `useQueryClient` hook returns the current `QueryClient` instance.\n*\n* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n* be used.\n* @returns The current `QueryClient` instance.\n* @throws If no `queryClient` argument is passed and no `QueryClientProvider` is found in the component tree.\n*/\nconst useQueryClient = (queryClient) => {\n\tconst client = React.useContext(QueryClientContext);\n\tif (queryClient) return queryClient;\n\tif (!client) throw new Error(\"No QueryClient set, use QueryClientProvider to set one\");\n\treturn client;\n};\n/**\n* Use the `QueryClientProvider` component to connect and provide a `QueryClient` to your application. Also\n* calls `client.mount()`/`client.unmount()` as this component mounts/unmounts, which subscribes the client to\n* focus/online events (resuming any paused mutations and refetching as needed when the app regains focus or\n* comes back online).\n*\n* @returns The provided `children`, wrapped so they can read the `QueryClient` via `useQueryClient`.\n*\n* @example\n* ```tsx\n* import { QueryClient, QueryClientProvider } from '@tanstack/react-query'\n*\n* const queryClient = new QueryClient()\n*\n* function App() {\n* return <QueryClientProvider client={queryClient}>...</QueryClientProvider>\n* }\n* ```\n*/\nconst QueryClientProvider = ({ client, children }) => {\n\tReact.useEffect(() => {\n\t\tclient.mount();\n\t\treturn () => {\n\t\t\tclient.unmount();\n\t\t};\n\t}, [client]);\n\treturn /* @__PURE__ */ jsx(QueryClientContext.Provider, {\n\t\tvalue: client,\n\t\tchildren\n\t});\n};\n//#endregion\nexport { QueryClientContext, QueryClientProvider, useQueryClient };\n\n//# sourceMappingURL=QueryClientProvider.js.map","//#region src/timeoutManager.ts\nconst defaultTimeoutProvider = {\n\tsetTimeout: (callback, delay) => setTimeout(callback, delay),\n\tclearTimeout: (timeoutId) => clearTimeout(timeoutId),\n\tsetInterval: (callback, delay) => setInterval(callback, delay),\n\tclearInterval: (intervalId) => clearInterval(intervalId)\n};\n/**\n* Allows customization of how timeouts are created.\n*\n* @tanstack/query-core makes liberal use of timeouts to implement `staleTime`\n* and `gcTime`. The default TimeoutManager provider uses the platform's global\n* `setTimeout` implementation, which is known to have scalability issues with\n* thousands of timeouts on the event loop.\n*\n* If you hit this limitation, consider providing a custom TimeoutProvider that\n* coalesces timeouts.\n*/\nvar TimeoutManager = class {\n\t#provider = defaultTimeoutProvider;\n\t#providerCalled = false;\n\t/**\n\t* `setTimeoutProvider` can be used to set a custom implementation of the\n\t* `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval` functions,\n\t* called a `TimeoutProvider`.\n\t*\n\t* This may be useful if you notice event loop performance issues with\n\t* thousands of queries. A custom TimeoutProvider could also support timer\n\t* delays longer than the global `setTimeout` maximum delay value of about\n\t* 24 days.\n\t*\n\t* It is important to call `setTimeoutProvider` before creating a\n\t* QueryClient or queries, so that the same provider is used consistently\n\t* for all timers in the application, since different TimeoutProviders\n\t* cannot cancel each others' timers.\n\t*\n\t* @example\n\t* ```ts\n\t* import { timeoutManager, QueryClient } from '@tanstack/query-core'\n\t* import { CustomTimeoutProvider } from './CustomTimeoutProvider'\n\t*\n\t* timeoutManager.setTimeoutProvider(new CustomTimeoutProvider())\n\t*\n\t* export const queryClient = new QueryClient()\n\t* ```\n\t*/\n\tsetTimeoutProvider(provider) {\n\t\tif (process.env.NODE_ENV !== \"production\") {\n\t\t\tif (this.#providerCalled && provider !== this.#provider) console.error(`[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`, {\n\t\t\t\tprevious: this.#provider,\n\t\t\t\tprovider\n\t\t\t});\n\t\t}\n\t\tthis.#provider = provider;\n\t\tif (process.env.NODE_ENV !== \"production\") this.#providerCalled = false;\n\t}\n\t/**\n\t* `setTimeout` schedules a callback to run after approximately `delay`\n\t* milliseconds, like the global `setTimeout` function. The callback can be\n\t* canceled with `clearTimeout`.\n\t*\n\t* It returns a timer ID, which may be a number or an object that can be\n\t* coerced to a number via `Symbol.toPrimitive`.\n\t*\n\t* @example\n\t* ```ts\n\t* import { timeoutManager } from '@tanstack/query-core'\n\t*\n\t* const timeoutId = timeoutManager.setTimeout(\n\t* () => console.log('ran at:', new Date()),\n\t* 1000,\n\t* )\n\t*\n\t* const timeoutIdNumber: number = Number(timeoutId)\n\t* ```\n\t*/\n\tsetTimeout(callback, delay) {\n\t\tif (process.env.NODE_ENV !== \"production\") this.#providerCalled = true;\n\t\treturn this.#provider.setTimeout(callback, delay);\n\t}\n\t/**\n\t* `clearTimeout` cancels a timeout callback scheduled with `setTimeout`,\n\t* like the global `clearTimeout` function. It should be called with a\n\t* timer ID returned by `setTimeout`.\n\t*\n\t* @example\n\t* ```ts\n\t* import { timeoutManager } from '@tanstack/query-core'\n\t*\n\t* const timeoutId = timeoutManager.setTimeout(\n\t* () => console.log('ran at:', new Date()),\n\t* 1000,\n\t* )\n\t*\n\t* timeoutManager.clearTimeout(timeoutId)\n\t* ```\n\t*/\n\tclearTimeout(timeoutId) {\n\t\tthis.#provider.clearTimeout(timeoutId);\n\t}\n\t/**\n\t* `setInterval` schedules a callback to be called approximately every\n\t* `delay` milliseconds, like the global `setInterval` function.\n\t*\n\t* Like `setTimeout`, it returns a timer ID, which may be a number or an\n\t* object that can be coerced to a number via `Symbol.toPrimitive`.\n\t*\n\t* @example\n\t* ```ts\n\t* import { timeoutManager } from '@tanstack/query-core'\n\t*\n\t* const intervalId = timeoutManager.setInterval(\n\t* () => console.log('ran at:', new Date()),\n\t* 1000,\n\t* )\n\t* ```\n\t*/\n\tsetInterval(callback, delay) {\n\t\tif (process.env.NODE_ENV !== \"production\") this.#providerCalled = true;\n\t\treturn this.#provider.setInterval(callback, delay);\n\t}\n\t/**\n\t* `clearInterval` can be used to cancel an interval, like the global\n\t* `clearInterval` function. It should be called with an interval ID\n\t* returned by `setInterval`.\n\t*\n\t* @example\n\t* ```ts\n\t* import { timeoutManager } from '@tanstack/query-core'\n\t*\n\t* const intervalId = timeoutManager.setInterval(\n\t* () => console.log('ran at:', new Date()),\n\t* 1000,\n\t* )\n\t*\n\t* timeoutManager.clearInterval(intervalId)\n\t* ```\n\t*/\n\tclearInterval(intervalId) {\n\t\tthis.#provider.clearInterval(intervalId);\n\t}\n};\n/**\n* Singleton instance of {@link TimeoutManager}, used throughout TanStack Query to schedule and cancel timers.\n*/\nconst timeoutManager = new TimeoutManager();\n/**\n* In many cases code wants to delay to the next event loop tick; this is not\n* mediated by {@link timeoutManager}.\n*\n* This function is provided to make auditing the `tanstack/query-core` for\n* incorrect use of system `setTimeout` easier.\n*/\nfunction systemSetTimeoutZero(callback) {\n\tsetTimeout(callback, 0);\n}\n//#endregion\nexport { TimeoutManager, defaultTimeoutProvider, systemSetTimeoutZero, timeoutManager };\n\n//# sourceMappingURL=timeoutManager.js.map","import { timeoutManager } from \"./timeoutManager.js\";\n//#region src/utils.ts\n/** @deprecated\n* use `environmentManager.isServer()` instead.\n*/\nconst isServer = typeof window === \"undefined\" || \"Deno\" in globalThis;\nfunction noop() {}\nfunction functionalUpdate(updater, input) {\n\treturn typeof updater === \"function\" ? updater(input) : updater;\n}\nfunction isValidTimeout(value) {\n\treturn typeof value === \"number\" && value >= 0 && value !== Infinity;\n}\nfunction timeUntilStale(updatedAt, staleTime) {\n\treturn Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);\n}\nfunction resolveQueryValue(value, query) {\n\treturn typeof value === \"function\" ? value(query) : value;\n}\n/**\n* Checks whether a query matches the given {@link QueryFilters}.\n* Every filter that is specified must match; filters that are left unspecified are ignored.\n*\n* @example\n* ```ts\n* const queryCache = queryClient.getQueryCache()\n*\n* const matchingQueries = queryCache\n* .getAll()\n* .filter((query) => matchQuery({ queryKey: ['posts'] }, query))\n* ```\n*/\nfunction matchQuery(filters, query) {\n\tconst { type = \"all\", exact, fetchStatus, predicate, queryKey, stale } = filters;\n\tif (queryKey) {\n\t\tif (exact) {\n\t\t\tif (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) return false;\n\t\t} else if (!partialMatchKey(query.queryKey, queryKey)) return false;\n\t}\n\tif (type !== \"all\") {\n\t\tconst isActive = query.isActive();\n\t\tif (type === \"active\" && !isActive) return false;\n\t\tif (type === \"inactive\" && isActive) return false;\n\t}\n\tif (typeof stale === \"boolean\" && query.isStale() !== stale) return false;\n\tif (fetchStatus && fetchStatus !== query.state.fetchStatus) return false;\n\tif (predicate && !predicate(query)) return false;\n\treturn true;\n}\n/**\n* Checks whether a mutation matches the given {@link MutationFilters}.\n* Every filter that is specified must match; filters that are left unspecified are ignored.\n* If a `mutationKey` filter is provided but the mutation has no `mutationKey` of its own, it does not match.\n*\n* @example\n* ```ts\n* const mutationCache = queryClient.getMutationCache()\n*\n* const matchingMutations = mutationCache\n* .getAll()\n* .filter((mutation) => matchMutation({ mutationKey: ['addPost'] }, mutation))\n* ```\n*/\nfunction matchMutation(filters, mutation) {\n\tconst { exact, status, predicate, mutationKey } = filters;\n\tif (mutationKey) {\n\t\tif (!mutation.options.mutationKey) return false;\n\t\tif (exact) {\n\t\t\tif (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) return false;\n\t\t} else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) return false;\n\t}\n\tif (status && mutation.state.status !== status) return false;\n\tif (predicate && !predicate(mutation)) return false;\n\treturn true;\n}\nfunction hashQueryKeyByOptions(queryKey, options) {\n\treturn (options?.queryKeyHashFn || hashKey)(queryKey);\n}\n/**\n* Default query & mutation keys hash function.\n* Hashes the value into a stable hash.\n*\n* @example\n* ```ts\n* // Object keys are sorted, so key order doesn't affect the hash:\n* hashKey(['todos', { page: 1, filter: 'done' }]) // === '[\"todos\",{\"filter\":\"done\",\"page\":1}]'\n* ```\n*/\nfunction hashKey(queryKey) {\n\treturn JSON.stringify(queryKey, (_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {\n\t\tresult[key] = val[key];\n\t\treturn result;\n\t}, {}) : val);\n}\nfunction partialMatchKey(a, b) {\n\tif (a === b) return true;\n\tif (typeof a !== typeof b) return false;\n\tif (a && b && typeof a === \"object\" && typeof b === \"object\") {\n\t\tif (Array.isArray(a) && Array.isArray(b)) {\n\t\t\tif (b.length > a.length) return false;\n\t\t\tfor (let i = 0; i < b.length; i++) if (!partialMatchKey(a[i], b[i])) return false;\n\t\t\treturn true;\n\t\t}\n\t\tconst bKeys = Object.keys(b);\n\t\tfor (const key of bKeys) if (!partialMatchKey(a[key], b[key])) return false;\n\t\treturn true;\n\t}\n\treturn false;\n}\nconst hasOwn = Object.prototype.hasOwnProperty;\nfunction replaceEqualDeep(a, b, depth = 0) {\n\tif (a === b) return a;\n\tif (depth > 500) return b;\n\tconst array = isPlainArray(a) && isPlainArray(b);\n\tif (!array && !(isPlainObject(a) && isPlainObject(b))) return b;\n\tconst aSize = (array ? a : Object.keys(a)).length;\n\tconst bItems = array ? b : Object.keys(b);\n\tconst bSize = bItems.length;\n\tconst copy = array ? new Array(bSize) : {};\n\tlet equalItems = 0;\n\tfor (let i = 0; i < bSize; i++) {\n\t\tconst key = array ? i : bItems[i];\n\t\tconst aItem = a[key];\n\t\tconst bItem = b[key];\n\t\tif (aItem === bItem) {\n\t\t\tcopy[key] = aItem;\n\t\t\tif (array ? i < aSize : hasOwn.call(a, key)) equalItems++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (aItem === null || bItem === null || typeof aItem !== \"object\" || typeof bItem !== \"object\") {\n\t\t\tcopy[key] = bItem;\n\t\t\tcontinue;\n\t\t}\n\t\tconst v = replaceEqualDeep(aItem, bItem, depth + 1);\n\t\tcopy[key] = v;\n\t\tif (v === aItem) equalItems++;\n\t}\n\treturn aSize === bSize && equalItems === aSize ? a : copy;\n}\n/**\n* Shallow compare objects.\n*/\nfunction shallowEqualObjects(a, b) {\n\tif (!b || Object.keys(a).length !== Object.keys(b).length) return false;\n\tfor (const key in a) if (a[key] !== b[key]) return false;\n\treturn true;\n}\nfunction isPlainArray(value) {\n\treturn Array.isArray(value) && value.length === Object.keys(value).length;\n}\nfunction isPlainObject(o) {\n\tif (!hasObjectPrototype(o)) return false;\n\tconst objectPrototype = Object.getPrototypeOf(o);\n\tconst ctor = objectPrototype?.constructor;\n\tif (ctor === void 0) return true;\n\tif (typeof ctor !== \"function\") return false;\n\tconst prot = ctor.prototype;\n\tif (!hasObjectPrototype(prot)) return false;\n\tif (!prot.hasOwnProperty(\"isPrototypeOf\")) return false;\n\tif (objectPrototype !== Object.prototype) return false;\n\treturn true;\n}\nfunction hasObjectPrototype(o) {\n\treturn Object.prototype.toString.call(o) === \"[object Object]\";\n}\nfunction sleep(timeout) {\n\treturn new Promise((resolve) => {\n\t\ttimeoutManager.setTimeout(resolve, timeout);\n\t});\n}\nfunction replaceData(prevData, data, options) {\n\tif (typeof options.structuralSharing === \"function\") return options.structuralSharing(prevData, data);\n\telse if (options.structuralSharing !== false) {\n\t\tif (process.env.NODE_ENV !== \"production\") try {\n\t\t\treturn replaceEqualDeep(prevData, data);\n\t\t} catch (error) {\n\t\t\tconsole.error(`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}`);\n\t\t\tthrow error;\n\t\t}\n\t\treturn replaceEqualDeep(prevData, data);\n\t}\n\treturn data;\n}\n/**\n* Intended to be passed as a query's `placeholderData` option, for example\n* `placeholderData: keepPreviousData`. Instead of resetting the query's data to `undefined` while a new\n* query key is fetching, it keeps displaying the previously fetched data until the new data arrives.\n*\n* @example\n* ```ts\n* new QueryObserver(queryClient, {\n* queryKey: ['posts', page],\n* queryFn: () => fetchPosts(page),\n* placeholderData: keepPreviousData,\n* })\n* ```\n*/\nfunction keepPreviousData(previousData) {\n\treturn previousData;\n}\nfunction addToEnd(items, item, max = 0) {\n\tconst newItems = [...items, item];\n\treturn max && newItems.length > max ? newItems.slice(1) : newItems;\n}\nfunction addToStart(items, item, max = 0) {\n\tconst newItems = [item, ...items];\n\treturn max && newItems.length > max ? newItems.slice(0, -1) : newItems;\n}\n/**\n* Sentinel value that can be passed as a query's `queryFn` to conditionally disable the query (equivalent\n* to `enabled: false`) while preserving full type inference for the query's data. Unlike `enabled: false`,\n* a query disabled via `skipToken` cannot be triggered with `refetch`.\n*\n* @example\n* ```ts\n* new QueryObserver(queryClient, {\n* queryKey: ['post', postId],\n* queryFn: postId != null ? () => fetchPost(postId) : skipToken,\n* })\n* ```\n*/\nconst skipToken = Symbol();\nfunction ensureQueryFn(options, fetchOptions) {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tif (options.queryFn === skipToken) console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`);\n\t}\n\tif (!options.queryFn && fetchOptions?.initialPromise) return () => fetchOptions.initialPromise;\n\tif (!options.queryFn || options.queryFn === skipToken) return () => Promise.reject(/* @__PURE__ */ new Error(`Missing queryFn: '${options.queryHash}'`));\n\treturn options.queryFn;\n}\n/**\n* Resolves a `throwOnError` option to a boolean.\n* If `throwOnError` is a function, it is called with `params` (e.g. the error and, depending on the caller,\n* additional context such as the query or mutation) and its result is returned, allowing the throwing\n* behavior to be decided per error. Otherwise, `throwOnError` itself is coerced to a boolean (`undefined`\n* resolves to `false`).\n*\n* @example\n* ```ts\n* const throwOnError =\n* query.state.error && typeof options.throwOnError === 'function'\n* ? shouldThrowError(options.throwOnError, [query.state.error, query])\n* : options.throwOnError\n* ```\n*/\nfunction shouldThrowError(throwOnError, params) {\n\tif (typeof throwOnError === \"function\") return throwOnError(...params);\n\treturn !!throwOnError;\n}\nfunction addConsumeAwareSignal(object, getSignal, onCancelled) {\n\tlet consumed = false;\n\tlet signal;\n\tObject.defineProperty(object, \"signal\", {\n\t\tenumerable: true,\n\t\tget: () => {\n\t\t\tsignal ??= getSignal();\n\t\t\tif (consumed) return signal;\n\t\t\tconsumed = true;\n\t\t\tif (signal.aborted) onCancelled();\n\t\t\telse signal.addEventListener(\"abort\", onCancelled, { once: true });\n\t\t\treturn signal;\n\t\t}\n\t});\n\treturn object;\n}\n//#endregion\nexport { addConsumeAwareSignal, addToEnd, addToStart, ensureQueryFn, functionalUpdate, hashKey, hashQueryKeyByOptions, isPlainArray, isPlainObject, isServer, isValidTimeout, keepPreviousData, matchMutation, matchQuery, noop, partialMatchKey, replaceData, replaceEqualDeep, resolveQueryValue, shallowEqualObjects, shouldThrowError, skipToken, sleep, timeUntilStale };\n\n//# sourceMappingURL=utils.js.map","import { isServer as isServer$1 } from \"./utils.js\";\n//#region src/environmentManager.ts\nlet isServerFn = () => isServer$1;\n/**\n* Returns whether the current runtime should be treated as a server environment.\n*/\nconst isServer = () => isServerFn();\n/**\n* Manages how TanStack Query detects whether the current runtime should be treated as\n* server-side, which disables scheduling refetch timers and changes the default `retry` count\n* and `gcTime`. By default, the detection treats a missing `window` (or the presence of a\n* `Deno` global) as server.\n*\n* Override this for runtimes where that default detection would give the wrong answer — for\n* example, a Service Worker, where `window` is undefined even though the environment should\n* behave like a client.\n*\n* @example\n* ```ts\n* import { environmentManager } from '@tanstack/query-core'\n*\n* environmentManager.setIsServer(() => false)\n* ```\n*/\nconst environmentManager = {\n\tisServer,\n\t/**\n\t* Overrides the server check globally.\n\t*/\n\tsetIsServer(isServerValue) {\n\t\tisServerFn = isServerValue;\n\t}\n};\n//#endregion\nexport { environmentManager, isServer };\n\n//# sourceMappingURL=environmentManager.js.map","//#region src/subscribable.ts\n/**\n* The base class behind everything in Query that you can subscribe to: `QueryCache`, `MutationCache`,\n* the observers, and the `FocusManager`/`OnlineManager` behind `focusManager` and `onlineManager`.\n* Subclasses decide what a listener receives and when it is called.\n*/\nvar Subscribable = class {\n\tconstructor() {\n\t\tthis.listeners = /* @__PURE__ */ new Set();\n\t\tthis.subscribe = this.subscribe.bind(this);\n\t}\n\t/**\n\t* Registers a listener to be called on every update this object notifies about. Returns a function\n\t* that removes the listener again — call it to stop listening. The base class never drops a listener\n\t* on its own, though some subclasses clear all of theirs in `destroy()`.\n\t* @param listener - Called on each update, with whatever the subclass passes to its subscribers.\n\t* @example\n\t* ```ts\n\t* const unsubscribe = subscribable.subscribe(() => {\n\t* // react to the update\n\t* })\n\t*\n\t* unsubscribe()\n\t* ```\n\t*/\n\tsubscribe(listener) {\n\t\tthis.listeners.add(listener);\n\t\tthis.onSubscribe();\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t\tthis.onUnsubscribe();\n\t\t};\n\t}\n\t/**\n\t* Returns `true` while at least one listener is registered, `false` once they have all unsubscribed.\n\t*/\n\thasListeners() {\n\t\treturn this.listeners.size > 0;\n\t}\n\tonSubscribe() {}\n\tonUnsubscribe() {}\n};\n//#endregion\nexport { Subscribable };\n\n//# sourceMappingURL=subscribable.js.map","import { Subscribable } from \"./subscribable.js\";\n//#region src/focusManager.ts\n/**\n* The `FocusManager` manages the focus state within TanStack Query.\n*\n* It can be used to change the default event listeners or to manually change the focus state.\n*/\nvar FocusManager = class extends Subscribable {\n\t#focused;\n\t#cleanup;\n\t#setup;\n\tconstructor() {\n\t\tsuper();\n\t\tthis.#setup = (onFocus) => {\n\t\t\tif (typeof window !== \"undefined\" && window.addEventListener) {\n\t\t\t\tconst listener = () => onFocus();\n\t\t\t\twindow.addEventListener(\"visibilitychange\", listener, false);\n\t\t\t\treturn () => {\n\t\t\t\t\twindow.removeEventListener(\"visibilitychange\", listener);\n\t\t\t\t};\n\t\t\t}\n\t\t};\n\t}\n\tonSubscribe() {\n\t\tif (!this.#cleanup) this.setEventListener(this.#setup);\n\t}\n\tonUnsubscribe() {\n\t\tif (!this.hasListeners()) {\n\t\t\tthis.#cleanup?.();\n\t\t\tthis.#cleanup = void 0;\n\t\t}\n\t}\n\t/**\n\t* `setEventListener` can be used to set a custom event listener that will\n\t* be used to determine the focus state. The provided `setup` function\n\t* receives a `setFocused` callback: call it with a `boolean` to manually\n\t* set the focus state, or with no arguments to re-evaluate the current\n\t* focus state and notify subscribers.\n\t*\n\t* @example\n\t* ```ts\n\t* import { focusManager } from '@tanstack/query-core'\n\t*\n\t* focusManager.setEventListener((handleFocus) => {\n\t* const listener = () => handleFocus()\n\t* // Listen to visibilitychange\n\t* if (typeof window !== 'undefined' && window.addEventListener) {\n\t* window.addEventListener('visibilitychange', listener, false)\n\t* }\n\t*\n\t* return () => {\n\t* // Be sure to unsubscribe if a new handler is set\n\t* window.removeEventListener('visibilitychange', listener)\n\t* }\n\t* })\n\t* ```\n\t*/\n\tsetEventListener(setup) {\n\t\tthis.#setup = setup;\n\t\tthis.#cleanup?.();\n\t\tthis.#cleanup = setup((focused) => {\n\t\t\tif (typeof focused === \"boolean\") this.setFocused(focused);\n\t\t\telse this.onFocus();\n\t\t});\n\t}\n\t/**\n\t* `setFocused` can be used to manually set the focus state. Set `undefined`\n\t* to fall back to the default focus check.\n\t*\n\t* @example\n\t* ```ts\n\t* import { focusManager } from '@tanstack/query-core'\n\t*\n\t* // Set focused\n\t* focusManager.setFocused(true)\n\t*\n\t* // Set unfocused\n\t* focusManager.setFocused(false)\n\t*\n\t* // Fallback to the default focus check\n\t* focusManager.setFocused(undefined)\n\t* ```\n\t*/\n\tsetFocused(focused) {\n\t\tif (this.#focused !== focused) {\n\t\t\tthis.#focused = focused;\n\t\t\tthis.onFocus();\n\t\t}\n\t}\n\t/**\n\t* `onFocus` notifies all subscribed listeners with the current focus state.\n\t*/\n\tonFocus() {\n\t\tconst isFocused = this.isFocused();\n\t\tthis.listeners.forEach((listener) => {\n\t\t\tlistener(isFocused);\n\t\t});\n\t}\n\t/**\n\t* `isFocused` can be used to get the current focus state.\n\t*/\n\tisFocused() {\n\t\tif (typeof this.#focused === \"boolean\") return this.#focused;\n\t\treturn globalThis.document?.visibilityState !== \"hidden\";\n\t}\n};\n/**\n* Singleton instance of {@link FocusManager}, used to manage and observe the focus state within TanStack Query.\n*/\nconst focusManager = new FocusManager();\n//#endregion\nexport { FocusManager, focusManager };\n\n//# sourceMappingURL=focusManager.js.map","import { noop } from \"./utils.js\";\n//#region src/hydration.ts\nfunction tryResolveSync(promise) {\n\tlet data;\n\tpromise.then((result) => {\n\t\tdata = result;\n\t\treturn result;\n\t}, noop)?.catch?.(noop);\n\tif (data !== void 0) return { data };\n}\nfunction dehydrateMutation(mutation) {\n\treturn {\n\t\tmutationKey: mutation.options.mutationKey,\n\t\tstate: mutation.state,\n\t\t...mutation.options.scope && { scope: mutation.options.scope },\n\t\t...mutation.meta && { meta: mutation.meta }\n\t};\n}\nfunction dehydratePromise(query, serializeData, shouldRedactErrors) {\n\tconst promise = query.promise?.then(serializeData).catch((error) => {\n\t\tif (shouldRedactErrors?.(error) === false) return Promise.reject(error);\n\t\tif (process.env.NODE_ENV !== \"production\") console.error(`A query that was dehydrated as pending ended up rejecting. [${query.queryHash}]: ${error}; The error will be redacted in production builds`);\n\t\treturn Promise.reject(/* @__PURE__ */ new Error(\"redacted\"));\n\t});\n\tpromise?.catch(noop);\n\treturn promise;\n}\n/**\n* Dehydrates a single `Query` into a serializable `DehydratedQuery` snapshot. Note that most query config (e.g.\n* `queryFn`, `staleTime`) is not dehydrated but instead meant to be configured again when consuming the\n* de/rehydrated data, typically with `useQuery` on the client. If the query is still `pending`, its in-flight\n* promise is dehydrated too so it can be resumed on the other side instead of re-fetched.\n* @param query - The query to dehydrate.\n* @param serializeData - Optional transform applied to `query.state.data` before it is included in the snapshot.\n* @param shouldRedactErrors - Optional predicate; if it returns `false` for the promise's rejection error, that\n* error is kept as-is instead of being redacted.\n*/\nfunction dehydrateQuery(query, serializeData, shouldRedactErrors) {\n\treturn {\n\t\tdehydratedAt: Date.now(),\n\t\tstate: {\n\t\t\t...query.state,\n\t\t\t...query.state.data !== void 0 && { data: serializeData ? serializeData(query.state.data) : query.state.data }\n\t\t},\n\t\tqueryKey: query.queryKey,\n\t\tqueryHash: query.queryHash,\n\t\t...query.state.status === \"pending\" && { promise: dehydratePromise(query, serializeData, shouldRedactErrors) },\n\t\t...query.meta && { meta: query.meta },\n\t\t...query.queryType && { queryType: query.queryType }\n\t};\n}\n/**\n* The default `shouldDehydrateMutation` predicate used by `dehydrate`. Only dehydrates mutations that are\n* currently paused (e.g. paused by `networkMode` while offline).\n*/\nfunction defaultShouldDehydrateMutation(mutation) {\n\treturn mutation.state.isPaused;\n}\n/**\n* The default `shouldDehydrateQuery` predicate used by `dehydrate`. Only dehydrates queries whose status is\n* `'success'`.\n*/\nfunction defaultShouldDehydrateQuery(query) {\n\treturn query.state.status === \"success\";\n}\n/**\n* Dehydrates a `QueryClient`'s cache (queries and mutations) into a plain, serializable `DehydratedState`,\n* typically to embed in server-rendered markup and later restore into a client-side `QueryClient` via `hydrate`.\n* Which queries/mutations are included, and how their data/errors are transformed, is controlled by `options`,\n* falling back to the client's `dehydrate` default options, and finally to `defaultShouldDehydrateQuery` /\n* `defaultShouldDehydrateMutation`.\n* @example\n* ```ts\n* const queryClient = new QueryClient()\n*\n* await queryClient.prefetchQuery({\n* queryKey: ['posts'],\n* queryFn: getPosts,\n* })\n*\n* const dehydratedState = dehydrate(queryClient)\n* ```\n*/\nfunction dehydrate(client, options = {}) {\n\tconst filterMutation = options.shouldDehydrateMutation ?? client.getDefaultOptions().dehydrate?.shouldDehydrateMutation ?? defaultShouldDehydrateMutation;\n\tconst mutations = client.getMutationCache().getAll().flatMap((mutation) => filterMutation(mutation) ? [dehydrateMutation(mutation)] : []);\n\tconst filterQuery = options.shouldDehydrateQuery ?? client.getDefaultOptions().dehydrate?.shouldDehydrateQuery ?? defaultShouldDehydrateQuery;\n\tconst shouldRedactErrors = options.shouldRedactErrors ?? client.getDefaultOptions().dehydrate?.shouldRedactErrors;\n\tconst serializeData = options.serializeData ?? client.getDefaultOptions().dehydrate?.serializeData;\n\treturn {\n\t\tmutations,\n\t\tqueries: client.getQueryCache().getAll().flatMap((query) => filterQuery(query) ? [dehydrateQuery(query, serializeData, shouldRedactErrors)] : [])\n\t};\n}\n/**\n* Restores a `DehydratedState` (as produced by `dehydrate`) into a `QueryClient`'s cache, typically to seed the\n* client with data already fetched on the server. `mutations` and `queries` are each optional on `dehydratedState`.\n* Queries not yet in the cache are built from the dehydrated snapshot; queries that already exist are only updated\n* when the dehydrated data is newer than what's already cached. Newly built queries have their `fetchStatus` reset\n* to `'idle'` so they don't hydrate stuck in a fetching state. If a dehydrated query still had an in-flight\n* promise, it is resumed via `query.fetch()` (reusing that promise as `initialPromise`) rather than re-invoking\n* `queryFn`.\n* @example\n* ```ts\n* // dehydratedState was produced by `dehydrate` on the server\n* // and sent to the client, e.g. embedded in server-rendered markup.\n* const queryClient = new QueryClient()\n*\n* hydrate(queryClient, dehydratedState)\n* ```\n*/\nfunction hydrate(client, dehydratedState, options) {\n\tconst mutationCache = client.getMutationCache();\n\tconst queryCache = client.getQueryCache();\n\tconst deserializeData = options?.defaultOptions?.deserializeData ?? client.getDefaultOptions().hydrate?.deserializeData;\n\tdehydratedState.mutations?.forEach(({ state, ...mutationOptions }) => {\n\t\tmutationCache.build(client, {\n\t\t\t...client.getDefaultOptions().hydrate?.mutations,\n\t\t\t...options?.defaultOptions?.mutations,\n\t\t\t...mutationOptions\n\t\t}, state);\n\t});\n\tdehydratedState.queries?.forEach(({ queryKey, state, queryHash, meta, promise, dehydratedAt, queryType }) => {\n\t\tconst syncData = promise ? tryResolveSync(promise) : void 0;\n\t\tconst rawData = state.data === void 0 ? syncData?.data : state.data;\n\t\tconst data = rawData === void 0 ? rawData : deserializeData ? deserializeData(rawData) : rawData;\n\t\tlet query = queryCache.get(queryHash);\n\t\tconst existingQueryIsPending = query?.state.status === \"pending\";\n\t\tconst existingQueryIsFetching = query?.state.fetchStatus === \"fetching\";\n\t\tif (query) {\n\t\t\tconst hasNewerSyncData = syncData && dehydratedAt > query.state.dataUpdatedAt;\n\t\t\tif (state.dataUpdatedAt > query.state.dataUpdatedAt || hasNewerSyncData) {\n\t\t\t\tconst { fetchStatus: _ignored, ...serializedState } = state;\n\t\t\t\tquery.setState({\n\t\t\t\t\t...serializedState,\n\t\t\t\t\tdata,\n\t\t\t\t\t...state.status === \"pending\" && data !== void 0 && {\n\t\t\t\t\t\tstatus: \"success\",\n\t\t\t\t\t\tdataUpdatedAt: dehydratedAt,\n\t\t\t\t\t\t...!existingQueryIsFetching && { fetchStatus: \"idle\" }\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t} else query = queryCache.build(client, {\n\t\t\t...client.getDefaultOptions().hydrate?.queries,\n\t\t\t...options?.defaultOptions?.queries,\n\t\t\tqueryKey,\n\t\t\tqueryHash,\n\t\t\tmeta,\n\t\t\t_type: queryType\n\t\t}, {\n\t\t\t...state,\n\t\t\tdata,\n\t\t\tfetchStatus: \"idle\",\n\t\t\tstatus: state.status === \"pending\" && data !== void 0 ? \"success\" : state.status,\n\t\t\t...state.status === \"pending\" && data !== void 0 && { dataUpdatedAt: dehydratedAt }\n\t\t});\n\t\tif (promise && !syncData && !existingQueryIsPending && !existingQueryIsFetching && dehydratedAt > query.state.dataUpdatedAt) query.fetch(void 0, { initialPromise: Promise.resolve(promise).then(deserializeData) }).catch(noop);\n\t});\n}\n//#endregion\nexport { defaultShouldDehydrateMutation, defaultShouldDehydrateQuery, dehydrate, dehydrateQuery, hydrate };\n\n//# sourceMappingURL=hydration.js.map","import { systemSetTimeoutZero } from \"./timeoutManager.js\";\n//#region src/notifyManager.ts\n/**\n* Default scheduling function used by the notify manager.\n* Schedules the callback with the system's `setTimeout(callback, 0)`.\n*/\nconst defaultScheduler = systemSetTimeoutZero;\nfunction createNotifyManager() {\n\tlet queue = [];\n\tlet transactions = 0;\n\tlet notifyFn = (callback) => {\n\t\tcallback();\n\t};\n\tlet batchNotifyFn = (callback) => {\n\t\tcallback();\n\t};\n\tlet scheduleFn = defaultScheduler;\n\tconst schedule = (callback) => {\n\t\tif (transactions) queue.push(callback);\n\t\telse scheduleFn(() => {\n\t\t\tnotifyFn(callback);\n\t\t});\n\t};\n\tconst flush = () => {\n\t\tconst originalQueue = queue;\n\t\tqueue = [];\n\t\tif (originalQueue.length) scheduleFn(() => {\n\t\t\tbatchNotifyFn(() => {\n\t\t\t\toriginalQueue.forEach((callback) => {\n\t\t\t\t\tnotifyFn(callback);\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t};\n\treturn {\n\t\t/**\n\t\t* Batches all updates scheduled inside the passed callback.\n\t\t* This is mainly used internally to optimize query client updating.\n\t\t* Batches can be nested; the queue is only flushed once the outermost `batch` call finishes.\n\t\t* The return value of `callback` is passed through.\n\t\t*/\n\t\tbatch: (callback) => {\n\t\t\tlet result;\n\t\t\ttransactions++;\n\t\t\ttry {\n\t\t\t\tresult = callback();\n\t\t\t} finally {\n\t\t\t\ttransactions--;\n\t\t\t\tif (!transactions) flush();\n\t\t\t}\n\t\t\treturn result;\n\t\t},\n\t\t/**\n\t\t* All calls to the wrapped function will be batched.\n\t\t*/\n\t\tbatchCalls: (callback) => {\n\t\t\treturn (...args) => {\n\t\t\t\tschedule(() => {\n\t\t\t\t\tcallback(...args);\n\t\t\t\t});\n\t\t\t};\n\t\t},\n\t\t/**\n\t\t* Schedules a function to be run on the next batch.\n\t\t* By default, the batch is run with a `setTimeout`, but this can be configured via `setScheduler`.\n\t\t*/\n\t\tschedule,\n\t\t/**\n\t\t* Use this method to set a custom notify function.\n\t\t* This can be used to for example wrap notifications with `React.act` while running tests.\n\t\t*/\n\t\tsetNotifyFunction: (fn) => {\n\t\t\tnotifyFn = fn;\n\t\t},\n\t\t/**\n\t\t* Use this method to set a custom function to batch notifications together into a single tick.\n\t\t* Framework adapters use this to plug in their own batching primitive, so that a single query\n\t\t* update only triggers one re-render instead of one per subscriber.\n\t\t*\n\t\t* @example\n\t\t* ```ts\n\t\t* import { notifyManager } from '@tanstack/query-core'\n\t\t* import { batch } from 'solid-js'\n\t\t*\n\t\t* notifyManager.setBatchNotifyFunction(batch)\n\t\t* ```\n\t\t*/\n\t\tsetBatchNotifyFunction: (fn) => {\n\t\t\tbatchNotifyFn = fn;\n\t\t},\n\t\t/**\n\t\t* Configures a custom callback that schedules when the next batch runs.\n\t\t* The default behavior is `setTimeout(callback, 0)`.\n\t\t*\n\t\t* @example\n\t\t* ```ts\n\t\t* import { notifyManager } from '@tanstack/query-core'\n\t\t*\n\t\t* // Schedule batches in the next microtask\n\t\t* notifyManager.setScheduler(queueMicrotask)\n\t\t*\n\t\t* // Schedule batches before the next frame is rendered\n\t\t* notifyManager.setScheduler(requestAnimationFrame)\n\t\t*\n\t\t* // Schedule batches some time in the future\n\t\t* notifyManager.setScheduler((cb) => setTimeout(cb, 10))\n\t\t* ```\n\t\t*/\n\t\tsetScheduler: (fn) => {\n\t\t\tscheduleFn = fn;\n\t\t}\n\t};\n}\n/**\n* Handles scheduling and batching callbacks in TanStack Query.\n*/\nconst notifyManager = createNotifyManager();\n//#endregion\nexport { createNotifyManager, defaultScheduler, notifyManager };\n\n//# sourceMappingURL=notifyManager.js.map","import { Subscribable } from \"./subscribable.js\";\n//#region src/onlineManager.ts\n/**\n* The `OnlineManager` manages the online state within TanStack Query. It can\n* be used to change the default event listeners or to manually change the\n* online state.\n*\n* By default, the `onlineManager` assumes an active network connection, and\n* listens to the `online` and `offline` events on the `window` object to\n* detect changes.\n*/\nvar OnlineManager = class extends Subscribable {\n\t#online = true;\n\t#cleanup;\n\t#setup;\n\tconstructor() {\n\t\tsuper();\n\t\tthis.#setup = (onOnline) => {\n\t\t\tif (typeof window !== \"undefined\" && window.addEventListener) {\n\t\t\t\tconst onlineListener = () => onOnline(true);\n\t\t\t\tconst offlineListener = () => onOnline(false);\n\t\t\t\twindow.addEventListener(\"online\", onlineListener, false);\n\t\t\t\twindow.addEventListener(\"offline\", offlineListener, false);\n\t\t\t\treturn () => {\n\t\t\t\t\twindow.removeEventListener(\"online\", onlineListener);\n\t\t\t\t\twindow.removeEventListener(\"offline\", offlineListener);\n\t\t\t\t};\n\t\t\t}\n\t\t};\n\t}\n\tonSubscribe() {\n\t\tif (!this.#cleanup) this.setEventListener(this.#setup);\n\t}\n\tonUnsubscribe() {\n\t\tif (!this.hasListeners()) {\n\t\t\tthis.#cleanup?.();\n\t\t\tthis.#cleanup = void 0;\n\t\t}\n\t}\n\t/**\n\t* `setEventListener` can be used to set a custom event listener that will\n\t* be used to determine the online state. The provided `setup` function\n\t* receives a `setOnline` callback that should be called with a `boolean`\n\t* whenever the online state changes.\n\t*\n\t* @example\n\t* ```ts\n\t* import NetInfo from '@react-native-community/netinfo'\n\t* import { onlineManager } from '@tanstack/query-core'\n\t*\n\t* onlineManager.setEventListener((setOnline) => {\n\t* return NetInfo.addEventListener((state) => {\n\t* setOnline(!!state.isConnected)\n\t* })\n\t* })\n\t* ```\n\t*/\n\tsetEventListener(setup) {\n\t\tthis.#setup = setup;\n\t\tthis.#cleanup?.();\n\t\tthis.#cleanup = setup(this.setOnline.bind(this));\n\t}\n\t/**\n\t* `setOnline` can be used to manually set the online state.\n\t*\n\t* @example\n\t* ```ts\n\t* import { onlineManager } from '@tanstack/query-core'\n\t*\n\t* // Set to online\n\t* onlineManager.setOnline(true)\n\t*\n\t* // Set to offline\n\t* onlineManager.setOnline(false)\n\t* ```\n\t*/\n\tsetOnline(online) {\n\t\tif (this.#online !== online) {\n\t\t\tthis.#online = online;\n\t\t\tthis.listeners.forEach((listener) => {\n\t\t\t\tlistener(online);\n\t\t\t});\n\t\t}\n\t}\n\t/**\n\t* `isOnline` can be used to get the current online state.\n\t*/\n\tisOnline() {\n\t\treturn this.#online;\n\t}\n};\n/**\n* Singleton instance of {@link OnlineManager}, used to manage and observe the online state within TanStack Query.\n*/\nconst onlineManager = new OnlineManager();\n//#endregion\nexport { OnlineManager, onlineManager };\n\n//# sourceMappingURL=onlineManager.js.map","import { noop, sleep } from \"./utils.js\";\nimport { isServer } from \"./environmentManager.js\";\nimport { focusManager } from \"./focusManager.js\";\nimport { onlineManager } from \"./onlineManager.js\";\n//#region src/retryer.ts\nfunction defaultRetryDelay(failureCount) {\n\treturn Math.min(1e3 * 2 ** failureCount, 3e4);\n}\nfunction canFetch(networkMode) {\n\treturn (networkMode ?? \"online\") === \"online\" ? onlineManager.isOnline() : true;\n}\n/**\n* The error thrown by a `Retryer` (and surfaced to `query.promise`/`mutation`) when a fetch is cancelled, e.g. via\n* `query.cancel()`. `revert`, if `true`, tells the caller to restore the state the query was in before the fetch\n* started instead of surfacing the error. `silent`, if `true`, tells the caller to suppress this error and instead\n* resolve with the promise of the fetch that triggered the cancellation.\n* @example\n* ```ts\n* query.cancel()\n*\n* try {\n* await query.promise\n* } catch (error) {\n* if (error instanceof CancelledError) {\n* // the fetch was cancelled, e.g. via `query.cancel()`\n* }\n* }\n* ```\n*/\nvar CancelledError = class extends Error {\n\tconstructor(options) {\n\t\tsuper(\"CancelledError\");\n\t\tthis.revert = options?.revert;\n\t\tthis.silent = options?.silent;\n\t}\n};\n/**\n* @deprecated Use instanceof `CancelledError` instead.\n*/\nfunction isCancelledError(value) {\n\treturn value instanceof CancelledError;\n}\nfunction createRetryer(config) {\n\tlet isRetryCancelled = false;\n\tlet failureCount = 0;\n\tlet continueFn;\n\tlet status = \"pending\";\n\tlet promiseResolve;\n\tlet promiseReject;\n\tconst promise = new Promise((resolve, reject) => {\n\t\tpromiseResolve = resolve;\n\t\tpromiseReject = reject;\n\t});\n\tpromise.catch(noop);\n\tconst isResolved = () => status !== \"pending\";\n\tconst cancel = (cancelOptions) => {\n\t\tif (!isResolved()) {\n\t\t\tconst error = new CancelledError(cancelOptions);\n\t\t\treject(error);\n\t\t\tconfig.onCancel?.(error);\n\t\t}\n\t};\n\tconst cancelRetry = () => {\n\t\tisRetryCancelled = true;\n\t};\n\tconst continueRetry = () => {\n\t\tisRetryCancelled = false;\n\t};\n\tconst canContinue = () => focusManager.isFocused() && (config.networkMode === \"always\" || onlineManager.isOnline()) && config.canRun();\n\tconst canStart = () => canFetch(config.networkMode) && config.canRun();\n\tconst resolve = (value) => {\n\t\tif (!isResolved()) {\n\t\t\tcontinueFn?.();\n\t\t\tstatus = \"resolved\";\n\t\t\tpromiseResolve(value);\n\t\t}\n\t};\n\tconst reject = (value) => {\n\t\tif (!isResolved()) {\n\t\t\tcontinueFn?.();\n\t\t\tstatus = \"rejected\";\n\t\t\tpromiseReject(value);\n\t\t}\n\t};\n\tconst pause = () => {\n\t\treturn new Promise((continueResolve) => {\n\t\t\tcontinueFn = (value) => {\n\t\t\t\tif (isResolved() || canContinue()) continueResolve(value);\n\t\t\t};\n\t\t\tconfig.onPause?.();\n\t\t}).then(() => {\n\t\t\tcontinueFn = void 0;\n\t\t\tif (!isResolved()) config.onContinue?.();\n\t\t});\n\t};\n\tconst run = () => {\n\t\tif (isResolved()) return;\n\t\tlet promiseOrValue;\n\t\tconst initialPromise = failureCount === 0 ? config.initialPromise : void 0;\n\t\ttry {\n\t\t\tpromiseOrValue = initialPromise ?? config.fn();\n\t\t} catch (error) {\n\t\t\tpromiseOrValue = Promise.reject(error);\n\t\t}\n\t\tPromise.resolve(promiseOrValue).then(resolve).catch((error) => {\n\t\t\tif (isResolved()) return;\n\t\t\tconst retry = config.retry ?? (isServer() ? 0 : 3);\n\t\t\tconst retryDelay = config.retryDelay ?? defaultRetryDelay;\n\t\t\tconst delay = typeof retryDelay === \"function\" ? retryDelay(failureCount, error) : retryDelay;\n\t\t\tconst shouldRetry = retry === true || typeof retry === \"number\" && failureCount < retry || typeof retry === \"function\" && retry(failureCount, error);\n\t\t\tif (isRetryCancelled || !shouldRetry) {\n\t\t\t\treject(error);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfailureCount++;\n\t\t\tconfig.onFail?.(failureCount, error);\n\t\t\tsleep(delay).then(() => {\n\t\t\t\treturn canContinue() ? void 0 : pause();\n\t\t\t}).then(() => {\n\t\t\t\tif (isRetryCancelled) reject(error);\n\t\t\t\telse run();\n\t\t\t});\n\t\t});\n\t};\n\treturn {\n\t\tpromise,\n\t\tstatus: () => status,\n\t\tcancel,\n\t\tcontinue: () => {\n\t\t\tcontinueFn?.();\n\t\t\treturn promise;\n\t\t},\n\t\tcancelRetry,\n\t\tcontinueRetry,\n\t\tcanStart,\n\t\tstart: () => {\n\t\t\tif (canStart()) run();\n\t\t\telse pause().then(run);\n\t\t\treturn promise;\n\t\t}\n\t};\n}\n//#endregion\nexport { CancelledError, canFetch, createRetryer, isCancelledError };\n\n//# sourceMappingURL=retryer.js.map","import { timeoutManager } from \"./timeoutManager.js\";\nimport { isValidTimeout } from \"./utils.js\";\nimport { isServer } from \"./environmentManager.js\";\n//#region src/removable.ts\n/**\n* The base class for cache entries that are garbage collected once nothing is using them —\n* `Query` and `Mutation` both extend it. `gcTime` controls how long an unused entry is kept.\n*/\nvar Removable = class {\n\t#gcTimeout;\n\t/**\n\t* Clears the pending garbage collection timeout, so the entry is no longer scheduled for removal.\n\t* A subclass may override this to release what it holds on to as well — `Query` also cancels any\n\t* in-flight fetch.\n\t*/\n\tdestroy() {\n\t\tthis.clearGcTimeout();\n\t}\n\tscheduleGc() {\n\t\tthis.clearGcTimeout();\n\t\tif (isValidTimeout(this.gcTime)) this.#gcTimeout = timeoutManager.setTimeout(() => {\n\t\t\tthis.optionalRemove();\n\t\t}, this.gcTime);\n\t}\n\tupdateGcTime(newGcTime) {\n\t\tthis.gcTime = Math.max(this.gcTime || 0, newGcTime ?? (isServer() ? Infinity : 3e5));\n\t}\n\tclearGcTimeout() {\n\t\tif (this.#gcTimeout !== void 0) {\n\t\t\ttimeoutManager.clearTimeout(this.#gcTimeout);\n\t\t\tthis.#gcTimeout = void 0;\n\t\t}\n\t}\n};\n//#endregion\nexport { Removable };\n\n//# sourceMappingURL=removable.js.map","import { addConsumeAwareSignal, addToEnd, addToStart, ensureQueryFn } from \"./utils.js\";\n//#region src/infiniteQueryBehavior.ts\nfunction infiniteQueryBehavior(pages) {\n\treturn { onFetch: (context, query) => {\n\t\tconst options = context.options;\n\t\tconst direction = context.fetchOptions?.meta?.fetchMore?.direction;\n\t\tconst oldPages = context.state.data?.pages || [];\n\t\tconst oldPageParams = context.state.data?.pageParams || [];\n\t\tlet result = {\n\t\t\tpages: [],\n\t\t\tpageParams: []\n\t\t};\n\t\tlet currentPage = 0;\n\t\tconst fetchFn = async () => {\n\t\t\tlet cancelled = false;\n\t\t\tconst addSignalProperty = (object) => {\n\t\t\t\taddConsumeAwareSignal(object, () => context.signal, () => cancelled = true);\n\t\t\t};\n\t\t\tconst queryFn = ensureQueryFn(context.options, context.fetchOptions);\n\t\t\tconst fetchPage = async (data, param, previous) => {\n\t\t\t\tif (cancelled) return Promise.reject(context.signal.reason);\n\t\t\t\tif (param == null && data.pages.length) return Promise.resolve(data);\n\t\t\t\tconst createQueryFnContext = () => {\n\t\t\t\t\tconst queryFnContext = {\n\t\t\t\t\t\tclient: context.client,\n\t\t\t\t\t\tqueryKey: context.queryKey,\n\t\t\t\t\t\tpageParam: param,\n\t\t\t\t\t\tdirection: previous ? \"backward\" : \"forward\",\n\t\t\t\t\t\tmeta: context.options.meta\n\t\t\t\t\t};\n\t\t\t\t\taddSignalProperty(queryFnContext);\n\t\t\t\t\treturn queryFnContext;\n\t\t\t\t};\n\t\t\t\tconst queryFnContext = createQueryFnContext();\n\t\t\t\tconst page = await queryFn(queryFnContext);\n\t\t\t\tconst { maxPages } = context.options;\n\t\t\t\tconst addTo = previous ? addToStart : addToEnd;\n\t\t\t\treturn {\n\t\t\t\t\tpages: addTo(data.pages, page, maxPages),\n\t\t\t\t\tpageParams: addTo(data.pageParams, param, maxPages)\n\t\t\t\t};\n\t\t\t};\n\t\t\tif (direction && oldPages.length) {\n\t\t\t\tconst previous = direction === \"backward\";\n\t\t\t\tconst pageParamFn = previous ? getPreviousPageParam : getNextPageParam;\n\t\t\t\tconst oldData = {\n\t\t\t\t\tpages: oldPages,\n\t\t\t\t\tpageParams: oldPageParams\n\t\t\t\t};\n\t\t\t\tresult = await fetchPage(oldData, pageParamFn(options, oldData), previous);\n\t\t\t} else {\n\t\t\t\tconst remainingPages = pages ?? oldPages.length;\n\t\t\t\tdo {\n\t\t\t\t\tconst param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result);\n\t\t\t\t\tif (currentPage > 0 && param == null) break;\n\t\t\t\t\tresult = await fetchPage(result, param);\n\t\t\t\t\tcurrentPage++;\n\t\t\t\t} while (currentPage < remainingPages);\n\t\t\t}\n\t\t\treturn result;\n\t\t};\n\t\tif (context.options.persister) context.fetchFn = () => {\n\t\t\treturn context.options.persister?.(fetchFn, {\n\t\t\t\tclient: context.client,\n\t\t\t\tqueryKey: context.queryKey,\n\t\t\t\tmeta: context.options.meta,\n\t\t\t\tsignal: context.signal\n\t\t\t}, query);\n\t\t};\n\t\telse context.fetchFn = fetchFn;\n\t} };\n}\nfunction getNextPageParam(options, { pages, pageParams }) {\n\tconst lastIndex = pages.length - 1;\n\treturn pages.length > 0 ? options.getNextPageParam(pages[lastIndex], pages, pageParams[lastIndex], pageParams) : void 0;\n}\nfunction getPreviousPageParam(options, { pages, pageParams }) {\n\treturn pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0;\n}\n/**\n* Checks if there is a next page.\n*/\nfunction hasNextPage(options, data) {\n\tif (!data) return false;\n\treturn getNextPageParam(options, data) != null;\n}\n/**\n* Checks if there is a previous page.\n*/\nfunction hasPreviousPage(options, data) {\n\tif (!data || !options.getPreviousPageParam) return false;\n\treturn getPreviousPageParam(options, data) != null;\n}\n//#endregion\nexport { hasNextPage, hasPreviousPage, infiniteQueryBehavior };\n\n//# sourceMappingURL=infiniteQueryBehavior.js.map","import { ensureQueryFn, noop, replaceData, resolveQueryValue, skipToken, timeUntilStale } from \"./utils.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { CancelledError, canFetch, createRetryer } from \"./retryer.js\";\nimport { Removable } from \"./removable.js\";\nimport { infiniteQueryBehavior } from \"./infiniteQueryBehavior.js\";\n//#region src/query.ts\n/**\n* Represents a single cached query. A `Query` holds the query's key, options,\n* state (data/error/status), and the observers currently subscribed to it.\n*\n* Instances are created and managed internally by `QueryCache`; application\n* code typically interacts with queries indirectly through `QueryClient` or\n* a framework hook like `useQuery`. Direct access to a `Query` instance is\n* possible via `queryCache.find()`/`findAll()` for inspecting cache state.\n*\n* @example\n* ```ts\n* const queryCache = queryClient.getQueryCache()\n* const query = queryCache.find({ queryKey: ['posts'] })\n*\n* if (query) {\n* console.log(query.state.dataUpdatedAt)\n* }\n* ```\n*/\nvar Query = class extends Removable {\n\t#queryType;\n\t#initialState;\n\t#revertState;\n\t#cache;\n\t#client;\n\t#retryer;\n\t#defaultOptions;\n\t#abortSignalConsumed;\n\tconstructor(config) {\n\t\tsuper();\n\t\tthis.#abortSignalConsumed = false;\n\t\tthis.#defaultOptions = config.defaultOptions;\n\t\tthis.setOptions(config.options);\n\t\tthis.observers = [];\n\t\tthis.#client = config.client;\n\t\tthis.#cache = this.#client.getQueryCache();\n\t\tthis.queryKey = config.queryKey;\n\t\tthis.queryHash = config.queryHash;\n\t\tthis.#initialState = getDefaultState(this.options);\n\t\tthis.state = config.state ?? this.#initialState;\n\t\tthis.scheduleGc();\n\t}\n\t/**\n\t* The `meta` object passed in the query's options, if any.\n\t*/\n\tget meta() {\n\t\treturn this.options.meta;\n\t}\n\t/** @internal */\n\tget queryType() {\n\t\treturn this.#queryType;\n\t}\n\t/**\n\t* The promise for the currently in-flight fetch, if the query is fetching.\n\t* `undefined` when the query is not fetching.\n\t*/\n\tget promise() {\n\t\treturn this.#retryer?.promise;\n\t}\n\t/** @internal */\n\tsetOptions(options) {\n\t\tthis.options = {\n\t\t\t...this.#defaultOptions,\n\t\t\t...options\n\t\t};\n\t\tif (options?._type) this.#queryType = options._type;\n\t\tthis.updateGcTime(this.options.gcTime);\n\t\tif (this.state && this.state.data === void 0) {\n\t\t\tconst defaultState = getDefaultState(this.options);\n\t\t\tif (defaultState.data !== void 0) {\n\t\t\t\tthis.setState(successState(defaultState.data, defaultState.dataUpdatedAt));\n\t\t\t\tthis.#initialState = defaultState;\n\t\t\t}\n\t\t}\n\t}\n\toptionalRemove() {\n\t\tif (!this.observers.length && this.state.fetchStatus === \"idle\") this.#cache.remove(this);\n\t}\n\t/** @internal */\n\tsetData(newData, options) {\n\t\tconst data = replaceData(this.state.data, newData, this.options);\n\t\tthis.#dispatch({\n\t\t\tdata,\n\t\t\ttype: \"success\",\n\t\t\tdataUpdatedAt: options?.updatedAt,\n\t\t\tmanual: options?.manual\n\t\t});\n\t\treturn data;\n\t}\n\t/**\n\t* Merges the given partial state directly into this query's state, notifying observers. Used\n\t* by persistence and broadcast plugins to restore a state snapshot, and by devtools to let a\n\t* user manually trigger a loading/error state or edit the cached data.\n\t*/\n\tsetState(state) {\n\t\tthis.#dispatch({\n\t\t\ttype: \"setState\",\n\t\t\tstate\n\t\t});\n\t}\n\t/**\n\t* Cancels the query's currently in-flight fetch, if any.\n\t* - Returns a promise that resolves once the cancellation has settled.\n\t* - If no fetch is in progress, resolves immediately.\n\t*\n\t* @example\n\t* ```ts\n\t* await query.cancel()\n\t* ```\n\t*/\n\tcancel(options) {\n\t\tconst promise = this.#retryer?.promise;\n\t\tthis.#retryer?.cancel(options);\n\t\treturn promise ? promise.then(noop).catch(noop) : Promise.resolve();\n\t}\n\t/**\n\t* Clears the query's garbage collection timeout and silently cancels any\n\t* in-flight fetch. Called by `QueryCache` when the query is removed from\n\t* the cache.\n\t*\n\t* @see {@link Query#cancel}\n\t*/\n\tdestroy() {\n\t\tsuper.destroy();\n\t\tthis.cancel({ silent: true });\n\t}\n\t/** @internal */\n\tget resetState() {\n\t\treturn this.#initialState;\n\t}\n\t/**\n\t* Resets the query back to its initial state (the state it had when it was\n\t* first created, e.g. any `initialData`), destroying it first to cancel any\n\t* in-flight fetch.\n\t*/\n\treset() {\n\t\tthis.destroy();\n\t\tthis.setState(this.resetState);\n\t}\n\t/**\n\t* Returns `true` if the query has at least one observer for which `enabled`\n\t* does not resolve to `false`.\n\t*/\n\tisActive() {\n\t\treturn this.observers.some((observer) => resolveQueryValue(observer.options.enabled, this) !== false);\n\t}\n\t/**\n\t* Returns `true` if the query is disabled, meaning it will not fetch\n\t* automatically.\n\t* - If the query has observers, it is disabled when none of them are active\n\t* (see `isActive`).\n\t* - If the query has no observers, it is disabled when its `queryFn` is\n\t* `skipToken` or it has never been fetched.\n\t*/\n\tisDisabled() {\n\t\tif (this.getObserversCount() > 0) return !this.isActive();\n\t\treturn this.options.queryFn === skipToken || !this.isFetched();\n\t}\n\t/**\n\t* Returns `true` if the query has been fetched, i.e. it has resolved with\n\t* either data or an error at least once.\n\t*/\n\tisFetched() {\n\t\treturn this.state.dataUpdateCount + this.state.errorUpdateCount > 0;\n\t}\n\t/**\n\t* Returns `true` if the query has at least one observer configured with\n\t* `staleTime: 'static'`, meaning it is treated as never stale.\n\t*/\n\tisStatic() {\n\t\tif (this.getObserversCount() > 0) return this.observers.some((observer) => resolveQueryValue(observer.options.staleTime, this) === \"static\");\n\t\treturn false;\n\t}\n\t/**\n\t* Returns `true` if the query is stale.\n\t* - If the query has observers, defers to whether any observer's current\n\t* result reports `isStale` (which accounts for each observer's own\n\t* `staleTime` and `enabled` state).\n\t* - If the query has no observers, it is considered stale when it has no\n\t* data or has been invalidated.\n\t*\n\t* @see {@link Query#isStaleByTime}\n\t* @example\n\t* ```ts\n\t* if (query.isStale()) {\n\t* // refetch or otherwise treat the cached data as outdated\n\t* }\n\t* ```\n\t*/\n\tisStale() {\n\t\tif (this.getObserversCount() > 0) return this.observers.some((observer) => observer.getCurrentResult().isStale);\n\t\treturn this.state.data === void 0 || this.state.isInvalidated;\n\t}\n\t/**\n\t* Returns `true` if the query's data is stale relative to the given\n\t* `staleTime` (defaults to `0`).\n\t* - A query with no data is always stale.\n\t* - `staleTime: 'static'` is never stale.\n\t* - An invalidated query is always stale.\n\t* - Otherwise, staleness is based on elapsed time since `dataUpdatedAt`.\n\t*\n\t* @see {@link Query#isStale}\n\t* @example\n\t* ```ts\n\t* const isStale = query.isStaleByTime(1000 * 60)\n\t* ```\n\t*/\n\tisStaleByTime(staleTime = 0) {\n\t\tif (this.state.data === void 0) return true;\n\t\tif (staleTime === \"static\") return false;\n\t\tif (this.state.isInvalidated) return true;\n\t\treturn !timeUntilStale(this.state.dataUpdatedAt, staleTime);\n\t}\n\t/** @internal */\n\tonFocus() {\n\t\tthis.observers.find((x) => x.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: false });\n\t\tthis.#retryer?.continue();\n\t}\n\t/** @internal */\n\tonOnline() {\n\t\tthis.observers.find((x) => x.shouldFetchOnReconnect())?.refetch({ cancelRefetch: false });\n\t\tthis.#retryer?.continue();\n\t}\n\t/** @internal */\n\taddObserver(observer) {\n\t\tif (!this.observers.includes(observer)) {\n\t\t\tthis.observers.push(observer);\n\t\t\tthis.clearGcTimeout();\n\t\t\tthis.#cache.notify({\n\t\t\t\ttype: \"observerAdded\",\n\t\t\t\tquery: this,\n\t\t\t\tobserver\n\t\t\t});\n\t\t}\n\t}\n\t/** @internal */\n\tremoveObserver(observer) {\n\t\tconst index = this.observers.indexOf(observer);\n\t\tif (index !== -1) {\n\t\t\tthis.observers.splice(index, 1);\n\t\t\tif (!this.observers.length) {\n\t\t\t\tif (this.#retryer) {\n\t\t\t\t\tif (this.#abortSignalConsumed || this.state.fetchStatus === \"paused\" && this.state.status === \"pending\") this.#retryer.cancel({ revert: true });\n\t\t\t\t\telse this.#retryer.cancelRetry();\n\t\t\t\t}\n\t\t\t\tthis.scheduleGc();\n\t\t\t}\n\t\t\tthis.#cache.notify({\n\t\t\t\ttype: \"observerRemoved\",\n\t\t\t\tquery: this,\n\t\t\t\tobserver\n\t\t\t});\n\t\t}\n\t}\n\t/**\n\t* Returns the number of observers currently subscribed to this query.\n\t*\n\t* @example\n\t* ```ts\n\t* if (query.getObserversCount() === 0) {\n\t* // no component is currently watching this query\n\t* }\n\t* ```\n\t*/\n\tgetObserversCount() {\n\t\treturn this.observers.length;\n\t}\n\t/**\n\t* Marks the query as invalidated, unless it is already invalidated. This\n\t* updates `state.isInvalidated` and notifies observers, but does not by\n\t* itself trigger a refetch.\n\t*\n\t* @example\n\t* ```ts\n\t* query.invalidate()\n\t* ```\n\t*/\n\tinvalidate() {\n\t\tif (!this.state.isInvalidated) this.#dispatch({ type: \"invalidate\" });\n\t}\n\t/**\n\t* Fetches the query, i.e. runs its `queryFn` (through any configured\n\t* retryer/behavior) and updates the query's state with the result.\n\t* - If a fetch is already in flight, returns its promise instead of\n\t* starting a new one, unless `fetchOptions.cancelRefetch` is set and the\n\t* query already has data, in which case the current fetch is silently\n\t* cancelled first.\n\t* - If `options` is passed, it replaces the query's current options\n\t* before fetching.\n\t*/\n\tasync fetch(options, fetchOptions) {\n\t\tif (this.state.fetchStatus !== \"idle\" && this.#retryer?.status() !== \"rejected\") {\n\t\t\tif (this.state.data !== void 0 && fetchOptions?.cancelRefetch) this.cancel({ silent: true });\n\t\t\telse if (this.#retryer) {\n\t\t\t\tthis.#retryer.continueRetry();\n\t\t\t\treturn this.#retryer.promise;\n\t\t\t}\n\t\t}\n\t\tif (options) this.setOptions(options);\n\t\tif (!this.options.queryFn) {\n\t\t\tconst observer = this.observers.find((x) => x.options.queryFn);\n\t\t\tif (observer) this.setOptions(observer.options);\n\t\t}\n\t\tif (process.env.NODE_ENV !== \"production\") {\n\t\t\tif (!Array.isArray(this.options.queryKey)) console.error(`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']`);\n\t\t}\n\t\tconst abortController = new AbortController();\n\t\tconst addSignalProperty = (object) => {\n\t\t\tObject.defineProperty(object, \"signal\", {\n\t\t\t\tenumerable: true,\n\t\t\t\tget: () => {\n\t\t\t\t\tthis.#abortSignalConsumed = true;\n\t\t\t\t\treturn abortController.signal;\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\t\tconst fetchFn = () => {\n\t\t\tconst queryFn = ensureQueryFn(this.options, fetchOptions);\n\t\t\tconst createQueryFnContext = () => {\n\t\t\t\tconst queryFnContext = {\n\t\t\t\t\tclient: this.#client,\n\t\t\t\t\tqueryKey: this.queryKey,\n\t\t\t\t\tmeta: this.meta\n\t\t\t\t};\n\t\t\t\taddSignalProperty(queryFnContext);\n\t\t\t\treturn queryFnContext;\n\t\t\t};\n\t\t\tconst queryFnContext = createQueryFnContext();\n\t\t\tthis.#abortSignalConsumed = false;\n\t\t\tif (this.options.persister) return this.options.persister(queryFn, queryFnContext, this);\n\t\t\treturn queryFn(queryFnContext);\n\t\t};\n\t\tconst createFetchContext = () => {\n\t\t\tconst context = {\n\t\t\t\tfetchOptions,\n\t\t\t\toptions: this.options,\n\t\t\t\tqueryKey: this.queryKey,\n\t\t\t\tclient: this.#client,\n\t\t\t\tstate: this.state,\n\t\t\t\tfetchFn\n\t\t\t};\n\t\t\taddSignalProperty(context);\n\t\t\treturn context;\n\t\t};\n\t\tconst context = createFetchContext();\n\t\t(this.#queryType === \"infinite\" ? infiniteQueryBehavior(this.options.pages) : this.options.behavior)?.onFetch(context, this);\n\t\tthis.#revertState = this.state;\n\t\tif (this.state.fetchStatus === \"idle\" || this.state.fetchMeta !== context.fetchOptions?.meta) this.#dispatch({\n\t\t\ttype: \"fetch\",\n\t\t\tmeta: context.fetchOptions?.meta\n\t\t});\n\t\tconst retryer = this.#retryer = createRetryer({\n\t\t\tinitialPromise: fetchOptions?.initialPromise,\n\t\t\tfn: context.fetchFn,\n\t\t\tonCancel: (error) => {\n\t\t\t\tif (error instanceof CancelledError && error.revert) this.setState({\n\t\t\t\t\t...this.#revertState,\n\t\t\t\t\tfetchStatus: \"idle\"\n\t\t\t\t});\n\t\t\t\tabortController.abort();\n\t\t\t},\n\t\t\tonFail: (failureCount, error) => {\n\t\t\t\tthis.#dispatch({\n\t\t\t\t\ttype: \"failed\",\n\t\t\t\t\tfailureCount,\n\t\t\t\t\terror\n\t\t\t\t});\n\t\t\t},\n\t\t\tonPause: () => {\n\t\t\t\tthis.#dispatch({ type: \"pause\" });\n\t\t\t},\n\t\t\tonContinue: () => {\n\t\t\t\tthis.#dispatch({ type: \"continue\" });\n\t\t\t},\n\t\t\tretry: context.options.retry,\n\t\t\tretryDelay: context.options.retryDelay,\n\t\t\tnetworkMode: context.options.networkMode,\n\t\t\tcanRun: () => true\n\t\t});\n\t\ttry {\n\t\t\tconst data = await retryer.start();\n\t\t\tif (data === void 0) {\n\t\t\t\tif (process.env.NODE_ENV !== \"production\") console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`);\n\t\t\t\tthrow new Error(`${this.queryHash} data is undefined`);\n\t\t\t}\n\t\t\tthis.setData(data);\n\t\t\tthis.#cache.config.onSuccess?.(data, this);\n\t\t\tthis.#cache.config.onSettled?.(data, this.state.error, this);\n\t\t\treturn data;\n\t\t} catch (error) {\n\t\t\tif (error instanceof CancelledError) {\n\t\t\t\tif (error.silent) return this.#retryer.promise;\n\t\t\t\telse if (error.revert) {\n\t\t\t\t\tif (this.state.data === void 0) throw error;\n\t\t\t\t\treturn this.state.data;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.#dispatch({\n\t\t\t\ttype: \"error\",\n\t\t\t\terror\n\t\t\t});\n\t\t\tthis.#cache.config.onError?.(error, this);\n\t\t\tthis.#cache.config.onSettled?.(this.state.data, error, this);\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tif (this.#retryer === retryer) this.#retryer = void 0;\n\t\t\tthis.scheduleGc();\n\t\t}\n\t}\n\t#dispatch(action) {\n\t\tconst reducer = (state) => {\n\t\t\tswitch (action.type) {\n\t\t\t\tcase \"failed\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tfetchFailureCount: action.failureCount,\n\t\t\t\t\tfetchFailureReason: action.error\n\t\t\t\t};\n\t\t\t\tcase \"pause\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tfetchStatus: \"paused\"\n\t\t\t\t};\n\t\t\t\tcase \"continue\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tfetchStatus: \"fetching\"\n\t\t\t\t};\n\t\t\t\tcase \"fetch\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\t...fetchState(state.data, this.options),\n\t\t\t\t\tfetchMeta: action.meta ?? null\n\t\t\t\t};\n\t\t\t\tcase \"success\":\n\t\t\t\t\tconst newState = {\n\t\t\t\t\t\t...state,\n\t\t\t\t\t\t...successState(action.data, action.dataUpdatedAt),\n\t\t\t\t\t\tdataUpdateCount: state.dataUpdateCount + 1,\n\t\t\t\t\t\t...!action.manual && {\n\t\t\t\t\t\t\tfetchStatus: \"idle\",\n\t\t\t\t\t\t\tfetchFailureCount: 0,\n\t\t\t\t\t\t\tfetchFailureReason: null\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tthis.#revertState = action.manual ? newState : void 0;\n\t\t\t\t\treturn newState;\n\t\t\t\tcase \"error\":\n\t\t\t\t\tconst error = action.error;\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...state,\n\t\t\t\t\t\terror,\n\t\t\t\t\t\terrorUpdateCount: state.errorUpdateCount + 1,\n\t\t\t\t\t\terrorUpdatedAt: Date.now(),\n\t\t\t\t\t\tfetchFailureCount: state.fetchFailureCount + 1,\n\t\t\t\t\t\tfetchFailureReason: error,\n\t\t\t\t\t\tfetchStatus: \"idle\",\n\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\tisInvalidated: true\n\t\t\t\t\t};\n\t\t\t\tcase \"invalidate\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tisInvalidated: true\n\t\t\t\t};\n\t\t\t\tcase \"setState\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\t...action.state\n\t\t\t\t};\n\t\t\t}\n\t\t};\n\t\tthis.state = reducer(this.state);\n\t\tnotifyManager.batch(() => {\n\t\t\tthis.observers.slice().forEach((observer) => {\n\t\t\t\tobserver.onQueryUpdate();\n\t\t\t});\n\t\t\tthis.#cache.notify({\n\t\t\t\tquery: this,\n\t\t\t\ttype: \"updated\",\n\t\t\t\taction\n\t\t\t});\n\t\t});\n\t}\n};\nfunction fetchState(data, options) {\n\treturn {\n\t\tfetchFailureCount: 0,\n\t\tfetchFailureReason: null,\n\t\tfetchStatus: canFetch(options.networkMode) ? \"fetching\" : \"paused\",\n\t\t...data === void 0 && {\n\t\t\terror: null,\n\t\t\tstatus: \"pending\"\n\t\t}\n\t};\n}\nfunction successState(data, dataUpdatedAt) {\n\treturn {\n\t\tdata,\n\t\tdataUpdatedAt: dataUpdatedAt ?? Date.now(),\n\t\terror: null,\n\t\tisInvalidated: false,\n\t\tstatus: \"success\"\n\t};\n}\nfunction getDefaultState(options) {\n\tconst data = typeof options.initialData === \"function\" ? options.initialData() : options.initialData;\n\tconst hasData = data !== void 0;\n\tconst initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === \"function\" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;\n\treturn {\n\t\tdata,\n\t\tdataUpdateCount: 0,\n\t\tdataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,\n\t\terror: null,\n\t\terrorUpdateCount: 0,\n\t\terrorUpdatedAt: 0,\n\t\tfetchFailureCount: 0,\n\t\tfetchFailureReason: null,\n\t\tfetchMeta: null,\n\t\tisInvalidated: false,\n\t\tstatus: hasData ? \"success\" : \"pending\",\n\t\tfetchStatus: \"idle\"\n\t};\n}\n//#endregion\nexport { Query, fetchState };\n\n//# sourceMappingURL=query.js.map","import { timeoutManager } from \"./timeoutManager.js\";\nimport { isValidTimeout, noop, replaceData, resolveQueryValue, shallowEqualObjects, timeUntilStale } from \"./utils.js\";\nimport { isServer } from \"./environmentManager.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { focusManager } from \"./focusManager.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { fetchState } from \"./query.js\";\n//#region src/queryObserver.ts\n/**\n* A `QueryObserver` watches a single query in the `QueryCache` and computes a\n* `QueryObserverResult` from its state, recomputing and notifying subscribers\n* whenever the underlying query (or the observer's options) changes. It is\n* the primitive that framework adapters (e.g. `useQuery`) build their hooks\n* on top of, but it can also be used directly to observe and switch between\n* queries outside of any framework.\n*\n* @example\n* ```ts\n* const observer = new QueryObserver(queryClient, {\n* queryKey: ['posts'],\n* queryFn: fetchPosts,\n* })\n*\n* const unsubscribe = observer.subscribe((result) => {\n* console.log(result.data)\n* })\n* ```\n*/\nvar QueryObserver = class extends Subscribable {\n\t#client;\n\t#currentQuery = void 0;\n\t#currentQueryInitialState = void 0;\n\t#currentResult = void 0;\n\t#currentResultState;\n\t#currentResultOptions;\n\t#selectError;\n\t#selectFn;\n\t#selectResult;\n\t#lastQueryWithDefinedData;\n\t#staleTimeoutId;\n\t#refetchIntervalId;\n\t#currentRefetchInterval;\n\t#trackedProps = /* @__PURE__ */ new Set();\n\tconstructor(client, options) {\n\t\tsuper();\n\t\tthis.options = options;\n\t\tthis.#client = client;\n\t\tthis.#selectError = null;\n\t\tthis.bindMethods();\n\t\tthis.setOptions(options);\n\t}\n\tbindMethods() {\n\t\tthis.refetch = this.refetch.bind(this);\n\t}\n\tonSubscribe() {\n\t\tif (this.listeners.size === 1) {\n\t\t\tthis.#currentQuery.addObserver(this);\n\t\t\tif (shouldFetchOnMount(this.#currentQuery, this.options)) this.#executeFetch();\n\t\t\telse this.updateResult();\n\t\t\tthis.#updateTimers();\n\t\t}\n\t}\n\tonUnsubscribe() {\n\t\tif (!this.hasListeners()) this.destroy();\n\t}\n\t/**\n\t* Returns whether the observed query is currently stale and configured\n\t* (via the `refetchOnReconnect` option) to refetch when the network\n\t* reconnects.\n\t*/\n\tshouldFetchOnReconnect() {\n\t\treturn shouldFetchOn(this.#currentQuery, this.options, this.options.refetchOnReconnect);\n\t}\n\t/**\n\t* Returns whether the observed query is currently stale and configured\n\t* (via the `refetchOnWindowFocus` option) to refetch when the window\n\t* regains focus.\n\t*/\n\tshouldFetchOnWindowFocus() {\n\t\treturn shouldFetchOn(this.#currentQuery, this.options, this.options.refetchOnWindowFocus);\n\t}\n\t/**\n\t* Stops observing the current query: clears all listeners, cancels the\n\t* stale and refetch-interval timers, and removes this observer from the\n\t* query it was observing.\n\t*/\n\tdestroy() {\n\t\tthis.listeners = /* @__PURE__ */ new Set();\n\t\tthis.#clearStaleTimeout();\n\t\tthis.#clearRefetchInterval();\n\t\tthis.#currentQuery.removeObserver(this);\n\t}\n\t/**\n\t* Updates the observer's options. This will re-resolve the query being\n\t* observed (switching to a different query if the `queryKey` changed),\n\t* trigger a fetch if the new options require one and the observer has\n\t* subscribers, recompute the current result, and reschedule the stale and\n\t* refetch-interval timers as needed.\n\t*\n\t* @example\n\t* ```ts\n\t* observer.setOptions({ queryKey: ['posts', 1], queryFn: () => fetchPost(1) })\n\t* // later: switch to a different query, reusing the same observer\n\t* observer.setOptions({ queryKey: ['posts', 2], queryFn: () => fetchPost(2) })\n\t* ```\n\t*/\n\tsetOptions(options) {\n\t\tconst prevOptions = this.options;\n\t\tconst prevQuery = this.#currentQuery;\n\t\tthis.options = this.#client.defaultQueryOptions(options);\n\t\tif (this.options.enabled !== void 0 && typeof this.options.enabled !== \"boolean\" && typeof this.options.enabled !== \"function\" && typeof resolveQueryValue(this.options.enabled, this.#currentQuery) !== \"boolean\") throw new Error(\"Expected enabled to be a boolean or a callback that returns a boolean\");\n\t\tthis.#updateQuery();\n\t\tthis.#currentQuery.setOptions(this.options);\n\t\tif (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) this.#client.getQueryCache().notify({\n\t\t\ttype: \"observerOptionsUpdated\",\n\t\t\tquery: this.#currentQuery,\n\t\t\tobserver: this\n\t\t});\n\t\tconst mounted = this.hasListeners();\n\t\tif (mounted && shouldFetchOptionally(this.#currentQuery, prevQuery, this.options, prevOptions)) this.#executeFetch();\n\t\tthis.updateResult();\n\t\tif (mounted && (this.#currentQuery !== prevQuery || resolveQueryValue(this.options.enabled, this.#currentQuery) !== resolveQueryValue(prevOptions.enabled, this.#currentQuery) || resolveQueryValue(this.options.staleTime, this.#currentQuery) !== resolveQueryValue(prevOptions.staleTime, this.#currentQuery))) this.#updateStaleTimeout();\n\t\tconst nextRefetchInterval = this.#computeRefetchInterval();\n\t\tif (mounted && (this.#currentQuery !== prevQuery || resolveQueryValue(this.options.enabled, this.#currentQuery) !== resolveQueryValue(prevOptions.enabled, this.#currentQuery) || nextRefetchInterval !== this.#currentRefetchInterval)) this.#updateRefetchInterval(nextRefetchInterval);\n\t}\n\t/**\n\t* Computes the result the observer would produce for the given (already-defaulted) options\n\t* right now, building the underlying `Query` if it doesn't exist yet, without waiting for a\n\t* subscription callback. Called by framework adapters on every render (e.g. `useQuery`) so the\n\t* returned value is available synchronously, ahead of `setOptions` triggering an actual fetch.\n\t*/\n\tgetOptimisticResult(options) {\n\t\tconst query = this.#client.getQueryCache().build(this.#client, options);\n\t\tconst result = this.createResult(query, options);\n\t\tif (!shallowEqualObjects(this.getCurrentResult(), result)) {\n\t\t\tthis.#currentResult = result;\n\t\t\tthis.#currentResultOptions = this.options;\n\t\t\tthis.#currentResultState = this.#currentQuery.state;\n\t\t}\n\t\treturn result;\n\t}\n\t/**\n\t* Returns the most recently computed `QueryObserverResult` for the\n\t* observed query. This is a point-in-time read; to be notified of updates\n\t* as they happen, subscribe to the observer instead (its inherited\n\t* `subscribe` method).\n\t*\n\t* @example\n\t* ```ts\n\t* const result = observer.getCurrentResult()\n\t* console.log(result.status, result.data)\n\t* ```\n\t*/\n\tgetCurrentResult() {\n\t\treturn this.#currentResult;\n\t}\n\t/**\n\t* Wraps a `QueryObserverResult` in a `Proxy` that records which properties are read, via\n\t* {@link QueryObserver#trackProp} (and an optional `onPropTracked` callback). Used by framework\n\t* adapters when `notifyOnChangeProps` is not set, to implement its default \"only re-render on\n\t* properties you actually read\" behavior.\n\t*/\n\ttrackResult(result, onPropTracked) {\n\t\treturn new Proxy(result, { get: (target, key) => {\n\t\t\tthis.trackProp(key);\n\t\t\tonPropTracked?.(key);\n\t\t\treturn Reflect.get(target, key);\n\t\t} });\n\t}\n\t/**\n\t* Records that the given `QueryObserverResult` property was read, so a subsequent update only\n\t* notifies this observer if a tracked property actually changed. Normally called indirectly via\n\t* {@link QueryObserver#trackResult}'s proxy; exposed directly for adapters that track property\n\t* access themselves (e.g. through their own reactivity system) instead of via the proxy.\n\t*/\n\ttrackProp(key) {\n\t\tthis.#trackedProps.add(key);\n\t}\n\t/**\n\t* Returns the `Query` instance this observer is currently observing.\n\t*/\n\tgetCurrentQuery() {\n\t\treturn this.#currentQuery;\n\t}\n\t/**\n\t* Refetches the observed query and returns a promise that resolves with\n\t* the resulting `QueryObserverResult`.\n\t*\n\t* @example\n\t* ```ts\n\t* const result = await observer.refetch({ cancelRefetch: false })\n\t* console.log(result.data)\n\t* ```\n\t*/\n\trefetch({ ...options } = {}) {\n\t\treturn this.fetch({ ...options });\n\t}\n\t/**\n\t* Fetches a query defined by the given options without affecting this\n\t* observer's own tracked query or result, and returns a promise that\n\t* resolves with the `QueryObserverResult` for that fetch. This is useful\n\t* for prefetching data that another observer (e.g. a query about to be\n\t* navigated to) will need, ahead of time.\n\t*\n\t* @example\n\t* ```ts\n\t* const result = await observer.fetchOptimistic({\n\t* queryKey: ['posts', 2],\n\t* queryFn: () => fetchPost(2),\n\t* })\n\t* console.log(result.data)\n\t* ```\n\t*/\n\tfetchOptimistic(options) {\n\t\tconst defaultedOptions = this.#client.defaultQueryOptions(options);\n\t\tconst query = this.#client.getQueryCache().build(this.#client, defaultedOptions);\n\t\tlet unsubscribe = () => {};\n\t\tlet resolveEarly;\n\t\tconst cachePromise = new Promise((resolve) => {\n\t\t\tresolveEarly = resolve;\n\t\t\tunsubscribe = this.#client.getQueryCache().subscribe((event) => {\n\t\t\t\tif (event.type === \"updated\" && event.query.queryHash === query.queryHash && query.state.data !== void 0) {\n\t\t\t\t\tunsubscribe();\n\t\t\t\t\tresolve(this.createResult(query, defaultedOptions));\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t\treturn Promise.race([query.fetch().then(() => {\n\t\t\tconst result = this.createResult(query, defaultedOptions);\n\t\t\tresolveEarly?.(result);\n\t\t\treturn result;\n\t\t}).finally(() => {\n\t\t\tunsubscribe();\n\t\t}), cachePromise]);\n\t}\n\tfetch(fetchOptions) {\n\t\treturn this.#executeFetch({\n\t\t\t...fetchOptions,\n\t\t\tcancelRefetch: fetchOptions.cancelRefetch ?? true\n\t\t}).then(() => {\n\t\t\tthis.updateResult();\n\t\t\treturn this.#currentResult;\n\t\t});\n\t}\n\t#executeFetch(fetchOptions) {\n\t\tthis.#updateQuery();\n\t\tlet promise = this.#currentQuery.fetch(this.options, fetchOptions);\n\t\tif (!fetchOptions?.throwOnError) promise = promise.catch(noop);\n\t\treturn promise;\n\t}\n\t#shouldScheduleTimer(timeout) {\n\t\treturn !isServer() && resolveQueryValue(this.options.enabled, this.#currentQuery) !== false && isValidTimeout(timeout);\n\t}\n\t#updateStaleTimeout() {\n\t\tthis.#clearStaleTimeout();\n\t\tconst staleTime = resolveQueryValue(this.options.staleTime, this.#currentQuery);\n\t\tif (this.#currentResult.isStale || !this.#shouldScheduleTimer(staleTime)) return;\n\t\tconst timeout = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime) + 1;\n\t\tthis.#staleTimeoutId = timeoutManager.setTimeout(() => {\n\t\t\tif (!this.#currentResult.isStale) this.updateResult();\n\t\t}, timeout);\n\t}\n\t#computeRefetchInterval() {\n\t\treturn resolveQueryValue(this.options.refetchInterval, this.#currentQuery) ?? false;\n\t}\n\t#updateRefetchInterval(nextInterval) {\n\t\tthis.#clearRefetchInterval();\n\t\tthis.#currentRefetchInterval = nextInterval;\n\t\tif (this.#currentRefetchInterval === 0 || !this.#shouldScheduleTimer(this.#currentRefetchInterval)) return;\n\t\tthis.#refetchIntervalId = timeoutManager.setInterval(() => {\n\t\t\tif (this.options.refetchIntervalInBackground || focusManager.isFocused()) this.#executeFetch();\n\t\t}, this.#currentRefetchInterval);\n\t}\n\t#updateTimers() {\n\t\tthis.#updateStaleTimeout();\n\t\tthis.#updateRefetchInterval(this.#computeRefetchInterval());\n\t}\n\t#clearStaleTimeout() {\n\t\tif (this.#staleTimeoutId !== void 0) {\n\t\t\ttimeoutManager.clearTimeout(this.#staleTimeoutId);\n\t\t\tthis.#staleTimeoutId = void 0;\n\t\t}\n\t}\n\t#clearRefetchInterval() {\n\t\tif (this.#refetchIntervalId !== void 0) {\n\t\t\ttimeoutManager.clearInterval(this.#refetchIntervalId);\n\t\t\tthis.#refetchIntervalId = void 0;\n\t\t}\n\t}\n\tcreateResult(query, options) {\n\t\tconst prevQuery = this.#currentQuery;\n\t\tconst prevOptions = this.options;\n\t\tconst prevResult = this.#currentResult;\n\t\tconst prevResultState = this.#currentResultState;\n\t\tconst prevResultOptions = this.#currentResultOptions;\n\t\tconst queryInitialState = query !== prevQuery ? query.state : this.#currentQueryInitialState;\n\t\tconst { state } = query;\n\t\tlet newState = { ...state };\n\t\tlet isPlaceholderData = false;\n\t\tlet data;\n\t\tif (options._optimisticResults) {\n\t\t\tconst mounted = this.hasListeners();\n\t\t\tconst fetchOnMount = !mounted && shouldFetchOnMount(query, options);\n\t\t\tconst fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);\n\t\t\tif (fetchOnMount || fetchOptionally) newState = {\n\t\t\t\t...newState,\n\t\t\t\t...fetchState(state.data, query.options)\n\t\t\t};\n\t\t\tif (options._optimisticResults === \"isRestoring\") newState.fetchStatus = \"idle\";\n\t\t}\n\t\tlet { error, errorUpdatedAt, status } = newState;\n\t\tdata = newState.data;\n\t\tlet skipSelect = false;\n\t\tif (options.placeholderData !== void 0 && data === void 0 && status === \"pending\") {\n\t\t\tlet placeholderData;\n\t\t\tif (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) {\n\t\t\t\tplaceholderData = prevResult.data;\n\t\t\t\tskipSelect = true;\n\t\t\t} else placeholderData = typeof options.placeholderData === \"function\" ? options.placeholderData(this.#lastQueryWithDefinedData?.state.data, this.#lastQueryWithDefinedData) : options.placeholderData;\n\t\t\tif (placeholderData !== void 0) {\n\t\t\t\tstatus = \"success\";\n\t\t\t\tdata = replaceData(prevResult?.data, placeholderData, options);\n\t\t\t\tisPlaceholderData = true;\n\t\t\t}\n\t\t}\n\t\tif (options.select && data !== void 0 && !skipSelect) {\n\t\t\tif (prevResult && data === prevResultState?.data && options.select === this.#selectFn) data = this.#selectResult;\n\t\t\telse try {\n\t\t\t\tthis.#selectFn = options.select;\n\t\t\t\tdata = options.select(data);\n\t\t\t\tdata = replaceData(prevResult?.data, data, options);\n\t\t\t\tthis.#selectResult = data;\n\t\t\t\tthis.#selectError = null;\n\t\t\t} catch (selectError) {\n\t\t\t\tthis.#selectError = selectError;\n\t\t\t}\n\t\t} else if (data === void 0) this.#selectError = null;\n\t\tif (this.#selectError) {\n\t\t\terror = this.#selectError;\n\t\t\tdata = this.#selectResult;\n\t\t\terrorUpdatedAt = Date.now();\n\t\t\tstatus = \"error\";\n\t\t\tisPlaceholderData = false;\n\t\t}\n\t\tconst isFetching = newState.fetchStatus === \"fetching\";\n\t\tconst isPending = status === \"pending\";\n\t\tconst isError = status === \"error\";\n\t\tconst isLoading = isPending && isFetching;\n\t\tconst hasData = data !== void 0;\n\t\treturn {\n\t\t\tstatus,\n\t\t\tfetchStatus: newState.fetchStatus,\n\t\t\tisPending,\n\t\t\tisSuccess: status === \"success\",\n\t\t\tisError,\n\t\t\tisInitialLoading: isLoading,\n\t\t\tisLoading,\n\t\t\tdata,\n\t\t\tdataUpdatedAt: newState.dataUpdatedAt,\n\t\t\terror,\n\t\t\terrorUpdatedAt,\n\t\t\tfailureCount: newState.fetchFailureCount,\n\t\t\tfailureReason: newState.fetchFailureReason,\n\t\t\terrorUpdateCount: newState.errorUpdateCount,\n\t\t\tisFetched: query.isFetched(),\n\t\t\tisFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,\n\t\t\tisFetching,\n\t\t\tisRefetching: isFetching && !isPending,\n\t\t\tisLoadingError: isError && !hasData,\n\t\t\tisPaused: newState.fetchStatus === \"paused\",\n\t\t\tisPlaceholderData,\n\t\t\tisRefetchError: isError && hasData,\n\t\t\tisStale: isStale(query, options),\n\t\t\trefetch: this.refetch,\n\t\t\tisEnabled: resolveQueryValue(options.enabled, query) !== false\n\t\t};\n\t}\n\t/**\n\t* Recomputes and stores the current result from the current query/options, notifying listeners\n\t* if it changed. Framework adapters call this right after subscribing to make sure no query\n\t* update was missed in the gap between creating the observer and subscribing to it.\n\t*/\n\tupdateResult() {\n\t\tconst prevResult = this.#currentResult;\n\t\tconst nextResult = this.createResult(this.#currentQuery, this.options);\n\t\tthis.#currentResultState = this.#currentQuery.state;\n\t\tthis.#currentResultOptions = this.options;\n\t\tif (this.#currentResultState.data !== void 0) this.#lastQueryWithDefinedData = this.#currentQuery;\n\t\tif (shallowEqualObjects(nextResult, prevResult)) return;\n\t\tthis.#currentResult = nextResult;\n\t\tconst shouldNotifyListeners = () => {\n\t\t\tif (!prevResult) return true;\n\t\t\tconst { notifyOnChangeProps } = this.options;\n\t\t\tconst notifyOnChangePropsValue = typeof notifyOnChangeProps === \"function\" ? notifyOnChangeProps() : notifyOnChangeProps;\n\t\t\tif (notifyOnChangePropsValue === \"all\" || !notifyOnChangePropsValue && !this.#trackedProps.size) return true;\n\t\t\tconst includedProps = new Set(notifyOnChangePropsValue ?? this.#trackedProps);\n\t\t\tif (this.options.throwOnError) includedProps.add(\"error\");\n\t\t\treturn Object.keys(this.#currentResult).some((key) => {\n\t\t\t\tconst typedKey = key;\n\t\t\t\treturn this.#currentResult[typedKey] !== prevResult[typedKey] && includedProps.has(typedKey);\n\t\t\t});\n\t\t};\n\t\tconst notifyListeners = shouldNotifyListeners();\n\t\tnotifyManager.batch(() => {\n\t\t\tif (notifyListeners) this.listeners.forEach((listener) => {\n\t\t\t\tlistener(this.#currentResult);\n\t\t\t});\n\t\t\tthis.#client.getQueryCache().notify({\n\t\t\t\tquery: this.#currentQuery,\n\t\t\t\ttype: \"observerResultsUpdated\"\n\t\t\t});\n\t\t});\n\t}\n\t#updateQuery() {\n\t\tconst query = this.#client.getQueryCache().build(this.#client, this.options);\n\t\tif (query === this.#currentQuery) return;\n\t\tconst prevQuery = this.#currentQuery;\n\t\tthis.#currentQuery = query;\n\t\tthis.#currentQueryInitialState = query.state;\n\t\tif (this.hasListeners()) {\n\t\t\tprevQuery?.removeObserver(this);\n\t\t\tquery.addObserver(this);\n\t\t}\n\t}\n\t/** @internal */\n\tonQueryUpdate() {\n\t\tthis.updateResult();\n\t\tif (this.hasListeners()) this.#updateTimers();\n\t}\n};\nfunction shouldLoadOnMount(query, options) {\n\treturn resolveQueryValue(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === \"error\" && resolveQueryValue(options.retryOnMount, query) === false);\n}\nfunction shouldFetchOnMount(query, options) {\n\treturn shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);\n}\nfunction shouldFetchOn(query, options, field) {\n\tif (resolveQueryValue(options.enabled, query) !== false && resolveQueryValue(options.staleTime, query) !== \"static\") {\n\t\tconst value = resolveQueryValue(field, query);\n\t\treturn value === \"always\" || value !== false && isStale(query, options);\n\t}\n\treturn false;\n}\nfunction shouldFetchOptionally(query, prevQuery, options, prevOptions) {\n\treturn (query !== prevQuery || resolveQueryValue(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== \"error\") && isStale(query, options);\n}\nfunction isStale(query, options) {\n\treturn resolveQueryValue(options.enabled, query) !== false && query.isStaleByTime(resolveQueryValue(options.staleTime, query));\n}\n//#endregion\nexport { QueryObserver };\n\n//# sourceMappingURL=queryObserver.js.map","import { hasNextPage, hasPreviousPage } from \"./infiniteQueryBehavior.js\";\nimport { QueryObserver } from \"./queryObserver.js\";\n//#region src/infiniteQueryObserver.ts\n/**\n* An `InfiniteQueryObserver` extends `QueryObserver` to observe and switch\n* between infinite queries. It augments the base `QueryObserverResult` with\n* infinite-query-specific fields and methods, such as `hasNextPage` and\n* `fetchNextPage`, and is the primitive that framework adapters (e.g.\n* `useInfiniteQuery`) build their hooks on top of.\n*\n* @example\n* ```ts\n* const observer = new InfiniteQueryObserver(queryClient, {\n* queryKey: ['projects'],\n* queryFn: ({ pageParam }) => fetchProjects(pageParam),\n* initialPageParam: 0,\n* getNextPageParam: (lastPage) => lastPage.nextCursor,\n* })\n*\n* const unsubscribe = observer.subscribe((result) => console.log(result))\n* ```\n*/\nvar InfiniteQueryObserver = class extends QueryObserver {\n\tconstructor(client, options) {\n\t\tsuper(client, options);\n\t}\n\tbindMethods() {\n\t\tsuper.bindMethods();\n\t\tthis.fetchNextPage = this.fetchNextPage.bind(this);\n\t\tthis.fetchPreviousPage = this.fetchPreviousPage.bind(this);\n\t}\n\t/**\n\t* Updates the observer's options. Behaves the same as\n\t* `QueryObserver.setOptions`, additionally marking the options as\n\t* belonging to an infinite query before delegating to the base\n\t* implementation.\n\t*/\n\tsetOptions(options) {\n\t\toptions._type = \"infinite\";\n\t\tsuper.setOptions(options);\n\t}\n\t/**\n\t* The infinite-query counterpart of {@link QueryObserver#getOptimisticResult}, marking the\n\t* options as an infinite query before delegating to it. Called by framework adapters (e.g.\n\t* `useInfiniteQuery`) ahead of subscribing, to compute the current `InfiniteQueryObserverResult`\n\t* synchronously.\n\t*/\n\tgetOptimisticResult(options) {\n\t\toptions._type = \"infinite\";\n\t\treturn super.getOptimisticResult(options);\n\t}\n\t/**\n\t* Fetches the next page of the infinite query and returns a promise that\n\t* resolves with the resulting `InfiniteQueryObserverResult`. The page\n\t* param used for the fetch is determined by `getNextPageParam`, which\n\t* receives the current pages/page params and whose result also determines\n\t* `hasNextPage`.\n\t*\n\t* @example\n\t* ```ts\n\t* const { hasNextPage } = observer.getCurrentResult()\n\t*\n\t* if (hasNextPage) {\n\t* await observer.fetchNextPage()\n\t* }\n\t* ```\n\t*\n\t* @see {@link InfiniteQueryObserver#fetchPreviousPage}\n\t*/\n\tfetchNextPage(options) {\n\t\treturn this.fetch({\n\t\t\t...options,\n\t\t\tmeta: { fetchMore: { direction: \"forward\" } }\n\t\t});\n\t}\n\t/**\n\t* Fetches the previous page of the infinite query and returns a promise\n\t* that resolves with the resulting `InfiniteQueryObserverResult`. The page\n\t* param used for the fetch is determined by `getPreviousPageParam`, which\n\t* receives the current pages/page params and whose result also determines\n\t* `hasPreviousPage`.\n\t*\n\t* @example\n\t* ```ts\n\t* const { hasPreviousPage } = observer.getCurrentResult()\n\t*\n\t* if (hasPreviousPage) {\n\t* await observer.fetchPreviousPage()\n\t* }\n\t* ```\n\t*\n\t* @see {@link InfiniteQueryObserver#fetchNextPage}\n\t*/\n\tfetchPreviousPage(options) {\n\t\treturn this.fetch({\n\t\t\t...options,\n\t\t\tmeta: { fetchMore: { direction: \"backward\" } }\n\t\t});\n\t}\n\tcreateResult(query, options) {\n\t\tconst { state } = query;\n\t\tconst parentResult = super.createResult(query, options);\n\t\tconst { isFetching, isRefetching, isError, isRefetchError } = parentResult;\n\t\tconst fetchDirection = state.fetchMeta?.fetchMore?.direction;\n\t\tconst isFetchNextPageError = isError && fetchDirection === \"forward\";\n\t\tconst isFetchingNextPage = isFetching && fetchDirection === \"forward\";\n\t\tconst isFetchPreviousPageError = isError && fetchDirection === \"backward\";\n\t\tconst isFetchingPreviousPage = isFetching && fetchDirection === \"backward\";\n\t\treturn {\n\t\t\t...parentResult,\n\t\t\tfetchNextPage: this.fetchNextPage,\n\t\t\tfetchPreviousPage: this.fetchPreviousPage,\n\t\t\thasNextPage: hasNextPage(options, state.data),\n\t\t\thasPreviousPage: hasPreviousPage(options, state.data),\n\t\t\tisFetchNextPageError,\n\t\t\tisFetchingNextPage,\n\t\t\tisFetchPreviousPageError,\n\t\t\tisFetchingPreviousPage,\n\t\t\tisRefetchError: isRefetchError && !isFetchNextPageError && !isFetchPreviousPageError,\n\t\t\tisRefetching: isRefetching && !isFetchingNextPage && !isFetchingPreviousPage\n\t\t};\n\t}\n};\n//#endregion\nexport { InfiniteQueryObserver };\n\n//# sourceMappingURL=infiniteQueryObserver.js.map","import { notifyManager } from \"./notifyManager.js\";\nimport { createRetryer } from \"./retryer.js\";\nimport { Removable } from \"./removable.js\";\n//#region src/mutation.ts\n/**\n* Represents a single mutation attempt. A `Mutation` holds the mutation's\n* options, state (data/error/status), and the `MutationObserver`s currently\n* subscribed to it.\n*\n* Instances are created and managed internally by `MutationCache`; application\n* code typically interacts with mutations indirectly through `QueryClient` or\n* a framework hook like `useMutation`. Direct access to a `Mutation` instance\n* is possible via `mutationCache.find()`/`getAll()` for inspecting cache state.\n*\n* @example\n* ```ts\n* const mutationCache = queryClient.getMutationCache()\n*\n* const mutation = mutationCache.find({ mutationKey: ['addPost'] })\n* ```\n*/\nvar Mutation = class extends Removable {\n\t#client;\n\t#observers;\n\t#mutationCache;\n\t#retryer;\n\tconstructor(config) {\n\t\tsuper();\n\t\tthis.#client = config.client;\n\t\tthis.mutationId = config.mutationId;\n\t\tthis.#mutationCache = config.mutationCache;\n\t\tthis.#observers = [];\n\t\tthis.state = config.state || getDefaultState();\n\t\tthis.setOptions(config.options);\n\t\tthis.scheduleGc();\n\t}\n\t/** @internal */\n\tsetOptions(options) {\n\t\tthis.options = options;\n\t\tthis.updateGcTime(this.options.gcTime);\n\t}\n\t/**\n\t* The `meta` object passed in the mutation's options, if any.\n\t*/\n\tget meta() {\n\t\treturn this.options.meta;\n\t}\n\t/** @internal */\n\taddObserver(observer) {\n\t\tif (!this.#observers.includes(observer)) {\n\t\t\tthis.#observers.push(observer);\n\t\t\tthis.clearGcTimeout();\n\t\t\tthis.#mutationCache.notify({\n\t\t\t\ttype: \"observerAdded\",\n\t\t\t\tmutation: this,\n\t\t\t\tobserver\n\t\t\t});\n\t\t}\n\t}\n\t/** @internal */\n\tremoveObserver(observer) {\n\t\tthis.#observers = this.#observers.filter((x) => x !== observer);\n\t\tthis.scheduleGc();\n\t\tthis.#mutationCache.notify({\n\t\t\ttype: \"observerRemoved\",\n\t\t\tmutation: this,\n\t\t\tobserver\n\t\t});\n\t}\n\toptionalRemove() {\n\t\tif (!this.#observers.length) {\n\t\t\tif (this.state.status === \"pending\") this.scheduleGc();\n\t\t\telse this.#mutationCache.remove(this);\n\t\t}\n\t}\n\t/**\n\t* Resumes a mutation that is currently paused or was restored from a\n\t* dehydrated, still-`pending` state.\n\t*\n\t* - If this mutation has an active retryer (it paused mid-attempt, e.g. due\n\t* to the network mode or scope-based queuing), its retryer is resumed.\n\t* - Otherwise, if the mutation's status is still `pending` (e.g. it was\n\t* dehydrated while an attempt was in flight and never got a retryer in\n\t* this instance), `execute` is called again with the last known variables.\n\t* - Otherwise the mutation has already settled and this resolves immediately\n\t* without running anything again.\n\t*\n\t* @example\n\t* ```ts\n\t* // typically driven by reconnect handling, e.g. queryClient.resumePausedMutations()\n\t* const mutation = mutationCache.find({ mutationKey: ['addPost'] })\n\t* await mutation?.continue()\n\t* ```\n\t*\n\t* @see {@link Mutation#execute}\n\t*/\n\tcontinue() {\n\t\treturn this.#retryer?.continue() ?? (this.state.status === \"pending\" ? this.execute(this.state.variables) : Promise.resolve());\n\t}\n\t/**\n\t* Runs the mutation function for the given variables through a retryer, and\n\t* drives the mutation's state and lifecycle callbacks through to settlement.\n\t*\n\t* If this mutation's state is already `pending` when `execute` is called\n\t* (i.e. it was restored, still in-flight, from a dehydrated state), the\n\t* `onMutate` step is skipped and a `continue` action is dispatched to\n\t* unpause it; otherwise a `pending` action is dispatched first, then the\n\t* mutation cache's `onMutate` and the mutation's own `onMutate` option are\n\t* awaited in that order, and the resulting context is stored.\n\t*\n\t* The mutation function is then run (subject to `retry`/`retryDelay`/\n\t* `networkMode`, and to the mutation cache's scope-based serialization).\n\t* On success, the cache's `onSuccess`/`onSettled` callbacks run before the\n\t* mutation's own `onSuccess`/`onSettled` options, a `success` action is\n\t* dispatched, and the resolved data is returned. On failure, the same\n\t* cache-then-option ordering is used for `onError`/`onSettled`, but each of\n\t* those four callbacks is individually caught so that a throwing callback\n\t* cannot mask the original error; an `error` action is then dispatched and\n\t* the original error is re-thrown.\n\t*\n\t* @example\n\t* ```ts\n\t* // Called internally by `MutationObserver.mutate` and `Mutation.continue` —\n\t* // applications normally trigger mutations through those, not this method.\n\t* const data = await mutation.execute(variables)\n\t* ```\n\t*\n\t* @see {@link Mutation#continue}\n\t*/\n\tasync execute(variables) {\n\t\tconst onContinue = () => {\n\t\t\tthis.#dispatch({ type: \"continue\" });\n\t\t};\n\t\tconst mutationFnContext = {\n\t\t\tclient: this.#client,\n\t\t\tmeta: this.options.meta,\n\t\t\tmutationKey: this.options.mutationKey\n\t\t};\n\t\tconst retryer = this.#retryer = createRetryer({\n\t\t\tfn: () => {\n\t\t\t\tif (!this.options.mutationFn) return Promise.reject(/* @__PURE__ */ new Error(\"No mutationFn found\"));\n\t\t\t\treturn this.options.mutationFn(variables, mutationFnContext);\n\t\t\t},\n\t\t\tonFail: (failureCount, error) => {\n\t\t\t\tthis.#dispatch({\n\t\t\t\t\ttype: \"failed\",\n\t\t\t\t\tfailureCount,\n\t\t\t\t\terror\n\t\t\t\t});\n\t\t\t},\n\t\t\tonPause: () => {\n\t\t\t\tthis.#dispatch({ type: \"pause\" });\n\t\t\t},\n\t\t\tonContinue,\n\t\t\tretry: this.options.retry ?? 0,\n\t\t\tretryDelay: this.options.retryDelay,\n\t\t\tnetworkMode: this.options.networkMode,\n\t\t\tcanRun: () => this.#mutationCache.canRun(this)\n\t\t});\n\t\tconst restored = this.state.status === \"pending\";\n\t\tconst isPaused = !retryer.canStart();\n\t\ttry {\n\t\t\tif (restored) onContinue();\n\t\t\telse {\n\t\t\t\tthis.#dispatch({\n\t\t\t\t\ttype: \"pending\",\n\t\t\t\t\tvariables,\n\t\t\t\t\tisPaused\n\t\t\t\t});\n\t\t\t\tif (this.#mutationCache.config.onMutate) await this.#mutationCache.config.onMutate(variables, this, mutationFnContext);\n\t\t\t\tconst context = await this.options.onMutate?.(variables, mutationFnContext);\n\t\t\t\tif (context !== this.state.context) this.#dispatch({\n\t\t\t\t\ttype: \"pending\",\n\t\t\t\t\tcontext,\n\t\t\t\t\tvariables,\n\t\t\t\t\tisPaused\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst data = await retryer.start();\n\t\t\tawait this.#mutationCache.config.onSuccess?.(data, variables, this.state.context, this, mutationFnContext);\n\t\t\tawait this.options.onSuccess?.(data, variables, this.state.context, mutationFnContext);\n\t\t\tawait this.#mutationCache.config.onSettled?.(data, null, this.state.variables, this.state.context, this, mutationFnContext);\n\t\t\tawait this.options.onSettled?.(data, null, variables, this.state.context, mutationFnContext);\n\t\t\tthis.#dispatch({\n\t\t\t\ttype: \"success\",\n\t\t\t\tdata\n\t\t\t});\n\t\t\treturn data;\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\tawait this.#mutationCache.config.onError?.(error, variables, this.state.context, this, mutationFnContext);\n\t\t\t} catch (e) {\n\t\t\t\tPromise.reject(e);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait this.options.onError?.(error, variables, this.state.context, mutationFnContext);\n\t\t\t} catch (e) {\n\t\t\t\tPromise.reject(e);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait this.#mutationCache.config.onSettled?.(void 0, error, this.state.variables, this.state.context, this, mutationFnContext);\n\t\t\t} catch (e) {\n\t\t\t\tPromise.reject(e);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait this.options.onSettled?.(void 0, error, variables, this.state.context, mutationFnContext);\n\t\t\t} catch (e) {\n\t\t\t\tPromise.reject(e);\n\t\t\t}\n\t\t\tthis.#dispatch({\n\t\t\t\ttype: \"error\",\n\t\t\t\terror\n\t\t\t});\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tif (this.#retryer === retryer) this.#retryer = void 0;\n\t\t\tthis.#mutationCache.runNext(this);\n\t\t}\n\t}\n\t#dispatch(action) {\n\t\tconst reducer = (state) => {\n\t\t\tswitch (action.type) {\n\t\t\t\tcase \"failed\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tfailureCount: action.failureCount,\n\t\t\t\t\tfailureReason: action.error\n\t\t\t\t};\n\t\t\t\tcase \"pause\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tisPaused: true\n\t\t\t\t};\n\t\t\t\tcase \"continue\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tisPaused: false\n\t\t\t\t};\n\t\t\t\tcase \"pending\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tcontext: action.context,\n\t\t\t\t\tdata: void 0,\n\t\t\t\t\tfailureCount: 0,\n\t\t\t\t\tfailureReason: null,\n\t\t\t\t\terror: null,\n\t\t\t\t\tisPaused: action.isPaused,\n\t\t\t\t\tstatus: \"pending\",\n\t\t\t\t\tvariables: action.variables,\n\t\t\t\t\tsubmittedAt: Date.now()\n\t\t\t\t};\n\t\t\t\tcase \"success\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tdata: action.data,\n\t\t\t\t\tfailureCount: 0,\n\t\t\t\t\tfailureReason: null,\n\t\t\t\t\terror: null,\n\t\t\t\t\tstatus: \"success\",\n\t\t\t\t\tisPaused: false\n\t\t\t\t};\n\t\t\t\tcase \"error\": return {\n\t\t\t\t\t...state,\n\t\t\t\t\tdata: void 0,\n\t\t\t\t\terror: action.error,\n\t\t\t\t\tfailureCount: state.failureCount + 1,\n\t\t\t\t\tfailureReason: action.error,\n\t\t\t\t\tisPaused: false,\n\t\t\t\t\tstatus: \"error\"\n\t\t\t\t};\n\t\t\t}\n\t\t};\n\t\tthis.state = reducer(this.state);\n\t\tnotifyManager.batch(() => {\n\t\t\tthis.#observers.forEach((observer) => {\n\t\t\t\tobserver.onMutationUpdate(action);\n\t\t\t});\n\t\t\tthis.#mutationCache.notify({\n\t\t\t\tmutation: this,\n\t\t\t\ttype: \"updated\",\n\t\t\t\taction\n\t\t\t});\n\t\t});\n\t}\n};\nfunction getDefaultState() {\n\treturn {\n\t\tcontext: void 0,\n\t\tdata: void 0,\n\t\terror: null,\n\t\tfailureCount: 0,\n\t\tfailureReason: null,\n\t\tisPaused: false,\n\t\tstatus: \"idle\",\n\t\tvariables: void 0,\n\t\tsubmittedAt: 0\n\t};\n}\n//#endregion\nexport { Mutation, getDefaultState };\n\n//# sourceMappingURL=mutation.js.map","import { matchMutation, noop } from \"./utils.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { Mutation } from \"./mutation.js\";\n//#region src/mutationCache.ts\n/**\n* The `MutationCache` is the storage for mutations.\n*\n* Normally, you will not interact with the `MutationCache` directly and instead use a\n* `QueryClient`. You can subscribe to it (inherited from `Subscribable`) to be informed of\n* safe/known updates to the cache, such as mutations being added, removed, or updated.\n*\n* @example\n* ```ts\n* const unsubscribe = mutationCache.subscribe((event) => {\n* console.log(event.type, event.mutation)\n* })\n* ```\n*/\nvar MutationCache = class extends Subscribable {\n\t#mutations;\n\t#scopes;\n\t#mutationId;\n\tconstructor(config = {}) {\n\t\tsuper();\n\t\tthis.config = config;\n\t\tthis.#mutations = /* @__PURE__ */ new Set();\n\t\tthis.#scopes = /* @__PURE__ */ new Map();\n\t\tthis.#mutationId = 0;\n\t}\n\t/** @internal */\n\tbuild(client, options, state) {\n\t\tconst mutation = new Mutation({\n\t\t\tclient,\n\t\t\tmutationCache: this,\n\t\t\tmutationId: ++this.#mutationId,\n\t\t\toptions: client.defaultMutationOptions(options),\n\t\t\tstate\n\t\t});\n\t\tthis.add(mutation);\n\t\treturn mutation;\n\t}\n\t/** @internal */\n\tadd(mutation) {\n\t\tthis.#mutations.add(mutation);\n\t\tconst scope = scopeFor(mutation);\n\t\tif (typeof scope === \"string\") {\n\t\t\tconst scopedMutations = this.#scopes.get(scope);\n\t\t\tif (scopedMutations) scopedMutations.push(mutation);\n\t\t\telse this.#scopes.set(scope, [mutation]);\n\t\t}\n\t\tthis.notify({\n\t\t\ttype: \"added\",\n\t\t\tmutation\n\t\t});\n\t}\n\t/** @internal */\n\tremove(mutation) {\n\t\tif (this.#mutations.delete(mutation)) {\n\t\t\tconst scope = scopeFor(mutation);\n\t\t\tif (typeof scope === \"string\") {\n\t\t\t\tconst scopedMutations = this.#scopes.get(scope);\n\t\t\t\tif (scopedMutations) {\n\t\t\t\t\tif (scopedMutations.length > 1) {\n\t\t\t\t\t\tconst index = scopedMutations.indexOf(mutation);\n\t\t\t\t\t\tif (index !== -1) scopedMutations.splice(index, 1);\n\t\t\t\t\t} else if (scopedMutations[0] === mutation) this.#scopes.delete(scope);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.notify({\n\t\t\ttype: \"removed\",\n\t\t\tmutation\n\t\t});\n\t}\n\t/** @internal */\n\tcanRun(mutation) {\n\t\tconst scope = scopeFor(mutation);\n\t\tif (typeof scope === \"string\") {\n\t\t\tconst firstPendingMutation = this.#scopes.get(scope)?.find((m) => m.state.status === \"pending\");\n\t\t\treturn !firstPendingMutation || firstPendingMutation === mutation;\n\t\t} else return true;\n\t}\n\t/** @internal */\n\trunNext(mutation) {\n\t\tconst scope = scopeFor(mutation);\n\t\tif (typeof scope === \"string\") return (this.#scopes.get(scope)?.find((m) => m !== mutation && m.state.isPaused))?.continue() ?? Promise.resolve();\n\t\telse return Promise.resolve();\n\t}\n\t/**\n\t* Removes all mutations from the cache.\n\t*\n\t* @example\n\t* ```ts\n\t* const mutationCache = queryClient.getMutationCache()\n\t*\n\t* mutationCache.clear()\n\t* ```\n\t*/\n\tclear() {\n\t\tnotifyManager.batch(() => {\n\t\t\tthis.#mutations.forEach((mutation) => {\n\t\t\t\tthis.notify({\n\t\t\t\t\ttype: \"removed\",\n\t\t\t\t\tmutation\n\t\t\t\t});\n\t\t\t});\n\t\t\tthis.#mutations.clear();\n\t\t\tthis.#scopes.clear();\n\t\t});\n\t}\n\t/**\n\t* Returns all mutations within the cache.\n\t*\n\t* This is not typically needed for most applications, but can come in handy when needing more\n\t* information about a mutation in rare scenarios.\n\t*\n\t* @example\n\t* ```ts\n\t* const mutationCache = queryClient.getMutationCache()\n\t*\n\t* const mutations = mutationCache.getAll()\n\t* ```\n\t*/\n\tgetAll() {\n\t\treturn Array.from(this.#mutations);\n\t}\n\t/**\n\t* A slightly more advanced method that can be used to get an existing mutation instance from\n\t* the cache. If the mutation does not exist, `undefined` is returned.\n\t*\n\t* This is not typically needed for most applications, but can come in handy when needing more\n\t* information about a mutation in rare scenarios.\n\t*\n\t* @see {@link MutationCache#findAll}\n\t* @example\n\t* ```ts\n\t* const mutationCache = queryClient.getMutationCache()\n\t*\n\t* const mutation = mutationCache.find({ mutationKey: ['addPost'] })\n\t* ```\n\t*/\n\tfind(filters) {\n\t\tconst defaultedFilters = {\n\t\t\texact: true,\n\t\t\t...filters\n\t\t};\n\t\treturn this.getAll().find((mutation) => matchMutation(defaultedFilters, mutation));\n\t}\n\t/**\n\t* An even more advanced method that can be used to get existing mutation instances from the\n\t* cache that match the given filters. If no mutations match, an empty array is returned.\n\t*\n\t* This is not typically needed for most applications, but can come in handy when needing more\n\t* information about mutations in rare scenarios.\n\t*\n\t* @see {@link MutationCache#find}\n\t* @example\n\t* ```ts\n\t* const mutationCache = queryClient.getMutationCache()\n\t*\n\t* const mutations = mutationCache.findAll({ mutationKey: ['addPost'] })\n\t* ```\n\t*/\n\tfindAll(filters = {}) {\n\t\treturn this.getAll().filter((mutation) => matchMutation(filters, mutation));\n\t}\n\t/** @internal */\n\tnotify(event) {\n\t\tnotifyManager.batch(() => {\n\t\t\tthis.listeners.forEach((listener) => {\n\t\t\t\tlistener(event);\n\t\t\t});\n\t\t});\n\t}\n\t/** @internal */\n\tresumePausedMutations() {\n\t\tconst pausedMutations = this.getAll().filter((x) => x.state.isPaused);\n\t\treturn notifyManager.batch(() => Promise.all(pausedMutations.map((mutation) => mutation.continue().catch(noop))));\n\t}\n};\nfunction scopeFor(mutation) {\n\treturn mutation.options.scope?.id;\n}\n//#endregion\nexport { MutationCache };\n\n//# sourceMappingURL=mutationCache.js.map","import { hashKey, shallowEqualObjects } from \"./utils.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { getDefaultState } from \"./mutation.js\";\n//#region src/mutationObserver.ts\n/**\n* Observes a single mutation and derives a `MutationObserverResult` from it.\n* A framework hook like `useMutation` creates one `MutationObserver` per hook\n* call, keeps it stable across re-renders, calls `setOptions` when the options\n* passed to the hook change, subscribes to it to re-render on updates, and\n* reads `getCurrentResult()` for the value to return. Calling `mutate()`\n* builds a new underlying `Mutation` in the `MutationCache` and executes it.\n*\n* @example\n* ```ts\n* const observer = new MutationObserver(queryClient, {\n* mutationFn: (variables: { title: string }) => addPost(variables),\n* })\n* ```\n*/\nvar MutationObserver = class extends Subscribable {\n\t#client;\n\t#currentResult = void 0;\n\t#currentMutation;\n\t#mutateOptions;\n\tconstructor(client, options) {\n\t\tsuper();\n\t\tthis.#client = client;\n\t\tthis.setOptions(options);\n\t\tthis.bindMethods();\n\t\tthis.#updateResult();\n\t}\n\tbindMethods() {\n\t\tthis.mutate = this.mutate.bind(this);\n\t\tthis.reset = this.reset.bind(this);\n\t}\n\t/**\n\t* Updates the observer's options.\n\t*\n\t* If the new `mutationKey` differs from the previous one (and both were\n\t* defined), the observer is reset, detaching it from the mutation it was\n\t* observing. Otherwise, if the currently observed mutation is still\n\t* `pending`, its options are updated in place as well.\n\t*\n\t* @example\n\t* ```ts\n\t* observer.setOptions({\n\t* mutationFn: (variables: { title: string }) => addPost(variables),\n\t* onSuccess: (data) => console.log(data),\n\t* })\n\t* ```\n\t*/\n\tsetOptions(options) {\n\t\tconst prevOptions = this.options;\n\t\tthis.options = this.#client.defaultMutationOptions(options);\n\t\tif (!shallowEqualObjects(this.options, prevOptions)) this.#client.getMutationCache().notify({\n\t\t\ttype: \"observerOptionsUpdated\",\n\t\t\tmutation: this.#currentMutation,\n\t\t\tobserver: this\n\t\t});\n\t\tif (prevOptions?.mutationKey && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) this.reset();\n\t\telse if (this.#currentMutation?.state.status === \"pending\") this.#currentMutation.setOptions(this.options);\n\t}\n\tonSubscribe() {\n\t\tif (this.listeners.size === 1 && this.#currentMutation) {\n\t\t\tthis.#currentMutation.addObserver(this);\n\t\t\tthis.#updateResult();\n\t\t}\n\t}\n\tonUnsubscribe() {\n\t\tif (!this.hasListeners()) this.#currentMutation?.removeObserver(this);\n\t}\n\t/** @internal */\n\tonMutationUpdate(action) {\n\t\tthis.#updateResult();\n\t\tthis.#notify(action);\n\t}\n\t/**\n\t* Returns the observer's current result, derived from the observed\n\t* mutation's state (or the default, `idle` state if no mutation has been\n\t* built yet, e.g. before the first `mutate()` call or after `reset()`).\n\t*/\n\tgetCurrentResult() {\n\t\treturn this.#currentResult;\n\t}\n\t/**\n\t* Detaches the observer from the mutation it is currently observing (if\n\t* any) and resets the observed result back to its default, `idle` state.\n\t*\n\t* This does not cancel an in-flight mutation; the mutation itself keeps\n\t* running to completion and its own callbacks still fire, but this\n\t* observer stops reflecting its state and a subsequent `mutate()` call\n\t* will build a brand new mutation.\n\t*\n\t* @example\n\t* ```ts\n\t* observer.reset()\n\t* ```\n\t*\n\t* @see {@link MutationObserver#mutate}\n\t*/\n\treset() {\n\t\tthis.#currentMutation?.removeObserver(this);\n\t\tthis.#currentMutation = void 0;\n\t\tthis.#updateResult();\n\t\tthis.#notify();\n\t}\n\t/**\n\t* Builds a new `Mutation` in the `MutationCache` using the observer's\n\t* current options, detaches this observer from any previously observed\n\t* mutation, attaches it to the new one, and executes it with the given\n\t* variables.\n\t*\n\t* The optional per-call `options` (`onSuccess`/`onError`/`onSettled`) are\n\t* invoked once the mutation settles, in addition to any callbacks defined\n\t* on the observer's own options.\n\t*\n\t* @example\n\t* ```ts\n\t* await observer.mutate(\n\t* { title: 'New post' },\n\t* { onSuccess: (data) => console.log(data) },\n\t* )\n\t* ```\n\t*/\n\tmutate(variables, options) {\n\t\tthis.#mutateOptions = options;\n\t\tthis.#currentMutation?.removeObserver(this);\n\t\tthis.#currentMutation = this.#client.getMutationCache().build(this.#client, this.options);\n\t\tthis.#currentMutation.addObserver(this);\n\t\treturn this.#currentMutation.execute(variables);\n\t}\n\t#updateResult() {\n\t\tconst state = this.#currentMutation?.state ?? getDefaultState();\n\t\tthis.#currentResult = {\n\t\t\t...state,\n\t\t\tisPending: state.status === \"pending\",\n\t\t\tisSuccess: state.status === \"success\",\n\t\t\tisError: state.status === \"error\",\n\t\t\tisIdle: state.status === \"idle\",\n\t\t\tmutate: this.mutate,\n\t\t\treset: this.reset\n\t\t};\n\t}\n\t#notify(action) {\n\t\tnotifyManager.batch(() => {\n\t\t\tif (this.#mutateOptions && this.hasListeners()) {\n\t\t\t\tconst variables = this.#currentResult.variables;\n\t\t\t\tconst onMutateResult = this.#currentResult.context;\n\t\t\t\tconst context = {\n\t\t\t\t\tclient: this.#client,\n\t\t\t\t\tmeta: this.options.meta,\n\t\t\t\t\tmutationKey: this.options.mutationKey\n\t\t\t\t};\n\t\t\t\tif (action?.type === \"success\") {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.#mutateOptions.onSuccess?.(action.data, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.#mutateOptions.onSettled?.(action.data, null, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t} else if (action?.type === \"error\") {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.#mutateOptions.onError?.(action.error, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.#mutateOptions.onSettled?.(void 0, action.error, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.listeners.forEach((listener) => {\n\t\t\t\tlistener(this.#currentResult);\n\t\t\t});\n\t\t});\n\t}\n};\n//#endregion\nexport { MutationObserver };\n\n//# sourceMappingURL=mutationObserver.js.map","import { replaceEqualDeep, shallowEqualObjects } from \"./utils.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { QueryObserver } from \"./queryObserver.js\";\n//#region src/queriesObserver.ts\nfunction difference(array1, array2) {\n\tconst excludeSet = new Set(array2);\n\treturn array1.filter((x) => !excludeSet.has(x));\n}\n/**\n* A `QueriesObserver` watches an array of queries at once, exposing them as\n* a single array of `QueryObserverResult`s (or, when a `combine` option is\n* given, as a combined value derived from that array). It manages one\n* internal `QueryObserver` per query, and is the primitive that framework\n* adapters (e.g. `useQueries`) build their hooks on top of.\n*\n* @example\n* ```ts\n* const observer = new QueriesObserver(queryClient, [\n* { queryKey: ['post', 1], queryFn: fetchPost },\n* { queryKey: ['post', 2], queryFn: fetchPost },\n* ])\n*\n* const unsubscribe = observer.subscribe((result) => {\n* console.log(result)\n* })\n* ```\n*/\nvar QueriesObserver = class extends Subscribable {\n\t#client;\n\t#result;\n\t#queries;\n\t#options;\n\t#observers;\n\t#combinedResult;\n\t#lastCombine;\n\t#lastResult;\n\t#lastQueryHashes;\n\t#observerMatches = [];\n\tconstructor(client, queries, options) {\n\t\tsuper();\n\t\tthis.#client = client;\n\t\tthis.#options = options;\n\t\tthis.#queries = [];\n\t\tthis.#observers = [];\n\t\tthis.#result = [];\n\t\tthis.setQueries(queries);\n\t}\n\tonSubscribe() {\n\t\tif (this.listeners.size === 1) this.#observers.forEach((observer) => {\n\t\t\tobserver.subscribe((result) => {\n\t\t\t\tthis.#onUpdate(observer, result);\n\t\t\t});\n\t\t});\n\t}\n\tonUnsubscribe() {\n\t\tif (!this.listeners.size) this.destroy();\n\t}\n\t/**\n\t* Stops observing all queries: clears all listeners and destroys every\n\t* underlying `QueryObserver` this observer manages.\n\t*/\n\tdestroy() {\n\t\tthis.listeners = /* @__PURE__ */ new Set();\n\t\tthis.#observers.forEach((observer) => {\n\t\t\tobserver.destroy();\n\t\t});\n\t}\n\t/**\n\t* Replaces the set of queries being observed. Existing `QueryObserver`s\n\t* are reused for queries that match an already-observed query hash;\n\t* observers for queries that are no longer present are destroyed, and new\n\t* observers are created and subscribed to for newly added queries.\n\t*\n\t* @example\n\t* ```ts\n\t* observer.setQueries([\n\t* { queryKey: ['post', 1], queryFn: fetchPost },\n\t* { queryKey: ['post', 3], queryFn: fetchPost },\n\t* ])\n\t* ```\n\t*/\n\tsetQueries(queries, options) {\n\t\tthis.#queries = queries;\n\t\tthis.#options = options;\n\t\tif (process.env.NODE_ENV !== \"production\") {\n\t\t\tconst queryHashes = queries.map((query) => this.#client.defaultQueryOptions(query).queryHash);\n\t\t\tif (new Set(queryHashes).size !== queryHashes.length) console.warn(\"[QueriesObserver]: Duplicate Queries found. This might result in unexpected behavior.\");\n\t\t}\n\t\tnotifyManager.batch(() => {\n\t\t\tconst prevObservers = this.#observers;\n\t\t\tconst newObserverMatches = this.#findMatchingObservers(this.#queries);\n\t\t\tnewObserverMatches.forEach((match) => match.observer.setOptions(match.defaultedQueryOptions));\n\t\t\tconst newObservers = newObserverMatches.map((match) => match.observer);\n\t\t\tconst newResult = newObservers.map((observer) => observer.getCurrentResult());\n\t\t\tconst hasLengthChange = prevObservers.length !== newObservers.length;\n\t\t\tconst hasIndexChange = newObservers.some((observer, index) => observer !== prevObservers[index]);\n\t\t\tconst hasStructuralChange = hasLengthChange || hasIndexChange;\n\t\t\tconst hasResultChange = hasStructuralChange ? true : newResult.some((result, index) => {\n\t\t\t\tconst prev = this.#result[index];\n\t\t\t\treturn !prev || !shallowEqualObjects(result, prev);\n\t\t\t});\n\t\t\tif (!hasStructuralChange && !hasResultChange) return;\n\t\t\tif (hasStructuralChange) {\n\t\t\t\tthis.#observerMatches = newObserverMatches;\n\t\t\t\tthis.#observers = newObservers;\n\t\t\t}\n\t\t\tthis.#result = newResult;\n\t\t\tif (!this.hasListeners()) return;\n\t\t\tif (hasStructuralChange) {\n\t\t\t\tdifference(prevObservers, newObservers).forEach((observer) => {\n\t\t\t\t\tobserver.destroy();\n\t\t\t\t});\n\t\t\t\tdifference(newObservers, prevObservers).forEach((observer) => {\n\t\t\t\t\tobserver.subscribe((result) => {\n\t\t\t\t\t\tthis.#onUpdate(observer, result);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis.#notify();\n\t\t});\n\t}\n\t/**\n\t* Returns the most recently computed array of `QueryObserverResult`s, one\n\t* per observed query, in the same order as the queries passed to the\n\t* constructor or `setQueries`.\n\t*\n\t* @example\n\t* ```ts\n\t* const results = observer.getCurrentResult()\n\t* const data = results.map((result) => result.data)\n\t* ```\n\t*/\n\tgetCurrentResult() {\n\t\treturn this.#result;\n\t}\n\t/**\n\t* Returns the underlying `Query` instances currently being observed, in\n\t* the same order as the queries passed to the constructor or `setQueries`.\n\t*/\n\tgetQueries() {\n\t\treturn this.#observers.map((observer) => observer.getCurrentQuery());\n\t}\n\t/**\n\t* Returns the underlying `QueryObserver` instances this observer manages,\n\t* in the same order as the queries passed to the constructor or\n\t* `setQueries`.\n\t*/\n\tgetObservers() {\n\t\treturn this.#observers;\n\t}\n\t/**\n\t* The `QueriesObserver` counterpart of {@link QueryObserver#getOptimisticResult} — computes\n\t* the result for the given (already-defaulted) queries right now, synchronously. Called by\n\t* framework adapters (e.g. `useQueries`) ahead of subscribing, returning a tuple of the raw\n\t* per-query results, a function to compute the combined result from them, and a function to\n\t* wrap the results for property-access tracking.\n\t*/\n\tgetOptimisticResult(queries, combine) {\n\t\tconst matches = this.#findMatchingObservers(queries);\n\t\tconst result = matches.map((match) => match.observer.getOptimisticResult(match.defaultedQueryOptions));\n\t\tconst queryHashes = matches.map((match) => match.defaultedQueryOptions.queryHash);\n\t\treturn [\n\t\t\tresult,\n\t\t\t(r) => {\n\t\t\t\treturn this.#combineResult(r ?? result, combine, queryHashes);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\treturn this.#trackResult(result, matches);\n\t\t\t}\n\t\t];\n\t}\n\t#trackResult(result, matches) {\n\t\tconst trackedProps = /* @__PURE__ */ new Set();\n\t\treturn matches.map((match, index) => {\n\t\t\tconst observerResult = result[index];\n\t\t\treturn !match.defaultedQueryOptions.notifyOnChangeProps ? match.observer.trackResult(observerResult, (accessedProp) => {\n\t\t\t\tif (!trackedProps.has(accessedProp)) {\n\t\t\t\t\ttrackedProps.add(accessedProp);\n\t\t\t\t\tmatches.forEach((m) => {\n\t\t\t\t\t\tm.observer.trackProp(accessedProp);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}) : observerResult;\n\t\t});\n\t}\n\t#combineResult(input, combine, queryHashes) {\n\t\tif (combine) {\n\t\t\tconst lastHashes = this.#lastQueryHashes;\n\t\t\tconst queryHashesChanged = queryHashes !== void 0 && lastHashes !== void 0 && (lastHashes.length !== queryHashes.length || queryHashes.some((hash, i) => hash !== lastHashes[i]));\n\t\t\tif (this.#result !== this.#lastResult || queryHashesChanged || combine !== this.#lastCombine) {\n\t\t\t\tthis.#lastCombine = combine;\n\t\t\t\tthis.#lastResult = this.#result;\n\t\t\t\tif (queryHashes !== void 0) this.#lastQueryHashes = queryHashes;\n\t\t\t\tthis.#combinedResult = replaceEqualDeep(this.#combinedResult, combine(input));\n\t\t\t}\n\t\t\treturn this.#combinedResult;\n\t\t}\n\t\treturn input;\n\t}\n\t#shouldSkipCombine() {\n\t\treturn !this.#options?.combine || this.#observers.some((observer, index) => {\n\t\t\treturn observer.options.suspense && this.#result[index]?.data === void 0;\n\t\t});\n\t}\n\t#findMatchingObservers(queries) {\n\t\tconst prevObserversMap = /* @__PURE__ */ new Map();\n\t\tthis.#observers.forEach((observer) => {\n\t\t\tconst key = observer.options.queryHash;\n\t\t\tif (!key) return;\n\t\t\tconst previousObservers = prevObserversMap.get(key);\n\t\t\tif (previousObservers) previousObservers.push(observer);\n\t\t\telse prevObserversMap.set(key, [observer]);\n\t\t});\n\t\tconst observers = [];\n\t\tqueries.forEach((options) => {\n\t\t\tconst defaultedOptions = this.#client.defaultQueryOptions(options);\n\t\t\tconst observer = prevObserversMap.get(defaultedOptions.queryHash)?.shift() ?? new QueryObserver(this.#client, defaultedOptions);\n\t\t\tobservers.push({\n\t\t\t\tdefaultedQueryOptions: defaultedOptions,\n\t\t\t\tobserver\n\t\t\t});\n\t\t});\n\t\treturn observers;\n\t}\n\t#onUpdate(observer, result) {\n\t\tconst index = this.#observers.indexOf(observer);\n\t\tif (index !== -1) {\n\t\t\tthis.#result = this.#result.slice();\n\t\t\tthis.#result[index] = result;\n\t\t\tthis.#notify();\n\t\t}\n\t}\n\t#notify() {\n\t\tif (this.hasListeners()) {\n\t\t\tconst shouldSkipCombine = this.#shouldSkipCombine();\n\t\t\tconst previousResult = this.#combinedResult;\n\t\t\tconst newResult = shouldSkipCombine ? previousResult : this.#combineResult(this.#trackResult(this.#result, this.#observerMatches), this.#options?.combine);\n\t\t\tif (shouldSkipCombine || previousResult !== newResult) notifyManager.batch(() => {\n\t\t\t\tthis.listeners.forEach((listener) => {\n\t\t\t\t\tlistener(this.#result);\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\t}\n};\n//#endregion\nexport { QueriesObserver };\n\n//# sourceMappingURL=queriesObserver.js.map","import { hashQueryKeyByOptions, matchQuery } from \"./utils.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { Query } from \"./query.js\";\n//#region src/queryCache.ts\n/**\n* The `QueryCache` is the storage mechanism for TanStack Query. It stores all the data, meta\n* information, and state of the queries it contains.\n*\n* Normally, you will not interact with the `QueryCache` directly and instead use a `QueryClient`\n* for a specific cache. You can subscribe to it (inherited from `Subscribable`) to be informed of\n* safe/known updates to the cache, such as queries being added, removed, or updated — updates made\n* outside of the cache's own tracked mechanisms (e.g. mutating a query's state object directly) do\n* not notify subscribers.\n*\n* @example\n* ```ts\n* const unsubscribe = queryCache.subscribe((event) => {\n* console.log(event.type, event.query)\n* })\n* ```\n*/\nvar QueryCache = class extends Subscribable {\n\t#queries;\n\tconstructor(config = {}) {\n\t\tsuper();\n\t\tthis.config = config;\n\t\tthis.#queries = /* @__PURE__ */ new Map();\n\t}\n\t/**\n\t* Returns the existing `Query` instance for the given options' `queryKey`/`queryHash`, or\n\t* builds and adds a new one to the cache if none exists yet. Used by framework adapters and\n\t* plugins (e.g. broadcast/persistence) that need to get-or-create a `Query` directly, bypassing\n\t* the reactive `QueryObserver` machinery.\n\t*\n\t* @example\n\t* ```ts\n\t* const queryCache = queryClient.getQueryCache()\n\t*\n\t* const query = queryCache.build(queryClient, {\n\t* queryKey: ['posts'],\n\t* queryFn: fetchPosts,\n\t* })\n\t* ```\n\t*/\n\tbuild(client, options, state) {\n\t\tconst queryKey = options.queryKey;\n\t\tconst queryHash = options.queryHash ?? hashQueryKeyByOptions(queryKey, options);\n\t\tlet query = this.get(queryHash);\n\t\tif (!query) {\n\t\t\tquery = new Query({\n\t\t\t\tclient,\n\t\t\t\tqueryKey,\n\t\t\t\tqueryHash,\n\t\t\t\toptions: client.defaultQueryOptions(options),\n\t\t\t\tstate,\n\t\t\t\tdefaultOptions: client.getQueryDefaults(queryKey)\n\t\t\t});\n\t\t\tthis.add(query);\n\t\t}\n\t\treturn query;\n\t}\n\t/** @internal */\n\tadd(query) {\n\t\tif (!this.#queries.has(query.queryHash)) {\n\t\t\tthis.#queries.set(query.queryHash, query);\n\t\t\tthis.notify({\n\t\t\t\ttype: \"added\",\n\t\t\t\tquery\n\t\t\t});\n\t\t}\n\t}\n\t/**\n\t* Destroys the given `Query` and removes it from the cache, notifying subscribers with a\n\t* `'removed'` event. A no-op if the query is no longer the one currently stored under its hash\n\t* (e.g. it was already replaced). Used by plugins (e.g. the broadcast client) that mirror\n\t* removals across `QueryCache` instances.\n\t*\n\t* @example\n\t* ```ts\n\t* const queryCache = queryClient.getQueryCache()\n\t* const query = queryCache.find({ queryKey: ['posts'] })\n\t*\n\t* if (query) {\n\t* queryCache.remove(query)\n\t* }\n\t* ```\n\t*/\n\tremove(query) {\n\t\tif (this.#queries.get(query.queryHash) === query) {\n\t\t\tquery.destroy();\n\t\t\tthis.#queries.delete(query.queryHash);\n\t\t\tthis.notify({\n\t\t\t\ttype: \"removed\",\n\t\t\t\tquery\n\t\t\t});\n\t\t}\n\t}\n\t/**\n\t* Removes all queries from the cache.\n\t*\n\t* @example\n\t* ```ts\n\t* const queryCache = queryClient.getQueryCache()\n\t*\n\t* queryCache.clear()\n\t* ```\n\t*/\n\tclear() {\n\t\tnotifyManager.batch(() => {\n\t\t\tthis.getAll().forEach((query) => {\n\t\t\t\tthis.remove(query);\n\t\t\t});\n\t\t});\n\t}\n\t/**\n\t* Returns the `Query` instance stored under the given `queryHash`, or `undefined` if none\n\t* exists. Unlike {@link QueryCache#find}, this looks up by the already-computed hash rather\n\t* than by `QueryFilters`. Used by plugins (e.g. broadcast/hydration) that already have a hash\n\t* to look up directly.\n\t*\n\t* @example\n\t* ```ts\n\t* const queryCache = queryClient.getQueryCache()\n\t* const queryHash = hashKey(['posts'])\n\t*\n\t* const query = queryCache.get(queryHash)\n\t* ```\n\t*/\n\tget(queryHash) {\n\t\treturn this.#queries.get(queryHash);\n\t}\n\t/**\n\t* Returns all queries within the cache.\n\t*\n\t* @example\n\t* ```ts\n\t* const queryCache = queryClient.getQueryCache()\n\t*\n\t* const queries = queryCache.getAll()\n\t* ```\n\t*/\n\tgetAll() {\n\t\treturn [...this.#queries.values()];\n\t}\n\t/**\n\t* A slightly more advanced method that can be used to get an existing query instance from the\n\t* cache. This instance not only contains all the state for the query, but all of the instances,\n\t* and underlying guts of the query as well. If the query does not exist, `undefined` is\n\t* returned.\n\t*\n\t* This is not typically needed for most applications, but can come in handy when needing more\n\t* information about a query in rare scenarios (e.g. looking at `query.state.dataUpdatedAt` to\n\t* decide whether a query is fresh enough to be used as an initial value).\n\t*\n\t* @see {@link QueryCache#findAll}\n\t* @example\n\t* ```ts\n\t* const queryCache = queryClient.getQueryCache()\n\t*\n\t* const query = queryCache.find({ queryKey: ['posts'] })\n\t* ```\n\t*/\n\tfind(filters) {\n\t\tconst defaultedFilters = {\n\t\t\texact: true,\n\t\t\t...filters\n\t\t};\n\t\treturn this.getAll().find((query) => matchQuery(defaultedFilters, query));\n\t}\n\t/**\n\t* An even more advanced method that can be used to get existing query instances from the cache\n\t* that partially match a query key. If no queries match, an empty array is returned.\n\t*\n\t* This is not typically needed for most applications, but can come in handy when needing more\n\t* information about queries in rare scenarios.\n\t*\n\t* @see {@link QueryCache#find}\n\t* @example\n\t* ```ts\n\t* const queryCache = queryClient.getQueryCache()\n\t*\n\t* const queries = queryCache.findAll({ queryKey: ['posts'] })\n\t* ```\n\t*/\n\tfindAll(filters = {}) {\n\t\tconst queries = this.getAll();\n\t\treturn Object.keys(filters).length > 0 ? queries.filter((query) => matchQuery(filters, query)) : queries;\n\t}\n\t/** @internal */\n\tnotify(event) {\n\t\tnotifyManager.batch(() => {\n\t\t\tthis.listeners.forEach((listener) => {\n\t\t\t\tlistener(event);\n\t\t\t});\n\t\t});\n\t}\n\t/** @internal */\n\tonFocus() {\n\t\tnotifyManager.batch(() => {\n\t\t\tthis.getAll().forEach((query) => {\n\t\t\t\tquery.onFocus();\n\t\t\t});\n\t\t});\n\t}\n\t/** @internal */\n\tonOnline() {\n\t\tnotifyManager.batch(() => {\n\t\t\tthis.getAll().forEach((query) => {\n\t\t\t\tquery.onOnline();\n\t\t\t});\n\t\t});\n\t}\n};\n//#endregion\nexport { QueryCache };\n\n//# sourceMappingURL=queryCache.js.map","import { functionalUpdate, hashKey, hashQueryKeyByOptions, noop, partialMatchKey, resolveQueryValue, skipToken } from \"./utils.js\";\nimport { focusManager } from \"./focusManager.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { onlineManager } from \"./onlineManager.js\";\nimport { MutationCache } from \"./mutationCache.js\";\nimport { QueryCache } from \"./queryCache.js\";\n//#region src/queryClient.ts\n/**\n* `QueryClient` is used to interact with a cache of queries and mutations. It owns a\n* `QueryCache` and a `MutationCache` (creating default ones if none are passed in) and holds\n* the default options that are applied to queries and mutations created through it.\n*\n* @example\n* ```ts\n* const queryClient = new QueryClient({\n* defaultOptions: {\n* queries: {\n* staleTime: Infinity,\n* },\n* },\n* })\n*\n* await queryClient.query({ queryKey: ['posts'], queryFn: fetchPosts })\n* ```\n*/\nvar QueryClient = class {\n\t#queryCache;\n\t#mutationCache;\n\t#defaultOptions;\n\t#queryDefaults;\n\t#mutationDefaults;\n\t#mountCount;\n\t#unsubscribeFocus;\n\t#unsubscribeOnline;\n\tconstructor(config = {}) {\n\t\tthis.#queryCache = config.queryCache || new QueryCache();\n\t\tthis.#mutationCache = config.mutationCache || new MutationCache();\n\t\tthis.#defaultOptions = config.defaultOptions || {};\n\t\tthis.#queryDefaults = /* @__PURE__ */ new Map();\n\t\tthis.#mutationDefaults = /* @__PURE__ */ new Map();\n\t\tthis.#mountCount = 0;\n\t}\n\t/**\n\t* Called by a framework adapter's `QueryClientProvider`-equivalent when it mounts, to start\n\t* listening for focus/online events and resume paused mutations. Ref-counted via an internal\n\t* mount count, so nested or multiple providers sharing the same `QueryClient` don't tear down\n\t* the shared listeners until the last one unmounts.\n\t*/\n\tmount() {\n\t\tthis.#mountCount++;\n\t\tif (this.#mountCount !== 1) return;\n\t\tthis.#unsubscribeFocus = focusManager.subscribe(async (focused) => {\n\t\t\tif (focused) {\n\t\t\t\tawait this.resumePausedMutations();\n\t\t\t\tthis.#queryCache.onFocus();\n\t\t\t}\n\t\t});\n\t\tthis.#unsubscribeOnline = onlineManager.subscribe(async (online) => {\n\t\t\tif (online) {\n\t\t\t\tawait this.resumePausedMutations();\n\t\t\t\tthis.#queryCache.onOnline();\n\t\t\t}\n\t\t});\n\t}\n\t/**\n\t* The inverse of {@link QueryClient#mount} — called by a framework adapter's\n\t* `QueryClientProvider`-equivalent when it unmounts. Only tears down the focus/online\n\t* listeners once the mount count returns to `0`.\n\t*/\n\tunmount() {\n\t\tthis.#mountCount--;\n\t\tif (this.#mountCount !== 0) return;\n\t\tthis.#unsubscribeFocus?.();\n\t\tthis.#unsubscribeFocus = void 0;\n\t\tthis.#unsubscribeOnline?.();\n\t\tthis.#unsubscribeOnline = void 0;\n\t}\n\t/**\n\t* Returns the number of queries in the cache that are currently fetching, optionally\n\t* matching a set of filters. This includes background-fetching, loading new pages, and\n\t* loading more infinite query results.\n\t*\n\t* @example\n\t* ```ts\n\t* if (queryClient.isFetching()) {\n\t* console.log('At least one query is fetching!')\n\t* }\n\t* ```\n\t*/\n\tisFetching(filters) {\n\t\treturn this.#queryCache.findAll({\n\t\t\t...filters,\n\t\t\tfetchStatus: \"fetching\"\n\t\t}).length;\n\t}\n\t/**\n\t* Returns the number of mutations in the cache that are currently pending, optionally\n\t* matching a set of filters.\n\t*\n\t* @example\n\t* ```ts\n\t* if (queryClient.isMutating()) {\n\t* console.log('At least one mutation is pending!')\n\t* }\n\t* ```\n\t*/\n\tisMutating(filters) {\n\t\treturn this.#mutationCache.findAll({\n\t\t\t...filters,\n\t\t\tstatus: \"pending\"\n\t\t}).length;\n\t}\n\t/**\n\t* Imperative (non-reactive) way to retrieve data for a QueryKey.\n\t* Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.\n\t*\n\t* Hint: Do not use this function inside a component, because it won't receive updates.\n\t* Use `useQuery` to create a `QueryObserver` that subscribes to changes.\n\t*\n\t* @returns The cached data for the query, or `undefined` if no query with this key has been observed yet.\n\t* @see {@link QueryClient#getQueriesData}\n\t*/\n\tgetQueryData(queryKey) {\n\t\tconst options = this.defaultQueryOptions({ queryKey });\n\t\treturn this.#queryCache.get(options.queryHash)?.state.data;\n\t}\n\t/**\n\t* @deprecated Use queryClient.query({ ...options, staleTime: 'static' }) instead. This method will be removed in the next major version.\n\t*/\n\tensureQueryData(options) {\n\t\tconst defaultedOptions = this.defaultQueryOptions(options);\n\t\tconst query = this.#queryCache.build(this, defaultedOptions);\n\t\tconst cachedData = query.state.data;\n\t\tif (cachedData === void 0) return this.fetchQuery(options);\n\t\tif (options.revalidateIfStale && query.isStaleByTime(resolveQueryValue(defaultedOptions.staleTime, query))) this.prefetchQuery(defaultedOptions);\n\t\treturn Promise.resolve(cachedData);\n\t}\n\t/**\n\t* Imperative (non-reactive) way to retrieve the cached data of multiple queries at once.\n\t* Only queries matching the given filters are returned; if none match, an empty array is\n\t* returned.\n\t*\n\t* Because the matched queries can hold data of different shapes (e.g. a broad filter can match\n\t* queries with unrelated data types), the `TQueryFnData` generic defaults to `unknown` rather\n\t* than being inferred. Passing a more specific type is a convenience for call sites that know\n\t* every matched query holds the same shape — it is not checked against the actual cache\n\t* contents.\n\t*\n\t* @returns An array of query key and data pairs. The data is `undefined` for a query with no cached data.\n\t* @see {@link QueryClient#getQueryData}\n\t* @example\n\t* ```ts\n\t* const data = queryClient.getQueriesData({ queryKey: ['posts'] })\n\t* ```\n\t*/\n\tgetQueriesData(filters) {\n\t\treturn this.#queryCache.findAll(filters).map(({ queryKey, state }) => {\n\t\t\treturn [queryKey, state.data];\n\t\t});\n\t}\n\t/**\n\t* Synchronous way to immediately update a query's cached data. If the updater (or the value\n\t* passed) resolves to `undefined`, the cache is left untouched and no query is created;\n\t* otherwise, if the query does not exist yet, it will be created. To update multiple queries\n\t* at once by partially matching query keys, use {@link QueryClient#setQueriesData} instead.\n\t*\n\t* Updates must be performed immutably: do not mutate `oldData`, or data previously retrieved\n\t* via {@link QueryClient#getQueryData}, in place.\n\t*\n\t* @param queryKey - The query key to set data for.\n\t* @param updater - Either the new data, or a function that receives the current data (which\n\t* may be `undefined`) and returns the new data.\n\t* @param options - Set `updatedAt` to override the timestamp the written data is recorded with.\n\t* @returns The data that was written, or `undefined` if the updater returned `undefined` — in that case\n\t* the write is skipped and the cache is left unchanged.\n\t*\n\t* @example\n\t* ```ts\n\t* queryClient.setQueryData(['posts'], newPosts)\n\t*\n\t* // Or, using an updater function that receives the current data:\n\t* queryClient.setQueryData(['posts'], (oldPosts) => [...oldPosts, newPost])\n\t* ```\n\t*/\n\tsetQueryData(queryKey, updater, options) {\n\t\tconst defaultedOptions = this.defaultQueryOptions({ queryKey });\n\t\tconst prevData = this.#queryCache.get(defaultedOptions.queryHash)?.state.data;\n\t\tconst data = functionalUpdate(updater, prevData);\n\t\tif (data === void 0) return;\n\t\treturn this.#queryCache.build(this, defaultedOptions).setData(data, {\n\t\t\t...options,\n\t\t\tmanual: true\n\t\t});\n\t}\n\t/**\n\t* Synchronous way to immediately update the cached data of multiple queries at once, using\n\t* filters or partial query key matching. Only queries that already exist and match the given\n\t* filters are updated; no new cache entries are created. Internally this calls\n\t* {@link QueryClient#setQueryData} for each matching query.\n\t*\n\t* @returns One `[queryKey, data]` tuple per matched query, in the same shape and with the same\n\t* `undefined` case as {@link QueryClient#setQueryData}.\n\t* @example\n\t* ```ts\n\t* queryClient.setQueriesData({ queryKey: ['posts'] }, (oldPosts) =>\n\t* oldPosts ? oldPosts.filter((post) => post.id !== deletedId) : oldPosts,\n\t* )\n\t* ```\n\t*/\n\tsetQueriesData(filters, updater, options) {\n\t\treturn notifyManager.batch(() => this.#queryCache.findAll(filters).map(({ queryKey }) => [queryKey, this.setQueryData(queryKey, updater, options)]));\n\t}\n\t/**\n\t* Imperative (non-reactive) way to retrieve an existing query's state. If the query does not\n\t* exist, `undefined` is returned.\n\t*\n\t* @example\n\t* ```ts\n\t* const state = queryClient.getQueryState(['posts'])\n\t* console.log(state?.dataUpdatedAt)\n\t* ```\n\t*/\n\tgetQueryState(queryKey) {\n\t\tconst options = this.defaultQueryOptions({ queryKey });\n\t\treturn this.#queryCache.get(options.queryHash)?.state;\n\t}\n\t/**\n\t* Removes queries from the cache that match the given filters. Unlike\n\t* {@link QueryClient#invalidateQueries} or {@link QueryClient#refetchQueries}, this removes\n\t* matching queries from the cache instead of refetching them. Without filters, every query in\n\t* the cache is removed.\n\t*\n\t* @example\n\t* ```ts\n\t* queryClient.removeQueries({ queryKey: ['posts'], exact: true })\n\t* ```\n\t*/\n\tremoveQueries(filters) {\n\t\tconst queryCache = this.#queryCache;\n\t\tnotifyManager.batch(() => {\n\t\t\tqueryCache.findAll(filters).forEach((query) => {\n\t\t\t\tqueryCache.remove(query);\n\t\t\t});\n\t\t});\n\t}\n\t/**\n\t* Resets queries matching the given filters back to their initial state (e.g. any\n\t* `initialData`), notifying subscribers rather than removing them. Active queries among the\n\t* matched set are then refetched, and the returned promise resolves once that refetch settles.\n\t*\n\t* @example\n\t* ```ts\n\t* await queryClient.resetQueries({ queryKey: ['posts'], exact: true })\n\t* ```\n\t*/\n\tresetQueries(filters, options) {\n\t\tconst queryCache = this.#queryCache;\n\t\treturn notifyManager.batch(() => {\n\t\t\tconst matched = queryCache.findAll(filters);\n\t\t\tconst queriesToRefetch = new Set(matched);\n\t\t\tmatched.forEach((query) => {\n\t\t\t\tquery.reset();\n\t\t\t});\n\t\t\treturn this.refetchQueries({\n\t\t\t\ttype: \"active\",\n\t\t\t\tpredicate: (query) => queriesToRefetch.has(query)\n\t\t\t}, options);\n\t\t});\n\t}\n\t/**\n\t* Cancels outgoing fetches for queries matching the given filters. Most useful when performing\n\t* optimistic updates, since any outgoing refetch that resolves afterwards would otherwise\n\t* overwrite the optimistic update. By default (`revert: true`), a cancelled query's data is\n\t* reverted to its state before the outgoing fetch started.\n\t*\n\t* The returned promise never rejects, even if individual cancellations fail.\n\t*\n\t* @example\n\t* ```ts\n\t* await queryClient.cancelQueries({ queryKey: ['posts'], exact: true })\n\t* ```\n\t*/\n\tcancelQueries(filters, cancelOptions = {}) {\n\t\tconst defaultedCancelOptions = {\n\t\t\trevert: true,\n\t\t\t...cancelOptions\n\t\t};\n\t\tconst promises = notifyManager.batch(() => this.#queryCache.findAll(filters).map((query) => query.cancel(defaultedCancelOptions)));\n\t\treturn Promise.all(promises).then(noop).catch(noop);\n\t}\n\t/**\n\t* Marks queries matching the given filters as invalidated. Unlike\n\t* {@link QueryClient#removeQueries}, invalidated queries stay in the cache.\n\t*\n\t* Unless `filters.refetchType` is `'none'`, matching queries are then refetched via\n\t* {@link QueryClient#refetchQueries}, using `filters.refetchType` if set, otherwise\n\t* `filters.type`, otherwise `'active'`.\n\t*\n\t* @example\n\t* ```ts\n\t* await queryClient.invalidateQueries({ queryKey: ['posts'], refetchType: 'active' })\n\t* ```\n\t*/\n\tinvalidateQueries(filters, options = {}) {\n\t\treturn notifyManager.batch(() => {\n\t\t\tthis.#queryCache.findAll(filters).forEach((query) => {\n\t\t\t\tquery.invalidate();\n\t\t\t});\n\t\t\tif (filters?.refetchType === \"none\") return Promise.resolve();\n\t\t\treturn this.refetchQueries({\n\t\t\t\t...filters,\n\t\t\t\ttype: filters?.refetchType ?? filters?.type ?? \"active\"\n\t\t\t}, options);\n\t\t});\n\t}\n\t/**\n\t* Refetches queries matching the given filters, regardless of whether they are stale. Without\n\t* filters, every query in the cache is refetched. Queries that are disabled, or static (only\n\t* have observers with a static `staleTime`), are never refetched.\n\t*\n\t* By default (`cancelRefetch: true`), a currently running fetch is cancelled before the new\n\t* one starts. The returned promise resolves once all matching queries have settled; it does\n\t* not reject on individual query failures unless `throwOnError` is set.\n\t*\n\t* @example\n\t* ```ts\n\t* // refetch all active queries partially matching a query key:\n\t* await queryClient.refetchQueries({ queryKey: ['posts'], type: 'active' })\n\t* ```\n\t*/\n\trefetchQueries(filters, options = {}) {\n\t\tconst fetchOptions = {\n\t\t\t...options,\n\t\t\tcancelRefetch: options.cancelRefetch ?? true\n\t\t};\n\t\tconst promises = notifyManager.batch(() => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled() && !query.isStatic()).map((query) => {\n\t\t\tlet promise = query.fetch(void 0, fetchOptions);\n\t\t\tif (!fetchOptions.throwOnError) promise = promise.catch(noop);\n\t\t\treturn query.state.fetchStatus === \"paused\" ? Promise.resolve() : promise;\n\t\t}));\n\t\treturn Promise.all(promises).then(noop);\n\t}\n\t/**\n\t* Asynchronous method to fetch and cache a query, resolving with the data or throwing with\n\t* the error.\n\t*\n\t* If the query already exists in the cache and its data is not stale (per the given\n\t* `staleTime`), the cached data is returned without fetching. Otherwise, the query is fetched\n\t* and the promise resolves once the fetch settles. If a `select` function is provided, it is\n\t* applied to the data in both cases (cached or freshly fetched) before it is returned.\n\t*\n\t* Unlike a reactive observer, retries are disabled by default here (`retry: false`) unless\n\t* explicitly configured, since there is no component to catch a thrown error and retry through\n\t* re-render.\n\t*\n\t* The accepted options are `QueryObserverOptions` minus the fields that only make sense for a\n\t* reactive observer — `enabled`, `refetchInterval`, `refetchIntervalInBackground`,\n\t* `refetchOnWindowFocus`, `refetchOnReconnect`, `refetchOnMount`, `retryOnMount`,\n\t* `notifyOnChangeProps`, `throwOnError`, `suspense`, and `placeholderData` are not part of this\n\t* method's options.\n\t*\n\t* This method replaces the deprecated `fetchQuery`, and — combined with\n\t* `{ staleTime: 'static' }` — the deprecated `ensureQueryData`.\n\t*\n\t* @example\n\t* ```ts\n\t* try {\n\t* const data = await queryClient.query({ queryKey, queryFn, staleTime: 10000 })\n\t* } catch (error) {\n\t* console.log(error)\n\t* }\n\t* ```\n\t*/\n\tasync query(options) {\n\t\tconst defaultedOptions = this.defaultQueryOptions(options);\n\t\tif (defaultedOptions.retry === void 0) defaultedOptions.retry = false;\n\t\tconst query = this.#queryCache.build(this, defaultedOptions);\n\t\tconst queryData = query.isStaleByTime(resolveQueryValue(defaultedOptions.staleTime, query)) ? await query.fetch(defaultedOptions) : query.state.data;\n\t\tconst select = defaultedOptions.select;\n\t\tif (select) return select(queryData);\n\t\treturn queryData;\n\t}\n\t/**\n\t* @deprecated Use queryClient.query(options) instead. This method will be removed in the next major version.\n\t*/\n\tfetchQuery(options) {\n\t\tconst defaultedOptions = this.defaultQueryOptions(options);\n\t\tif (defaultedOptions.retry === void 0) defaultedOptions.retry = false;\n\t\tconst query = this.#queryCache.build(this, defaultedOptions);\n\t\treturn query.isStaleByTime(resolveQueryValue(defaultedOptions.staleTime, query)) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);\n\t}\n\t/**\n\t* @deprecated Use queryClient.query(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.\n\t*/\n\tprefetchQuery(options) {\n\t\treturn this.fetchQuery(options).then(noop).catch(noop);\n\t}\n\t/**\n\t* Asynchronous method to fetch and cache an infinite query, resolving with an\n\t* {@link InfiniteData} object or throwing with the error.\n\t*\n\t* Behaves like {@link QueryClient#query}, accepting the same options (minus\n\t* `initialPageParam`), plus the required `initialPageParam`, and an optional `pages` /\n\t* `getNextPageParam` pair used to refetch a fixed number of pages from the start.\n\t*\n\t* This method replaces the deprecated `fetchInfiniteQuery`, and — combined with\n\t* `{ staleTime: 'static' }` — the deprecated `ensureInfiniteQueryData`.\n\t*\n\t* @example\n\t* ```ts\n\t* try {\n\t* const data = await queryClient.infiniteQuery({ queryKey, queryFn, initialPageParam: 0 })\n\t* console.log(data.pages)\n\t* } catch (error) {\n\t* console.log(error)\n\t* }\n\t* ```\n\t*/\n\tinfiniteQuery(options) {\n\t\toptions._type = \"infinite\";\n\t\treturn this.query(options);\n\t}\n\t/**\n\t* @deprecated Use queryClient.infiniteQuery(options) instead. This method will be removed in the next major version.\n\t*/\n\tfetchInfiniteQuery(options) {\n\t\toptions._type = \"infinite\";\n\t\treturn this.fetchQuery(options);\n\t}\n\t/**\n\t* @deprecated Use queryClient.infiniteQuery(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.\n\t*/\n\tprefetchInfiniteQuery(options) {\n\t\treturn this.fetchInfiniteQuery(options).then(noop).catch(noop);\n\t}\n\t/**\n\t* @deprecated Use queryClient.infiniteQuery({ ...options, staleTime: 'static' }) instead. This method will be removed in the next major version.\n\t*/\n\tensureInfiniteQueryData(options) {\n\t\toptions._type = \"infinite\";\n\t\treturn this.ensureQueryData(options);\n\t}\n\t/**\n\t* Resumes mutations that were paused because there was no network connection. Does nothing\n\t* (resolving immediately) if the client is currently offline.\n\t*\n\t* @example\n\t* ```ts\n\t* import { QueryClient } from '@tanstack/query-core'\n\t*\n\t* const queryClient = new QueryClient()\n\t* await queryClient.resumePausedMutations()\n\t* ```\n\t*/\n\tresumePausedMutations() {\n\t\tif (onlineManager.isOnline()) return this.#mutationCache.resumePausedMutations();\n\t\treturn Promise.resolve();\n\t}\n\t/**\n\t* Returns the query cache this client is connected to.\n\t*\n\t* @example\n\t* ```ts\n\t* import { QueryClient } from '@tanstack/query-core'\n\t*\n\t* const queryClient = new QueryClient()\n\t* const queryCache = queryClient.getQueryCache()\n\t* const queries = queryCache.findAll({ queryKey: ['posts'] })\n\t* ```\n\t*/\n\tgetQueryCache() {\n\t\treturn this.#queryCache;\n\t}\n\t/**\n\t* Returns the mutation cache this client is connected to.\n\t*\n\t* @example\n\t* ```ts\n\t* import { QueryClient } from '@tanstack/query-core'\n\t*\n\t* const queryClient = new QueryClient()\n\t* const mutationCache = queryClient.getMutationCache()\n\t* const mutations = mutationCache.findAll({ status: 'pending' })\n\t* ```\n\t*/\n\tgetMutationCache() {\n\t\treturn this.#mutationCache;\n\t}\n\t/**\n\t* Returns the default options that were set when creating the client, or via\n\t* {@link QueryClient#setDefaultOptions}.\n\t*\n\t* @example\n\t* ```ts\n\t* import { QueryClient } from '@tanstack/query-core'\n\t*\n\t* const queryClient = new QueryClient()\n\t* const defaultOptions = queryClient.getDefaultOptions()\n\t* ```\n\t*/\n\tgetDefaultOptions() {\n\t\treturn this.#defaultOptions;\n\t}\n\t/**\n\t* Dynamically sets the default options for this client, overwriting any previously defined\n\t* default options.\n\t*\n\t* @see {@link QueryClient#getDefaultOptions}\n\t* @example\n\t* ```ts\n\t* import { QueryClient } from '@tanstack/query-core'\n\t*\n\t* const queryClient = new QueryClient()\n\t* queryClient.setDefaultOptions({\n\t* queries: {\n\t* staleTime: Infinity,\n\t* },\n\t* })\n\t* ```\n\t*/\n\tsetDefaultOptions(options) {\n\t\tthis.#defaultOptions = options;\n\t}\n\t/**\n\t* Sets default options for queries whose query key partially matches the given `queryKey`.\n\t*\n\t* If several registered query defaults match a given query key, they are merged together in\n\t* registration order by {@link QueryClient#getQueryDefaults}, so register defaults from the\n\t* most generic key to the least generic one — more specific defaults should be registered\n\t* after more generic ones so they take precedence.\n\t*\n\t* @example\n\t* ```ts\n\t* queryClient.setQueryDefaults(['posts'], { queryFn: fetchPosts })\n\t*\n\t* await queryClient.query({ queryKey: ['posts'] })\n\t* ```\n\t*/\n\tsetQueryDefaults(queryKey, options) {\n\t\tthis.#queryDefaults.set(hashKey(queryKey), {\n\t\t\tqueryKey,\n\t\t\tdefaultOptions: options\n\t\t});\n\t}\n\t/**\n\t* Returns the default options registered for queries whose query key partially matches the\n\t* given `queryKey`, via {@link QueryClient#setQueryDefaults}. If multiple registered defaults\n\t* match, they are merged together in registration order.\n\t*\n\t* @example\n\t* ```ts\n\t* const defaultOptions = queryClient.getQueryDefaults(['posts'])\n\t* ```\n\t*/\n\tgetQueryDefaults(queryKey) {\n\t\tconst defaults = [...this.#queryDefaults.values()];\n\t\tconst result = {};\n\t\tdefaults.forEach((queryDefault) => {\n\t\t\tif (partialMatchKey(queryKey, queryDefault.queryKey)) Object.assign(result, queryDefault.defaultOptions);\n\t\t});\n\t\treturn result;\n\t}\n\t/**\n\t* Sets default options for mutations whose mutation key partially matches the given\n\t* `mutationKey`. As with {@link QueryClient#setQueryDefaults}, the order of registration\n\t* matters when several registered defaults match the same mutation key.\n\t*\n\t* @see {@link QueryClient#getMutationDefaults}\n\t* @example\n\t* ```ts\n\t* queryClient.setMutationDefaults(['addPost'], { mutationFn: addPost })\n\t* ```\n\t*/\n\tsetMutationDefaults(mutationKey, options) {\n\t\tthis.#mutationDefaults.set(hashKey(mutationKey), {\n\t\t\tmutationKey,\n\t\t\tdefaultOptions: options\n\t\t});\n\t}\n\t/**\n\t* Returns the default options registered for mutations whose mutation key partially matches\n\t* the given `mutationKey`, via {@link QueryClient#setMutationDefaults}. If multiple registered\n\t* defaults match, they are merged together in registration order.\n\t*\n\t* @example\n\t* ```ts\n\t* const defaultOptions = queryClient.getMutationDefaults(['addPost'])\n\t* ```\n\t*/\n\tgetMutationDefaults(mutationKey) {\n\t\tconst defaults = [...this.#mutationDefaults.values()];\n\t\tconst result = {};\n\t\tdefaults.forEach((queryDefault) => {\n\t\t\tif (partialMatchKey(mutationKey, queryDefault.mutationKey)) Object.assign(result, queryDefault.defaultOptions);\n\t\t});\n\t\treturn result;\n\t}\n\t/**\n\t* Called by framework adapters (e.g. inside `useQuery`) to resolve the options passed by the\n\t* caller into their final, defaulted form: merging `queryClient.setQueryDefaults` for the\n\t* given `queryKey`, then the client's own `defaultOptions.queries`, then the caller's options\n\t* on top. A no-op if the options are already defaulted (`_defaulted: true`).\n\t*/\n\tdefaultQueryOptions(options) {\n\t\tif (options._defaulted) return options;\n\t\tconst defaultedOptions = {\n\t\t\t...this.#defaultOptions.queries,\n\t\t\t...this.getQueryDefaults(options.queryKey),\n\t\t\t...options,\n\t\t\t_defaulted: true\n\t\t};\n\t\tif (!defaultedOptions.queryHash) defaultedOptions.queryHash = hashQueryKeyByOptions(defaultedOptions.queryKey, defaultedOptions);\n\t\tif (defaultedOptions.refetchOnReconnect === void 0) defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== \"always\";\n\t\tif (defaultedOptions.throwOnError === void 0) defaultedOptions.throwOnError = !!defaultedOptions.suspense;\n\t\tif (!defaultedOptions.networkMode && defaultedOptions.persister) defaultedOptions.networkMode = \"offlineFirst\";\n\t\tif (defaultedOptions.queryFn === skipToken) defaultedOptions.enabled = false;\n\t\treturn defaultedOptions;\n\t}\n\t/**\n\t* The mutation counterpart of {@link QueryClient#defaultQueryOptions}. Called by framework\n\t* adapters (e.g. inside `useMutation`) to merge `queryClient.setMutationDefaults` for the\n\t* given `mutationKey`, then the client's `defaultOptions.mutations`, then the caller's options\n\t* on top. A no-op if the options are already defaulted (`_defaulted: true`).\n\t*/\n\tdefaultMutationOptions(options) {\n\t\tif (options?._defaulted) return options;\n\t\treturn {\n\t\t\t...this.#defaultOptions.mutations,\n\t\t\t...options?.mutationKey && this.getMutationDefaults(options.mutationKey),\n\t\t\t...options,\n\t\t\t_defaulted: true\n\t\t};\n\t}\n\t/**\n\t* Clears both the query cache and the mutation cache this client is connected to.\n\t*\n\t* @example\n\t* ```ts\n\t* import { QueryClient } from '@tanstack/query-core'\n\t*\n\t* const queryClient = new QueryClient()\n\t* queryClient.clear()\n\t* ```\n\t*/\n\tclear() {\n\t\tthis.#queryCache.clear();\n\t\tthis.#mutationCache.clear();\n\t}\n};\n//#endregion\nexport { QueryClient };\n\n//# sourceMappingURL=queryClient.js.map","\"use client\";\nimport * as React from \"react\";\n//#region src/IsRestoringProvider.ts\nconst IsRestoringContext = React.createContext(false);\n/**\n* If you are using `PersistQueryClientProvider`, you can also use the `useIsRestoring` hook alongside it to\n* check if a restore is currently in progress. `useQuery` and friends also check this internally to avoid\n* race conditions between the restore and mounting queries.\n*\n* @returns `true` while a persisted client is being restored, `false` otherwise.\n*/\nconst useIsRestoring = () => React.useContext(IsRestoringContext);\n/**\n* The Provider that `PersistQueryClientProvider` uses to signal whether a persisted client is currently\n* being restored, read by `useIsRestoring`.\n*/\nconst IsRestoringProvider = IsRestoringContext.Provider;\n//#endregion\nexport { IsRestoringProvider, useIsRestoring };\n\n//# sourceMappingURL=IsRestoringProvider.js.map","\"use client\";\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\n//#region src/QueryErrorResetBoundary.tsx\n/**\n* Resets any query errors within the boundary, so queries know they can try again.\n*/\nfunction createValue() {\n\tlet isReset = false;\n\treturn {\n\t\t/**\n\t\t* Clears the reset state, so queries know not to try again until the boundary is reset again.\n\t\t*/\n\t\tclearReset: () => {\n\t\t\tisReset = false;\n\t\t},\n\t\t/**\n\t\t* Resets any query errors within the boundary, so queries know they can try again.\n\t\t*/\n\t\treset: () => {\n\t\t\tisReset = true;\n\t\t},\n\t\t/**\n\t\t* Returns whether the boundary has been reset and not yet cleared.\n\t\t*/\n\t\tisReset: () => {\n\t\t\treturn isReset;\n\t\t}\n\t};\n}\nconst QueryErrorResetBoundaryContext = React.createContext(createValue());\n/**\n* This hook will reset any query errors within the closest `QueryErrorResetBoundary`. If there is no boundary\n* defined it will reset them globally.\n*\n* @returns The boundary's {@link QueryErrorResetBoundaryValue}.\n*\n* @example\n* ```tsx\n* import { ErrorBoundary } from 'react-error-boundary'\n* import { useQueryErrorResetBoundary } from '@tanstack/react-query'\n*\n* function App({ children }: { children: React.ReactNode }) {\n* const { reset } = useQueryErrorResetBoundary()\n*\n* return (\n* <ErrorBoundary\n* onReset={reset}\n* fallbackRender={({ resetErrorBoundary }) => (\n* <div>\n* There was an error!\n* <button onClick={() => resetErrorBoundary()}>Try again</button>\n* </div>\n* )}\n* >\n* {children}\n* </ErrorBoundary>\n* )\n* }\n* ```\n*/\nconst useQueryErrorResetBoundary = () => React.useContext(QueryErrorResetBoundaryContext);\n/**\n* When using `suspense` or `throwOnError` in your queries, you need a way to let queries know that you want to\n* try again when re-rendering after some error occurred. With the `QueryErrorResetBoundary` component you can\n* reset any query errors within the boundaries of the component.\n*\n* @returns The `children`, rendered as-is, or called with the boundary's {@link QueryErrorResetBoundaryValue}\n* if `children` is a function.\n*\n* @example\n* ```tsx\n* import { ErrorBoundary } from 'react-error-boundary'\n* import { QueryErrorResetBoundary } from '@tanstack/react-query'\n*\n* function App() {\n* return (\n* <QueryErrorResetBoundary>\n* {({ reset }) => (\n* <ErrorBoundary\n* onReset={reset}\n* fallbackRender={({ resetErrorBoundary }) => (\n* <div>\n* There was an error!\n* <button onClick={() => resetErrorBoundary()}>Try again</button>\n* </div>\n* )}\n* >\n* <Page />\n* </ErrorBoundary>\n* )}\n* </QueryErrorResetBoundary>\n* )\n* }\n* ```\n*/\nconst QueryErrorResetBoundary = ({ children }) => {\n\tconst [value] = React.useState(() => createValue());\n\treturn /* @__PURE__ */ jsx(QueryErrorResetBoundaryContext.Provider, {\n\t\tvalue,\n\t\tchildren: typeof children === \"function\" ? children(value) : children\n\t});\n};\n//#endregion\nexport { QueryErrorResetBoundary, useQueryErrorResetBoundary };\n\n//# sourceMappingURL=QueryErrorResetBoundary.js.map","\"use client\";\nimport * as React from \"react\";\nimport { shouldThrowError } from \"@tanstack/query-core\";\n//#region src/errorBoundaryUtils.ts\nconst ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => {\n\tconst throwOnError = query?.state.error && typeof options.throwOnError === \"function\" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError;\n\tif (options.suspense || throwOnError) {\n\t\tif (!errorResetBoundary.isReset()) options.retryOnMount = false;\n\t}\n};\nconst useClearResetErrorBoundary = (errorResetBoundary) => {\n\tReact.useEffect(() => {\n\t\terrorResetBoundary.clearReset();\n\t}, [errorResetBoundary]);\n};\nconst getHasError = ({ result, errorResetBoundary, throwOnError, query, suspense }) => {\n\treturn result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query]));\n};\n//#endregion\nexport { ensurePreventErrorBoundaryRetry, getHasError, useClearResetErrorBoundary };\n\n//# sourceMappingURL=errorBoundaryUtils.js.map","//#region src/suspense.ts\nconst defaultThrowOnError = (_error, query) => query.state.data === void 0;\nconst ensureSuspenseTimers = (defaultedOptions) => {\n\tif (defaultedOptions.suspense) {\n\t\tconst MIN_SUSPENSE_TIME_MS = 1e3;\n\t\tconst clamp = (value) => value === \"static\" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS);\n\t\tconst originalStaleTime = defaultedOptions.staleTime;\n\t\tdefaultedOptions.staleTime = typeof originalStaleTime === \"function\" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime);\n\t\tif (typeof defaultedOptions.gcTime === \"number\") defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, MIN_SUSPENSE_TIME_MS);\n\t}\n};\nconst shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending;\nconst fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {\n\terrorResetBoundary.clearReset();\n});\n//#endregion\nexport { defaultThrowOnError, ensureSuspenseTimers, fetchOptimistic, shouldSuspend };\n\n//# sourceMappingURL=suspense.js.map","\"use client\";\nimport { useQueryClient } from \"./QueryClientProvider.js\";\nimport { useIsRestoring } from \"./IsRestoringProvider.js\";\nimport { useQueryErrorResetBoundary } from \"./QueryErrorResetBoundary.js\";\nimport { ensurePreventErrorBoundaryRetry, getHasError, useClearResetErrorBoundary } from \"./errorBoundaryUtils.js\";\nimport { ensureSuspenseTimers, fetchOptimistic, shouldSuspend } from \"./suspense.js\";\nimport * as React from \"react\";\nimport { QueriesObserver, QueryObserver, noop, notifyManager } from \"@tanstack/query-core\";\n//#region src/useQueries.ts\n/**\n* The `useQueries` hook can be used to fetch a variable number of queries.\n*\n* The `queries` key accepts an array with query option objects mostly identical to `useQuery` — the top-level\n* `subscribed` option isn't accepted per query (see `placeholderData` below for another difference). A custom\n* `QueryClient` is supplied once, as `useQueries`' own top-level second argument, rather than per query.\n*\n* Having the same query key more than once in the array of query objects may cause some data to be shared\n* between queries. To avoid this, consider de-duplicating the queries and map the results back to the desired\n* structure.\n*\n* The `combine` option can be used to combine the results of the queries into a single value. The result will\n* be structurally shared to be as referentially stable as possible.\n*\n* @remarks The `combine` function only re-runs if it changed referentially, or if any of the query results\n* changed. An inlined `combine` function, as shown in the example below, therefore runs on every render — wrap\n* it in `useCallback`, or extract it to a stable function reference if it doesn't have any dependencies, to\n* avoid that.\n*\n* Unlike `useQuery`, `useQueries` cannot infer the `data` argument of an _inline_ `select` from its sibling\n* `queryFn`. Because `useQueries` infers the type of the whole `queries` array at once, the `select` parameter\n* of a query object written inline cannot be contextually typed from that same object's `queryFn`, so it falls\n* back to `unknown` — a [known TypeScript limitation](https://github.com/TanStack/query/issues/6556). Annotate\n* the `select` parameter explicitly, or define the query with {@link queryOptions}, which resolves its types in\n* a single object _before_ it reaches `useQueries`, to work around this — see the example below. The same\n* limitation applies to {@link useSuspenseQueries}.\n*\n* `placeholderData` is supported here too, but unlike `useQuery`, it doesn't receive information from\n* previously rendered queries, because the number of queries can differ between renders.\n* @param queryClient - Use this to provide a custom `QueryClient`. Otherwise, the one from the nearest context\n* will be used.\n* @returns The combined result. Without `combine`, this is an array with all the query results, in the same\n* order as the input. When `combine` is provided, this is the value returned by `combine` instead.\n*\n* @example\n* ```tsx\n* import { useQueries } from '@tanstack/react-query'\n*\n* function Posts({ ids }: { ids: Array<number> }) {\n* const postQueries = useQueries({\n* queries: ids.map((id) => ({\n* queryKey: ['post', id],\n* queryFn: () => fetchPost(id),\n* staleTime: Infinity,\n* })),\n* })\n*\n* return (\n* <ul>\n* {postQueries.map((query, index) => {\n* if (query.isPending) return <li key={ids[index]}>Loading...</li>\n* if (query.isError) return <li key={ids[index]}>Error: {query.error.message}</li>\n* return <li key={ids[index]}>{query.data.title}</li>\n* })}\n* </ul>\n* )\n* }\n* ```\n*\n* @example\n* Combining results into a single value:\n* ```tsx\n* import { useQueries } from '@tanstack/react-query'\n*\n* function Posts({ ids }: { ids: Array<number> }) {\n* const { data, isPending, isError } = useQueries({\n* queries: ids.map((id) => ({\n* queryKey: ['post', id],\n* queryFn: () => fetchPost(id),\n* })),\n* combine: (postQueries) => {\n* return {\n* data: postQueries.map((query) => query.data),\n* isPending: postQueries.some((query) => query.isPending),\n* isError: postQueries.some((query) => query.isError),\n* }\n* },\n* })\n*\n* if (isPending) return 'Loading...'\n* if (isError) return 'Error loading posts'\n*\n* return (\n* <ul>\n* {data.map((post) => (\n* <li key={post?.id}>{post?.title}</li>\n* ))}\n* </ul>\n* )\n* }\n* ```\n*\n* @example\n* Typing `select` via {@link queryOptions}. Note that spreading a `queryOptions` result and overriding\n* `select` inline still falls back to `unknown` — wrap the spread in `queryOptions` again so the override is\n* resolved before it reaches `useQueries`:\n* ```tsx\n* import { queryOptions, useQueries } from '@tanstack/react-query'\n*\n* const postOptions = (id: number) =>\n* queryOptions({\n* queryKey: ['post', id],\n* queryFn: () => fetchPost(id),\n* })\n*\n* function PostTitle({ id }: { id: number }) {\n* const [{ data: broken }] = useQueries({\n* queries: [\n* {\n* ...postOptions(id),\n* // ❌ `data` is `unknown` here\n* select: (data) => data.title,\n* },\n* ],\n* })\n*\n* const [{ data: fixed }] = useQueries({\n* queries: [\n* queryOptions({\n* ...postOptions(id),\n* // ✅ `data` is `Post`\n* select: (data) => data.title,\n* }),\n* ],\n* })\n*\n* return <h1>{fixed}</h1>\n* }\n* ```\n*/\nfunction useQueries({ queries, ...options }, queryClient) {\n\tconst client = useQueryClient(queryClient);\n\tconst isRestoring = useIsRestoring();\n\tconst errorResetBoundary = useQueryErrorResetBoundary();\n\tconst subscribed = options.subscribed !== false;\n\tconst defaultedQueries = React.useMemo(() => queries.map((opts) => {\n\t\tconst defaultedOptions = client.defaultQueryOptions(opts);\n\t\tdefaultedOptions._optimisticResults = isRestoring ? \"isRestoring\" : subscribed ? \"optimistic\" : void 0;\n\t\treturn defaultedOptions;\n\t}), [\n\t\tqueries,\n\t\tclient,\n\t\tisRestoring,\n\t\tsubscribed\n\t]);\n\tdefaultedQueries.forEach((queryOptions) => {\n\t\tensureSuspenseTimers(queryOptions);\n\t\tconst query = client.getQueryCache().get(queryOptions.queryHash);\n\t\tensurePreventErrorBoundaryRetry(queryOptions, errorResetBoundary, query);\n\t});\n\tuseClearResetErrorBoundary(errorResetBoundary);\n\tconst [observer] = React.useState(() => new QueriesObserver(client, defaultedQueries, options));\n\tconst [optimisticResult, getCombinedResult, trackResult] = observer.getOptimisticResult(defaultedQueries, options.combine);\n\tconst shouldSubscribe = !isRestoring && subscribed;\n\tReact.useSyncExternalStore(React.useCallback((onStoreChange) => shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop, [observer, shouldSubscribe]), () => observer.getCurrentResult(), () => observer.getCurrentResult());\n\tReact.useEffect(() => {\n\t\tobserver.setQueries(defaultedQueries, options);\n\t}, [\n\t\tdefaultedQueries,\n\t\toptions,\n\t\tobserver\n\t]);\n\tconst suspensePromises = optimisticResult.some((result, index) => shouldSuspend(defaultedQueries[index], result)) ? optimisticResult.flatMap((result, index) => {\n\t\tconst opts = defaultedQueries[index];\n\t\tif (opts && shouldSuspend(opts, result)) {\n\t\t\tconst queryObserver = new QueryObserver(client, opts);\n\t\t\treturn fetchOptimistic(opts, queryObserver, errorResetBoundary);\n\t\t}\n\t\treturn [];\n\t}) : [];\n\tif (suspensePromises.length > 0) throw Promise.all(suspensePromises);\n\tconst firstSingleResultWhichShouldThrow = optimisticResult.find((result, index) => {\n\t\tconst query = defaultedQueries[index];\n\t\treturn query && getHasError({\n\t\t\tresult,\n\t\t\terrorResetBoundary,\n\t\t\tthrowOnError: query.throwOnError,\n\t\t\tquery: client.getQueryCache().get(query.queryHash),\n\t\t\tsuspense: query.suspense\n\t\t});\n\t});\n\tif (firstSingleResultWhichShouldThrow) throw firstSingleResultWhichShouldThrow.error;\n\treturn getCombinedResult(trackResult());\n}\n//#endregion\nexport { useQueries };\n\n//# sourceMappingURL=useQueries.js.map","\"use client\";\nimport { useQueryClient } from \"./QueryClientProvider.js\";\nimport { useIsRestoring } from \"./IsRestoringProvider.js\";\nimport { useQueryErrorResetBoundary } from \"./QueryErrorResetBoundary.js\";\nimport { ensurePreventErrorBoundaryRetry, getHasError, useClearResetErrorBoundary } from \"./errorBoundaryUtils.js\";\nimport { ensureSuspenseTimers, fetchOptimistic, shouldSuspend } from \"./suspense.js\";\nimport * as React from \"react\";\nimport { noop, notifyManager } from \"@tanstack/query-core\";\n//#region src/useBaseQuery.ts\nfunction useBaseQuery(options, Observer, queryClient) {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tif (typeof options !== \"object\" || Array.isArray(options)) throw new Error(\"Bad argument type. Starting with v5, only the \\\"Object\\\" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object\");\n\t}\n\tconst isRestoring = useIsRestoring();\n\tconst errorResetBoundary = useQueryErrorResetBoundary();\n\tconst client = useQueryClient(queryClient);\n\tconst defaultedOptions = client.defaultQueryOptions(options);\n\tconst query = client.getQueryCache().get(defaultedOptions.queryHash);\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tif (!defaultedOptions.queryFn) console.error(`[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`);\n\t}\n\tconst subscribed = options.subscribed !== false;\n\tdefaultedOptions._optimisticResults = isRestoring ? \"isRestoring\" : subscribed ? \"optimistic\" : void 0;\n\tensureSuspenseTimers(defaultedOptions);\n\tensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query);\n\tuseClearResetErrorBoundary(errorResetBoundary);\n\tconst [observer] = React.useState(() => new Observer(client, defaultedOptions));\n\tconst result = observer.getOptimisticResult(defaultedOptions);\n\tconst shouldSubscribe = !isRestoring && subscribed;\n\tReact.useSyncExternalStore(React.useCallback((onStoreChange) => {\n\t\tconst unsubscribe = shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop;\n\t\tobserver.updateResult();\n\t\treturn unsubscribe;\n\t}, [observer, shouldSubscribe]), () => observer.getCurrentResult(), () => observer.getCurrentResult());\n\tReact.useEffect(() => {\n\t\tobserver.setOptions(defaultedOptions);\n\t}, [defaultedOptions, observer]);\n\tif (shouldSuspend(defaultedOptions, result)) throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);\n\tif (getHasError({\n\t\tresult,\n\t\terrorResetBoundary,\n\t\tthrowOnError: defaultedOptions.throwOnError,\n\t\tquery,\n\t\tsuspense: defaultedOptions.suspense\n\t})) throw result.error;\n\treturn !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;\n}\n//#endregion\nexport { useBaseQuery };\n\n//# sourceMappingURL=useBaseQuery.js.map","\"use client\";\nimport { useBaseQuery } from \"./useBaseQuery.js\";\nimport { QueryObserver } from \"@tanstack/query-core\";\n//#region src/useQuery.ts\nfunction useQuery(options, queryClient) {\n\treturn useBaseQuery(options, QueryObserver, queryClient);\n}\n//#endregion\nexport { useQuery };\n\n//# sourceMappingURL=useQuery.js.map","\"use client\";\nimport { useQueryClient } from \"./QueryClientProvider.js\";\nimport * as React from \"react\";\nimport { notifyManager } from \"@tanstack/query-core\";\n//#region src/useIsFetching.ts\n/**\n* The `useIsFetching` hook returns the `number` of the queries that your application is loading or fetching in\n* the background (useful for app-wide loading indicators).\n*\n* @param filters - The {@link QueryFilters} to narrow down the matched queries.\n* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n* be used.\n* @returns Will be the `number` of the queries that your application is currently loading or fetching in the\n* background.\n*\n* @example\n* ```tsx\n* import { useIsFetching } from '@tanstack/react-query'\n*\n* function PostsFetchingIndicator() {\n* // How many queries matching the posts prefix are fetching?\n* const isFetchingPosts = useIsFetching({ queryKey: ['posts'] })\n*\n* return isFetchingPosts ? <span>Refreshing posts...</span> : null\n* }\n* ```\n*\n* @example\n* A global loading indicator for any query fetching in the background, not just the ones on screen:\n* ```tsx\n* import { useIsFetching } from '@tanstack/react-query'\n*\n* function GlobalLoadingIndicator() {\n* const isFetching = useIsFetching()\n*\n* return isFetching ? (\n* <div>Queries are fetching in the background...</div>\n* ) : null\n* }\n* ```\n*/\nfunction useIsFetching(filters, queryClient) {\n\tconst client = useQueryClient(queryClient);\n\tconst queryCache = client.getQueryCache();\n\treturn React.useSyncExternalStore(React.useCallback((onStoreChange) => queryCache.subscribe(notifyManager.batchCalls(onStoreChange)), [queryCache]), () => client.isFetching(filters), () => client.isFetching(filters));\n}\n//#endregion\nexport { useIsFetching };\n\n//# sourceMappingURL=useIsFetching.js.map","\"use client\";\nimport { useQueryClient } from \"./QueryClientProvider.js\";\nimport * as React from \"react\";\nimport { MutationObserver, noop, notifyManager, shouldThrowError } from \"@tanstack/query-core\";\n//#region src/useMutation.ts\n/**\n* Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.\n* `useMutation` is the hook for that.\n*\n* @see {@link mutationOptions} to share these options across multiple `useMutation` call sites, or to look\n* the mutation up elsewhere via its `mutationKey` (e.g. with `useMutationState`).\n* @param options - The {@link UseMutationOptions} to use — everything you can pass to `useMutation`.\n* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n* be used.\n* @returns `mutate`/`mutateAsync` also accept per-call `onSuccess`/`onError`/`onSettled` callbacks as a second\n* argument, useful for triggering call-site side effects (e.g. navigation) without coupling them to the shared\n* mutation definition. Hook-level callbacks (passed to `options`) fire for every mutation; per-call callbacks\n* fire only for the latest call you've made, and only while the component is still mounted — unmounting before\n* the mutation settles removes the subscription and prevents them from firing.\n*\n* @example\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodo() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* return (\n* <button\n* onClick={() =>\n* addMutation.mutate('Item', {\n* onError: (error) => console.error('Failed to add item:', error),\n* })\n* }\n* >\n* Add\n* </button>\n* )\n* }\n* ```\n*\n* @example\n* Rendering the mutation's own state, rather than just firing it off:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodo() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* return (\n* <div>\n* {addMutation.isPending ? (\n* 'Adding todo...'\n* ) : (\n* <>\n* {addMutation.isError ? (\n* <div>An error occurred: {addMutation.error.message}</div>\n* ) : null}\n* <button onClick={() => addMutation.mutate('Item')}>Add</button>\n* </>\n* )}\n* </div>\n* )\n* }\n* ```\n*\n* @example\n* Optimistic update via `onMutate`, rolling back on `onError`:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodo() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onMutate: async (newTodo) => {\n* await queryClient.cancelQueries({ queryKey: ['todos'] })\n* const previousTodos = queryClient.getQueryData<Array<string>>(['todos'])\n*\n* queryClient.setQueryData<Array<string>>(['todos'], (old) => [\n* ...(old ?? []),\n* newTodo,\n* ])\n*\n* // Passed to `onError` as `onMutateResult` if the mutation fails.\n* return { previousTodos }\n* },\n* onError: (_err, _newTodo, onMutateResult) => {\n* queryClient.setQueryData(['todos'], onMutateResult?.previousTodos)\n* },\n* onSettled: () => {\n* queryClient.invalidateQueries({ queryKey: ['todos'] })\n* },\n* })\n*\n* return (\n* <button onClick={() => addMutation.mutate('Item')}>Add</button>\n* )\n* }\n* ```\n*\n* @example\n* Callbacks passed per call to `mutate` only fire for the last call — `mutateAsync` gives you a\n* promise per call instead, so you can wait for all of them when they succeed:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodos() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* async function handleAddAll(todos: Array<string>) {\n* try {\n* await Promise.all(todos.map((todo) => addMutation.mutateAsync(todo)))\n* } catch (error) {\n* console.error('Failed to add todos:', error)\n* }\n* }\n*\n* return (\n* <button onClick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>\n* Add all\n* </button>\n* )\n* }\n* ```\n*\n* @example\n* If some of the mutations above can fail independently of the others, and you want to know which ones\n* did — rather than losing that information the moment the first one rejects — swap `Promise.all` for\n* `Promise.allSettled`:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodos() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* async function handleAddAll(todos: Array<string>) {\n* const addResults = await Promise.allSettled(\n* todos.map((todo) => addMutation.mutateAsync(todo)),\n* )\n*\n* addResults.forEach((addResult, index) => {\n* if (addResult.status === 'rejected') {\n* console.error(`Failed to add \"${todos[index]}\":`, addResult.reason)\n* }\n* })\n* }\n*\n* return (\n* <button onClick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>\n* Add all\n* </button>\n* )\n* }\n* ```\n*/\nfunction useMutation(options, queryClient) {\n\tconst client = useQueryClient(queryClient);\n\tconst [observer] = React.useState(() => new MutationObserver(client, options));\n\tReact.useEffect(() => {\n\t\tobserver.setOptions(options);\n\t}, [observer, options]);\n\tconst result = React.useSyncExternalStore(React.useCallback((onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer]), () => observer.getCurrentResult(), () => observer.getCurrentResult());\n\tconst mutate = React.useCallback((...args) => {\n\t\tobserver.mutate(args[0], args[1]).catch(noop);\n\t}, [observer]);\n\tif (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) throw result.error;\n\treturn {\n\t\t...result,\n\t\tmutate,\n\t\tmutateAsync: result.mutate\n\t};\n}\n//#endregion\nexport { useMutation };\n\n//# sourceMappingURL=useMutation.js.map","\"use client\";\nimport { useBaseQuery } from \"./useBaseQuery.js\";\nimport { InfiniteQueryObserver } from \"@tanstack/query-core\";\n//#region src/useInfiniteQuery.ts\nfunction useInfiniteQuery(options, queryClient) {\n\treturn useBaseQuery(options, InfiniteQueryObserver, queryClient);\n}\n//#endregion\nexport { useInfiniteQuery };\n\n//# sourceMappingURL=useInfiniteQuery.js.map","var QrCodeDataType = /* @__PURE__ */ ((QrCodeDataType2) => {\n QrCodeDataType2[QrCodeDataType2[\"Border\"] = -1] = \"Border\";\n QrCodeDataType2[QrCodeDataType2[\"Data\"] = 0] = \"Data\";\n QrCodeDataType2[QrCodeDataType2[\"Function\"] = 1] = \"Function\";\n QrCodeDataType2[QrCodeDataType2[\"Position\"] = 2] = \"Position\";\n QrCodeDataType2[QrCodeDataType2[\"Timing\"] = 3] = \"Timing\";\n QrCodeDataType2[QrCodeDataType2[\"Alignment\"] = 4] = \"Alignment\";\n return QrCodeDataType2;\n})(QrCodeDataType || {});\n\nconst LOW = [0, 1];\nconst MEDIUM = [1, 0];\nconst QUARTILE = [2, 3];\nconst HIGH = [3, 2];\nconst EccMap = {\n L: LOW,\n M: MEDIUM,\n Q: QUARTILE,\n H: HIGH\n};\nconst NUMERIC_REGEX = /^\\d*$/;\nconst ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+./:-]*$/;\nconst ALPHANUMERIC_CHARSET = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:\";\nconst MIN_VERSION = 1;\nconst MAX_VERSION = 40;\nconst PENALTY_N1 = 3;\nconst PENALTY_N2 = 3;\nconst PENALTY_N3 = 40;\nconst PENALTY_N4 = 10;\nconst ECC_CODEWORDS_PER_BLOCK = [\n // Version: (note that index 0 is for padding, and is set to an illegal value)\n // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level\n [-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],\n // Low\n [-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28],\n // Medium\n [-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],\n // Quartile\n [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]\n // High\n];\nconst NUM_ERROR_CORRECTION_BLOCKS = [\n // Version: (note that index 0 is for padding, and is set to an illegal value)\n // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level\n [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],\n // Low\n [-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49],\n // Medium\n [-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68],\n // Quartile\n [-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]\n // High\n];\nclass QrCode {\n /* -- Constructor (low level) and fields -- */\n // Creates a new QR Code with the given version number,\n // error correction level, data codeword bytes, and mask number.\n // This is a low-level API that most users should not use directly.\n // A mid-level API is the encodeSegments() function.\n constructor(version, ecc, dataCodewords, msk) {\n this.version = version;\n this.ecc = ecc;\n if (version < MIN_VERSION || version > MAX_VERSION)\n throw new RangeError(\"Version value out of range\");\n if (msk < -1 || msk > 7)\n throw new RangeError(\"Mask value out of range\");\n this.size = version * 4 + 17;\n const row = Array.from({ length: this.size }).fill(false);\n for (let i = 0; i < this.size; i++) {\n this.modules.push(row.slice());\n this.types.push(row.map(() => 0));\n }\n this.drawFunctionPatterns();\n const allCodewords = this.addEccAndInterleave(dataCodewords);\n this.drawCodewords(allCodewords);\n if (msk === -1) {\n let minPenalty = 1e9;\n for (let i = 0; i < 8; i++) {\n this.applyMask(i);\n this.drawFormatBits(i);\n const penalty = this.getPenaltyScore();\n if (penalty < minPenalty) {\n msk = i;\n minPenalty = penalty;\n }\n this.applyMask(i);\n }\n }\n this.mask = msk;\n this.applyMask(msk);\n this.drawFormatBits(msk);\n }\n /* -- Fields -- */\n // The width and height of this QR Code, measured in modules, between\n // 21 and 177 (inclusive). This is equal to version * 4 + 17.\n size;\n // The index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive).\n // Even if a QR Code is created with automatic masking requested (mask = -1),\n // the resulting object still has a mask value between 0 and 7.\n mask;\n // The modules of this QR Code (false = light, true = dark).\n // Immutable after constructor finishes. Accessed through getModule().\n modules = [];\n types = [];\n /* -- Accessor methods -- */\n // Returns the color of the module (pixel) at the given coordinates, which is false\n // for light or true for dark. The top left corner has the coordinates (x=0, y=0).\n // If the given coordinates are out of bounds, then false (light) is returned.\n getModule(x, y) {\n return x >= 0 && x < this.size && y >= 0 && y < this.size && this.modules[y][x];\n }\n /* -- Private helper methods for constructor: Drawing function modules -- */\n // Reads this object's version field, and draws and marks all function modules.\n drawFunctionPatterns() {\n for (let i = 0; i < this.size; i++) {\n this.setFunctionModule(6, i, i % 2 === 0, QrCodeDataType.Timing);\n this.setFunctionModule(i, 6, i % 2 === 0, QrCodeDataType.Timing);\n }\n this.drawFinderPattern(3, 3);\n this.drawFinderPattern(this.size - 4, 3);\n this.drawFinderPattern(3, this.size - 4);\n const alignPatPos = this.getAlignmentPatternPositions();\n const numAlign = alignPatPos.length;\n for (let i = 0; i < numAlign; i++) {\n for (let j = 0; j < numAlign; j++) {\n if (!(i === 0 && j === 0 || i === 0 && j === numAlign - 1 || i === numAlign - 1 && j === 0))\n this.drawAlignmentPattern(alignPatPos[i], alignPatPos[j]);\n }\n }\n this.drawFormatBits(0);\n this.drawVersion();\n }\n // Draws two copies of the format bits (with its own error correction code)\n // based on the given mask and this object's error correction level field.\n drawFormatBits(mask) {\n const data = this.ecc[1] << 3 | mask;\n let rem = data;\n for (let i = 0; i < 10; i++)\n rem = rem << 1 ^ (rem >>> 9) * 1335;\n const bits = (data << 10 | rem) ^ 21522;\n for (let i = 0; i <= 5; i++)\n this.setFunctionModule(8, i, getBit(bits, i));\n this.setFunctionModule(8, 7, getBit(bits, 6));\n this.setFunctionModule(8, 8, getBit(bits, 7));\n this.setFunctionModule(7, 8, getBit(bits, 8));\n for (let i = 9; i < 15; i++)\n this.setFunctionModule(14 - i, 8, getBit(bits, i));\n for (let i = 0; i < 8; i++)\n this.setFunctionModule(this.size - 1 - i, 8, getBit(bits, i));\n for (let i = 8; i < 15; i++)\n this.setFunctionModule(8, this.size - 15 + i, getBit(bits, i));\n this.setFunctionModule(8, this.size - 8, true);\n }\n // Draws two copies of the version bits (with its own error correction code),\n // based on this object's version field, iff 7 <= version <= 40.\n drawVersion() {\n if (this.version < 7)\n return;\n let rem = this.version;\n for (let i = 0; i < 12; i++)\n rem = rem << 1 ^ (rem >>> 11) * 7973;\n const bits = this.version << 12 | rem;\n for (let i = 0; i < 18; i++) {\n const color = getBit(bits, i);\n const a = this.size - 11 + i % 3;\n const b = Math.floor(i / 3);\n this.setFunctionModule(a, b, color);\n this.setFunctionModule(b, a, color);\n }\n }\n // Draws a 9*9 finder pattern including the border separator,\n // with the center module at (x, y). Modules can be out of bounds.\n drawFinderPattern(x, y) {\n for (let dy = -4; dy <= 4; dy++) {\n for (let dx = -4; dx <= 4; dx++) {\n const dist = Math.max(Math.abs(dx), Math.abs(dy));\n const xx = x + dx;\n const yy = y + dy;\n if (xx >= 0 && xx < this.size && yy >= 0 && yy < this.size)\n this.setFunctionModule(xx, yy, dist !== 2 && dist !== 4, QrCodeDataType.Position);\n }\n }\n }\n // Draws a 5*5 alignment pattern, with the center module\n // at (x, y). All modules must be in bounds.\n drawAlignmentPattern(x, y) {\n for (let dy = -2; dy <= 2; dy++) {\n for (let dx = -2; dx <= 2; dx++) {\n this.setFunctionModule(\n x + dx,\n y + dy,\n Math.max(Math.abs(dx), Math.abs(dy)) !== 1,\n QrCodeDataType.Alignment\n );\n }\n }\n }\n // Sets the color of a module and marks it as a function module.\n // Only used by the constructor. Coordinates must be in bounds.\n setFunctionModule(x, y, isDark, type = QrCodeDataType.Function) {\n this.modules[y][x] = isDark;\n this.types[y][x] = type;\n }\n /* -- Private helper methods for constructor: Codewords and masking -- */\n // Returns a new byte string representing the given data with the appropriate error correction\n // codewords appended to it, based on this object's version and error correction level.\n addEccAndInterleave(data) {\n const ver = this.version;\n const ecl = this.ecc;\n if (data.length !== getNumDataCodewords(ver, ecl))\n throw new RangeError(\"Invalid argument\");\n const numBlocks = NUM_ERROR_CORRECTION_BLOCKS[ecl[0]][ver];\n const blockEccLen = ECC_CODEWORDS_PER_BLOCK[ecl[0]][ver];\n const rawCodewords = Math.floor(getNumRawDataModules(ver) / 8);\n const numShortBlocks = numBlocks - rawCodewords % numBlocks;\n const shortBlockLen = Math.floor(rawCodewords / numBlocks);\n const blocks = [];\n const rsDiv = reedSolomonComputeDivisor(blockEccLen);\n for (let i = 0, k = 0; i < numBlocks; i++) {\n const dat = data.slice(k, k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1));\n k += dat.length;\n const ecc = reedSolomonComputeRemainder(dat, rsDiv);\n if (i < numShortBlocks)\n dat.push(0);\n blocks.push(dat.concat(ecc));\n }\n const result = [];\n for (let i = 0; i < blocks[0].length; i++) {\n blocks.forEach((block, j) => {\n if (i !== shortBlockLen - blockEccLen || j >= numShortBlocks)\n result.push(block[i]);\n });\n }\n return result;\n }\n // Draws the given sequence of 8-bit codewords (data and error correction) onto the entire\n // data area of this QR Code. Function modules need to be marked off before this is called.\n drawCodewords(data) {\n if (data.length !== Math.floor(getNumRawDataModules(this.version) / 8))\n throw new RangeError(\"Invalid argument\");\n let i = 0;\n for (let right = this.size - 1; right >= 1; right -= 2) {\n if (right === 6)\n right = 5;\n for (let vert = 0; vert < this.size; vert++) {\n for (let j = 0; j < 2; j++) {\n const x = right - j;\n const upward = (right + 1 & 2) === 0;\n const y = upward ? this.size - 1 - vert : vert;\n if (!this.types[y][x] && i < data.length * 8) {\n this.modules[y][x] = getBit(data[i >>> 3], 7 - (i & 7));\n i++;\n }\n }\n }\n }\n }\n // XORs the codeword modules in this QR Code with the given mask pattern.\n // The function modules must be marked and the codeword bits must be drawn\n // before masking. Due to the arithmetic of XOR, calling applyMask() with\n // the same mask value a second time will undo the mask. A final well-formed\n // QR Code needs exactly one (not zero, two, etc.) mask applied.\n applyMask(mask) {\n if (mask < 0 || mask > 7)\n throw new RangeError(\"Mask value out of range\");\n for (let y = 0; y < this.size; y++) {\n for (let x = 0; x < this.size; x++) {\n let invert;\n switch (mask) {\n case 0:\n invert = (x + y) % 2 === 0;\n break;\n case 1:\n invert = y % 2 === 0;\n break;\n case 2:\n invert = x % 3 === 0;\n break;\n case 3:\n invert = (x + y) % 3 === 0;\n break;\n case 4:\n invert = (Math.floor(x / 3) + Math.floor(y / 2)) % 2 === 0;\n break;\n case 5:\n invert = x * y % 2 + x * y % 3 === 0;\n break;\n case 6:\n invert = (x * y % 2 + x * y % 3) % 2 === 0;\n break;\n case 7:\n invert = ((x + y) % 2 + x * y % 3) % 2 === 0;\n break;\n default:\n throw new Error(\"Unreachable\");\n }\n if (!this.types[y][x] && invert)\n this.modules[y][x] = !this.modules[y][x];\n }\n }\n }\n // Calculates and returns the penalty score based on state of this QR Code's current modules.\n // This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.\n getPenaltyScore() {\n let result = 0;\n for (let y = 0; y < this.size; y++) {\n let runColor = false;\n let runX = 0;\n const runHistory = [0, 0, 0, 0, 0, 0, 0];\n for (let x = 0; x < this.size; x++) {\n if (this.modules[y][x] === runColor) {\n runX++;\n if (runX === 5)\n result += PENALTY_N1;\n else if (runX > 5)\n result++;\n } else {\n this.finderPenaltyAddHistory(runX, runHistory);\n if (!runColor)\n result += this.finderPenaltyCountPatterns(runHistory) * PENALTY_N3;\n runColor = this.modules[y][x];\n runX = 1;\n }\n }\n result += this.finderPenaltyTerminateAndCount(runColor, runX, runHistory) * PENALTY_N3;\n }\n for (let x = 0; x < this.size; x++) {\n let runColor = false;\n let runY = 0;\n const runHistory = [0, 0, 0, 0, 0, 0, 0];\n for (let y = 0; y < this.size; y++) {\n if (this.modules[y][x] === runColor) {\n runY++;\n if (runY === 5)\n result += PENALTY_N1;\n else if (runY > 5)\n result++;\n } else {\n this.finderPenaltyAddHistory(runY, runHistory);\n if (!runColor)\n result += this.finderPenaltyCountPatterns(runHistory) * PENALTY_N3;\n runColor = this.modules[y][x];\n runY = 1;\n }\n }\n result += this.finderPenaltyTerminateAndCount(runColor, runY, runHistory) * PENALTY_N3;\n }\n for (let y = 0; y < this.size - 1; y++) {\n for (let x = 0; x < this.size - 1; x++) {\n const color = this.modules[y][x];\n if (color === this.modules[y][x + 1] && color === this.modules[y + 1][x] && color === this.modules[y + 1][x + 1]) {\n result += PENALTY_N2;\n }\n }\n }\n let dark = 0;\n for (const row of this.modules)\n dark = row.reduce((sum, color) => sum + (color ? 1 : 0), dark);\n const total = this.size * this.size;\n const k = Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1;\n result += k * PENALTY_N4;\n return result;\n }\n /* -- Private helper functions -- */\n // Returns an ascending list of positions of alignment patterns for this version number.\n // Each position is in the range [0,177), and are used on both the x and y axes.\n // This could be implemented as lookup table of 40 variable-length lists of integers.\n getAlignmentPatternPositions() {\n if (this.version === 1) {\n return [];\n } else {\n const numAlign = Math.floor(this.version / 7) + 2;\n const step = this.version === 32 ? 26 : Math.ceil((this.version * 4 + 4) / (numAlign * 2 - 2)) * 2;\n const result = [6];\n for (let pos = this.size - 7; result.length < numAlign; pos -= step)\n result.splice(1, 0, pos);\n return result;\n }\n }\n // Can only be called immediately after a light run is added, and\n // returns either 0, 1, or 2. A helper function for getPenaltyScore().\n finderPenaltyCountPatterns(runHistory) {\n const n = runHistory[1];\n const core = n > 0 && runHistory[2] === n && runHistory[3] === n * 3 && runHistory[4] === n && runHistory[5] === n;\n return (core && runHistory[0] >= n * 4 && runHistory[6] >= n ? 1 : 0) + (core && runHistory[6] >= n * 4 && runHistory[0] >= n ? 1 : 0);\n }\n // Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().\n finderPenaltyTerminateAndCount(currentRunColor, currentRunLength, runHistory) {\n if (currentRunColor) {\n this.finderPenaltyAddHistory(currentRunLength, runHistory);\n currentRunLength = 0;\n }\n currentRunLength += this.size;\n this.finderPenaltyAddHistory(currentRunLength, runHistory);\n return this.finderPenaltyCountPatterns(runHistory);\n }\n // Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().\n finderPenaltyAddHistory(currentRunLength, runHistory) {\n if (runHistory[0] === 0)\n currentRunLength += this.size;\n runHistory.pop();\n runHistory.unshift(currentRunLength);\n }\n}\nfunction appendBits(val, len, bb) {\n if (len < 0 || len > 31 || val >>> len !== 0)\n throw new RangeError(\"Value out of range\");\n for (let i = len - 1; i >= 0; i--)\n bb.push(val >>> i & 1);\n}\nfunction getBit(x, i) {\n return (x >>> i & 1) !== 0;\n}\nclass QrSegment {\n // Creates a new QR Code segment with the given attributes and data.\n // The character count (numChars) must agree with the mode and the bit buffer length,\n // but the constraint isn't checked. The given bit buffer is cloned and stored.\n constructor(mode, numChars, bitData) {\n this.mode = mode;\n this.numChars = numChars;\n this.bitData = bitData;\n if (numChars < 0)\n throw new RangeError(\"Invalid argument\");\n this.bitData = bitData.slice();\n }\n /* -- Methods -- */\n // Returns a new copy of the data bits of this segment.\n getData() {\n return this.bitData.slice();\n }\n}\nconst MODE_NUMERIC = [1, 10, 12, 14];\nconst MODE_ALPHANUMERIC = [2, 9, 11, 13];\nconst MODE_BYTE = [4, 8, 16, 16];\nfunction numCharCountBits(mode, ver) {\n return mode[Math.floor((ver + 7) / 17) + 1];\n}\nfunction makeBytes(data) {\n const bb = [];\n for (const b of data)\n appendBits(b, 8, bb);\n return new QrSegment(MODE_BYTE, data.length, bb);\n}\nfunction makeNumeric(digits) {\n if (!isNumeric(digits))\n throw new RangeError(\"String contains non-numeric characters\");\n const bb = [];\n for (let i = 0; i < digits.length; ) {\n const n = Math.min(digits.length - i, 3);\n appendBits(Number.parseInt(digits.substring(i, i + n), 10), n * 3 + 1, bb);\n i += n;\n }\n return new QrSegment(MODE_NUMERIC, digits.length, bb);\n}\nfunction makeAlphanumeric(text) {\n if (!isAlphanumeric(text))\n throw new RangeError(\"String contains unencodable characters in alphanumeric mode\");\n const bb = [];\n let i;\n for (i = 0; i + 2 <= text.length; i += 2) {\n let temp = ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)) * 45;\n temp += ALPHANUMERIC_CHARSET.indexOf(text.charAt(i + 1));\n appendBits(temp, 11, bb);\n }\n if (i < text.length)\n appendBits(ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)), 6, bb);\n return new QrSegment(MODE_ALPHANUMERIC, text.length, bb);\n}\nfunction makeSegments(text) {\n if (text === \"\")\n return [];\n else if (isNumeric(text))\n return [makeNumeric(text)];\n else if (isAlphanumeric(text))\n return [makeAlphanumeric(text)];\n else\n return [makeBytes(toUtf8ByteArray(text))];\n}\nfunction isNumeric(text) {\n return NUMERIC_REGEX.test(text);\n}\nfunction isAlphanumeric(text) {\n return ALPHANUMERIC_REGEX.test(text);\n}\nfunction getTotalBits(segs, version) {\n let result = 0;\n for (const seg of segs) {\n const ccbits = numCharCountBits(seg.mode, version);\n if (seg.numChars >= 1 << ccbits)\n return Number.POSITIVE_INFINITY;\n result += 4 + ccbits + seg.bitData.length;\n }\n return result;\n}\nfunction toUtf8ByteArray(str) {\n str = encodeURI(str);\n const result = [];\n for (let i = 0; i < str.length; i++) {\n if (str.charAt(i) !== \"%\") {\n result.push(str.charCodeAt(i));\n } else {\n result.push(Number.parseInt(str.substring(i + 1, i + 3), 16));\n i += 2;\n }\n }\n return result;\n}\nfunction getNumRawDataModules(ver) {\n if (ver < MIN_VERSION || ver > MAX_VERSION)\n throw new RangeError(\"Version number out of range\");\n let result = (16 * ver + 128) * ver + 64;\n if (ver >= 2) {\n const numAlign = Math.floor(ver / 7) + 2;\n result -= (25 * numAlign - 10) * numAlign - 55;\n if (ver >= 7)\n result -= 36;\n }\n return result;\n}\nfunction getNumDataCodewords(ver, ecl) {\n return Math.floor(getNumRawDataModules(ver) / 8) - ECC_CODEWORDS_PER_BLOCK[ecl[0]][ver] * NUM_ERROR_CORRECTION_BLOCKS[ecl[0]][ver];\n}\nfunction reedSolomonComputeDivisor(degree) {\n if (degree < 1 || degree > 255)\n throw new RangeError(\"Degree out of range\");\n const result = [];\n for (let i = 0; i < degree - 1; i++)\n result.push(0);\n result.push(1);\n let root = 1;\n for (let i = 0; i < degree; i++) {\n for (let j = 0; j < result.length; j++) {\n result[j] = reedSolomonMultiply(result[j], root);\n if (j + 1 < result.length)\n result[j] ^= result[j + 1];\n }\n root = reedSolomonMultiply(root, 2);\n }\n return result;\n}\nfunction reedSolomonComputeRemainder(data, divisor) {\n const result = divisor.map((_) => 0);\n for (const b of data) {\n const factor = b ^ result.shift();\n result.push(0);\n divisor.forEach((coef, i) => result[i] ^= reedSolomonMultiply(coef, factor));\n }\n return result;\n}\nfunction reedSolomonMultiply(x, y) {\n if (x >>> 8 !== 0 || y >>> 8 !== 0)\n throw new RangeError(\"Byte out of range\");\n let z = 0;\n for (let i = 7; i >= 0; i--) {\n z = z << 1 ^ (z >>> 7) * 285;\n z ^= (y >>> i & 1) * x;\n }\n return z;\n}\nfunction encodeSegments(segs, ecl, minVersion = 1, maxVersion = 40, mask = -1, boostEcl = true) {\n if (!(MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= MAX_VERSION) || mask < -1 || mask > 7) {\n throw new RangeError(\"Invalid value\");\n }\n let version;\n let dataUsedBits;\n for (version = minVersion; ; version++) {\n const dataCapacityBits2 = getNumDataCodewords(version, ecl) * 8;\n const usedBits = getTotalBits(segs, version);\n if (usedBits <= dataCapacityBits2) {\n dataUsedBits = usedBits;\n break;\n }\n if (version >= maxVersion)\n throw new RangeError(\"Data too long\");\n }\n for (const newEcl of [MEDIUM, QUARTILE, HIGH]) {\n if (boostEcl && dataUsedBits <= getNumDataCodewords(version, newEcl) * 8)\n ecl = newEcl;\n }\n const bb = [];\n for (const seg of segs) {\n appendBits(seg.mode[0], 4, bb);\n appendBits(seg.numChars, numCharCountBits(seg.mode, version), bb);\n for (const b of seg.getData())\n bb.push(b);\n }\n const dataCapacityBits = getNumDataCodewords(version, ecl) * 8;\n appendBits(0, Math.min(4, dataCapacityBits - bb.length), bb);\n appendBits(0, (8 - bb.length % 8) % 8, bb);\n for (let padByte = 236; bb.length < dataCapacityBits; padByte ^= 236 ^ 17)\n appendBits(padByte, 8, bb);\n const dataCodewords = Array.from({ length: Math.ceil(bb.length / 8) }, () => 0);\n bb.forEach((b, i) => dataCodewords[i >>> 3] |= b << 7 - (i & 7));\n return new QrCode(version, ecl, dataCodewords, mask);\n}\n\nfunction encode(data, options) {\n const {\n ecc = \"L\",\n boostEcc = false,\n minVersion = 1,\n maxVersion = 40,\n maskPattern = -1,\n border = 1\n } = options || {};\n const segment = typeof data === \"string\" ? makeSegments(data) : Array.isArray(data) ? [makeBytes(data)] : void 0;\n if (!segment)\n throw new Error(`uqr only supports encoding string and binary data, but got: ${typeof data}`);\n const qr = encodeSegments(\n segment,\n EccMap[ecc],\n minVersion,\n maxVersion,\n maskPattern,\n boostEcc\n );\n const result = addBorder({\n version: qr.version,\n maskPattern: qr.mask,\n size: qr.size,\n data: qr.modules,\n types: qr.types\n }, border);\n if (options?.invert)\n result.data = result.data.map((row) => row.map((mod) => !mod));\n options?.onEncoded?.(result);\n return result;\n}\nfunction addBorder(input, border = 1) {\n if (!border)\n return input;\n const { size } = input;\n const newSize = size + border * 2;\n input.size = newSize;\n input.data.forEach((row) => {\n for (let i = 0; i < border; i++) {\n row.unshift(false);\n row.push(false);\n }\n });\n for (let i = 0; i < border; i++) {\n input.data.unshift(Array.from({ length: newSize }, (_) => false));\n input.data.push(Array.from({ length: newSize }, (_) => false));\n }\n const b = QrCodeDataType.Border;\n input.types.forEach((row) => {\n for (let i = 0; i < border; i++) {\n row.unshift(b);\n row.push(b);\n }\n });\n for (let i = 0; i < border; i++) {\n input.types.unshift(Array.from({ length: newSize }, (_) => b));\n input.types.push(Array.from({ length: newSize }, (_) => b));\n }\n return input;\n}\nfunction getDataAt(data, x, y, defaults = false) {\n if (x < 0 || y < 0 || x >= data.length || y >= data.length)\n return defaults;\n return data[y][x];\n}\n\nfunction renderUnicode(data, options = {}) {\n const {\n whiteChar = \"\\u2588\",\n blackChar = \"\\u2591\"\n } = options;\n const result = encode(data, options);\n return result.data.map((row) => {\n return row.map((mod) => mod ? blackChar : whiteChar).join(\"\");\n }).join(\"\\n\");\n}\nfunction renderANSI(data, options = {}) {\n return renderUnicode(data, {\n ...options,\n blackChar: \"\\x1B[40m\\u3000\\x1B[0m\",\n whiteChar: \"\\x1B[47m\\u3000\\x1B[0m\"\n });\n}\nfunction renderUnicodeCompact(data, options = {}) {\n const palette = {\n WHITE_ALL: \"\\u2588\",\n WHITE_BLACK: \"\\u2580\",\n BLACK_WHITE: \"\\u2584\",\n BLACK_ALL: \" \"\n };\n const result = encode(data, options);\n const WHITE = false;\n const BLACK = true;\n const at = (x, y) => getDataAt(result.data, x, y, true);\n const lines = [];\n let line = \"\";\n for (let row = 0; row < result.size; row += 2) {\n for (let col = 0; col < result.size; col++) {\n if (at(col, row) === WHITE && at(col, row + 1) === WHITE)\n line += palette.WHITE_ALL;\n else if (at(col, row) === WHITE && at(col, row + 1) === BLACK)\n line += palette.WHITE_BLACK;\n else if (at(col, row) === BLACK && at(col, row + 1) === WHITE)\n line += palette.BLACK_WHITE;\n else\n line += palette.BLACK_ALL;\n }\n lines.push(line);\n line = \"\";\n }\n return lines.join(\"\\n\");\n}\n\nfunction escapeAttr(value) {\n return value.replace(/&/g, \"&amp;\").replace(/\"/g, \"&quot;\").replace(/</g, \"&lt;\").replace(/>/g, \"&gt;\");\n}\nfunction renderSVG(data, options = {}) {\n const result = encode(data, options);\n const {\n pixelSize = 10,\n whiteColor = \"white\",\n blackColor = \"black\"\n } = options;\n const height = result.size * pixelSize;\n const width = result.size * pixelSize;\n let svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 ${width} ${height}\">`;\n const paths = [];\n for (let row = 0; row < result.size; row++) {\n for (let col = 0; col < result.size; col++) {\n const x = col * pixelSize;\n const y = row * pixelSize;\n if (result.data[row][col])\n paths.push(`M${x},${y}h${pixelSize}v${pixelSize}h-${pixelSize}z`);\n }\n }\n svg += `<rect fill=\"${escapeAttr(whiteColor)}\" width=\"${width}\" height=\"${height}\"/>`;\n svg += `<path fill=\"${escapeAttr(blackColor)}\" d=\"${paths.join(\"\")}\"/>`;\n svg += \"</svg>\";\n return svg;\n}\n\nexport { QrCodeDataType, encode, renderANSI, renderSVG, renderUnicode, renderUnicodeCompact };\n","/**\n * Encodes an RGBA image to a ThumbHash. RGB should not be premultiplied by A.\n *\n * @param w The width of the input image. Must be ≤100px.\n * @param h The height of the input image. Must be ≤100px.\n * @param rgba The pixels in the input image, row-by-row. Must have w*h*4 elements.\n * @returns The ThumbHash as a Uint8Array.\n */\nexport function rgbaToThumbHash(w, h, rgba) {\n // Encoding an image larger than 100x100 is slow with no benefit\n if (w > 100 || h > 100) throw new Error(`${w}x${h} doesn't fit in 100x100`)\n let { PI, round, max, cos, abs } = Math\n\n // Determine the average color\n let avg_r = 0, avg_g = 0, avg_b = 0, avg_a = 0\n for (let i = 0, j = 0; i < w * h; i++, j += 4) {\n let alpha = rgba[j + 3] / 255\n avg_r += alpha / 255 * rgba[j]\n avg_g += alpha / 255 * rgba[j + 1]\n avg_b += alpha / 255 * rgba[j + 2]\n avg_a += alpha\n }\n if (avg_a) {\n avg_r /= avg_a\n avg_g /= avg_a\n avg_b /= avg_a\n }\n\n let hasAlpha = avg_a < w * h\n let l_limit = hasAlpha ? 5 : 7 // Use fewer luminance bits if there's alpha\n let lx = max(1, round(l_limit * w / max(w, h)))\n let ly = max(1, round(l_limit * h / max(w, h)))\n let l = [] // luminance\n let p = [] // yellow - blue\n let q = [] // red - green\n let a = [] // alpha\n\n // Convert the image from RGBA to LPQA (composite atop the average color)\n for (let i = 0, j = 0; i < w * h; i++, j += 4) {\n let alpha = rgba[j + 3] / 255\n let r = avg_r * (1 - alpha) + alpha / 255 * rgba[j]\n let g = avg_g * (1 - alpha) + alpha / 255 * rgba[j + 1]\n let b = avg_b * (1 - alpha) + alpha / 255 * rgba[j + 2]\n l[i] = (r + g + b) / 3\n p[i] = (r + g) / 2 - b\n q[i] = r - g\n a[i] = alpha\n }\n\n // Encode using the DCT into DC (constant) and normalized AC (varying) terms\n let encodeChannel = (channel, nx, ny) => {\n let dc = 0, ac = [], scale = 0, fx = []\n for (let cy = 0; cy < ny; cy++) {\n for (let cx = 0; cx * ny < nx * (ny - cy); cx++) {\n let f = 0\n for (let x = 0; x < w; x++)\n fx[x] = cos(PI / w * cx * (x + 0.5))\n for (let y = 0; y < h; y++)\n for (let x = 0, fy = cos(PI / h * cy * (y + 0.5)); x < w; x++)\n f += channel[x + y * w] * fx[x] * fy\n f /= w * h\n if (cx || cy) {\n ac.push(f)\n scale = max(scale, abs(f))\n } else {\n dc = f\n }\n }\n }\n if (scale)\n for (let i = 0; i < ac.length; i++)\n ac[i] = 0.5 + 0.5 / scale * ac[i]\n return [dc, ac, scale]\n }\n let [l_dc, l_ac, l_scale] = encodeChannel(l, max(3, lx), max(3, ly))\n let [p_dc, p_ac, p_scale] = encodeChannel(p, 3, 3)\n let [q_dc, q_ac, q_scale] = encodeChannel(q, 3, 3)\n let [a_dc, a_ac, a_scale] = hasAlpha ? encodeChannel(a, 5, 5) : []\n\n // Write the constants\n let isLandscape = w > h\n let header24 = round(63 * l_dc) | (round(31.5 + 31.5 * p_dc) << 6) | (round(31.5 + 31.5 * q_dc) << 12) | (round(31 * l_scale) << 18) | (hasAlpha << 23)\n let header16 = (isLandscape ? ly : lx) | (round(63 * p_scale) << 3) | (round(63 * q_scale) << 9) | (isLandscape << 15)\n let hash = [header24 & 255, (header24 >> 8) & 255, header24 >> 16, header16 & 255, header16 >> 8]\n let ac_start = hasAlpha ? 6 : 5\n let ac_index = 0\n if (hasAlpha) hash.push(round(15 * a_dc) | (round(15 * a_scale) << 4))\n\n // Write the varying factors\n for (let ac of hasAlpha ? [l_ac, p_ac, q_ac, a_ac] : [l_ac, p_ac, q_ac])\n for (let f of ac)\n hash[ac_start + (ac_index >> 1)] |= round(15 * f) << ((ac_index++ & 1) << 2)\n return new Uint8Array(hash)\n}\n\n/**\n * Decodes a ThumbHash to an RGBA image. RGB is not be premultiplied by A.\n *\n * @param hash The bytes of the ThumbHash.\n * @returns The width, height, and pixels of the rendered placeholder image.\n */\nexport function thumbHashToRGBA(hash) {\n let { PI, min, max, cos, round } = Math\n\n // Read the constants\n let header24 = hash[0] | (hash[1] << 8) | (hash[2] << 16)\n let header16 = hash[3] | (hash[4] << 8)\n let l_dc = (header24 & 63) / 63\n let p_dc = ((header24 >> 6) & 63) / 31.5 - 1\n let q_dc = ((header24 >> 12) & 63) / 31.5 - 1\n let l_scale = ((header24 >> 18) & 31) / 31\n let hasAlpha = header24 >> 23\n let p_scale = ((header16 >> 3) & 63) / 63\n let q_scale = ((header16 >> 9) & 63) / 63\n let isLandscape = header16 >> 15\n let lx = max(3, isLandscape ? hasAlpha ? 5 : 7 : header16 & 7)\n let ly = max(3, isLandscape ? header16 & 7 : hasAlpha ? 5 : 7)\n let a_dc = hasAlpha ? (hash[5] & 15) / 15 : 1\n let a_scale = (hash[5] >> 4) / 15\n\n // Read the varying factors (boost saturation by 1.25x to compensate for quantization)\n let ac_start = hasAlpha ? 6 : 5\n let ac_index = 0\n let decodeChannel = (nx, ny, scale) => {\n let ac = []\n for (let cy = 0; cy < ny; cy++)\n for (let cx = cy ? 0 : 1; cx * ny < nx * (ny - cy); cx++)\n ac.push((((hash[ac_start + (ac_index >> 1)] >> ((ac_index++ & 1) << 2)) & 15) / 7.5 - 1) * scale)\n return ac\n }\n let l_ac = decodeChannel(lx, ly, l_scale)\n let p_ac = decodeChannel(3, 3, p_scale * 1.25)\n let q_ac = decodeChannel(3, 3, q_scale * 1.25)\n let a_ac = hasAlpha && decodeChannel(5, 5, a_scale)\n\n // Decode using the DCT into RGB\n let ratio = thumbHashToApproximateAspectRatio(hash)\n let w = round(ratio > 1 ? 32 : 32 * ratio)\n let h = round(ratio > 1 ? 32 / ratio : 32)\n let rgba = new Uint8Array(w * h * 4), fx = [], fy = []\n for (let y = 0, i = 0; y < h; y++) {\n for (let x = 0; x < w; x++, i += 4) {\n let l = l_dc, p = p_dc, q = q_dc, a = a_dc\n\n // Precompute the coefficients\n for (let cx = 0, n = max(lx, hasAlpha ? 5 : 3); cx < n; cx++)\n fx[cx] = cos(PI / w * (x + 0.5) * cx)\n for (let cy = 0, n = max(ly, hasAlpha ? 5 : 3); cy < n; cy++)\n fy[cy] = cos(PI / h * (y + 0.5) * cy)\n\n // Decode L\n for (let cy = 0, j = 0; cy < ly; cy++)\n for (let cx = cy ? 0 : 1, fy2 = fy[cy] * 2; cx * ly < lx * (ly - cy); cx++, j++)\n l += l_ac[j] * fx[cx] * fy2\n\n // Decode P and Q\n for (let cy = 0, j = 0; cy < 3; cy++) {\n for (let cx = cy ? 0 : 1, fy2 = fy[cy] * 2; cx < 3 - cy; cx++, j++) {\n let f = fx[cx] * fy2\n p += p_ac[j] * f\n q += q_ac[j] * f\n }\n }\n\n // Decode A\n if (hasAlpha)\n for (let cy = 0, j = 0; cy < 5; cy++)\n for (let cx = cy ? 0 : 1, fy2 = fy[cy] * 2; cx < 5 - cy; cx++, j++)\n a += a_ac[j] * fx[cx] * fy2\n\n // Convert to RGB\n let b = l - 2 / 3 * p\n let r = (3 * l - b + q) / 2\n let g = r - q\n rgba[i] = max(0, 255 * min(1, r))\n rgba[i + 1] = max(0, 255 * min(1, g))\n rgba[i + 2] = max(0, 255 * min(1, b))\n rgba[i + 3] = max(0, 255 * min(1, a))\n }\n }\n return { w, h, rgba }\n}\n\n/**\n * Extracts the average color from a ThumbHash. RGB is not be premultiplied by A.\n *\n * @param hash The bytes of the ThumbHash.\n * @returns The RGBA values for the average color. Each value ranges from 0 to 1.\n */\nexport function thumbHashToAverageRGBA(hash) {\n let { min, max } = Math\n let header = hash[0] | (hash[1] << 8) | (hash[2] << 16)\n let l = (header & 63) / 63\n let p = ((header >> 6) & 63) / 31.5 - 1\n let q = ((header >> 12) & 63) / 31.5 - 1\n let hasAlpha = header >> 23\n let a = hasAlpha ? (hash[5] & 15) / 15 : 1\n let b = l - 2 / 3 * p\n let r = (3 * l - b + q) / 2\n let g = r - q\n return {\n r: max(0, min(1, r)),\n g: max(0, min(1, g)),\n b: max(0, min(1, b)),\n a\n }\n}\n\n/**\n * Extracts the approximate aspect ratio of the original image.\n *\n * @param hash The bytes of the ThumbHash.\n * @returns The approximate aspect ratio (i.e. width / height).\n */\nexport function thumbHashToApproximateAspectRatio(hash) {\n let header = hash[3]\n let hasAlpha = hash[2] & 0x80\n let isLandscape = hash[4] & 0x80\n let lx = isLandscape ? hasAlpha ? 5 : 7 : header & 7\n let ly = isLandscape ? header & 7 : hasAlpha ? 5 : 7\n return lx / ly\n}\n\n/**\n * Encodes an RGBA image to a PNG data URL. RGB should not be premultiplied by\n * A. This is optimized for speed and simplicity and does not optimize for size\n * at all. This doesn't do any compression (all values are stored uncompressed).\n *\n * @param w The width of the input image. Must be ≤100px.\n * @param h The height of the input image. Must be ≤100px.\n * @param rgba The pixels in the input image, row-by-row. Must have w*h*4 elements.\n * @returns A data URL containing a PNG for the input image.\n */\nexport function rgbaToDataURL(w, h, rgba) {\n let row = w * 4 + 1\n let idat = 6 + h * (5 + row)\n let bytes = [\n 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0,\n w >> 8, w & 255, 0, 0, h >> 8, h & 255, 8, 6, 0, 0, 0, 0, 0, 0, 0,\n idat >>> 24, (idat >> 16) & 255, (idat >> 8) & 255, idat & 255,\n 73, 68, 65, 84, 120, 1\n ]\n let table = [\n 0, 498536548, 997073096, 651767980, 1994146192, 1802195444, 1303535960,\n 1342533948, -306674912, -267414716, -690576408, -882789492, -1687895376,\n -2032938284, -1609899400, -1111625188\n ]\n let a = 1, b = 0\n for (let y = 0, i = 0, end = row - 1; y < h; y++, end += row - 1) {\n bytes.push(y + 1 < h ? 0 : 1, row & 255, row >> 8, ~row & 255, (row >> 8) ^ 255, 0)\n for (b = (b + a) % 65521; i < end; i++) {\n let u = rgba[i] & 255\n bytes.push(u)\n a = (a + u) % 65521\n b = (b + a) % 65521\n }\n }\n bytes.push(\n b >> 8, b & 255, a >> 8, a & 255, 0, 0, 0, 0,\n 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130\n )\n for (let [start, end] of [[12, 29], [37, 41 + idat]]) {\n let c = ~0\n for (let i = start; i < end; i++) {\n c ^= bytes[i]\n c = (c >>> 4) ^ table[c & 15]\n c = (c >>> 4) ^ table[c & 15]\n }\n c = ~c\n bytes[end++] = c >>> 24\n bytes[end++] = (c >> 16) & 255\n bytes[end++] = (c >> 8) & 255\n bytes[end++] = c & 255\n }\n return 'data:image/png;base64,' + btoa(String.fromCharCode(...bytes))\n}\n\n/**\n * Decodes a ThumbHash to a PNG data URL. This is a convenience function that\n * just calls \"thumbHashToRGBA\" followed by \"rgbaToDataURL\".\n *\n * @param hash The bytes of the ThumbHash.\n * @returns A data URL containing a PNG for the rendered ThumbHash.\n */\nexport function thumbHashToDataURL(hash) {\n let image = thumbHashToRGBA(hash)\n return rgbaToDataURL(image.w, image.h, image.rgba)\n}\n"],"ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134],"mappings":"2jBACA,IAAMiB,GAAc,EAAM,EAAS,EAAM,KAAU,CAClD,OACA,UACA,OACA,MACD,GAGMC,GAAY,EAAG,IAAM,CAC1B,IAAIC,EAAM,MAAM,KAAK,CAAE,OAAQC,EAAE,OAAS,CAAE,GAAI,EAAG,IAAMC,CAAC,EAC1D,IAAK,IAAIA,EAAI,EAAGA,GAAKT,EAAE,OAAQ,IAAK,CACnC,IAAMU,EAAO,CAACD,CAAC,EACf,IAAK,IAAIE,EAAI,EAAGA,GAAKH,EAAE,OAAQ,IAAK,CACnC,IAAMI,EAAOZ,EAAES,EAAI,KAAOD,EAAEG,EAAI,GAAK,EAAI,EACzC,EAAKA,GAAK,KAAK,IAAIJ,EAAII,GAAK,EAAGD,EAAKC,EAAI,GAAK,EAAGJ,EAAII,EAAI,GAAKC,CAAI,CAClE,CACA,EAAMF,CACP,CACA,OAAOH,EAAIC,EAAE,OACd,EAEMK,GAAW,EAAM,IAAe,CACrC,IAAMC,EAAQC,EAAK,YAAY,EACzBC,EAAOC,EAAW,IAAK,IAAe,CAC3C,YACA,MAAOX,EAASQ,EAAOI,EAAU,YAAY,CAAC,CAC/C,EAAE,CAAC,CAAC,MAAM,EAAG,IAAMlB,EAAE,MAAQQ,EAAE,KAAK,CAAC,CAA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A,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,GAAG,EACVC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,KACA,KACA,IACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,GAAG,EACVC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,KAAM,GAAG,EAChBC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,GAAG,EACVC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,GAAG,EACVC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,GAAG,EACVC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,KACA,KACA,IACA,GACD,EACAC,GAAM,CAAC,GAAG,EACVC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,GAAG,EACVC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CAAC,KAAM,GAAG,EAChBC,GAAM,CAAC,GAAG,EACVC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,IACA,GACD,EACAC,GAAM,CACL,KACA,KACA,IACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,KACA,IACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,GAAG,EACVC,GAAM,CACL,KACA,KACA,IACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,KACA,KACA,IACA,GACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,GAAG,EACVC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CAAC,GAAG,EACVC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CAAC,GAAG,EACVC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,GAAG,EACVC,GAAM,CAAC,GAAG,EACVC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,KACA,KACA,IACA,GACD,EACAC,GAAM,CACL,KACA,KACA,IACA,GACD,EACAC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CACL,KACA,KACA,IACA,GACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CACL,IACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CAAC,IAAK,GAAG,EACfC,GAAM,CACL,IACA,KACA,GACD,EACAC,GAAM,CACL,IACA,KACA,KACA,GACD,EACAC,GAAM,CAAC,IAAK,IAAI,EAChBC,GAAM,CACL,IACA,IACA,KACA,IACD,EACAC,GAAM,CACL,IACA,KACA,IACA,IACD,EACAC,GAAM,CAAC,IAAK,GAAG,EACf,QAAS,CACR,IACA,IACA,KACA,IACD,EACA,SAAU,CACT,IACA,KACA,KACA,GACD,EACA,QAAS,CACR,IACA,IACA,IACD,EACA,SAAU,CACT,IACA,KACA,IACA,IACD,EACA,QAAS,CACR,IACA,KACA,IACA,IACD,EACA,QAAS,CACR,IACA,IACA,KACA,IACD,EACA,QAAS,CACR,IACA,KACA,IACA,IACD,EACA,QAAS,CACR,IACA,IACA,KACA,IACD,EACA,QAAS,CACR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