reactiveadmin 0.2.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 (260) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +88 -0
  3. data/LICENSE +21 -0
  4. data/README.md +81 -0
  5. data/app/assets/reactive_admin/bridge.js +89 -0
  6. data/app/controllers/reactive_admin/api_controller.rb +30 -0
  7. data/app/controllers/reactive_admin/client_errors_controller.rb +38 -0
  8. data/app/controllers/reactive_admin/manifest_controller.rb +10 -0
  9. data/app/controllers/reactive_admin/mcp_controller.rb +48 -0
  10. data/app/controllers/reactive_admin/openapi_controller.rb +13 -0
  11. data/app/controllers/reactive_admin/session_controller.rb +11 -0
  12. data/app/views/layouts/reactive_admin/embed.html.erb +30 -0
  13. data/lib/generators/reactiveadmin/install/install_generator.rb +341 -0
  14. data/lib/generators/reactiveadmin/install/templates/menu.rb.tt +25 -0
  15. data/lib/generators/reactiveadmin/install/templates/reactive_admin.rb.tt +53 -0
  16. data/lib/generators/reactiveadmin/install/templates/reactive_admin_annotated.rb.tt +110 -0
  17. data/lib/reactive_admin/aa/v3/controller.rb +76 -0
  18. data/lib/reactive_admin/aa/v3/forms.rb +29 -0
  19. data/lib/reactive_admin/aa/v3/inputs/filters/typeahead_input.rb +51 -0
  20. data/lib/reactive_admin/aa/v3/inputs/typeahead_input.rb +8 -0
  21. data/lib/reactive_admin/aa/v3/install.rb +36 -0
  22. data/lib/reactive_admin/aa/v3/menu.rb +67 -0
  23. data/lib/reactive_admin/aa/v3/presenters.rb +102 -0
  24. data/lib/reactive_admin/aa/v3/registry.rb +78 -0
  25. data/lib/reactive_admin/aa/v3/views.rb +63 -0
  26. data/lib/reactive_admin/aa/v3.rb +23 -0
  27. data/lib/reactive_admin/aa/v4.rb +59 -0
  28. data/lib/reactive_admin/aa.rb +46 -0
  29. data/lib/reactive_admin/action_items.rb +39 -0
  30. data/lib/reactive_admin/action_links.rb +197 -0
  31. data/lib/reactive_admin/action_safety.rb +19 -0
  32. data/lib/reactive_admin/actions.rb +95 -0
  33. data/lib/reactive_admin/api_errors.rb +116 -0
  34. data/lib/reactive_admin/api_fallback.rb +15 -0
  35. data/lib/reactive_admin/api_guards.rb +445 -0
  36. data/lib/reactive_admin/audit.rb +72 -0
  37. data/lib/reactive_admin/auth/guard.rb +68 -0
  38. data/lib/reactive_admin/auth/token_requests.rb +15 -0
  39. data/lib/reactive_admin/auth.rb +135 -0
  40. data/lib/reactive_admin/authorizer.rb +47 -0
  41. data/lib/reactive_admin/background_requests.rb +33 -0
  42. data/lib/reactive_admin/batch_actions.rb +57 -0
  43. data/lib/reactive_admin/choices.rb +289 -0
  44. data/lib/reactive_admin/client_error.rb +70 -0
  45. data/lib/reactive_admin/composite_keys.rb +12 -0
  46. data/lib/reactive_admin/configuration.rb +221 -0
  47. data/lib/reactive_admin/controller_extension.rb +229 -0
  48. data/lib/reactive_admin/csv_injection.rb +26 -0
  49. data/lib/reactive_admin/date_bound.rb +31 -0
  50. data/lib/reactive_admin/degradation.rb +72 -0
  51. data/lib/reactive_admin/diagnostics.rb +16 -0
  52. data/lib/reactive_admin/doctor.rb +466 -0
  53. data/lib/reactive_admin/dry_run.rb +147 -0
  54. data/lib/reactive_admin/dry_run_flag.rb +18 -0
  55. data/lib/reactive_admin/embed.rb +73 -0
  56. data/lib/reactive_admin/engine.rb +47 -0
  57. data/lib/reactive_admin/error_keys.rb +23 -0
  58. data/lib/reactive_admin/exposure.rb +86 -0
  59. data/lib/reactive_admin/filters.rb +165 -0
  60. data/lib/reactive_admin/fixtures/scrubber.rb +1075 -0
  61. data/lib/reactive_admin/fixtures.rb +161 -0
  62. data/lib/reactive_admin/form_content.rb +78 -0
  63. data/lib/reactive_admin/form_field.rb +279 -0
  64. data/lib/reactive_admin/form_has_many.rb +116 -0
  65. data/lib/reactive_admin/form_lock.rb +71 -0
  66. data/lib/reactive_admin/form_payload.rb +57 -0
  67. data/lib/reactive_admin/form_recorder.rb +192 -0
  68. data/lib/reactive_admin/form_schema.rb +160 -0
  69. data/lib/reactive_admin/frame.rb +97 -0
  70. data/lib/reactive_admin/html_nodes.rb +390 -0
  71. data/lib/reactive_admin/html_policy.rb +338 -0
  72. data/lib/reactive_admin/html_rich.rb +186 -0
  73. data/lib/reactive_admin/implicit_defaults.rb +102 -0
  74. data/lib/reactive_admin/index_options.rb +41 -0
  75. data/lib/reactive_admin/index_payload.rb +259 -0
  76. data/lib/reactive_admin/index_recorder.rb +115 -0
  77. data/lib/reactive_admin/index_views.rb +85 -0
  78. data/lib/reactive_admin/inline_style.rb +125 -0
  79. data/lib/reactive_admin/labels_payload.rb +34 -0
  80. data/lib/reactive_admin/ladder.rb +268 -0
  81. data/lib/reactive_admin/layout_classes.rb +167 -0
  82. data/lib/reactive_admin/legacy_inventory.rb +547 -0
  83. data/lib/reactive_admin/location.rb +22 -0
  84. data/lib/reactive_admin/lookup_audit.rb +30 -0
  85. data/lib/reactive_admin/lookup_payload.rb +41 -0
  86. data/lib/reactive_admin/manifest.rb +36 -0
  87. data/lib/reactive_admin/masked_json.rb +62 -0
  88. data/lib/reactive_admin/masking.rb +100 -0
  89. data/lib/reactive_admin/mcp/access.rb +111 -0
  90. data/lib/reactive_admin/mcp/api.rb +123 -0
  91. data/lib/reactive_admin/mcp/count_tool.rb +22 -0
  92. data/lib/reactive_admin/mcp/layout.rb +175 -0
  93. data/lib/reactive_admin/mcp/output.rb +46 -0
  94. data/lib/reactive_admin/mcp/prompts.rb +111 -0
  95. data/lib/reactive_admin/mcp/server.rb +134 -0
  96. data/lib/reactive_admin/mcp/shapes.rb +164 -0
  97. data/lib/reactive_admin/mcp/tools.rb +386 -0
  98. data/lib/reactive_admin/mcp.rb +53 -0
  99. data/lib/reactive_admin/media_nodes.rb +34 -0
  100. data/lib/reactive_admin/menu.rb +90 -0
  101. data/lib/reactive_admin/menu_overlay.rb +291 -0
  102. data/lib/reactive_admin/node_registry.rb +47 -0
  103. data/lib/reactive_admin/open_api/builder.rb +156 -0
  104. data/lib/reactive_admin/open_api/context.rb +46 -0
  105. data/lib/reactive_admin/open_api/core.rb +51 -0
  106. data/lib/reactive_admin/open_api/operation_ids.rb +18 -0
  107. data/lib/reactive_admin/open_api/page_doc.rb +75 -0
  108. data/lib/reactive_admin/open_api/parts.rb +86 -0
  109. data/lib/reactive_admin/open_api/resource_doc.rb +423 -0
  110. data/lib/reactive_admin/open_api/security.rb +55 -0
  111. data/lib/reactive_admin/open_api/write_schema.rb +104 -0
  112. data/lib/reactive_admin/open_api.rb +41 -0
  113. data/lib/reactive_admin/option_source.rb +36 -0
  114. data/lib/reactive_admin/option_sources.rb +14 -0
  115. data/lib/reactive_admin/options_payload.rb +61 -0
  116. data/lib/reactive_admin/page_controller_extension.rb +112 -0
  117. data/lib/reactive_admin/page_forms.rb +181 -0
  118. data/lib/reactive_admin/page_payload.rb +120 -0
  119. data/lib/reactive_admin/param_normalizer.rb +89 -0
  120. data/lib/reactive_admin/paths.rb +63 -0
  121. data/lib/reactive_admin/permissions.rb +31 -0
  122. data/lib/reactive_admin/provenance.rb +57 -0
  123. data/lib/reactive_admin/query_guard.rb +108 -0
  124. data/lib/reactive_admin/ransack_guard.rb +107 -0
  125. data/lib/reactive_admin/rate_limit.rb +59 -0
  126. data/lib/reactive_admin/reactive_dsl.rb +99 -0
  127. data/lib/reactive_admin/readiness.rb +189 -0
  128. data/lib/reactive_admin/registry.rb +69 -0
  129. data/lib/reactive_admin/resource_meta.rb +120 -0
  130. data/lib/reactive_admin/resource_summary.rb +41 -0
  131. data/lib/reactive_admin/routes.rb +60 -0
  132. data/lib/reactive_admin/row_errors.rb +29 -0
  133. data/lib/reactive_admin/rspec.rb +116 -0
  134. data/lib/reactive_admin/scrubbed_error.rb +22 -0
  135. data/lib/reactive_admin/search.rb +79 -0
  136. data/lib/reactive_admin/server_timing.rb +31 -0
  137. data/lib/reactive_admin/show_payload.rb +88 -0
  138. data/lib/reactive_admin/sidebars.rb +34 -0
  139. data/lib/reactive_admin/site.rb +55 -0
  140. data/lib/reactive_admin/style_report.rb +129 -0
  141. data/lib/reactive_admin/style_sources.rb +83 -0
  142. data/lib/reactive_admin/template_actions.rb +126 -0
  143. data/lib/reactive_admin/template_content.rb +49 -0
  144. data/lib/reactive_admin/template_form.rb +442 -0
  145. data/lib/reactive_admin/test_support.rb +31 -0
  146. data/lib/reactive_admin/typeahead.rb +33 -0
  147. data/lib/reactive_admin/ui/assets.rb +91 -0
  148. data/lib/reactive_admin/ui/client_build.rb +47 -0
  149. data/lib/reactive_admin/ui/helper.rb +24 -0
  150. data/lib/reactive_admin/ui/packaged_client.rb +67 -0
  151. data/lib/reactive_admin/ui/shell.rb +81 -0
  152. data/lib/reactive_admin/ui/switch.rb +38 -0
  153. data/lib/reactive_admin/ui.rb +43 -0
  154. data/lib/reactive_admin/value_payload.rb +147 -0
  155. data/lib/reactive_admin/value_token.rb +36 -0
  156. data/lib/reactive_admin/values.rb +43 -0
  157. data/lib/reactive_admin/version.rb +3 -0
  158. data/lib/reactive_admin/write_audit.rb +60 -0
  159. data/lib/reactive_admin/write_guards.rb +142 -0
  160. data/lib/reactive_admin.rb +153 -0
  161. data/lib/reactiveadmin.rb +1 -0
  162. data/lib/tasks/reactiveadmin.rake +36 -0
  163. data/lib/tasks/reactiveadmin_client.rake +11 -0
  164. data/lib/tasks/reactiveadmin_legacy.rake +7 -0
  165. data/lib/tasks/reactiveadmin_styles.rake +6 -0
  166. data/openapi/core.yaml +1643 -0
  167. data/vendor/client/assets/ActionPage-XUYorI8E.js +1 -0
  168. data/vendor/client/assets/ActionView-BsZFcsgp.js +1 -0
  169. data/vendor/client/assets/CommandPalette-C59HT1ip.js +1 -0
  170. data/vendor/client/assets/DatePicker-DuaK0iMg.js +1 -0
  171. data/vendor/client/assets/DateRangeCalendar-B2BDsG-X.js +1 -0
  172. data/vendor/client/assets/DegradedNotice-DiH5n2DO.js +1 -0
  173. data/vendor/client/assets/FormDialog-pmYl8Eov.js +1 -0
  174. data/vendor/client/assets/FormSkeleton-DuSBZO3C.js +1 -0
  175. data/vendor/client/assets/FrameView-2X8cFvUt.css +1 -0
  176. data/vendor/client/assets/FrameView-zmUeDO8d.js +1 -0
  177. data/vendor/client/assets/GroupOverview-DI5T3k5K.js +1 -0
  178. data/vendor/client/assets/InlineForm-CMEIMgeh.js +1 -0
  179. data/vendor/client/assets/JsonDiff-o7JWr7CH.js +3 -0
  180. data/vendor/client/assets/JsonEditor-D4VXdlEx.js +1 -0
  181. data/vendor/client/assets/JsonView-BrJLDmSN.js +1 -0
  182. data/vendor/client/assets/MobileMenu-GAeFOeEb.js +1 -0
  183. data/vendor/client/assets/Node-SQl61V4K.js +2 -0
  184. data/vendor/client/assets/PageView-C-laNEPZ.js +1 -0
  185. data/vendor/client/assets/ResourceForm-BPjsoCY6.js +1 -0
  186. data/vendor/client/assets/ResourceIndex-COezAw5t.js +3 -0
  187. data/vendor/client/assets/ResourceOrPage-CRZGCY84.js +1 -0
  188. data/vendor/client/assets/ResourceShow-DweRXn18.js +1 -0
  189. data/vendor/client/assets/Segmented-BE9TCbph.js +1 -0
  190. data/vendor/client/assets/Sidebars-CsB9rFqX.js +1 -0
  191. data/vendor/client/assets/breadcrumb-DSA3Tlyd.js +1 -0
  192. data/vendor/client/assets/button-CvZ4_DFC.js +1 -0
  193. data/vendor/client/assets/calendar-BoyMpJIf.js +1 -0
  194. data/vendor/client/assets/check-C5A3J16N.js +1 -0
  195. data/vendor/client/assets/command-CMuk0oAt.js +1 -0
  196. data/vendor/client/assets/dist-CqEI82S_.js +1 -0
  197. data/vendor/client/assets/dist-IW4yX942.js +1 -0
  198. data/vendor/client/assets/editor-yqRLzgsJ.js +2 -0
  199. data/vendor/client/assets/external-link-C2aR4slL.js +1 -0
  200. data/vendor/client/assets/frames-C9gPCc3N.js +1 -0
  201. data/vendor/client/assets/humanize-DtU_Kpr4.js +1 -0
  202. data/vendor/client/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  203. data/vendor/client/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  204. data/vendor/client/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
  205. data/vendor/client/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
  206. data/vendor/client/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  207. data/vendor/client/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  208. data/vendor/client/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
  209. data/vendor/client/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
  210. data/vendor/client/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  211. data/vendor/client/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  212. data/vendor/client/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  213. data/vendor/client/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  214. data/vendor/client/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  215. data/vendor/client/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  216. data/vendor/client/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
  217. data/vendor/client/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
  218. data/vendor/client/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  219. data/vendor/client/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  220. data/vendor/client/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
  221. data/vendor/client/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
  222. data/vendor/client/assets/ibm-plex-sans-cyrillic-ext-wght-normal-d45eAU9y.woff2 +0 -0
  223. data/vendor/client/assets/ibm-plex-sans-cyrillic-wght-normal-BAAhND-U.woff2 +0 -0
  224. data/vendor/client/assets/ibm-plex-sans-greek-wght-normal-CmyJS8uq.woff2 +0 -0
  225. data/vendor/client/assets/ibm-plex-sans-latin-ext-wght-normal-CIII54If.woff2 +0 -0
  226. data/vendor/client/assets/ibm-plex-sans-latin-wght-normal-IvpUvPa2.woff2 +0 -0
  227. data/vendor/client/assets/ibm-plex-sans-vietnamese-wght-normal-Dg1JeJN0.woff2 +0 -0
  228. data/vendor/client/assets/index-B51aUaAY.js +43 -0
  229. data/vendor/client/assets/index-Cs9rCoWM.css +2 -0
  230. data/vendor/client/assets/input-DByFmQPa.js +1 -0
  231. data/vendor/client/assets/json-De3PN-R6.css +1 -0
  232. data/vendor/client/assets/json-oTp7Q-d-.js +5 -0
  233. data/vendor/client/assets/media-D4a_En8R.js +1 -0
  234. data/vendor/client/assets/plus-CfJ9vo8X.js +1 -0
  235. data/vendor/client/assets/popover-CDtI9R8Q.js +1 -0
  236. data/vendor/client/assets/purify-G7QKJyJq.js +1 -0
  237. data/vendor/client/assets/query-CCsZN2fa.js +1 -0
  238. data/vendor/client/assets/recent-BrzLwL0D.js +1 -0
  239. data/vendor/client/assets/rich-BQc_q5T7.js +1 -0
  240. data/vendor/client/assets/rolldown-runtime-XKyaHtl9.js +1 -0
  241. data/vendor/client/assets/select-C43qDA3k.js +1 -0
  242. data/vendor/client/assets/sheet-BPl2n-4n.js +1 -0
  243. data/vendor/client/assets/textarea-BnOphXry.js +1 -0
  244. data/vendor/client/assets/uiMode-z0ZbRV49.js +1 -0
  245. data/vendor/client/assets/uiToggle-DwnRQTH1.js +1 -0
  246. data/vendor/client/assets/useRecordForm-X_DExEP2.js +1 -0
  247. data/vendor/client/assets/useRecordVisit-BRtfMi-q.js +1 -0
  248. data/vendor/client/assets/utils-DwBGbDkG.js +1 -0
  249. data/vendor/client/assets/vendor-calendar-nTZiq9oY.js +1 -0
  250. data/vendor/client/assets/vendor-datefns-BoC6MCnl.js +1 -0
  251. data/vendor/client/assets/vendor-forms-D0h8hG_S.js +55 -0
  252. data/vendor/client/assets/vendor-purify-BXoPR7WT.js +3 -0
  253. data/vendor/client/assets/vendor-query-DZ6APRNI.js +1 -0
  254. data/vendor/client/assets/vendor-react-C1iE8mnY.js +9 -0
  255. data/vendor/client/assets/vendor-router-CI6Vh4k_.js +1 -0
  256. data/vendor/client/assets/vendor-table-DuQ835by.js +4 -0
  257. data/vendor/client/index.html +24 -0
  258. data/vendor/client/manifest.json +867 -0
  259. data/vendor/client/reactiveadmin-client.json +4 -0
  260. metadata +350 -0
@@ -0,0 +1,55 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t}from"./vendor-react-C1iE8mnY.js";var n=e(t(),1),r=e=>e.type===`checkbox`,i=e=>e.type===`file`,a=e=>e instanceof Date,o=e=>e==null,s=e=>typeof e==`object`,c=e=>!o(e)&&!Array.isArray(e)&&s(e)&&!a(e),l=e=>c(e)&&e.target?r(e.target)?e.target.checked:i(e.target)?e.target.files:e.target.value:e,u=/[.[\]'"]/,d=e=>e.split(u).filter(Boolean);function f(e,t){let n=d(t),r=e._formValues,i=e._defaultValues;for(let e=0;e<n.length-1;e++){let t=n[e];if(r=r==null?r:r[t],i=i==null?i:i[t],r===null||i===null)return null}}var p=(e,t)=>t.split(`.`).some((t,n,r)=>!isNaN(Number(t))&&e.has(r.slice(0,n).join(`.`))),m=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function h(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e);let t=typeof Blob<`u`&&e instanceof Blob,n=typeof FileList<`u`&&e instanceof FileList;if(m&&(t||n))return e;let r=Array.isArray(e),i=Object.getPrototypeOf(e);if(!r&&i&&i.constructor!==Object)return e;let a=r?Array(e.length):Object.create(i);for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(a[t]=h(e[t]));return a}var g={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`,SUBMIT:`submit`,TRIGGER:`trigger`,VALID:`valid`},_={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},v={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},y=[v.required,v.min,v.max,v.minLength,v.maxLength,v.pattern,v.validate],b=`form`,x=`root`,S=[`__proto__`,`constructor`,`prototype`],C=/^\w*$/,w=e=>C.test(e),T=e=>e===void 0,E=(e,t,n)=>{if(!t||!c(e))return n;let r=w(t)?[t]:d(t);if(r.some(e=>S.includes(e)))return n;let i=r.reduce((e,t)=>o(e)?void 0:e[t],e);return T(i)||i===e?T(e[t])?n:e[t]:i},D=e=>typeof e==`boolean`,O=e=>typeof e==`function`,k=(e,t,n)=>{let r=-1,i=w(t)?[t]:d(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=c(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(S.includes(t))return;e[t]=a,e=e[t]}},A=n.createContext(null);A.displayName=`HookFormControlContext`;var j=()=>n.useContext(A),M=(e,t,n,r=!0)=>{let i={};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==_.all&&(t._proxyFormState[i]=!r||_.all),n&&(n[i]=!0),e[i]}});return i},N=typeof window<`u`?n.useLayoutEffect:n.useEffect,ee=e=>{let t=e.constructor&&e.constructor.prototype;return c(t)&&t.hasOwnProperty(`isPrototypeOf`)},te=e=>o(e)||!s(e),ne=(e,t)=>t.length===0&&!Array.isArray(e)&&Object.getPrototypeOf(e)!==null&&!ee(e);function P(e,t,n=!1,r=new WeakMap){if(e===t)return!0;if(te(e)||te(t))return Object.is(e,t);if(a(e)&&a(t))return Object.is(e.getTime(),t.getTime());if(Array.isArray(e)&&Array.isArray(t)&&e.length!==t.length)return!1;let i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;if(ne(e,i)||ne(t,o))return Object.is(e,t);if(!i.length&&Array.isArray(e)!==Array.isArray(t))return!1;let s=r.get(e);if(s&&s.has(t))return!0;if(s)s.add(t);else{let n=new WeakSet;n.add(t),r.set(e,n)}for(let o of i){let i=e[o];if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!n||o!==`ref`){let e=t[o];if(a(i)&&a(e)||(c(i)||Array.isArray(i))&&(c(e)||Array.isArray(e))?!P(i,e,n,r):!Object.is(i,e))return!1}}return!0}var re=({defaultValues:e,...t})=>({...h(t),defaultValues:e});function ie(e,t=h){let r=n.useRef(!1),i=n.useRef(!1),a=n.useRef(void 0),o=n.useRef(0);return o.current++,!i.current&&e&&(i.current=!0,a.current=t(e())),{resyncIfNeeded:n.useCallback((e,t,n)=>{if(e&&(r.current||i.current&&o.current>1)){let e=t();P(a.current,e)||n(e)}r.current=!0},[]),snapshot:n.useCallback((e,n)=>{e&&(a.current=t(n()))},[t])}}function F(e){let t=j(),{control:r=t,disabled:i,name:a,exact:o}=e||{},s=()=>({...r._formState,defaultValues:r._defaultValues}),[c,l]=n.useState(s),u=n.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),{resyncIfNeeded:d,snapshot:f}=ie(s,re);return N(()=>{d(!i,s,l);let e=r._subscribe({name:a,formState:u.current,exact:o,callback:e=>{!i&&l({...r._formState,...e,defaultValues:r._defaultValues})}});return()=>{e(),f(!i,s)}},[r,a,i,o,d,f]),n.useEffect(()=>{u.current.isValid&&r._setValid(!0)},[r]),n.useMemo(()=>M(c,r,u.current,!1),[c,r])}var I=e=>typeof e==`string`,ae=(e,t,n,r,i)=>I(e)?(r&&t.watch.add(e),E(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),E(n,e,E(i,e)))):(r&&(t.watchAll=!0),n);function oe(e){let t=j(),{control:r=t,name:i,defaultValue:a,disabled:o,exact:s,compute:c}=e||{},l=n.useRef(a),u=n.useRef(c),d=n.useRef(r),f=n.useRef(i);u.current=c;let p=()=>{let e=r._getWatch(i,l.current);return u.current?u.current(e):e},[m,g]=n.useState(p),_=n.useRef(m),v=n.useCallback(e=>{let t=ae(i,r._names,e||r._formValues,!1,l.current);return u.current?u.current(t):t},[r._formValues,r._names,i]),y=n.useCallback(e=>{if(!o){let t=ae(i,r._names,e||r._formValues,!1,l.current);if(u.current){let e=u.current(t);P(e,_.current)||(g(e),_.current=e)}else g(t),_.current=t}},[r._formValues,r._names,o,i]),{resyncIfNeeded:b,snapshot:x}=ie(p),S=n.useRef(y);S.current=y;let C=n.useRef(v);C.current=v,N(()=>{d.current!==r||!P(f.current,i)?(d.current=r,f.current=i,S.current()):b(!o,()=>C.current(),e=>{let t=h(e);g(t),_.current=t});let e=r._subscribe({name:i,formState:{values:!0},exact:s,callback:e=>{S.current(e.values)}});return()=>{e(),x(!o,()=>C.current())}},[r,s,i,o,b,x]),n.useEffect(()=>r._removeUnmounted());let w=d.current!==r,T=f.current,E=n.useMemo(()=>!w&&!P(T,i),[w,i,T]);return(w||E)&&(l.current=a),!o&&(w||E)?v():m}function L(e){let t=j(),{name:r,disabled:i,control:a=t,shouldUnregister:o,defaultValue:s,exact:c=!0}=e,u=p(a._names.array,r),d=oe({control:a,name:r,defaultValue:n.useMemo(()=>{let e=E(a._formValues,r,E(a._defaultValues,r,s));return T(e)?f(a,r):e},[a,r,s]),exact:c}),m=F({control:a,name:r,exact:c}),_=n.useRef(e),v=n.useRef(o),y=n.useRef(null),b=n.useRef(void 0),x=n.useRef(a.register(r,{...e.rules,value:b.current===r&&!E(a._fields,r)?void 0:d,...D(e.disabled)?{disabled:e.disabled}:{}}));b.current=r,_.current=e;let S=n.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!E(m.errors,r)},isDirty:{enumerable:!0,get:()=>!!E(m.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!E(m.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!E(m.validatingFields,r)},error:{enumerable:!0,get:()=>E(m.errors,r)}}),[m,r]),C=n.useCallback(e=>{let t=l(e);return E(a._fields,r)||(x.current=a.register(r,{..._.current.rules,value:t})),x.current.onChange({target:{value:l(e),name:r},type:g.CHANGE})},[r,a]),w=n.useCallback(()=>{let e=E(a._formValues,r);return E(a._fields,r)||(x.current=a.register(r,{..._.current.rules,value:e})),x.current.onBlur({target:{value:e,name:r},type:g.BLUR})},[r,a]),A=n.useCallback(e=>{e&&(y.current={focus:()=>O(e.focus)&&e.focus(),select:()=>O(e.select)&&e.select(),setCustomValidity:t=>O(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>O(e.reportValidity)&&e.reportValidity()});let t=E(a._fields,r);t&&t._f&&e&&(t._f.ref=y.current,t._f._c=!0)},[a._fields,r]),M=n.useMemo(()=>({name:r,value:d,...D(i)||m.disabled?{disabled:m.disabled||i}:{},onChange:C,onBlur:w,ref:A}),[r,i,m.disabled,C,w,A,d]);return n.useEffect(()=>{if(v.current=o,a._options.shouldUnregister||o){let e=h(E(o?a._defaultValues:a._options.values||a._defaultValues,r,E(a._options.defaultValues,r,_.current.defaultValue)));k(a._defaultValues,r,e),T(E(a._formValues,r))&&k(a._formValues,r,e)}else!u&&!T(_.current.defaultValue)&&T(E(a._defaultValues,r))&&(k(a._defaultValues,r,h(_.current.defaultValue)),a._subjects.state.next({defaultValues:a._defaultValues}))},[a,r,u,o]),n.useEffect(()=>{x.current=a.register(r,{..._.current.rules,...D(_.current.disabled)?{disabled:_.current.disabled}:{}});let e=(e,t)=>{let n=E(a._fields,e);n&&n._f&&(n._f.mount=t,n._f._c=t)};if(e(r,!0),!u&&a.register(r,{..._.current.rules,...D(_.current.disabled)?{disabled:_.current.disabled}:{}}),y.current){let e=E(a._fields,r);e&&e._f&&(e._f.ref=y.current)}return()=>{let t=a._options.shouldUnregister||v.current;(u?t&&!a._state.action:t)?a.unregister(r):e(r,!1)}},[r,a,u]),n.useEffect(()=>{a._setDisabledField({disabled:i,name:r})},[i,r,a]),n.useMemo(()=>({field:M,formState:m,fieldState:S}),[M,m,S])}var se=e=>({isOnSubmit:!e||e===_.onSubmit,isOnBlur:e===_.onBlur,isOnChange:e===_.onChange,isOnAll:e===_.all,isOnTouch:e===_.onTouched}),ce=(e,t,n)=>{if(n)return!1;if(t.watchAll||t.watch.has(e))return!0;for(let n of t.watch)if(e.startsWith(n)&&e.charAt(n.length)===`.`)return!0;return!1},le=(e,t,n)=>{for(let r of n||Object.keys(e)){if(r===`_f`)continue;let i=n?E(e,r):e[r];if(i){let{_f:e}=i;if(e){let n=e.refs?.find(e=>!e.disabled);if(n&&t(n,e.name)||e.ref&&t(e.ref,e.name)||le(i,t))return!0}else if((c(i)||Array.isArray(i))&&le(i,t))return!0}}},ue=(e,t,n)=>{let r=E(e,n),i=Array.isArray(r)?r:[];return k(i,x,E(t[n],x,t[n])),k(e,n,i),e},R=e=>c(e)&&!Object.keys(e).length,de=e=>{if(!m)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},fe=e=>e.type===`radio`,pe=e=>e instanceof RegExp,z=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},me={value:!1,isValid:!1},he={value:!0,isValid:!0},ge=e=>{if(!Array.isArray(e))return me;if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}let t=e[0];return!t||!t.checked||t.disabled?me:!t.attributes||!(`value`in t.attributes)||T(t.value)||t.value===``?he:{value:t.value,isValid:!0}},_e={isValid:!1,value:null},B=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,_e):_e;function ve(e,t,n=`validate`){if(I(e)||Array.isArray(e)&&e.length&&e.every(I)||D(e)&&!e)return{type:n,message:I(e)?e:``,ref:t}}var V=e=>c(e)&&!pe(e)?e:{value:e,message:``},ye=async(e,t,n,s,l,u)=>{let{ref:d,refs:f,required:p,maxLength:m,minLength:h,min:g,max:_,pattern:y,validate:b,name:x,valueAsNumber:S,mount:C,_c:w}=e._f,k=E(n,x);if(!C||t.has(x))return{};let A=f?f[0]:d,j=e=>{if(l&&A.reportValidity){let t=D(e)?``:e||``;f?f.forEach(e=>O(e.setCustomValidity)&&e.setCustomValidity(t)):A.setCustomValidity(t),A.reportValidity()}},M={},N=!w&&fe(d),ee=!w&&r(d),te=N||ee,ne=(S||i(d))&&T(d.value)&&T(k)||de(d)&&d.value===``&&!w||k===``||Array.isArray(k)&&!k.length,P=z.bind(null,x,s,M),re=(e,t,n,r=v.maxLength,i=v.minLength)=>{let a=e?t:n;M[x]={type:e?r:i,message:a,ref:d,...P(e?r:i,a)}};if(u?!Array.isArray(k)||!k.length:p&&(!te&&(ne||o(k))||D(k)&&!k||ee&&!ge(f).isValid||N&&!B(f).isValid)){let{value:e,message:t}=I(p)?{value:!!p,message:p}:V(p);if(e&&(M[x]={type:v.required,message:t,ref:A,...P(v.required,t)},!s))return j(t),M}if(!ne&&(!o(g)||!o(_))){let e,t,n=V(_),r=V(g);if(!o(k)&&!a(k)&&!isNaN(k)){let i=!w&&d.valueAsNumber||k&&+k;o(n.value)||(e=i>n.value),o(r.value)||(t=i<r.value)}else{let i=!w&&d.valueAsDate||new Date(k),a=e=>new Date(new Date().toDateString()+` `+e),o=d.type==`time`,s=d.type==`week`;I(n.value)&&k&&(e=o?a(k)>a(n.value):s?k>n.value:i>new Date(n.value)),I(r.value)&&k&&(t=o?a(k)<a(r.value):s?k<r.value:i<new Date(r.value))}if((e||t)&&(re(!!e,n.message,r.message,v.max,v.min),!s))return j(M[x].message),M}if((!o(m)||!o(h))&&!ne&&(I(k)||u&&Array.isArray(k))){let e=V(m),t=V(h),n=!o(e.value)&&k.length>+e.value,r=!o(t.value)&&k.length<+t.value;if((n||r)&&(re(n,e.message,t.message),!s))return j(M[x].message),M}if(y&&!ne&&I(k)){let{value:e,message:t}=V(y);if(pe(e)&&!k.match(e)&&(M[x]={type:v.pattern,message:t,ref:d,...P(v.pattern,t)},!s))return j(t),M}if(b){if(O(b)){let e=ve(await b(k,n),A);if(e&&(M[x]={...e,...P(v.validate,e.message)},!s))return j(e.message),M}else if(c(b)){let e={};for(let t in b){if(!R(e)&&!s)break;let r=ve(await b[t](k,n),A,t);r&&(e={...r,...P(t,r.message)},s||j(r.message),s&&(M[x]=e))}if(!R(e)&&(M[x]={ref:A,...e},!s))return M}}let ie=M[x];return j(!ie||ie.message),M},be=e=>Array.isArray(e)?e:[e],xe=e=>Array.isArray(e)?e.filter(Boolean):[];function Se(e,t){let n=t.length-1,r=0;for(;r<n;){if(o(e)){e=void 0;break}e=e[t[r]],r++}return e}function Ce(e){for(let t in e)if(e.hasOwnProperty(t)&&!T(e[t]))return!1;return!0}function H(e,t){if(!c(e)&&!Array.isArray(e))return e;if(I(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;let n=Array.isArray(t)?t:w(t)?[t]:d(t);if(n.some(e=>S.includes(String(e))))return e;let r=n.length===1?e:Se(e,n),i=n.length-1,a=n[i];return r&&(c(r)||Array.isArray(r))&&delete r[a],i!==0&&(c(r)&&R(r)||Array.isArray(r)&&Ce(r))&&H(e,n.slice(0,-1)),e}var we=()=>{let e=new Set,t=0;return{get observers(){return Array.from(e)},next:n=>{let r=e;t++;for(let e of r)e.next&&e.next(n);r===e&&t--},subscribe:n=>(e.add(n),{unsubscribe:()=>{t&&=(e=new Set(e),0),e.delete(n)}}),unsubscribe:()=>{e=new Set,t=0}}};function Te(e,t){let n=Array.isArray(e)?[]:{};for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let i=e[r],a=t[r];i&&(c(i)||Array.isArray(i))&&a?n[r]=Te(i,a):e[r]&&(n[r]=a)}return n}var Ee=(e,t)=>e!==null&&s(e)&&Object.prototype.hasOwnProperty.call(e,t),De=(e,t)=>{if(!t)return!1;let n=e;for(let r of w(t)?[t]:d(t)){if(!Ee(n,r))return Ee(e,t);n=n[r]}return!0},Oe=e=>e.type===`select-multiple`,ke=e=>{let t=[...e.options];return!e.multiple&&e.size<2&&!t.some(e=>e.defaultSelected)?e.selectedIndex!==t.findIndex(e=>!e.disabled&&!e.parentElement?.matches(`optgroup[disabled]`)):t.some(e=>e.selected!==e.defaultSelected)},Ae=e=>r(e)?e.checked!==e.defaultChecked:e.type===`select-one`||Oe(e)?ke(e):!fe(e)&&e.type!==`range`&&e.type!==`color`&&`defaultValue`in e&&e.value!==e.defaultValue,je=e=>fe(e)||r(e),Me=e=>de(e)&&e.isConnected;function Ne(e){return Array.isArray(e)||c(e)}function Pe(e,t,n=``,r=[]){for(let i in e){let a=n?`${n}.${i}`:i,o=e[i];Ne(o)&&Ne(E(t,a))?Pe(o,t,a,r):o&&r.push(a)}return r}var Fe=e=>{for(let t in e)if(O(e[t]))return!0;return!1};function Ie(e){return Array.isArray(e)||c(e)&&!Fe(e)}function Le(e){return!!(e&&`_f`in e)}function Re(e){return Array.isArray(e)?!e.some(e=>!T(e)):!Object.keys(e).length}function ze(e,t){Array.isArray(e)?e[t]=void 0:delete e[t]}function Be(e,t={},n){for(let r in e){let i=e[r],a=n&&n[r];Ie(i)&&(!Array.isArray(i)||!Le(a))?(t[r]=Array.isArray(i)?[]:{},Be(i,t[r],a),Re(t[r])&&ze(t,r)):T(i)||(t[r]=!0)}return t}function Ve(e,t,n,r){n||=Be(t,Array.isArray(o(t)?e:t)?[]:{},r);for(let i in e){let a=e[i],s=r&&r[i];Ie(a)&&(!Array.isArray(a)||!Le(s))?(T(t)||te(n[i])?n[i]=Be(a,Array.isArray(a)?[]:{},s):Ve(a,o(t)?{}:t[i],n[i],s),Re(n[i])&&ze(n,i)):P(a,o(t)?void 0:t[i])?ze(n,i):n[i]=!0}return n}var He=(e,t)=>{let n=t.split(`.`),r=[],i=n[0];for(let t=1;t<n.length;i+=`.`+n[t++])!isNaN(+n[t])&&e.has(i)&&r.push(`${i}.${n[t]}`);return r},Ue=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>T(e)?e:t?e===``?NaN:e&&+e:n&&I(e)?new Date(e):r?r(e):e;function We(e){let t=e.ref;return i(t)?t.files:fe(t)?B(e.refs).value:Oe(t)?[...t.selectedOptions].filter(e=>!e.disabled&&!e.closest?.call(e,`optgroup[disabled]`)).map(({value:e})=>e):r(t)?ge(e.refs).value:Ue(t.value,e)}var Ge=(e,t,n,r)=>{let i={};for(let n of e){let e=E(t,n);e&&k(i,n,h(e._f))}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},Ke=e=>T(e)?e:pe(e)?e.source:c(e)?pe(e.value)?e.value.source:e.value:e,qe=`AsyncFunction`,Je=e=>{if(!e||!e.validate)return!1;if(O(e.validate))return e.validate.constructor.name===qe;if(c(e.validate)){for(let t in e.validate)if(e.validate[t].constructor.name===qe)return!0}return!1},Ye=e=>e.mount&&(e.required||!T(e.required)&&e.required!==!1||!T(e.min)||!T(e.max)||!T(e.maxLength)||!T(e.minLength)||e.pattern||e.validate);function Xe(e,t,n){let r=E(e,n);if(r&&(r.type||r.message)||Array.isArray(r))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=E(t,r),o=E(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:n}}var Ze=(e,t,n)=>{let r=Object.keys(e).filter(e=>e!==`name`);return!r.length||n&&r.length>=Object.keys(t).length||r.find(e=>t[e]===(!n||_.all))},Qe=(e,t,n)=>n?e===t||e.startsWith(t+`.`):e.startsWith(t)||t.startsWith(e),$e=(e,t,n)=>{if(!e||!t||e===t)return!0;if(!Array.isArray(e))return Qe(e,t,n);for(let r of e)if(r&&Qe(r,t,n))return!0;return!1},et=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:!(n?r.isOnChange:i.isOnChange)||e,tt=(e,t)=>{let n=E(e,t);!xe(n).length&&!(n&&n.root)&&H(e,t)},nt={mode:_.onSubmit,reValidateMode:_.onChange,shouldFocusError:!0},rt=(e,t)=>{for(let t in e)delete e[t];Object.assign(e,t)},it={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function at(e={}){let t={...nt,...e},n={...h(it),isLoading:O(t.defaultValues),errors:h(t.errors)||{},disabled:t.disabled||!1},s={},u=(c(t.defaultValues)||c(t.values))&&h(t.defaultValues||t.values)||{},f=t.shouldUnregister?{}:h(u),S={action:!1,actionArrayLengths:new Map,mount:!1,watch:!1,keepIsValid:!1},C=!1,A={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},j={},M={},N=new Set,ee=se(t.mode),te=se(t.reValidateMode),ne={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},re={...ne},ie={},F=(...e)=>e.some(e=>re[e]||ie[e]),oe=e=>{for(let t of N)if($e(t.name,e,t.exact))return!0;return!1},L={array:we(),state:we()},fe=0,pe=0,z=0,me=0,he={},ge=t.criteriaMode===_.all,_e=(e,t)=>n=>{clearTimeout(M[e]),M[e]=setTimeout(t,n)},B=e=>{clearTimeout(M[e]),delete M[e],delete j[e]},ve=e=>{B(e);let t=`${e}.`;for(let e of Object.keys(j))e.startsWith(t)&&B(e)},V=async e=>{if(!S.keepIsValid&&!t.disabled&&(F(`isValid`)||e)){let r=++fe,i=z,a;if(t.resolver?(a=R((await at()).errors),r===fe&&Ce()):a=await ct({fields:s,onlyCheckValid:!0,eventType:g.VALID}),r!==fe)return;if(i!==z)return V(e);a!==n.isValid&&L.state.next({isValid:a})}},Se=(e,t)=>{let r=[...e];if(!r.some(e=>e&&(t?E(n.validatingFields,e)!==!0:De(n.validatingFields,e))))return;let i=h(n.validatingFields);for(let e of r)e&&(t?k(i,e,!0):H(i,e));P(n.validatingFields,i)||(n.validatingFields=i)},Ce=(e,r)=>{!t.disabled&&F(`isValidating`,`validatingFields`)&&(Se(e||A.mount,r),L.state.next({validatingFields:n.validatingFields,isValidating:!R(n.validatingFields)}))},Ee=()=>{n.dirtyFields=Ve(u,f,void 0,s)},ke=(e,r=[],i,a,o=!0,c=!0)=>{if(a&&i&&!t.disabled){S.action=!0,S.keepIsValid=!1;let t=E(s,e),l=t&&t._f,u=l?Object.assign([],t):t;if(S.actionArrayLengths.has(e)||S.actionArrayLengths.set(e,Array.isArray(u)?u.length:0),c&&Array.isArray(u)){let t=i(u,a.argA,a.argB)||u;l?k(s,e,{...t,_f:l}):o&&k(s,e,t)}let d=E(n.errors,e);if(c&&Array.isArray(d)){let t=d.root,r=i(d,a.argA,a.argB)||d;t&&(r.root=t),o&&k(n.errors,e,r),tt(n.errors,e),n.errors={...n.errors}}let f=E(n.touchedFields,e),p=c&&Array.isArray(f);if(p){let t=i(f,a.argA,a.argB);o&&k(n.touchedFields,e,t)}let m=E(n.dirtyFields,e);if(c&&Array.isArray(m)){let t=i(m,a.argA,a.argB)||m;o&&k(n.dirtyFields,e,t)}F(`dirtyFields`)?Ee():C=!0,L.state.next({name:e,isDirty:ut(e,r),dirtyFields:n.dirtyFields,...p&&{touchedFields:n.touchedFields},errors:n.errors,isValid:n.isValid})}else k(f,e,r)},Ne=(e,t)=>{k(n.errors,e,t),n.errors={...n.errors},L.state.next({errors:n.errors})},Fe=e=>{Object.keys(j).forEach(B);let t=!R(e);n.errors=h(e),L.state.next({errors:n.errors,...t?{isValid:!1}:{}}),!t&&S.mount&&V()},Ie=e=>w(e)?[e]:d(e),Le=e=>{let t=Ie(e),n=f,r=u;for(let e=0;e<t.length-1;e++){let i=t[e];if(n=o(n)?n:n[i],r=o(r)?r:r[i],n===null&&r!==null)return!0}return!1},Re=e=>{if(!S.actionArrayLengths.size)return!1;let t=Ie(e),n=f,r=``,i=-1,a=0;for(let e=0;e<t.length;e++){if(o(n))return!1;let s=t[e];if(r=r?`${r}.${s}`:s,Array.isArray(n)&&+s>=n.length)return i===-1?!1:e!==i||+s<a;if(S.actionArrayLengths.has(r)&&(i=e+1,a=S.actionArrayLengths.get(r)),n=n[s],T(n)&&i!==-1&&e>i&&+t[i]<a)return!0}return!1},ze=e=>{let t=f;for(let n of Ie(e)){if(Array.isArray(t)&&+n>=t.length)return!0;t&&=t[n]}return!1},Be=(e,r,i,a)=>{let o=E(s,e);if(o){if(Le(e)||Re(e))return;let s=T(E(f,e)),c=E(f,e,T(i)?E(u,e):i),l=!!a&&!n.isReady&&Ae(a);if(T(c)||a&&a.defaultChecked||l||r){let t=r?c:We(o._f);T(t)&&ze(e)||(F(`dirtyFields`)&&!P(E(f,e),t)&&(C=!0),k(f,e,t),l&&qe(e,t))}else pt(e,c);S.mount&&!S.action&&(t.resolver&&F(`isValidating`,`validatingFields`)?Promise.resolve().then(()=>V()):V(),s&&n.isDirty&&F(`isDirty`)&&(ut()||(n.isDirty=!1,L.state.next({...n}))),t.shouldUnregister&&s&&!T(E(f,e))&&ce(e,A)&&(S.watch=!0))}},qe=(e,r,i,a,o)=>{let l=!1,d=!1,p={name:e};if(!t.disabled||a===!0){if(!i||a){let t=P(E(u,e),r);if(F(`isDirty`)&&(d=n.isDirty,n.isDirty=p.isDirty=!t||ut(),l=d!==p.isDirty),d=!!E(n.dirtyFields,e),t)H(n.dirtyFields,e);else{let t=E(u,e),i=E(s,e),a=!(i&&i._f)&&(c(t)||Array.isArray(t))?Ve(t,r,void 0,i):!0;k(n.dirtyFields,e,a)}let i=!1;if(C||t&&(F(`isDirty`)?n.isDirty:ut())){C=!1;let e=Ve(u,f,void 0,s);P(n.dirtyFields,e)||(i=!0,rt(n.dirtyFields,e))}p.dirtyFields=n.dirtyFields,l||=F(`dirtyFields`)&&(i||d!==!t)}if(i){let t=De(n.touchedFields,e)?E(n.touchedFields,e):void 0;t||(k(n.touchedFields,e,i),p.touchedFields=n.touchedFields,l||=F(`touchedFields`)&&t!==i)}l&&o&&L.state.next(p)}return l?p:{}},Qe=(e,r,i,a)=>{let o=E(n.errors,e),s=F(`isValid`)&&D(r)&&n.isValid!==r;if(t.delayError&&i?(j[e]=_e(e,()=>Ne(e,i)),j[e](t.delayError)):(B(e),i?k(n.errors,e,i):H(n.errors,e),n.errors={...n.errors}),(i?!P(o,i,!0):o)||!R(a)||s){let t={...a,...s&&D(r)?{isValid:r}:{},errors:n.errors,name:e};L.state.next(t)}},at=async e=>(Ce(e,!0),await t.resolver(f,t.context,Ge(e||A.mount,s,t.criteriaMode,t.shouldUseNativeValidation))),ot=async e=>{let t=z,r=me,i=e?e.filter(e=>E(s,e)):[],{errors:a}=await at(e);if(t!==z)return a;if(Ce(e),e){for(let t of e){if(i.includes(t)&&(!E(s,t)||he[t]>r)){H(a,t);continue}let e=E(a,t);ve(t);let o=A.array.has(t)&&c(e)&&!Object.keys(e).some(e=>!Number.isNaN(Number(e))),l=E(s,t),u=c(l)&&Object.keys(l).some(e=>e!==`_f`);o?ue(n.errors,{[t]:e},t):e&&(e.type||e.message)||Array.isArray(e)||c(e)&&u?k(n.errors,t,e):H(n.errors,t)}n.errors={...n.errors}}else Object.keys(j).forEach(B),n.errors=a;return a},st=async({name:e,eventType:r,onlyCheckValid:i})=>{if(t.validate){let a=z,o=++pe,s=await t.validate({formValues:f,formState:n,name:e,eventType:r});if(a!==z||r!==g.SUBMIT&&o!==pe)return!0;if(i&&(c(s)?Object.values(s).some(Boolean):I(s)||!s))return!1;if(c(s)){let e=!0;Ct(b);for(let t in s){let n=s[t];n&&(e=!1,W(`${b}.${t}`,{message:I(n.message)?n.message:``,type:n.type||v.validate}))}return e}return I(s)||!s?(Ct(b),W(b,{message:s||``,type:v.validate}),!1):(Ct(b),!0)}return!0},ct=async({fields:e,onlyCheckValid:r,name:i,eventType:a,context:o={valid:!0,runRootValidation:!1}})=>{let c=z;if(t.validate&&!o.runRootValidation&&(o.runRootValidation=!0,!await st({name:i,eventType:a,onlyCheckValid:r})&&(o.valid=!1,r)))return o.valid;for(let i in e){let l=e[i];if(l){let{_f:e,...u}=l;if(e){let i=A.array.has(e.name),a=l._f&&Je(l._f),u=F(`isValidating`,`validatingFields`);a&&u&&Ce([e.name],!0);let d=me,p=await ye(l,A.disabled,f,ge,t.shouldUseNativeValidation&&!r,i);if(c!==z)return o.valid;if(a&&u&&Ce([e.name]),!E(s,e.name)||he[e.name]>d)continue;if(p[e.name]&&(o.valid=!1,r)||(r||(B(e.name),E(p,e.name)?i?ue(n.errors,p,e.name):k(n.errors,e.name,p[e.name]):H(n.errors,e.name)),t.shouldUseNativeValidation&&p[e.name]))break}!R(u)&&await ct({context:o,onlyCheckValid:r,fields:u,name:i,eventType:a})}}return o.valid},lt=()=>{for(let e of A.unMount){let t=E(s,e);t&&(t._f.refs?t._f.refs.every(e=>!Me(e)):!Me(t._f.ref))&&Dt(e)}A.unMount=new Set},ut=(e,t)=>(e&&!T(t)&&k(f,e,t),!P(S.mount?f:u,u)),dt=(e,t,n)=>{let r=S.mount?f:T(t)||!T(e)?u:t;return ae(e,A,T(e)?{...r}:r,n,t)},ft=e=>xe(E(S.mount?f:u,e,t.shouldUnregister?E(u,e,[]):[])),pt=(e,t,n={},a=!1,c=!1,l=!1)=>{let u=E(s,e),d=t;if(u){let n=u._f;n&&(!n.disabled&&k(f,e,Ue(t,n)),d=de(n.ref)&&o(t)?``:t,Oe(n.ref)?[...n.ref.options].forEach(e=>e.selected=d.includes(e.value)):n.refs?r(n.ref)?n.refs.forEach(e=>{e.defaultChecked&&e.disabled||(e.checked=Array.isArray(d)?!T(e.value)&&d.includes(e.value):d===e.value||!!d)}):n.refs.forEach(e=>e.checked=e.value===d):i(n.ref)?n.ref.value=``:(n.ref.value=d,n.ref.type||c||l||L.state.next({name:e,values:a?f:oe(e)?h(f):void 0})))}(n.shouldDirty||n.shouldTouch)&&qe(e,u&&u._f&&!u._f.disabled&&(u._f.valueAsNumber||u._f.valueAsDate||u._f.setValueAs)?Ue(t,u._f):d,n.shouldTouch,n.shouldDirty,!c),n.shouldValidate&&U(e,{delayError:n.delayError}),n.shouldValidate&&u&&u._f&&u._f.deps&&(!Array.isArray(u._f.deps)||u._f.deps.length>0)&&U(u._f.deps)},mt=(e,t,n,r=!1,i=!1,o=!1)=>{for(let l in t){if(!Object.prototype.hasOwnProperty.call(t,l))continue;let u=t[l],d=e+`.`+l,p=E(s,d);A.array.has(d)&&L.array.next({name:d,values:r?f:h(f)}),(A.array.has(e)||c(u)||p&&!p._f)&&!a(u)?mt(d,u,n,r,i,o):pt(d,u,n,r,i,o)}},ht=(e,t,r,i,a=!1)=>{let c=E(s,e),l=A.array.has(e),u=i?t:h(t),d=P(E(f,e),u);if(d||k(f,e,u),l)L.array.next({name:e,values:i?f:h(f)}),F(`isDirty`,`dirtyFields`)&&r.shouldDirty&&(Ee(),n.isDirty=ut(e,u),a||L.state.next({name:e,dirtyFields:n.dirtyFields,isDirty:n.isDirty})),r.shouldValidate&&U(e,{delayError:r.delayError});else{let t=Array.isArray(u)&&!u.length||R(u),n=!d&&!a;!c||c._f||o(u)||t?pt(e,u,r,i,a,n):mt(e,u,r,i,a,n)}if(!d&&!a){let t=ce(e,A),r=S.mount||t?e:void 0,a=l?[]:He(A.array,e),o=i?f:oe(r)||a.some(oe)?h(f):void 0;L.state.next({...t&&n,name:r,values:o});for(let e of a)L.state.next({name:e,values:o&&h(f)})}},gt=(e,t,n={})=>ht(e,t,n,!1),_t=(e,t={})=>{let r=O(e)?e(f):e;if(!P(f,r)||t.shouldValidate||t.shouldDirty||t.shouldTouch){f={...f,...r};for(let e of new Set([...A.mount,...A.array]))De(r,e)&&ht(e,E(r,e),t,!0,!0);if(t.shouldDirty&&F(`isDirty`,`dirtyFields`))for(let e of Object.keys(r))qe(e,f[e],!1,!0);L.state.next({...n,name:void 0,type:void 0,...N.size?{values:f}:{}}),t.shouldValidate&&V()}},vt=async e=>{S.mount=!0;let r=e.target,i=r.name,a=!0,o=E(s,i),c=me,u=e=>{a=!!E(s,i)&&!(he[i]>c)&&P(e,E(f,i,e))};if(o){S.keepIsValid=!1;let c,d,p=!1,m=r.type?We(o._f):l(e),_=e.type===g.BLUR||e.type===g.FOCUS_OUT,v=!Ye(o._f)&&!t.validate&&!t.resolver&&!E(n.errors,i)&&!o._f.deps,y=v||et(_,E(n.touchedFields,i),n.isSubmitted,te,ee),b=ce(i,A,_);k(f,i,h(m)),_?r&&r.readOnly||(o._f.onBlur&&o._f.onBlur(e),Object.prototype.hasOwnProperty.call(j,i)&&(p=!0,j[i](0))):o._f.onChange&&o._f.onChange(e);let x=qe(i,m,_),C=!R(x)||b;if(!_&&L.state.next({name:i,type:e.type,...oe(i)?{values:h(f)}:{}}),y)return v&&n.isValid||!F(`isValid`)||(t.mode===`onBlur`?_&&V():_||V()),C&&L.state.next({name:i,...b?{}:x});if(!t.resolver&&t.validate&&await st({name:i,eventType:e.type}),!_&&b&&L.state.next({...n}),t.resolver){let e=z,{errors:t}=await at([i]);if(e!==z)return;if(Ce([i]),u(m),!a){!R(x)&&L.state.next(x);return}let r=Xe(n.errors,s,i),o=Xe(t,s,r.name||i);c=o.error,i=o.name,d=R(t)}else{let n=z,r=++fe;if(Ce([i],!0),c=(await ye(o,A.disabled,f,ge,t.shouldUseNativeValidation))[i],n!==z)return;if(Ce([i]),u(m),a){if(c)d=!1;else if(F(`isValid`)){if(d=await ct({fields:s,onlyCheckValid:!0,name:i,eventType:e.type}),n!==z)return;u(m),r!==fe&&(d=void 0)}}}a&&(o._f.deps&&(!Array.isArray(o._f.deps)||o._f.deps.length>0)&&U(o._f.deps),Qe(i,d,c,x),p&&Object.prototype.hasOwnProperty.call(j,i)&&j[i](0))}},yt=(e,t)=>{if(E(n.errors,t)&&e.focus)return e.focus(),1},U=async(e,r={})=>{S.keepIsValid=!1;let i,a,o=be(e),l=z;if(t.resolver){let t=await ot(T(e)?e:o);i=R(t),a=e?!o.some(e=>E(t,e)):i}else e?(a=(await Promise.all(o.map(async e=>{let t=E(s,e);return await ct({fields:t&&t._f?{[e]:t}:t,eventType:g.TRIGGER})}))).every(Boolean),(a||n.isValid)&&V()):a=i=await ct({fields:s,name:e,eventType:g.TRIGGER});if(l!==z)return a;if(r.delayError&&t.delayError&&I(e)){let r=E(n.errors,e);r?(H(n.errors,e),j[e]=_e(e,()=>Ne(e,r)),j[e](t.delayError)):B(e)}if(r.shouldTouch){let t=e=>{!A.array.has(e)&&k(n.touchedFields,e,!0)};for(let n of e?o:A.mount){let e=E(s,n);c(e)||Array.isArray(e)?le(s,(e,n)=>t(n),[n]):t(n)}}return n.errors={...n.errors},L.state.next({...!I(e)||F(`isValid`)&&i!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:i}:{},...r.shouldTouch&&F(`touchedFields`)?{touchedFields:n.touchedFields}:{},errors:n.errors}),r.shouldFocus&&!a&&le(s,yt,e?o:A.mount),a},bt=((e,t)=>{let r=T(e)&&!t?{...S.mount?f:u}:S.mount?f:u;return t&&(r=Te(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),T(e)?r:I(e)?E(r,e):e.map(e=>E(r,e))}),xt=(e=>T(e)?{...n.errors}:I(e)?E(n.errors,e):e.map(e=>E(n.errors,e))),St=(e,t)=>{let r=t||n,i=E(r.errors,e);return{invalid:!!i,isDirty:!!E(r.dirtyFields,e),error:i,isValidating:!!E(r.validatingFields,e),isTouched:!!E(r.touchedFields,e)}},Ct=e=>{let t=e?be(e):void 0;t?t.forEach(e=>{ve(e),H(n.errors,e),n.errors={...n.errors},L.state.next({name:e,errors:n.errors})}):(Object.keys(j).forEach(B),n.errors={},L.state.next({errors:n.errors}))},W=(e,t,r)=>{ve(e);let i=E(s,e,{_f:{}}),a=i._f&&i._f.ref,{ref:o,message:c,type:l,types:u,...d}=E(n.errors,e)||{};if(k(n.errors,e,{...d,...t,ref:a}),n.errors={...n.errors},L.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus){let e=i._f?.refs?i._f.refs.find(e=>!e.disabled)||i._f.refs[0]:a;e&&e.focus&&e.focus()}},wt=(e,t)=>{if(O(e)){let n={};N.add(n);let{unsubscribe:r}=L.state.subscribe({next:n=>`values`in n&&e(n.values||dt(void 0,t),n)});return{unsubscribe:()=>{N.delete(n),r()}}}return dt(e,t,!0)},Tt=e=>{let t={name:e.name,exact:e.exact};e.formState&&e.formState.values&&N.add(t);let{unsubscribe:r}=L.state.subscribe({next:t=>{if($e(e.name,t.name,e.exact)&&Ze(t,e.formState||re,e.reRenderRoot)){let r=t.values||{...f};e.callback({...n,...t,validatingFields:n.validatingFields,isValidating:n.isValidating,values:r,defaultValues:u})}}});return()=>{N.delete(t),r()}},Et=e=>{S.mount=!0;let t=Object.keys(e.formState||{}).filter(t=>e.formState&&e.formState[t]);for(let e of t)ie[e]=(ie[e]||0)+1;let n=Tt({...e,formState:{...ne,...e.formState}});return()=>{for(let e of t.splice(0))ie[e]--;n()}},Dt=(e,r={})=>{let i=e?be(e):[...A.mount],a=new Set(i);if(e)for(let e of A.mount)i.some(t=>e.startsWith(`${t}.`))&&a.add(e);r.keepIsValidating||Se(a);for(let e of a)A.mount.delete(e),A.array.delete(e),A.disabled.delete(e),H(s,e),!r.keepValue&&H(f,e),r.keepError||(ve(e),H(n.errors,e)),!r.keepDirty&&H(n.dirtyFields,e),!r.keepTouched&&H(n.touchedFields,e),!t.shouldUnregister&&!r.keepDefaultValue&&H(u,e);r.keepError||(n.errors={...n.errors}),N.size&&L.state.next({values:h(f)}),L.state.next({...n,...r.keepDirty?{}:{isDirty:ut()},...r.keepIsValidating?{}:{isValidating:!R(n.validatingFields)}}),!r.keepIsValid&&V()},Ot=({disabled:e,name:t})=>{if(D(e)&&S.mount||e||A.disabled.has(t)){let n=A.disabled.has(t)!==!!e;e?A.disabled.add(t):A.disabled.delete(t),n&&S.mount&&!S.action&&V()}},kt=(e,n={})=>{let r=E(s,e),i=D(n.disabled)||D(t.disabled),a=!A.registerName.has(e)&&r&&r._f&&!r._f.mount;if(r&&r._f||(he[e]=++me),k(s,e,{...r||{},_f:{...r&&r._f?r._f:{ref:{name:e}},name:e,mount:!0,...n}}),A.mount.add(e),r&&r._f){let t=E(s,e);for(let e of y)e in n||delete t._f[e]}return r&&!a?Ot({disabled:D(n.disabled)?n.disabled:t.disabled,name:e}):Be(e,!0,n.value),{...i?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!Ke(n.required),min:Ke(n.min),max:Ke(n.max),minLength:Ke(n.minLength),maxLength:Ke(n.maxLength),pattern:Ke(n.pattern)}:{},name:e,onChange:vt,onBlur:vt,ref:i=>{if(i){A.registerName.add(e),kt(e,n),A.registerName.delete(e),r=E(s,e);let t=T(i.value)&&i.querySelectorAll&&i.querySelectorAll(`input,select,textarea`)[0]||i,a=je(t),o=r._f.refs||[];if(a?o.find(e=>e===t):t===r._f.ref)return;let c={...r._f};a?(c.refs=[...o.filter(Me),t,...Array.isArray(E(u,e))?[{}]:[]],c.ref={type:t.type,name:e}):(c.ref=t,delete c.refs),k(s,e,{_f:c}),Be(e,!1,void 0,t)}else r=E(s,e,{}),r._f&&(r._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(p(A.array,e)&&S.action)&&A.unMount.add(e)}}},At=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&le(s,yt,A.mount),jt=e=>{D(e)&&(L.state.next({disabled:e}),le(s,(t,n)=>{let r=E(s,n);r&&(t.disabled=r._f.disabled||e,Array.isArray(r._f.refs)&&r._f.refs.forEach(t=>{t.disabled=r._f.disabled||e}))},0))},Mt=(e,r)=>async i=>{let a,o,l=!1;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let u=h(f);L.state.next({isSubmitting:!0});let d=z,p=e=>{throw d===z&&L.state.next({isSubmitting:!1}),e};if(t.resolver){let e;try{e=await at()}catch(e){p(e)}let{errors:t,values:r}=e;if(d!==z)return;Ce(),Object.keys(j).forEach(B),n.errors=t,u=h(r)}else{try{await ct({fields:s,eventType:g.SUBMIT})}catch(e){p(e)}if(d!==z)return;H(n.errors,x),n.errors={...n.errors}}if(A.disabled.size&&(c(u)||Array.isArray(u)))for(let e of A.disabled)H(u,e);if(R(n.errors)){L.state.next({errors:{}});try{a=await e(u,i)}catch(e){l=!0,o=e}}else{if(r)try{await r({...n.errors},i)}catch(e){p(e)}d===z&&(At(),setTimeout(At))}if(d===z&&L.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:R(n.errors)&&!l,submitCount:n.submitCount+1,errors:n.errors}),l)throw o;return a},Nt=(e,t={})=>{E(s,e)&&(Se([e]),T(t.defaultValue)?gt(e,h(E(u,e))):(gt(e,t.defaultValue),u=h(u),k(u,e,h(t.defaultValue))),t.keepTouched||H(n.touchedFields,e),t.keepDirty||(H(n.dirtyFields,e),n.isDirty=T(t.defaultValue)?ut():ut(e,h(E(u,e)))),t.keepError||(ve(e),H(n.errors,e),n.errors={...n.errors},V()),L.state.next({...n,isValidating:!R(n.validatingFields)}))},G=(e,r={})=>{z++;let i=e?h(e):u,a=h(i),o=R(e),c=a,l=s;if(Object.keys(j).forEach(B),r.keepDefaultValues||(u=i),!r.keepValues){if(r.keepDirtyValues){let e=new Set([...A.mount,...Pe(Ve(u,f,void 0,l),n.dirtyFields)]);for(let t of e){let e=E(n.dirtyFields,t),r=E(f,t),i=E(c,t);e&&!T(r)?k(c,t,r):!e&&!T(i)&&gt(t,i)}}else{if(m&&T(e))for(let e of A.mount){let t=E(s,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(de(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(r.keepFieldsRef)for(let e of A.mount)gt(e,E(c,e));else s={}}if(t.shouldUnregister){if(f=r.keepDefaultValues?h(u):{},r.keepFieldsRef)for(let e of A.mount)k(f,e,E(c,e))}else f=h(c);L.array.next({values:{...c}}),L.state.next({name:void 0,type:void 0,values:{...c}})}A={mount:r.keepDirtyValues||r.keepFieldsRef?A.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:r.keepValues||r.keepDirtyValues||r.keepFieldsRef?new Set([...A.disabled].filter(e=>E(s,e))):new Set,watch:new Set,watchAll:!1,focus:``},S.mount=!re.isValid||!!r.keepIsValid||!!r.keepDirtyValues||!t.shouldUnregister&&!R(c),S.watch=!!t.shouldUnregister,S.keepIsValid=!!r.keepIsValid,S.action=!1,S.actionArrayLengths.clear(),C=!1,r.keepErrors||(n.errors={}),L.state.next({submitCount:r.keepSubmitCount?n.submitCount:0,isDirty:o?!1:r.keepDirty?n.isDirty:r.keepValues?ut():!!(r.keepDefaultValues&&e&&!P(e,u)),isSubmitted:r.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:o?{}:r.keepDirtyValues?r.keepDefaultValues&&f?Ve(u,f,void 0,l):n.dirtyFields:r.keepDefaultValues&&e?Ve(u,e,void 0,l):r.keepDirty?n.dirtyFields:r.keepValues?Ve(u,f,void 0,l):{},touchedFields:r.keepTouched?n.touchedFields:{},...!r.keepIsValidating&&(n.isValidating||!R(n.validatingFields))?{validatingFields:{},isValidating:!1}:null,errors:r.keepErrors?n.errors:{},isSubmitSuccessful:r.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:u})},Pt=(e,n)=>G(O(e)?e(f):e,{...t.resetOptions,...n}),Ft=(e,t={})=>{let n=E(s,e),r=n&&n._f;if(r){let e=r.refs?r.refs.find(e=>!e.disabled)||r.refs[0]:r.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&O(e.select)&&e.select()})}};L.state.subscribe({next:e=>{let{name:t,type:r,values:i,...a}=e;Object.keys(a).length&&(n={...n,...a})}});let It={control:{register:kt,unregister:Dt,getFieldState:St,handleSubmit:Mt,setError:W,_subscribe:Tt,_runSchema:at,_updateIsValidating:Ce,_focusError:At,_getWatch:dt,_getDirty:ut,_setValid:V,_setFieldArray:ke,_setDisabledField:Ot,_setErrors:Fe,_getFieldArray:ft,_reset:G,_resetDefaultValues:()=>O(t.defaultValues)&&t.defaultValues().then(e=>{Pt(e,t.resetOptions),L.state.next({isLoading:!1})}),_removeUnmounted:lt,_disableForm:jt,_subjects:L,_proxyFormState:re,get _fields(){return s},get _formValues(){return f},get _state(){return S},set _state(e){S=e},get _defaultValues(){return u},get _names(){return A},set _names(e){A=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e},ee=se(t.mode),te=se(t.reValidateMode),ge=t.criteriaMode===_.all}},subscribe:Et,trigger:U,register:kt,handleSubmit:Mt,watch:wt,setValue:gt,setValues:_t,getValues:bt,getErrors:xt,reset:Pt,resetField:Nt,resetDefaultValues:(e,t={})=>{if(u=h(e),!t.keepDirty){let e=Ve(u,f,void 0,s);n.dirtyFields=e,n.isDirty=!R(e)}t.keepIsValid||V(),L.state.next({...n,defaultValues:u})},clearErrors:Ct,unregister:Dt,setError:W,setFocus:Ft,getFieldState:St};return{...It,formControl:It}}var ot={mode:nt.mode,reValidateMode:nt.reValidateMode,shouldFocusError:nt.shouldFocusError,resolver:void 0,criteriaMode:void 0,delayError:void 0,shouldUnregister:void 0,shouldUseNativeValidation:void 0,context:void 0,progressive:void 0,resetOptions:void 0};function st(e={}){let t=n.useRef(void 0),r=n.useRef(void 0),i=n.useRef(e.formControl),a=n.useRef(!1),o=n.useRef(!!e.validate),s=n.useRef(!!e.errors),c=n.useRef(!1),[l,u]=n.useState(()=>({...h(it),isLoading:O(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:O(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&i.current!==e.formControl){if(i.current=e.formControl,a.current=!1,e.formControl)t.current={...e.formControl,formState:l},e.defaultValues&&!O(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...r}=at(e);t.current={...r,formState:l}}}let d=t.current.control,f=d._options,p={};for(let t in ot)t in f&&!(t in e)&&(p[t]=ot[t]);a.current&&!e.disabled&&(p.disabled=!1),d._options={...p,...e,validate:e.validate};let m=()=>({...d._formState,defaultValues:d._defaultValues}),{resyncIfNeeded:g,snapshot:_}=ie(m,re);return N(()=>{g(!0,m,u);let e=d._subscribe({formState:d._proxyFormState,callback:()=>u({...d._formState,defaultValues:d._defaultValues}),reRenderRoot:!0});return u(e=>({...e,isReady:!0})),d._formState.isReady=!0,d._subjects.state.next({isReady:!0}),()=>{e(),_(!0,m)}},[d,g,_]),n.useEffect(()=>{d._disableForm(a.current&&!e.disabled?!1:e.disabled),a.current=!!e.disabled},[d,e.disabled]),n.useEffect(()=>{e.mode&&(d._options.mode=e.mode),e.reValidateMode&&(d._options.reValidateMode=e.reValidateMode)},[d,e.mode,e.reValidateMode]),n.useEffect(()=>{e.errors?(d._setErrors(e.errors),d._focusError()):s.current&&d._setErrors({}),s.current=!!e.errors},[d,e.errors]),n.useEffect(()=>{o.current&&!e.validate&&t.current&&t.current.clearErrors(b),o.current=!!e.validate},[e.validate]),n.useEffect(()=>{e.shouldUnregister&&d._subjects.state.next({values:d._getWatch()})},[d,e.shouldUnregister]),n.useEffect(()=>{if(d._proxyFormState.isDirty){let e=d._getDirty();e!==l.isDirty&&d._subjects.state.next({isDirty:e})}},[d,l.isDirty]),n.useEffect(()=>{e.values&&!P(e.values,r.current)?(d._reset(e.values,{keepFieldsRef:!0,...d._options.resetOptions}),d._options.resetOptions&&d._options.resetOptions.keepIsValid||d._setValid(),r.current=e.values,u(e=>({...e}))):d._resetDefaultValues()},[d,e.values]),n.useEffect(()=>{d._state.mount&&(c.current||e.values)||(d._setValid(),d._state.mount=!0),c.current=!0,d._state.watch&&(d._state.watch=!1,d._subjects.state.next({...d._formState})),d._removeUnmounted()}),t.current.formState=n.useMemo(()=>M(l,d),[d,l]),t.current}var ct=n.createContext(null);ct.displayName=`HookFormContext`;var lt=()=>n.useContext(ct),ut=({children:e,watch:t,getValues:r,getErrors:i,getFieldState:a,setError:o,clearErrors:s,setValue:c,setValues:l,trigger:u,formState:d,resetField:f,reset:p,resetDefaultValues:m,handleSubmit:h,unregister:g,control:_,register:v,setFocus:y,subscribe:b})=>{let x=n.useMemo(()=>({watch:t,getValues:r,getErrors:i,getFieldState:a,setError:o,clearErrors:s,setValue:c,setValues:l,trigger:u,formState:d,resetField:f,reset:p,resetDefaultValues:m,handleSubmit:h,unregister:g,control:_,register:v,setFocus:y,subscribe:b}),[s,_,d,i,a,r,h,v,p,m,f,o,y,c,l,b,u,g,t]);return n.createElement(ct.Provider,{value:x},n.createElement(A.Provider,{value:x.control},e))};function dt(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ft(e,t=`|`){return e.map(e=>Pt(e)).join(t)}function pt(e,t){return typeof t==`bigint`?t.toString():t}var mt=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function ht(e){return new mt(e)}function gt(e){return e==null}function _t(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function vt(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function yt(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function U(e){return yt(e._zod.def)??e._zod.def.shape}function bt(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return vt(this,t,e),e},enumerable:!0,configurable:!0})}function xt(e,t,n){t in e?vt(e,t,n):e[t]=n}function St(e,t,n,r){let i=U(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?bt(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):xt(e,a,r?r(n.value,a):n.value))}}function Ct(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?bt(e,n,()=>t[n]):xt(e,n,r.value))}}function W(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function wt(e){return JSON.stringify(e)}function Tt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Et=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Dt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Ot=ht(()=>{if(wn.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function kt(e){if(Dt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Dt(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function At(e){return kt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var jt=new Set([`string`,`number`,`symbol`]);function Mt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Nt(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function G(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Pt(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Ft(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var It={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Lt={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Rt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return St(i,e,zt(e,t)),Nt(e,W(n,{shape:i,checks:[]}))}function zt(e,t){let n=U(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Bt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(zt(e,t)),a={};return St(a,e,Reflect.ownKeys(U(e)).filter(e=>!i.has(e))),Nt(e,W(n,{shape:a,checks:[]}))}function Vt(e,t){if(!kt(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=U(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Nt(e,W(e._zod.def,{shape:Ht(e,t)}))}function Ht(e,t){let n={};return St(n,e,Reflect.ownKeys(U(e))),Ct(n,t),n}function Ut(e,t){if(!kt(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Nt(e,W(e._zod.def,{shape:Ht(e,t)}))}function Wt(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return St(n,e,Reflect.ownKeys(U(e))),St(n,t,Reflect.ownKeys(U(t))),Nt(e,W(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Gt(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(zt(t,n)):void 0,o={};return St(o,t,Reflect.ownKeys(U(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),Nt(t,W(t._zod.def,{shape:o,checks:[]}))}function Kt(e,t,n){let r=n?new Set(zt(t,n)):void 0,i={};return St(i,t,Reflect.ownKeys(U(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),Nt(t,W(t._zod.def,{shape:i}))}function qt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Jt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Yt(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Xt(e){return typeof e==`string`?e:e?.message}function Zt(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function Qt(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function $t(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Xt(e.inst?._zod.def?.error?.(e))??Xt(a?.(e))??Xt(t?.error?.(e))??Xt(n.customError?.(e))??Xt(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var en=/[\uD800-\uDBFF]/;function tn(e){let t=e.length;if(!en.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function nn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function rn(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function an(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function on(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):un(e,n,r.value)}}function sn(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function cn(e,t,n){return sn(e,t,n,!1)}function ln(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return sn(this,n,r(this))},set(e){sn(this,n,e)}})}return t}function un(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:sn(this,t,n.bind(this))},set(e){sn(this,t,e)}})}function dn(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var fn,pn=!1,mn={configurable:!0,get(){pn=!0}};function K(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&fn!==e._zod?fn=void 0:(fn=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,mn);let e=pn;pn=!1;try{let r=n(this);return pn?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),pn||=e,r}catch(n){throw delete this[t],pn||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function hn(e,t,n,r){let i=dn(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var gn=`~constantCatch`;function _n(e){let t=()=>e;return t[gn]=!0,t}var vn,yn={value:void 0,enumerable:!1},bn=`captureStackTrace`in Error?Error:null;function xn(e){let t=bn;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return bn=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function q(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){yn.value=new a(r);try{Object.defineProperty(n,"_zod",yn)}finally{yn.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),on(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?xn(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Sn=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Cn=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(vn=globalThis).__zod_globalConfig??(vn.__zod_globalConfig={});var wn=globalThis.__zod_globalConfig;function Tn(e){return e&&Object.assign(wn,e),wn}function En(){let e=this._zod;return e.message??=JSON.stringify(e.def,pt,2),e.message}function Dn(e){this._zod.message=e}var On={get:En,set:Dn,enumerable:!0,configurable:!0},kn={value:void 0,enumerable:!1},An=new WeakSet([Object.prototype,Error.prototype]),jn=q(`$ZodError`,(e,t)=>{e.name=`$ZodError`,kn.value=t,Object.defineProperty(e,"issues",kn),kn.value=void 0,Object.defineProperty(e,"message",On);let n=Object.getPrototypeOf(e);An.has(n)||(An.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function Mn(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Nn(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Mn(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Pn(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Fn(e,t){return{callee:t?.callee??e,Err:t?.Err}}var In=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Sn;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>$t(e,o,Tn())));throw Et(n,a?.callee??t),n}return s.value};return t},Ln=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>$t(e,o,Tn())));throw Et(n,a?.callee??t),n}return s.value};return t},Rn=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Sn;return a.issues.length?zn(e,a.issues,i):{success:!0,data:a.value}};function zn(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>$t(e,n,Tn()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Bn=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?zn(e,a.issues,i):{success:!0,data:a.value}},Vn=Symbol.for(`zod.compile.invalid`),Hn=Symbol.for(`zod.compile.fallback`),Un=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Vn)return!0;if(r.definite===!0&&n===void 0)return!1}return Wn(e,t,n)});function Wn(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Hn]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Sn;return a.issues.length===0}var Gn=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Kn=e=>{let t=In(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Fn(n,a))};return n},qn=e=>{let t=In(e),n=(e,r,i,a)=>t(e,r,i,Fn(n,a));return n},Jn=e=>{let t=Ln(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Fn(n,a))};return n},Yn=e=>{let t=Ln(e),n=async(e,r,i,a)=>await t(e,r,i,Fn(n,a));return n},Xn=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Rn(e)(t,n,i)},Zn=e=>(t,n,r)=>Rn(e)(t,n,r),Qn=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Bn(e)(t,n,i)},$n=e=>async(t,n,r)=>Bn(e)(t,n,r),er=/^[cC][0-9a-z]{6,}$/,tr=/^[0-9a-z]+$/,nr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,rr=/^[0-9a-vA-V]{20}$/,ir=/^[A-Za-z0-9]{27}$/,ar=/^[a-zA-Z0-9_-]{21}$/;function or(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var sr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,cr=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,lr=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ur=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,dr=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function fr(){return new RegExp(dr,`u`)}var pr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,mr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,hr=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,gr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,_r=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,vr=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,yr=/^https?$/,br=/^\+[1-9]\d{6,14}$/,xr=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Sr(e){return RegExp(`^${e}$`)}var Cr=Sr(xr);function wr(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Tr(e){return RegExp(`^${wr(e)}$`)}function Er(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${wr({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${wr({precision:e.precision})}`:n;return RegExp(`^${xr}T(?:${r})$`)}var Dr=/^[\s\S]{0,}$/,Or=/^(?:true|false)$/i,kr=/^[^A-Z]*$/,Ar=/^[^a-z]*$/,jr=q(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Mr=e=>{let t=e.value;return!gt(t)&&t.length!==void 0},Nr=q(`$ZodCheckMaxLength`,(e,t)=>{var n;jr.init(e,t),(n=e._zod.def).when??(n.when=Mr),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?tn(r):i)<=t.maximum)return;let a=nn(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Pr=q(`$ZodCheckMinLength`,(e,t)=>{var n;jr.init(e,t),(n=e._zod.def).when??(n.when=Mr),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?tn(r):i)>=t.minimum)return;let a=nn(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Fr=q(`$ZodCheckLengthEquals`,(e,t)=>{var n;jr.init(e,t),(n=e._zod.def).when??(n.when=Mr),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?tn(r):i;if(a===t.length)return;let o=nn(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ir=q(`$ZodCheckStringFormat`,(e,t)=>{var n,r;jr.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Lr=q(`$ZodCheckRegex`,(e,t)=>{Ir.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Rr=q(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=kr,Ir.init(e,t)}),zr=q(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Ar,Ir.init(e,t)}),Br=q(`$ZodCheckIncludes`,(e,t)=>{jr.init(e,t);let n=Mt(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Vr=q(`$ZodCheckStartsWith`,(e,t)=>{jr.init(e,t);let n=RegExp(`^${Mt(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Hr=q(`$ZodCheckEndsWith`,(e,t)=>{jr.init(e,t);let n=RegExp(`.*${Mt(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function Ur(e,t,n){e.issues.length&&t.issues.push(...Yt(n,e.issues))}var Wr=q(`$ZodCheckProperties`,(e,t)=>{jr.init(e,t),cn(e,Symbol.iterator,function*(){yield e});let n;e._zod.check=r=>{if(r.value==null){r.issues.push({expected:`object`,code:`invalid_type`,input:r.value,inst:e});return}n??=Reflect.ownKeys(t.shape).map(e=>[e,t.shape[e]]);let i=r.value,a;for(let[e,t]of n){let n=t._zod.run({value:i[e],issues:[]},{});n instanceof Promise?(a??=[],a.push(n.then(t=>Ur(t,r,e)))):Ur(n,r,e)}if(a)return Promise.all(a).then(()=>void 0)}}),Gr=q(`$ZodCheckOverwrite`,(e,t)=>{jr.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Kr=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
2
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
3
+ `)}\n};`)(...Object.values(this.closed))}},qr={major:4,minor:6,patch:7},J=q(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=qr;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=qt(t),a;for(let o of n){if(o._zod.def.when){if(Jt(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Sn;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Qt(t.issues,n,e),i||=qt(t,n))});else{if(t.issues.length===n)continue;Qt(t.issues,n,e),i||=qt(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(qt(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Sn;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Sn;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return cn(this,`~standard`,Xr(this))},set"~standard"(e){sn(this,`~standard`,e)}}),Jr=(e,t)=>e.issues.length?{issues:e.issues.map(e=>$t(e,t,Tn()))}:{value:e.value};async function Yr(e,t){let n={async:!0};return Jr(await e._zod.run({value:t,issues:[]},n),n)}function Xr(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Jr(r,n)}catch{}return Yr(e,t)},vendor:`zod`,version:1}}var Zr=q(`$ZodString`,(e,t)=>{J.init(e,t),e._zod.pattern=t.pattern??Dr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Y=q(`$ZodStringFormat`,(e,t)=>{Ir.init(e,t),Zr.init(e,t)}),Qr=q(`$ZodGUID`,(e,t)=>{t.pattern??=cr,Y.init(e,t)}),$r=q(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=lr(e)}else t.pattern??=lr();Y.init(e,t)}),ei=q(`$ZodEmail`,(e,t)=>{t.pattern??=ur,Y.init(e,t)});function ti(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function ni(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?ti(e)||2:ri(e,t)}function ri(e,t){if(!t.normalize&&t.protocol?.source===yr.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var ii=/[\t\n\r]/g;function ai(e){return e.replace(ii,``)}function oi(e,t){return t.lastIndex=0,t.test(e.hostname)}function si(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var ci=q(`$ZodURL`,(e,t)=>{Y.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=ni(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=ai(r);return}t.hostname&&!oi(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!si(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:ai(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),li=q(`$ZodEmoji`,(e,t)=>{t.pattern??=fr(),Y.init(e,t)}),ui=q(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?ar:or(t.length),Y.init(e,t)}),di=q(`$ZodCUID`,(e,t)=>{t.pattern??=er,Y.init(e,t)}),fi=q(`$ZodCUID2`,(e,t)=>{t.pattern??=tr,Y.init(e,t)}),pi=q(`$ZodULID`,(e,t)=>{t.pattern??=nr,Y.init(e,t)}),mi=q(`$ZodXID`,(e,t)=>{t.pattern??=rr,Y.init(e,t)}),hi=q(`$ZodKSUID`,(e,t)=>{t.pattern??=ir,Y.init(e,t)}),gi=q(`$ZodISODateTime`,(e,t)=>{t.pattern??=Er(t),Y.init(e,t)}),_i=q(`$ZodISODate`,(e,t)=>{t.pattern??=Cr,Y.init(e,t)}),vi=q(`$ZodISOTime`,(e,t)=>{t.pattern??=Tr(t),Y.init(e,t)}),yi=q(`$ZodISODuration`,(e,t)=>{t.pattern??=sr,Y.init(e,t)}),bi=q(`$ZodIPv4`,(e,t)=>{t.pattern??=pr,Y.init(e,t)}),xi=/^[0-9a-fA-F:.]+$/;function Si(e){return xi.test(e)?ti(`http://[${e}]`):!1}var Ci=q(`$ZodIPv6`,(e,t)=>{t.pattern??=mr,Y.init(e,t),e._zod.check=n=>{Si(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),wi=q(`$ZodCIDRv4`,(e,t)=>{t.pattern??=hr,Y.init(e,t)});function Ti(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Si(n)}var Ei=q(`$ZodCIDRv6`,(e,t)=>{t.pattern??=gr,Y.init(e,t),e._zod.check=n=>{Ti(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Di(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Oi=/^[0-9a-zA-Z+/]*={0,2}$/,ki=q(`$ZodBase64`,(e,t)=>{t.pattern??=Oi,Y.init(e,t),e._zod.check=n=>{Di(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Ai=/^[A-Za-z0-9_-]*$/;function ji(e){if(!Ai.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Di(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Mi=q(`$ZodBase64URL`,(e,t)=>{t.pattern??=Ai,Y.init(e,t),e._zod.check=n=>{ji(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Ni=q(`$ZodE164`,(e,t)=>{t.pattern??=br,Y.init(e,t)});function Pi(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Fi=q(`$ZodJWT`,(e,t)=>{Y.init(e,t),e._zod.check=n=>{Pi(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Ii=q(`$ZodBoolean`,(e,t)=>{J.init(e,t),e._zod.pattern=Or,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Li=q(`$ZodAny`,(e,t)=>{J.init(e,t),e._zod.parse=e=>e}),Ri=q(`$ZodUnknown`,(e,t)=>{J.init(e,t),e._zod.parse=e=>e}),zi=q(`$ZodNever`,(e,t)=>{J.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Bi(e,t){let n=Zt(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Zt(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,Qt(n.issues,t,e),n}}return i(n,a)}}var Vi=e=>Array.isArray(e)?e.length:-1;function Hi(e,t,n){e.issues.length&&t.issues.push(...Yt(n,e.issues)),t.value[n]=e.value}var Ui=q(`$ZodArray`,(e,t)=>{J.init(e,t);let n=wn.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Hi(t,r,e)));else if(Hi(c,r,e),s&&c.issues.length!==0&&qt(c))break}return o.length?Promise.all(o).then(()=>r):r},Bi(e,Vi)});function Wi(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Yt(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Gi=[];function Ki(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Gi,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Ft(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function qi(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(qt(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Wi(e,n,i,t,d,f))):Wi(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Ji=q(`$ZodObject`,(e,t)=>{J.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=ht(()=>Ki(t));K(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||vt(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=Dt,o=t.catchall,s,c=wn.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(qt(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Wi(n,t,e,r,a,o))):Wi(s,t,e,r,a,o)}return o?qi(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Yi=q(`$ZodObjectJIT`,(e,t)=>{Ji.init(e,t);let n=e._zod.parse,r=ht(()=>Ki(t)),i=wn.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Kr([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
4
+ let ${e}_ab = false;
5
+ for (let i = 0; i < ${e}.issues.length; i++) {
6
+ const iss = ${e}.issues[i];
7
+ iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
8
+ payload.issues.push(iss);
9
+ if (iss.continue !== true) ${e}_ab = true;
10
+ }
11
+ if (${e}_ab && ctx && ctx.abortEarly) {
12
+ payload.value = newResult;
13
+ return payload;
14
+ }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:wt(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
15
+ const ${n}_present = ${i};
16
+ if (!${n}.issues.length || ${n}_present) {
17
+ if (${n}.issues.length) {${c(n,r)}
18
+ }
19
+
20
+ if (${e}) {
21
+ newResult[${r}] = ${n}.value;
22
+ }
23
+ }
24
+
25
+ `)}else f?(o.write(`
26
+ if (${n}.issues.length) {${c(n,r)}
27
+ }
28
+ `),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
29
+ if (${n}.value !== undefined || ${i}) {
30
+ newResult[${r}] = ${n}.value;
31
+ }
32
+ `)):o.write(`
33
+ const ${n}_present = ${i};
34
+ if (${n}.issues.length) {${c(n,r)}
35
+ }
36
+ if (!${n}_present && !${n}.issues.length) {
37
+ payload.issues.push({
38
+ code: "invalid_type",
39
+ expected: "nonoptional",
40
+ input: undefined,
41
+ path: [${r}]
42
+ });
43
+ if (ctx && ctx.abortEarly) {
44
+ payload.value = newResult;
45
+ return payload;
46
+ }
47
+ }
48
+
49
+ if (${n}_present) {
50
+ newResult[${r}] = ${n}.value;
51
+ }
52
+
53
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=Dt,c=!wn.jitless,l=c&&Ot.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?qi([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Xi(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!qt(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>$t(e,r,Tn())))}),t)}var Zi=q(`$ZodUnion`,(e,t)=>{J.init(e,t),K(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),K(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),K(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),K(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>_t(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Xi(t,r,e,i)):Xi(o,r,e,i)}}),Qi=q(`$ZodIntersection`,(e,t)=>{J.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>ea(e,t,n)):ea(e,i,a)}});function $i(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(kt(e)&&kt(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=$i(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=$i(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ea(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=$i(t.value,n.value);if(!c.valid){if(qt(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var ta=q(`$ZodEnum`,(e,t)=>{J.init(e,t);let n=dt(t.entries),r=new Set(n);e._zod.values=r,K(e,`pattern`,e=>{let t=dt(e.def.entries).filter(e=>jt.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Mt(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),na=q(`$ZodTransform`,(e,t)=>{J.init(e,t),e._zod.optin=`optional`,wn.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Cn(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Sn;return n.value=i,n}});function ra(e,t){return e.value=t.issues.length?void 0:t.value,e}var ia=q(`$ZodOptional`,(e,t)=>{J.init(e,t),K(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,K(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),K(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${_t(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>ra(e,t)):ra(e,r)}return t.innerType._zod.run(e,n)}}),aa=q(`$ZodExactOptional`,(e,t)=>{ia.init(e,t),K(e,`values`,e=>e.def.innerType._zod.values),K(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),oa=q(`$ZodNullable`,(e,t)=>{J.init(e,t),K(e,`optin`,e=>e.def.innerType._zod.optin),K(e,`optout`,e=>e.def.innerType._zod.optout),K(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${_t(t.source)}|null)$`):void 0}),K(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),sa=q(`$ZodDefault`,(e,t)=>{J.init(e,t),e._zod.optin=`defaulted`,K(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>ca(e,t)):ca(r,t)}});function ca(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var la=q(`$ZodPrefault`,(e,t)=>{J.init(e,t),e._zod.optin=`defaulted`,K(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),ua=q(`$ZodNonOptional`,(e,t)=>{J.init(e,t),K(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>da(t,e)):da(i,e)}});function da(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function fa(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>$t(e,r,Tn()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var pa=q(`$ZodCatch`,(e,t)=>{J.init(e,t),K(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),K(e,`optout`,e=>e.def.innerType._zod.optout),K(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>fa(e,r,t,n)):fa(e,r,t,n)}}),ma=q(`$ZodPipe`,(e,t)=>{J.init(e,t),K(e,`values`,e=>e.def.in._zod.values),K(e,`optin`,e=>e.def.in._zod.optin),K(e,`optout`,e=>e.def.out._zod.optout),K(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>ha(e,t.in,n)):ha(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ha(e,t.out,n)):ha(r,t.out,n)}});function ha(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var ga=q(`$ZodReadonly`,(e,t)=>{J.init(e,t),K(e,`propValues`,e=>e.def.innerType._zod.propValues),K(e,`values`,e=>e.def.innerType._zod.values),K(e,`optin`,e=>e.def.innerType?._zod?.optin),K(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(_a):_a(r)}});function _a(e){return e.memo||(e.value=Object.freeze(e.value)),e}var va=q(`$ZodCustom`,(e,t)=>{jr.init(e,t),J.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>ya(t,n,r,e));ya(i,n,r,e)}});function ya(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(an(e))}}var ba=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},xa=`~memo`,Sa=[];function Ca(e){return typeof e==`object`&&!!e}function wa(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Ta=new WeakMap,Ea=0,Da=1,Oa=2;function ka(e,t,n){let r=Ta.get(e);if(r!==void 0)return r?Oa:Ea;if(t.has(e))return Oa;t.add(e);let i=Ea,a=e=>{if(i!==Oa&&e?._zod){let r=ka(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=Ea;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Da:o.value?._zod?ka(o.value,t,n):Ea;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=yt(c);s(e?o(e,!0):Da),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?ka(r,t,!1):Da);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Aa(e,i)}function Aa(e,t){return t!==Da&&Ta.set(e,t===Oa),t}function ja(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Ma,Na=[],Pa={alloc(e,t,n){let r=Ma;if(!r)return n;Ma=void 0;let i={value:n,issues:null};return r.set(t.value,i),Na.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Ia(n,e.value))throw new ba;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=ka(e,new Set,!1);if(i===Ea)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Oa||r?n=!0:r=!0}let l=s.value;if(!Ca(l))return t(s,c);let u=c[xa];u||(u={buckets:new WeakMap,backEdges:void 0},c[xa]=u);let d;i===c?d=a:(d=ja(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...wa(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Ma=d;let p=Na.length,m=t(s,c);Ma=void 0;let h=Na.length>p?Na.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?wa(e.issues):Sa),e)):(h&&(h.issues=m.issues.length?wa(m.issues):Sa),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Fa(){return Pa}function Ia(e,t){let n=e[xa]?.backEdges;return n!==void 0&&Ca(t)&&n.has(t)}var La=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(rn(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Pt(e.values[0])}`:`Invalid option: expected one of ${ft(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${ft(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Ra(){return{localeError:La()}}var za,Ba=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Va(){return new Ba}(za=globalThis).__zod_globalRegistry??(za.__zod_globalRegistry=Va());var Ha=globalThis.__zod_globalRegistry;function Ua(e){return e.checks&&=[...e.checks],e}function Wa(e,t){return new e(Ua({type:`string`,...G(t)}))}function Ga(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...G(t)})}function Ka(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...G(t)})}function qa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...G(t)})}function Ja(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...G(t)})}function Ya(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...G(t)})}function Xa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...G(t)})}function Za(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...G(t)})}function Qa(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...G(t)})}function $a(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...G(t)})}function eo(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...G(t)})}function to(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...G(t)})}function no(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...G(t)})}function ro(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...G(t)})}function io(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...G(t)})}function ao(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...G(t)})}function oo(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...G(t)})}function so(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...G(t)})}function co(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...G(t)})}function lo(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...G(t)})}function uo(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...G(t)})}function fo(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...G(t)})}function po(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...G(t)})}function mo(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...G(t)})}function ho(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...G(t)})}function go(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...G(t)})}function _o(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...G(t)})}function vo(e,t){return new e({type:`boolean`,...G(t)})}function yo(e){return new e({type:`any`})}function bo(e){return new e({type:`unknown`})}function xo(e,t){return new e({type:`never`,...G(t)})}function So(e,t){return new Nr({check:`max_length`,...G(t),maximum:e})}function Co(e,t){return new Pr({check:`min_length`,...G(t),minimum:e})}function wo(e,t){return new Fr({check:`length_equals`,...G(t),length:e})}function To(e,t){return new Lr({check:`string_format`,format:`regex`,...G(t),pattern:e})}function Eo(e){return new Rr({check:`string_format`,format:`lowercase`,...G(e)})}function Do(e){return new zr({check:`string_format`,format:`uppercase`,...G(e)})}function Oo(e,t){return new Br({check:`string_format`,format:`includes`,...G(t),includes:e})}function ko(e,t){return new Vr({check:`string_format`,format:`starts_with`,...G(t),prefix:e})}function Ao(e,t){return new Hr({check:`string_format`,format:`ends_with`,...G(t),suffix:e})}function jo(e,t){return new Wr({check:`properties`,shape:e,...G(t)})}function Mo(e){return new Gr({check:`overwrite`,tx:e})}function No(e){return Mo(t=>t.normalize(e))}function Po(){return Mo(e=>e.trim())}function Fo(){return Mo(e=>e.toLowerCase())}function Io(){return Mo(e=>e.toUpperCase())}function Lo(){return Mo(e=>Tt(e))}function Ro(e,t,n){return new e({type:`array`,element:t,...G(n)})}function zo(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...G(n)})}function Bo(e,t){let n=Vo(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(an(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(an(r))}},e(t.value,t)),t);return n}function Vo(e,t){let n=new jr({check:`custom`,...G(t)});return n._zod.check=e,n}function Ho(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&vt(e,t,n[t]);return e}function Uo(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Ha,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Wo(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function X(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,X(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Ho(o.schema,c),t.io===`input`&&Z(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Go(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Ko(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Go(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Go(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
54
+
55
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function qo(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;qo(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Jo=new Set([`type`,`properties`,`required`,`additionalProperties`]),Yo=[`oneOf`,`anyOf`];function Xo(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Zo(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Jo.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Xo(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}vt(n,r,e.length===1?e[0]:Zo(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Xo(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Qo(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Jo)if(t in e)return;let n=t.filter(e=>Yo.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Zo(t);else{let e=n[0],i=Yo.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Zo([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Ho(e,r))}function $o(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Ho(i,s),Ho(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())qo(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Qo(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Ho(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,vt(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ts(t,`input`,e.processors),output:ts(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Z(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Z(r.element,n);if(r.type===`set`)return Z(r.valueType,n);if(r.type===`lazy`)return Z(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return Z(r.innerType,n);if(r.type===`intersection`)return Z(r.left,n)||Z(r.right,n);if(r.type===`record`||r.type===`map`)return Z(r.keyType,n)||Z(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Z(r.in,n)||Z(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Z(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Z(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Z(e,n))return!0;return!!(r.rest&&Z(r.rest,n))}return!1}var es=(e,t={})=>n=>{let r=Uo({...n,processors:t});return X(e,r),Ko(r,e),$o(r,e)},ts=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Uo({...i??{},target:a,io:t,processors:n});return X(e,o),Ko(o,e),$o(o,e)},ns=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},rs=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},is=(e,t)=>{ns(e,`minimum`,t),rs(e,`maximum`,t)},as=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},os=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},ss=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},cs=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},ls=(e,t)=>ns(e,`minimum`,t.minimum),us=(e,t)=>rs(e,`maximum`,t.maximum),ds=e=>(t,n)=>{cs(t,n.format);let[r,i]=e[n.format];ns(t,`minimum`,r),rs(t,`maximum`,i)},fs={greater_than:(e,t)=>ns(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>rs(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>as(e,t.value),number_format:ds(It),bigint_format:ds(Lt),min_length:ls,max_length:us,length_equals:(e,t)=>is(e,t.length),min_size:ls,max_size:us,size_equals:(e,t)=>is(e,t.size),string_format:(e,t)=>{cs(e,t.format),t.pattern&&os(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>ss(e,t.mime)};function ps(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)fs[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&ns(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&ns(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&rs(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&rs(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&as(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&ss(t,i.mime);for(let e of i.patterns??[])os(t,e);return t}var ms={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},hs=new Map([[Oi,_r],[Ai,vr]]),gs=e=>hs.get(e)??e,_s=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=ps(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ms[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(gs);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},vs=(e,t,n,r)=>{n.type=`boolean`},ys=(e,t,n,r)=>{n.not={}},bs=(e,t,n,r)=>{let i=e._zod.def,a=dt(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},xs=(e,t,n,r)=>{Wo(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Ss=(e,t,n,r)=>{Wo(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Cs=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=ps(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=X(a.element,t,{...r,path:[...r.path,`items`]})};function ws(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?ws(t.out):t.type===`catch`?ws(t.innerType):e._zod.optin}var Ts=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Wo(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)vt(i.properties,e,X(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?ws(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=X(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Es=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>X(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ds=(e,t,n,r)=>{let i=e._zod.def,a=X(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=X(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Os=(e,t,n,r)=>{let i=e._zod.def,a=X(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},ks=(e,t,n,r)=>{let i=e._zod.def;X(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},As=Symbol();function js(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Wo(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),As):JSON.parse(o)}var Ms=(e,t,n,r)=>{let i=e._zod.def;X(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=js(i.defaultValue,e,t,n,r);o!==As&&(n.default=o)},Ns=(e,t,n,r)=>{let i=e._zod.def;X(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=js(i.defaultValue,e,t,n,r);o!==As&&(n._prefault=o)},Ps=(e,t,n,r)=>{let i=e._zod.def;X(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Wo(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Fs=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;X(o,t,r);let s=t.seen.get(e);s.ref=o},Is=(e,t,n,r)=>{let i=e._zod.def;X(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ls=(e,t,n,r)=>{let i=e._zod.def;X(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Rs=new WeakSet([Object.prototype,Error.prototype]);function zs(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Bs=q(`ZodError`,(e,t)=>{jn.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Rs.has(n)||(Rs.add(n),zs(n,`format`,e=>t=>Pn(e,t)),zs(n,`flatten`,e=>t=>Nn(e,t)),zs(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,pt,2)}),zs(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,pt,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Vs=In(Bs),Hs=Ln(Bs),Us=Rn(Bs),Ws=Bn(Bs),Gs=Kn(Bs),Ks=qn(Bs),qs=Jn(Bs),Js=Yn(Bs),Ys=Xn(Bs),Xs=Zn(Bs),Zs=Qn(Bs),Qs=$n(Bs);function $s(){wn.localeError||Tn(Ra())}function ec(){wn.memoizer||Tn({memoizer:Fa()})}var Q=q(`ZodType`,(e,t)=>($s(),J.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(W(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Nt(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(fl(e,t))},superRefine(e,t){return this.check(pl(e,t))},overwrite(e){return this.check(Mo(e))},optional(){return Jc(this)},exactOptional(){return Xc(this)},nullable(){return Qc(this)},nullish(){return Jc(Qc(this))},nonoptional(e){return il(this,e)},array(){return Ic(this)},or(e){return Bc([this,e])},and(e){return Hc(this,e)},transform(e){return cl(this,Kc(e))},default(e){return el(this,e)},prefault(e){return nl(this,e)},catch(e){return ol(this,e)},pipe(e){return cl(this,e)},readonly(){return ul(this)},describe(e){let t=this.clone();return Ha.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ha.get(this);let t=this.clone();return Ha.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return cn(this,`~standard`,{...Xr(this),jsonSchema:{input:ts(this,`input`),output:ts(this,`output`)}})},set"~standard"(e){sn(this,`~standard`,e)},parse:function e(t,n){return Vs(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Hs(this,t,n,{callee:e})},safeParse(e,t){return Us(this,e,t)},async safeParseAsync(e,t){return Ws(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){sn(this,`spa`,e)},validate(e,t){return Un(this,e,t)},validateAsync(e,t){return Gn(this,e,t)},encode:function e(t,n){return Gs(this,t,n,{callee:e})},decode:function e(t,n){return Ks(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await qs(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Js(this,t,n,{callee:e})},safeEncode(e,t){return Ys(this,e,t)},safeDecode(e,t){return Xs(this,e,t)},async safeEncodeAsync(e,t){return Zs(this,e,t)},async safeDecodeAsync(e,t){return Qs(this,e,t)},toJSONSchema(e){return es(this,{})(e)},get description(){return Ha.get(this)?.description},get _def(){return this._zod.def}}),tc=q(`_ZodString`,(e,t)=>{Zr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_s(e,t,n,r)},ln({format:e=>ps(e).format??null,minLength:e=>ps(e).minimum??null,maxLength:e=>ps(e).maximum??null},{regex(...e){return this.check(To(...e))},includes(...e){return this.check(Oo(...e))},startsWith(...e){return this.check(ko(...e))},endsWith(...e){return this.check(Ao(...e))},min(...e){return this.check(Co(...e))},max(...e){return this.check(So(...e))},length(...e){return this.check(wo(...e))},nonempty(...e){return this.check(Co(1,...e))},lowercase(e){return this.check(Eo(e))},uppercase(e){return this.check(Do(e))},trim(){return this.check(Po())},normalize(...e){return this.check(No(...e))},toLowerCase(){return this.check(Fo())},toUpperCase(){return this.check(Io())},slugify(){return this.check(Lo())}})),nc=q(`ZodString`,(e,t)=>{Zr.init(e,t),tc.init(e,t)},{email(e){return this.check(Ga(cc,e))},url(e){return this.check(Za(dc,e))},jwt(e){return this.check(po(Ec,e))},emoji(e){return this.check(Qa(fc,e))},guid(e){return this.check(Ka(lc,e))},uuid(e){return this.check(qa(uc,e))},uuidv4(e){return this.check(Ja(uc,e))},uuidv6(e){return this.check(Ya(uc,e))},uuidv7(e){return this.check(Xa(uc,e))},nanoid(e){return this.check($a(pc,e))},cuid(e){return this.check(eo(mc,e))},cuid2(e){return this.check(to(hc,e))},ulid(e){return this.check(no(gc,e))},base64(e){return this.check(lo(Cc,e))},base64url(e){return this.check(uo(wc,e))},xid(e){return this.check(ro(_c,e))},ksuid(e){return this.check(io(vc,e))},ipv4(e){return this.check(ao(yc,e))},ipv6(e){return this.check(oo(bc,e))},cidrv4(e){return this.check(so(xc,e))},cidrv6(e){return this.check(co(Sc,e))},e164(e){return this.check(fo(Tc,e))},datetime(e){return this.check(mo(ic,e))},date(e){return this.check(ho(ac,e))},time(e){return this.check(go(oc,e))},duration(e){return this.check(_o(sc,e))}});function rc(e){return Wa(nc,e)}var $=q(`ZodStringFormat`,(e,t)=>{Y.init(e,t),tc.init(e,t)}),ic=q(`ZodISODateTime`,(e,t)=>{gi.init(e,t),$.init(e,t)}),ac=q(`ZodISODate`,(e,t)=>{_i.init(e,t),$.init(e,t)}),oc=q(`ZodISOTime`,(e,t)=>{vi.init(e,t),$.init(e,t)}),sc=q(`ZodISODuration`,(e,t)=>{yi.init(e,t),$.init(e,t)}),cc=q(`ZodEmail`,(e,t)=>{ei.init(e,t),$.init(e,t)}),lc=q(`ZodGUID`,(e,t)=>{Qr.init(e,t),$.init(e,t)}),uc=q(`ZodUUID`,(e,t)=>{$r.init(e,t),$.init(e,t)}),dc=q(`ZodURL`,(e,t)=>{ci.init(e,t),$.init(e,t)}),fc=q(`ZodEmoji`,(e,t)=>{li.init(e,t),$.init(e,t)}),pc=q(`ZodNanoID`,(e,t)=>{ui.init(e,t),$.init(e,t)}),mc=q(`ZodCUID`,(e,t)=>{di.init(e,t),$.init(e,t)}),hc=q(`ZodCUID2`,(e,t)=>{fi.init(e,t),$.init(e,t)}),gc=q(`ZodULID`,(e,t)=>{pi.init(e,t),$.init(e,t)}),_c=q(`ZodXID`,(e,t)=>{mi.init(e,t),$.init(e,t)}),vc=q(`ZodKSUID`,(e,t)=>{hi.init(e,t),$.init(e,t)}),yc=q(`ZodIPv4`,(e,t)=>{bi.init(e,t),$.init(e,t)}),bc=q(`ZodIPv6`,(e,t)=>{Ci.init(e,t),$.init(e,t)}),xc=q(`ZodCIDRv4`,(e,t)=>{wi.init(e,t),$.init(e,t)}),Sc=q(`ZodCIDRv6`,(e,t)=>{Ei.init(e,t),$.init(e,t)}),Cc=q(`ZodBase64`,(e,t)=>{ki.init(e,t),$.init(e,t)}),wc=q(`ZodBase64URL`,(e,t)=>{Mi.init(e,t),$.init(e,t)}),Tc=q(`ZodE164`,(e,t)=>{Ni.init(e,t),$.init(e,t)}),Ec=q(`ZodJWT`,(e,t)=>{Fi.init(e,t),$.init(e,t)}),Dc=q(`ZodBoolean`,(e,t)=>{Ii.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vs(e,t,n,r)});function Oc(e){return vo(Dc,e)}var kc=q(`ZodAny`,(e,t)=>{Li.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ac(){return yo(kc)}var jc=q(`ZodUnknown`,(e,t)=>{Ri.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Mc(){return bo(jc)}var Nc=q(`ZodNever`,(e,t)=>{zi.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ys(e,t,n,r)});function Pc(e){return xo(Nc,e)}var Fc=q(`ZodArray`,(e,t)=>{ec(),Ui.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cs(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Co(e,t))},nonempty(e){return this.check(Co(1,e))},max(e,t){return this.check(So(e,t))},length(e,t){return this.check(wo(e,t))},unwrap(){return this.element}});function Ic(e,t){return Ro(Fc,e,t)}var Lc=q(`ZodObject`,(e,t)=>{ec(),Yi.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ts(e,t,n,r),hn(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Wc(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(W(this._zod.def,{catchall:e}))},passthrough(){return this.clone(W(this._zod.def,{catchall:Mc()}))},loose(){return this.clone(W(this._zod.def,{catchall:Mc()}))},strict(){return this.clone(W(this._zod.def,{catchall:Pc()}))},strip(){return this.clone(W(this._zod.def,{catchall:void 0}))},extend(e){return Vt(this,e)},safeExtend(e){return Ut(this,e)},merge(e){return Wt(this,e)},pick(e){return Rt(this,e)},omit(e){return Bt(this,e)},partial(...e){return Gt(qc,this,e[0])},exactPartial(...e){return Gt(Yc,this,e[0],`exactPartial`)},required(...e){return Kt(rl,this,e[0])}});function Rc(e,t){return new Lc({type:`object`,shape:e??{},...G(t)})}var zc=q(`ZodUnion`,(e,t)=>{Zi.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Es(e,t,n,r),e.options=t.options});function Bc(e,t){return new zc({type:`union`,options:e,...G(t)})}var Vc=q(`ZodIntersection`,(e,t)=>{Qi.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ds(e,t,n,r)});function Hc(e,t){return new Vc({type:`intersection`,left:e,right:t})}var Uc=q(`ZodEnum`,(e,t)=>{ta.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bs(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Uc({...t,checks:[],...G(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Uc({...t,checks:[],...G(r),entries:i})}});function Wc(e,t){return new Uc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...G(t)})}var Gc=q(`ZodTransform`,(e,t)=>{ec(),na.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ss(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Cn(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(an(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(an(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Kc(e){return new Gc({type:`transform`,transform:e})}var qc=q(`ZodOptional`,(e,t)=>{ia.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ls(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Jc(e){return new qc({type:`optional`,innerType:e})}var Yc=q(`ZodExactOptional`,(e,t)=>{aa.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ls(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xc(e){return new Yc({type:`optional`,innerType:e})}var Zc=q(`ZodNullable`,(e,t)=>{oa.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Os(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Qc(e){return new Zc({type:`nullable`,innerType:e})}var $c=q(`ZodDefault`,(e,t)=>{sa.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ms(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function el(e,t){return new $c({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():At(t)}})}var tl=q(`ZodPrefault`,(e,t)=>{la.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ns(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function nl(e,t){return new tl({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():At(t)}})}var rl=q(`ZodNonOptional`,(e,t)=>{ua.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ks(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function il(e,t){return new rl({type:`nonoptional`,innerType:e,...G(t)})}var al=q(`ZodCatch`,(e,t)=>{pa.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ps(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ol(e,t){return new al({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:_n(t)})}var sl=q(`ZodPipe`,(e,t)=>{ma.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fs(e,t,n,r),e.in=t.in,e.out=t.out});function cl(e,t){return new sl({type:`pipe`,in:e,out:t})}var ll=q(`ZodReadonly`,(e,t)=>{ga.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Is(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ul(e){return new ll({type:`readonly`,innerType:e})}var dl=q(`ZodCustom`,(e,t)=>{va.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xs(e,t,n,r)});function fl(e,t={}){return zo(dl,e,t)}function pl(e,t){return Bo(e,t)}var ml=q(`ZodInstanceOf`,(e,t)=>{dl.init(e,t)},{properties(e,t){return this.check(jo(e,t))}});function hl(e,t={}){let n=new ml({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...G(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}export{Rc as a,L as c,oe as d,Oc as i,st as l,Ac as n,rc as o,Ic as r,ut as s,hl as t,lt as u};
@@ -0,0 +1,3 @@
1
+ function e(e,t){this.v=e,this.k=t}function t(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function n(e){if(Array.isArray(e))return e}function r(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function i(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function a(e,t){return n(e)||r(e,t)||o(e,t)||i()}function o(e,n){if(e){if(typeof e==`string`)return t(e,n);var r={}.toString.call(e).slice(8,-1);return r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`?Array.from(e):r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}function s(t){var n,r;function i(n,r){try{var o=t[n](r),s=o.value,c=s instanceof e;Promise.resolve(c?s.v:s).then(function(e){if(c){var r=n===`return`&&s.k?n:`next`;if(!s.k||e.done)return i(r,e);e=t[r](e).value}a(!!o.done,e)},function(e){i(`throw`,e)})}catch(e){a(2,e)}}function a(e,t){e===2?n.reject(t):n.resolve({value:t,done:e}),(n=n.next)?i(n.key,n.arg):r=null}this._invoke=function(e,t){return new Promise(function(a,o){var s={key:e,arg:t,resolve:a,reject:o,next:null};r?r=r.next=s:(n=r=s,i(e,t))})},typeof t.return!=`function`&&(this.return=void 0)}s.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},s.prototype.next=function(e){return this._invoke(`next`,e)},s.prototype.throw=function(e){return this._invoke(`throw`,e)},s.prototype.return=function(e){return this._invoke(`return`,e)};var c=Object.entries,l=Object.keys,u=Object.setPrototypeOf,d=Object.isFrozen,f=Object.getPrototypeOf,p=Object.getOwnPropertyDescriptor,m=Object.freeze,h=Object.seal,g=Object.create,ee=typeof Reflect<`u`&&Reflect,te=ee.apply,ne=ee.construct;m||=function(e){return e},h||=function(e){return e},te||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},ne||=function(e){return new e(...[...arguments].slice(1))};var _=D(Array.prototype.forEach),re=D(Array.prototype.lastIndexOf),ie=D(Array.prototype.pop),ae=D(Array.prototype.push),oe=D(Array.prototype.slice),se=D(Array.prototype.splice),v=Array.isArray,ce=O(Set),le=D(Set.prototype.add),ue=D(Set.prototype.has),y=D(String.prototype.toLowerCase),de=D(String.prototype.toString),fe=D(String.prototype.match),pe=D(String.prototype.replace),me=D(String.prototype.indexOf),he=D(String.prototype.trim),b=D(Number.prototype.toString),x=D(Boolean.prototype.toString),ge=typeof BigInt>`u`?null:D(BigInt.prototype.toString),_e=typeof Symbol>`u`?null:D(Symbol.prototype.toString),S=D(Object.prototype.hasOwnProperty),C=D(Object.prototype.toString),w=RegExp.prototype.test,T=function(e,t){return e instanceof RegExp&&(e.lastIndex=0),te(w,e,[t])},E=O(TypeError);function D(e){return function(t){var n=[...arguments].slice(1);return te(e,t,n)}}function O(e){return function(){return ne(e,[...arguments])}}function k(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:y;if(u&&u(e,null),!v(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(d(t)||(t[r]=e),i=e)}e[i]=!0}return e}function A(e){for(let t=0;t<e.length;t++)S(e,t)||(e[t]=null);return e}function ve(e){let t=g(null);for(let r of c(e)){var n=a(r,2);let i=n[0],o=n[1];S(e,i)&&(t[i]=v(o)?A(o):o&&typeof o==`object`&&o.constructor===Object?ve(o):o)}return t}function ye(e){let t=g(null),n=l(e),r=n.length;for(;r--;)t[n[r]]=e[n[r]];return t}function be(e){switch(typeof e){case`string`:return e;case`number`:return b(e);case`boolean`:return x(e);case`bigint`:return ge?ge(e):`0`;case`symbol`:return _e?_e(e):`Symbol()`;case`undefined`:return C(e);case`function`:case`object`:{if(e===null)return C(e);let t=e,n=j(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:C(e)}return C(e)}default:return C(e)}}function j(e,t){for(;e!==null;){let n=p(e,t);if(n){if(n.get)return D(n.get);if(typeof n.value==`function`)return D(n.value)}e=f(e)}function n(){return null}return n}function xe(e,t){for(;e!==null;){let n=p(e,t);if(n)return n.get?D(n.get):null;e=f(e)}return null}function Se(e){if(!e)return!1;try{return T(e,``),!0}catch{return!1}}var Ce=m(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),we=m(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.filter.font.g.glyph.glyphref.hkern.image.line.lineargradient.marker.mask.metadata.mpath.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Te=m([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Ee=m([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),De=m(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Oe=m([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),ke=m([`#text`]),Ae=m(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),je=m(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Me=m(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Ne=m([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Pe=h(/{{[\w\W]*|^[\w\W]*}}/g),Fe=h(/<%[\w\W]*|^[\w\W]*%>/g),Ie=h(/\${[\w\W]*/g),Le=h(/{{|}}|\${|<%|%>|&lt;%|%&gt;/),Re=h(/^data-[\-\w.\u00B7-\uFFFF]+$/),ze=h(/^aria-[\-\w]+$/),Be=h(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ve=h(/^(?:\w+script|data):/i),He=h(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ue=h(/^html$/i),We=h(/^[a-z][.\w]*(-[.\w]+)+$/i),Ge=h(/<[/\w!]/g),Ke=h(/<[/\w]/g),qe=h(/<\/no(script|embed|frames)/i),Je=h(/\/>/i),Ye=h(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i),Xe=h(/^[\r\n\t ]+/),M={element:1,text:3,processingInstruction:7,comment:8,document:9,documentFragment:11},Ze=m(k({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),Qe=function(){return typeof window>`u`?null:window},$e=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},et=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},N=function(e,t,n,r){return S(e,t)&&v(e[t])?k(r.base?ye(r.base):{},e[t],r.transform):n},tt=function(e,t,n){let r=S(e,t)?e[t]:void 0;return r&&typeof r==`object`?ve(r):n};function nt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Qe(),t=e=>nt(e);if(t.version=`3.4.18`,t.removed=[],!e||!e.document||e.document.nodeType!==M.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript,a=e.HTMLTemplateElement,o=e.Node,s=e.Element,l=e.NodeFilter,u=e.DOMParser,d=e.trustedTypes,f=s.prototype,p=j(f,`cloneNode`),ee=j(f,`remove`),te=j(f,`removeAttributeNode`),ne=j(f,`nextSibling`),b=j(f,`childNodes`),x=j(f,`parentNode`),ge=j(f,`shadowRoot`),_e=j(f,`attributes`),C=o&&o.prototype?j(o.prototype,`nodeType`):null,w=o&&o.prototype?j(o.prototype,`nodeName`):null,D=o&&o.prototype?j(o.prototype,`ownerDocument`):null,O=function(e){return C?C(e):e.nodeType},A=function(e){return w?w(e):e.nodeName},rt=xe(f,`namespaceURI`),it=function(e){return rt?rt(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let P,F=``,at,ot=!1,st=0,ct=function(){if(st>0)throw E(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},lt=function(e){ct(),st++;try{return P.createHTML(e)}finally{st--}},ut=function(e){return P&&Vt?lt(e):e},dt=function(e){ct(),st++;try{return P.createScriptURL(e)}finally{st--}},ft=function(){return ot||=(at=$e(d,i),!0),at},pt=n,mt=pt.implementation,ht=pt.createNodeIterator,gt=pt.createDocumentFragment,_t=pt.getElementsByTagName,vt=r.importNode,I=et();t.isSupported=typeof c==`function`&&typeof x==`function`&&mt&&mt.createHTMLDocument!==void 0;let yt=Pe,bt=Fe,xt=Ie,St=Re,Ct=ze,wt=Ve,Tt=He,Et=We,Dt=Be,L=null,Ot=k({},[...Ce,...we,...Te,...De,...ke]),R=null,kt=k({},[...Ae,...je,...Me,...Ne]),z=null,At=null,jt=null,B=Object.seal(g(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Mt=!0,Nt=!0,Pt=!1,Ft=!0,V=!1,H=!0,U=!1,It=!1,Lt=null,Rt=null,zt=!1,W=!1,Bt=!1,Vt=!1,Ht=!0,Ut=!1,Wt=`user-content-`,Gt=!0,Kt=!1,G=null,K=!1,q=null,qt=k({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Jt=null,Yt=k({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Xt=null,Zt=k({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Qt=`http://www.w3.org/1998/Math/MathML`,$t=`http://www.w3.org/2000/svg`,J=`http://www.w3.org/1999/xhtml`,Y=J,en=!1,tn=null,nn=k({},[Qt,$t,J],de),rn=m(k({},[`mi`,`mo`,`mn`,`ms`,`mtext`])),an=null,on=m(k({},[`annotation-xml`])),sn=null,cn=m(g(null)),ln=k({},[`title`,`style`,`font`,`a`,`script`]),un=null,dn=[`application/xhtml+xml`,`text/html`],X=null,fn=null,pn=n.createElement(`form`),mn=function(e){return e instanceof RegExp||e instanceof Function},hn=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e&&typeof e==`object`||(e={}),e=ve(e),un=dn.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,X=un===`application/xhtml+xml`?de:y,L=N(e,`ALLOWED_TAGS`,Ot,{transform:X}),R=N(e,`ALLOWED_ATTR`,kt,{transform:X}),tn=N(e,`ALLOWED_NAMESPACES`,nn,{transform:de}),Xt=N(e,`ADD_URI_SAFE_ATTR`,Zt,{transform:X,base:Zt}),Jt=N(e,`ADD_DATA_URI_TAGS`,Yt,{transform:X,base:Yt}),q=N(e,`FORBID_CONTENTS`,qt,{transform:X}),At=N(e,`FORBID_TAGS`,g(null),{transform:X}),jt=N(e,`FORBID_ATTR`,g(null),{transform:X}),K=S(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?ve(e.USE_PROFILES):e.USE_PROFILES:!1,Mt=e.ALLOW_ARIA_ATTR!==!1,Nt=e.ALLOW_DATA_ATTR!==!1,Pt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ft=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,V=e.SAFE_FOR_TEMPLATES||!1,H=e.SAFE_FOR_XML!==!1,U=e.WHOLE_DOCUMENT||!1,W=e.RETURN_DOM||!1,Bt=e.RETURN_DOM_FRAGMENT||!1,Vt=e.RETURN_TRUSTED_TYPE||!1,zt=e.FORCE_BODY||!1,Ht=e.SANITIZE_DOM!==!1,Ut=e.SANITIZE_NAMED_PROPS||!1,Gt=e.KEEP_CONTENT!==!1,Kt=e.IN_PLACE||!1,Dt=Se(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Be,Y=typeof e.NAMESPACE==`string`?e.NAMESPACE:J,an=tt(e,`MATHML_TEXT_INTEGRATION_POINTS`,rn),sn=tt(e,`HTML_INTEGRATION_POINTS`,on);let t=tt(e,`CUSTOM_ELEMENT_HANDLING`,cn);if(z=g(null),S(t,`tagNameCheck`)&&mn(t.tagNameCheck)&&(z.tagNameCheck=t.tagNameCheck),S(t,`attributeNameCheck`)&&mn(t.attributeNameCheck)&&(z.attributeNameCheck=t.attributeNameCheck),S(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(z.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),h(z),V&&(Nt=!1),Bt&&(W=!0),K&&((S(e,`ALLOWED_TAGS`)||S(e,`ALLOWED_ATTR`))&&typeof console<`u`&&typeof console.warn==`function`&&console.warn(`DOMPurify: USE_PROFILES overrides ALLOWED_TAGS and ALLOWED_ATTR. Do not use these options together.`),L=k({},ke),R=g(null),K.html===!0&&(k(L,Ce),k(R,Ae)),K.svg===!0&&(k(L,we),k(R,je),k(R,Ne)),K.svgFilters===!0&&(k(L,Te),k(R,je),k(R,Ne)),K.mathMl===!0&&(k(L,De),k(R,Me),k(R,Ne))),B.tagCheck=null,B.attributeCheck=null,S(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?B.tagCheck=e.ADD_TAGS:v(e.ADD_TAGS)&&(L===Ot&&(L=ye(L)),k(L,e.ADD_TAGS,X))),S(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?B.attributeCheck=e.ADD_ATTR:v(e.ADD_ATTR)&&(R===kt&&(R=ye(R)),k(R,e.ADD_ATTR,X))),S(e,`ADD_FORBID_CONTENTS`)&&v(e.ADD_FORBID_CONTENTS)&&(q===qt&&(q=ye(q)),k(q,e.ADD_FORBID_CONTENTS,X)),Gt&&(L[`#text`]=!0),U&&k(L,[`html`,`head`,`body`]),L.table&&(L.tbody=!0,delete At.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw E(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw E(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=P;P=e.TRUSTED_TYPES_POLICY;try{F=lt(``)}catch(e){throw P=t,e}}else e.TRUSTED_TYPES_POLICY===null?(P=void 0,F=``):(P===void 0&&(P=ft()),P&&typeof F==`string`&&(F=lt(``)));fn=m(e)},gn=k({},[...we,...Te,...Ee]),_n=k({},[...De,...Oe]),vn=function(e,t,n){return t===J?e===`svg`:t===Qt?e===`svg`&&(n===`annotation-xml`||an[n]):!!gn[e]},yn=function(e,t,n){return t===J?e===`math`:t===$t?e===`math`&&sn[n]:!!_n[e]},bn=function(e,t,n){return t===$t&&!sn[n]||t===Qt&&!an[n]?!1:!_n[e]&&(ln[e]||!gn[e])},xn=function(e){let t=it(e),n=y(A(e)),r=x(e),i=Y,a=`template`;return r&&O(r)===M.element&&(i=it(r),a=y(A(r))),tn[t]?t===$t?vn(n,i,a):t===Qt?yn(n,i,a):t===J?bn(n,i,a):un===`application/xhtml+xml`:!1},Z=function(e){ae(t.removed,{element:e});try{x(e).removeChild(e)}catch{if(ee(e),!x(e))throw E(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},Sn=function(e,t,n){try{te(e,t)}catch{try{e.removeAttribute(n)}catch{}}},Cn=function(e){En(e);let t=b(e);t&&_(oe(t),e=>{try{ee(e)}catch{}}),O(e)===M.element&&wn(e,!1)},Q=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}if(ae(t.removed,{attribute:r||null,from:n}),r)Sn(n,r,e);else try{n.removeAttribute(e)}catch{}if(e===`is`){if(W||Bt)try{Z(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},wn=function(e,t){let n=_e(e);if(n)for(let r=n.length-1;r>=0;--r){let i=n[r],a=i&&i.name;typeof a==`string`&&!(t&&R[X(a)])&&Sn(e,i,a)}},Tn=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&O(e)===M.element){let t=ge(e);Hn(t)&&r.push(t)}let i=b(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},En=function(e){Tn(e,e=>{O(e)===M.element&&wn(e,!0)})},Dn=function(e){let t=[];return Tn(e,e=>{t.push(e)},!0),t},On=function(e,t){let n=ce();_(Dn(e),e=>{O(e)===M.element&&le(n,e)}),_(t,e=>{O(e)===M.element&&!ue(n,e)&&wn(e,!0)})},kn=function(e,n){let r=!1;return _(t.removed,t=>{t.element&&(r||=t.element===e,En(t.element))}),On(e,n),r},An=function(e,t){let n=G,r=null,i=()=>(r||(r=ce(),_(t,e=>{le(r,e)})),r);for(let t=0;;t++){let r=Dn(e),a=[e],o=!1;if(_(r,e=>{O(e)===M.documentFragment?ae(a,e):!o&&!ue(n,e)&&(o=ue(i(),e))}),!o)return;if(t>=8)throw E(`the tree kept changing during in-place sanitization; refusing to return it`);_(a,(t,n)=>{jn(t,n>0,e,i())})}},jn=function(e,t,n,r){let i=In(e),a;for(;a=i.nextNode();)ue(r,a)&&!ue(G,a)&&(t&&$(I.uponSanitizeShadowNode,a,null),rr(a,n))},Mn=function(e){G&&le(G,e)},Nn=function(e,t){return H?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},Pn=function(e){H&&Tn(e,e=>{let t=O(e);if(t===M.processingInstruction||t===M.comment&&T(Ke,e.data)){try{ee(e)}catch{}return!1}if(t===M.element){let t=e,n=X(A(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Nn(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},Fn=function(e){let t=null,r=null;if(zt)e=`<remove></remove>`+e;else{let t=fe(e,Xe);r=t&&t[0]}un===`application/xhtml+xml`&&Y===J&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=P?lt(e):e;if(Y===J)try{t=new u().parseFromString(i,un)}catch{}if(!t||!t.documentElement){t=mt.createDocument(Y,`template`,null);try{t.documentElement.innerHTML=en?F:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Y===J?_t.call(t,U?`html`:`body`)[0]:U?t.documentElement:a},In=function(e){let t=arguments.length>1&&arguments[1]!==void 0&&arguments[1],n=D?D(e):e.ownerDocument;return ht.call(n||e,e,(t?0:l.SHOW_ELEMENT)|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Ln=function(e){return e=pe(e,yt,` `),e=pe(e,bt,` `),e=pe(e,xt,` `),e},Rn=function(e){zn(e);let t=e.querySelectorAll?.call(e,`template`);t&&_(t,e=>{Hn(e.content)&&Rn(e.content)})},zn=function(e){e.normalize();let t=In(e,!0),n=t.nextNode();for(;n;)n.data=Ln(n.data),n=t.nextNode()},Bn=function(e){let t=w?w(e):null;return typeof t!=`string`||X(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==_e(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==C(e)||e.childNodes!==b(e)},Vn=function(e){if(!C||typeof e!=`object`||!e)return null;try{let t=C(e);return typeof t==`number`?t:null}catch{return null}},Hn=function(e){return Vn(e)===M.documentFragment},Un=function(e){return Vn(e)!==null};function $(e,n,r){e.length!==0&&_(e,e=>{e.call(t,n,r,fn)})}let Wn=function(e,t,n){return!!(H&&n===M.element&&e.hasChildNodes()&&!Un(e.firstElementChild)&&T(Ge,e.textContent)&&T(Ge,e.innerHTML)||H&&Ze[t]&&n===M.element&&it(e)===J&&(Un(e.firstElementChild)||typeof e.textContent==`string`&&T(Ge,e.textContent))||n===M.processingInstruction||H&&n===M.comment&&T(Ke,e.data))},Gn=function(e,t){return e instanceof RegExp?T(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Kn=function(e,t,n){if(!At[t]&&Qn(t)&&Gn(z.tagNameCheck,t))return!1;if(Gt&&!q[t]&&!q[y(t)]){let t=x(e),r=b(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?p(r[a],!0):r[a];t.insertBefore(i,ne(e))}}}return Z(e),!0},qn=function(e,t,n,r){return e.length===0?t:t===n||t===r?ye(t):t},Jn=function(e,t){return e===t||x(e)!==null?!1:(Kt&&En(e),!0)},Yn=function(e,n){if(Mn(e),$(I.beforeSanitizeElements,e,null),Jn(e,n))return!0;if(Bn(e))return Z(e),!0;let r=X(A(e)),i=O(e);if(L=qn(I.uponSanitizeElement,L,Ot,Lt),$(I.uponSanitizeElement,e,{tagName:r,allowedTags:L}),Jn(e,n))return!0;if(Wn(e,r,i))return Z(e),!0;if(At[r]||!(B.tagCheck instanceof Function&&B.tagCheck(r))&&!L[r]){let t=Kn(e,r,n);return t===!1&&($(I.afterSanitizeElements,e,null),Jn(e,n))?!0:t}if(i===M.element&&!xn(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&T(qe,e.innerHTML))return Z(e),!0;if(V&&i===M.text){let n=e.textContent,r=Ln(n);n!==r&&(ae(t.removed,{element:e.cloneNode()}),e.textContent=r)}return $(I.afterSanitizeElements,e,null),Jn(e,n)},Xn=function(e,t,r){if(jt[t]||Nn(t,e)||Ht&&(t===`id`||t===`name`)&&(r in n||r in pn))return!1;let i=R[t]||B.attributeCheck instanceof Function&&B.attributeCheck(t,e);if(Nt&&T(St,t)||Mt&&T(Ct,t))return!0;if(!i)return Qn(e)&&Gn(z.tagNameCheck,e)&&Gn(z.attributeNameCheck,t,e)||t===`is`&&z.allowCustomizedBuiltInElements&&Gn(z.tagNameCheck,r);if(Xt[t])return!0;let a=pe(r,Tt,``);return T(Dt,a)||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&me(r,`data:`)===0&&Jt[e]||Pt&&!T(wt,a)?!0:!r},Zn=k({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Qn=function(e){return!Zn[y(e)]&&T(Et,e)},$n=function(e,t,n,r){if(P&&typeof d==`object`&&typeof d.getAttributeType==`function`&&!n)switch(d.getAttributeType(e,t)){case`TrustedHTML`:return lt(r);case`TrustedScriptURL`:return dt(r)}return r},er=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Bn(e)||(Z(e),!1)}catch{return Q(t,e),!1}},tr=function(e,t){return H&&T(Ye,t)?!0:y(e)===`attributename`&&me(t,`href`)!==-1},nr=function(e,n){if($(I.beforeSanitizeAttributes,e,null),Jn(e,n))return;let r=e.attributes;if(!r||Bn(e))return;R=qn(I.uponSanitizeAttribute,R,kt,Rt);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0},a=r.length,o=X(A(e));for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=X(s),d=l,f=s===`value`?d:he(d),p=!1;i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,$(I.uponSanitizeAttribute,e,i),f=i.attrValue,Ut&&(u===`id`||u===`name`)&&me(f,Wt)!==0&&(Q(s,e,n),f=Wt+f,p=!0),tr(s,f)?Q(s,e,n):i.forceKeepAttr||(i.keepAttr?!Ft&&T(Je,f)?Q(s,e,n):(V&&(f=Ln(f)),Xn(o,u,f)?(f=$n(o,u,c,f),f!==d&&er(e,s,c,f)&&p&&ie(t.removed)):Q(s,e,n)):Q(s,e,n))}$(I.afterSanitizeAttributes,e,null),Jn(e,n)},rr=function(e,t){Yn(e,t),nr(e,t),Hn(e.content)&&ir(e.content)},ir=function(e){let t=null,n=In(e);for($(I.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if($(I.uponSanitizeShadowNode,t,null),rr(t,e),O(t)===M.element){let e=ge(t);Hn(e)&&(ar(e),ir(e))}V&&zn(e),$(I.afterSanitizeShadowDOM,e,null)},ar=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){ir(e.shadow);continue}let n=e.node,r=O(n)===M.element,i=b(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=w?w(n):null;if(typeof e==`string`&&X(e)===`template`){let e=n.content;Hn(e)&&t.push({node:e,shadow:null})}}if(r){let e=ge(n);Hn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(en=!e,en&&(e=`<!-->`),typeof e!=`string`&&!Un(e)&&(e=be(e),typeof e!=`string`))throw E(`dirty is not a string, aborting`);if(!t.isSupported)return e;It?(L=Lt,R=Rt):hn(n),t.removed=[];let c=Kt&&typeof e!=`string`&&Un(e),l=[],u=G;if(c){Pn(e);let t=A(e);if(typeof t==`string`){let n=X(t);if(!L[n]||At[n])throw Cn(e),E(`root node is forbidden and cannot be sanitized in-place`)}if(Bn(e))throw Cn(e),E(`root node is clobbered and cannot be sanitized in-place`);l=Dn(e),G=ce()}else if(Un(e))i=Fn(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===M.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),ar(i);else{if(!W&&!V&&!U&&e.indexOf(`<`)===-1)return ut(e);if(i=Fn(e),!i)return W?null:Vt?F:``}i&&zt&&Z(i.firstChild);let d=c?e:i;try{c&&ar(e);let t=In(d);for(;o=t.nextNode();)rr(o,d);c&&An(e,l)}catch(t){throw c&&(Cn(e),kn(e,l)),t}finally{G=u}if(c){if(kn(e,l))throw E(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return V&&Rn(e),e}if(W){if(V&&Rn(i),Bt)for(s=gt.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(R.shadowroot||R.shadowrootmode)&&(s=vt.call(r,s,!0)),s}let f=()=>U?i.outerHTML:i.innerHTML,p=f();return V&&T(Le,p)&&(zn(i),p=f()),U&&L[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&T(Ue,i.ownerDocument.doctype.name)&&(p=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
3
+ `+p),ut(p)},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};hn(e),It=!0,Lt=L,Rt=R},t.clearConfig=function(){fn=null,It=!1,Lt=null,Rt=null,P=at,F=``},t.isValidAttribute=function(e,t,n){fn||hn({});let r=X(e),i=X(t);return typeof n==`string`&&(tr(t,n)||!Ft&&T(Je,n))?!1:Xn(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&S(I,e)&&ae(I[e],t)},t.removeHook=function(e,t){if(S(I,e)){if(t!==void 0){let n=re(I[e],t);return n===-1?void 0:se(I[e],n,1)[0]}return ie(I[e])}},t.removeHooks=function(e){S(I,e)&&(I[e]=[])},t.removeAllHooks=function(){I=et()},t}var rt=nt();export{rt as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./vendor-react-C1iE8mnY.js";var r=e(t(),1),i=n(),a=r.createContext(void 0),o=e=>{let t=r.useContext(a);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},s=({client:e,children:t})=>(r.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,i.jsx)(a.Provider,{value:e,children:t})),c={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},l=new class{#e=c;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function u(e){setTimeout(e,0)}var d=typeof window>`u`||`Deno`in globalThis;function f(){}function p(e,t){return typeof e==`function`?e(t):e}function m(e){return typeof e==`number`&&e>=0&&e!==1/0}function h(e,t){return Math.max(e+(t||0)-Date.now(),0)}function g(e,t){return typeof e==`function`?e(t):e}function _(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==y(o,t.options))return!1}else if(!x(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function v(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(b(t.options.mutationKey)!==b(a))return!1}else if(!x(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function y(e,t){return(t?.queryKeyHashFn||b)(e)}function b(e){return JSON.stringify(e,(e,t)=>E(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function x(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!x(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!x(e[r],t[r]))return!1;return!0}return!1}var S=Object.prototype.hasOwnProperty;function C(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=T(e)&&T(t);if(!r&&!(E(e)&&E(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:S.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=C(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function w(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n of Object.keys(e))if(!S.call(t,n)||e[n]!==t[n])return!1;return!0}function T(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function E(e){if(!D(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!D(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function D(e){return Object.prototype.toString.call(e)===`[object Object]`}function ee(e){return new Promise(t=>{l.setTimeout(t,e)})}function O(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:C(e,t)}function te(e){return e}function ne(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(-n):r}function re(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,n):r}var k=Symbol();function ie(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===k?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ae(e,t){return typeof e==`function`?e(...t):!!e}var A=Symbol();function oe(e,t,n,r){let i=!1,a;return Object.defineProperties(e,{[A]:{value:r},signal:{enumerable:!0,get:()=>(a??=t(),i||(i=!0,a.aborted?n():a.addEventListener(`abort`,n,{once:!0})),a)}}),e}var se=()=>d,j=()=>se(),M=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},N=new class extends M{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},ce=u;function le(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ce,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var P=le(),F=new class extends M{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function ue(e){return Math.min(1e3*2**e,3e4)}function I(e){return(e??`online`)!==`online`||F.isOnline()}var L=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function R(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(f);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new L(t);g(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},p=()=>N.isFocused()&&(e.networkMode===`always`||F.isOnline())&&e.canRun(),m=()=>I(e.networkMode)&&e.canRun(),h=e=>{c()||(r?.(),i=`resolved`,a(e))},g=e=>{c()||(r?.(),i=`rejected`,o(e))},_=t=>new Promise(n=>{r=e=>{(c()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),v=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(h).catch(r=>{if(c())return;let i=e.retry??(j()?0:3),a=e.retryDelay??ue,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);t||!s?g(r):(n++,e.onFail?.(n,r),ee(o).then(()=>c()||p()?void 0:_(p)).then(()=>{t?g(r):v()}))})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:m,start:()=>(m()?v():_(m).then(v),s)}}var z=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),m(this.gcTime)&&(this.#e=l.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(j()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(l.clearTimeout(this.#e),this.#e=void 0)}};function de(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=t,u=e=>{oe(e,()=>t.signal,()=>n=!0,l[A])},d=ie(t.options,t.fetchOptions),f=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return u(e),e})(),o=await d(a),{maxPages:s}=t.options,c=i?re:ne;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?V:B,n={pages:a,pageParams:o};s=await f(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]===void 0?r.initialPageParam:o[0]:B(r,s);if(c>0&&e==null)break;s=await f(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function B(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function V(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function fe(e,t){return t?B(e,t)!=null:!1}function pe(e,t){return!t||!e.getPreviousPageParam?!1:V(e,t)!=null}var me=class extends z{#e;#t;#n;#r;#i;#a;#o;#s;#c;constructor(e){super(),this.#c=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=W(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#s,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=W(this.options);e.data!==void 0&&(this.setState(U(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=O(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(f).catch(f):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>g(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===k||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.state.data!==void 0&&this.getObserversCount()>0&&this.observers.some(e=>g(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!h(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#c||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a&&this.#o)return this.#a.continueRetry(),this.#o}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperties(e,{[A]:{value:n.signal,enumerable:!0},signal:{enumerable:!0,get:()=>(this.#c=!0,n.signal)}})},i=()=>{let e=ie(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#c=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?de(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=R({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof L&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}),s=(async()=>{try{let e=await o.promise;if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof L){if(e.silent){if(this.#a!==o&&this.#o)return this.#o;throw e}if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0,this.#o=void 0),this.scheduleGc()}})();return this.#o=s,o.start(),s}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...H(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...U(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),P.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function H(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:I(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function U(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function W(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var G=class extends M{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),K(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return q(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return q(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof g(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!w(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&J(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||g(this.options.enabled,this.#t)!==g(t.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||g(this.options.enabled,this.#t)!==g(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return w(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch(t).then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(f)),t}#h(e){return!j()&&g(this.options.enabled,this.#t)!==!1&&m(e)}#g(){this.#b();let e=g(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=h(this.#r.dataUpdatedAt,e)+1;this.#u=l.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return g(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=l.setInterval(()=>{(this.options.refetchIntervalInBackground||N.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(l.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(l.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&K(e,t),o=i&&J(e,n,t,r);(a||o)&&(l={...l,...H(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=O(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=O(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=i?.error===f?i.errorUpdatedAt:Date.now(),m=`error`,u=!1);let _=l.fetchStatus===`fetching`,v=m===`pending`,y=m===`error`,b=v&&_,x=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:v,isSuccess:m===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:Y(e,t),refetch:this.refetch,isEnabled:g(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),w(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size||this.options.throwOnError&&this.#r.error!==e.error)return!0;for(let t of n??this.#p)if(this.#r[t]!==e[t])return!0;return!1})();P.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function he(e,t){return g(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||g(t.retryOnMount,e)!==!1)}function K(e,t){return he(e,t)||e.state.data!==void 0&&q(e,t,t.refetchOnMount)}function q(e,t,n){if(g(t.enabled,e)!==!1&&g(t.staleTime,e)!==`static`){let r=g(n,e);return r===`always`||r!==!1&&Y(e,t)}return!1}function J(e,t,n,r){return(e!==t||g(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Y(e,n)}function Y(e,t){return g(t.enabled,e)!==!1&&e.isStaleByTime(g(t.staleTime,e))}var ge=class extends G{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:fe(t,n.data),hasPreviousPage:pe(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},_e=class extends z{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||ve(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=R({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}this.state.isPaused&&r.canStart()&&t();let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),P.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ve(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ye=class extends M{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new _e({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=X(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=X(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=X(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=X(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){P.batch(()=>{let e=this.getAll();this.#e.clear(),this.#t.clear(),e.forEach(e=>{this.notify({type:`removed`,mutation:e})})})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>v(t,e))}findAll(e={}){return this.getAll().filter(t=>v(e,t))}notify(e){P.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return P.batch(()=>Promise.all(e.map(e=>e.continue().catch(f))))}};function X(e){return e.options.scope?.id}function Z(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var be=class extends M{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,P.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!w(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Z(e,n).forEach(e=>{e.destroy()}),Z(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=C(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new G(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&P.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},xe=class extends M{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??y(r,t),a=this.get(i);return a||(a=new me({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){P.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>_(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>_(e,t)):t}notify(e){P.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){P.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){P.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Se=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new xe,this.#t=e.mutationCache||new ye,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=N.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=F.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(g(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=p(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return P.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;P.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return P.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=P.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(f).catch(f)}invalidateQueries(e,t={}){return P.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=P.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n),r=e.state.fetchStatus===`paused`;return(!n.throwOnError||r)&&(t=t.catch(f)),r?Promise.resolve():t}));return Promise.all(r).then(f)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(g(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(g(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(f).catch(f)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(f).catch(f)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return F.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(b(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{x(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(b(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{x(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=y(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===k&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ce=r.createContext(!1),we=()=>r.useContext(Ce);Ce.Provider;function Te(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ee=r.createContext(Te()),De=()=>r.useContext(Ee),Oe=(e,t,n)=>{let r=n?.state.status===`error`&&typeof e.throwOnError==`function`?ae(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},ke=e=>{r.useEffect(()=>{e.clearReset()},[e])},Ae=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ae(n,[e.error,r])),je=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Q=(e,t)=>e?.suspense&&t.isPending,Me=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ne({queries:e,...t},n){let i=o(n),a=we(),s=De(),c=t.subscribed!==!1,l=r.useMemo(()=>e.map(e=>{let t=i.defaultQueryOptions(e);return t._optimisticResults=a?`isRestoring`:c?`optimistic`:void 0,t}),[e,i,a,c]);l.forEach(e=>{je(e);let t=i.getQueryCache().get(e.queryHash);Oe(e,s,t)}),ke(s);let[u]=r.useState(()=>new be(i,l,t)),[d,p,m]=u.getOptimisticResult(l,t.combine);r.useEffect(()=>{u.setQueries(l,t)},[l,t,u]);let h=!a&&c;r.useSyncExternalStore(r.useCallback(e=>h?u.subscribe(P.batchCalls(e)):f,[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult());let g=d.some((e,t)=>Q(l[t],e))?d.flatMap((e,t)=>{let n=l[t];return n&&Q(n,e)?Me(n,new G(i,n),s):[]}):[];if(g.length>0)throw Promise.all(g);let _=d.find((e,t)=>{let n=l[t];return n&&Ae({result:e,errorResetBoundary:s,throwOnError:n.throwOnError,query:i.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(_)throw _.error;return p(m())}function $(e,t,n){let i=we(),a=De(),s=o(n),c=s.defaultQueryOptions(e),l=s.getQueryCache().get(c.queryHash),u=e.subscribed!==!1;c._optimisticResults=i?`isRestoring`:u?`optimistic`:void 0,je(c),Oe(c,a,l),ke(a);let[d]=r.useState(()=>new t(s,c)),p=d.getOptimisticResult(c);r.useEffect(()=>{d.setOptions(c)},[c,d]);let m=!i&&u;if(r.useSyncExternalStore(r.useCallback(e=>{let t=m?d.subscribe(P.batchCalls(e)):f;return d.updateResult(),t},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),Q(c,p))throw Me(c,d,a);if(Ae({result:p,errorResetBoundary:a,throwOnError:c.throwOnError,query:l,suspense:c.suspense}))throw p.error;return c.notifyOnChangeProps?p:d.trackResult(p)}function Pe(e,t){return $(e,G,t)}function Fe(e,t){return $(e,ge,t)}export{te as a,Se as i,Pe as n,s as o,Ne as r,o as s,Fe as t};