@yuriai/web 0.2.27-beta.6 → 0.2.27

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 (228) hide show
  1. package/README.md +8 -0
  2. package/dist/assets/{AgentAvatar-Bi1vvWPC.js → AgentAvatar-DNm_jMna.js} +1 -1
  3. package/dist/assets/AssistantContactStatus-BPRpgMFh.js +3 -0
  4. package/dist/assets/{AssistantUnreadBadge-DdJyySwn.js → AssistantUnreadBadge-BssH-RvV.js} +1 -1
  5. package/dist/assets/AssistantView-CxQv-9Ms.js +1 -0
  6. package/dist/assets/{DiagramView-CI4bTtxy.js → DiagramView-DPpG0fwx.js} +1 -1
  7. package/dist/assets/{FadeInOnReveal-BB4qEnAn.js → FadeInOnReveal-S6UbimjB.js} +1 -1
  8. package/dist/assets/{GuiPluginSurface-CguxFUbM.js → GuiPluginSurface-BOf0JA1T.js} +1 -1
  9. package/dist/assets/{GuiPluginWindow-DOJ7wuRH.js → GuiPluginWindow-OrYkfQ4m.js} +1 -1
  10. package/dist/assets/{Icon-t2xvbAyN.js → Icon-BE4mEwzV.js} +1 -1
  11. package/dist/assets/{ImageLoadingPlaceholder-D1L13TK0.js → ImageLoadingPlaceholder-CBFJC_KD.js} +1 -1
  12. package/dist/assets/{LoadingImage-5rY_edNm.js → LoadingImage-NLq7_P-i.js} +1 -1
  13. package/dist/assets/MarkdownRenderer-BaMotAOQ.js +2 -0
  14. package/dist/assets/{MarkdownRendererImpl-cE-0AYRg.js → MarkdownRendererImpl-Cv6UnGG7.js} +1 -1
  15. package/dist/assets/{MarkstreamRendererImpl-BZyqDl82.js → MarkstreamRendererImpl-Rb9O6wkW.js} +1 -1
  16. package/dist/assets/{MobileDetailNavigation-tbfsMfB-.js → MobileDetailNavigation-CK4KbkeS.js} +1 -1
  17. package/dist/assets/{MobileResizableSheet-BeRmT6_x.js → MobileResizableSheet-Deidw1br.js} +1 -1
  18. package/dist/assets/{MobileShareBridge-C3Equ3P_.js → MobileShareBridge-CO_OWEfq.js} +2 -2
  19. package/dist/assets/MobileTabPageHeader-DbC8L6A4.js +2 -0
  20. package/dist/assets/{MultiRunWindow-CAM2XPII.js → MultiRunWindow-DtVW9NTV.js} +1 -1
  21. package/dist/assets/{OnboardingScreen-4ftRerP5.js → OnboardingScreen-C8ld4wO7.js} +1 -1
  22. package/dist/assets/{OverlayScrollbar-CF0PCvQz.js → OverlayScrollbar-B3auC2WH.js} +1 -1
  23. package/dist/assets/{SettingsView-2tk4WH7R.js → SettingsView-Cm7woZWl.js} +15 -15
  24. package/dist/assets/{SettingsWindow-B9zbeJaW.js → SettingsWindow-CdL4PFxW.js} +1 -1
  25. package/dist/assets/{TerminalView-DfxvTHye.js → TerminalView-CwRB6Yyr.js} +1 -1
  26. package/dist/assets/{ToolOutputDialog-CrjDIhru.js → ToolOutputDialog-B4BfmoVH.js} +1 -1
  27. package/dist/assets/{YuriLogo-QvS1ZEHi.js → YuriLogo-BOx0s0Ue.js} +1 -1
  28. package/dist/assets/{appThemeRegistry-Bb_DtiV9.js → appThemeRegistry-B6woJIX5.js} +1 -1
  29. package/dist/assets/{assistant-attachment-cache-B9iHLlm2.js → assistant-attachment-cache-B_qRvy-k.js} +1 -1
  30. package/dist/assets/{button-DinGM3tu.js → button-BXxwtxsG.js} +1 -1
  31. package/dist/assets/{capgoAdapter-DufzjXRs.js → capgoAdapter-C5HFS-rx.js} +1 -1
  32. package/dist/assets/{collapsible-Bh1GLNYV.js → collapsible-BEm0787p.js} +1 -1
  33. package/dist/assets/context-menu-DUwvVUDY.js +1 -0
  34. package/dist/assets/{desktopRelayRestore-CoLLVJw8.js → desktopRelayRestore-D1UX7HW2.js} +1 -1
  35. package/dist/assets/device-BcRP6Tjd.js +2 -0
  36. package/dist/assets/{diagram-BmG-7Jb4.js → diagram-DyY8dxjZ.js} +1 -1
  37. package/dist/assets/{dialog-BXssfGXA.js → dialog-CLca6ojn.js} +1 -1
  38. package/dist/assets/dropdown-menu.styles-DGaALKP0.js +1 -0
  39. package/dist/assets/{es-HP_Ise0X.js → es-CrsHvgue.js} +2 -2
  40. package/dist/assets/feishu-Ct1ZxlzQ.svg +6 -0
  41. package/dist/assets/fileMentionAutocompleteState-BZJqfgae.js +2 -0
  42. package/dist/assets/{fileMentionTouchSelection-DSl0tj2r.js → fileMentionTouchSelection-C4dvP8GY.js} +2 -2
  43. package/dist/assets/{fileQueries-5a1jkme2.js → fileQueries-BeXkd3o6.js} +1 -1
  44. package/dist/assets/{fileReferenceActions-CGpBSFq4.js → fileReferenceActions-CrIAce3K.js} +1 -1
  45. package/dist/assets/{fr-D0kJXJ6U.js → fr-CEgiRlfa.js} +2 -2
  46. package/dist/assets/{gitApi-Wo0IZow9.js → gitApi-D2G9ny2O.js} +1 -1
  47. package/dist/assets/{gitApiHttp-De9liKnG.js → gitApiHttp-B7vYwgBh.js} +4 -4
  48. package/dist/assets/{gui-9enrif_1.js → gui-CJjEj3l4.js} +1 -1
  49. package/dist/assets/host-CnVx34Dh.js +1 -0
  50. package/dist/assets/{image-loading-Dq1g_wpm.js → image-loading-D5UhMj7Z.js} +1 -1
  51. package/dist/assets/{input-v8-rVbo-.js → input-D59Q2pm8.js} +1 -1
  52. package/dist/assets/insertionBoundaries-CedfTSM5.js +1 -0
  53. package/dist/assets/{ja-BjHKXazE.js → ja-CX-_p9jZ.js} +2 -2
  54. package/dist/assets/{ko-Llwnl876.js → ko-D5xlLYJM.js} +2 -2
  55. package/dist/assets/main-CxpUooVS.js +2 -0
  56. package/dist/assets/main-Dpm4KxWX.js +169 -0
  57. package/dist/assets/{markdownHeightCache-BVV2dktw.js → markdownHeightCache-D2VWb_4E.js} +1 -1
  58. package/dist/assets/{mcpQueries-BoBrB4a4.js → mcpQueries-DQ3KthDF.js} +1 -1
  59. package/dist/assets/miniChat-CTdj8Ug9.js +2 -0
  60. package/dist/assets/mobile-ChbA3Q8j.js +2 -0
  61. package/dist/assets/{mobileBackNavigation-DMSzAvb6.js → mobileBackNavigation-BJqt3oHk.js} +1 -1
  62. package/dist/assets/{multirun-BhWttsRQ.js → multirun-BILeETbd.js} +1 -1
  63. package/dist/assets/{native-DSvNnKAm.js → native-BYMhr-xH.js} +1 -1
  64. package/dist/assets/{native-config-DjdrW_9n.js → native-config-BIY0Cr-l.js} +1 -1
  65. package/dist/assets/{persistence-CfrHIiIS.js → persistence-CWuLIq1J.js} +2 -2
  66. package/dist/assets/{pl-BOd_idqn.js → pl-BjH81A_q.js} +2 -2
  67. package/dist/assets/projectMeta-B9_Uh8YH.js +1 -0
  68. package/dist/assets/{pt-BR-B8djxMsl.js → pt-BR-Dp5oK2x3.js} +2 -2
  69. package/dist/assets/{queryRuntime-Dkpnq3Z1.js → queryRuntime-CTcigFdj.js} +1 -1
  70. package/dist/assets/queue-abort-optimistic-CS5jTJq-.js +1 -0
  71. package/dist/assets/react-DRe85o5s.js +1 -0
  72. package/dist/assets/readiness-BNIgH81X.js +1 -0
  73. package/dist/assets/renderElectronMiniChatApp-asOqV7FB.js +2 -0
  74. package/dist/assets/renderMobileApp-DAfque7-.js +28 -0
  75. package/dist/assets/runtime-fetch-D0YWp3FJ.js +1 -0
  76. package/dist/assets/{runtime-file-download-CcNIVp7u.js → runtime-file-download-Cf1WxfeW.js} +1 -1
  77. package/dist/assets/{runtime-file-resource-6np6lzoV.js → runtime-file-resource-UJjHUF2C.js} +1 -1
  78. package/dist/assets/runtimeConfig-BX8JirIc.js +2 -0
  79. package/dist/assets/runtimeEndpointReset-CFQgUiUr.js +149 -0
  80. package/dist/assets/scheduledTaskNavigation-EomDNVu2.js +1 -0
  81. package/dist/assets/sessionLookup-BxAaxPOw.js +1 -0
  82. package/dist/assets/{sortable-tabs-strip-yKyqsqut.js → sortable-tabs-strip-DpbW5MqX.js} +1 -1
  83. package/dist/assets/speechSettingsQueries-CC0fusUo.js +4 -0
  84. package/dist/assets/src-BMKjN2ip.css +2 -0
  85. package/dist/assets/{store-CUBymvAC.js → store-CkIHVrmT.js} +4 -3
  86. package/dist/assets/{terminalApi-BblSkqch.js → terminalApi-rl9mZAlB.js} +1 -1
  87. package/dist/assets/{textarea-B39OCNPV.js → textarea-7eTptEtD.js} +1 -1
  88. package/dist/assets/{tooltip-d8TNN4lx.js → tooltip-BPwoSTzO.js} +1 -1
  89. package/dist/assets/types-CUtSV1V8.js +2 -0
  90. package/dist/assets/{uk-BNd7CjVO.js → uk-BEfkaLtM.js} +2 -2
  91. package/dist/assets/{useAppFontEffects-BVoVpJYO.js → useAppFontEffects-Ck2PdQRx.js} +52 -52
  92. package/dist/assets/{useAssistantUIStore-Bp6TxG5E.js → useAssistantUIStore-CfaQV3ID.js} +1 -1
  93. package/dist/assets/useDesktopWindowControlsLayout-DxxOUZj1.js +1 -0
  94. package/dist/assets/useEffectiveDirectory-CNCQfN_x.js +1 -0
  95. package/dist/assets/{useFontPreferences-BFyBjtQ6.js → useFontPreferences-DeqW9nRx.js} +1 -1
  96. package/dist/assets/useMobileNavigationStore-BmVr5a5c.js +17 -0
  97. package/dist/assets/useUIStore-C6CE42oh.js +1 -0
  98. package/dist/assets/{useWorkerHighlightedLines-CPxG8Fya.js → useWorkerHighlightedLines-CN_RGaSw.js} +1 -1
  99. package/dist/assets/{vendor-effect-DV9F8PTZ.js → vendor-effect-X1Hqc7ba.js} +13 -13
  100. package/dist/assets/vendor-opencode-client-cQ47ywrT.js +23 -0
  101. package/dist/assets/{vendor-opencode-plugin-CgKz9Hcy.js → vendor-opencode-plugin-BmdTE4Te.js} +1 -1
  102. package/dist/assets/vendor-opencode-schema-DWT45VBX.js +1 -0
  103. package/dist/assets/vendor-solid-js-D98iXT7C.js +1 -0
  104. package/dist/assets/vendor-zod-DZzbCm1s.js +55 -0
  105. package/dist/assets/{zh-CN-BkTAEOZG.js → zh-CN-DipfA56P.js} +2 -2
  106. package/dist/assets/{zh-TW-x8SfMzfc.js → zh-TW-B7pXMVjt.js} +2 -2
  107. package/dist/index.html +18 -18
  108. package/dist/mini-chat.html +18 -18
  109. package/dist/mobile.html +18 -18
  110. package/package.json +6 -1
  111. package/server/index.js +2 -145
  112. package/server/lib/assistants/DOCUMENTATION.md +69 -11
  113. package/server/lib/assistants/cards.js +1 -1
  114. package/server/lib/assistants/channel-image.js +92 -0
  115. package/server/lib/assistants/channel-image.test.js +76 -0
  116. package/server/lib/assistants/channel-output-store.test.js +41 -0
  117. package/server/lib/assistants/channel-output.integration.test.js +114 -0
  118. package/server/lib/assistants/channel-output.js +90 -0
  119. package/server/lib/assistants/channel-output.test.js +79 -0
  120. package/server/lib/assistants/channels/DOCUMENTATION.md +329 -0
  121. package/server/lib/assistants/channels/PROTOCOLS.md +250 -0
  122. package/server/lib/assistants/channels/dingtalk-chat-adapter.js +645 -0
  123. package/server/lib/assistants/channels/dingtalk-chat-adapter.test.js +423 -0
  124. package/server/lib/assistants/channels/integration.test.js +44 -0
  125. package/server/lib/assistants/channels/routes.js +59 -0
  126. package/server/lib/assistants/channels/routes.test.js +139 -0
  127. package/server/lib/assistants/channels/runtime.js +958 -0
  128. package/server/lib/assistants/channels/runtime.test.js +897 -0
  129. package/server/lib/assistants/channels/sdk-adapters.js +383 -0
  130. package/server/lib/assistants/channels/sdk-adapters.test.js +384 -0
  131. package/server/lib/assistants/channels/store.js +249 -0
  132. package/server/lib/assistants/channels/store.test.js +296 -0
  133. package/server/lib/assistants/channels/transport.js +42 -0
  134. package/server/lib/assistants/channels/transport.test.js +23 -0
  135. package/server/lib/assistants/channels/wecom-chat-adapter.js +703 -0
  136. package/server/lib/assistants/channels/wecom-chat-adapter.test.js +130 -0
  137. package/server/lib/assistants/contact-store.js +9 -3
  138. package/server/lib/assistants/contact-store.test.js +27 -0
  139. package/server/lib/assistants/contact-tools.js +65 -75
  140. package/server/lib/assistants/contact-tools.test.js +114 -22
  141. package/server/lib/assistants/harness.js +79 -34
  142. package/server/lib/assistants/harness.test.js +52 -20
  143. package/server/lib/assistants/message-channel-origin.js +7 -0
  144. package/server/lib/assistants/resource-reference.integration.test.js +284 -0
  145. package/server/lib/assistants/routes.js +14 -4
  146. package/server/lib/assistants/service.js +116 -69
  147. package/server/lib/assistants/service.test.js +31 -17
  148. package/server/lib/assistants/weixin/DOCUMENTATION.md +121 -14
  149. package/server/lib/assistants/weixin/api.js +45 -1
  150. package/server/lib/assistants/weixin/api.test.js +28 -0
  151. package/server/lib/assistants/weixin/chat-adapter.js +113 -0
  152. package/server/lib/assistants/weixin/chat-adapter.test.js +62 -0
  153. package/server/lib/assistants/weixin/inbound.js +149 -0
  154. package/server/lib/assistants/weixin/inbound.test.js +141 -0
  155. package/server/lib/assistants/weixin/media.js +79 -0
  156. package/server/lib/assistants/weixin/media.test.js +66 -0
  157. package/server/lib/assistants/weixin/runtime.js +105 -74
  158. package/server/lib/assistants/weixin/runtime.test.js +192 -4
  159. package/server/lib/assistants/weixin/store.js +16 -8
  160. package/server/lib/assistants/weixin/store.test.js +93 -0
  161. package/server/lib/assistants/weixin/toon.js +49 -0
  162. package/server/lib/assistants/weixin/toon.test.js +25 -0
  163. package/server/lib/assistants/yuri-project.http.test.js +9 -3
  164. package/server/lib/github/DOCUMENTATION.md +9 -8
  165. package/server/lib/llm/bridge-plugin.bundle.js +188 -188
  166. package/server/lib/notifications/DOCUMENTATION.md +6 -0
  167. package/server/lib/notifications/runtime.js +26 -15
  168. package/server/lib/notifications/runtime.test.js +14 -13
  169. package/server/lib/opencode/DOCUMENTATION.md +10 -1
  170. package/server/lib/opencode/auth.d.ts +6 -2
  171. package/server/lib/opencode/core-routes.js +0 -1
  172. package/server/lib/opencode/feature-routes-runtime.js +0 -24
  173. package/server/lib/opencode/location-release.d.ts +5 -1
  174. package/server/lib/opencode/managed-capabilities/scheduled-task.js +1 -1
  175. package/server/lib/opencode/managed-capabilities-runtime.test.js +1 -1
  176. package/server/lib/opencode/native-goal.js +15 -0
  177. package/server/lib/opencode/native-goal.test.js +17 -0
  178. package/server/lib/opencode/settings-helpers.js +0 -6
  179. package/server/lib/opencode/shutdown-runtime.js +0 -2
  180. package/server/lib/projects/project-config.js +3 -6
  181. package/server/lib/scheduled-tasks/DOCUMENTATION.md +10 -35
  182. package/server/lib/scheduled-tasks/managed-tool-route.js +1 -30
  183. package/server/lib/scheduled-tasks/routes.js +0 -26
  184. package/server/lib/scheduled-tasks/runtime.js +33 -257
  185. package/server/lib/scheduled-tasks/runtime.test.js +24 -65
  186. package/server/lib/session-metadata/DOCUMENTATION.md +9 -12
  187. package/server/lib/session-metadata/routes.js +4 -38
  188. package/server/lib/session-metadata/routes.test.js +2 -2
  189. package/dist/assets/AssistantContactStatus-CWq-PDz6.js +0 -3
  190. package/dist/assets/AssistantView-Br1iETTs.js +0 -1
  191. package/dist/assets/MarkdownRenderer-BlGxjOei.js +0 -2
  192. package/dist/assets/MobileTabPageHeader-DQRqAAEf.js +0 -2
  193. package/dist/assets/context-menu-DpbkRkk1.js +0 -1
  194. package/dist/assets/device-BjRYYXNT.js +0 -2
  195. package/dist/assets/host-FR_grJxM.js +0 -1
  196. package/dist/assets/insertionBoundaries-CZz7TWJv.js +0 -1
  197. package/dist/assets/main-Bp9HHqTr.js +0 -2
  198. package/dist/assets/main-DOwAfmxJ.js +0 -169
  199. package/dist/assets/miniChat-BJDgCrfF.js +0 -2
  200. package/dist/assets/mobile-GM9931J_.js +0 -2
  201. package/dist/assets/projectMeta-31PobC-M.js +0 -1
  202. package/dist/assets/react-B9v0P7kT.js +0 -1
  203. package/dist/assets/readiness-CYNnsekT.js +0 -1
  204. package/dist/assets/renderElectronMiniChatApp-N2r999Bf.js +0 -2
  205. package/dist/assets/renderMobileApp-CU1ec6Ak.js +0 -28
  206. package/dist/assets/runtime-fetch-D4ja813o.js +0 -1
  207. package/dist/assets/runtimeConfig-Db7yfo6L.js +0 -2
  208. package/dist/assets/runtimeEndpointReset-DO5WVetV.js +0 -149
  209. package/dist/assets/scheduledTaskNavigation-Bsrhv3Ow.js +0 -1
  210. package/dist/assets/sessionLookup-DRVy7LM1.js +0 -1
  211. package/dist/assets/speechSettingsQueries-DU25rmGc.js +0 -4
  212. package/dist/assets/src-Bckdo2XS.css +0 -2
  213. package/dist/assets/types-BqFQhQTt.js +0 -2
  214. package/dist/assets/useDesktopWindowControlsLayout-CYx1LNO5.js +0 -1
  215. package/dist/assets/useEffectiveDirectory-D8FFE5Yn.js +0 -1
  216. package/dist/assets/useMobileNavigationStore-BHMFeMjo.js +0 -23
  217. package/dist/assets/useUIStore-BbYD420L.js +0 -1
  218. package/dist/assets/vendor-opencode-client-UL_TecvQ.js +0 -12
  219. package/dist/assets/vendor-solid-js-0T254UHG.js +0 -1
  220. package/dist/assets/vendor-zod-Dzk5kdUU.js +0 -39
  221. package/server/lib/session-goal/DOCUMENTATION.md +0 -371
  222. package/server/lib/session-goal/capability.js +0 -57
  223. package/server/lib/session-goal/capability.test.js +0 -33
  224. package/server/lib/session-goal/objectives.js +0 -61
  225. package/server/lib/session-goal/routes.js +0 -274
  226. package/server/lib/session-goal/routes.test.js +0 -211
  227. package/server/lib/session-goal/runtime.js +0 -2452
  228. package/server/lib/session-goal/runtime.test.js +0 -2125
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-hePW80VL.js";import{A as t,C as n,D as r,E as i,N as a,P as o,S as s,_ as c,b as l,c as u,d,f,j as p,k as m,l as ee,m as te,p as ne,s as re,u as ie,w as ae,x as h,y as oe}from"./vendor-opencode-client-UL_TecvQ.js";var se=e({Aliases:()=>v,Assets:()=>J,ChildProperties:()=>_,DOMElements:()=>le,DelegatedEvents:()=>b,Dynamic:()=>ze,ErrorBoundary:()=>re,For:()=>u,Hydration:()=>Ce,HydrationScript:()=>J,Index:()=>ee,Match:()=>ie,NoHydration:()=>Se,Portal:()=>Le,Properties:()=>g,RequestContext:()=>we,SVGElements:()=>x,SVGNamespace:()=>S,Show:()=>d,Suspense:()=>f,SuspenseList:()=>ne,Switch:()=>te,addEventListener:()=>A,assign:()=>I,classList:()=>j,className:()=>k,clearDelegatedEvents:()=>pe,createComponent:()=>c,createDynamic:()=>Re,delegateEvents:()=>T,dynamicProperty:()=>ge,effect:()=>h,escape:()=>Ne,generateHydrationScript:()=>J,getAssets:()=>J,getHydrationKey:()=>q,getNextElement:()=>L,getNextMarker:()=>ye,getNextMatch:()=>ve,getOwner:()=>i,getPropAlias:()=>y,getRequestEvent:()=>J,hydrate:()=>Ie,innerHTML:()=>Te,insert:()=>F,isDev:()=>!1,isServer:()=>!1,memo:()=>ue,mergeProps:()=>r,render:()=>w,renderToStream:()=>Q,renderToString:()=>X,renderToStringAsync:()=>Z,resolveSSRNode:()=>Me,runHydrationEvents:()=>be,setAttribute:()=>E,setAttributeNS:()=>D,setBoolAttribute:()=>O,setProperty:()=>me,setStyleProperty:()=>he,spread:()=>N,ssr:()=>Ee,ssrAttribute:()=>Ae,ssrClassList:()=>Oe,ssrElement:()=>De,ssrHydrationKey:()=>je,ssrSpread:()=>Pe,ssrStyle:()=>ke,style:()=>M,template:()=>fe,untrack:()=>o,use:()=>P,useAssets:()=>J}),g=new Set([`className`,`value`,`readOnly`,`noValidate`,`formNoValidate`,`isMap`,`noModule`,`playsInline`,`adAuctionHeaders`,`allowFullscreen`,`browsingTopics`,`defaultChecked`,`defaultMuted`,`defaultSelected`,`disablePictureInPicture`,`disableRemotePlayback`,`preservesPitch`,`shadowRootClonable`,`shadowRootCustomElementRegistry`,`shadowRootDelegatesFocus`,`shadowRootSerializable`,`sharedStorageWritable`,...`allowfullscreen.async.alpha.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.hidden.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.adauctionheaders.browsingtopics.credentialless.defaultchecked.defaultmuted.defaultselected.defer.disablepictureinpicture.disableremoteplayback.preservespitch.shadowrootclonable.shadowrootcustomelementregistry.shadowrootdelegatesfocus.shadowrootserializable.sharedstoragewritable`.split(`.`)]),_=new Set([`innerHTML`,`textContent`,`innerText`,`children`]),v=Object.assign(Object.create(null),{className:`class`,htmlFor:`for`}),ce=Object.assign(Object.create(null),{class:`className`,novalidate:{$:`noValidate`,FORM:1},formnovalidate:{$:`formNoValidate`,BUTTON:1,INPUT:1},ismap:{$:`isMap`,IMG:1},nomodule:{$:`noModule`,SCRIPT:1},playsinline:{$:`playsInline`,VIDEO:1},readonly:{$:`readOnly`,INPUT:1,TEXTAREA:1},adauctionheaders:{$:`adAuctionHeaders`,IFRAME:1},allowfullscreen:{$:`allowFullscreen`,IFRAME:1},browsingtopics:{$:`browsingTopics`,IMG:1},defaultchecked:{$:`defaultChecked`,INPUT:1},defaultmuted:{$:`defaultMuted`,AUDIO:1,VIDEO:1},defaultselected:{$:`defaultSelected`,OPTION:1},disablepictureinpicture:{$:`disablePictureInPicture`,VIDEO:1},disableremoteplayback:{$:`disableRemotePlayback`,AUDIO:1,VIDEO:1},preservespitch:{$:`preservesPitch`,AUDIO:1,VIDEO:1},shadowrootclonable:{$:`shadowRootClonable`,TEMPLATE:1},shadowrootdelegatesfocus:{$:`shadowRootDelegatesFocus`,TEMPLATE:1},shadowrootserializable:{$:`shadowRootSerializable`,TEMPLATE:1},sharedstoragewritable:{$:`sharedStorageWritable`,IFRAME:1,IMG:1}});function y(e,t){let n=ce[e];return typeof n==`object`?n[t]?n.$:void 0:n}var b=new Set([`beforeinput`,`click`,`dblclick`,`contextmenu`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mousemove`,`mouseout`,`mouseover`,`mouseup`,`pointerdown`,`pointermove`,`pointerout`,`pointerover`,`pointerup`,`touchend`,`touchmove`,`touchstart`]),x=new Set(`altGlyph.altGlyphDef.altGlyphItem.animate.animateColor.animateMotion.animateTransform.circle.clipPath.color-profile.cursor.defs.desc.ellipse.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.filter.font.font-face.font-face-format.font-face-name.font-face-src.font-face-uri.foreignObject.g.glyph.glyphRef.hkern.image.line.linearGradient.marker.mask.metadata.missing-glyph.mpath.path.pattern.polygon.polyline.radialGradient.rect.set.stop.svg.switch.symbol.text.textPath.tref.tspan.use.view.vkern`.split(`.`)),S={xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`},le=new Set(`html.base.head.link.meta.style.title.body.address.article.aside.footer.header.main.nav.section.body.blockquote.dd.div.dl.dt.figcaption.figure.hr.li.ol.p.pre.ul.a.abbr.b.bdi.bdo.br.cite.code.data.dfn.em.i.kbd.mark.q.rp.rt.ruby.s.samp.small.span.strong.sub.sup.time.u.var.wbr.area.audio.img.map.track.video.embed.iframe.object.param.picture.portal.source.svg.math.canvas.noscript.script.del.ins.caption.col.colgroup.table.tbody.td.tfoot.th.thead.tr.button.datalist.fieldset.form.input.label.legend.meter.optgroup.option.output.progress.select.textarea.details.dialog.menu.summary.details.slot.template.acronym.applet.basefont.bgsound.big.blink.center.content.dir.font.frame.frameset.hgroup.image.keygen.marquee.menuitem.nobr.noembed.noframes.plaintext.rb.rtc.shadow.spacer.strike.tt.xmp.a.abbr.acronym.address.applet.area.article.aside.audio.b.base.basefont.bdi.bdo.bgsound.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.del.details.dfn.dialog.dir.div.dl.dt.em.embed.fieldset.figcaption.figure.font.footer.form.frame.frameset.head.header.hgroup.hr.html.i.iframe.image.img.input.ins.kbd.keygen.label.legend.li.link.main.map.mark.marquee.menu.menuitem.meta.meter.nav.nobr.noembed.noframes.noscript.object.ol.optgroup.option.output.p.param.picture.plaintext.portal.pre.progress.q.rb.rp.rt.rtc.ruby.s.samp.script.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.title.tr.track.tt.u.ul.var.video.wbr.xmp.input.h1.h2.h3.h4.h5.h6.webview.isindex.listing.multicol.nextid.noindex.search`.split(`.`)),ue=e=>l(()=>e());function de(e,t,n){let r=n.length,i=t.length,a=r,o=0,s=0,c=t[i-1].nextSibling,l=null;for(;o<i||s<a;){if(t[o]===n[s]){o++,s++;continue}for(;t[i-1]===n[a-1];)i--,a--;if(i===o){let t=a<r?s?n[s-1].nextSibling:n[a-s]:c;for(;s<a;)e.insertBefore(n[s++],t)}else if(a===s)for(;o<i;)(!l||!l.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[s]===t[i-1]){let r=t[--i].nextSibling;e.insertBefore(n[s++],t[o++].nextSibling),e.insertBefore(n[--a],r),t[i]=n[a]}else{if(!l){l=new Map;let e=s;for(;e<a;)l.set(n[e],e++)}let r=l.get(t[o]);if(r!=null)if(s<r&&r<a){let c=o,u=1,d;for(;++c<i&&c<a&&(d=l.get(t[c]))!=null&&d===r+u;)u++;if(u>r-s){let i=t[o];for(;s<r;)e.insertBefore(n[s++],i)}else e.replaceChild(n[s++],t[o++])}else o++;else t[o++].remove()}}}var C=`_$DX_DELEGATE`;function w(e,t,n,r={}){let i;return s(r=>{i=r,t===document?e():F(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function fe(e,t,n,r){let i,a=()=>{let t=r?document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`template`):document.createElement(`template`);return t.innerHTML=e,n?t.content.firstChild.firstChild:r?t.firstChild:t.content.firstChild},s=t?()=>o(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return s.cloneNode=s,s}function T(e,t=window.document){let n=t[C]||(t[C]=new Set);for(let r=0,i=e.length;r<i;r++){let i=e[r];n.has(i)||(n.add(i),t.addEventListener(i,V))}}function pe(e=window.document){if(e[C]){for(let t of e[C].keys())e.removeEventListener(t,V);delete e[C]}}function me(e,t,n){R(e)||(e[t]=n)}function E(e,t,n){R(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function D(e,t,n,r){R(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function O(e,t,n){R(e)||(n?e.setAttribute(t,``):e.removeAttribute(t))}function k(e,t){R(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function A(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){let r=n[0];e.addEventListener(t,n[0]=t=>r.call(e,n[1],t))}else e.addEventListener(t,n,typeof n!=`function`&&n)}function j(e,t,n={}){let r=Object.keys(t||{}),i=Object.keys(n),a,o;for(a=0,o=i.length;a<o;a++){let r=i[a];!r||r===`undefined`||t[r]||(z(e,r,!1),delete n[r])}for(a=0,o=r.length;a<o;a++){let i=r[a],o=!!t[i];!i||i===`undefined`||n[i]===o||!o||(z(e,i,!0),n[i]=o)}return n}function M(e,t,n){if(!t)return n?E(e,`style`):t;let r=e.style;if(typeof t==`string`)return r.cssText=t;typeof n==`string`&&(r.cssText=n=void 0),n||={},t||={};let i,a;for(a in n)t[a]??r.removeProperty(a),delete n[a];for(a in t)i=t[a],i!==n[a]&&(r.setProperty(a,i),n[a]=i);return n}function he(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function N(e,t={},n,r){let i={};return r||h(()=>i.children=H(e,t.children,i.children)),h(()=>typeof t.ref==`function`&&P(t.ref,e)),h(()=>I(e,t,n,!0,i,!0)),i}function ge(e,t){let n=e[t];return Object.defineProperty(e,t,{get(){return n()},enumerable:!0}),e}function P(e,t,n){return o(()=>e(t,n))}function F(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return H(e,t,r,n);h(r=>H(e,t(),r,n),r)}function I(e,t,n,r,i={},a=!1){t||={};for(let r in i)if(!(r in t)){if(r===`children`)continue;i[r]=B(e,r,null,i[r],n,a,t)}for(let o in t){if(o===`children`){r||H(e,t.children);continue}let s=t[o];i[o]=B(e,o,s,i[o],n,a,t)}}function _e(e,t,n={}){if(globalThis._$HY.done)return w(e,t,[...t.childNodes],n);p.completed=globalThis._$HY.completed,p.events=globalThis._$HY.events,p.load=e=>globalThis._$HY.r[e],p.has=e=>e in globalThis._$HY.r,p.gather=e=>K(t,e),p.registry=new Map,p.context={id:n.renderId||``,count:0};try{return K(t,n.renderId),w(e,t,[...t.childNodes],n)}finally{p.context=null}}function L(e){let t,n;return!R()||!(t=p.registry.get(n=q()))?e():(p.completed&&p.completed.add(t),p.registry.delete(n),t)}function ve(e,t){for(;e&&e.localName!==t;)e=e.nextSibling;return e}function ye(e){let t=e,n=0,r=[];if(R(e))for(;t;){if(t.nodeType===8){let e=t.nodeValue;if(e===`$`)n++;else if(e===`/`){if(n===0)return[t,r];n--}}r.push(t),t=t.nextSibling}return[t,r]}function be(){p.events&&!p.events.queued&&(queueMicrotask(()=>{let{completed:e,events:t}=p;if(t){for(t.queued=!1;t.length;){let[n,r]=t[0];if(!e.has(n))return;t.shift(),V(r)}p.done&&(p.events=_$HY.events=null,p.completed=_$HY.completed=null)}}),p.events.queued=!0)}function R(e){return!!p.context&&!p.done&&(!e||e.isConnected)}function xe(e){return e.toLowerCase().replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function z(e,t,n){let r=t.trim().split(/\s+/);for(let t=0,i=r.length;t<i;t++)e.classList.toggle(r[t],n)}function B(e,t,n,r,i,a,o){let s,c,l,u,d;if(t===`style`)return M(e,n,r);if(t===`classList`)return j(e,n,r);if(n===r)return r;if(t===`ref`)a||n(e);else if(t.slice(0,3)===`on:`){let i=t.slice(3);r&&e.removeEventListener(i,r,typeof r!=`function`&&r),n&&e.addEventListener(i,n,typeof n!=`function`&&n)}else if(t.slice(0,10)===`oncapture:`){let i=t.slice(10);r&&e.removeEventListener(i,r,!0),n&&e.addEventListener(i,n,!0)}else if(t.slice(0,2)===`on`){let i=t.slice(2).toLowerCase(),a=b.has(i);if(!a&&r){let t=Array.isArray(r)?r[0]:r;e.removeEventListener(i,t)}(a||n)&&(A(e,i,n,a),a&&T([i]))}else if(t.slice(0,5)===`attr:`)E(e,t.slice(5),n);else if(t.slice(0,5)===`bool:`)O(e,t.slice(5),n);else if((d=t.slice(0,5)===`prop:`)||(l=_.has(t))||!i&&((u=y(t,e.tagName))||(c=g.has(t)))||(s=e.nodeName.includes(`-`)||`is`in o)){if(d)t=t.slice(5),c=!0;else if(R(e))return n;t===`class`||t===`className`?k(e,n):s&&!c&&!l?e[xe(t)]=n:e[u||t]=n}else{let r=i&&t.indexOf(`:`)>-1&&S[t.split(`:`)[0]];r?D(e,r,t,n):E(e,v[t]||t,n)}return n}function V(e){if(p.registry&&p.events&&p.events.find(([t,n])=>n===e))return;let t=e.target,n=`$$${e.type}`,r=e.target,i=e.currentTarget,a=t=>Object.defineProperty(e,"target",{configurable:!0,value:t}),o=()=>{let r=t[n];if(r&&!t.disabled){let i=t[`${n}Data`];if(i===void 0?r.call(t,e):r.call(t,i,e),e.cancelBubble)return}return t.host&&typeof t.host!=`string`&&!t.host._$host&&t.contains(e.target)&&a(t.host),!0},s=()=>{for(;o()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),p.registry&&!p.done&&(p.done=_$HY.done=!0),e.composedPath){let n=e.composedPath();a(n[0]);for(let e=0;e<n.length-2&&(t=n[e],o());e++){if(t._$host){t=t._$host,s();break}if(t.parentNode===i)break}}else s();a(r)}function H(e,t,n,r,i){let a=R(e);if(a){!n&&(n=[...e.childNodes]);let t=[];for(let e=0;e<n.length;e++){let r=n[e];r.nodeType===8&&r.data.slice(0,2)===`!$`?r.remove():t.push(r)}n=t}for(;typeof n==`function`;)n=n();if(t===n)return n;let o=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,o===`string`||o===`number`){if(a||o===`number`&&(t=t.toString(),t===n))return n;if(s){let i=n[0];i&&i.nodeType===3?i.data!==t&&(i.data=t):i=document.createTextNode(t),n=G(e,n,r,i)}else n=n!==``&&typeof n==`string`?e.firstChild.data=t:e.textContent=t}else if(t==null||o===`boolean`){if(a)return n;n=G(e,n,r)}else if(o===`function`)return h(()=>{let i=t();for(;typeof i==`function`;)i=i();n=H(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(U(o,t,n,i))return h(()=>n=H(e,o,n,r,!0)),()=>n;if(a){if(!o.length)return n;if(r===void 0)return n=[...e.childNodes];let t=o[0];if(t.parentNode!==e)return n;let i=[t];for(;(t=t.nextSibling)!==r;)i.push(t);return n=i}if(o.length===0){if(n=G(e,n,r),s)return n}else c?n.length===0?W(e,o,r):de(e,n,o):(n&&G(e),W(e,o));n=o}else if(t.nodeType){if(a&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=G(e,n,r,t);G(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function U(e,t,n,r){let i=!1;for(let a=0,o=t.length;a<o;a++){let o=t[a],s=n&&n[e.length],c;if(o!=null&&o!==!0&&o!==!1)if((c=typeof o)==`object`&&o.nodeType)e.push(o);else if(Array.isArray(o))i=U(e,o,s)||i;else if(c===`function`)if(r){for(;typeof o==`function`;)o=o();i=U(e,Array.isArray(o)?o:[o],Array.isArray(s)?s:[s])||i}else e.push(o),i=!0;else{let t=String(o);s&&s.nodeType===3&&s.data===t?e.push(s):e.push(document.createTextNode(t))}}return i}function W(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function G(e,t,n,r){if(n===void 0)return e.textContent=``;let i=r||document.createTextNode(``);if(t.length){let r=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(i!==o){let t=o.parentNode===e;!r&&!a?t?e.replaceChild(i,o):e.insertBefore(i,n):t&&o.remove()}else r=!0}}else e.insertBefore(i,n);return[i]}function K(e,t){let n=e.querySelectorAll(`*[data-hk]`);for(let e=0;e<n.length;e++){let r=n[e],i=r.getAttribute(`data-hk`);(!t||i.startsWith(t))&&!p.registry.has(i)&&p.registry.set(i,r)}}function q(){return p.getNextContextId()}function Se(e){return p.context?void 0:e.children}function Ce(e){return e.children}var J=()=>void 0,we=Symbol();function Te(e,t){!p.context&&(e.innerHTML=t)}function Y(e){let t=Error(`${e.name} is not supported in the browser, returning undefined`);console.error(t)}function X(e,t){Y(X)}function Z(e,t){Y(Z)}function Q(e,t){Y(Q)}function Ee(e,...t){}function De(e,t,n,r){}function Oe(e){}function ke(e){}function Ae(e,t){}function je(){}function Me(e){}function Ne(e){}function Pe(e,t,n){}var Fe=`http://www.w3.org/2000/svg`;function $(e,t=!1,n=void 0){return t?document.createElementNS(Fe,e):document.createElement(e,{is:n})}var Ie=(...e)=>(ae(),_e(...e));function Le(e){let{useShadow:r}=e,a=document.createTextNode(``),o=()=>e.mount||document.body,c=i(),u,d=!!p.context;return oe(()=>{d&&(i().user=d=!1),u||=t(c,()=>l(()=>e.children));let f=o();if(f instanceof HTMLHeadElement){let[e,t]=n(!1);s(t=>F(f,()=>e()?t():u(),null)),m(()=>t(!0))}else{let t=$(e.isSVG?`g`:`div`,e.isSVG),n=r&&t.attachShadow?t.attachShadow({mode:`open`}):t;Object.defineProperty(t,"_$host",{get(){return a.parentNode},configurable:!0}),F(n,u),f.appendChild(t),e.ref&&e.ref(t),m(()=>f.removeChild(t))}},void 0,{render:!d}),a}function Re(e,t){let n=l(e);return l(()=>{let e=n();switch(typeof e){case`function`:return o(()=>e(t));case`string`:let n=x.has(e),r=p.context?L():$(e,n,o(()=>t.is));return N(r,t,n),r}})}function ze(e){let[,t]=a(e,[`component`]);return Re(()=>e.component,t)}export{se as n,w as t};
@@ -1,39 +0,0 @@
1
- Object.freeze({status:`aborted`});function e(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var t=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},n=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},r={};function i(e){return e&&Object.assign(r,e),r}function a(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 o(e,t){return typeof t==`bigint`?t.toString():t}function s(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function c(e){return e==null}function l(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function u(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var d=Symbol(`evaluating`);function f(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==d)return r===void 0&&(r=d,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function p(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function m(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ee(e){return JSON.stringify(e)}function te(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ne=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function h(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var re=s(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function g(e){if(h(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return h(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ie(e){return g(e)?{...e}:Array.isArray(e)?[...e]:e}var ae=new Set([`string`,`number`,`symbol`]);function _(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function v(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function y(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 oe(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var se={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ce(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`);return v(e,m(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return p(this,`shape`,e),e},checks:[]}))}function le(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`);return v(e,m(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return p(this,`shape`,r),r},checks:[]}))}function ue(e,t){if(!g(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return v(e,m(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return p(this,`shape`,n),n}}))}function de(e,t){if(!g(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return v(e,m(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return p(this,`shape`,n),n}}))}function fe(e,t){return v(e,m(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return p(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function pe(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return v(t,m(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return p(this,`shape`,i),i},checks:[]}))}function me(e,t,n){return v(t,m(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return p(this,`shape`,i),i}}))}function b(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 he(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function x(e){return typeof e==`string`?e:e?.message}function S(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=x(e.inst?._zod.def?.error?.(e))??x(t?.error?.(e))??x(n.customError?.(e))??x(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function C(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function w(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var ge=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,o,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},_e=e(`$ZodError`,ge),ve=e(`$ZodError`,ge,{Parent:Error});function ye(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function be(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var T=e=>(n,r,a,o)=>{let s=a?Object.assign(a,{async:!1}):{async:!1},c=n._zod.run({value:r,issues:[]},s);if(c instanceof Promise)throw new t;if(c.issues.length){let t=new((o?.Err)??e)(c.issues.map(e=>S(e,s,i())));throw ne(t,o?.callee),t}return c.value},E=e=>async(t,n,r,a)=>{let o=r?Object.assign(r,{async:!0}):{async:!0},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let t=new((a?.Err)??e)(s.issues.map(e=>S(e,o,i())));throw ne(t,a?.callee),t}return s.value},D=e=>(n,r,a)=>{let o=a?{...a,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new t;return s.issues.length?{success:!1,error:new(e??_e)(s.issues.map(e=>S(e,o,i())))}:{success:!0,data:s.value}},xe=D(ve),O=e=>async(t,n,r)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>S(e,a,i())))}:{success:!0,data:o.value}},Se=O(ve),Ce=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return T(e)(t,n,i)},we=e=>(t,n,r)=>T(e)(t,n,r),Te=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return E(e)(t,n,i)},Ee=e=>async(t,n,r)=>E(e)(t,n,r),De=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return D(e)(t,n,i)},Oe=e=>(t,n,r)=>D(e)(t,n,r),ke=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return O(e)(t,n,i)},Ae=e=>async(t,n,r)=>O(e)(t,n,r),je=/^[cC][^\s-]{8,}$/,Me=/^[0-9a-z]+$/,Ne=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Pe=/^[0-9a-vA-V]{20}$/,Fe=/^[A-Za-z0-9]{27}$/,Ie=/^[a-zA-Z0-9_-]{21}$/,Le=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Re=/^([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})$/,ze=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)$/,Be=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ve=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function He(){return new RegExp(Ve,`u`)}var Ue=/^(?:(?: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])$/,We=/^(([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}|:))$/,Ge=/^((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])$/,Ke=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qe=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Je=/^[A-Za-z0-9_-]*$/,Ye=/^\+[1-9]\d{6,14}$/,Xe=`(?:(?:\\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])))`,Ze=RegExp(`^${Xe}$`);function Qe(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}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function $e(e){return RegExp(`^${Qe(e)}$`)}function et(e){let t=Qe({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Xe}T(?:${r})$`)}var tt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},nt=/^-?\d+$/,rt=/^-?\d+(?:\.\d+)?$/,it=/^(?:true|false)$/i,at=/^[^A-Z]*$/,ot=/^[^a-z]*$/,k=e(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),A={number:`number`,bigint:`bigint`,object:`date`},st=e(`$ZodCheckLessThan`,(e,t)=>{k.init(e,t);let n=A[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ct=e(`$ZodCheckGreaterThan`,(e,t)=>{k.init(e,t);let n=A[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),lt=e(`$ZodCheckMultipleOf`,(e,t)=>{k.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):u(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ut=e(`$ZodCheckNumberFormat`,(e,t)=>{k.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=se[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=nt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),dt=e(`$ZodCheckMaxLength`,(e,t)=>{var n;k.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!c(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=C(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ft=e(`$ZodCheckMinLength`,(e,t)=>{var n;k.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!c(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=C(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pt=e(`$ZodCheckLengthEquals`,(e,t)=>{var n;k.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!c(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=C(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),j=e(`$ZodCheckStringFormat`,(e,t)=>{var n,r;k.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),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=()=>{})}),mt=e(`$ZodCheckRegex`,(e,t)=>{j.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})}}),ht=e(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=at,j.init(e,t)}),gt=e(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ot,j.init(e,t)}),_t=e(`$ZodCheckIncludes`,(e,t)=>{k.init(e,t);let n=_(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),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})}}),vt=e(`$ZodCheckStartsWith`,(e,t)=>{k.init(e,t);let n=RegExp(`^${_(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(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})}}),yt=e(`$ZodCheckEndsWith`,(e,t)=>{k.init(e,t);let n=RegExp(`.*${_(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(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})}}),bt=e(`$ZodCheckOverwrite`,(e,t)=>{k.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),xt=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--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?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
3
- `))}},St={major:4,minor:3,patch:6},M=e(`$ZodType`,(e,n)=>{var r;e??={},e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=St;let i=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&i.unshift(e);for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(e,n,r)=>{let i=b(e),a;for(let o of n){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(i)continue;let n=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&r?.async===!1)throw new t;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,e.issues.length!==n&&(i||=b(e,n))});else{if(e.issues.length===n)continue;i||=b(e,n)}}return a?a.then(()=>e):e},r=(r,a,o)=>{if(b(r))return r.aborted=!0,r;let s=n(a,i,o);if(s instanceof Promise){if(o.async===!1)throw new t;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(a,o)=>{if(o.skipChecks)return e._zod.parse(a,o);if(o.direction===`backward`){let t=e._zod.parse({value:a.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,a,o)):r(t,a,o)}let s=e._zod.parse(a,o);if(s instanceof Promise){if(o.async===!1)throw new t;return s.then(e=>n(e,i,o))}return n(s,i,o)}}f(e,`~standard`,()=>({validate:t=>{try{let n=xe(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Se(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),N=e(`$ZodString`,(e,t)=>{M.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??tt(e._zod.bag),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}}),P=e(`$ZodStringFormat`,(e,t)=>{j.init(e,t),N.init(e,t)}),Ct=e(`$ZodGUID`,(e,t)=>{t.pattern??=Re,P.init(e,t)}),wt=e(`$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??=ze(e)}else t.pattern??=ze();P.init(e,t)}),Tt=e(`$ZodEmail`,(e,t)=>{t.pattern??=Be,P.init(e,t)}),Et=e(`$ZodURL`,(e,t)=>{P.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.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&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.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:r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Dt=e(`$ZodEmoji`,(e,t)=>{t.pattern??=He(),P.init(e,t)}),Ot=e(`$ZodNanoID`,(e,t)=>{t.pattern??=Ie,P.init(e,t)}),kt=e(`$ZodCUID`,(e,t)=>{t.pattern??=je,P.init(e,t)}),At=e(`$ZodCUID2`,(e,t)=>{t.pattern??=Me,P.init(e,t)}),jt=e(`$ZodULID`,(e,t)=>{t.pattern??=Ne,P.init(e,t)}),Mt=e(`$ZodXID`,(e,t)=>{t.pattern??=Pe,P.init(e,t)}),Nt=e(`$ZodKSUID`,(e,t)=>{t.pattern??=Fe,P.init(e,t)}),Pt=e(`$ZodISODateTime`,(e,t)=>{t.pattern??=et(t),P.init(e,t)}),Ft=e(`$ZodISODate`,(e,t)=>{t.pattern??=Ze,P.init(e,t)}),It=e(`$ZodISOTime`,(e,t)=>{t.pattern??=$e(t),P.init(e,t)}),Lt=e(`$ZodISODuration`,(e,t)=>{t.pattern??=Le,P.init(e,t)}),Rt=e(`$ZodIPv4`,(e,t)=>{t.pattern??=Ue,P.init(e,t),e._zod.bag.format=`ipv4`}),zt=e(`$ZodIPv6`,(e,t)=>{t.pattern??=We,P.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Bt=e(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Ge,P.init(e,t)}),Vt=e(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ke,P.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Ht(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Ut=e(`$ZodBase64`,(e,t)=>{t.pattern??=qe,P.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Ht(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Wt(e){if(!Je.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Ht(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Gt=e(`$ZodBase64URL`,(e,t)=>{t.pattern??=Je,P.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Wt(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Kt=e(`$ZodE164`,(e,t)=>{t.pattern??=Ye,P.init(e,t)});function qt(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 Jt=e(`$ZodJWT`,(e,t)=>{P.init(e,t),e._zod.check=n=>{qt(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Yt=e(`$ZodNumber`,(e,t)=>{M.init(e,t),e._zod.pattern=e._zod.bag.pattern??rt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Xt=e(`$ZodNumberFormat`,(e,t)=>{ut.init(e,t),Yt.init(e,t)}),Zt=e(`$ZodBoolean`,(e,t)=>{M.init(e,t),e._zod.pattern=it,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}}),Qt=e(`$ZodUnknown`,(e,t)=>{M.init(e,t),e._zod.parse=e=>e}),$t=e(`$ZodNever`,(e,t)=>{M.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function en(e,t,n){e.issues.length&&t.issues.push(...he(n,e.issues)),t.value[n]=e.value}var tn=e(`$ZodArray`,(e,t)=>{M.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>en(t,n,e))):en(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function F(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...he(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function nn(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=oe(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function I(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>F(e,n,i,t,u))):F(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var rn=e(`$ZodObject`,(e,t)=>{if(M.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=s(()=>nn(t));f(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=h,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>F(n,t,e,s,r))):F(i,t,e,s,r)}return i?I(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),an=e(`$ZodObjectJIT`,(e,t)=>{rn.init(e,t);let n=e._zod.parse,i=s(()=>nn(t)),a=e=>{let t=new xt([`shape`,`payload`,`ctx`]),n=i.value,r=e=>{let t=ee(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let i of n.keys){let n=a[i],o=ee(i),s=e[i]?._zod?.optout===`optional`;t.write(`const ${n} = ${r(i)};`),s?t.write(`
4
- if (${n}.issues.length) {
5
- if (${o} in input) {
6
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
7
- ...iss,
8
- path: iss.path ? [${o}, ...iss.path] : [${o}]
9
- })));
10
- }
11
- }
12
-
13
- if (${n}.value === undefined) {
14
- if (${o} in input) {
15
- newResult[${o}] = undefined;
16
- }
17
- } else {
18
- newResult[${o}] = ${n}.value;
19
- }
20
-
21
- `):t.write(`
22
- if (${n}.issues.length) {
23
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
24
- ...iss,
25
- path: iss.path ? [${o}, ...iss.path] : [${o}]
26
- })));
27
- }
28
-
29
- if (${n}.value === undefined) {
30
- if (${o} in input) {
31
- newResult[${o}] = undefined;
32
- }
33
- } else {
34
- newResult[${o}] = ${n}.value;
35
- }
36
-
37
- `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},o,c=h,l=!r.jitless,u=l&&re.value,d=t.catchall,f;e._zod.parse=(r,s)=>{f??=i.value;let p=r.value;return c(p)?l&&u&&s?.async===!1&&s.jitless!==!0?(o||=a(t.shape),r=o(r,s),d?I([],p,r,s,f,e):r):n(r,s):(r.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),r)}});function L(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let a=e.filter(e=>!b(e));return a.length===1?(t.value=a[0].value,a[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>S(e,r,i())))}),t)}var on=e(`$ZodUnion`,(e,t)=>{M.init(e,t),f(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),f(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),f(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),f(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>l(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>L(t,i,e,a)):L(s,i,e,a)}}),sn=e(`$ZodIntersection`,(e,t)=>{M.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])=>cn(e,t,n)):cn(e,i,a)}});function R(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(g(e)&&g(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=R(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=R(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 cn(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),b(e))return e;let o=R(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var ln=e(`$ZodEnum`,(e,t)=>{M.init(e,t);let n=a(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ae.has(typeof e)).map(e=>typeof e==`string`?_(e):e.toString()).join(`|`)})$`),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}}),un=e(`$ZodLiteral`,(e,t)=>{if(M.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?_(e):e?_(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),dn=e(`$ZodTransform`,(e,r)=>{M.init(e,r),e._zod.parse=(i,a)=>{if(a.direction===`backward`)throw new n(e.constructor.name);let o=r.transform(i.value,i);if(a.async)return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(i.value=e,i));if(o instanceof Promise)throw new t;return i.value=o,i}});function fn(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var pn=e(`$ZodOptional`,(e,t)=>{M.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,f(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),f(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${l(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>fn(t,e.value)):fn(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),mn=e(`$ZodExactOptional`,(e,t)=>{pn.init(e,t),f(e._zod,`values`,()=>t.innerType._zod.values),f(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),hn=e(`$ZodNullable`,(e,t)=>{M.init(e,t),f(e._zod,`optin`,()=>t.innerType._zod.optin),f(e._zod,`optout`,()=>t.innerType._zod.optout),f(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${l(e.source)}|null)$`):void 0}),f(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),gn=e(`$ZodDefault`,(e,t)=>{M.init(e,t),e._zod.optin=`optional`,f(e._zod,`values`,()=>t.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=>_n(e,t)):_n(r,t)}});function _n(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var vn=e(`$ZodPrefault`,(e,t)=>{M.init(e,t),e._zod.optin=`optional`,f(e._zod,`values`,()=>t.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))}),yn=e(`$ZodNonOptional`,(e,t)=>{M.init(e,t),f(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].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=>bn(t,e)):bn(i,e)}});function bn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var xn=e(`$ZodCatch`,(e,t)=>{M.init(e,t),f(e._zod,`optin`,()=>t.innerType._zod.optin),f(e._zod,`optout`,()=>t.innerType._zod.optout),f(e._zod,`values`,()=>t.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(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>S(e,n,i()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>S(e,n,i()))},input:e.value}),e.issues=[]),e)}}),Sn=e(`$ZodPipe`,(e,t)=>{M.init(e,t),f(e._zod,`values`,()=>t.in._zod.values),f(e._zod,`optin`,()=>t.in._zod.optin),f(e._zod,`optout`,()=>t.out._zod.optout),f(e._zod,`propValues`,()=>t.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=>z(e,t.in,n)):z(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>z(e,t.out,n)):z(r,t.out,n)}});function z(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Cn=e(`$ZodReadonly`,(e,t)=>{M.init(e,t),f(e._zod,`propValues`,()=>t.innerType._zod.propValues),f(e._zod,`values`,()=>t.innerType._zod.values),f(e._zod,`optin`,()=>t.innerType?._zod?.optin),f(e._zod,`optout`,()=>t.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(wn):wn(r)}});function wn(e){return e.value=Object.freeze(e.value),e}var Tn=e(`$ZodCustom`,(e,t)=>{k.init(e,t),M.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=>En(t,n,r,e));En(i,n,r,e)}});function En(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(w(e))}}var Dn,On=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 kn(){return new On}(Dn=globalThis).__zod_globalRegistry??(Dn.__zod_globalRegistry=kn());var B=globalThis.__zod_globalRegistry;function An(e,t){return new e({type:`string`,...y(t)})}function jn(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...y(t)})}function Mn(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...y(t)})}function Nn(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...y(t)})}function Pn(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...y(t)})}function Fn(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...y(t)})}function In(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...y(t)})}function Ln(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...y(t)})}function Rn(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...y(t)})}function zn(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...y(t)})}function Bn(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...y(t)})}function Vn(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...y(t)})}function Hn(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...y(t)})}function Un(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...y(t)})}function Wn(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...y(t)})}function Gn(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...y(t)})}function Kn(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...y(t)})}function qn(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...y(t)})}function Jn(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...y(t)})}function Yn(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...y(t)})}function Xn(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...y(t)})}function Zn(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...y(t)})}function Qn(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...y(t)})}function $n(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...y(t)})}function er(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...y(t)})}function tr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...y(t)})}function nr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...y(t)})}function rr(e,t){return new e({type:`number`,checks:[],...y(t)})}function ir(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...y(t)})}function ar(e,t){return new e({type:`boolean`,...y(t)})}function or(e){return new e({type:`unknown`})}function sr(e,t){return new e({type:`never`,...y(t)})}function cr(e,t){return new st({check:`less_than`,...y(t),value:e,inclusive:!1})}function V(e,t){return new st({check:`less_than`,...y(t),value:e,inclusive:!0})}function H(e,t){return new ct({check:`greater_than`,...y(t),value:e,inclusive:!1})}function U(e,t){return new ct({check:`greater_than`,...y(t),value:e,inclusive:!0})}function lr(e,t){return new lt({check:`multiple_of`,...y(t),value:e})}function ur(e,t){return new dt({check:`max_length`,...y(t),maximum:e})}function W(e,t){return new ft({check:`min_length`,...y(t),minimum:e})}function dr(e,t){return new pt({check:`length_equals`,...y(t),length:e})}function fr(e,t){return new mt({check:`string_format`,format:`regex`,...y(t),pattern:e})}function pr(e){return new ht({check:`string_format`,format:`lowercase`,...y(e)})}function mr(e){return new gt({check:`string_format`,format:`uppercase`,...y(e)})}function hr(e,t){return new _t({check:`string_format`,format:`includes`,...y(t),includes:e})}function gr(e,t){return new vt({check:`string_format`,format:`starts_with`,...y(t),prefix:e})}function _r(e,t){return new yt({check:`string_format`,format:`ends_with`,...y(t),suffix:e})}function G(e){return new bt({check:`overwrite`,tx:e})}function vr(e){return G(t=>t.normalize(e))}function yr(){return G(e=>e.trim())}function br(){return G(e=>e.toLowerCase())}function xr(){return G(e=>e.toUpperCase())}function Sr(){return G(e=>te(e))}function Cr(e,t,n){return new e({type:`array`,element:t,...y(n)})}function wr(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...y(n)})}function Tr(e){let t=Er(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(w(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(w(r))}},e(n.value,n)));return t}function Er(e,t){let n=new k({check:`custom`,...y(t)});return n._zod.check=e,n}function Dr(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??B,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function K(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);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,K(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&q(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Or(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);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}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+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>
38
-
39
- 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);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function kr(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)):Object.assign(i,s),Object.assign(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??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);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)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:J(t,`input`,e.processors),output:J(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function q(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 q(r.element,n);if(r.type===`set`)return q(r.valueType,n);if(r.type===`lazy`)return q(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`)return q(r.innerType,n);if(r.type===`intersection`)return q(r.left,n)||q(r.right,n);if(r.type===`record`||r.type===`map`)return q(r.keyType,n)||q(r.valueType,n);if(r.type===`pipe`)return q(r.in,n)||q(r.out,n);if(r.type===`object`){for(let e in r.shape)if(q(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(q(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(q(e,n))return!0;return!!(r.rest&&q(r.rest,n))}return!1}var Ar=(e,t={})=>n=>{let r=Dr({...n,processors:t});return K(e,r),Or(r,e),kr(r,e)},J=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Dr({...i??{},target:a,io:t,processors:n});return K(e,o),Or(o,e),kr(o,e)},jr={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Mr=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=jr[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];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}))])}},Nr=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},Pr=(e,t,n,r)=>{n.type=`boolean`},Fr=(e,t,n,r)=>{n.not={}},Ir=(e,t,n,r)=>{let i=e._zod.def,o=a(i.entries);o.every(e=>typeof e==`number`)&&(n.type=`number`),o.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=o},Lr=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Rr=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},zr=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Br=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=K(a.element,t,{...r,path:[...r.path,`items`]})},Vr=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=K(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=K(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Hr=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>K(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ur=(e,t,n,r)=>{let i=e._zod.def,a=K(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=K(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Wr=(e,t,n,r)=>{let i=e._zod.def,a=K(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`}]},Gr=(e,t,n,r)=>{let i=e._zod.def;K(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Kr=(e,t,n,r)=>{let i=e._zod.def;K(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},qr=(e,t,n,r)=>{let i=e._zod.def;K(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Jr=(e,t,n,r)=>{let i=e._zod.def;K(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Yr=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;K(a,t,r);let o=t.seen.get(e);o.ref=a},Xr=(e,t,n,r)=>{let i=e._zod.def;K(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Zr=(e,t,n,r)=>{let i=e._zod.def;K(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Qr=e(`ZodISODateTime`,(e,t)=>{Pt.init(e,t),Z.init(e,t)});function $r(e){return $n(Qr,e)}var ei=e(`ZodISODate`,(e,t)=>{Ft.init(e,t),Z.init(e,t)});function ti(e){return er(ei,e)}var ni=e(`ZodISOTime`,(e,t)=>{It.init(e,t),Z.init(e,t)});function ri(e){return tr(ni,e)}var ii=e(`ZodISODuration`,(e,t)=>{Lt.init(e,t),Z.init(e,t)});function ai(e){return nr(ii,e)}var oi=(e,t)=>{_e.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>be(e,t)},flatten:{value:t=>ye(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,o,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,o,2)}},isEmpty:{get(){return e.issues.length===0}}})};e(`ZodError`,oi);var Y=e(`ZodError`,oi,{Parent:Error}),si=T(Y),ci=E(Y),li=D(Y),ui=O(Y),di=Ce(Y),fi=we(Y),pi=Te(Y),mi=Ee(Y),hi=De(Y),gi=Oe(Y),_i=ke(Y),vi=Ae(Y),X=e(`ZodType`,(e,t)=>(M.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:J(e,`input`),output:J(e,`output`)}}),e.toJSONSchema=Ar(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(m(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>v(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>si(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>li(e,t,n),e.parseAsync=async(t,n)=>ci(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ui(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>di(e,t,n),e.decode=(t,n)=>fi(e,t,n),e.encodeAsync=async(t,n)=>pi(e,t,n),e.decodeAsync=async(t,n)=>mi(e,t,n),e.safeEncode=(t,n)=>hi(e,t,n),e.safeDecode=(t,n)=>gi(e,t,n),e.safeEncodeAsync=async(t,n)=>_i(e,t,n),e.safeDecodeAsync=async(t,n)=>vi(e,t,n),e.refine=(t,n)=>e.check(Oa(t,n)),e.superRefine=t=>e.check(ka(t)),e.overwrite=t=>e.check(G(t)),e.optional=()=>ua(e),e.exactOptional=()=>fa(e),e.nullable=()=>ma(e),e.nullish=()=>ua(ma(e)),e.nonoptional=t=>ba(e,t),e.array=()=>Zi(e),e.or=t=>ta([e,t]),e.and=t=>ra(e,t),e.transform=t=>wa(e,ca(t)),e.default=t=>ga(e,t),e.prefault=t=>va(e,t),e.catch=t=>Sa(e,t),e.pipe=t=>wa(e,t),e.readonly=()=>Ea(e),e.describe=t=>{let n=e.clone();return B.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return B.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return B.get(e);let n=e.clone();return B.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),yi=e(`_ZodString`,(e,t)=>{N.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mr(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(fr(...t)),e.includes=(...t)=>e.check(hr(...t)),e.startsWith=(...t)=>e.check(gr(...t)),e.endsWith=(...t)=>e.check(_r(...t)),e.min=(...t)=>e.check(W(...t)),e.max=(...t)=>e.check(ur(...t)),e.length=(...t)=>e.check(dr(...t)),e.nonempty=(...t)=>e.check(W(1,...t)),e.lowercase=t=>e.check(pr(t)),e.uppercase=t=>e.check(mr(t)),e.trim=()=>e.check(yr()),e.normalize=(...t)=>e.check(vr(...t)),e.toLowerCase=()=>e.check(br()),e.toUpperCase=()=>e.check(xr()),e.slugify=()=>e.check(Sr())}),bi=e(`ZodString`,(e,t)=>{N.init(e,t),yi.init(e,t),e.email=t=>e.check(jn(Si,t)),e.url=t=>e.check(Ln(wi,t)),e.jwt=t=>e.check(Qn(zi,t)),e.emoji=t=>e.check(Rn(Ti,t)),e.guid=t=>e.check(Mn(Ci,t)),e.uuid=t=>e.check(Nn(Q,t)),e.uuidv4=t=>e.check(Pn(Q,t)),e.uuidv6=t=>e.check(Fn(Q,t)),e.uuidv7=t=>e.check(In(Q,t)),e.nanoid=t=>e.check(zn(Ei,t)),e.guid=t=>e.check(Mn(Ci,t)),e.cuid=t=>e.check(Bn(Di,t)),e.cuid2=t=>e.check(Vn(Oi,t)),e.ulid=t=>e.check(Hn(ki,t)),e.base64=t=>e.check(Yn(Ii,t)),e.base64url=t=>e.check(Xn(Li,t)),e.xid=t=>e.check(Un(Ai,t)),e.ksuid=t=>e.check(Wn(ji,t)),e.ipv4=t=>e.check(Gn(Mi,t)),e.ipv6=t=>e.check(Kn(Ni,t)),e.cidrv4=t=>e.check(qn(Pi,t)),e.cidrv6=t=>e.check(Jn(Fi,t)),e.e164=t=>e.check(Zn(Ri,t)),e.datetime=t=>e.check($r(t)),e.date=t=>e.check(ti(t)),e.time=t=>e.check(ri(t)),e.duration=t=>e.check(ai(t))});function xi(e){return An(bi,e)}var Z=e(`ZodStringFormat`,(e,t)=>{P.init(e,t),yi.init(e,t)}),Si=e(`ZodEmail`,(e,t)=>{Tt.init(e,t),Z.init(e,t)}),Ci=e(`ZodGUID`,(e,t)=>{Ct.init(e,t),Z.init(e,t)}),Q=e(`ZodUUID`,(e,t)=>{wt.init(e,t),Z.init(e,t)}),wi=e(`ZodURL`,(e,t)=>{Et.init(e,t),Z.init(e,t)}),Ti=e(`ZodEmoji`,(e,t)=>{Dt.init(e,t),Z.init(e,t)}),Ei=e(`ZodNanoID`,(e,t)=>{Ot.init(e,t),Z.init(e,t)}),Di=e(`ZodCUID`,(e,t)=>{kt.init(e,t),Z.init(e,t)}),Oi=e(`ZodCUID2`,(e,t)=>{At.init(e,t),Z.init(e,t)}),ki=e(`ZodULID`,(e,t)=>{jt.init(e,t),Z.init(e,t)}),Ai=e(`ZodXID`,(e,t)=>{Mt.init(e,t),Z.init(e,t)}),ji=e(`ZodKSUID`,(e,t)=>{Nt.init(e,t),Z.init(e,t)}),Mi=e(`ZodIPv4`,(e,t)=>{Rt.init(e,t),Z.init(e,t)}),Ni=e(`ZodIPv6`,(e,t)=>{zt.init(e,t),Z.init(e,t)}),Pi=e(`ZodCIDRv4`,(e,t)=>{Bt.init(e,t),Z.init(e,t)}),Fi=e(`ZodCIDRv6`,(e,t)=>{Vt.init(e,t),Z.init(e,t)}),Ii=e(`ZodBase64`,(e,t)=>{Ut.init(e,t),Z.init(e,t)}),Li=e(`ZodBase64URL`,(e,t)=>{Gt.init(e,t),Z.init(e,t)}),Ri=e(`ZodE164`,(e,t)=>{Kt.init(e,t),Z.init(e,t)}),zi=e(`ZodJWT`,(e,t)=>{Jt.init(e,t),Z.init(e,t)}),Bi=e(`ZodNumber`,(e,t)=>{Yt.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nr(e,t,n,r),e.gt=(t,n)=>e.check(H(t,n)),e.gte=(t,n)=>e.check(U(t,n)),e.min=(t,n)=>e.check(U(t,n)),e.lt=(t,n)=>e.check(cr(t,n)),e.lte=(t,n)=>e.check(V(t,n)),e.max=(t,n)=>e.check(V(t,n)),e.int=t=>e.check(Ui(t)),e.safe=t=>e.check(Ui(t)),e.positive=t=>e.check(H(0,t)),e.nonnegative=t=>e.check(U(0,t)),e.negative=t=>e.check(cr(0,t)),e.nonpositive=t=>e.check(V(0,t)),e.multipleOf=(t,n)=>e.check(lr(t,n)),e.step=(t,n)=>e.check(lr(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Vi(e){return rr(Bi,e)}var Hi=e(`ZodNumberFormat`,(e,t)=>{Xt.init(e,t),Bi.init(e,t)});function Ui(e){return ir(Hi,e)}var Wi=e(`ZodBoolean`,(e,t)=>{Zt.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pr(e,t,n,r)});function Gi(e){return ar(Wi,e)}var Ki=e(`ZodUnknown`,(e,t)=>{Qt.init(e,t),X.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function qi(){return or(Ki)}var Ji=e(`ZodNever`,(e,t)=>{$t.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fr(e,t,n,r)});function Yi(e){return sr(Ji,e)}var Xi=e(`ZodArray`,(e,t)=>{tn.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Br(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(W(t,n)),e.nonempty=t=>e.check(W(1,t)),e.max=(t,n)=>e.check(ur(t,n)),e.length=(t,n)=>e.check(dr(t,n)),e.unwrap=()=>e.element});function Zi(e,t){return Cr(Xi,e,t)}var Qi=e(`ZodObject`,(e,t)=>{an.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vr(e,t,n,r),f(e,`shape`,()=>t.shape),e.keyof=()=>ia(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:qi()}),e.loose=()=>e.clone({...e._zod.def,catchall:qi()}),e.strict=()=>e.clone({...e._zod.def,catchall:Yi()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>ue(e,t),e.safeExtend=t=>de(e,t),e.merge=t=>fe(e,t),e.pick=t=>ce(e,t),e.omit=t=>le(e,t),e.partial=(...t)=>pe(la,e,t[0]),e.required=(...t)=>me(ya,e,t[0])});function $i(e,t){return new Qi({type:`object`,shape:e??{},...y(t)})}var ea=e(`ZodUnion`,(e,t)=>{on.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hr(e,t,n,r),e.options=t.options});function ta(e,t){return new ea({type:`union`,options:e,...y(t)})}var na=e(`ZodIntersection`,(e,t)=>{sn.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ur(e,t,n,r)});function ra(e,t){return new na({type:`intersection`,left:e,right:t})}var $=e(`ZodEnum`,(e,t)=>{ln.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ir(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);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 $({...t,checks:[],...y(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 $({...t,checks:[],...y(r),entries:i})}});function ia(e,t){return new $({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...y(t)})}var aa=e(`ZodLiteral`,(e,t)=>{un.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lr(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function oa(e,t){return new aa({type:`literal`,values:Array.isArray(e)?e:[e],...y(t)})}var sa=e(`ZodTransform`,(e,t)=>{dn.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zr(e,t,n,r),e._zod.parse=(r,i)=>{if(i.direction===`backward`)throw new n(e.constructor.name);r.addIssue=n=>{if(typeof n==`string`)r.issues.push(w(n,r.value,t));else{let t=n;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=r.value,t.inst??=e,r.issues.push(w(t))}};let a=t.transform(r.value,r);return a instanceof Promise?a.then(e=>(r.value=e,r)):(r.value=a,r)}});function ca(e){return new sa({type:`transform`,transform:e})}var la=e(`ZodOptional`,(e,t)=>{pn.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zr(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ua(e){return new la({type:`optional`,innerType:e})}var da=e(`ZodExactOptional`,(e,t)=>{mn.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zr(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fa(e){return new da({type:`optional`,innerType:e})}var pa=e(`ZodNullable`,(e,t)=>{hn.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wr(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ma(e){return new pa({type:`nullable`,innerType:e})}var ha=e(`ZodDefault`,(e,t)=>{gn.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kr(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ga(e,t){return new ha({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ie(t)}})}var _a=e(`ZodPrefault`,(e,t)=>{vn.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qr(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function va(e,t){return new _a({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ie(t)}})}var ya=e(`ZodNonOptional`,(e,t)=>{yn.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gr(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ba(e,t){return new ya({type:`nonoptional`,innerType:e,...y(t)})}var xa=e(`ZodCatch`,(e,t)=>{xn.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jr(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Sa(e,t){return new xa({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Ca=e(`ZodPipe`,(e,t)=>{Sn.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yr(e,t,n,r),e.in=t.in,e.out=t.out});function wa(e,t){return new Ca({type:`pipe`,in:e,out:t})}var Ta=e(`ZodReadonly`,(e,t)=>{Cn.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xr(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ea(e){return new Ta({type:`readonly`,innerType:e})}var Da=e(`ZodCustom`,(e,t)=>{Tn.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rr(e,t,n,r)});function Oa(e,t={}){return wr(Da,e,t)}function ka(e){return Tr(e)}export{Vi as a,oa as i,Zi as n,$i as o,Gi as r,xi as s,ia as t};
@@ -1,371 +0,0 @@
1
- # Session Goal
2
-
3
- Server-side control loop that keeps a session working toward a user-defined
4
- objective. On OpenCode 2.x the goal record lives in the Yuri session
5
- metadata store (`packages/web/server/lib/session-metadata/`), folded back onto
6
- `session.metadata` by the proxy. Capability is **open** (`supported: true`):
7
- manual UI, goal routes, and scheduled-task goal create all write the same
8
- store. The small model is an independent progress auditor. Built on
9
- Yuri's backend-driven architecture: the loop lives in the web server
10
- and survives UI disconnects.
11
-
12
- ## v2 storage (Yuri session metadata store)
13
-
14
- OpenCode 2.x accepts session `metadata` only at create time — there is no
15
- PATCH. Goal progress therefore belongs in the Host
16
- `packages/web/server/lib/session-metadata/` store (merge-patched under
17
- `yuri.goal`), not an OpenCode `PATCH /session/:id`.
18
-
19
- `createSessionGoalRuntime` accepts optional seams:
20
-
21
- | Seam | Role |
22
- |---|---|
23
- | `readSessionMetadata` | Read Host metadata for the session |
24
- | `persistSessionGoal` | Full goal replace (routes / scheduled create) |
25
- | `mutateSessionMetadata` | Preferred conditional commit: `decide(committed) → { ok, patch }` on the store lock |
26
-
27
- When `mutateSessionMetadata` is present, runtime goal commits use it exclusively
28
- (no OpenCode PATCH). When only `readSessionMetadata` + `persistSessionGoal` are
29
- present, the runtime falls back to read-then-persist. When neither store path is
30
- wired, the legacy OpenCode PATCH path remains (tests / unwired servers).
31
-
32
- Those seams, the proxy overlay, and `PUT /api/yuri/sessions/:id/metadata`
33
- are wired in `server/index.js`. A UI metadata write notifies the runtime with
34
- a synthetic `session.updated` so create/resume can arm the loop. Metadata PUT
35
- normalizes `executionGeneration` for goal patches inside the store mutate lock.
36
-
37
- **Capability is open** (`supported === true`). Scheduled-task goal create and
38
- `POST /api/goals/:sessionId` persist an active goal into the same store as
39
- manual UI metadata writes; after first persist they notify the runtime with a
40
- synthetic `session.updated` so the loop can arm.
41
-
42
- ## Goal payload (`metadata.yuri.goal`)
43
-
44
- Live activity reads the V2 `session.active` client only. A failed active-session
45
- read remains unknown; it never calls the removed session-status endpoint.
46
-
47
- ```
48
- {
49
- id, // opaque per-logical-goal id; stale-write guard
50
- objective, // inline user text (fallback), <= 5000 chars
51
- objectiveFile, // true: objective text lives in a server-side file
52
- status, // active | paused | blocked | budgetLimited | complete
53
- tokenBudget, // optional positive int
54
- tokensUsed, // tokensCommitted + current segment (snapshot - baseline)
55
- tokensBaseline, // segment start snapshot (pre-goal turn; 0 after compaction)
56
- tokensCommitted, // closed segments' total (one segment per compaction)
57
- turnsUsed, // auto-continuation attempts committed (capped at MAX_AUTO_TURNS)
58
- blockedStreak, // consecutive blocked audit verdicts
59
- auditFailStreak, // consecutive failed/unavailable audit calls
60
- note, // latest audit progress note, <= 280 chars
61
- statusReason, // why settled; 'resumed' is a kickoff signal from UI
62
- lastAccountedMessageID, // incremental accounting cursor
63
- executionGeneration, // execution permit generation (see pause boundary)
64
- pendingContinuation, // durable admission (ticket 10); null when idle
65
- createdAt, updatedAt
66
- }
67
-
68
- ### Durable continuation admission (`pendingContinuation`)
69
-
70
- Minimal Host-metadata field (not a parallel store). Written only through the
71
- same conditional goal owner as other goal commits:
72
-
73
- ```
74
- {
75
- messageID, // msg_goalc_<goalId>_<generation>_<turnsUsed>
76
- goalId, generation, turnsUsed,
77
- phase, // reserved | transport | uncertain | accepted
78
- text, // fixed prompt payload for legal same-id re-dispatch
79
- providerID, modelID, variant?, agent?,
80
- error?, at
81
- }
82
- ```
83
-
84
- Rules:
85
-
86
- 1. **Reserve before send** — persist fixed `messageID` + prompt/selection
87
- identity with `phase: reserved` **without** bumping `turnsUsed`.
88
- 2. **Accept commit** — `turnsUsed` increment and `pendingContinuation: null`
89
- share one conditional write after upstream accept (or reconcile `found`).
90
- 3. **Selection / pre-prompt drop** — pause or switchAgent/switchModel failure
91
- clears reserved pending; **0 count**.
92
- 4. **Uncertain transport** — keep durable identity; pause auto-continue with a
93
- user-visible `statusReason` (reuses blocked/pause reason UI). Reconcile via
94
- official `session.inbox.list` / `session.message.get` (or projected list);
95
- fetch failure is **unavailable**, never authoritative empty.
96
- 5. **Already received** — count once, clear pending; do not invent a new id.
97
- 6. **pause → resume / goal replace** — reserved pending cleared on pause;
98
- transport/uncertain/accepted identity retained (no claim of upstream revoke).
99
- Stale `goalId` / superseded `generation` never overwrite newer user ops;
100
- found-under-stale-gen still counts once.
101
- 7. **Reboot** — restore pending from metadata, reconcile first, then same-id
102
- fixed-payload re-dispatch only when still absent and generation matches.
103
- ```
104
-
105
- The UI writes goals (create/edit/pause/resume/clear) by patching this
106
- metadata; the runtime never creates a goal on its own. Goal creation happens
107
- at send time via the arm store (`useSessionGoalArmStore`): the composer
108
- target button arms "the next prompt is the objective", and the run-as-goal
109
- flows (fork-from-answer dialog, plan implement dialog) arm the same way —
110
- the plan flow additionally supplies an objective OVERRIDE carrying the plan
111
- content, since "Implement this plan: X" alone gives the audit nothing to
112
- judge against. The armed send also attaches a synthetic system-reminder
113
- part telling the agent goal mode is active and that each turn should end
114
- with a factual done/verified/remaining statement for the independent audit.
115
-
116
- ### Execution generation and pause/commit boundary
117
-
118
- `executionGeneration` is the durable execution permit. It starts at `0` on
119
- create and advances on:
120
-
121
- - pause (user, abort, question) while status was `active`
122
- - resume (`paused`/`blocked`/… → `active`)
123
- - execution-condition edits (`tokenBudget`, `objective`, `objectiveFile`)
124
-
125
- Settle paths (`active` → `complete` / `blocked` / `budgetLimited`) keep the
126
- same generation. Writers go through `withGoalExecutionGeneration` (metadata
127
- PUT, `persistSessionGoal` Host wiring) or the runtime's `advanceGeneration`
128
- flag so UI patches that omit the field still bump correctly.
129
-
130
- Runtime commits (continue accounting, settle, pause) validate **goal id +
131
- expected generation + applicable status** on one serial boundary when the
132
- Host `mutateSessionMetadata` seam is wired. A late audit that returns
133
- `continue` / `complete` / `blocked` after pause cannot overwrite the paused
134
- snapshot or start a new `session.prompt` continuation.
135
-
136
- Local (in-process) ordering:
137
-
138
- 1. Pause / stop / `session.updated` paused → bump dispatch epoch + abort
139
- in-flight audit controller + clear idle timer (**before** awaiting durable
140
- write).
141
- 2. Tick captures epoch at start; re-checks before continue commit and before
142
- dispatch.
143
- 3. `sendContinuation` re-validates **epoch + shutdown recovery + stopped** after
144
- every await (`switchAgent` / `switchModel` / generation re-read) and again
145
- immediately before `session.prompt`. It also re-reads durable goal
146
- generation/status at the prompt boundary. A pause or shutdown that lands
147
- during selection must drop with `uncertain: false` and **zero** prompt.
148
- 4. Continuation identity `{ goalId, generation, turnsUsed }` and
149
- `phase: transport` are recorded **only at the actual prompt boundary** —
150
- not before selection. Selection failures (agent/model switch) must **not**
151
- be reported as prompt-uncertain. Uncertain applies only after prompt left
152
- the process and transport failed; the identity is kept for reconcile. The
153
- runtime does **not** claim full revoke of a request already handed upstream.
154
- Explicit stop of the upstream turn remains the existing abort/stop operation.
155
-
156
- Public seams for tests / controlled async: `runTick`, `pauseGoal`,
157
- `getDispatchEpoch`, `getDispatchedContinuation`.
158
-
159
- ## File-backed objectives
160
-
161
- The objective TEXT lives in `<data-dir>/goals/<sessionId>.md` (data dir =
162
- `YURI_DATA_DIR` or `~/.config/yuri`), keyed by the SESSION ID:
163
- sessions are globally unique and carry one goal at a time, so the mapping is
164
- deterministic and a new goal simply overwrites the file. Metadata carries
165
- only `objectiveFile: true` — never a path — so user-writable metadata cannot
166
- become a file-read vector (`objectives.js` also validates the id shape
167
- before touching the filesystem). Rationale: metadata rides every
168
- `session.updated`, so multi-KB objectives must not live there.
169
-
170
- - `objectives.js` — write/read/delete, 5000-char clamp.
171
- - `capability.js` — `getSessionGoalCapability()` / `assertSessionGoalSupported()`
172
- (single source; currently `{ supported: true }`).
173
- - `routes.js` — `GET /api/goals/capability`, create/resume endpoints,
174
- `PUT/GET/DELETE /api/goals/objective/:sessionId` (Yuri-owned,
175
- registered before the generic proxy; JSON parsing via the `/api/goals`
176
- family in core-routes). Create / resume require an injected
177
- `persistSessionGoal` (503 when missing); objective PUT writes the file when
178
- supported. The UI writes the file BEFORE patching the goal metadata and
179
- falls back to an inline objective when the write fails;
180
- `clearSessionGoal` deletes the file best-effort.
181
- - The tick resolves the effective objective fresh on every cycle (the file
182
- is live-editable mid-goal) and falls back to the inline `objective` when
183
- the file is unreadable — a goal never dies because a file went away.
184
- - UI display fetches content via the GET route
185
- (`useGoalObjectiveContent`); in VS Code the route is unavailable, so the
186
- strip degrades to the audit note (display-only fallback by design).
187
- - Scheduled goal tasks write the file server-side directly via
188
- `objectives.js`.
189
-
190
- ## Flow
191
-
192
- Recent-message reads request the newest 40 records with V2 `order: desc`, then
193
- reverse that page into chronological order for tail checks, audit selection and
194
- accounting. The SDK and HTTP fallback use the same ordering contract; `asc`
195
- without a cursor would read the oldest page and strand long sessions after
196
- compaction. Message IDs are not used to reorder the fetched page.
197
-
198
- UI goal removal sends the Merge Patch tombstone `yuri.goal: null`.
199
- Omitting the key preserves the stored goal. Objective-file cleanup and stopping
200
- the active turn follow a successful metadata write; failed writes retain the
201
- goal and its objective for retry.
202
-
203
- 1. `createSessionGoalRuntime` subscribes to the global SSE hub (it needs
204
- the envelope's `directory`).
205
- 2. Native execution success/failure and `session.status: idle` arm a 15s per-session timer; native start/retry and `busy`/`retry` clear
206
- it. A `session.updated` carrying a fresh active goal (`turnsUsed === 0` or
207
- `statusReason === 'resumed'`) arms a kickoff timer — 3s for fresh goals,
208
- ~250ms for an explicit Resume so the nudge feels immediate — since setting
209
- a goal on an idle session emits no status transition.
210
- 3. On fire (`tick`), gated by the `sessionGoalEnabled` setting:
211
- - fetch session (skip sub-agent sessions), require an `active` goal;
212
- - quiescence check via the message tail (trailing user message or
213
- unfinished assistant reply → bail; the next idle transition re-arms).
214
- Exception: an unfinished assistant reply that also carries no error can
215
- be an ORPHAN left by force-killing the app mid-turn — the session is
216
- really idle even though the tail looks incomplete. In that case the tick
217
- corroborates against the live `/session/status` and, if the session is
218
- idle, resumes past the orphan instead of bailing forever. A genuinely
219
- busy session still bails;
220
- - token accounting as a SNAPSHOT of the latest completed assistant turn:
221
- `input + cache.read + output`. Earlier turns' inputs and outputs fold
222
- into the next turn's cache, so the latest snapshot already carries the
223
- whole run's paid tokens — no summing across messages. Goal-relative via
224
- `tokensBaseline` (the same snapshot of the newest pre-goal turn,
225
- captured on the first tick). Compaction (an assistant message with
226
- `summary: true`) breaks the snapshot chain, so accounting is segmented:
227
- the summary message closes the segment into `tokensCommitted` (the
228
- summary turn read the whole context, so its snapshot prices the
229
- compaction itself) and the next segment starts with a zero baseline.
230
- `tokensUsed = tokensCommitted + current segment`, kept monotonic so
231
- unflagged context shrinks never move the budget backwards;
232
- - a user abort pauses the goal instead of blocking it: the event path in
233
- `processPayload` pauses immediately on the MessageAbortedError message
234
- (before any tick could send a continuation over the user's explicit
235
- stop), with a tick-side safety net. Messages sent while paused leave
236
- the goal alone; Resume re-arms the loop, and resuming over an aborted
237
- tail skips the audit and goes straight to a continuation nudge;
238
- - Native `form.created` with `form.metadata.kind === 'question'` and `question.asked` pause an active goal (including when a child /
239
- sub-agent session asks — the parent session's goal is the one paused)
240
- but does NOT abort the current turn: aborting would kill the pending
241
- question. After the user answers, they Resume manually to re-arm
242
- the loop. **Exception:** when question auto-delegate is handling the
243
- ask (`shouldKeepGoalActiveForQuestion`), the goal stays `active` and
244
- only the idle timer is cleared; `tick` also bails while
245
- `isQuestionBlockingGoal` reports a pending auto-delegated question on
246
- the session or a known descendant. User pause / disable of auto-delegate
247
- still calls `pauseForQuestion`. See `lib/question-auto-delegate/`.
248
- Explicit `session.updated` with `status: paused` notifies `onGoalPaused`
249
- (cancels related question timers) **except** when `statusReason` is
250
- `paused for question` (auto-delegate must keep counting). Abort after
251
- metadata already paused still notifies for non-question pause reasons
252
- (UI concurrent abort + metadata race).
253
- - terminal checks, cheapest first: assistant turn error → `blocked`;
254
- `tokensUsed >= tokenBudget` → `budgetLimited`;
255
- `turnsUsed >= MAX_AUTO_TURNS` (20) → `blocked`;
256
- - if the latest message is a compaction summary, skip the audit and
257
- continue unconditionally — running into the context window mid-work is
258
- by definition "in progress, not finished" (the summary is a retelling,
259
- not evidence, and must not be judged);
260
- - otherwise, small-model audit of the objective + the last assistant turn
261
- only — no conversation history and no continuation prompts
262
- (`restrictToPreferredProvider`, session's own provider/model preferred):
263
- JSON `{verdict: continue|complete|blocked, note}`. The audit is the SOLE
264
- termination authority besides the hard stops above — the working agent
265
- has no channel to settle its own goal. `complete` settles; `blocked`
266
- increments `blockedStreak` and settles only after 3 consecutive blocked
267
- verdicts, so a one-off snag cannot end the goal. Audit failure/absence
268
- tolerates ONE consecutive unaudited continuation (`auditFailStreak`); a
269
- second consecutive failure settles the goal as `blocked` ("progress
270
- audit unavailable") — resumable, and settling resets the streak so
271
- Resume gets fresh tolerance. A dead small model can never drive the
272
- loop blind to the turn cap;
273
- - continue (ticket 10 durable admission): persist accounting +
274
- `pendingContinuation` (`phase: reserved`, fixed `msg_goalc_…` id +
275
- prompt/selection payload) **without** bumping `turnsUsed`; re-check
276
- tail; then `session.switchAgent` / `session.switchModel` +
277
- `session.prompt` with that stable id. Accept → one conditional commit
278
- of `turnsUsed + 1` and clear pending. Selection/pre-prompt pause or
279
- failure clears reserved pending (0 count). Uncertain transport keeps
280
- durable identity and pauses auto-continue with a readable
281
- `statusReason`; next tick / reboot reconciles via inbox / exact
282
- message (fail ≠ empty) before any new id. Already-received counts
283
- once. Synthetic is metadata-only (`goalContinuation`).
284
- - **Shutdown recovery (ticket 07):** `session.execution.interrupted` with
285
- `reason: shutdown` clears the idle timer and sets a **local** recovery
286
- pending marker (not a parallel durable store). Auto-continue / tick stay
287
- gated until authoritative `session.status` idle or a non-shutdown
288
- execution terminal clears the marker. Goal status itself is unchanged.
289
-
290
- 4. Settling (`complete`/`blocked`/`budgetLimited`) fires the injected
291
- `emitGoalNotification` so the user hears about it even with the UI closed.
292
- The same settle also notifies a registered Assistant contact reporter
293
- (`setAssignedSessionSettleHandler`) so an assigned/watched session updates
294
- its contact card — read-only, no second scheduler:
295
- desktop + UI broadcast + the standard push fanout (web-push with full
296
- text; APNs with a generic per-type title and the session name as body).
297
- It obeys the notify-on-completion setting. Conversely, while a goal is
298
- ACTIVE the notifications runtime suppresses per-turn "ready"
299
- notifications on every channel — they would only echo the loop's own
300
- continuations; error/question/permission notifications are untouched.
301
- Pausing a goal from the UI also aborts the running turn (and vice versa —
302
- an abort pauses the goal), so "stop" means stop on both axes. A
303
- `question.asked` pause is the exception: it only writes `status: paused`
304
- and leaves the waiting turn intact.
305
-
306
- ## Continuation prompt
307
-
308
- Built inline in `runtime.js`: the objective as untrusted user data in an
309
- XML-escaped `<objective>` block, budget numbers, keep-the-full-objective and
310
- work-from-evidence rules, a completion-audit instruction, and the requirement
311
- to end every turn with a factual done/verified/remaining report — the audit
312
- sees only that final turn, so the report is its evidence.
313
-
314
- ## UI consumers (packages/ui)
315
-
316
- - `lib/sessionGoalMetadata.ts` — payload parsing/types.
317
- - `lib/sessionGoalActions.ts` — create/edit/pause/resume/clear via
318
- `patchSessionMetadata`; `lib/sessionGoalPresentation.ts` — status
319
- colors/labels shared across surfaces.
320
- - `stores/useSessionGoalArmStore.ts` — the "next prompt starts a goal" flag,
321
- consumed by `sendMessage` in `sync/session-ui-store.ts` (works for drafts).
322
- - `hooks/useSessionGoal.ts` — live goal state.
323
- - `components/chat/SessionGoalButton.tsx` — composer target button
324
- (arm / status color / cancel confirm); `SessionGoalRow.tsx` — goal strip
325
- above the composer; `SessionGoalDialog.tsx` — manage dialog
326
- (edit/pause/resume/complete/clear).
327
- - Sidebar glyph next to the date in `SessionNodeItem`.
328
-
329
- ## Capability (Host goal state)
330
-
331
- `capability.js` is the single source for whether Host goal state is available:
332
-
333
- ```
334
- getSessionGoalCapability() → { supported: true }
335
- ```
336
-
337
- Goal records live in the Yuri session-metadata store (not OpenCode
338
- SessionInfo). Routes, scheduled tasks, and the proxy overlay share that store.
339
-
340
- | Surface | While supported |
341
- |---|---|
342
- | `GET /api/goals/capability` | `{ supported: true }` |
343
- | `POST /api/goals/:sessionId` (create) | Write objective + persist active goal (503 if persist missing) |
344
- | `POST /api/goals/:sessionId/resume` | Set status active / statusReason resumed (404 if no goal) |
345
- | `PUT /api/goals/objective/:sessionId` | Writes the objective file |
346
- | `GET` / `DELETE` objective | Allowed |
347
- | Scheduled `goalEnabled` create/edit | Allowed |
348
- | Existing `goalEnabled` task run | Persist goal after session create; fail before create if persist unwired |
349
-
350
- ## Scheduled goals
351
-
352
- Scheduled tasks with `execution.goalEnabled` (+ optional
353
- `execution.goalTokenBudget`) write the objective file, persist an active goal
354
- into the Host store (same shape as manual create), notify the goal runtime to
355
- arm, and attach the goal-mode intro to the prompt. Without
356
- `persistSessionGoal` injected, runs fail **before** session create (no
357
- create/distill/prompt side effects).
358
-
359
- ## Limitations
360
-
361
- - TODO(watch): Assistant contact assign skipped a watch tool this slice.
362
- Goal settle already notifies. Do not invent a second scheduler. A later
363
- thin contact tool can post a read-only session status card when
364
- `metadata.yuri.goal` settles.
365
- - Web-server feature: VS Code (extension-only) renders goal state via
366
- `session.updated` but does not run the loop.
367
- - A goal on a session with no assistant reply yet starts after the first
368
- user exchange completes (no provider/model to continue with before that).
369
- - `tokensUsed` only counts completed assistant messages seen within the
370
- 40-message fetch window per tick; extremely long busy stretches between
371
- idles undercount (acceptable: budget is a guardrail, not billing).