@shumai-one/shumai 0.4.2 → 0.4.4

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 (269) hide show
  1. package/bin/chunk-071x515q.js +4 -0
  2. package/bin/{chunk-adekdctx.css → chunk-0ccg9ddn.css} +1 -1
  3. package/bin/chunk-0cmx7k4c.js +1 -0
  4. package/bin/chunk-0qaq0sp8.js +5 -0
  5. package/bin/chunk-0qjfahk9.js +2 -0
  6. package/bin/chunk-0zv3bks2.js +2 -0
  7. package/bin/chunk-16xax8kk.js +1 -0
  8. package/bin/chunk-1gvscz88.js +5 -0
  9. package/bin/chunk-1j27fzy1.js +2 -0
  10. package/bin/chunk-1t167cvj.js +11 -0
  11. package/bin/chunk-1xh34aew.js +2 -0
  12. package/bin/chunk-1zwajpwf.js +8 -0
  13. package/bin/chunk-2w5xqhjm.js +1 -0
  14. package/bin/chunk-3tedzb2j.js +54 -0
  15. package/bin/chunk-3ttrhqy3.js +2 -0
  16. package/bin/chunk-3zkasqb8.js +1 -0
  17. package/bin/chunk-453ykvaw.js +2 -0
  18. package/bin/chunk-4991gz3y.js +13 -0
  19. package/bin/chunk-4hkkdm2q.js +2 -0
  20. package/bin/chunk-4mjywsj8.js +3 -0
  21. package/bin/chunk-4v41a1r9.js +6 -0
  22. package/bin/chunk-4wy87hwd.js +3 -0
  23. package/bin/chunk-579e4wv4.js +3 -0
  24. package/bin/chunk-5adsx8x4.js +2 -0
  25. package/bin/chunk-5hg6kcfz.js +45 -0
  26. package/bin/chunk-5nm2jvg5.js +32 -0
  27. package/bin/chunk-5tcdwep5.js +11 -0
  28. package/bin/chunk-5vzrpz50.js +2 -0
  29. package/bin/chunk-6ghcj4a9.js +3 -0
  30. package/bin/chunk-77fmkpdz.js +10 -0
  31. package/bin/chunk-7bcxj1jd.js +2 -0
  32. package/bin/chunk-7gmdnsdg.js +2 -0
  33. package/bin/chunk-7jtmwt5a.js +3 -0
  34. package/bin/chunk-7kjgvxqa.js +2 -0
  35. package/bin/chunk-7pw1550a.js +2 -0
  36. package/bin/chunk-7rhz2gze.js +211 -0
  37. package/bin/chunk-837fky18.js +3 -0
  38. package/bin/chunk-84as6x83.js +1 -0
  39. package/bin/chunk-8e28hcny.js +2 -0
  40. package/bin/chunk-914bp49r.js +4 -0
  41. package/bin/chunk-97f2af6d.js +12 -0
  42. package/bin/chunk-98715kc3.js +2 -0
  43. package/bin/chunk-9ccw540k.js +2 -0
  44. package/bin/chunk-9t8n2des.js +2 -0
  45. package/bin/chunk-9ybt6vbm.js +1 -0
  46. package/bin/chunk-a6gx7f5q.js +1 -0
  47. package/bin/chunk-avwgktxb.js +2 -0
  48. package/bin/chunk-bkr5zm4h.js +2 -0
  49. package/bin/chunk-cbgq517y.js +2 -0
  50. package/bin/chunk-d27mm390.js +1 -0
  51. package/bin/chunk-dj92fss9.js +2 -0
  52. package/bin/chunk-dqxeztfa.js +2 -0
  53. package/bin/chunk-drepsbb4.js +2 -0
  54. package/bin/chunk-f6svp4dp.js +2 -0
  55. package/bin/chunk-fahk9h62.js +8 -0
  56. package/bin/chunk-fb40xxz3.js +3 -0
  57. package/bin/chunk-fnmwksnb.js +3 -0
  58. package/bin/chunk-fpc4p0j8.js +3 -0
  59. package/bin/chunk-fsyzs0tf.js +1 -0
  60. package/bin/chunk-fxecgp5k.js +1 -0
  61. package/bin/chunk-g3fpmyyn.js +3 -0
  62. package/bin/chunk-gc5sbfa5.js +2 -0
  63. package/bin/chunk-gdm6yfqq.js +2 -0
  64. package/bin/chunk-gk2q9a3f.js +2 -0
  65. package/bin/chunk-gt4csat6.js +3 -0
  66. package/bin/chunk-gye8gabk.js +2 -0
  67. package/bin/chunk-hk5rc6cd.js +24 -0
  68. package/bin/chunk-hm0dkzed.js +3 -0
  69. package/bin/chunk-hmpwg5za.js +16 -0
  70. package/bin/chunk-j1tkmcae.js +3 -0
  71. package/bin/chunk-j2bvj2yn.js +2 -0
  72. package/bin/chunk-jffktpqg.js +1 -0
  73. package/bin/chunk-jgs8an3h.js +18 -0
  74. package/bin/chunk-jmpb5633.js +2 -0
  75. package/bin/chunk-jrjnqx78.js +2 -0
  76. package/bin/chunk-k2k9vjq6.js +1 -0
  77. package/bin/chunk-kpgfqkp0.js +3 -0
  78. package/bin/chunk-ks8xzc95.js +3 -0
  79. package/bin/chunk-kswvyqq1.js +2 -0
  80. package/bin/chunk-m9pr03kn.js +2 -0
  81. package/bin/chunk-mfn9qjm4.js +2 -0
  82. package/bin/chunk-msfw3jmc.js +3 -0
  83. package/bin/chunk-mz0yjra0.js +5 -0
  84. package/bin/chunk-nbdw8fen.js +1 -0
  85. package/bin/chunk-nkdk229f.js +2 -0
  86. package/bin/chunk-nr20tvnw.js +3 -0
  87. package/bin/chunk-pazjhrnf.js +12 -0
  88. package/bin/chunk-q806pqeh.js +1 -0
  89. package/bin/chunk-qka4mkmj.js +2 -0
  90. package/bin/chunk-qsr1a0rp.js +2 -0
  91. package/bin/chunk-rchsme43.js +3 -0
  92. package/bin/chunk-reyxk4bw.js +2 -0
  93. package/bin/chunk-rhvv1vvk.js +3 -0
  94. package/bin/chunk-rq0n0vcc.js +2 -0
  95. package/bin/chunk-rqf7999q.js +42 -0
  96. package/bin/chunk-rssgmj7x.js +2 -0
  97. package/bin/chunk-ryzz5fht.js +2 -0
  98. package/bin/chunk-s2fnfyn9.js +2 -0
  99. package/bin/chunk-s2k4qntr.js +3 -0
  100. package/bin/chunk-snhsjs4x.js +299 -0
  101. package/bin/chunk-t2hy6tj9.js +2 -0
  102. package/bin/chunk-t7nsgg5k.js +4 -0
  103. package/bin/chunk-tm7f32c7.js +14 -0
  104. package/bin/chunk-trveq4wg.js +3 -0
  105. package/bin/chunk-vap4k11j.js +20 -0
  106. package/bin/chunk-vm5fx7td.js +3 -0
  107. package/bin/chunk-vy8gntez.js +1 -0
  108. package/bin/chunk-vyzptrea.js +2 -0
  109. package/bin/chunk-w4ghe71n.js +2 -0
  110. package/bin/chunk-wdsf44hs.js +2 -0
  111. package/bin/chunk-wjyaezs7.js +2 -0
  112. package/bin/chunk-wndm3px3.js +1 -0
  113. package/bin/chunk-x5jwwvs0.js +1 -0
  114. package/bin/chunk-x92cq59c.js +1 -0
  115. package/bin/chunk-xa18z1py.js +3 -0
  116. package/bin/chunk-xarsrs08.js +2 -0
  117. package/bin/chunk-xtf3c29c.css +1 -0
  118. package/bin/chunk-xx337zcw.js +2 -0
  119. package/bin/chunk-xz6713tj.js +2 -0
  120. package/bin/chunk-yfnem6se.js +2 -0
  121. package/bin/chunk-ytdwk2fq.js +2 -0
  122. package/bin/chunk-ze20rm02.js +7 -0
  123. package/bin/chunk-zw86wnwe.js +7 -0
  124. package/bin/chunk-zxk7q0zk.js +2 -0
  125. package/bin/{pdf.worker.min-szxdj13d.mjs → pdf.worker.min-vf48er29.mjs} +14423 -13889
  126. package/bin/shumai-app.html +1 -1
  127. package/bin/shumai-app.js +841 -678
  128. package/package.json +18 -18
  129. package/prisma/migrations/20260904022457_add_agent_id_to_assets_and_audit_logs/migration.sql +17 -0
  130. package/prisma/migrations/20260906081230_default_denied_tools_delete_asset/migration.sql +15 -0
  131. package/prisma/migrations/20260907021754_add_asset_upload_id/migration.sql +2 -0
  132. package/prisma/schema.prisma +10 -0
  133. package/bin/chunk-07h4b77v.js +0 -2
  134. package/bin/chunk-0t4n4d5w.js +0 -4
  135. package/bin/chunk-1611z9jg.js +0 -2
  136. package/bin/chunk-1phqxp6z.js +0 -3
  137. package/bin/chunk-23hckrrz.js +0 -2
  138. package/bin/chunk-30z44j1g.js +0 -2
  139. package/bin/chunk-3j463k1g.js +0 -1
  140. package/bin/chunk-4181tdds.js +0 -14
  141. package/bin/chunk-480jtqng.js +0 -4
  142. package/bin/chunk-4c3g146q.js +0 -2
  143. package/bin/chunk-4ca0zt5e.js +0 -1
  144. package/bin/chunk-4d9bgmf2.js +0 -2
  145. package/bin/chunk-4ev56fss.js +0 -9
  146. package/bin/chunk-4gk52tjq.js +0 -45
  147. package/bin/chunk-4mdqkj4d.js +0 -1
  148. package/bin/chunk-4r91fggc.js +0 -2
  149. package/bin/chunk-50fb1x3w.js +0 -1
  150. package/bin/chunk-59gj1njz.js +0 -1
  151. package/bin/chunk-5pr0t7fb.js +0 -2
  152. package/bin/chunk-5vewxmz7.js +0 -3
  153. package/bin/chunk-62zx96pe.js +0 -2
  154. package/bin/chunk-63y0eb07.js +0 -2
  155. package/bin/chunk-6d5xrgfx.js +0 -2
  156. package/bin/chunk-6gbtz5bf.js +0 -67
  157. package/bin/chunk-6gjg5egq.js +0 -3
  158. package/bin/chunk-6m4jz9s1.js +0 -44
  159. package/bin/chunk-6s4x525w.js +0 -2
  160. package/bin/chunk-6w2wmvqs.js +0 -3
  161. package/bin/chunk-77d23vcn.js +0 -2
  162. package/bin/chunk-77m5p188.js +0 -2
  163. package/bin/chunk-7bvx087f.js +0 -1
  164. package/bin/chunk-7pfjfrjg.js +0 -5
  165. package/bin/chunk-7q10s127.js +0 -4
  166. package/bin/chunk-7thx8ctx.js +0 -3
  167. package/bin/chunk-8t4s91gh.js +0 -2
  168. package/bin/chunk-98ey5p2e.js +0 -3
  169. package/bin/chunk-9amndcyh.js +0 -6
  170. package/bin/chunk-9bk23g9x.js +0 -1
  171. package/bin/chunk-9mkcfy43.js +0 -1
  172. package/bin/chunk-9t3nsq5n.js +0 -2
  173. package/bin/chunk-9tjq99ds.js +0 -2
  174. package/bin/chunk-9wm9rwh1.js +0 -2
  175. package/bin/chunk-ab16fyg4.js +0 -4
  176. package/bin/chunk-arv0g2av.js +0 -1
  177. package/bin/chunk-aytj4zxg.js +0 -3
  178. package/bin/chunk-b1ypjqgp.js +0 -2
  179. package/bin/chunk-bdjv0ykq.js +0 -2
  180. package/bin/chunk-c1k86mfa.js +0 -10
  181. package/bin/chunk-caa96dgd.js +0 -2
  182. package/bin/chunk-ce4v2yjy.js +0 -1
  183. package/bin/chunk-cqh60y54.js +0 -3
  184. package/bin/chunk-cvq7zgw7.js +0 -1
  185. package/bin/chunk-d9mjbtp2.js +0 -2
  186. package/bin/chunk-dn7sbjws.js +0 -3
  187. package/bin/chunk-dxyq9h8n.js +0 -3
  188. package/bin/chunk-e3cabksx.js +0 -3
  189. package/bin/chunk-egcrbj94.js +0 -2
  190. package/bin/chunk-ev17v1mv.js +0 -2
  191. package/bin/chunk-evtpwg71.js +0 -2
  192. package/bin/chunk-f3e0nsv2.js +0 -2
  193. package/bin/chunk-f40gjqpq.js +0 -2
  194. package/bin/chunk-fe7822ak.js +0 -299
  195. package/bin/chunk-g8tkhw9j.js +0 -2
  196. package/bin/chunk-g9r0p4t8.js +0 -2
  197. package/bin/chunk-gbjyh9ms.js +0 -1
  198. package/bin/chunk-gtbsb39v.js +0 -3
  199. package/bin/chunk-gytz1q13.js +0 -13
  200. package/bin/chunk-h0fxysxs.js +0 -7
  201. package/bin/chunk-h8bdvsqt.js +0 -2
  202. package/bin/chunk-hag024w8.js +0 -2
  203. package/bin/chunk-hc6w5nw4.js +0 -7
  204. package/bin/chunk-j69dqc48.js +0 -2
  205. package/bin/chunk-jbtw1zym.js +0 -8
  206. package/bin/chunk-jc1vb7rj.js +0 -5
  207. package/bin/chunk-jdv78w9r.js +0 -2
  208. package/bin/chunk-jjs70y9v.js +0 -3
  209. package/bin/chunk-jmdar2gz.js +0 -2
  210. package/bin/chunk-jvwz10n4.js +0 -2
  211. package/bin/chunk-k47md1g4.js +0 -2
  212. package/bin/chunk-k4v0brcb.js +0 -2
  213. package/bin/chunk-k6n7c07e.js +0 -1
  214. package/bin/chunk-kk2cstsg.js +0 -2
  215. package/bin/chunk-knz4h56q.js +0 -12
  216. package/bin/chunk-kqqtt6bd.js +0 -3
  217. package/bin/chunk-kvyp1t4j.js +0 -7
  218. package/bin/chunk-kxskpgsq.js +0 -5
  219. package/bin/chunk-m6srbjcs.js +0 -2
  220. package/bin/chunk-mcc1scxs.js +0 -12
  221. package/bin/chunk-mq83a0kk.js +0 -2
  222. package/bin/chunk-mxm8g4q0.js +0 -1
  223. package/bin/chunk-nhpgdqq5.js +0 -2
  224. package/bin/chunk-nne496aa.js +0 -2
  225. package/bin/chunk-nqpb0r9h.js +0 -11
  226. package/bin/chunk-ns0zww9g.js +0 -2
  227. package/bin/chunk-ps4xfp23.js +0 -2
  228. package/bin/chunk-pz2ec6xt.js +0 -2
  229. package/bin/chunk-q163k309.js +0 -2
  230. package/bin/chunk-q1da61ps.js +0 -1
  231. package/bin/chunk-qrf0ady6.js +0 -68
  232. package/bin/chunk-qy28f25e.js +0 -2
  233. package/bin/chunk-r7s4ypw1.js +0 -2
  234. package/bin/chunk-ran23vm9.js +0 -1
  235. package/bin/chunk-rfvdc4n0.js +0 -2
  236. package/bin/chunk-rgthkvgx.js +0 -3
  237. package/bin/chunk-s39n3yw3.js +0 -2
  238. package/bin/chunk-s7wdd0g7.js +0 -8
  239. package/bin/chunk-s88ha5kx.js +0 -3
  240. package/bin/chunk-sf91bt9m.js +0 -2
  241. package/bin/chunk-sjwbjf9j.js +0 -2
  242. package/bin/chunk-t62076pv.js +0 -1
  243. package/bin/chunk-tbbwss3v.js +0 -3
  244. package/bin/chunk-tjcc7a6y.js +0 -24
  245. package/bin/chunk-tp6ab26e.js +0 -2
  246. package/bin/chunk-v2wxk9p5.js +0 -4
  247. package/bin/chunk-vbk6y4hk.js +0 -2
  248. package/bin/chunk-vfgfg5fk.js +0 -2
  249. package/bin/chunk-vm6c3xx9.js +0 -2
  250. package/bin/chunk-vsx96mt6.js +0 -3
  251. package/bin/chunk-wbyw1shz.js +0 -6
  252. package/bin/chunk-whh2vh50.css +0 -1
  253. package/bin/chunk-wjkcq65s.js +0 -2
  254. package/bin/chunk-wkefwkfp.js +0 -41
  255. package/bin/chunk-x7bsnk1e.js +0 -2
  256. package/bin/chunk-xbhw6bpz.js +0 -3
  257. package/bin/chunk-xg5yrcj5.js +0 -2
  258. package/bin/chunk-xg9xscqz.js +0 -1
  259. package/bin/chunk-xw2gpcsh.js +0 -3
  260. package/bin/chunk-ycq8ank7.js +0 -2
  261. package/bin/chunk-yp9hvkc5.js +0 -73
  262. package/bin/chunk-ytypyfkc.js +0 -65
  263. package/bin/chunk-z1kjmf60.js +0 -2
  264. package/bin/chunk-z36bx86r.js +0 -2
  265. package/bin/chunk-z7hdnecp.js +0 -3
  266. package/bin/chunk-zeby1cq7.js +0 -2
  267. package/bin/chunk-zs5e8z1w.js +0 -1
  268. package/bin/chunk-zxnyefg5.js +0 -2
  269. /package/bin/{chunk-24ke0th1.css → chunk-kegybs91.css} +0 -0
@@ -0,0 +1,2 @@
1
+ import{T}from"./chunk-7rhz2gze.js";var t=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],Li=T("list-todo",t);
2
+ export{Li};
@@ -0,0 +1,8 @@
1
+ // @bun
2
+ import{ar}from"./chunk-579e4wv4.js";import"./chunk-mz0yjra0.js";import{Ra}from"./chunk-xa18z1py.js";import{$s,Gs,Qs}from"./chunk-pazjhrnf.js";import{es}from"./chunk-837fky18.js";import{mn,hn}from"./chunk-4wy87hwd.js";import{$n,Cr}from"./chunk-hm0dkzed.js";import{on}from"./chunk-rchsme43.js";import{Vi}from"./chunk-7jtmwt5a.js";import{qr}from"./chunk-trveq4wg.js";import{Za,hc,Xi,Yt}from"./chunk-nr20tvnw.js";var z=new Set;function X(e){return z.add(e),()=>{z.delete(e)}}function j(e){let t=e.filter((o)=>o!==void 0);if(t.length===0)return{cleanup:()=>{}};if(t.length===1)return{signal:t[0],cleanup:()=>{}};let r=new AbortController,n=[],s=(o)=>{if(!r.signal.aborted)r.abort(o.reason)};for(let o of t){if(o.aborted){s(o);break}let i=()=>s(o);o.addEventListener("abort",i,{once:!0}),n.push({signal:o,listener:i})}return{signal:r.signal,cleanup:()=>{for(let{signal:o,listener:i}of n)o.removeEventListener("abort",i)}}}var me={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function F(e,t){let r=e.toLowerCase(),n=e.toUpperCase();return t?.[r]||t?.[n]||ar(r)||ar(n)||""}function ye(e){if(e instanceof URL)return e;try{return new URL(e)}catch{return}}function be(e,t,r){let n=F("no_proxy",r).toLowerCase();if(!n)return!0;if(n==="*")return!1;return n.split(/[,\s]/).every((s)=>{if(!s)return!0;let o=s.match(/^(.+):(\d+)$/),i=o?o[1]:s,l=o?Number.parseInt(o[2],10):0;if(l&&l!==t)return!0;if(!/^[.*]/.test(i))return e!==i;if(i.startsWith("*"))i=i.slice(1);return!e.endsWith(i)})}function he(e,t){let r=ye(e);if(!r?.protocol||!r.host)return"";let n=r.protocol.split(":",1)[0],s=r.host.replace(/:\d*$/,""),o=Number.parseInt(r.port,10)||me[n]||0;if(!be(s,o,t))return"";let i=F(`${n}_proxy`,t)||F("all_proxy",t);if(i&&!i.includes("://"))i=`${n}://${i}`;return i}var we="Unsupported proxy protocol. SOCKS and PAC proxy URLs are not supported; use an HTTP or HTTPS proxy URL.";function V(e,t){let r=he(e,t);if(!r)return;let n;try{n=new URL(r)}catch(s){throw Error(`Invalid proxy URL ${JSON.stringify(r)}: ${s instanceof Error?s.message:String(s)}`)}if(n.protocol!=="http:"&&n.protocol!=="https:")throw Error(`${we} Got ${n.protocol}`);return n}function ge(){if(typeof process>"u"||!(process.versions?.node||process.versions?.bun))return null;return process.getBuiltinModule?.("node:os")??null}var D=ge(),Se="https://chatgpt.com/backend-api",Ee="https://api.openai.com/auth",_e=0,Y=1000,ke=60000,Te=15000,Re=3,ne=new Set(["openai","openai-codex","opencode"]),xe=1009,ve="websocket_connection_limit_reached",Ce="previous_response_not_found",Oe=new Set(["completed","incomplete","failed","cancelled","queued","in_progress"]);function Ae(e){return/GoUsageLimitError|FreeUsageLimitError|Monthly usage limit reached|available balance|insufficient_quota|out of budget|quota exceeded|billing/i.test(e)}function Le(e,t){if(e===429&&Ae(t))return!1;if(e===429||e===500||e===502||e===503||e===504)return!0;return/rate.?limit|overloaded|service.?unavailable|upstream.?connect|connection.?refused/i.test(t)}function We(e){let t=e.get("retry-after-ms");if(t!==null){let o=Number(t);if(Number.isFinite(o))return Math.max(0,o)}let r=e.get("retry-after");if(!r)return;let n=Number(r);if(Number.isFinite(n))return Math.max(0,n*1000);let s=Date.parse(r);if(!Number.isNaN(s))return Math.max(0,s-Date.now());return}class K extends Error{}function Ne(e,t){let r=t?.maxRetryDelayMs??ke;if(r>0&&e>r)throw new K(`Server requested ${Math.ceil(e/1000)}s retry delay (max: ${Math.ceil(r/1000)}s)`);return e}function Z(e,t){return new Promise((r,n)=>{if(t?.aborted){n(Error("Request was aborted"));return}let s=setTimeout(r,e);t?.addEventListener("abort",()=>{clearTimeout(s),n(Error("Request was aborted"))})})}function Q(e){if(e===void 0)return;if(!Number.isFinite(e)||e<0)throw Error(`Invalid timeoutMs: ${String(e)}`);return Math.floor(e)}function Pe(){if(typeof process>"u"||!(process.versions?.node||process.versions?.bun))return null;return process.getBuiltinModule?.("node:zlib")??null}function Me(e){let t=Pe();if(!t||typeof t.zstdCompressSync!=="function")return null;try{let r=t.zstdCompressSync(e,{params:{[t.constants.ZSTD_c_compressionLevel]:Re}});return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}catch{return null}}var De=(e,t,r)=>{let n=new Yt;return(async()=>{let s={role:"assistant",content:[],api:"openai-codex-responses",provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let o=r?.apiKey;if(!o)throw Error(`No API key for provider: ${e.provider}`);let i=ft(o),l=$n(t.tools,e.compat?.supportsOpenAIGrammarTools??!1),a=r?.cacheRetention==="none"?void 0:r?.sessionId,c=es(a),d=Ie(e,t,r,c,l),u=await r?.onPayload?.(d,e);if(u!==void 0)d=u;let g=c||Vi(),f=dt(e.headers,r?.headers,i,o,c),S=pt(e.headers,r?.headers,i,o,g),m=JSON.stringify(d),p=Q(r?.timeoutMs),x=Q(r?.websocketConnectTimeoutMs),y=r?.transport||"auto",h=!1,b=y!=="sse"&&ce(a);if(b)ee(a);if(y!=="sse"&&!b){let w=!1,_=!1,C=!1;while(!0){w=!1;try{if(await ut(Be(e.baseUrl),d,S,s,n,e,()=>{if(w=!0,!h)h=!0,n.push({type:"start",partial:s})},p,x,a,l,r),r?.signal?.aborted)throw Error("Request was aborted");n.push({type:"done",reason:s.stopReason,message:s}),n.end();return}catch(T){let N=r?.signal?.aborted,P=!w&&Fe(T),A=Je(T);if(!N&&A&&!C){C=!0;continue}if(!N&&P&&!_){_=!0;continue}if(N||$e(T)&&!P)throw T;if(Xi(s,hc("provider_transport_failure",T,{configuredTransport:y,fallbackTransport:w?void 0:"sse",eventsEmitted:w,phase:w?"after_message_stream_start":"before_message_stream_start",requestBytes:new TextEncoder().encode(m).byteLength})),Ye(a,T),w)throw T;ee(a);break}}}let v=Me(m);if(v)f.set("content-encoding","zstd");let O=v??m,E,W,U=r?.maxRetries??_e;for(let w=0;w<=U;w++){if(r?.signal?.aborted)throw Error("Request was aborted");try{let _=p!==void 0&&p>0?AbortSignal.timeout(p):void 0,C=j([r?.signal,_]);try{E=await fetch(ie(e.baseUrl),{method:"POST",headers:f,body:O,signal:C.signal})}catch(A){if(_?.aborted&&!r?.signal?.aborted)throw Error(`Codex SSE response headers timed out after ${p}ms`);throw A}finally{C.cleanup()}if(await r?.onResponse?.({status:E.status,headers:on(E.headers)},e),E.ok)break;let T=await E.text();if(w<U&&Le(E.status,T)){let A=We(E.headers),pe=A===void 0?Y*2**w:Ne(A,r);await Z(pe,r?.signal);continue}let N=new Response(T,{status:E.status,statusText:E.statusText}),P=await lt(N);throw Error(P.friendlyMessage||P.message)}catch(_){if(_ instanceof Error){if(_.name==="AbortError"||_.message==="Request was aborted")throw Error("Request was aborted")}if(W=_ instanceof Error?_:Error(String(_)),w<U&&!(W instanceof K)&&!W.message.includes("usage limit")){let C=Y*2**w;await Z(C,r?.signal);continue}throw W}}if(!E?.ok)throw W??Error("Failed after retries");if(!E.body)throw Error("No response body");if(!h)h=!0,n.push({type:"start",partial:s});if(await Ue(E,s,n,e,l,r),r?.signal?.aborted)throw Error("Request was aborted");n.push({type:"done",reason:s.stopReason,message:s}),n.end()}catch(o){for(let i of s.content)delete i.partialJson,delete i.customInput;s.stopReason=r?.signal?.aborted?"aborted":"error",s.errorMessage=hn(mn(o)),n.push({type:"error",reason:s.stopReason,error:s}),n.end()}})(),n},Wt=(e,t,r)=>{let n=r?.apiKey;if(!n)throw Error(`No API key for provider: ${e.provider}`);let s=Cr(e,t,r,n),o=r?.reasoning?qr(e,r.reasoning):void 0;return De(e,t,{...s,reasoningEffort:o==="off"?void 0:o})};function Ie(e,t,r,n,s=$n(t.tools,e.compat?.supportsOpenAIGrammarTools??!1)){let o=e.compat?.supportsStrictMode??!0,i=e.compat?.supportsOpenAIGrammarTools??!1,l=Ra(t,e.compat?.supportsToolSearch??!1),a=$s(e,t,ne,{includeSystemPrompt:!1,grammarToolInputProperties:s,deferredTools:l.deferred,toolOptions:{strict:null,supportsStrictMode:o,supportsOpenAIGrammarTools:i}}),c={model:e.id,store:!1,stream:!0,instructions:t.systemPrompt||"You are a helpful assistant.",input:a,text:{verbosity:r?.textVerbosity||"low"},include:["reasoning.encrypted_content"],prompt_cache_key:n,tool_choice:r?.toolChoice??"auto",parallel_tool_calls:!0};if(r?.temperature!==void 0)c.temperature=r.temperature;if(r?.serviceTier!==void 0)c.service_tier=r.serviceTier;if(l.immediate.length>0)c.tools=Gs(l.immediate,{strict:null,supportsStrictMode:o,supportsOpenAIGrammarTools:i});if(r?.reasoningEffort!==void 0){let d=r.reasoningEffort==="none"?e.thinkingLevelMap?.off??"none":e.thinkingLevelMap?.[r.reasoningEffort]??r.reasoningEffort;if(d!==null)c.reasoning={effort:d,summary:r.reasoningSummary??"auto"}}return c}function qe(e,t){switch(t){case"flex":return 0.5;case"priority":return e.id==="gpt-5.5"?2.5:2;default:return 1}}function oe(e,t,r){let n=qe(r,t);if(n===1)return;e.cost.input*=n,e.cost.output*=n,e.cost.cacheRead*=n,e.cost.cacheWrite*=n,e.cost.total=e.cost.input+e.cost.output+e.cost.cacheRead+e.cost.cacheWrite}function se(e,t){if(e==="default"&&(t==="flex"||t==="priority"))return t;return e??t}function ie(e){let r=(e&&e.trim().length>0?e:Se).replace(/\/+$/,"");if(r.endsWith("/codex/responses"))return r;if(r.endsWith("/codex"))return`${r}/responses`;return`${r}/codex/responses`}function Be(e){let t=new URL(ie(e));if(t.protocol==="https:")t.protocol="wss:";if(t.protocol==="http:")t.protocol="ws:";return t.toString()}async function Ue(e,t,r,n,s,o){await Qs(ae(Ge(e,o?.signal)),t,r,n,{serviceTier:o?.serviceTier,grammarToolInputProperties:s,resolveServiceTier:se,applyServiceTierPricing:(i,l)=>oe(i,l,n)})}class L extends Error{code;payload;constructor(e,t){super(e);this.name="CodexApiError",this.code=t?.code,this.payload=t?.payload,this.cause=t?.cause}}class B extends Error{payload;constructor(e,t){super(e);this.name="CodexProtocolError",this.payload=t?.payload,this.cause=t?.cause}}function $e(e){return e instanceof L||e instanceof B}function Fe(e){return e instanceof L&&e.code===ve}function Je(e){return e instanceof L&&e.code===Ce}function He(e){let t=e.error&&typeof e.error==="object"?e.error:void 0;return{code:typeof e.code==="string"?e.code:typeof t?.code==="string"?t.code:void 0,message:typeof e.message==="string"?e.message:typeof t?.message==="string"?t.message:void 0}}async function*ae(e){for await(let t of e){let r=typeof t.type==="string"?t.type:void 0;if(!r)continue;if(r==="error"){let{code:n,message:s}=He(t);throw new L(`Codex error: ${s||n||JSON.stringify(t)}`,{code:n,payload:t})}if(r==="response.failed"){let n=t.response,s=n?.error?.code,o=n?.error?.message;throw new L(o||"Codex response failed",{code:s,payload:t})}if(r==="response.done"||r==="response.completed"||r==="response.incomplete"){let n=t.response,s=n?{...n,status:Ke(n.status)}:n;yield{...t,type:"response.completed",response:s};return}yield t}}function Ke(e){if(typeof e!=="string")return;return Oe.has(e)?e:void 0}async function*Ge(e,t){if(!e.body)return;let r=e.body.getReader(),n=new TextDecoder,s="",o=()=>{r.cancel().catch(()=>{})};t?.addEventListener("abort",o,{once:!0});try{while(!0){if(t?.aborted)throw Error("Request was aborted");let{done:i,value:l}=await r.read();if(t?.aborted)throw Error("Request was aborted");if(i)break;s+=n.decode(l,{stream:!0});let a=s.indexOf(`
3
+
4
+ `);while(a!==-1){let c=s.slice(0,a);s=s.slice(a+2);let d=c.split(`
5
+ `).filter((u)=>u.startsWith("data:")).map((u)=>u.slice(5).trim());if(d.length>0){let u=d.join(`
6
+ `).trim();if(u&&u!=="[DONE]")try{yield JSON.parse(u)}catch(g){throw new B(`Invalid Codex SSE JSON: ${Za(g)}`,{cause:g,payload:u})}}a=s.indexOf(`
7
+
8
+ `)}}}finally{t?.removeEventListener("abort",o);try{await r.cancel()}catch{}try{r.releaseLock()}catch{}}}var ze="responses_websockets=2026-02-06",Xe=300000,je=3300000,k=new Map,M=new Map,q=new Set;function G(e){let t=M.get(e);if(!t)t={requests:0,connectionsCreated:0,connectionsReused:0,cachedContextRequests:0,storeTrueRequests:0,fullContextRequests:0,deltaRequests:0,lastInputItems:0,websocketFailures:0,sseFallbacks:0},M.set(e,t);return t}function Nt(e){let t=M.get(e);return t?{...t}:void 0}function Pt(e){if(e){M.delete(e),q.delete(e);return}M.clear(),q.clear()}function Ve(e){let t=(r)=>{if(r.idleTimer)clearTimeout(r.idleTimer);R(r.socket,1000,"debug_close")};if(e){let r=k.get(e);if(r)t(r);k.delete(e);return}for(let r of k.values())t(r);k.clear()}X(Ve);function ce(e){return e?q.has(e):!1}function ee(e){if(!e)return;let t=G(e);t.sseFallbacks++,t.websocketFallbackActive=ce(e)}function Ye(e,t){if(!e)return;q.add(e);let r=G(e);r.websocketFailures++,r.lastWebSocketError=Za(t),r.websocketFallbackActive=!0}var J=null;async function Ze(e){if(!e&&J)return J;if(typeof process<"u"&&process.versions?.bun){let r=class extends WebSocket{constructor(n,s){let o={};if(Array.isArray(s)||typeof s==="string")o={protocols:s};else o={...s};let i=V(n.toString().replace(/^wss:/,"https:").replace(/^ws:/,"http:"),e);super(n,{...o,...i?{proxy:i.toString()}:{}})}};if(!e)J=r;return r}let t=globalThis.WebSocket;if(typeof t!=="function")return null;return t}class ue extends Error{code;reason;wasClean;constructor(e,t){super(e);this.name="WebSocketCloseError",this.code=t?.code,this.reason=t?.reason,this.wasClean=t?.wasClean}}function Qe(e){let t=e.readyState;return typeof t==="number"?t:void 0}function I(e){let t=Qe(e);return t===void 0||t===1}function et(e){return Date.now()-e.createdAt>=je}function R(e,t=1000,r="done"){try{e.close(t,r)}catch{}}function te(e,t){if(t.idleTimer)clearTimeout(t.idleTimer);t.idleTimer=setTimeout(()=>{if(t.busy)return;R(t.socket,1000,"idle_timeout"),k.delete(e)},Xe)}async function H(e,t,r,n=Te,s){let o=await Ze(s);if(!o)throw Error("WebSocket transport is not available in this runtime");let i=on(t);return delete i["OpenAI-Beta"],new Promise((l,a)=>{let c=!1,d,u;try{u=new o(e,{headers:i})}catch(y){a(y instanceof Error?y:Error(String(y)));return}let g=()=>{if(d)clearTimeout(d),d=void 0;u.removeEventListener("open",S),u.removeEventListener("error",m),u.removeEventListener("close",p),r?.removeEventListener("abort",x)},f=(y,h)=>{if(c)return;if(c=!0,g(),h)R(u,1000,h);a(y)},S=()=>{if(c)return;c=!0,g(),l(u)},m=(y)=>{f(le(y))},p=(y)=>{f(fe(y))},x=()=>{f(Error("Request was aborted"),"aborted")};if(u.addEventListener("open",S),u.addEventListener("error",m),u.addEventListener("close",p),r?.addEventListener("abort",x),n>0)d=setTimeout(()=>{f(Error(`WebSocket connect timeout after ${n}ms`),"connect_timeout")},n);if(r?.aborted)x()})}async function tt(e,t,r,n,s,o){if(!r){let c=await H(e,t,n,s,o);return{socket:c,reused:!1,release:()=>R(c)}}let i=k.get(r);if(i){if(i.idleTimer)clearTimeout(i.idleTimer),i.idleTimer=void 0;if(!i.busy&&et(i))R(i.socket,1000,"connection_age_limit"),k.delete(r);else if(!i.busy&&I(i.socket))return i.busy=!0,{socket:i.socket,entry:i,reused:!0,release:({keep:c}={})=>{if(!c||!I(i.socket)){R(i.socket),k.delete(r);return}i.busy=!1,te(r,i)}};if(i.busy){let c=await H(e,t,n,s,o);return{socket:c,reused:!1,release:()=>{R(c)}}}if(!I(i.socket))R(i.socket),k.delete(r)}let l=await H(e,t,n,s,o),a={socket:l,busy:!0,createdAt:Date.now()};return k.set(r,a),{socket:l,entry:a,reused:!1,release:({keep:c}={})=>{if(!c||!I(a.socket)){if(R(a.socket),a.idleTimer)clearTimeout(a.idleTimer);if(k.get(r)===a)k.delete(r);return}a.busy=!1,te(r,a)}}}function le(e){if(e&&typeof e==="object"){let t="message"in e?e.message:void 0;if(typeof t==="string"&&t.length>0)return Error(t);let r="error"in e?e.error:void 0;if(r instanceof Error&&r.message.length>0)return r;if(r&&typeof r==="object"&&"message"in r){let n=r.message;if(typeof n==="string"&&n.length>0)return Error(n)}}return Error("WebSocket error")}function fe(e){if(e&&typeof e==="object"){let t="code"in e?e.code:void 0,r="reason"in e?e.reason:void 0,n="wasClean"in e?e.wasClean:void 0,s=typeof t==="number"?` ${t}`:"",o=typeof r==="string"&&r.length>0?` ${r}`:"";if(!o&&t===xe)o=" message too big";return new ue(`WebSocket closed${s}${o}`.trim(),{code:typeof t==="number"?t:void 0,reason:typeof r==="string"&&r.length>0?r:void 0,wasClean:typeof n==="boolean"?n:void 0})}return Error("WebSocket closed")}async function rt(e){if(typeof e==="string")return e;if(e instanceof ArrayBuffer)return new TextDecoder().decode(new Uint8Array(e));if(ArrayBuffer.isView(e)){let t=e;return new TextDecoder().decode(new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}if(e&&typeof e==="object"&&"arrayBuffer"in e){let r=await e.arrayBuffer();return new TextDecoder().decode(new Uint8Array(r))}return null}async function*nt(e,t,r){let n=[],s=null,o=!1,i=null,l=!1,a=()=>{if(!s)return;let f=s;s=null,f()},c=(f)=>{(async()=>{let S=null;try{if(!f||typeof f!=="object"||!("data"in f))return;if(S=await rt(f.data),!S)return;let m=JSON.parse(S),p=typeof m.type==="string"?m.type:"";if(p==="response.completed"||p==="response.done"||p==="response.incomplete")l=!0,o=!0;n.push(m),a()}catch(m){i=new B(`Invalid Codex WebSocket JSON: ${Za(m)}`,{cause:m,payload:S}),o=!0,a()}})()},d=(f)=>{i=le(f),o=!0,a()},u=(f)=>{if(l){o=!0,a();return}if(!i)i=fe(f);o=!0,a()},g=()=>{i=Error("Request was aborted"),o=!0,a()};e.addEventListener("message",c),e.addEventListener("error",d),e.addEventListener("close",u),t?.addEventListener("abort",g);try{while(!0){if(t?.aborted)throw Error("Request was aborted");if(n.length>0){yield n.shift();continue}if(o)break;let f;await new Promise((S,m)=>{if(s=S,r!==void 0&&r>0)f=setTimeout(()=>{let p=Error(`WebSocket idle timeout after ${r}ms`);i=p,o=!0,s=null,R(e,1000,"idle_timeout"),m(p)},r)}).finally(()=>{if(f)clearTimeout(f)})}if(i)throw i;if(!l)throw Error("WebSocket stream closed before response.completed")}finally{e.removeEventListener("message",c),e.removeEventListener("error",d),e.removeEventListener("close",u),t?.removeEventListener("abort",g)}}function re(e){let{input:t,previous_response_id:r,...n}=e;return n}function ot(e,t){return JSON.stringify(e??[])===JSON.stringify(t??[])}function st(e,t){return JSON.stringify(re(e))===JSON.stringify(re(t))}function it(e,t){if(!st(e,t.lastRequestBody))return;let r=e.input??[],n=[...t.lastRequestBody.input??[],...t.lastResponseItems];if(r.length<n.length)return;let s=r.slice(0,n.length);if(!ot(s,n))return;return r.slice(n.length)}function at(e,t){let r=e.continuation;if(!r)return t;let n=it(t,r);if(!n||!r.lastResponseId)return e.continuation=void 0,t;return{...t,previous_response_id:r.lastResponseId,input:n}}async function*ct(e,t){let r=!1;for await(let n of e){if(!r)r=!0,t();yield n}}async function ut(e,t,r,n,s,o,i,l,a,c,d,u){let{socket:g,entry:f,reused:S,release:m}=await tt(e,r,c,u?.signal,a,u?.env),p=!0,x=u?.transport==="websocket-cached"||u?.transport==="auto",y=t,h=x&&f?at(f,y):y,b=c?G(c):void 0;if(b){if(b.requests++,S)b.connectionsReused++;else b.connectionsCreated++;if(x)b.cachedContextRequests++;if(h.store===!0)b.storeTrueRequests++;if(b.lastInputItems=h.input?.length??0,h.previous_response_id)b.deltaRequests++,b.lastDeltaInputItems=h.input?.length??0,b.lastPreviousResponseId=h.previous_response_id;else b.fullContextRequests++,b.lastDeltaInputItems=void 0,b.lastPreviousResponseId=void 0}try{if(g.send(JSON.stringify({type:"response.create",...h})),await Qs(ct(ae(nt(g,u?.signal,l)),i),n,s,o,{serviceTier:u?.serviceTier,grammarToolInputProperties:d,resolveServiceTier:se,applyServiceTierPricing:(v,O)=>oe(v,O,o)}),u?.signal?.aborted)p=!1;else if(x&&f&&n.responseId){let v=$s(o,{messages:[n]},ne,{includeSystemPrompt:!1,grammarToolInputProperties:d}).filter((O)=>O.type!=="function_call_output"&&O.type!=="custom_tool_call_output");f.continuation={lastRequestBody:y,lastResponseId:n.responseId,lastResponseItems:v}}}catch(v){if(f)f.continuation=void 0;throw p=!1,v}finally{m({keep:p})}}async function lt(e){let t=await e.text(),r=t||e.statusText||"Request failed",n;try{let o=JSON.parse(t)?.error;if(o){let i=o.code||o.type||"";if(/usage_limit_reached|usage_not_included|rate_limit_exceeded/i.test(i)||e.status===429){let l=o.plan_type?` (${o.plan_type.toLowerCase()} plan)`:"",a=o.resets_at?Math.max(0,Math.round((o.resets_at*1000-Date.now())/60000)):void 0,c=a!==void 0?` Try again in ~${a} min.`:"";n=`You have hit your ChatGPT usage limit${l}.${c}`.trim()}r=o.message||n||r}}catch{}return{message:r,friendlyMessage:n}}function ft(e){try{let t=e.split(".");if(t.length!==3)throw Error("Invalid token");let n=JSON.parse(atob(t[1]))?.[Ee]?.chatgpt_account_id;if(!n)throw Error("No account ID in token");return n}catch{throw Error("Failed to extract accountId from token")}}function de(e,t,r,n){let s=new Headers(e);for(let[i,l]of Object.entries(t||{}))if(l===null)s.delete(i);else s.set(i,l);s.set("Authorization",`Bearer ${n}`),s.set("chatgpt-account-id",r),s.set("originator","pi");let o=D?`pi (${D.platform()} ${D.release()}; ${D.arch()})`:"pi (browser)";return s.set("User-Agent",o),s}function dt(e,t,r,n,s){let o=de(e,t,r,n);if(o.set("OpenAI-Beta","responses=experimental"),o.set("accept","text/event-stream"),o.set("content-type","application/json"),s)o.set("session-id",s),o.set("x-client-request-id",s);return o}function pt(e,t,r,n,s){let o=de(e,t,r,n);return o.delete("accept"),o.delete("content-type"),o.delete("OpenAI-Beta"),o.delete("openai-beta"),o.set("OpenAI-Beta",ze),o.set("x-client-request-id",s),o.set("session-id",s),o}export{Ve as closeOpenAICodexWebSocketSessions,Nt as getOpenAICodexWebSocketDebugStats,Pt as resetOpenAICodexWebSocketDebugStats,De as stream,Wt as streamSimple};
@@ -0,0 +1 @@
1
+ import{D,N,h,O,w,u,Vn,C,B,t,o,K,Ou,Du,mr,vc,za,yo,qt,Vo,Lu,Zu,Bu,Uu,xc,Fu,Z,U,ut,Fe,A,T,br,L,wt,be,hr,Ut,De,E,dt,he,Y,It,vr,Lt,se,sr,S,Ee,Ie,Te,sA,aA,ay,uy,dy,hf,Zy,Fm,ke,Wa,$m,$0,Pc,Km,Ps,ls,ih,lh,Ub,Fb,bh,vw,vv,xv,tx,Qf,Vf,hx,Ix,jh,Zc,bS,ig,FS,jS,np,HS,QS,cg,KS,WS,ug,YS,XS,Cd,Ed,Id,wl,cp,iC,lC,cC,uC,Td,Os,IC,FC,qC,oE,uE,fE,pE,mE,hE,Mg,gE,Nd,XE,nI,gI,jg,cn,Rp,UI,FI,jc,Je,Xe,et,tt,rt,nt,ot,st,H,Mt,R,Cn,Zp,we,gt,At,yt,Il,Nr,Gd,Ct,Nt,Ot,Ht,Rt}from"./chunk-7rhz2gze.js";import{Eo,pr}from"./chunk-gc5sbfa5.js";import{Ul}from"./chunk-914bp49r.js";import{Fs,Uo,jl,ci,zi,Ca,ql}from"./chunk-dqxeztfa.js";import{Tn,Mn,Rn,_r,bt,mt}from"./chunk-xx337zcw.js";import"./chunk-5adsx8x4.js";import"./chunk-j2bvj2yn.js";import{Hn,oo}from"./chunk-cbgq517y.js";C();function te(a,e){let s=new Set(e);return a.filter((i)=>!s.has(i))}var ae=class extends yo{#r;#e;#o;#a;#t;#s;#i;#n;#l;#d=[];constructor(a,e,s){super();this.#r=a,this.#a=s,this.#o=[],this.#t=[],this.#e=[],this.setQueries(e)}onSubscribe(){if(this.listeners.size===1)this.#t.forEach((a)=>{a.subscribe((e)=>{this.#p(a,e)})})}onUnsubscribe(){if(!this.listeners.size)this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach((a)=>{a.destroy()})}setQueries(a,e){this.#o=a,this.#a=e,qt.batch(()=>{let s=this.#t,i=this.#u(this.#o);i.forEach((c)=>c.observer.setOptions(c.defaultedQueryOptions));let m=i.map((c)=>c.observer),r=m.map((c)=>c.getCurrentResult()),p=s.length!==m.length,f=m.some((c,x)=>c!==s[x]),g=p||f,v=g?!0:r.some((c,x)=>{let y=this.#e[x];return!y||!za(c,y)});if(!g&&!v)return;if(g)this.#d=i,this.#t=m;if(this.#e=r,!this.hasListeners())return;if(g)te(s,m).forEach((c)=>{c.destroy()}),te(m,s).forEach((c)=>{c.subscribe((x)=>{this.#p(c,x)})});this.#f()})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map((a)=>a.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(a,e){let s=this.#u(a),i=s.map((r)=>r.observer.getOptimisticResult(r.defaultedQueryOptions)),m=s.map((r)=>r.defaultedQueryOptions.queryHash);return[i,(r)=>this.#c(r??i,e,m),()=>this.#m(i,s)]}#m(a,e){let s=new Set;return e.map((i,m)=>{let r=a[m];return!i.defaultedQueryOptions.notifyOnChangeProps?i.observer.trackResult(r,(p)=>{if(!s.has(p))s.add(p),e.forEach((f)=>{f.observer.trackProp(p)})}):r})}#c(a,e,s){if(e){let i=this.#l,m=s!==void 0&&i!==void 0&&(i.length!==s.length||s.some((r,p)=>r!==i[p]));if(this.#e!==this.#n||m||e!==this.#i){if(this.#i=e,this.#n=this.#e,s!==void 0)this.#l=s;this.#s=vc(this.#s,e(a))}return this.#s}return a}#g(){return!this.#a?.combine||this.#t.some((a,e)=>a.options.suspense&&this.#e[e]?.data===void 0)}#u(a){let e=new Map;this.#t.forEach((i)=>{let m=i.options.queryHash;if(!m)return;let r=e.get(m);if(r)r.push(i);else e.set(m,[i])});let s=[];return a.forEach((i)=>{let m=this.#r.defaultQueryOptions(i),r=e.get(m.queryHash)?.shift()??new Vo(this.#r,m);s.push({defaultedQueryOptions:m,observer:r})}),s}#p(a,e){let s=this.#t.indexOf(a);if(s!==-1)this.#e=this.#e.slice(),this.#e[s]=e,this.#f()}#f(){if(this.hasListeners()){let a=this.#g(),e=this.#s,s=a?e:this.#c(this.#m(this.#e,this.#d),this.#a?.combine);if(a||e!==s)qt.batch(()=>{this.listeners.forEach((i)=>{i(this.#e)})})}}};C();function re({queries:a,...e},s){let i=K(s),m=Ou(),r=Du(),p=e.subscribed!==!1,f=O(()=>a.map((d)=>{let b=i.defaultQueryOptions(d);return b._optimisticResults=m?"isRestoring":p?"optimistic":void 0,b}),[a,i,m,p]);f.forEach((d)=>{Uu(d);let b=i.getQueryCache().get(d.queryHash);Lu(d,r,b)}),Zu(r);let[g]=u(()=>new ae(i,f,e)),[v,c,x]=g.getOptimisticResult(f,e.combine),y=!m&&p;Vn(N((d)=>y?g.subscribe(qt.batchCalls(d)):mr,[g,y]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),h(()=>{g.setQueries(f,e)},[f,e,g]);let n=v.some((d,b)=>xc(f[b],d))?v.flatMap((d,b)=>{let k=f[b];if(k&&xc(k,d)){let Q=new Vo(i,k);return Fu(k,Q,r)}return[]}):[];if(n.length>0)throw Promise.all(n);let _=v.find((d,b)=>{let k=f[b];return k&&Bu({result:d,errorResetBoundary:r,throwOnError:k.throwOnError,query:i.getQueryCache().get(k.queryHash),suspense:k.suspense})});if(_)throw _.error;return c(x())}C();C();var ve=Object.defineProperty,M=(a,e)=>ve(a,"name",{value:e,configurable:!0}),W="Collapsible",[Ne,Bt]=dt(W),[ye,X]=Ne(W),Ce=D(M(function(e,s){let{__scopeCollapsible:i,open:m,defaultOpen:r,disabled:p,onOpenChange:f,...g}=e,[v,c]=Lt({prop:m,defaultProp:r??!1,onChange:f,caller:W});return t(ye,{scope:i,disabled:p,contentId:vr(),open:v,onOpenToggle:N(()=>c((x)=>!x),[c]),children:t(se.div,{"data-state":z(v),"data-disabled":p?"":void 0,...g,ref:s})})},"Collapsible")),_e="CollapsibleTrigger",Re=D(M(function(e,s){let{__scopeCollapsible:i,...m}=e,r=X(_e,i);return t(se.button,{type:"button","aria-controls":r.open?r.contentId:void 0,"aria-expanded":r.open||!1,"data-state":z(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...m,ref:s,onClick:Y(e.onClick,r.onOpenToggle)})},"CollapsibleTrigger")),oe="CollapsibleContent",Ae=D(M(function(e,s){let{forceMount:i,...m}=e,r=X(oe,e.__scopeCollapsible);return t(sr,{present:i||r.open,children:({present:p})=>t(qe,{...m,ref:s,present:p})})},"CollapsibleContent")),qe=D(M(function(e,s){let{__scopeCollapsible:i,present:m,children:r,...p}=e,f=X(oe,i),[g,v]=u(m),c=w(null),x=he(s,c),y=w(0),n=y.current,_=w(0),d=_.current,b=f.open||g,k=w(b),Q=w(void 0);return h(()=>{let I=requestAnimationFrame(()=>k.current=!1);return()=>cancelAnimationFrame(I)},[]),It(()=>{let I=c.current;if(I){Q.current=Q.current||{transitionDuration:I.style.transitionDuration,animationName:I.style.animationName},I.style.transitionDuration="0s",I.style.animationName="none";let j=I.getBoundingClientRect();if(y.current=j.height,_.current=j.width,!k.current)I.style.transitionDuration=Q.current.transitionDuration,I.style.animationName=Q.current.animationName;v(m)}},[f.open,m]),t(se.div,{"data-state":z(f.open),"data-disabled":f.disabled?"":void 0,id:f.contentId,hidden:!b,...p,ref:x,style:{["--radix-collapsible-content-height"]:n?`${n}px`:void 0,["--radix-collapsible-content-width"]:d?`${d}px`:void 0,...e.style},children:b&&r})},"CollapsibleContentImpl"));function z(a){return a?"open":"closed"}M(z,"getState");var Pe=Ce;var He=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],ie=T("chart-no-axes-column",He);var Oe=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],J=T("funnel",Oe);var Qe=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]],F=T("messages-square",Qe);function ne({teamId:a}){let[e,s]=u("team"),[i,m]=u("1h"),{data:r,isLoading:p}=Z({queryKey:["teams",a,"ai-usage",i,"team"],queryFn:async()=>{let d=await A.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:a},query:{timeframe:i}});if(!d.ok)throw Error("Failed to fetch team AI usage");return await d.json()},enabled:!!a&&e==="team"}),{data:f,isLoading:g}=Z({queryKey:["teams",a,"members"],queryFn:async()=>{let d=await A.api.teams[":teamId"].members.$get({param:{teamId:a},query:{}});if(!d.ok)throw Error("Failed to fetch team members");return await d.json()},enabled:!!a&&e==="members"}),v=re({queries:(f||[]).map((d)=>({queryKey:["teams",a,"ai-usage",i,d.id],queryFn:async()=>{let b=await A.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:a},query:{timeframe:i,userId:d.id}});if(!b.ok)throw Error(`Failed to fetch AI usage for member ${d.id}`);return await b.json()},enabled:!!a&&e==="members"}))}),c=g||v.some((d)=>d.isLoading),x=(d)=>{if(!d)return"U";let b=d.split(" ");if(b.length>1)return`${b[0][0]}${b[b.length-1][0]}`.toUpperCase();return d.substring(0,2).toUpperCase()},y=(d)=>{if(!d)return"";switch(d.toLowerCase()){case"owner":return Zc();case"editor":return Ps();case"reviewer":return Os();default:return d}},n=(d)=>(d??0).toLocaleString(),_=(d)=>`$${(d??0).toFixed(6)}`;return o(Ct,{className:"border-border/60 shadow-sm",children:[o(Nt,{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between pb-6",children:[o("div",{children:[t(Ot,{className:"text-xl font-semibold tracking-tight",children:uy()}),t(Ht,{className:"text-sm text-muted-foreground mt-1",children:dy()})]}),o("div",{className:"flex flex-wrap items-center gap-3",children:[o(Eo,{type:"single",value:e,onValueChange:(d)=>{if(d)s(d)},className:"border rounded-lg p-1 bg-muted/30",children:[t(pr,{value:"team",className:"px-3 py-1.5 text-xs font-medium",children:nI()}),t(pr,{value:"members",className:"px-3 py-1.5 text-xs font-medium",children:xv()})]}),o(Eo,{type:"single",value:i,onValueChange:(d)=>{if(d)m(d)},className:"border rounded-lg p-1 bg-muted/30",children:[t(pr,{value:"1h",className:"px-2.5 py-1.5 text-xs font-medium",children:"1h"}),t(pr,{value:"24h",className:"px-2.5 py-1.5 text-xs font-medium",children:"24h"}),t(pr,{value:"7d",className:"px-2.5 py-1.5 text-xs font-medium",children:"7d"}),t(pr,{value:"30d",className:"px-2.5 py-1.5 text-xs font-medium",children:"30d"})]})]})]}),t(Rt,{children:e==="team"?p?t("div",{className:"flex h-48 items-center justify-center",children:t(L,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):t("div",{className:"rounded-md border",children:o(Tn,{children:[t(Mn,{children:o(_r,{children:[t(bt,{children:Nd()}),t(bt,{className:"text-right",children:bh()}),t(bt,{className:"text-right",children:jh()}),t(bt,{className:"text-right",children:Fm()}),t(bt,{className:"text-right",children:jg()}),t(bt,{className:"text-right",children:$m()})]})}),t(Rn,{children:o(_r,{children:[t(mt,{className:"font-medium",children:Nd()}),t(mt,{className:"text-right",children:n(r?.team?.inputTokens)}),t(mt,{className:"text-right",children:n(r?.team?.outputTokens)}),t(mt,{className:"text-right",children:n(r?.team?.cacheReadTokens)}),t(mt,{className:"text-right font-medium",children:n(r?.team?.totalTokens)}),t(mt,{className:"text-right font-medium",children:_(r?.team?.cost)})]})})]})}):c?t("div",{className:"flex h-48 items-center justify-center",children:t(L,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):t("div",{className:"rounded-md border",children:o(Tn,{children:[t(Mn,{children:o(_r,{children:[t(bt,{children:vv()}),t(bt,{children:IC()}),t(bt,{className:"text-right",children:bh()}),t(bt,{className:"text-right",children:jh()}),t(bt,{className:"text-right",children:Fm()}),t(bt,{className:"text-right",children:jg()}),t(bt,{className:"text-right",children:$m()})]})}),t(Rn,{children:(f||[]).map((d,b)=>{let k=v[b]?.data?.member;return o(_r,{children:[t(mt,{children:o("div",{className:"flex items-center gap-3",children:[o(Ee,{className:"h-8 w-8 rounded-full",children:[d.image&&t(Ie,{src:d.image,alt:d.name,className:"object-cover"}),t(Te,{className:"bg-primary/20 text-xs",children:x(d.name)})]}),o("div",{className:"flex flex-col",children:[t("span",{className:"text-sm font-medium leading-none",children:d.name}),t("span",{className:"text-xs text-muted-foreground mt-0.5",children:d.email})]})]})}),t(mt,{className:"text-xs text-muted-foreground",children:y(d.role)}),t(mt,{className:"text-right",children:n(k?.inputTokens)}),t(mt,{className:"text-right",children:n(k?.outputTokens)}),t(mt,{className:"text-right",children:n(k?.cacheReadTokens)}),t(mt,{className:"text-right font-medium",children:n(k?.totalTokens)}),t(mt,{className:"text-right font-medium",children:_(k?.cost)})]},d.id)})})]})})})]})}C();function le({teamId:a}){let[e,s]=u(null),{ref:i,inView:m}=Mt(),{data:r,isLoading:p,isError:f,fetchNextPage:g,hasNextPage:v,isFetchingNextPage:c}=ut({queryKey:["teams",a,"agent-sessions"],queryFn:async({pageParam:n})=>{let _=await A.api.teams[":teamId"]["agent-sessions"].$get({param:{teamId:a},query:{first:"20",after:n?String(n):void 0}});if(!_.ok)throw Error("Failed to fetch agent sessions");return await _.json()},initialPageParam:"",getNextPageParam:(n)=>n.pageInfo.cursor||void 0,enabled:!!a});h(()=>{if(m&&v&&!c)g()},[m,v,c,g]);let x=r?.pages.flatMap((n)=>n.data).filter((n)=>n.id!=="pending")||[],y=(n)=>{switch(n){case"comment":return t(we,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20",children:mE()});case"chat":return t(we,{variant:"outline",className:"bg-violet-500/10 text-violet-600 dark:text-violet-400 border-violet-500/20",children:pE()});case"naming":return t(we,{variant:"outline",className:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20",children:hE()});default:return t(we,{variant:"outline",className:"bg-muted text-muted-foreground border-border",children:n})}};return o("div",{className:"space-y-6",children:[o(Ct,{className:"border border-border/50 shadow-xs",children:[t(Nt,{className:"pb-4",children:t("div",{className:"flex items-center justify-between",children:o("div",{children:[o(Ot,{className:"text-xl font-bold flex items-center gap-2",children:[t(F,{className:"w-5 h-5 text-violet-500"}),Mg()]}),t(Ht,{className:"mt-1 text-sm text-muted-foreground",children:gE()})]})})}),t(Rt,{children:p?t("div",{className:"flex h-64 items-center justify-center",children:t(L,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):f?t("div",{className:"flex h-64 items-center justify-center text-destructive",children:"Failed to load agent sessions."}):x.length===0?o("div",{className:"flex flex-col items-center justify-center py-12 text-center text-muted-foreground",children:[t(F,{className:"w-10 h-10 text-muted-foreground/40 mb-3"}),t("p",{className:"text-base font-medium",children:hx()})]}):o("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o(Tn,{children:[t(Mn,{className:"bg-muted/40",children:o(_r,{children:[t(bt,{children:uE()}),t(bt,{children:Pc()}),t(bt,{children:fE()}),t(bt,{className:"text-right",children:$0()})]})}),t(Rn,{children:x.map((n)=>o(_r,{onClick:()=>s(n.id),className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[t(mt,{className:"font-medium",children:o("div",{className:"flex flex-col",children:[t("span",{className:"text-sm font-semibold text-foreground",children:n.name||Rp()}),t("span",{className:"text-xs font-mono text-muted-foreground/70",children:n.id})]})}),t(mt,{children:o("div",{className:"flex items-center gap-2",children:[o(Ee,{className:"h-6 w-6",children:[t(Ie,{src:n.creator?.image||void 0}),t(Te,{className:"text-[10px]",children:n.creator?.name?.[0]?.toUpperCase()||"?"})]}),t("span",{className:"text-sm text-foreground/90",children:n.creator?.name||"System / Agent"})]})}),t(mt,{children:y(n.type)}),t(mt,{className:"text-right text-xs text-muted-foreground",children:Cn(n.createdAt)})]},n.id))})]}),t("div",{ref:i,className:"py-4 flex justify-center",children:c&&t(L,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})})]}),t(Ul,{sessionId:e,open:!!e,onOpenChange:(n)=>{if(!n)s(null)}})]})}C();function de({...a}){return t(Pe,{"data-slot":"collapsible",...a})}function me({...a}){return t(Re,{"data-slot":"collapsible-trigger",...a})}function ce({...a}){return t(Ae,{"data-slot":"collapsible-content",...a})}function ee(a){switch(a.toLowerCase()){case"owner":return Zc();case"editor":return Ps();case"reviewer":return Os();default:return a}}function Le(a,e){if(typeof a==="object"&&a!==null&&"message"in a){let s=a.message;if(typeof s==="string")return s}return e}function Be({rule:a}){let e=a.resourceData??{};if(a.resource==="agent_mcp_call_count")return t("span",{children:lC({value:String(e.id??"")})});if(a.resource==="agent_bash_call_count")return t("span",{children:iC({value:String(e.match??"*")})});if(a.resource==="agent_tool_call_count")return t("span",{children:cC({value:String(e.name??e.toolName??"*")})});return null}function Me({rule:a}){if(a.scopeMode==="all_members")return o(we,{variant:"secondary",className:"gap-1 text-xs",children:[t(oo,{className:"h-3 w-3"}),o("span",{children:[Cd(),a.role?` (${ee(a.role)})`:` (${wl()})`]})]});if(a.scopeMode==="each_member")return o(we,{variant:"secondary",className:"gap-1 text-xs",children:[t(Hn,{className:"h-3 w-3"}),o("span",{children:[Ed(),a.role?` (${ee(a.role)})`:` (${wl()})`]})]});return o(we,{variant:"secondary",className:"gap-1 text-xs",children:[t(ci,{className:"h-3 w-3"}),o("span",{children:[Id()," (",a.userIds?.length||0,")"]})]})}function je({teamId:a,rule:e,record:s}){let i=K(),[m,r]=u(!1),[p,f]=u(()=>new Date),g=zi[e.resource],v=e.scopeMode==="all_members",c=s.percent>=100,x=v?e.role?`${XS()}: ${ee(e.role)}`:uC():s.user?.name||s.userId||cn();h(()=>{if(!s.isWindowActive||!s.periodEnd)return;let n=window.setInterval(()=>f(new Date),60000);return()=>window.clearInterval(n)},[s.isWindowActive,s.periodEnd]);let y=U({mutationFn:async()=>{let n=await A.api.teams[":teamId"].quotas[":id"].records.reset.$post({param:{teamId:a,id:e.id},json:{userId:s.userId??null}});if(!n.ok){let _=await n.json().catch(()=>null);throw Error(Le(_,lh()))}return await n.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",a,"quotas",e.id,"records"]}),i.invalidateQueries({queryKey:["teams",a,"quotas"]}),r(!1),R.success(WS())},onError:(n)=>{let _=n instanceof Error?n.message:lh();r(!1),R.error(_)}});return o(B,{children:[o("div",{className:"space-y-3 rounded-xl border border-border/70 bg-card p-4 text-card-foreground shadow-2xs",children:[o("div",{className:"flex items-center justify-between gap-3",children:[o("div",{className:"flex min-w-0 items-center gap-3",children:[v?t("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:t(oo,{className:"h-5 w-5"})}):o(Ee,{className:"h-9 w-9 shrink-0 border border-border/50",children:[t(Ie,{src:s.user?.image||void 0}),t(Te,{className:"text-xs font-semibold",children:s.user?.name?.[0]?.toUpperCase()||"U"})]}),o("div",{className:"min-w-0",children:[t("div",{className:"truncate text-sm font-semibold text-foreground",children:x}),!v&&s.user?.email&&t("div",{className:"truncate text-xs text-muted-foreground",children:s.user.email})]})]}),o("div",{className:"flex shrink-0 items-center gap-2",children:[s.isWindowActive&&s.periodEnd?o(we,{variant:"outline",className:"hidden gap-1 border-primary/30 bg-primary/5 text-xs text-primary sm:flex",children:[t(hr,{className:"h-3 w-3"}),t("span",{children:cg({time:Zp(s.periodEnd,p)})})]}):o(we,{variant:"secondary",className:"hidden gap-1 text-xs text-muted-foreground sm:flex",children:[t(br,{className:"h-3 w-3 text-primary"}),t("span",{children:ig()})]}),o(S,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>r(!0),disabled:y.isPending,children:[y.isPending?t(L,{className:"h-3.5 w-3.5 animate-spin"}):t(Fs,{className:"h-3.5 w-3.5"}),ug()]})]})]}),o("div",{className:"space-y-1.5 pt-1",children:[t(Gd,{value:Math.min(100,Math.max(0,s.percent)),className:"h-2"}),o("div",{className:"flex items-center justify-between gap-2 text-xs font-medium",children:[o("span",{className:c?"font-bold text-destructive":"text-foreground",children:[Ca(e.resource,s.consumed)," /"," ",Ca(e.resource,e.limit)," ",g?.unit]}),o("span",{className:c?"font-bold text-destructive":"text-muted-foreground",children:[s.percent,"%"]})]})]}),o("div",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground sm:hidden",children:[s.isWindowActive&&s.periodEnd?o("span",{className:"flex items-center gap-1 text-primary",children:[t(hr,{className:"h-3 w-3"}),cg({time:Zp(s.periodEnd,p)})]}):o("span",{className:"flex items-center gap-1",children:[t(br,{className:"h-3 w-3 text-primary"}),ig()]}),o("span",{children:[KS(),": ",Ca(e.resource,s.remaining)," ",g?.unit]})]})]}),t(Je,{open:m,onOpenChange:r,children:o(Xe,{children:[o(et,{children:[t(rt,{children:ug()}),t(nt,{children:YS({target:x})})]}),o(tt,{children:[t(st,{disabled:y.isPending,children:ke()}),o(ot,{onClick:(n)=>{n.preventDefault(),y.mutate()},disabled:y.isPending,children:[y.isPending&&t(L,{className:"mr-2 h-4 w-4 animate-spin"}),Wa()]})]})]})})]})}function Ue({teamId:a,rule:e}){let[s,i]=u(!1),[m,r]=u(""),p=zi[e.resource],f=p?.icon||Uo,{data:g,isLoading:v,isError:c}=Z({queryKey:["teams",a,"quotas",e.id,"records"],queryFn:async()=>{let n=await A.api.teams[":teamId"].quotas[":id"].records.$get({param:{teamId:a,id:e.id}});if(!n.ok)throw Error(ih());return await n.json()},enabled:s,refetchInterval:s?1e4:!1}),x=g?.records??[],y=x.filter((n)=>{if(!m.trim())return!0;let _=m.toLowerCase();return n.user?.name.toLowerCase().includes(_)||n.user?.email.toLowerCase().includes(_)});return o(de,{open:s,onOpenChange:i,className:"rounded-xl border border-border/70",children:[t(me,{asChild:!0,children:o("button",{type:"button","aria-label":s?FS():HS(),className:"flex w-full items-center justify-between gap-4 p-4 text-left transition-colors hover:bg-muted/40",children:[o("div",{className:"flex min-w-0 items-start gap-3",children:[t("div",{className:"mt-0.5 rounded-lg bg-primary/10 p-2 text-primary",children:t(f,{className:"h-5 w-5"})}),o("div",{className:"min-w-0",children:[o("div",{className:"flex flex-wrap items-center gap-2",children:[t("span",{className:"font-semibold text-foreground",children:p?.label()||e.resource}),!e.enabled&&t(we,{variant:"secondary",children:np()})]}),o("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[t(Me,{rule:e}),o(we,{variant:"outline",className:"gap-1 text-xs",children:[t(hr,{className:"h-3 w-3"}),Ca(e.resource,e.limit)," ",p?.unit," /"," ",ql(e.period)]}),t(Be,{rule:e})]})]})]}),t(be,{className:`h-5 w-5 shrink-0 text-muted-foreground transition-transform ${s?"rotate-180":""}`})]})}),t(ce,{children:o("div",{className:"space-y-3 border-t border-border/60 bg-muted/10 p-4",children:[e.scopeMode!=="all_members"&&x.length>3&&o("div",{className:"relative",children:[t(Ut,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),t(H,{value:m,onChange:(n)=>r(n.target.value),placeholder:cp(),className:"h-9 pl-9 text-sm"})]}),v?t("div",{className:"flex justify-center py-10",children:t(L,{className:"h-7 w-7 animate-spin text-primary"})}):c?t("div",{className:"py-8 text-center text-sm text-destructive",children:ih()}):y.length===0?t("div",{className:"py-8 text-center text-sm text-muted-foreground",children:QS()}):y.map((n,_)=>t(je,{teamId:a,rule:e,record:n},n.id||n.userId||`record-${_}`))]})})]})}function ue({teamId:a}){let{data:e,isLoading:s,isError:i}=Z({queryKey:["teams",a,"quotas"],queryFn:async()=>{let r=await A.api.teams[":teamId"].quotas.$get({param:{teamId:a}});if(!r.ok)throw Error(ls());return await r.json()},enabled:!!a}),m=e?.rules??[];return o(Ct,{className:"border-border/60 shadow-sm",children:[o(Nt,{children:[o(Ot,{className:"flex items-center gap-2 text-xl font-semibold tracking-tight",children:[t(Uo,{className:"h-5 w-5 text-primary"}),Td()]}),t(Ht,{children:jS()})]}),t(Rt,{children:s?t("div",{className:"flex h-48 items-center justify-center",children:t(L,{className:"h-7 w-7 animate-spin text-muted-foreground"})}):i?t("div",{className:"py-10 text-center text-sm text-destructive",children:ls()}):m.length===0?o("div",{className:"flex flex-col items-center justify-center rounded-xl border-2 border-dashed border-border py-12 text-center",children:[t(Uo,{className:"mb-3 h-10 w-10 text-muted-foreground/50"}),t("p",{className:"text-base font-medium text-foreground",children:Vf()}),t("p",{className:"mt-1 max-w-md text-sm text-muted-foreground",children:Qf()})]}):t("div",{className:"space-y-3",children:m.map((r)=>t(Ue,{teamId:a,rule:r},r.id))})})]})}C();var $e=Object.values(Il);function pe({teamId:a}){let[e,s]=u([]),[i,m]=u([]),[r,p]=u(""),{ref:f,inView:g}=Mt(),{data:v}=Z({queryKey:["teams",a,"members"],queryFn:async()=>{let l=await A.api.teams[":teamId"].members.$get({param:{teamId:a},query:{}});if(!l.ok)return[];return await l.json()},enabled:!!a}),c=v||[],{data:x,isLoading:y,isError:n,fetchNextPage:_,hasNextPage:d,isFetchingNextPage:b}=ut({queryKey:["teams",a,"audit-logs",e,i,r],queryFn:async({pageParam:l})=>{let q=await A.api.teams[":teamId"]["audit-logs"].$get({param:{teamId:a},query:{first:"20",after:l?String(l):void 0,actions:e.length>0?e:void 0,userIds:i.length>0?i:void 0,itemId:r.trim()||void 0}});if(!q.ok)throw Error("Failed to fetch audit logs");return await q.json()},initialPageParam:"",getNextPageParam:(l)=>l.pageInfo.endCursor||void 0,enabled:!!a});h(()=>{if(g&&d&&!b)_()},[g,d,b,_]);let k=x?.pages.flatMap((l)=>l.nodes)||[],Q=x?.pages[0]?.total??0,I=(l)=>{s((q)=>q.includes(l)?q.filter((P)=>P!==l):[...q,l])},j=(l)=>{m((q)=>q.includes(l)?q.filter((P)=>P!==l):[...q,l])},fe=(l)=>{if(l.includes("delete")||l.includes("remove")||l.includes("revoke"))return t(we,{variant:"outline",className:"bg-destructive/10 text-destructive border-destructive/20 font-mono text-xs",children:l});if(l.includes("create")||l.includes("add"))return t(we,{variant:"outline",className:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20 font-mono text-xs",children:l});if(l.includes("update")||l.includes("reparent")||l.includes("copy"))return t(we,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 font-mono text-xs",children:l});return t(we,{variant:"outline",className:"bg-muted text-muted-foreground border-border font-mono text-xs",children:l})},ge=new Map(c.map((l)=>[l.userId||l.id,l]));return t("div",{className:"space-y-6",children:o(Ct,{className:"border border-border/50 shadow-xs",children:[o(Nt,{className:"pb-4",children:[o("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[o("div",{children:[o(Ot,{className:"text-xl font-bold flex items-center gap-2",children:[t(Fs,{className:"h-5 w-5 text-primary"}),hf()]}),t(Ht,{className:"mt-1",children:Zy()})]}),Q>0&&o(we,{variant:"secondary",className:"w-fit text-xs font-normal",children:[Q," ",hf()]})]}),o("div",{className:"mt-4 flex flex-wrap items-center gap-3 pt-4 border-t border-border/40",children:[o(gt,{children:[t(At,{asChild:!0,children:o(S,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[t(J,{className:"h-3.5 w-3.5"}),Ub(),e.length>0&&t(we,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:e.length})]})}),o(yt,{className:"w-64 p-2",align:"start",children:[t("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:qC()}),t("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:$e.map((l)=>o("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[t(Nr,{checked:e.includes(l),onCheckedChange:()=>I(l)}),t("span",{className:"font-mono",children:l})]},l))}),e.length>0&&t(S,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>s([]),children:"Clear Actions"})]})]}),o(gt,{children:[t(At,{asChild:!0,children:o(S,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[t(J,{className:"h-3.5 w-3.5"}),Fb(),i.length>0&&t(we,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:i.length})]})}),o(yt,{className:"w-64 p-2",align:"start",children:[t("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:oE()}),t("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:c.map((l)=>{let q=l.userId||l.user?.id||l.id,P=l.user?.name||l.name||q,V=l.user?.image||l.image;return o("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[t(Nr,{checked:i.includes(q),onCheckedChange:()=>j(q)}),o(Ee,{className:"h-5 w-5",children:[t(Ie,{src:V||void 0}),t(Te,{className:"text-[10px]",children:P.slice(0,2).toUpperCase()})]}),t("span",{className:"truncate",children:P})]},q)})}),i.length>0&&t(S,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>m([]),children:"Clear Users"})]})]}),o("div",{className:"relative flex-1 min-w-[200px] max-w-xs",children:[t(Ut,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),t(H,{type:"text",placeholder:FC(),value:r,onChange:(l)=>p(l.target.value),className:"pl-8 pr-8 h-9 text-xs"}),r&&t("button",{onClick:()=>p(""),className:"absolute right-2.5 top-2.5 text-muted-foreground hover:text-foreground",children:t(De,{className:"h-4 w-4"})})]}),(e.length>0||i.length>0||r)&&t(S,{variant:"ghost",size:"sm",className:"h-9 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{s([]),m([]),p("")},children:"Clear all"})]})]}),o(Rt,{className:"p-0",children:[y?t("div",{className:"flex h-64 items-center justify-center",children:t(L,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):n?t("div",{className:"p-8 text-center text-sm text-destructive",children:"Failed to load audit logs."}):k.length===0?t("div",{className:"p-12 text-center text-sm text-muted-foreground",children:tx()}):o(Tn,{children:[t(Mn,{children:o(_r,{className:"hover:bg-transparent border-b border-border/50",children:[t(bt,{className:"w-[180px] text-xs font-semibold",children:aA()}),t(bt,{className:"w-[200px] text-xs font-semibold",children:FI()}),t(bt,{className:"text-xs font-semibold",children:vw()}),t(bt,{className:"text-xs font-semibold",children:bS()}),t(bt,{className:"w-[160px] text-right text-xs font-semibold",children:gI()})]})}),t(Rn,{children:k.map((l)=>{let q=l.userId?ge.get(l.userId):null,P=q?.user?.name||q?.name||l.userId||"System",V=q?.user?.image||q?.image;return o(_r,{className:"hover:bg-muted/40 transition-colors",children:[t(mt,{className:"py-3 font-medium",children:fe(l.action)}),t(mt,{className:"py-3",children:o("div",{className:"flex items-center gap-2",children:[o(Ee,{className:"h-6 w-6",children:[t(Ie,{src:V||void 0}),t(Te,{className:"text-[10px]",children:P.slice(0,2).toUpperCase()})]}),t("span",{className:"text-xs font-medium text-foreground truncate max-w-[160px]",children:l.agent?jc({user:P,agent:l.agent.name}):P}),l.agent&&t(wt,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"})]})}),t(mt,{className:"py-3 text-xs font-mono text-muted-foreground",children:l.itemId||"-"}),t(mt,{className:"py-3 text-xs font-mono text-muted-foreground",children:l.projectId||"-"}),t(mt,{className:"py-3 text-right text-xs text-muted-foreground",children:Cn(l.createdAt)})]},l.id)})})]}),t("div",{ref:f,className:"py-4 flex justify-center",children:b&&t(L,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})]})})}function ze(){let{teamId:a}=Ge.useParams(),[e,s]=u("audit-logs"),{data:i,isLoading:m}=Z({queryKey:["teams",a,"me"],queryFn:async()=>{let r=await A.api.teams[":teamId"].me.$get({param:{teamId:a}});if(!r.ok)throw Error("Failed to fetch me");return await r.json()},enabled:!!a});if(m)return t("div",{className:"flex h-screen items-center justify-center",children:t(L,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(i?.role?.toLowerCase()!=="owner")return o("div",{className:"flex h-full flex-col items-center justify-center p-8 text-center",children:[t(jl,{className:"h-12 w-12 text-destructive mb-4"}),t("h2",{className:"text-xl font-bold tracking-tight mb-2",children:sA()}),t("p",{className:"text-sm text-muted-foreground max-w-md",children:Ix()})]});return t("div",{className:"h-full bg-background font-sans selection:bg-primary/20 transition-colors duration-300",children:o("div",{className:"flex flex-col md:flex-row h-full",children:[t("div",{className:"w-full h-full md:w-72 bg-sidebar border-b md:border-b-0 md:border-r border-sidebar-border z-10 md:left-16 overflow-y-auto transition-colors duration-300",children:o("nav",{className:"p-4 space-y-1 mt-4",children:[t("div",{className:"mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider",children:Km()}),t("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:XE()}),o("button",{onClick:()=>s("audit-logs"),className:E("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",e==="audit-logs"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[t(Fs,{className:"w-5 h-5"}),hf(),e==="audit-logs"&&t("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),o("button",{onClick:()=>s("quotas"),className:E("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",e==="quotas"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[t(Uo,{className:"w-5 h-5"}),Td(),e==="quotas"&&t("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),t("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:ay()}),o("button",{onClick:()=>s("ai-usage"),className:E("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",e==="ai-usage"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[t(ie,{className:"w-5 h-5"}),UI(),e==="ai-usage"&&t("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),o("button",{onClick:()=>s("ai-sessions"),className:E("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",e==="ai-sessions"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[t(F,{className:"w-5 h-5"}),Mg(),e==="ai-sessions"&&t("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]})]})}),t("div",{className:"flex-1 overflow-y-auto p-4 md:p-8",children:o("div",{className:"max-w-6xl mx-auto space-y-8",children:[e==="audit-logs"&&t(pe,{teamId:a}),e==="ai-usage"&&t(ne,{teamId:a}),e==="ai-sessions"&&t(le,{teamId:a}),e==="quotas"&&t(ue,{teamId:a})]})})]})})}var Ge=Fe("/teams/$teamId/dashboard")({component:ze});export{Ge as Route};
@@ -0,0 +1,54 @@
1
+ // @bun
2
+ import{Oe}from"./chunk-fnmwksnb.js";function Ue(t){let o=Object.values(t).filter((c)=>typeof c==="number");return Object.entries(t).filter(([c,u])=>o.indexOf(+c)===-1).map(([c,u])=>u)}function dt(t,o="|"){return t.map((n)=>gt(n)).join(o)}function we(t,o){if(typeof o==="bigint")return o.toString();return o}function ke(t){return{get value(){{let n=t();return Object.defineProperty(this,"value",{value:n}),n}throw Error("cached value already set")}}}function eo(t){return t===null||t===void 0}function Me(t){let o=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(o,n)}function to(t,o){let n=t/o,c=Math.round(n),u=4*Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-c)<u)return 0;return n-c}var Qr=Symbol("evaluating");function ro(t,o,n){let c=void 0;Object.defineProperty(t,o,{get(){if(c===Qr)return;if(c===void 0)c=Qr,c=n();return c},set(u){Object.defineProperty(t,o,{value:u})},configurable:!0})}function L(t,o,n){Object.defineProperty(t,o,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ae(...t){let o={};for(let n of t){let c=Object.getOwnPropertyDescriptors(n);Object.assign(o,c)}return Object.defineProperties({},o)}function oo(t){return JSON.stringify(t)}function no(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var mt="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function ge(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}var io=ke(()=>{if(B.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(t){return!1}});function me(t){if(ge(t)===!1)return!1;let o=t.constructor;if(o===void 0)return!0;if(typeof o!=="function")return!0;let n=o.prototype;if(ge(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function _t(t){if(me(t))return{...t};if(Array.isArray(t))return[...t];if(t instanceof Map)return new Map(t);if(t instanceof Set)return new Set(t);return t}var so=new Set(["string","number","symbol"]);function le(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Y(t,o,n){let c=new t._zod.constr(o??t._zod.def);if(!o||n?.parent)c._zod.parent=t;return c}function S(t){let o=t;if(!o)return{};if(typeof o==="string")return{error:()=>o};if(o?.message!==void 0){if(o?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");o.error=o.message}if(delete o.message,typeof o.error==="string")return{...o,error:()=>o.error};return o}function gt(t){if(typeof t==="bigint")return t.toString()+"n";if(typeof t==="string")return`"${t}"`;return`${t}`}function ao(t){return Object.keys(t).filter((o)=>t[o]._zod.optin!==void 0&&t[o]._zod.optout==="optional")}var lo=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))();function Ic(t,o){let n=t._zod.def,c=n.checks;if(c&&c.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let p=ae(t._zod.def,{get shape(){let f={};for(let h of Reflect.ownKeys(o)){if(!Object.prototype.hasOwnProperty.call(n.shape,h))throw Error(`Unrecognized key: "${String(h)}"`);if(!o[h])continue;L(f,h,n.shape[h])}return L(this,"shape",f),f},checks:[]});return Y(t,p)}function Ec(t,o){let n=t._zod.def,c=n.checks;if(c&&c.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let p=ae(t._zod.def,{get shape(){let f={...t._zod.def.shape};for(let h of Reflect.ownKeys(o)){if(!Object.prototype.hasOwnProperty.call(n.shape,h))throw Error(`Unrecognized key: "${String(h)}"`);if(!o[h])continue;delete f[h]}return L(this,"shape",f),f},checks:[]});return Y(t,p)}function Tc(t,o){if(!me(o))throw Error("Invalid input to extend: expected a plain object");let n=t._zod.def.checks;if(n&&n.length>0){let p=t._zod.def.shape;for(let f of Reflect.ownKeys(o))if(Object.getOwnPropertyDescriptor(p,f)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let u=ae(t._zod.def,{get shape(){let p={...t._zod.def.shape,...o};return L(this,"shape",p),p}});return Y(t,u)}function Ac(t,o){if(!me(o))throw Error("Invalid input to safeExtend: expected a plain object");let n=ae(t._zod.def,{get shape(){let c={...t._zod.def.shape,...o};return L(this,"shape",c),c}});return Y(t,n)}function Nc(t,o){if(!o?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(t._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n=ae(t._zod.def,{get shape(){let c={...t._zod.def.shape,...o._zod.def.shape};return L(this,"shape",c),c},get catchall(){return o._zod.def.catchall},checks:o._zod.def.checks??[]});return Y(t,n)}function po(t,o,n,c="partial"){let p=o._zod.def.checks;if(p&&p.length>0)throw Error(`.${c}() cannot be used on object schemas containing refinements`);let h=ae(o._zod.def,{get shape(){let _=o._zod.def.shape,b={..._};if(n)for(let z of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(_,z))throw Error(`Unrecognized key: "${String(z)}"`);if(!n[z])continue;b[z]=t?new t({type:"optional",innerType:_[z]}):_[z]}else for(let z of Reflect.ownKeys(_))b[z]=t?new t({type:"optional",innerType:_[z]}):_[z];return L(this,"shape",b),b},checks:[]});return Y(o,h)}function Cc(t,o,n){let c=ae(o._zod.def,{get shape(){let u=o._zod.def.shape,p={...u};if(n)for(let f of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(p,f))throw Error(`Unrecognized key: "${String(f)}"`);if(!n[f])continue;p[f]=new t({type:"nonoptional",innerType:u[f]})}else for(let f of Reflect.ownKeys(u))p[f]=new t({type:"nonoptional",innerType:u[f]});return L(this,"shape",p),p}});return Y(o,c)}function he(t,o=0){if(t.aborted===!0)return!0;for(let n=o;n<t.issues.length;n++)if(t.issues[n]?.continue!==!0)return!0;return!1}function fo(t,o=0){if(t.aborted===!0)return!0;for(let n=o;n<t.issues.length;n++)if(t.issues[n]?.continue===!1)return!0;return!1}function re(t,o){return o.map((n)=>{var c;return(c=n).path??(c.path=[]),n.path.unshift(t),n})}function $e(t){return typeof t==="string"?t:t?.message}function xt(t,o,n){var c;for(let u=o;u<t.length;u++)(c=t[u]).schema??(c.schema=n)}function ne(t,o,n){var c;let u=t.inst?._zod?.traits;if(u?.has("$ZodType"))if(u.has("$ZodCheck"))(c=t).schema??(c.schema=t.inst);else t.schema=t.inst;let p=t.schema!==t.inst?t.schema?._zod.def?.error:void 0,f=t.message?t.message:$e(t.inst?._zod.def?.error?.(t))??$e(p?.(t))??$e(o?.error?.(t))??$e(n.customError?.(t))??$e(n.localeError?.(t))??"Invalid input",{inst:h,schema:_,continue:b,input:z,...w}=t;if(w.path??(w.path=[]),w.message=f,o?.reportInput)w.input=z;return w}var jc=/[\uD800-\uDBFF]/;function Je(t){let o=t.length;if(!jc.test(t))return o;let n=o;for(let c=0;c<o-1;c++)if((t.charCodeAt(c)&64512)===55296&&(t.charCodeAt(c+1)&64512)===56320)n--,c++;return n}function Be(t){if(Array.isArray(t))return"array";if(typeof t==="string")return"string";return"unknown"}function mo(t){let o=typeof t;switch(o){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let n=t;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return o}function _e(...t){let[o,n,c]=t;if(typeof o==="string")return{message:o,code:"custom",input:n,inst:c};return{...o}}function ho(t,o){for(let n in o){let c=Object.getOwnPropertyDescriptor(o,n);if(c.get)Object.defineProperty(t,n,{...c,enumerable:!1});else Rc(t,n,c.value)}}function de(t,o,n,c=!0){return Object.defineProperty(t,o,{configurable:!0,writable:!0,enumerable:c,value:n}),n}function yt(t,o,n){return de(t,o,n,!1)}function Rc(t,o,n){Object.defineProperty(t,o,{configurable:!0,get(){return this==null?n:de(this,o,n.bind(this))},set(c){de(this,o,c)}})}function Dc(t,o){let n=Object.getPrototypeOf(t);return o in n?void 0:n}var pt,ue=!1,Lc={configurable:!0,get(){ue=!0;return}};function T(t,o,n){let c=Object.getPrototypeOf(t._zod);if(o in c&&pt!==t._zod){pt=void 0;return}pt=t._zod,Object.defineProperty(c,o,{configurable:!0,get(){Object.defineProperty(this,o,Lc);let u=ue;ue=!1;try{let p=n(this);if(ue)delete this[o];else Object.defineProperty(this,o,{configurable:!0,writable:!0,value:p});return ue=ue||u,p}catch(p){throw delete this[o],ue=ue||u,p}},set(u){Object.defineProperty(this,o,{configurable:!0,writable:!0,value:u})}})}function Fc(t,o,n,c){let u=Dc(t,o);if(!u)return;Object.defineProperty(u,o,{configurable:!0,get(){let p={configurable:!0,writable:!0,enumerable:c,value:void 0};return Object.defineProperty(this,o,p),p.value=n(this),Object.defineProperty(this,o,p),p.value},set(p){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:c,value:p})}})}var Uc="~constantCatch";function _o(t){let o=()=>t;return o[Uc]=!0,o}var go,Dr=Object.freeze({status:"aborted"}),bt={value:void 0,enumerable:!1},xo="captureStackTrace"in Error?Error:null;function Mc(t){let o=xo;if(o){let n=o.stackTraceLimit;if(typeof n==="number"){try{o.stackTraceLimit=0}catch{return xo=null,new t}try{return new t}finally{o.stackTraceLimit=n}}}return new t}function v(t,o,n,c){let u={};function p(k){this.def=k,this.constr=w,this.traits=new Set}p.prototype=u;let f=n,h=f&&new WeakSet;function _(k,Z){if(!k._zod){bt.value=new p(Z);try{Object.defineProperty(k,"_zod",bt)}finally{bt.value=void 0}}if(k._zod.traits.has(t))return;if(k._zod.traits.add(t),o(k,Z),h){let O=Object.getPrototypeOf(k),E=k._zod.constr.prototype,J=O;while(J&&J!==E)J=Object.getPrototypeOf(J);let q=J??O;if(!h.has(q))h.add(q),ho(q,f)}let P=w.prototype;for(let O in P){if(!Object.prototype.hasOwnProperty.call(P,O))continue;if(!(O in k))k[O]=P[O].bind(k)}}let b=c?.Parent??Object;class z extends b{}Object.defineProperty(z,"name",{value:t});function w(k){let Z=c?.Parent?Mc(z):this;_(Z,k);let P=Z._zod.deferred;if(P){for(let E of P)E();Z._zod.deferred=void 0}let O=globalThis.__zod_globalConfig?.postProcessor;if(O)O(Z);return Z}return Object.defineProperty(w,"init",{value:_}),Object.defineProperty(w,Symbol.hasInstance,{value:(k)=>{if(c?.Parent&&k instanceof c.Parent)return!0;return k?._zod?.traits?.has(t)}}),Object.defineProperty(w,"name",{value:t}),w}class ie extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ze extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`);this.name="ZodEncodeError"}}(go=globalThis).__zod_globalConfig??(go.__zod_globalConfig={});var B=globalThis.__zod_globalConfig;function W(t){if(t)Object.assign(B,t);return B}function Jc(){let t=this._zod;return t.message??(t.message=JSON.stringify(t.def,we,2)),t.message}function Bc(t){this._zod.message=t}var Vc={get:Jc,set:Bc,enumerable:!0,configurable:!0},vt={value:void 0,enumerable:!1},$t={value:void 0,enumerable:!1},yo=new WeakSet([Object.prototype,Error.prototype]),bo=(t,o)=>{t.name="$ZodError",vt.value=t._zod,Object.defineProperty(t,"_zod",vt),$t.value=o,Object.defineProperty(t,"issues",$t),vt.value=void 0,$t.value=void 0,Object.defineProperty(t,"message",Vc);let n=Object.getPrototypeOf(t);if(!yo.has(n))yo.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let c=()=>this.message;return Object.defineProperty(this,"toString",{value:c,configurable:!0,writable:!0}),c},set(c){Object.defineProperty(this,"toString",{value:c,configurable:!0,writable:!0})}})},Vs=v("$ZodError",bo),wt=v("$ZodError",bo,void 0,{Parent:Error});function Kc(t,o,n){if(!Object.prototype.hasOwnProperty.call(t,o))if(o==="__proto__")Object.defineProperty(t,o,{value:n(),writable:!0,enumerable:!0,configurable:!0});else t[o]=n();return t[o]}function kt(t,o=(n)=>n.message){let n={},c=[];for(let u of t.issues)if(u.path.length>0)Kc(n,u.path[0],()=>[]).push(o(u));else c.push(o(u));return{formErrors:c,fieldErrors:n}}function Zt(t,o=(n)=>n.message){let n={_errors:[]},c=(u,p=[])=>{for(let f of u.issues)if(f.code==="invalid_union"&&f.errors.length)f.errors.map((h)=>c({issues:h},[...p,...f.path]));else if(f.code==="invalid_key")c({issues:f.issues},[...p,...f.path]);else if(f.code==="invalid_element")c({issues:f.issues},[...p,...f.path]);else{let h=[...p,...f.path];if(h.length===0)n._errors.push(o(f));else{let _=n,b=0;while(b<h.length){let z=h[b],w=b===h.length-1;if(z==="_errors"){if(w)_._errors.push(o(f));b++;continue}if(!Object.prototype.hasOwnProperty.call(_,z))Object.defineProperty(_,z,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let k=_[z];if(w)k._errors.push(o(f));_=k,b++}}}};return c(t),n}function Wc(t){let o=[],n=t.map((c)=>typeof c==="object"?c.key:c);for(let c of n)if(typeof c==="number")o.push(`[${c}]`);else if(typeof c==="symbol")o.push(`[${JSON.stringify(String(c))}]`);else if(/[^\w$]/.test(c))o.push(`[${JSON.stringify(c)}]`);else{if(o.length)o.push(".");o.push(c)}return o.join("")}function ef(t){let o=[],n=[...t.issues].sort((c,u)=>(c.path??[]).length-(u.path??[]).length);for(let c of n)if(o.push(`\u2716 ${c.message}`),c.path?.length)o.push(` \u2192 at ${Wc(c.path)}`);return o.join(`
3
+ `)}function Ve(t,o){return{callee:o?.callee??t,Err:o?.Err}}var Ke=(t)=>{let o=(n,c,u,p)=>{let f=u?{...u,async:!1}:{async:!1},h=n._zod.run({value:c,issues:[]},f);if(h instanceof Promise)throw new ie;if(h.issues.length){let _=new(p?.Err??t)(h.issues.map((b)=>ne(b,f,W())));throw mt(_,p?.callee??o),_}return h.value};return o};var We=(t)=>{let o=async(n,c,u,p)=>{let f=u?{...u,async:!0}:{async:!0},h=n._zod.run({value:c,issues:[]},f);if(h instanceof Promise)h=await h;if(h.issues.length){let _=new(p?.Err??t)(h.issues.map((b)=>ne(b,f,W())));throw mt(_,p?.callee??o),_}return h.value};return o};var Pe=(t)=>(o,n,c)=>{let u=c?{...c,async:!1}:{async:!1},p=o._zod.run({value:n,issues:[]},u);if(p instanceof Promise)throw new ie;return p.issues.length?{success:!1,error:new(t??Vs)(p.issues.map((f)=>ne(f,u,W())))}:{success:!0,data:p.value}},zo=Pe(wt),Ie=(t)=>async(o,n,c)=>{let u=c?{...c,async:!0}:{async:!0},p=o._zod.run({value:n,issues:[]},u);if(p instanceof Promise)p=await p;return p.issues.length?{success:!1,error:new t(p.issues.map((f)=>ne(f,u,W())))}:{success:!0,data:p.value}},vo=Ie(wt);var $o=(t)=>{let o=Ke(t),n=(c,u,p,f)=>{let h=p?{...p,direction:"backward"}:{direction:"backward"};return o(c,u,h,Ve(n,f))};return n};var wo=(t)=>{let o=Ke(t),n=(c,u,p,f)=>o(c,u,p,Ve(n,f));return n};var ko=(t)=>{let o=We(t),n=async(c,u,p,f)=>{let h=p?{...p,direction:"backward"}:{direction:"backward"};return await o(c,u,h,Ve(n,f))};return n};var Zo=(t)=>{let o=We(t),n=async(c,u,p,f)=>await o(c,u,p,Ve(n,f));return n};var Po=(t)=>(o,n,c)=>{let u=c?{...c,direction:"backward"}:{direction:"backward"};return Pe(t)(o,n,u)};var So=(t)=>(o,n,c)=>Pe(t)(o,n,c);var Oo=(t)=>async(o,n,c)=>{let u=c?{...c,direction:"backward"}:{direction:"backward"};return Ie(t)(o,n,u)};var Io=(t)=>async(o,n,c)=>Ie(t)(o,n,c);var Eo=/^[cC][0-9a-z]{6,}$/,To=/^[0-9a-z]+$/,Ao=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,No=/^[0-9a-vA-V]{20}$/,Co=/^[A-Za-z0-9]{27}$/,jo=/^[a-zA-Z0-9_-]{21}$/;function Ro(t){return new RegExp(`^[a-zA-Z0-9_-]{${t}}$`)}var Do=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Lo=/^([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})$/,St=(t)=>{if(!t)return/^([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)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Fo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var qc="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Uo(){return new RegExp(qc,"u")}var Mo=/^(?:(?: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])$/,Jo=/^(([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}|:))$/;var Bo=/^((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])$/,Vo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ko=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ot=/^[A-Za-z0-9_-]*$/;var Wo=/^https?$/,Go=/^\+[1-9]\d{6,14}$/;var qo="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Yc(t){return new RegExp(`^${t}$`)}var Yo=Yc(qo);function Pt(t){return typeof t.precision==="number"?t.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":t.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${t.precision}}`:t.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Xo(t){return new RegExp(`^${Pt(t)}$`)}function Ho(t){let o=["Z"];if(t.offset)o.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${Pt({precision:t.precision,seconds:!0})}(?:${o.join("|")})`,c=t.local?`${n}|${Pt({precision:t.precision})}`:n;return new RegExp(`^${qo}T(?:${c})$`)}var Qo=(t)=>{let o=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${o}$`)},en=/^-?\d+n?$/,Ge=/^-?\d+$/,Ee=/^-?\d+(?:\.\d+)?$/,tn=/^(?:true|false)$/i,rn=/^null$/i;var on=/^[^A-Z]*$/,nn=/^[^a-z]*$/;var M=v("$ZodCheck",(t,o)=>{var n;t._zod??(t._zod={}),t._zod.def=o,(n=t._zod).onattach??(n.onattach=[])});var It=(t)=>{let o=t.value;return!eo(o)&&o.length!==void 0},qe={number:"number",bigint:"bigint",object:"date"},Tt=v("$ZodCheckLessThan",(t,o)=>{M.init(t,o);let n=qe[typeof o.value];t._zod.onattach.push((c)=>{let u=c._zod.bag,p=(o.inclusive?u.maximum:u.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(o.value<p)if(o.inclusive)u.maximum=o.value;else u.exclusiveMaximum=o.value}),t._zod.check=(c)=>{if(o.inclusive?c.value<=o.value:c.value<o.value)return;c.issues.push({origin:qe[typeof c.value]??n,code:"too_big",maximum:typeof o.value==="object"?o.value.getTime():o.value,input:c.value,inclusive:o.inclusive,inst:t,continue:!o.abort})}}),At=v("$ZodCheckGreaterThan",(t,o)=>{M.init(t,o);let n=qe[typeof o.value];t._zod.onattach.push((c)=>{let u=c._zod.bag,p=(o.inclusive?u.minimum:u.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(o.value>p)if(o.inclusive)u.minimum=o.value;else u.exclusiveMinimum=o.value}),t._zod.check=(c)=>{if(o.inclusive?c.value>=o.value:c.value>o.value)return;c.issues.push({origin:qe[typeof c.value]??n,code:"too_small",minimum:typeof o.value==="object"?o.value.getTime():o.value,input:c.value,inclusive:o.inclusive,inst:t,continue:!o.abort})}}),sn=v("$ZodCheckMultipleOf",(t,o)=>{M.init(t,o),t._zod.onattach.push((n)=>{var c;(c=n._zod.bag).multipleOf??(c.multipleOf=o.value)}),t._zod.check=(n)=>{if(typeof n.value!==typeof o.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?o.value!==BigInt(0)&&n.value%o.value===BigInt(0):to(n.value,o.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:o.value,input:n.value,inst:t,continue:!o.abort})}}),cn=v("$ZodCheckNumberFormat",(t,o)=>{M.init(t,o),o.format=o.format||"float64";let n=o.format?.includes("int"),c=n?"int":"number",[u,p]=lo[o.format];t._zod.onattach.push((f)=>{let h=f._zod.bag;if(h.format=o.format,h.minimum=u,h.maximum=p,n)h.pattern=Ge}),t._zod.check=(f)=>{let h=f.value;if(n){if(!Number.isInteger(h)){f.issues.push({expected:c,format:o.format,code:"invalid_type",continue:!1,input:h,inst:t});return}if(!Number.isSafeInteger(h)){if(h>0)f.issues.push({input:h,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:c,inclusive:!0,continue:!o.abort});else f.issues.push({input:h,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:c,inclusive:!0,continue:!o.abort});return}}if(h<u)f.issues.push({origin:"number",input:h,code:"too_small",minimum:u,inclusive:!0,inst:t,continue:!o.abort});if(h>p)f.issues.push({origin:"number",input:h,code:"too_big",maximum:p,inclusive:!0,inst:t,continue:!o.abort})}});var un=v("$ZodCheckMaxLength",(t,o)=>{var n;M.init(t,o),(n=t._zod.def).when??(n.when=It),t._zod.onattach.push((c)=>{let u=c._zod.bag.maximum??Number.POSITIVE_INFINITY;if(o.maximum<u)c._zod.bag.maximum=o.maximum}),t._zod.check=(c)=>{let u=c.value,p=u.length;if((typeof u==="string"&&p>o.maximum?Je(u):p)<=o.maximum)return;let h=Be(u);c.issues.push({origin:h,code:"too_big",maximum:o.maximum,inclusive:!0,input:u,inst:t,continue:!o.abort})}}),an=v("$ZodCheckMinLength",(t,o)=>{var n;M.init(t,o),(n=t._zod.def).when??(n.when=It),t._zod.onattach.push((c)=>{let u=c._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(o.minimum>u)c._zod.bag.minimum=o.minimum}),t._zod.check=(c)=>{let u=c.value,p=u.length;if((typeof u==="string"&&p>=o.minimum&&p<o.minimum*2?Je(u):p)>=o.minimum)return;let h=Be(u);c.issues.push({origin:h,code:"too_small",minimum:o.minimum,inclusive:!0,input:u,inst:t,continue:!o.abort})}}),ln=v("$ZodCheckLengthEquals",(t,o)=>{var n;M.init(t,o),(n=t._zod.def).when??(n.when=It),t._zod.onattach.push((c)=>{let u=c._zod.bag;u.minimum=o.length,u.maximum=o.length,u.length=o.length}),t._zod.check=(c)=>{let u=c.value,p=u.length,f=typeof u==="string"&&p>=o.length&&p<=o.length*2?Je(u):p;if(f===o.length)return;let h=Be(u),_=f>o.length;c.issues.push({origin:h,..._?{code:"too_big",maximum:o.length}:{code:"too_small",minimum:o.length},inclusive:!0,exact:!0,input:c.value,inst:t,continue:!o.abort})}}),Te=v("$ZodCheckStringFormat",(t,o)=>{var n,c;if(M.init(t,o),t._zod.onattach.push((u)=>{let p=u._zod.bag;if(p.format=o.format,o.pattern)p.patterns??(p.patterns=new Set),p.patterns.add(o.pattern)}),o.pattern)(n=t._zod).check??(n.check=(u)=>{if(o.pattern.lastIndex=0,o.pattern.test(u.value))return;u.issues.push({origin:"string",code:"invalid_format",format:o.format,input:u.value,...o.pattern?{pattern:o.pattern.toString()}:{},inst:t,continue:!o.abort})});else(c=t._zod).check??(c.check=()=>{})}),pn=v("$ZodCheckRegex",(t,o)=>{Te.init(t,o),t._zod.check=(n)=>{if(o.pattern.lastIndex=0,o.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:o.pattern.toString(),inst:t,continue:!o.abort})}}),fn=v("$ZodCheckLowerCase",(t,o)=>{o.pattern??(o.pattern=on),Te.init(t,o)}),dn=v("$ZodCheckUpperCase",(t,o)=>{o.pattern??(o.pattern=nn),Te.init(t,o)}),mn=v("$ZodCheckIncludes",(t,o)=>{M.init(t,o);let n=le(o.includes),c=new RegExp(typeof o.position==="number"?`^.{${o.position},}${n}`:n);o.pattern=c,t._zod.onattach.push((u)=>{let p=u._zod.bag;p.patterns??(p.patterns=new Set),p.patterns.add(c)}),t._zod.check=(u)=>{if(u.value.includes(o.includes,o.position))return;u.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:o.includes,input:u.value,inst:t,continue:!o.abort})}}),hn=v("$ZodCheckStartsWith",(t,o)=>{M.init(t,o);let n=new RegExp(`^${le(o.prefix)}.*`);o.pattern??(o.pattern=n),t._zod.onattach.push((c)=>{let u=c._zod.bag;u.patterns??(u.patterns=new Set),u.patterns.add(n)}),t._zod.check=(c)=>{if(c.value.startsWith(o.prefix))return;c.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:o.prefix,input:c.value,inst:t,continue:!o.abort})}}),_n=v("$ZodCheckEndsWith",(t,o)=>{M.init(t,o);let n=new RegExp(`.*${le(o.suffix)}$`);o.pattern??(o.pattern=n),t._zod.onattach.push((c)=>{let u=c._zod.bag;u.patterns??(u.patterns=new Set),u.patterns.add(n)}),t._zod.check=(c)=>{if(c.value.endsWith(o.suffix))return;c.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:o.suffix,input:c.value,inst:t,continue:!o.abort})}});var gn=v("$ZodCheckOverwrite",(t,o)=>{M.init(t,o),t._zod.check=(n)=>{n.value=o.tx(n.value)}});class Nt{constructor(t=[],o={}){this.content=[],this.indent=0,this.args=t,this.closed=o}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t==="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
4
+ `).filter((p)=>p),c=Math.min(...n.map((p)=>p.length-p.trimStart().length)),u=n.map((p)=>p.slice(c)).map((p)=>" ".repeat(this.indent*2)+p);for(let p of u)this.content.push(p)}compile(){let t=Function,o=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
5
+ ${o.join(`
6
+ `)}
7
+ };`)(...Object.values(this.closed))}}var yn={major:4,minor:5,patch:4};var A=v("$ZodType",(t,o)=>{var n;t??(t={}),t._zod.def=o,t._zod.bag=t._zod.bag||{},t._zod.version=yn;let c=t._zod.def.checks,u=t._zod.traits.has("$ZodCheck")?[t,...c??[]]:c?.length?[...c]:[];for(let p of u)for(let f of p._zod.onattach)f(t);if(u.length===0)(n=t._zod).deferred??(n.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let p=(h,_,b)=>{if(h.memo)return h;let z=he(h),w;for(let k of _){if(k._zod.def.when){if(fo(h))continue;if(!k._zod.def.when(h))continue}else if(z)continue;let Z=h.issues.length,P=k._zod.check(h);if(P instanceof Promise&&b?.async===!1)throw new ie;if(w||P instanceof Promise)w=(w??Promise.resolve()).then(async()=>{if(await P,h.issues.length===Z)return;if(xt(h.issues,Z,t),!z)z=he(h,Z)});else{if(h.issues.length===Z)continue;if(xt(h.issues,Z,t),!z)z=he(h,Z)}}if(w)return w.then(()=>h);return h},f=(h,_,b)=>{if(he(h))return h.aborted=!0,h;let z=p(_,u,b);if(z instanceof Promise){if(b.async===!1)throw new ie;return z.then((w)=>t._zod.parse(w,b))}return t._zod.parse(z,b)};t._zod.run=(h,_)=>{if(_.skipChecks)return t._zod.parse(h,_);if(_.direction==="backward"){let z=t._zod.parse({value:h.value,issues:[]},{..._,skipChecks:!0});if(z instanceof Promise)return z.then((w)=>f(w,h,_));return f(z,h,_)}let b=t._zod.parse(h,_);if(b instanceof Promise){if(_.async===!1)throw new ie;return b.then((z)=>p(z,u,_))}return p(b,u,_)}}},{get "~standard"(){return yt(this,"~standard",Rt(this))},set "~standard"(t){de(this,"~standard",t)}}),bn=(t)=>t.success?{value:t.data}:{issues:t.error?.issues};function Rt(t){return{validate:(o)=>{try{return bn(zo(t,o))}catch(n){return vo(t,o).then(bn)}},vendor:"zod",version:1}}var He=v("$ZodString",(t,o)=>{A.init(t,o),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Qo(t._zod.bag),t._zod.parse=(n,c)=>{if(o.coerce)try{n.value=String(n.value)}catch(u){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:t}),n}}),j=v("$ZodStringFormat",(t,o)=>{Te.init(t,o),He.init(t,o)}),An=v("$ZodGUID",(t,o)=>{o.pattern??(o.pattern=Lo),j.init(t,o)}),Nn=v("$ZodUUID",(t,o)=>{if(o.version){let c={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[o.version];if(c===void 0)throw Error(`Invalid UUID version: "${o.version}"`);o.pattern??(o.pattern=St(c))}else o.pattern??(o.pattern=St());j.init(t,o)}),Cn=v("$ZodEmail",(t,o)=>{o.pattern??(o.pattern=Fo),j.init(t,o)}),jn=1,Rn=2;function Xc(t,o){if(!o.normalize&&o.protocol?.source===Wo.source&&!/^https?:\/\//i.test(t))return jn;try{return new URL(t)}catch{return Rn}}var Hc=/[\t\n\r]/g;function Qc(t){return t.replace(Hc,"")}function eu(t,o){return o.lastIndex=0,o.test(t.hostname)}function tu(t,o){return o.lastIndex=0,o.test(t.protocol.endsWith(":")?t.protocol.slice(0,-1):t.protocol)}var Dn=v("$ZodURL",(t,o)=>{j.init(t,o),t._zod.check=(n)=>{try{let c=n.value.trim(),u=Xc(c,o);if(u===jn){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:t,continue:!o.abort});return}if(u===Rn){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!o.abort});return}if(o.hostname&&!eu(u,o.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:o.hostname.source,input:n.value,inst:t,continue:!o.abort});if(o.protocol&&!tu(u,o.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:o.protocol.source,input:n.value,inst:t,continue:!o.abort});n.value=o.normalize?u.href:Qc(c);return}catch(c){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!o.abort})}}}),Ln=v("$ZodEmoji",(t,o)=>{o.pattern??(o.pattern=Uo()),j.init(t,o)}),Fn=v("$ZodNanoID",(t,o)=>{if(o.length!==void 0&&(!Number.isInteger(o.length)||o.length<1))throw Error(`Invalid nanoid length: ${o.length}`);o.pattern??(o.pattern=o.length===void 0?jo:Ro(o.length)),j.init(t,o)}),Un=v("$ZodCUID",(t,o)=>{o.pattern??(o.pattern=Eo),j.init(t,o)}),Mn=v("$ZodCUID2",(t,o)=>{o.pattern??(o.pattern=To),j.init(t,o)}),Jn=v("$ZodULID",(t,o)=>{o.pattern??(o.pattern=Ao),j.init(t,o)}),Bn=v("$ZodXID",(t,o)=>{o.pattern??(o.pattern=No),j.init(t,o)}),Vn=v("$ZodKSUID",(t,o)=>{o.pattern??(o.pattern=Co),j.init(t,o)}),Kn=v("$ZodISODateTime",(t,o)=>{if(o.pattern??(o.pattern=Ho(o)),j.init(t,o),o.local||o.precision===-1)t._zod.bag.laxFormat=!0,t._zod.onattach.push((n)=>{n._zod.bag.laxFormat=!0})}),Wn=v("$ZodISODate",(t,o)=>{o.pattern??(o.pattern=Yo),j.init(t,o)}),Gn=v("$ZodISOTime",(t,o)=>{o.pattern??(o.pattern=Xo(o)),j.init(t,o)}),qn=v("$ZodISODuration",(t,o)=>{o.pattern??(o.pattern=Do),j.init(t,o)}),Yn=v("$ZodIPv4",(t,o)=>{o.pattern??(o.pattern=Mo),j.init(t,o),t._zod.bag.format="ipv4"}),ru=/^[0-9a-fA-F:.]+$/;function Xn(t){if(!ru.test(t))return!1;try{return new URL(`http://[${t}]`),!0}catch{return!1}}var Hn=v("$ZodIPv6",(t,o)=>{o.pattern??(o.pattern=Jo),j.init(t,o),t._zod.bag.format="ipv6",t._zod.check=(n)=>{if(!Xn(n.value))n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!o.abort})}});var Qn=v("$ZodCIDRv4",(t,o)=>{o.pattern??(o.pattern=Bo),j.init(t,o)});function ou(t){let o=t.split("/");if(o.length!==2)return!1;let[n,c]=o;if(!c)return!1;let u=Number(c);if(`${u}`!==c)return!1;if(u<0||u>128)return!1;return Xn(n)}var ei=v("$ZodCIDRv6",(t,o)=>{o.pattern??(o.pattern=Vo),j.init(t,o),t._zod.check=(n)=>{if(!ou(n.value))n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!o.abort})}});function ti(t){if(t==="")return!0;if(/\s/.test(t))return!1;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var ri=v("$ZodBase64",(t,o)=>{o.pattern??(o.pattern=Ko),j.init(t,o),t._zod.bag.contentEncoding="base64",t._zod.check=(n)=>{if(ti(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!o.abort})}});function nu(t){if(!Ot.test(t))return!1;let o=t.replace(/[-_]/g,(c)=>c==="-"?"+":"/"),n=o.padEnd(Math.ceil(o.length/4)*4,"=");return ti(n)}var oi=v("$ZodBase64URL",(t,o)=>{o.pattern??(o.pattern=Ot),j.init(t,o),t._zod.bag.contentEncoding="base64url",t._zod.check=(n)=>{if(nu(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!o.abort})}}),ni=v("$ZodE164",(t,o)=>{o.pattern??(o.pattern=Go),j.init(t,o)});function iu(t,o=null){try{let n=t.split(".");if(n.length!==3)return!1;let[c]=n;if(!c)return!1;let u=JSON.parse(atob(c));if("typ"in u&&u?.typ!=="JWT")return!1;if(!u.alg)return!1;if(o&&(!("alg"in u)||u.alg!==o))return!1;return!0}catch{return!1}}var ii=v("$ZodJWT",(t,o)=>{j.init(t,o),t._zod.check=(n)=>{if(iu(n.value,o.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!o.abort})}});var Dt=v("$ZodNumber",(t,o)=>{A.init(t,o),t._zod.pattern=t._zod.bag.pattern??Ee,t._zod.parse=(n,c)=>{if(o.coerce)try{n.value=Number(n.value)}catch(f){}let u=n.value;if(typeof u==="number"&&!Number.isNaN(u)&&Number.isFinite(u))return n;let p=typeof u==="number"?Number.isNaN(u)?"NaN":!Number.isFinite(u)?String(u):void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:u,inst:t,...p?{received:p}:{}}),n}}),si=v("$ZodNumberFormat",(t,o)=>{cn.init(t,o),Dt.init(t,o)}),ci=v("$ZodBoolean",(t,o)=>{A.init(t,o),t._zod.pattern=tn,t._zod.parse=(n,c)=>{if(o.coerce)try{n.value=Boolean(n.value)}catch(p){}let u=n.value;if(typeof u==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:u,inst:t}),n}}),ui=v("$ZodBigInt",(t,o)=>{A.init(t,o),t._zod.pattern=en,t._zod.parse=(n,c)=>{if(o.coerce)try{n.value=BigInt(n.value)}catch(u){}if(typeof n.value==="bigint")return n;return n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:t}),n}});var ai=v("$ZodNull",(t,o)=>{A.init(t,o),t._zod.pattern=rn,t._zod.values=new Set([null]),t._zod.parse=(n,c)=>{let u=n.value;if(u===null)return n;return n.issues.push({expected:"null",code:"invalid_type",input:u,inst:t}),n}}),li=v("$ZodAny",(t,o)=>{A.init(t,o),t._zod.parse=(n)=>n}),pi=v("$ZodUnknown",(t,o)=>{A.init(t,o),t._zod.parse=(n)=>n}),fi=v("$ZodNever",(t,o)=>{A.init(t,o),t._zod.parse=(n,c)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)}),di=v("$ZodVoid",(t,o)=>{A.init(t,o),t._zod.parse=(n,c)=>{let u=n.value;if(typeof u>"u")return n;return n.issues.push({expected:"void",code:"invalid_type",input:u,inst:t}),n}}),mi=v("$ZodDate",(t,o)=>{A.init(t,o),t._zod.parse=(n,c)=>{if(o.coerce)try{n.value=new Date(n.value)}catch(h){}let u=n.value,p=u instanceof Date;if(p&&!Number.isNaN(u.getTime()))return n;return n.issues.push({expected:"date",code:"invalid_type",input:u,...p?{received:"Invalid Date"}:{},inst:t}),n}});function zn(t,o,n){if(t.issues.length)o.issues.push(...re(n,t.issues));o.value[n]=t.value}var _i=v("$ZodArray",(t,o)=>{A.init(t,o);let n=B.memoizer;n?.attach(t),t._zod.parse=(c,u)=>{let p=c.value;if(!Array.isArray(p))return c.issues.push({expected:"array",code:"invalid_type",input:p,inst:t}),c;c.value=n?n.alloc(t,c,Array(p.length),u):Array(p.length);let f=[];for(let h=0;h<p.length;h++){let _=p[h],b=o.element._zod.run({value:_,issues:[]},u);if(b instanceof Promise)f.push(b.then((z)=>zn(z,c,h)));else zn(b,c,h)}if(f.length)return Promise.all(f).then(()=>c);return c}});function Xe(t,o,n,c,u,p){let f=n in c,h=p==="optional";if(!f&&h&&u==="optional")return;if(t.issues.length){if(u!==void 0&&h&&!f)return;o.issues.push(...re(n,t.issues))}if(!f&&u===void 0){if(!t.issues.length)o.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(t.value===void 0){if(f)o.value[n]=void 0}else o.value[n]=t.value}var su=[];function xi(t){let o=Object.keys(t.shape),n=Object.getOwnPropertySymbols(t.shape),c=n.length?n:su,u=c.length?[...o,...c]:o;for(let f of u)if(!t.shape?.[f]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(f)}": expected a Zod schema`);let p=ao(t.shape);return{...t,allKeys:u,symbolKeys:c,keySet:new Set(o),numKeys:o.length,optionalKeys:new Set(p)}}function yi(t,o,n,c,u,p){let f=[],h=u.keySet,_=u.catchall._zod,b=_.def.type,{optin:z,optout:w}=_;for(let k in o){if(h.has(k))continue;if(k==="__proto__"){if(b==="never")f.push(k);continue}if(b==="never"){f.push(k);continue}let Z=_.run({value:o[k],issues:[]},c);if(Z instanceof Promise)t.push(Z.then((P)=>Xe(P,n,k,o,z,w)));else Xe(Z,n,k,o,z,w)}if(f.length)n.issues.push({code:"unrecognized_keys",keys:f,input:o,inst:p,continue:!0});if(!t.length)return n;return Promise.all(t).then(()=>n)}var Ct=new WeakMap,cu=v("$ZodObject",(t,o)=>{if(A.init(t,o),!Object.getOwnPropertyDescriptor(o,"shape")?.get){let _=o.shape;Ct.set(o,_),Object.defineProperty(o,"shape",{get:()=>{let b={..._};return Object.defineProperty(o,"shape",{value:b}),Ct.set(o,b),b}})}let c=ke(()=>xi(o));T(t,"propValues",(_)=>{let b=_.def.shape,z={};for(let w in b){let k=b[w]._zod;if(k.values){if(!Object.prototype.hasOwnProperty.call(z,w))L(z,w,new Set);for(let Z of k.values)z[w].add(Z);if(k.optin!==void 0)z[w].add(void 0)}}return z});let u=ge,p=o.catchall,f,h=B.memoizer;h?.attach(t),t._zod.parse=(_,b)=>{f??(f=c.value);let z=_.value;if(!u(z))return _.issues.push({expected:"object",code:"invalid_type",input:z,inst:t}),_;_.value=h?h.alloc(t,_,{},b):{};let w=[],k=f.shape;for(let Z of f.allKeys){if(Z==="__proto__")continue;let P=k[Z],O=P._zod.optin,E=P._zod.optout,J=P._zod.run({value:z[Z],issues:[]},b);if(J instanceof Promise)w.push(J.then((q)=>Xe(q,_,Z,z,O,E)));else Xe(J,_,Z,z,O,E)}if(!p)return w.length?Promise.all(w).then(()=>_):_;return yi(w,z,_,b,c.value,t)}}),bi=v("$ZodObjectJIT",(t,o)=>{cu.init(t,o);let n=t._zod.parse,c=ke(()=>xi(o)),u=B.memoizer,p=(Z)=>{let P=c.value,O=P.symbolKeys,E=new Nt(["payload","ctx"],{shape:Z,inst:t,memo:u,syms:O}),J=(K)=>`shape[${K}]._zod.run({ value: input[${K}], issues: [] }, ctx)`,q=(K,R)=>`
8
+ for (let i = 0; i < ${K}.issues.length; i++) {
9
+ const iss = ${K}.issues[i];
10
+ iss.path = iss.path ? [${R}, ...iss.path] : [${R}];
11
+ payload.issues.push(iss);
12
+ }`;E.write("const input = payload.value;");let qr=Object.create(null),Pc=0;for(let K of P.allKeys)qr[K]=`key_${Pc++}`;E.write(u?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let K of P.allKeys){if(K==="__proto__")continue;let R=qr[K],Q=typeof K==="symbol"?`syms[${O.indexOf(K)}]`:oo(K),lt=`${Q} in input`,Yr=Z[K],Xr=Yr?._zod?.optin,Hr=Xr!==void 0,Sc=Yr?._zod?.optout==="optional";if(E.write(`const ${R} = ${J(Q)};`),Hr&&Sc){let Oc=Xr==="optional"?`${R}_present`:`${R}.value !== undefined || ${R}_present`;E.write(`
13
+ const ${R}_present = ${lt};
14
+ if (!${R}.issues.length || ${R}_present) {
15
+ if (${R}.issues.length) {${q(R,Q)}
16
+ }
17
+
18
+ if (${Oc}) {
19
+ newResult[${Q}] = ${R}.value;
20
+ }
21
+ }
22
+
23
+ `)}else if(!Hr)E.write(`
24
+ const ${R}_present = ${lt};
25
+ if (${R}.issues.length) {${q(R,Q)}
26
+ }
27
+ if (!${R}_present && !${R}.issues.length) {
28
+ payload.issues.push({
29
+ code: "invalid_type",
30
+ expected: "nonoptional",
31
+ input: undefined,
32
+ path: [${Q}]
33
+ });
34
+ }
35
+
36
+ if (${R}_present) {
37
+ newResult[${Q}] = ${R}.value;
38
+ }
39
+
40
+ `);else E.write(`
41
+ if (${R}.issues.length) {${q(R,Q)}
42
+ }
43
+
44
+ if (${R}.value === undefined) {
45
+ if (${lt}) {
46
+ newResult[${Q}] = undefined;
47
+ }
48
+ } else {
49
+ newResult[${Q}] = ${R}.value;
50
+ }
51
+
52
+ `)}return E.write("payload.value = newResult;"),E.write("return payload;"),E.compile()},f,h=ge,_=!B.jitless,z=_&&io.value,w=o.catchall,k;t._zod.parse=(Z,P)=>{k??(k=c.value);let O=Z.value;if(!h(O))return Z.issues.push({expected:"object",code:"invalid_type",input:O,inst:t}),Z;if(_&&z&&P?.async===!1&&P.jitless!==!0){if(!f)f=p(o.shape);if(Z=f(Z,P),!w)return Z;return yi([],O,Z,P,k,t)}return n(Z,P)}});function vn(t,o,n,c){for(let p of t)if(p.issues.length===0)return o.value=p.value,o;let u=t.filter((p)=>!he(p));if(u.length===1)return o.value=u[0].value,u[0];return o.issues.push({code:"invalid_union",input:o.value,inst:n,errors:t.map((p)=>p.issues.map((f)=>ne(f,c,W())))}),o}var Lt=v("$ZodUnion",(t,o)=>{A.init(t,o),T(t,"optin",(c)=>c.def.options.some((u)=>u._zod.optin==="defaulted")?"defaulted":c.def.options.some((u)=>u._zod.optin!==void 0)?"optional":void 0),T(t,"optout",(c)=>c.def.options.some((u)=>u._zod.optout==="optional")?"optional":void 0),T(t,"values",(c)=>{if(c.def.options.every((u)=>u._zod.values))return new Set(c.def.options.flatMap((u)=>Array.from(u._zod.values)));return}),T(t,"pattern",(c)=>{if(c.def.options.every((u)=>u._zod.pattern)){let u=c.def.options.map((p)=>p._zod.pattern);return new RegExp(`^(${u.map((p)=>Me(p.source)).join("|")})$`)}return});let n=o.options.length===1?o.options[0]._zod.run:null;t._zod.parse=(c,u)=>{if(n)return n(c,u);let p=!1,f=[];for(let h of o.options){let _=h._zod.run({value:c.value,issues:[]},u);if(_ instanceof Promise)f.push(_),p=!0;else{if(_.issues.length===0)return _;f.push(_)}}if(!p)return vn(f,c,t,u);return Promise.all(f).then((h)=>vn(h,c,t,u))}});var zi=v("$ZodDiscriminatedUnion",(t,o)=>{o.inclusive=!1,Lt.init(t,o);let n=t._zod.parse;T(t,"propValues",(u)=>{let p={};for(let f of u.def.options){let h=f._zod.propValues;if(!h||Object.keys(h).length===0)throw Error(`Invalid discriminated union option at index "${u.def.options.indexOf(f)}"`);for(let[_,b]of Object.entries(h)){if(!Object.prototype.hasOwnProperty.call(p,_))L(p,_,new Set);for(let z of b)p[_].add(z)}}return p}),o.options.forEach((u,p)=>{let f=Ct.get(u._zod.def);if(f&&!Object.prototype.hasOwnProperty.call(f,o.discriminator))throw Error(`Invalid discriminated union option at index "${p}"`)});let c=ke(()=>{let u=o.options,p=new Map;for(let f of u){let h=f._zod.propValues?.[o.discriminator];if(!h||h.size===0)throw Error(`Invalid discriminated union option at index "${o.options.indexOf(f)}"`);for(let _ of h){if(p.has(_))throw Error(`Duplicate discriminator value "${String(_)}"`);p.set(_,f)}}return p});t._zod.parse=(u,p)=>{let f=u.value;if(!ge(f))return u.issues.push({code:"invalid_type",expected:"object",input:f,inst:t}),u;let h=c.value.get(f?.[o.discriminator]);if(h)return h._zod.run(u,p);if(o.unionFallback||p.direction==="backward")return n(u,p);return u.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:o.discriminator,options:Array.from(c.value.keys()),input:f,path:[o.discriminator],inst:t}),u}}),vi=v("$ZodIntersection",(t,o)=>{A.init(t,o),t._zod.parse=(n,c)=>{let u=n.value,p=o.left._zod.run({value:u,issues:[]},c),f=o.right._zod.run({value:u,issues:[]},c);if(p instanceof Promise||f instanceof Promise)return Promise.all([p,f]).then(([_,b])=>$n(n,_,b));return $n(n,p,f)}});function jt(t,o){if(t===o)return{valid:!0,data:t};if(t instanceof Date&&o instanceof Date&&+t===+o)return{valid:!0,data:t};if(me(t)&&me(o)){let n=Object.keys(o),c=Object.keys(t).filter((p)=>n.indexOf(p)!==-1),u={...t,...o};if(Object.prototype.hasOwnProperty.call(u,"__proto__"))delete u.__proto__;for(let p of c){if(p==="__proto__")continue;let f=jt(t[p],o[p]);if(!f.valid)return{valid:!1,mergeErrorPath:[p,...f.mergeErrorPath]};u[p]=f.data}return{valid:!0,data:u}}if(Array.isArray(t)&&Array.isArray(o)){if(t.length!==o.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let c=0;c<t.length;c++){let u=t[c],p=o[c],f=jt(u,p);if(!f.valid)return{valid:!1,mergeErrorPath:[c,...f.mergeErrorPath]};n.push(f.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function $n(t,o,n){let c=new Map,u,p=new Map,f=(b,z)=>{let w;if(b.code==="unrecognized_keys"&&!b.path?.length)u??(u=b),w=b.keys;else if(b.code==="invalid_key"&&b.origin==="record"&&b.path?.length===1){let k=String(b.path[0]);if(!p.has(k))p.set(k,b);w=[k]}else return!1;for(let k of w){if(!c.has(k))c.set(k,{});c.get(k)[z]=!0}return!0};for(let b of o.issues)if(!f(b,"l"))t.issues.push(b);for(let b of n.issues)if(!f(b,"r"))t.issues.push(b);let h=[...c].filter(([,b])=>b.l&&b.r).map(([b])=>b);if(h.length){let b=u?h.filter((z)=>u.keys.includes(z)):[];if(b.length)t.issues.push({...u,keys:b});for(let z of h)if(!b.includes(z)&&p.has(z))t.issues.push(p.get(z))}let _=jt(o.value,n.value);if(!_.valid){if(he(t))return t;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(_.mergeErrorPath)}`)}return t.value=_.data,t}var $i=v("$ZodTuple",(t,o)=>{A.init(t,o);let n=o.items,c=B.memoizer;c?.attach(t),t._zod.parse=(u,p)=>{let f=u.value;if(!Array.isArray(f))return u.issues.push({input:f,inst:t,expected:"tuple",code:"invalid_type"}),u;u.value=c?c.alloc(t,u,[],p):[];let h=[],_=wn(n,"optin"),b=wn(n,"optout");if(!o.rest){if(f.length<_)return u.issues.push({code:"too_small",minimum:_,inclusive:!0,input:f,inst:t,origin:"array"}),u;if(f.length>n.length)u.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:f,inst:t,origin:"array"})}let z=Array(n.length);for(let w=0;w<n.length;w++){let k=n[w]._zod.run({value:f[w],issues:[]},p);if(k instanceof Promise)h.push(k.then((Z)=>{z[w]=Z}));else z[w]=k}if(o.rest){let w=n.length-1,k=f.slice(n.length);for(let Z of k){w++;let P=o.rest._zod.run({value:Z,issues:[]},p);if(P instanceof Promise)h.push(P.then((O)=>kn(O,u,w)));else kn(P,u,w)}}if(h.length)return Promise.all(h).then(()=>Zn(z,u,n,f,b));return Zn(z,u,n,f,b)}});function wn(t,o){for(let n=t.length-1;n>=0;n--)if(!(o==="optin"?t[n]._zod.optin!==void 0:t[n]._zod.optout==="optional"))return n+1;return 0}function kn(t,o,n){if(t.issues.length)o.issues.push(...re(n,t.issues));o.value[n]=t.value}function Zn(t,o,n,c,u){for(let p=0;p<n.length;p++){let f=t[p],h=p<c.length;if(!h&&p>=u&&n[p]._zod.optin==="optional"){o.value.length=p;break}if(f.issues.length){if(!h&&p>=u){o.value.length=p;break}o.issues.push(...re(p,f.issues))}o.value[p]=f.value}for(let p=o.value.length-1;p>=c.length;p--)if(n[p]._zod.optout==="optional"&&o.value[p]===void 0)o.value.length=p;else break;return o}var wi=v("$ZodRecord",(t,o)=>{A.init(t,o);let n=B.memoizer;n?.attach(t),t._zod.parse=(c,u)=>{let p=c.value;if(!me(p))return c.issues.push({expected:"record",code:"invalid_type",input:p,inst:t}),c;let f=[],h=o.keyType._zod.values;if(h&&!o.partial){c.value=n?n.alloc(t,c,{},u):{};let _=new Set;for(let z of h)if(typeof z==="string"||typeof z==="number"||typeof z==="symbol"){if(_.add(typeof z==="number"?z.toString():z),z==="__proto__")continue;let w=o.keyType._zod.run({value:z,issues:[]},u);if(w instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(w.issues.length){c.issues.push({code:"invalid_key",origin:"record",issues:w.issues.map((P)=>ne(P,u,W())),input:z,path:[z],inst:t});continue}let k=w.value;if(k==="__proto__")continue;let Z=o.valueType._zod.run({value:p[z],issues:[]},u);if(Z instanceof Promise)f.push(Z.then((P)=>{if(P.issues.length)c.issues.push(...re(z,P.issues));c.value[k]=P.value}));else{if(Z.issues.length)c.issues.push(...re(z,Z.issues));c.value[k]=Z.value}}let b;for(let z in p)if(!_.has(z))if(o.mode==="loose"){if(z==="__proto__")continue;c.value[z]=p[z]}else b=b??[],b.push(z);if(b&&b.length>0)c.issues.push({code:"unrecognized_keys",input:p,inst:t,keys:b,continue:!0})}else{c.value=n?n.alloc(t,c,{},u):{};let _;for(let b of Reflect.ownKeys(p)){if(b==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(p,b))continue;let z=o.keyType._zod.run({value:b,issues:[]},u);if(z instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof b==="string"&&Ee.test(b)&&z.issues.length){let P=o.keyType._zod.run({value:Number(b),issues:[]},u);if(P instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(P.issues.length===0)z=P}if(z.issues.length){if(o.mode==="loose")c.value[b]=p[b];else if(h)_=_??[],_.push(b);else c.issues.push({code:"invalid_key",origin:"record",issues:z.issues.map((P)=>ne(P,u,W())),input:b,path:[b],inst:t});continue}let k=z.value;if(k==="__proto__")continue;let Z=o.valueType._zod.run({value:p[b],issues:[]},u);if(Z instanceof Promise)f.push(Z.then((P)=>{if(P.issues.length)c.issues.push(...re(b,P.issues));c.value[k]=P.value}));else{if(Z.issues.length)c.issues.push(...re(b,Z.issues));c.value[k]=Z.value}}if(_&&_.length>0)c.issues.push({code:"unrecognized_keys",input:p,inst:t,keys:_,continue:!0})}if(f.length)return Promise.all(f).then(()=>c);return c}});var ki=v("$ZodEnum",(t,o)=>{A.init(t,o);let n=Ue(o.entries),c=new Set(n);t._zod.values=c;let u=n.filter((p)=>so.has(typeof p));t._zod.pattern=new RegExp(u.length?`^(${u.map((p)=>le(p.toString())).join("|")})$`:"^[^\\s\\S]$"),t._zod.parse=(p,f)=>{let h=p.value;if(c.has(h))return p;return p.issues.push({code:"invalid_value",values:n,input:h,inst:t}),p}}),Zi=v("$ZodLiteral",(t,o)=>{A.init(t,o);let n=new Set(o.values);t._zod.values=n,t._zod.pattern=new RegExp(o.values.length?`^(${o.values.map((c)=>typeof c==="string"?le(c):c?le(c.toString()):String(c)).join("|")})$`:"^[^\\s\\S]$"),t._zod.parse=(c,u)=>{let p=c.value;if(n.has(p))return c;return c.issues.push({code:"invalid_value",values:o.values,input:p,inst:t}),c}});var Pi=v("$ZodTransform",(t,o)=>{A.init(t,o),t._zod.optin="optional",B.memoizer?.guard(t),t._zod.parse=(n,c)=>{if(c.direction==="backward")throw new Ze(t.constructor.name);let u=o.transform(n.value,n);if(c.async)return(u instanceof Promise?u:Promise.resolve(u)).then((f)=>(n.value=f,n));if(u instanceof Promise)throw new ie;return n.value=u,n}});function Pn(t,o){return t.value=o.issues.length?void 0:o.value,t}var Ft=v("$ZodOptional",(t,o)=>{A.init(t,o),T(t,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),t._zod.optout="optional",T(t,"values",(n)=>{let c=n.def.innerType._zod.values;return c?new Set([...c,void 0]):void 0}),T(t,"pattern",(n)=>{let c=n.def.innerType._zod.pattern;return c?new RegExp(`^(${Me(c.source)})?$`):void 0}),t._zod.parse=(n,c)=>{if(n.value===void 0){if(o.innerType._zod.optin!=="defaulted")return n;let u=o.innerType._zod.run({value:n.value,issues:[]},c);if(u instanceof Promise)return u.then((p)=>Pn(n,p));return Pn(n,u)}return o.innerType._zod.run(n,c)}}),Si=v("$ZodExactOptional",(t,o)=>{Ft.init(t,o),T(t,"values",(n)=>n.def.innerType._zod.values),T(t,"pattern",(n)=>n.def.innerType._zod.pattern),t._zod.parse=(n,c)=>o.innerType._zod.run(n,c)}),Oi=v("$ZodNullable",(t,o)=>{A.init(t,o),T(t,"optin",(n)=>n.def.innerType._zod.optin),T(t,"optout",(n)=>n.def.innerType._zod.optout),T(t,"pattern",(n)=>{let c=n.def.innerType._zod.pattern;return c?new RegExp(`^(${Me(c.source)}|null)$`):void 0}),T(t,"values",(n)=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),t._zod.parse=(n,c)=>{if(n.value===null)return n;return o.innerType._zod.run(n,c)}}),Ii=v("$ZodDefault",(t,o)=>{A.init(t,o),t._zod.optin="defaulted",T(t,"values",(n)=>n.def.innerType._zod.values),t._zod.parse=(n,c)=>{if(c.direction==="backward")return o.innerType._zod.run(n,c);if(n.value===void 0)return n.value=o.defaultValue,n;let u=o.innerType._zod.run(n,c);if(u instanceof Promise)return u.then((p)=>Sn(p,o));return Sn(u,o)}});function Sn(t,o){if(t.value===void 0)t.value=o.defaultValue;return t}var Ei=v("$ZodPrefault",(t,o)=>{A.init(t,o),t._zod.optin="defaulted",T(t,"values",(n)=>n.def.innerType._zod.values),t._zod.parse=(n,c)=>{if(c.direction==="backward")return o.innerType._zod.run(n,c);if(n.value===void 0)n.value=o.defaultValue;return o.innerType._zod.run(n,c)}}),Ti=v("$ZodNonOptional",(t,o)=>{A.init(t,o),T(t,"values",(n)=>{let c=n.def.innerType._zod.values;return c?new Set([...c].filter((u)=>u!==void 0)):void 0}),t._zod.parse=(n,c)=>{let u=o.innerType._zod.run(n,c);if(u instanceof Promise)return u.then((p)=>On(p,t));return On(u,t)}});function On(t,o){if(!t.issues.length&&t.value===void 0)t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:o});return t}function In(t,o,n,c){if(!o.issues.length){if(t.value=o.value,o.memo)t.memo=!0;return t}return t.value=n.catchValue({...o,value:t.value,error:{issues:o.issues.map((u)=>ne(u,c,W()))},input:t.value}),t}var Ni=v("$ZodCatch",(t,o)=>{A.init(t,o),T(t,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),T(t,"optout",(n)=>n.def.innerType._zod.optout),T(t,"values",(n)=>n.def.innerType._zod.values),t._zod.parse=(n,c)=>{if(c.direction==="backward")return o.innerType._zod.run(n,c);let u=o.innerType._zod.run({value:n.value,issues:[]},c);if(u instanceof Promise)return u.then((p)=>In(n,p,o,c));return In(n,u,o,c)}});var Ut=v("$ZodPipe",(t,o)=>{A.init(t,o),T(t,"values",(n)=>n.def.in._zod.values),T(t,"optin",(n)=>n.def.in._zod.optin),T(t,"optout",(n)=>n.def.out._zod.optout),T(t,"propValues",(n)=>n.def.in._zod.propValues),t._zod.parse=(n,c)=>{if(c.direction==="backward"){let p=o.out._zod.run(n,c);if(p instanceof Promise)return p.then((f)=>Ye(f,o.in,c));return Ye(p,o.in,c)}let u=o.in._zod.run(n,c);if(u instanceof Promise)return u.then((p)=>Ye(p,o.out,c));return Ye(u,o.out,c)}});function Ye(t,o,n){if(t.issues.some((c)=>c.code!=="unrecognized_keys"))return t.aborted=!0,t;return o._zod.run({value:t.value,issues:t.issues},n)}var Ci=v("$ZodPreprocess",(t,o)=>{Ut.init(t,o)}),ji=v("$ZodReadonly",(t,o)=>{A.init(t,o),T(t,"propValues",(n)=>n.def.innerType._zod.propValues),T(t,"values",(n)=>n.def.innerType._zod.values),T(t,"optin",(n)=>n.def.innerType?._zod?.optin),T(t,"optout",(n)=>n.def.innerType?._zod?.optout),t._zod.parse=(n,c)=>{if(c.direction==="backward")return o.innerType._zod.run(n,c);let u=o.innerType._zod.run(n,c);if(u instanceof Promise)return u.then(En);return En(u)}});function En(t){if(!t.memo)t.value=Object.freeze(t.value);return t}var Ri=v("$ZodLazy",(t,o)=>{A.init(t,o),ro(t._zod,"innerType",()=>{let n=o;if(!n._cachedInner)n._cachedInner=o.getter();return n._cachedInner}),T(t,"pattern",(n)=>n.innerType?._zod?.pattern),T(t,"propValues",(n)=>n.innerType?._zod?.propValues),T(t,"optin",(n)=>n.innerType?._zod?.optin??void 0),T(t,"optout",(n)=>n.innerType?._zod?.optout??void 0),t._zod.parse=(n,c)=>t._zod.innerType._zod.run(n,c)}),Di=v("$ZodCustom",(t,o)=>{M.init(t,o),A.init(t,o),t._zod.parse=(n,c)=>n,t._zod.check=(n)=>{let c=n.value,u=o.fn(c);if(u instanceof Promise)return u.then((p)=>Tn(p,n,c,t));Tn(u,n,c,t);return}});function Tn(t,o,n,c){if(!t){let u={code:"custom",input:n,inst:c,path:[...c._zod.def.path??[]],continue:!c._zod.def.abort};if(c._zod.def.params)u.params=c._zod.def.params;o.issues.push(_e(u))}}class Ui extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Jt="~memo",Li=[];function Mt(t){return t.map((o)=>o.path?{...o,path:o.path.slice()}:{...o})}var Fi=new WeakMap;function Mi(t,o){let n=Fi.get(t);if(n!==void 0)return n;if(o.has(t))return!0;o.add(t);let c=!1,u=(h)=>{if(!c&&h?._zod&&Mi(h,o))c=!0},p=t._zod.def,f=p.type;switch(f){case"object":{for(let h of Reflect.ownKeys(p.shape))u(p.shape[h]);u(p.catchall);break}case"array":u(p.element);break;case"tuple":for(let h of p.items)u(h);u(p.rest);break;case"record":case"map":u(p.keyType),u(p.valueType);break;case"set":u(p.valueType);break;case"union":for(let h of p.options)u(h);break;case"intersection":u(p.left),u(p.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":u(p.innerType);break;case"pipe":u(p.in),u(p.out);break;case"function":u(p.input),u(p.output);break;case"lazy":u(t._zod.innerType);break;case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let h in p){let _=Object.getOwnPropertyDescriptor(p,h);if(!_||_.get)continue;let b=_.value;if(!b||typeof b!=="object")continue;if(b._zod)u(b);else if(Array.isArray(b))for(let z of b)u(z)}}return o.delete(t),Fi.set(t,c),c}function uu(t,o){let n=t.buckets.get(o);if(!n)n=new Map,t.buckets.set(o,n);return n}var Qe,et=[],au={alloc(t,o,n){let c=Qe;if(!c)return n;Qe=void 0;let u={value:n,issues:null};return c.set(o.value,u),et.push(u),n},guard(t){var o;(o=t._zod).deferred??(o.deferred=[]),t._zod.deferred.push(()=>{let n=t._zod.parse,c=(u,p)=>{if(p.direction!=="backward"&&lu(p,u.value))throw new Ui;return n(u,p)};if(t._zod.parse=c,t._zod.run===n)t._zod.run=c})},attach(t){var o;let n,c,u;(o=t._zod).deferred??(o.deferred=[]),t._zod.deferred.push(()=>{let p=t._zod.parse,f=(h,_)=>{if(n===void 0){if(n=Mi(t,new Set),!n){if(t._zod.parse=p,t._zod.run===f)t._zod.run=p;return p(h,_)}}let b=h.value;if(b===null||typeof b!=="object")return p(h,_);let z=_[Jt];if(!z)z={buckets:new Map,backEdges:void 0},_[Jt]=z;let w;if(c===_)w=u;else w=uu(z,t),c=_,u=w;let k=w.get(b);if(k){if(h.value=k.value,k.issues){if(k.issues.length)h.issues.push(...Mt(k.issues))}else h.memo=!0,z.backEdges??(z.backEdges=new Set),z.backEdges.add(k.value);return h}Qe=w;let Z=et.length,P=p(h,_);Qe=void 0;let O=et.length>Z?et.pop():void 0;if(P instanceof Promise)return P.then((E)=>{if(O)O.issues=E.issues.length?Mt(E.issues):Li;return E});if(O)O.issues=P.issues.length?Mt(P.issues):Li;return P};if(t._zod.parse=f,t._zod.run===p)t._zod.run=f})}};function Bt(){return au}function lu(t,o){let n=t[Jt]?.backEdges;return n!==void 0&&o!==null&&typeof o==="object"&&n.has(o)}var pu=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function o(p){return t[p]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",credit_card:"credit card number",jwt:"JWT",template_literal:"input"},c={nan:"NaN"};function u(p,f){if(p==="number"&&typeof f==="number"&&!Number.isFinite(f))return String(f);return c[p]??p}return(p)=>{switch(p.code){case"invalid_type":{let f=u(p.expected),h=mo(p.input),_=u(h,p.input);return`Invalid input: expected ${f}, received ${_}`}case"invalid_value":if(p.values.length===1)return`Invalid input: expected ${gt(p.values[0])}`;return`Invalid option: expected one of ${dt(p.values,"|")}`;case"too_big":{let f=p.exact?"exactly ":p.inclusive?"<=":"<",h=o(p.origin);if(h)return`Too big: expected ${p.origin??"value"} to have ${f}${p.maximum.toString()} ${h.unit??"elements"}`;return`Too big: expected ${p.origin??"value"} to be ${f}${p.maximum.toString()}`}case"too_small":{let f=p.exact?"exactly ":p.inclusive?">=":">",h=o(p.origin);if(h)return`Too small: expected ${p.origin} to have ${f}${p.minimum.toString()} ${h.unit}`;return`Too small: expected ${p.origin} to be ${f}${p.minimum.toString()}`}case"invalid_format":{let f=p;if(f.format==="starts_with")return`Invalid string: must start with "${f.prefix}"`;if(f.format==="ends_with")return`Invalid string: must end with "${f.suffix}"`;if(f.format==="includes")return`Invalid string: must include "${f.includes}"`;if(f.format==="regex")return`Invalid string: must match pattern ${f.pattern}`;return`Invalid ${n[f.format]??p.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${p.divisor}`;case"unrecognized_keys":return`Unrecognized key${p.keys.length>1?"s":""}: ${dt(p.keys,", ")}`;case"invalid_key":return`Invalid key in ${p.origin}`;case"invalid_union":if(p.options&&Array.isArray(p.options)&&p.options.length>0)return`Invalid discriminator value. Expected ${p.options.map((h)=>`'${h}'`).join(" | ")}`;if(p.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${p.origin}`;default:return"Invalid input"}}};function Vt(){return{localeError:pu()}}var Ji;class Bi{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...o){let n=o[0];if(this._map.set(t,n),n&&typeof n==="object"&&"id"in n)this._idmap.set(n.id,t);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let o=this._map.get(t);if(o&&typeof o==="object"&&"id"in o)this._idmap.delete(o.id);return this._map.delete(t),this}get(t){let o=t._zod.parent;if(o){let n={...this.get(o)??{}};delete n.id;let c={...n,...this._map.get(t)};return Object.keys(c).length?c:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Vi(){return new Bi}(Ji=globalThis).__zod_globalRegistry??(Ji.__zod_globalRegistry=Vi());var pe=globalThis.__zod_globalRegistry;function Ki(t,o){return new t({type:"string",...S(o)})}function Wi(t,o){return new t({type:"string",coerce:!0,...S(o)})}function Kt(t,o){return new t({type:"string",format:"email",check:"string_format",abort:!1,...S(o)})}function Gi(t,o){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...S(o)})}function qi(t,o){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...S(o)})}function Yi(t,o){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...S(o)})}function Xi(t,o){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...S(o)})}function Hi(t,o){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...S(o)})}function Wt(t,o){return new t({type:"string",format:"url",check:"string_format",abort:!1,...S(o)})}function Qi(t,o){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...S(o)})}function es(t,o){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...S(o)})}function ts(t,o){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...S(o)})}function rs(t,o){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...S(o)})}function os(t,o){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...S(o)})}function ns(t,o){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...S(o)})}function is(t,o){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...S(o)})}function Gt(t,o){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...S(o)})}function qt(t,o){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...S(o)})}function ss(t,o){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...S(o)})}function cs(t,o){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...S(o)})}function us(t,o){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...S(o)})}function as(t,o){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...S(o)})}function ls(t,o){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...S(o)})}function ps(t,o){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...S(o)})}function tt(t,o){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...S(o)})}function rt(t,o){return new t({type:"string",format:"date",check:"string_format",...S(o)})}function Yt(t,o){return new t({type:"string",format:"time",check:"string_format",precision:null,...S(o)})}function Xt(t,o){return new t({type:"string",format:"duration",check:"string_format",...S(o)})}function fs(t,o){return new t({type:"number",checks:[],...S(o)})}function ds(t,o){return new t({type:"number",coerce:!0,checks:[],...S(o)})}function ms(t,o){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...S(o)})}function hs(t,o){return new t({type:"boolean",...S(o)})}function gs(t,o){return new t({type:"boolean",coerce:!0,...S(o)})}function xs(t,o){return new t({type:"bigint",coerce:!0,...S(o)})}function ys(t,o){return new t({type:"null",...S(o)})}function zs(t){return new t({type:"any"})}function vs(t){return new t({type:"unknown"})}function $s(t,o){return new t({type:"never",...S(o)})}function ws(t,o){return new t({type:"void",...S(o)})}function ks(t,o){return new t({type:"date",...S(o)})}function Zs(t,o){return new t({type:"date",coerce:!0,...S(o)})}function ye(t,o){return new Tt({check:"less_than",...S(o),value:t,inclusive:!1})}function se(t,o){return new Tt({check:"less_than",...S(o),value:t,inclusive:!0})}function be(t,o){return new At({check:"greater_than",...S(o),value:t,inclusive:!1})}function ce(t,o){return new At({check:"greater_than",...S(o),value:t,inclusive:!0})}function Ae(t,o){return new sn({check:"multiple_of",...S(o),value:t})}function ot(t,o){return new un({check:"max_length",...S(o),maximum:t})}function ze(t,o){return new an({check:"min_length",...S(o),minimum:t})}function nt(t,o){return new ln({check:"length_equals",...S(o),length:t})}function Ht(t,o){return new pn({check:"string_format",format:"regex",...S(o),pattern:t})}function Qt(t){return new fn({check:"string_format",format:"lowercase",...S(t)})}function er(t){return new dn({check:"string_format",format:"uppercase",...S(t)})}function rr(t,o){return new mn({check:"string_format",format:"includes",...S(o),includes:t})}function or(t,o){return new hn({check:"string_format",format:"starts_with",...S(o),prefix:t})}function nr(t,o){return new _n({check:"string_format",format:"ends_with",...S(o),suffix:t})}function fe(t){return new gn({check:"overwrite",tx:t})}function ir(t){return fe((o)=>o.normalize(t))}function sr(){return fe((t)=>t.trim())}function cr(){return fe((t)=>t.toLowerCase())}function ur(){return fe((t)=>t.toUpperCase())}function ar(){return fe((t)=>no(t))}function Ps(t,o,n){return new t({type:"array",element:o,...S(n)})}function Ss(t,o,n){let c=S(n);return c.abort??(c.abort=!0),new t({type:"custom",check:"custom",fn:o,...c})}function Os(t,o,n){return new t({type:"custom",check:"custom",fn:o,...S(n)})}function Is(t,o){let n=fu((c)=>(c.addIssue=(u)=>{if(typeof u==="string")c.issues.push(_e(u,c.value,n._zod.def));else{let p=u;if(p.fatal)p.continue=!1;if(p.code??(p.code="custom"),!("input"in p))p.input=c.value;p.inst??(p.inst=n),p.continue??(p.continue=!n._zod.def.abort),c.issues.push(_e(p))}},t(c.value,c)),o);return n}function fu(t,o){let n=new M({check:"custom",...S(o)});return n._zod.check=t,n}function Ne(t,...o){for(let n of o)for(let c of Reflect.ownKeys(n))if(Object.prototype.propertyIsEnumerable.call(n,c))L(t,c,n[c]);return t}function je(t){let o=t?.target??"draft-2020-12";if(o==="draft-4")o="draft-04";if(o==="draft-7")o="draft-07";return{processors:t.processors??{},metadataRegistry:t?.metadata??pe,target:o,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:t?.cycles??"ref",reused:t?.reused??"inline",intersections:[],deferred:[],external:t?.external??void 0}}function U(t,o,n,c,u){let p=typeof o.unrepresentable==="function"?o.unrepresentable({zodSchema:t,path:c.path,message:u}):o.unrepresentable;if(p==="any")return!1;if(p===void 0||p==="throw")throw Error(u);return Object.assign(n,p),!0}function C(t,o,n={path:[],schemaPath:[]}){var c;let u=t._zod.def,p=o.seen.get(t);if(p){if(p.count++,n.schemaPath.includes(t))p.cycle=n.path;return p.schema}let f={schema:{},count:1,cycle:void 0,path:n.path};o.seen.set(t,f),o.sharedDefsExtractedFor=void 0,o.sharedEmitDoneFor=void 0;let h=t._zod.toJSONSchema?.();if(h)f.schema=h;else{let z={...n,schemaPath:[...n.schemaPath,t],path:n.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(o,f.schema,z);else{let k=f.schema,Z=o.processors[u.type];if(!Z)throw Error(`[toJSONSchema]: Non-representable type encountered: ${u.type}`);Z(t,o,k,z)}let w=t._zod.parent;if(w){if(!f.ref)f.ref=w;C(w,o,z),o.seen.get(w).isParent=!0}}let _=o.metadataRegistry.get(t);if(_)Ne(f.schema,_);if(o.io==="input"&&V(t))delete f.schema.examples,delete f.schema.default;if(o.io==="input"&&"_prefault"in f.schema)(c=f.schema).default??(c.default=f.schema._prefault);return delete f.schema._prefault,o.seen.get(t).schema}function Es(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function Re(t,o){let n=t.seen.get(o);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");if(t.external&&t.sharedDefsExtractedFor===t.external)return;let c=new Map;for(let f of t.seen.entries()){let h=t.metadataRegistry.get(f[0])?.id;if(h){let _=c.get(h);if(_&&_!==f[0])throw Error(`Duplicate schema id "${h}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);c.set(h,f[0])}}let u=(f)=>{let h=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let w=t.external.registry.get(f[0])?.id,k=t.external.uri??((P)=>P);if(w)return{ref:k(w)};let Z=f[1].defId??f[1].schema.id??`schema${t.counter++}`;return f[1].defId=Z,{defId:Z,ref:`${k("__shared")}#/${h}/${Es(Z)}`}}let _="#",b=`${_}/${h}/`;if(f[1]===n&&!f[1].schema.id)return{ref:_};let z=f[1].schema.id??`__schema${t.counter++}`;return{defId:z,ref:b+Es(z)}},p=(f)=>{if(f[1].schema.$ref)return;let h=f[1],{ref:_,defId:b}=u(f);if(h.def={...h.schema},b)h.defId=b;let z=h.schema;for(let w in z)delete z[w];z.$ref=_};if(t.cycles==="throw")for(let f of t.seen.entries()){let h=f[1];if(h.cycle)throw Error(`Cycle detected: #/${h.cycle?.join("/")}/<root>
53
+
54
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let f of t.seen.entries()){let h=f[1];if(o===f[0]){p(f);continue}if(t.external){let b=t.external.registry.get(f[0])?.id;if(o!==f[0]&&b){p(f);continue}}if(t.metadataRegistry.get(f[0])?.id){p(f);continue}if(h.cycle){p(f);continue}if(h.count>1){if(t.reused==="ref"){p(f);continue}}}if(t.external)t.sharedDefsExtractedFor=t.external}function Ns(t){let o=t.anyOf;if(!Array.isArray(o)||o.length===0||t.type!==void 0)return;let n=[];for(let c of o){if(!c||typeof c!=="object")return;Ns(c);let u=Object.keys(c);if(u.length!==1||u[0]!=="type")return;let p=c.type;for(let f of Array.isArray(p)?p:[p]){if(typeof f!=="string")return;if(!n.includes(f))n.push(f)}}delete t.anyOf,t.type=n.length===1?n[0]:n}var Cs=new Set(["type","properties","required","additionalProperties"]),Ts=["oneOf","anyOf"];function As(t){let o=t.additionalProperties;if(o===void 0||o===!1||typeof o!=="object"||o===null)return null;return Object.keys(o).length?o:null}function lr(t){let o=[];for(let p of t){if(typeof p!=="object"||p.type!=="object")return null;for(let f in p)if(!Cs.has(f))return null;o.push(p)}let n={},c=new Set;for(let p of o){for(let f in p.properties){if(Object.prototype.hasOwnProperty.call(n,f))continue;let h=[];for(let b of o){let z=b.properties?.[f]??As(b);if(z===null||z===void 0)continue;if(!h.some((w)=>JSON.stringify(w)===JSON.stringify(z)))h.push(z)}let _=h.length===1?h[0]:lr(h)??{allOf:h};L(n,f,_)}for(let f of p.required??[])c.add(f)}let u={type:"object",properties:n};if(c.size)u.required=[...c];if(o.every((p)=>p.additionalProperties===!1))u.additionalProperties=!1;else{let p=[];for(let f of o){let h=As(f);if(h&&!p.some((_)=>JSON.stringify(_)===JSON.stringify(h)))p.push(h)}if(p.length===1)u.additionalProperties=p[0];else if(p.length>1)u.additionalProperties={allOf:p}}return u}function du(t){let o=t.allOf;if(!Array.isArray(o)||o.length<2)return;for(let u of Cs)if(u in t)return;let n=o.filter((u)=>Ts.some((p)=>Array.isArray(u[p]))),c=null;if(!n.length)c=lr(o);else{let u=n[0],p=Ts.find((_)=>Array.isArray(u[_]));if(Object.keys(u).length!==1)return;let f=o.filter((_)=>_!==u),h=u[p].map((_)=>lr([...f,_]));if(h.some((_)=>!_))return;c={[p]:h}}if(!c)return;delete t.allOf,Ne(t,c)}function De(t,o){let n=t.seen.get(o);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let c=(h)=>{let _=t.seen.get(h);if(_.ref===null)return;let b=_.def??_.schema,z={...b},w=_.ref;if(_.ref=null,w){c(w);let Z=t.seen.get(w),P=Z.schema;if(P.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"))b.allOf=b.allOf??[],b.allOf.push(P);else Ne(b,P);if(Ne(b,z),h._zod.parent===w)for(let E in b){if(E==="$ref"||E==="allOf")continue;if(!(E in z))delete b[E]}if(P.$ref&&Z.def)for(let E in b){if(E==="$ref"||E==="allOf")continue;if(E in Z.def&&JSON.stringify(b[E])===JSON.stringify(Z.def[E]))delete b[E]}}let k=h._zod.parent;if(k&&k!==w){c(k);let Z=t.seen.get(k);if(Z?.schema.$ref){if(b.$ref=Z.schema.$ref,Z.def)for(let P in b){if(P==="$ref"||P==="allOf")continue;if(P in Z.def&&JSON.stringify(b[P])===JSON.stringify(Z.def[P]))delete b[P]}}}t.override({zodSchema:h,jsonSchema:b,path:_.path??[]})};if(!t.external||t.sharedEmitDoneFor!==t.external){for(let h of[...t.seen.entries()].reverse())c(h[0]);if(t.target!=="openapi-3.0")for(let h of t.seen.entries())Ns(h[1].def??h[1].schema);for(let h of t.deferred)h();if(t.intersections.length){let h=new Map;for(let _ of t.seen.values())for(let b of[_.schema,_.def]){let z=b?.allOf;if(!Array.isArray(z))continue;let w=h.get(z);if(w)w.push(b);else h.set(z,[b])}for(let _ of t.intersections)for(let b of h.get(_)??[])du(b)}}let u={};if(t.target==="draft-2020-12")u.$schema="https://json-schema.org/draft/2020-12/schema";else if(t.target==="draft-07")u.$schema="http://json-schema.org/draft-07/schema#";else if(t.target==="draft-04")u.$schema="http://json-schema.org/draft-04/schema#";else if(t.target==="openapi-3.0");if(t.external?.uri){let h=t.external.registry.get(o)?.id;if(!h)throw Error("Schema is missing an `id` property");u.$id=t.external.uri(h)}Ne(u,n.defId?n.schema:n.def??n.schema);let p=t.metadataRegistry.get(o)?.id;if(p!==void 0&&u.id===p)delete u.id;let f=t.external?.defs??{};if(!t.external||t.sharedEmitDoneFor!==t.external)for(let h of t.seen.entries()){let _=h[1];if(_.def&&_.defId){if(_.def.id===_.defId)delete _.def.id;L(f,_.defId,_.def)}}if(t.external)t.sharedEmitDoneFor=t.external;if(t.external);else if(Object.keys(f).length>0)if(t.target==="draft-2020-12")u.$defs=f;else u.definitions=f;try{let h=JSON.parse(JSON.stringify(u));return Object.defineProperty(h,"~standard",{value:{...o["~standard"],jsonSchema:{input:Ce(o,"input",t.processors),output:Ce(o,"output",t.processors)}},enumerable:!1,writable:!1}),h}catch(h){throw Error("Error converting schema to JSON.")}}function V(t,o){let n=o??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);let c=t._zod.def;if(c.type==="transform")return!0;if(c.type==="array")return V(c.element,n);if(c.type==="set")return V(c.valueType,n);if(c.type==="lazy")return V(c.getter(),n);if(c.type==="promise"||c.type==="optional"||c.type==="nonoptional"||c.type==="nullable"||c.type==="readonly"||c.type==="default"||c.type==="prefault"||c.type==="catch")return V(c.innerType,n);if(c.type==="intersection")return V(c.left,n)||V(c.right,n);if(c.type==="record"||c.type==="map")return V(c.keyType,n)||V(c.valueType,n);if(c.type==="pipe"){if(t._zod.traits.has("$ZodCodec"))return!0;return V(c.in,n)||V(c.out,n)}if(c.type==="object"){for(let u in c.shape)if(V(c.shape[u],n))return!0;return!1}if(c.type==="union"){for(let u of c.options)if(V(u,n))return!0;return!1}if(c.type==="tuple"){for(let u of c.items)if(V(u,n))return!0;if(c.rest&&V(c.rest,n))return!0;return!1}return!1}var js=(t,o={})=>(n)=>{let c=je({...n,processors:o});return C(t,c),Re(c,t),De(c,t)},Ce=(t,o,n={})=>(c)=>{let{libraryOptions:u,target:p}=c??{},f=je({...u??{},target:p,io:o,processors:n});return C(t,f),Re(f,t),De(f,t)};var mu={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},dr=(t,o,n,c)=>{let u=n;u.type="string";let{minimum:p,maximum:f,format:h,patterns:_,contentEncoding:b,laxFormat:z}=t._zod.bag;if(typeof p==="number")u.minLength=p;if(typeof f==="number")u.maxLength=f;if(h){if(u.format=mu[h]??h,u.format==="")delete u.format;if(h==="time"||z)delete u.format}if(b)u.contentEncoding=b;if(_&&_.size>0){let w=[..._];if(w.length===1)u.pattern=w[0].source;else if(w.length>1)u.allOf=[...w.map((k)=>({...o.target==="draft-07"||o.target==="draft-04"||o.target==="openapi-3.0"?{type:"string"}:{},pattern:k.source}))]}},mr=(t,o,n,c)=>{let u=n,{minimum:p,maximum:f,format:h,multipleOf:_,exclusiveMaximum:b,exclusiveMinimum:z}=t._zod.bag;if(typeof h==="string"&&h.includes("int"))u.type="integer";else u.type="number";let w=typeof z==="number"&&z>=(p??Number.NEGATIVE_INFINITY),k=typeof b==="number"&&b<=(f??Number.POSITIVE_INFINITY),Z=o.target==="draft-04"||o.target==="openapi-3.0";if(w)if(Z)u.minimum=z,u.exclusiveMinimum=!0;else u.exclusiveMinimum=z;else if(typeof p==="number")u.minimum=p;if(k)if(Z)u.maximum=b,u.exclusiveMaximum=!0;else u.exclusiveMaximum=b;else if(typeof f==="number")u.maximum=f;if(typeof _==="number")if(Number.isFinite(_)&&_!==0)u.multipleOf=Math.abs(_);else U(t,o,u,c,`A multipleOf divisor of ${_} cannot be represented in JSON Schema`)},hr=(t,o,n,c)=>{n.type="boolean"},_r=(t,o,n,c)=>{U(t,o,n,c,"BigInt cannot be represented in JSON Schema")},Ds=(t,o,n,c)=>{U(t,o,n,c,"Symbols cannot be represented in JSON Schema")},gr=(t,o,n,c)=>{if(o.target==="openapi-3.0")n.type="string",n.nullable=!0,n.enum=[null];else n.type="null"},Ls=(t,o,n,c)=>{U(t,o,n,c,"Undefined cannot be represented in JSON Schema")},xr=(t,o,n,c)=>{U(t,o,n,c,"Void cannot be represented in JSON Schema")},yr=(t,o,n,c)=>{n.not={}},br=(t,o,n,c)=>{},zr=(t,o,n,c)=>{},vr=(t,o,n,c)=>{U(t,o,n,c,"Date cannot be represented in JSON Schema")},$r=(t,o,n,c)=>{let u=t._zod.def,p=Ue(u.entries);if(p.length===0){n.not={};return}if(p.every((f)=>typeof f==="number"))n.type="number";if(p.every((f)=>typeof f==="string"))n.type="string";n.enum=p},wr=(t,o,n,c)=>{let u=t._zod.def;if(u.values.length===0){n.not={};return}let p=[];for(let f of u.values)if(f===void 0){if(U(t,o,n,c,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof f==="bigint"){if(U(t,o,n,c,"BigInt literals cannot be represented in JSON Schema"))return;p.push(Number(f))}else p.push(f);if(p.length===0);else if(p.length===1){let f=p[0];if(n.type=f===null?"null":typeof f,o.target==="draft-04"||o.target==="openapi-3.0")n.enum=[f];else n.const=f}else{if(p.every((f)=>typeof f==="number"))n.type="number";if(p.every((f)=>typeof f==="string"))n.type="string";if(p.every((f)=>typeof f==="boolean"))n.type="boolean";if(p.every((f)=>f===null))n.type="null";n.enum=p}},Fs=(t,o,n,c)=>{U(t,o,n,c,"NaN cannot be represented in JSON Schema")},Us=(t,o,n,c)=>{let u=n,p=t._zod.pattern;if(!p)throw Error("Pattern not found in template literal");u.type="string",u.pattern=p.source},Ms=(t,o,n,c)=>{let u=n,p={type:"string",format:"binary",contentEncoding:"binary"},{minimum:f,maximum:h,mime:_}=t._zod.bag;if(f!==void 0)p.minLength=f;if(h!==void 0)p.maxLength=h;if(_)if(_.length===1)p.contentMediaType=_[0],Object.assign(u,p);else Object.assign(u,p),u.anyOf=_.map((b)=>({contentMediaType:b}));else Object.assign(u,p)},Js=(t,o,n,c)=>{n.type="boolean"},kr=(t,o,n,c)=>{U(t,o,n,c,"Custom types cannot be represented in JSON Schema")},Bs=(t,o,n,c)=>{U(t,o,n,c,"Function types cannot be represented in JSON Schema")},Zr=(t,o,n,c)=>{U(t,o,n,c,"Transforms cannot be represented in JSON Schema")},Gs=(t,o,n,c)=>{U(t,o,n,c,"Map cannot be represented in JSON Schema")},qs=(t,o,n,c)=>{U(t,o,n,c,"Set cannot be represented in JSON Schema")},Pr=(t,o,n,c)=>{let u=n,p=t._zod.def,{minimum:f,maximum:h}=t._zod.bag;if(typeof f==="number")u.minItems=f;if(typeof h==="number")u.maxItems=h;u.type="array",u.items=C(p.element,o,{...c,path:[...c.path,"items"]})};function Le(t){let o=t._zod.def;if(o.type==="pipe"&&o.in._zod.traits.has("$ZodTransform"))return Le(o.out);if(o.type==="catch")return Le(o.innerType);return t._zod.optin}var Sr=(t,o,n,c)=>{let u=n,p=t._zod.def,f=p.shape;if(Object.getOwnPropertySymbols(f).length&&U(t,o,u,c,"Symbol keys cannot be represented in JSON Schema"))return;u.type="object",u.properties={};for(let z in f)L(u.properties,z,C(f[z],o,{...c,path:[...c.path,"properties",z]}));let _=new Set(Object.keys(f)),b=new Set([..._].filter((z)=>{let w=p.shape[z];if(o.io==="input")return Le(w)===void 0;else return w._zod.optout===void 0}));if(b.size>0)u.required=Array.from(b);if(p.catchall?._zod.def.type==="never")u.additionalProperties=!1;else if(!p.catchall){if(o.io==="output")u.additionalProperties=!1}else if(p.catchall)u.additionalProperties=C(p.catchall,o,{...c,path:[...c.path,"additionalProperties"]})},Or=(t,o,n,c)=>{let u=t._zod.def,p=u.inclusive===!1,f=u.options.map((h,_)=>C(h,o,{...c,path:[...c.path,p?"oneOf":"anyOf",_]}));if(p)n.oneOf=f;else n.anyOf=f},Ir=(t,o,n,c)=>{let u=t._zod.def,p=C(u.left,o,{...c,path:[...c.path,"allOf",0]}),f=C(u.right,o,{...c,path:[...c.path,"allOf",1]}),h=(b)=>("allOf"in b)&&Object.keys(b).length===1,_=[...h(p)?p.allOf:[p],...h(f)?f.allOf:[f]];n.allOf=_,o.intersections.push(_)},Er=(t,o,n,c)=>{let u=n,p=t._zod.def;u.type="array";let f=o.target==="draft-2020-12"?"prefixItems":"items",h=o.target==="draft-2020-12"?"items":o.target==="openapi-3.0"?"items":"additionalItems",_=p.items.map((O,E)=>C(O,o,{...c,path:[...c.path,f,E]})),b=p.rest?C(p.rest,o,{...c,path:[...c.path,h,...o.target==="openapi-3.0"?[p.items.length]:[]]}):null,z=p.items.length;while(z>0){let O=p.items[z-1];if(!(o.io==="input"?Le(O)!==void 0:O._zod.optout==="optional"))break;z--}let w=p.items.length,k=!p.rest;if(o.target==="draft-2020-12"){if(u.prefixItems=_,k)u.items=!1;else if(b)u.items=b;if(z>0)u.minItems=z;if(k)u.maxItems=w}else if(o.target==="openapi-3.0"){if(u.items={anyOf:_},b)u.items.anyOf.push(b);if(z>0)u.minItems=z;if(k)u.maxItems=w}else{if(u.items=_,k)u.additionalItems=!1;else if(b)u.additionalItems=b;if(z>0)u.minItems=z;if(k)u.maxItems=w}let{minimum:Z,maximum:P}=t._zod.bag;if(typeof Z==="number")u.minItems=Z;if(typeof P==="number")u.maxItems=P};function pr(t,o,n){if(o.$ref){if(n.has(o))return o;n.add(o);let P=t.get(o)?.def;if(!P)return o;let O=pr(t,P,n);return O===P?o:O}for(let P of["anyOf","oneOf"]){let O=o[P];if(!Array.isArray(O))continue;let E=O.map((J)=>pr(t,J,n));if(E.some((J,q)=>J!==O[q]))o={...o,[P]:E}}let c=Array.isArray(o.type)?o.type:[o.type],u=!c.includes("string")&&c.some((P)=>P==="number"||P==="integer"),p=o.enum??(o.const!==void 0?[o.const]:void 0);if(!u&&!p?.some((P)=>typeof P==="number"))return o;let{minimum:f,maximum:h,exclusiveMinimum:_,exclusiveMaximum:b,multipleOf:z,format:w,id:k,...Z}=o;if(Z.enum)Z.enum=Z.enum.map((P)=>typeof P==="number"?String(P):P);else if(typeof Z.const==="number")Z.const=String(Z.const);if(!u)return Z;if(Z.type="string",!p)Z.pattern=(c.includes("number")?Ee:Ge).source;return Z}var fr=new WeakMap;function hu(t){let o=new Map;for(let c of t.seen.values())if(c.def&&!o.has(c.schema))o.set(c.schema,c);let n=new Map;for(let c of fr.get(t)??[]){let u=t.seen.get(c),p=(u?.def??u?.schema)?.propertyNames;if(!p||p===!0||n.has(p))continue;let f=pr(o,p,new Set);if(f!==p)n.set(p,f)}if(!n.size)return;for(let c of t.seen.values())for(let u of[c.schema,c.def]){let p=u&&n.get(u.propertyNames);if(p)u.propertyNames=p}}var Tr=(t,o,n,c)=>{let u=n,p=t._zod.def;u.type="object";let f=p.keyType,_=f._zod.bag?.patterns;if(p.mode==="loose"&&_&&_.size>0){let w=C(p.valueType,o,{...c,path:[...c.path,"patternProperties","*"]});u.patternProperties={};for(let k of _)L(u.patternProperties,k.source,w)}else{if(o.target==="draft-07"||o.target==="draft-2020-12"){u.propertyNames=C(p.keyType,o,{...c,path:[...c.path,"propertyNames"]});let w=fr.get(o);if(!w)w=[],fr.set(o,w),o.deferred.push(()=>hu(o));w.push(t)}u.additionalProperties=C(p.valueType,o,{...c,path:[...c.path,"additionalProperties"]})}let b=f._zod.values,z=o.io==="input"&&Le(p.valueType)!==void 0;if(b&&!p.partial&&!z){let w=[...b].filter((k)=>typeof k==="string"||typeof k==="number");if(w.length>0)u.required=w.map(String)}},Ar=(t,o,n,c)=>{let u=t._zod.def,p=C(u.innerType,o,c),f=o.seen.get(t);if(o.target==="openapi-3.0")f.ref=u.innerType,n.nullable=!0;else n.anyOf=[p,{type:"null"}]},Nr=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);p.ref=u.innerType},Cr=Symbol();function Xs(t,o,n,c,u){let p=!1,f=JSON.stringify(t,(h,_)=>{if(typeof _!=="bigint")return _;return p=!0,null});if(!p)return JSON.parse(f);return U(o,n,c,u,"BigInt defaults cannot be represented in JSON Schema"),Cr}var jr=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);p.ref=u.innerType;let f=Xs(u.defaultValue,t,o,n,c);if(f!==Cr)n.default=f},Rr=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);if(p.ref=u.innerType,o.io!=="input")return;let f=Xs(u.defaultValue,t,o,n,c);if(f!==Cr)n._prefault=f},Lr=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);p.ref=u.innerType;let f;try{f=u.catchValue(void 0)}catch{U(t,o,n,c,"Dynamic catch values are not supported in JSON Schema");return}n.default=f},Fr=(t,o,n,c)=>{let u=t._zod.def,p=u.in._zod.traits.has("$ZodTransform"),f=o.io==="input"?p?u.out:u.in:u.out;C(f,o,c);let h=o.seen.get(t);h.ref=f},Ur=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);p.ref=u.innerType,n.readOnly=!0},Hs=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);p.ref=u.innerType},it=(t,o,n,c)=>{let u=t._zod.def;C(u.innerType,o,c);let p=o.seen.get(t);p.ref=u.innerType},Mr=(t,o,n,c)=>{let u=t._zod.innerType;C(u,o,c);let p=o.seen.get(t);p.ref=u},Rs={string:dr,number:mr,boolean:hr,bigint:_r,symbol:Ds,null:gr,undefined:Ls,void:xr,never:yr,any:br,unknown:zr,date:vr,enum:$r,literal:wr,nan:Fs,template_literal:Us,file:Ms,success:Js,custom:kr,function:Bs,transform:Zr,map:Gs,set:qs,array:Pr,object:Sr,union:Or,intersection:Ir,tuple:Er,record:Tr,nullable:Ar,nonoptional:Nr,default:jr,prefault:Rr,catch:Lr,pipe:Fr,readonly:Ur,promise:Hs,optional:it,lazy:Mr};function Ks(t,o){if("_idmap"in t){let c=t,u=je({...o,processors:Rs}),p={};for(let _ of c._idmap.entries()){let[b,z]=_;C(z,u)}let f={},h={registry:c,uri:o?.uri,defs:p};u.external=h;for(let _ of c._idmap.entries()){let[b,z]=_;Re(u,z),L(f,b,De(u,z))}if(Object.keys(p).length>0){let _=u.target==="draft-2020-12"?"$defs":"definitions";f.__shared={[_]:p}}return{schemas:f}}let n=je({...o,processors:Rs});return C(t,n),Re(n,t),De(n,t)}var Qs=new WeakSet([Object.prototype,Error.prototype]);function st(t,o,n){Object.defineProperty(t,o,{configurable:!0,enumerable:!1,get(){let c=n(this);return Object.defineProperty(this,o,{value:c,configurable:!0,writable:!0}),c},set(c){Object.defineProperty(this,o,{value:c,configurable:!0,writable:!0})}})}var ku=(t,o)=>{Vs.init(t,o),t.name="ZodError";let n=Object.getPrototypeOf(t);if(Qs.has(n))return;Qs.add(n),st(n,"format",(c)=>(u)=>Zt(c,u)),st(n,"flatten",(c)=>(u)=>kt(c,u)),st(n,"addIssue",(c)=>(u)=>{c.issues.push(u),c.message=JSON.stringify(c.issues,we,2)}),st(n,"addIssues",(c)=>(u)=>{c.issues.push(...u),c.message=JSON.stringify(c.issues,we,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var G=v("ZodError",ku,void 0,{Parent:Error});var ec=Ke(G),tc=We(G),Au=Pe(G),yu=Ie(G),rc=$o(G),oc=wo(G),nc=ko(G),ic=Zo(G),sc=Po(G),uc=So(G),ac=Oo(G),pc=Io(G);function Pu(){if(!B.localeError)W(Vt())}function Fe(){if(!B.memoizer)W({memoizer:Bt()})}var N=v("ZodType",(t,o)=>(Pu(),A.init(t,o),t.def=o,t.type=o.type,t),{check(...t){let o=this.def;return this.clone(ae(o,{checks:[...o.checks??[],...t.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,o){return Y(this,t,o)},brand(){return this},register(t,o){return t.add(this,o),this},refine(t,o){return this.check(ma(t,o))},superRefine(t,o){return this.check(ha(t,o))},overwrite(t){return this.check(fe(t))},optional(){return Se(this)},exactOptional(){return ta(this)},nullable(){return s(this)},nullish(){return Se(s(this))},nonoptional(t){return ca(this,t)},array(){return a(this)},or(t){return I([this,t])},and(t){return _s(this,t)},transform(t){return dc(this,$c(t))},default(t){return na(this,t)},prefault(t){return sa(this,t)},catch(t){return aa(this,t)},pipe(t){return dc(this,t)},readonly(){return fa(this)},describe(t){let o=this.clone();return pe.add(o,{description:t}),o},meta(...t){if(t.length===0)return pe.get(this);let o=this.clone();return pe.add(o,t[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t,...o){return o.length===0?t(this):t(this,...o)},get "~standard"(){return yt(this,"~standard",{...Rt(this),jsonSchema:{input:Ce(this,"input"),output:Ce(this,"output")}})},set "~standard"(t){de(this,"~standard",t)},parse:function t(o,n){return ec(this,o,n,{callee:t})},parseAsync:async function t(o,n){return await tc(this,o,n,{callee:t})},safeParse(t,o){return Au(this,t,o)},async safeParseAsync(t,o){return yu(this,t,o)},get spa(){return this?.safeParseAsync},set spa(t){de(this,"spa",t)},encode:function t(o,n){return rc(this,o,n,{callee:t})},decode:function t(o,n){return oc(this,o,n,{callee:t})},encodeAsync:async function t(o,n){return await nc(this,o,n,{callee:t})},decodeAsync:async function t(o,n){return await ic(this,o,n,{callee:t})},safeEncode(t,o){return sc(this,t,o)},safeDecode(t,o){return uc(this,t,o)},async safeEncodeAsync(t,o){return ac(this,t,o)},async safeDecodeAsync(t,o){return pc(this,t,o)},toJSONSchema(t){return js(this,{})(t)},get description(){return pe.get(this)?.description},get _def(){return this._zod.def}}),mc=v("_ZodString",(t,o)=>{He.init(t,o),N.init(t,o),t._zod.processJSONSchema=(c,u,p)=>dr(t,c,u,p);let n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null},{regex(...t){return this.check(Ht(...t))},includes(...t){return this.check(rr(...t))},startsWith(...t){return this.check(or(...t))},endsWith(...t){return this.check(nr(...t))},min(...t){return this.check(ze(...t))},max(...t){return this.check(ot(...t))},length(...t){return this.check(nt(...t))},nonempty(...t){return this.check(ze(1,...t))},lowercase(t){return this.check(Qt(t))},uppercase(t){return this.check(er(t))},trim(){return this.check(sr())},normalize(...t){return this.check(ir(...t))},toLowerCase(){return this.check(cr())},toUpperCase(){return this.check(ur())},slugify(){return this.check(ar())}}),Jr=v("ZodString",(t,o)=>{He.init(t,o),mc.init(t,o)},{email(t){return this.check(Kt(gc,t))},url(t){return this.check(Wt(xc,t))},jwt(t){return this.check(ps(Mu,t))},emoji(t){return this.check(Qi(Ou,t))},guid(t){return this.check(Gi(Su,t))},uuid(t){return this.check(qi(ct,t))},uuidv4(t){return this.check(Yi(ct,t))},uuidv6(t){return this.check(Xi(ct,t))},uuidv7(t){return this.check(Hi(ct,t))},nanoid(t){return this.check(es(Iu,t))},cuid(t){return this.check(ts(Eu,t))},cuid2(t){return this.check(rs(Tu,t))},ulid(t){return this.check(os(Nu,t))},base64(t){return this.check(us(Lu,t))},base64url(t){return this.check(as(Fu,t))},xid(t){return this.check(ns(Cu,t))},ksuid(t){return this.check(is(ju,t))},ipv4(t){return this.check(Gt(yc,t))},ipv6(t){return this.check(qt(bc,t))},cidrv4(t){return this.check(ss(Ru,t))},cidrv6(t){return this.check(cs(Du,t))},e164(t){return this.check(ls(Uu,t))},datetime(t){return this.check(tt(Br,t))},date(t){return this.check(rt(Vr,t))},time(t){return this.check(Yt(hc,t))},duration(t){return this.check(Xt(_c,t))}});function e(t){return Ki(Jr,t)}var D=v("ZodStringFormat",(t,o)=>{j.init(t,o),mc.init(t,o)}),Br=v("ZodISODateTime",(t,o)=>{Kn.init(t,o),D.init(t,o)}),Vr=v("ZodISODate",(t,o)=>{Wn.init(t,o),D.init(t,o)}),hc=v("ZodISOTime",(t,o)=>{Gn.init(t,o),D.init(t,o)}),_c=v("ZodISODuration",(t,o)=>{qn.init(t,o),D.init(t,o)}),gc=v("ZodEmail",(t,o)=>{Cn.init(t,o),D.init(t,o)});function co(t){return Kt(gc,t)}var Su=v("ZodGUID",(t,o)=>{An.init(t,o),D.init(t,o)});var ct=v("ZodUUID",(t,o)=>{Nn.init(t,o),D.init(t,o)});var xc=v("ZodURL",(t,o)=>{Dn.init(t,o),D.init(t,o)});function Ws(t){return Wt(xc,t)}var Ou=v("ZodEmoji",(t,o)=>{Ln.init(t,o),D.init(t,o)});var Iu=v("ZodNanoID",(t,o)=>{Fn.init(t,o),D.init(t,o)});var Eu=v("ZodCUID",(t,o)=>{Un.init(t,o),D.init(t,o)});var Tu=v("ZodCUID2",(t,o)=>{Mn.init(t,o),D.init(t,o)});var Nu=v("ZodULID",(t,o)=>{Jn.init(t,o),D.init(t,o)});var Cu=v("ZodXID",(t,o)=>{Bn.init(t,o),D.init(t,o)});var ju=v("ZodKSUID",(t,o)=>{Vn.init(t,o),D.init(t,o)});var yc=v("ZodIPv4",(t,o)=>{Yn.init(t,o),D.init(t,o)});function lc(t){return Gt(yc,t)}var bc=v("ZodIPv6",(t,o)=>{Hn.init(t,o),D.init(t,o)});function tf(t){return qt(bc,t)}var Ru=v("ZodCIDRv4",(t,o)=>{Qn.init(t,o),D.init(t,o)});var Du=v("ZodCIDRv6",(t,o)=>{ei.init(t,o),D.init(t,o)});var Lu=v("ZodBase64",(t,o)=>{ri.init(t,o),D.init(t,o)});var Fu=v("ZodBase64URL",(t,o)=>{oi.init(t,o),D.init(t,o)});var Uu=v("ZodE164",(t,o)=>{ni.init(t,o),D.init(t,o)});var Mu=v("ZodJWT",(t,o)=>{ii.init(t,o),D.init(t,o)});var at=v("ZodNumber",(t,o)=>{Dt.init(t,o),N.init(t,o),t._zod.processJSONSchema=(c,u,p)=>mr(t,c,u,p);let n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??0.5),t.isFinite=!0,t.format=n.format??null},{gt(t,o){return this.check(be(t,o))},gte(t,o){return this.check(ce(t,o))},min(t,o){return this.check(ce(t,o))},lt(t,o){return this.check(ye(t,o))},lte(t,o){return this.check(se(t,o))},max(t,o){return this.check(se(t,o))},int(t){return this.check(m(t))},safe(t){return this.check(m(t))},positive(t){return this.check(be(0,t))},nonnegative(t){return this.check(ce(0,t))},negative(t){return this.check(ye(0,t))},nonpositive(t){return this.check(se(0,t))},multipleOf(t,o){return this.check(Ae(t,o))},step(t,o){return this.check(Ae(t,o))},finite(){return this}});function i(t){return fs(at,t)}var Ju=v("ZodNumberFormat",(t,o)=>{si.init(t,o),at.init(t,o)});function m(t){return ms(Ju,t)}var Kr=v("ZodBoolean",(t,o)=>{ci.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>hr(t,n,c,u)});function d(t){return hs(Kr,t)}var zc=v("ZodBigInt",(t,o)=>{ui.init(t,o),N.init(t,o),t._zod.processJSONSchema=(c,u,p)=>_r(t,c,u,p);let n=t._zod.bag;t.minValue=n.minimum??null,t.maxValue=n.maximum??null,t.format=n.format??null},{gte(t,o){return this.check(ce(t,o))},min(t,o){return this.check(ce(t,o))},gt(t,o){return this.check(be(t,o))},lt(t,o){return this.check(ye(t,o))},lte(t,o){return this.check(se(t,o))},max(t,o){return this.check(se(t,o))},positive(t){return this.check(be(BigInt(0),t))},negative(t){return this.check(ye(BigInt(0),t))},nonpositive(t){return this.check(se(BigInt(0),t))},nonnegative(t){return this.check(ce(BigInt(0),t))},multipleOf(t,o){return this.check(Ae(t,o))}});var Bu=v("ZodNull",(t,o)=>{ai.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>gr(t,n,c,u)});function uo(t){return ys(Bu,t)}var Vu=v("ZodAny",(t,o)=>{li.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>br(t,n,c,u)});function x(){return zs(Vu)}var Ku=v("ZodUnknown",(t,o)=>{pi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>zr(t,n,c,u)});function F(){return vs(Ku)}var Wu=v("ZodNever",(t,o)=>{fi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>yr(t,n,c,u)});function rf(t){return $s(Wu,t)}var Gu=v("ZodVoid",(t,o)=>{di.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>xr(t,n,c,u)});function Et(t){return ws(Gu,t)}var Wr=v("ZodDate",(t,o)=>{mi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(c,u,p)=>vr(t,c,u,p),t.min=(c,u)=>t.check(ce(c,u)),t.max=(c,u)=>t.check(se(c,u));let n=t._zod.bag;t.minDate=n.minimum?new Date(n.minimum):null,t.maxDate=n.maximum?new Date(n.maximum):null});function ee(t){return ks(Wr,t)}var qu=v("ZodArray",(t,o)=>{Fe(),_i.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Pr(t,n,c,u),t.element=o.element},{min(t,o){return this.check(ze(t,o))},nonempty(t){return this.check(ze(1,t))},max(t,o){return this.check(ot(t,o))},length(t,o){return this.check(nt(t,o))},unwrap(){return this.element}});function a(t,o){return Ps(qu,t,o)}var hi=v("ZodObject",(t,o)=>{Fe(),bi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Sr(t,n,c,u),Fc(t,"shape",(n)=>n._zod.def.shape,!1)},{keyof(){return g(Object.keys(this._zod.def.shape))},catchall(t){return this.clone({...this._zod.def,catchall:t})},passthrough(){return this.clone({...this._zod.def,catchall:F()})},loose(){return this.clone({...this._zod.def,catchall:F()})},strict(){return this.clone({...this._zod.def,catchall:rf()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(t){return Tc(this,t)},safeExtend(t){return Ac(this,t)},merge(t){return Nc(this,t)},pick(t){return Ic(this,t)},omit(t){return Ec(this,t)},partial(...t){return po(gi,this,t[0])},exactPartial(...t){return po(wc,this,t[0],"exactPartial")},required(...t){return Cc(kc,this,t[0])}});function r(t,o){let n={type:"object",shape:t??{},...S(o)};return new hi(n)}function oe(t,o){return new hi({type:"object",shape:t,catchall:F(),...S(o)})}var vc=v("ZodUnion",(t,o)=>{Lt.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Or(t,n,c,u),t.options=o.options});function I(t,o){return new vc({type:"union",options:t,...S(o)})}var Yu=v("ZodDiscriminatedUnion",(t,o)=>{vc.init(t,o),zi.init(t,o)});function te(t,o,n){return new Yu({type:"union",options:o,discriminator:t,...S(n)})}var Xu=v("ZodIntersection",(t,o)=>{vi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Ir(t,n,c,u)});function _s(t,o){return new Xu({type:"intersection",left:t,right:o})}var Hu=v("ZodTuple",(t,o)=>{Fe(),$i.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Er(t,n,c,u)},{rest(t){return this.clone({...this._zod.def,rest:t})},partial(){let t=this._zod.def;if(t.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...t,items:t.items.map((o)=>new gi({type:"optional",innerType:o}))})}});function Oa(t,o,n){let c=o instanceof A,u=c?n:o;return new Hu({type:"tuple",items:t,rest:c?o:null,...S(u)})}var fc=v("ZodRecord",(t,o)=>{Fe(),wi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Tr(t,n,c,u),t.keyType=o.keyType,t.valueType=o.valueType});function y(t,o,n){if(!o||!o._zod)return new fc({type:"record",keyType:e(),valueType:t,...S(o)});return new fc({type:"record",keyType:t,valueType:o,...S(n)})}var ut=v("ZodEnum",(t,o)=>{ki.init(t,o),N.init(t,o),t._zod.processJSONSchema=(c,u,p)=>$r(t,c,u,p),t.enum=o.entries,t.options=Object.values(o.entries);let n=new Set(Object.keys(o.entries));t.extract=(c,u)=>{let p={};for(let f of c)if(n.has(f))p[f]=o.entries[f];else throw Error(`Key ${f} not found in enum`);return new ut({...o,checks:[],...S(u),entries:p})},t.exclude=(c,u)=>{let p={...o.entries};for(let f of c)if(n.has(f))delete p[f];else throw Error(`Key ${f} not found in enum`);return new ut({...o,checks:[],...S(u),entries:p})}});function g(t,o){let n=Array.isArray(t)?Object.fromEntries(t.map((c)=>[c,c])):t;return new ut({type:"enum",entries:n,...S(o)})}function tr(t,o){return new ut({type:"enum",entries:t,...S(o)})}var Qu=v("ZodLiteral",(t,o)=>{Zi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>wr(t,n,c,u),t.values=new Set(o.values),Object.defineProperty(t,"value",{get(){if(o.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return o.values[0]}})});function l(t,o){return new Qu({type:"literal",values:Array.isArray(t)?t:[t],...S(o)})}var ea=v("ZodTransform",(t,o)=>{Fe(),Pi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Zr(t,n,c,u),t._zod.parse=(n,c)=>{if(c.direction==="backward")throw new Ze(t.constructor.name);n.addIssue=(p)=>{if(typeof p==="string")n.issues.push(_e(p,n.value,o));else{let f=p;if(f.fatal)f.continue=!1;if(f.code??(f.code="custom"),!("input"in f))f.input=n.value;f.inst??(f.inst=t),n.issues.push(_e(f))}};let u=o.transform(n.value,n);if(u instanceof Promise)return u.then((p)=>(n.value=p,n));return n.value=u,n}});function $c(t){return new ea({type:"transform",transform:t})}var gi=v("ZodOptional",(t,o)=>{Ft.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>it(t,n,c,u),t.unwrap=()=>t._zod.def.innerType});function Se(t){return new gi({type:"optional",innerType:t})}var wc=v("ZodExactOptional",(t,o)=>{Si.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>it(t,n,c,u),t.unwrap=()=>t._zod.def.innerType});function ta(t){return new wc({type:"optional",innerType:t})}var ra=v("ZodNullable",(t,o)=>{Oi.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Ar(t,n,c,u),t.unwrap=()=>t._zod.def.innerType});function s(t){return new ra({type:"nullable",innerType:t})}var oa=v("ZodDefault",(t,o)=>{Ii.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>jr(t,n,c,u),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function na(t,o){return new oa({type:"default",innerType:t,get defaultValue(){return typeof o==="function"?o():_t(o)}})}var ia=v("ZodPrefault",(t,o)=>{Ei.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Rr(t,n,c,u),t.unwrap=()=>t._zod.def.innerType});function sa(t,o){return new ia({type:"prefault",innerType:t,get defaultValue(){return typeof o==="function"?o():_t(o)}})}var kc=v("ZodNonOptional",(t,o)=>{Ti.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Nr(t,n,c,u),t.unwrap=()=>t._zod.def.innerType});function ca(t,o){return new kc({type:"nonoptional",innerType:t,...S(o)})}var ua=v("ZodCatch",(t,o)=>{Ni.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Lr(t,n,c,u),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function aa(t,o){return new ua({type:"catch",innerType:t,catchValue:typeof o==="function"?o:_o(o)})}var Zc=v("ZodPipe",(t,o)=>{Ut.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Fr(t,n,c,u),t.in=o.in,t.out=o.out});function dc(t,o){return new Zc({type:"pipe",in:t,out:o})}var la=v("ZodPreprocess",(t,o)=>{Zc.init(t,o),Ci.init(t,o)}),pa=v("ZodReadonly",(t,o)=>{ji.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Ur(t,n,c,u),t.unwrap=()=>t._zod.def.innerType});function fa(t){return new pa({type:"readonly",innerType:t})}var da=v("ZodLazy",(t,o)=>{Ri.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>Mr(t,n,c,u),t.unwrap=()=>t._zod.def.getter()});function ht(t){return new da({type:"lazy",getter:t})}var Gr=v("ZodCustom",(t,o)=>{Di.init(t,o),N.init(t,o),t._zod.processJSONSchema=(n,c,u)=>kr(t,n,c,u)});function ft(t,o){return Ss(Gr,t??(()=>!0),o)}function ma(t,o={}){return Os(Gr,t,o)}function ha(t,o){return Is(t,o)}function _u(t,o={}){let n=new Gr({type:"custom",check:"custom",fn:(c)=>c instanceof t,abort:!0,...S(o)});return n._zod.bag.Class=t,n._zod.check=(c)=>{if(!(c.value instanceof t))c.issues.push({code:"invalid_type",expected:t.name,input:c.value,inst:n,path:[...n._zod.def.path??[]]})},n}function Ys(t){let o=ht(()=>I([e(t),i(),d(),uo(),a(o),y(e(),o)]));return o}function Ai(t,o){return new la({type:"pipe",in:$c(t),out:o})}var bs={};Oe(bs,{bigint:()=>ga,boolean:()=>cc,date:()=>xa,number:()=>rm,string:()=>tm});function tm(t){return Wi(Jr,t)}function rm(t){return ds(at,t)}function cc(t){return gs(Kr,t)}function ga(t){return xs(zc,t)}function xa(t){return Zs(Wr,t)}function X(t){return tt(Br,t)}function oA(t){return rt(Vr,t)}export{Dr,Vs,ef,Ks,Au,yu,e,co,Ws,lc,tf,i,m,d,uo,x,F,rf,Et,ee,a,hi,r,oe,I,te,_s,Oa,y,g,tr,l,gi,Se,s,ht,ft,_u,Ys,Ai,X,oA,tm,rm,cc,bs};
@@ -0,0 +1,2 @@
1
+ import{T}from"./chunk-7rhz2gze.js";var a=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],ri=T("save",a);
2
+ export{ri};
@@ -0,0 +1 @@
1
+ import{h,C,t,Z,Fe,A,it,_t,jp}from"./chunk-7rhz2gze.js";import"./chunk-77fmkpdz.js";import"./chunk-1j27fzy1.js";import"./chunk-0qaq0sp8.js";import{Di}from"./chunk-rqf7999q.js";import"./chunk-3ttrhqy3.js";import"./chunk-1xh34aew.js";import{er}from"./chunk-5vzrpz50.js";import"./chunk-98715kc3.js";import"./chunk-m9pr03kn.js";import"./chunk-avwgktxb.js";import"./chunk-5adsx8x4.js";import"./chunk-gk2q9a3f.js";C();function l(){let{projectId:e}=p.useParams(),{teamId:r,ensureTeamIdForProject:i}=it();h(()=>{i(e)},[e,i]);let{data:a}=er(jp(e)),o=a?.rootFolder,{data:d}=Z({queryKey:["folders",o],queryFn:async()=>{let n=await A.api.folders[":folderId"].$get({param:{folderId:o}});if(!n.ok)throw Error("failed to fetch folder");return await n.json()},enabled:!!o});if(!r||!o||!d)return t(_t,{});return t(Di,{teamId:r,projectId:e,projectName:a.name??"",assetId:o,rootFolderId:o,isRoot:!0})}var p=Fe("/projects/$projectId/agentsmd")({component:l});export{p as Route};
@@ -0,0 +1,2 @@
1
+ import{T}from"./chunk-7rhz2gze.js";var o=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]],Pl=T("arrow-up-narrow-wide",o);
2
+ export{Pl};
@@ -0,0 +1,13 @@
1
+ // @bun
2
+ import{v,G}from"./chunk-fnmwksnb.js";var ne=v(function(Nt,re){var A=1000,T=A*60,M=T*60,P=M*24,Ie=P*7,Re=P*365.25;re.exports=function(e,r){r=r||{};var t=typeof e;if(t==="string"&&e.length>0)return Ae(e);else if(t==="number"&&isFinite(e))return r.long?Me(e):Te(e);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Ae(e){if(e=String(e),e.length>100)return;var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!r)return;var t=parseFloat(r[1]),n=(r[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*Re;case"weeks":case"week":case"w":return t*Ie;case"days":case"day":case"d":return t*P;case"hours":case"hour":case"hrs":case"hr":case"h":return t*M;case"minutes":case"minute":case"mins":case"min":case"m":return t*T;case"seconds":case"second":case"secs":case"sec":case"s":return t*A;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}function Te(e){var r=Math.abs(e);if(r>=P)return Math.round(e/P)+"d";if(r>=M)return Math.round(e/M)+"h";if(r>=T)return Math.round(e/T)+"m";if(r>=A)return Math.round(e/A)+"s";return e+"ms"}function Me(e){var r=Math.abs(e);if(r>=P)return D(e,r,P,"day");if(r>=M)return D(e,r,M,"hour");if(r>=T)return D(e,r,T,"minute");if(r>=A)return D(e,r,A,"second");return e+" ms"}function D(e,r,t,n){var o=r>=t*1.5;return Math.round(e/t)+" "+n+(o?"s":"")}});var J=v(function(Lt,oe){function je(e){t.debug=t,t.default=t,t.coerce=F,t.disable=u,t.enable=o,t.enabled=w,t.humanize=ne(),t.destroy=N,Object.keys(e).forEach((s)=>{t[s]=e[s]}),t.names=[],t.skips=[],t.formatters={};function r(s){let i=0;for(let a=0;a<s.length;a++)i=(i<<5)-i+s.charCodeAt(a),i|=0;return t.colors[Math.abs(i)%t.colors.length]}t.selectColor=r;function t(s){let i,a=null,f,b;function p(...d){if(!p.enabled)return;let O=p,m=Number(new Date),E=m-(i||m);if(O.diff=E,O.prev=i,O.curr=m,i=m,d[0]=t.coerce(d[0]),typeof d[0]!=="string")d.unshift("%O");let x=0;d[0]=d[0].replace(/%([a-zA-Z%])/g,(S,R)=>{if(S==="%%")return"%";x++;let te=t.formatters[R];if(typeof te==="function"){let Pe=d[x];S=te.call(O,Pe),d.splice(x,1),x--}return S}),t.formatArgs.call(O,d),(O.log||t.log).apply(O,d)}if(p.namespace=s,p.useColors=t.useColors(),p.color=t.selectColor(s),p.extend=n,p.destroy=t.destroy,Object.defineProperty(p,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(a!==null)return a;if(f!==t.namespaces)f=t.namespaces,b=t.enabled(s);return b},set:(d)=>{a=d}}),typeof t.init==="function")t.init(p);return p}function n(s,i){let a=t(this.namespace+(typeof i>"u"?":":i)+s);return a.log=this.log,a}function o(s){t.save(s),t.namespaces=s,t.names=[],t.skips=[];let i=(typeof s==="string"?s:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let a of i)if(a[0]==="-")t.skips.push(a.slice(1));else t.names.push(a)}function c(s,i){let a=0,f=0,b=-1,p=0;while(a<s.length)if(f<i.length&&(i[f]===s[a]||i[f]==="*"))if(i[f]==="*")b=f,p=a,f++;else a++,f++;else if(b!==-1)f=b+1,p++,a=p;else return!1;while(f<i.length&&i[f]==="*")f++;return f===i.length}function u(){let s=[...t.names,...t.skips.map((i)=>"-"+i)].join(",");return t.enable(""),s}function w(s){for(let i of t.skips)if(c(s,i))return!1;for(let i of t.names)if(c(s,i))return!0;return!1}function F(s){if(s instanceof Error)return s.stack||s.message;return s}function N(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}oe.exports=je});var se=v(function(W,k){W.formatArgs=Le;W.save=Be;W.load=qe;W.useColors=Ne;W.storage=De();W.destroy=(()=>{let e=!1;return()=>{if(!e)e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();W.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Ne(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Le(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+k.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;e.splice(1,0,r,"color: inherit");let t=0,n=0;e[0].replace(/%[a-zA-Z%]/g,(o)=>{if(o==="%%")return;if(t++,o==="%c")n=t}),e.splice(n,0,r)}W.log=console.debug||console.log||(()=>{});function Be(e){try{if(e)W.storage.setItem("debug",e);else W.storage.removeItem("debug")}catch(r){}}function qe(){let e;try{e=W.storage.getItem("debug")||W.storage.getItem("DEBUG")}catch(r){}if(!e&&typeof process<"u"&&"env"in process)e=process.env.DEBUG;return e}function De(){try{return localStorage}catch(e){}}k.exports=J()(W);var{formatters:ke}=k.exports;ke.j=function(e){try{return JSON.stringify(e)}catch(r){return"[UnexpectedJSONParseError]: "+r.message}}});var ce=v(function(qt,ie){ie.exports=(e,r=process.argv)=>{let t=e.startsWith("-")?"":e.length===1?"-":"--",n=r.indexOf(t+e),o=r.indexOf("--");return n!==-1&&(o===-1||n<o)}});var fe=v(function(Dt,ae){var Je=G("os"),ue=G("tty"),y=ce(),{env:l}=process,U;if(y("no-color")||y("no-colors")||y("color=false")||y("color=never"))U=0;else if(y("color")||y("colors")||y("color=true")||y("color=always"))U=1;function We(){if("FORCE_COLOR"in l){if(l.FORCE_COLOR==="true")return 1;if(l.FORCE_COLOR==="false")return 0;return l.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(l.FORCE_COLOR,10),3)}}function Ke(e){if(e===0)return!1;return{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Ze(e,{streamIsTTY:r,sniffFlags:t=!0}={}){let n=We();if(n!==void 0)U=n;let o=t?U:n;if(o===0)return 0;if(t){if(y("color=16m")||y("color=full")||y("color=truecolor"))return 3;if(y("color=256"))return 2}if(e&&!r&&o===void 0)return 0;let c=o||0;if(l.TERM==="dumb")return c;if(process.platform==="win32"){let u=Je.release().split(".");if(Number(u[0])>=10&&Number(u[2])>=10586)return Number(u[2])>=14931?3:2;return 1}if("CI"in l){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some((u)=>(u in l))||l.CI_NAME==="codeship")return 1;return c}if("TEAMCITY_VERSION"in l)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(l.TEAMCITY_VERSION)?1:0;if(l.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in l){let u=Number.parseInt((l.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(l.TERM_PROGRAM){case"iTerm.app":return u>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(l.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(l.TERM))return 1;if("COLORTERM"in l)return 1;return c}function K(e,r={}){let t=Ze(e,{streamIsTTY:e&&e.isTTY,...r});return Ke(t)}ae.exports={supportsColor:K,stdout:K({isTTY:ue.isatty(1)}),stderr:K({isTTY:ue.isatty(2)})}});var de=v(function(Z,z){var Qe=G("tty"),H=G("util");Z.init=st;Z.log=rt;Z.formatArgs=et;Z.save=nt;Z.load=ot;Z.useColors=Xe;Z.destroy=H.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");Z.colors=[6,2,3,4,5,1];try{let e=fe();if(e&&(e.stderr||e).level>=2)Z.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(e){}Z.inspectOpts=Object.keys(process.env).filter((e)=>/^debug_/i.test(e)).reduce((e,r)=>{let t=r.substring(6).toLowerCase().replace(/_([a-z])/g,(o,c)=>c.toUpperCase()),n=process.env[r];if(/^(yes|on|true|enabled)$/i.test(n))n=!0;else if(/^(no|off|false|disabled)$/i.test(n))n=!1;else if(n==="null")n=null;else n=Number(n);return e[t]=n,e},{});function Xe(){return"colors"in Z.inspectOpts?Boolean(Z.inspectOpts.colors):Qe.isatty(process.stderr.fd)}function et(e){let{namespace:r,useColors:t}=this;if(t){let n=this.color,o="\x1B[3"+(n<8?n:"8;5;"+n),c=` ${o};1m${r} \x1B[0m`;e[0]=c+e[0].split(`
3
+ `).join(`
4
+ `+c),e.push(o+"m+"+z.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=tt()+r+" "+e[0]}function tt(){if(Z.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function rt(...e){return process.stderr.write(H.formatWithOptions(Z.inspectOpts,...e)+`
5
+ `)}function nt(e){if(e)process.env.DEBUG=e;else delete process.env.DEBUG}function ot(){return process.env.DEBUG}function st(e){e.inspectOpts={};let r=Object.keys(Z.inspectOpts);for(let t=0;t<r.length;t++)e.inspectOpts[r[t]]=Z.inspectOpts[r[t]]}z.exports=J()(Z);var{formatters:le}=z.exports;le.o=function(e){return this.inspectOpts.colors=this.useColors,H.inspect(e,this.inspectOpts).split(`
6
+ `).map((r)=>r.trim()).join(" ")};le.O=function(e){return this.inspectOpts.colors=this.useColors,H.inspect(e,this.inspectOpts)}});var X=v(function($t,Q){if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)Q.exports=se();else Q.exports=de()});var ye=v(function(h){var dt=h&&h.__createBinding||(Object.create?function(e,r,t,n){if(n===void 0)n=t;var o=Object.getOwnPropertyDescriptor(r,t);if(!o||("get"in o?!r.__esModule:o.writable||o.configurable))o={enumerable:!0,get:function(){return r[t]}};Object.defineProperty(e,n,o)}:function(e,r,t,n){if(n===void 0)n=t;e[n]=r[t]}),ht=h&&h.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),he=h&&h.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null){for(var t in e)if(t!=="default"&&Object.prototype.hasOwnProperty.call(e,t))dt(r,e,t)}return ht(r,e),r};Object.defineProperty(h,"__esModule",{value:!0});h.req=h.json=h.toBuffer=void 0;var Ct=he(G("http")),yt=he(G("https"));async function Ce(e){let r=0,t=[];for await(let n of e)r+=n.length,t.push(n);return Buffer.concat(t,r)}h.toBuffer=Ce;async function gt(e){let t=(await Ce(e)).toString("utf8");try{return JSON.parse(t)}catch(n){let o=n;throw o.message+=` (input: ${t})`,o}}h.json=gt;function bt(e,r={}){let n=((typeof e==="string"?e:e.href).startsWith("https:")?yt:Ct).request(e,r),o=new Promise((c,u)=>{n.once("response",c).once("error",u).end()});return n.then=o.then.bind(o),n}h.req=bt});var Oe=v(function(C){var be=C&&C.__createBinding||(Object.create?function(e,r,t,n){if(n===void 0)n=t;var o=Object.getOwnPropertyDescriptor(r,t);if(!o||("get"in o?!r.__esModule:o.writable||o.configurable))o={enumerable:!0,get:function(){return r[t]}};Object.defineProperty(e,n,o)}:function(e,r,t,n){if(n===void 0)n=t;e[n]=r[t]}),mt=C&&C.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),me=C&&C.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null){for(var t in e)if(t!=="default"&&Object.prototype.hasOwnProperty.call(e,t))be(r,e,t)}return mt(r,e),r},_t=C&&C.__exportStar||function(e,r){for(var t in e)if(t!=="default"&&!Object.prototype.hasOwnProperty.call(r,t))be(r,e,t)};Object.defineProperty(C,"__esModule",{value:!0});C.Agent=void 0;var Ot=me(G("net")),ge=me(G("http")),vt=G("https");_t(ye(),C);var _=Symbol("AgentBaseInternalState");class _e extends ge.Agent{constructor(e){super(e);this[_]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint==="boolean")return e.secureEndpoint;if(typeof e.protocol==="string")return e.protocol==="https:"}let{stack:r}=Error();if(typeof r!=="string")return!1;return r.split(`
7
+ `).some((t)=>t.indexOf("(https.js:")!==-1||t.indexOf("node:https:")!==-1)}incrementSockets(e){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;if(!this.sockets[e])this.sockets[e]=[];let r=new Ot.Socket({writable:!1});return this.sockets[e].push(r),this.totalSocketCount++,r}decrementSockets(e,r){if(!this.sockets[e]||r===null)return;let t=this.sockets[e],n=t.indexOf(r);if(n!==-1){if(t.splice(n,1),this.totalSocketCount--,t.length===0)delete this.sockets[e]}}getName(e){if(this.isSecureEndpoint(e))return vt.Agent.prototype.getName.call(this,e);return super.getName(e)}createSocket(e,r,t){let n={...r,secureEndpoint:this.isSecureEndpoint(r)},o=this.getName(n),c=this.incrementSockets(o);Promise.resolve().then(()=>this.connect(e,n)).then((u)=>{if(this.decrementSockets(o,c),u instanceof ge.Agent)try{return u.addRequest(e,n)}catch(w){return t(w)}this[_].currentSocket=u,super.createSocket(e,r,t)},(u)=>{this.decrementSockets(o,c),t(u)})}createConnection(){let e=this[_].currentSocket;if(this[_].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[_].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(e){if(this[_])this[_].defaultPort=e}get protocol(){return this[_].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(e){if(this[_])this[_].protocol=e}}C.Agent=_e});var ve=v(function(j){var wt=j&&j.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(j,"__esModule",{value:!0});j.parseProxyResponse=void 0;var Ft=wt(X()),Y=(0,Ft.default)("https-proxy-agent:parse-proxy-response");function xt(e){return new Promise((r,t)=>{let n=0,o=[];function c(){let s=e.read();if(s)N(s);else e.once("readable",c)}function u(){e.removeListener("end",w),e.removeListener("error",F),e.removeListener("readable",c)}function w(){u(),Y("onend"),t(Error("Proxy connection ended before receiving CONNECT response"))}function F(s){u(),Y("onerror %o",s),t(s)}function N(s){o.push(s),n+=s.length;let i=Buffer.concat(o,n),a=i.indexOf(`\r
8
+ \r
9
+ `);if(a===-1){Y("have not received end of HTTP headers yet..."),c();return}let f=i.slice(0,a).toString("ascii").split(`\r
10
+ `),b=f.shift();if(!b)return e.destroy(),t(Error("No header received from proxy CONNECT response"));let p=b.split(" "),d=+p[1],O=p.slice(2).join(" "),m={};for(let E of f){if(!E)continue;let x=E.indexOf(":");if(x===-1)return e.destroy(),t(Error(`Invalid header from proxy CONNECT response: "${E}"`));let q=E.slice(0,x).toLowerCase(),S=E.slice(x+1).trimStart(),R=m[q];if(typeof R==="string")m[q]=[R,S];else if(Array.isArray(R))R.push(S);else m[q]=S}Y("got proxy server response: %o %o",b,m),u(),r({connect:{statusCode:d,statusText:O,headers:m},buffered:i})}e.on("error",F),e.on("end",w),c()})}j.parseProxyResponse=xt});var jt=v(function(g){var Et=g&&g.__createBinding||(Object.create?function(e,r,t,n){if(n===void 0)n=t;var o=Object.getOwnPropertyDescriptor(r,t);if(!o||("get"in o?!r.__esModule:o.writable||o.configurable))o={enumerable:!0,get:function(){return r[t]}};Object.defineProperty(e,n,o)}:function(e,r,t,n){if(n===void 0)n=t;e[n]=r[t]}),St=g&&g.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),Ee=g&&g.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null){for(var t in e)if(t!=="default"&&Object.prototype.hasOwnProperty.call(e,t))Et(r,e,t)}return St(r,e),r},Se=g&&g.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(g,"__esModule",{value:!0});g.HttpsProxyAgent=void 0;var V=Ee(G("net")),we=Ee(G("tls")),Pt=Se(G("assert")),It=Se(X()),Rt=Oe(),At=G("url"),Tt=ve(),B=(0,It.default)("https-proxy-agent"),Fe=(e)=>{if(e.servername===void 0&&e.host&&!V.isIP(e.host))return{...e,servername:e.host};return e};class ee extends Rt.Agent{constructor(e,r){super(r);this.options={path:void 0},this.proxy=typeof e==="string"?new At.URL(e):e,this.proxyHeaders=r?.headers??{},B("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let t=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),n=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...r?xe(r,"headers"):null,host:t,port:n}}async connect(e,r){let{proxy:t}=this;if(!r.host)throw TypeError('No "host" provided');let n;if(t.protocol==="https:")B("Creating `tls.Socket`: %o",this.connectOpts),n=we.connect(Fe(this.connectOpts));else B("Creating `net.Socket`: %o",this.connectOpts),n=V.connect(this.connectOpts);let o=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders},c=V.isIPv6(r.host)?`[${r.host}]`:r.host,u=`CONNECT ${c}:${r.port} HTTP/1.1\r
11
+ `;if(t.username||t.password){let i=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;o["Proxy-Authorization"]=`Basic ${Buffer.from(i).toString("base64")}`}if(o.Host=`${c}:${r.port}`,!o["Proxy-Connection"])o["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close";for(let i of Object.keys(o))u+=`${i}: ${o[i]}\r
12
+ `;let w=Tt.parseProxyResponse(n);n.write(`${u}\r
13
+ `);let{connect:F,buffered:N}=await w;if(e.emit("proxyConnect",F),this.emit("proxyConnect",F,e),F.statusCode===200){if(e.once("socket",Mt),r.secureEndpoint)return B("Upgrading socket connection to TLS"),we.connect({...xe(Fe(r),"host","path","port"),socket:n});return n}n.destroy();let s=new V.Socket({writable:!1});return s.readable=!0,e.once("socket",(i)=>{B("Replaying proxy buffer for failed request"),(0,Pt.default)(i.listenerCount("data")>0),i.push(N),i.push(null)}),s}}ee.protocols=["http","https"];g.HttpsProxyAgent=ee;function Mt(e){e.resume()}function xe(e,...r){let t={},n;for(n in e)if(!r.includes(n))t[n]=e[n];return t}});export default jt();
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ss,$o}from"./chunk-vap4k11j.js";import{Go}from"./chunk-1gvscz88.js";import{Qo,mo,kt}from"./chunk-5tcdwep5.js";import{an,nr,He,Jr,Jt,go,jt}from"./chunk-jgs8an3h.js";var{awsEndpointFunctions:B,emitWarningIfUnsupportedVersion:W,createDefaultUserAgentProvider:Q,NODE_APP_ID_CONFIG_OPTIONS:Y,getAwsRegionExtensionConfiguration:J,resolveAwsRegionExtensionConfiguration:X,resolveUserAgentConfig:Z,resolveHostHeaderConfig:ee,getUserAgentPlugin:te,getHostHeaderPlugin:se,getLoggerPlugin:oe,getRecursionDetectionPlugin:ne}=kt(),{NoAuthSigner:re,getHttpAuthSchemeEndpointRuleSetPlugin:ie,DefaultIdentityProviderConfig:ae,getHttpSigningPlugin:ce}=mo(),{normalizeProvider:b,getSmithyContext:ue,ServiceException:de,NoOpLogger:le,emitWarningIfUnsupportedVersion:pe,loadConfigsForDefaultMode:he,getDefaultExtensionConfiguration:ge,resolveDefaultRuntimeConfig:me,Client:_e,makeBuilder:Se,createAggregatedClient:fe}=nr(),{Command:us}=nr();var{resolveDefaultsModeConfig:Ee,loadConfig:a,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:Pe,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:ve,NODE_REGION_CONFIG_OPTIONS:Re,NODE_REGION_CONFIG_FILE_OPTIONS:Ce,resolveRegionConfig:xe}=He(),{BinaryDecisionDiagram:Ie,EndpointCache:Ae,decideEndpoint:ye,customEndpointFunctions:Oe,resolveEndpointConfig:Te,getEndpointPlugin:De}=Jr(),{parseUrl:Ne,getHttpHandlerExtensionConfiguration:we,resolveHttpHandlerRuntimeConfig:ke,getContentLengthPlugin:be}=jt(),{DEFAULT_RETRY_MODE:Fe,NODE_RETRY_MODE_CONFIG_OPTIONS:$e,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:qe,resolveRetryConfig:Ue,getRetryPlugin:Ge}=Qo(),{TypeRegistry:F,getSchemaSerdePlugin:Me}=an(),{resolveAwsSdkSigV4Config:ze,AwsSdkSigV4Signer:je,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:Le}=$o(),{toUtf8:Ke,fromUtf8:Ve,toBase64:Be,fromBase64:We,calculateBodyLength:Qe}=Jt(),{streamCollector:Ye,NodeHttpHandler:Je}=Go(),{AwsRestJsonProtocol:Xe}=Ss(),{Sha256:Ze}=go(),et=async(e,t,s)=>({operation:ue(t).operation,region:await b(e.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function tt(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"awsssoportal",region:e.region},propertiesExtractor:(t,s)=>({signingProperties:{config:t,context:s}})}}function st(e){return{schemeId:"smithy.api#noAuth"}}var ot=(e)=>{let t=[];switch(e.operation){case"GetRoleCredentials":{t.push(st());break}default:t.push(tt(e))}return t},nt=(e)=>{let t=ze(e);return Object.assign(t,{authSchemePreference:b(e.authSchemePreference??[])})},rt=(e)=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"awsssoportal"}),it={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},at="3.997.43",ct={version:at},l="ref",c=-1,g=!0,T="isSet",q="PartitionResult",m="booleanEquals",v="getAttr",D={[l]:"Endpoint"},R={[l]:q},d={},N=[{[l]:"Region"}],w={conditions:[[T,[D]],[T,N],["aws.partition",N,q],[m,[{[l]:"UseFIPS"},g]],[m,[{[l]:"UseDualStack"},g]],[m,[{fn:v,argv:[R,"supportsDualStack"]},g]],[m,[{fn:v,argv:[R,"supportsFIPS"]},g]],["stringEquals",[{fn:v,argv:[R,"name"]},"aws-us-gov"]]],results:[[c],[c,"Invalid Configuration: FIPS and custom endpoint are not supported"],[c,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[D,d],["https://portal.sso-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",d],[c,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://portal.sso.{Region}.amazonaws.com",d],["https://portal.sso-fips.{Region}.{PartitionResult#dnsSuffix}",d],[c,"FIPS is enabled but this partition does not support FIPS"],["https://portal.sso.{Region}.{PartitionResult#dualStackDnsSuffix}",d],[c,"DualStack is enabled but this partition does not support DualStack"],["https://portal.sso.{Region}.{PartitionResult#dnsSuffix}",d],[c,"Invalid Configuration: Missing Region"]]},ut=2,n=1e8,dt=new Int32Array([-1,1,-1,0,13,3,1,4,n+12,2,5,n+12,3,8,6,4,7,n+11,5,n+9,n+10,4,11,9,6,10,n+8,7,n+6,n+7,5,12,n+5,6,n+4,n+5,3,n+1,14,4,n+2,n+3]),lt=Ie.from(dt,ut,w.conditions,w.results),pt=new Ae({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),ht=(e,t={})=>pt.get(e,()=>ye(lt,{endpointParams:e,logger:t.logger}));Oe.aws=B;class u extends de{constructor(e){super(e);Object.setPrototypeOf(this,u.prototype)}}class C extends u{name="InvalidRequestException";$fault="client";constructor(e){super({name:"InvalidRequestException",$fault:"client",...e});Object.setPrototypeOf(this,C.prototype)}}class x extends u{name="ResourceNotFoundException";$fault="client";constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e});Object.setPrototypeOf(this,x.prototype)}}class I extends u{name="TooManyRequestsException";$fault="client";constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e});Object.setPrototypeOf(this,I.prototype)}}class A extends u{name="UnauthorizedException";$fault="client";constructor(e){super({name:"UnauthorizedException",$fault:"client",...e});Object.setPrototypeOf(this,A.prototype)}}var gt="AccessTokenType",mt="GetRoleCredentials",_t="GetRoleCredentialsRequest",St="GetRoleCredentialsResponse",ft="InvalidRequestException",Et="RoleCredentials",Pt="ResourceNotFoundException",vt="SecretAccessKeyType",Rt="SessionTokenType",Ct="TooManyRequestsException",xt="UnauthorizedException",It="accountId",At="accessKeyId",yt="accessToken",Ot="account_id",_="client",S="error",Tt="expiration",Dt="http",f="httpError",Nt="httpHeader",k="httpQuery",E="message",wt="roleCredentials",bt="roleName",Ft="role_name",H="smithy.ts.sdk.synthetic.com.amazonaws.sso",$t="secretAccessKey",qt="sessionToken",Ht="x-amz-sso_bearer_token",r="com.amazonaws.sso",U=F.for(H),Ut=[-3,H,"SSOServiceException",0,[],[]];U.registerError(Ut,u);var p=F.for(r),Gt=[-3,r,ft,{[S]:_,[f]:400},[E],[0]];p.registerError(Gt,C);var Mt=[-3,r,Pt,{[S]:_,[f]:404},[E],[0]];p.registerError(Mt,x);var zt=[-3,r,Ct,{[S]:_,[f]:429},[E],[0]];p.registerError(zt,I);var Lt=[-3,r,xt,{[S]:_,[f]:401},[E],[0]];p.registerError(Lt,A);var Kt=[U,p],Vt=[0,r,gt,8,0],Bt=[0,r,vt,8,0],Wt=[0,r,Rt,8,0],Qt=[3,r,_t,0,[bt,It,yt],[[0,{[k]:Ft}],[0,{[k]:Ot}],[()=>Vt,{[Nt]:Ht}]],3],Yt=[3,r,St,0,[wt],[[()=>Xt,0]]],Xt=[3,r,Et,0,[At,$t,qt,Tt],[0,[()=>Bt,0],[()=>Wt,0],1]],Zt=[9,r,mt,{[Dt]:["GET","/federation/credentials",200]},()=>Qt,()=>Yt],es=(e)=>({apiVersion:"2019-06-10",base64Decoder:e?.base64Decoder??We,base64Encoder:e?.base64Encoder??Be,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??ht,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??ot,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(t)=>t.getIdentityProvider("aws.auth#sigv4"),signer:new je},{schemeId:"smithy.api#noAuth",identityProvider:(t)=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new re}],logger:e?.logger??new le,protocol:e?.protocol??Xe,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.sso",errorTypeRegistries:Kt,version:"2019-06-10",serviceTarget:"SWBPortalService"},serviceId:e?.serviceId??"SSO",sha256:e?.sha256??Ze,urlParser:e?.urlParser??Ne,utf8Decoder:e?.utf8Decoder??Ve,utf8Encoder:e?.utf8Encoder??Ke}),ts=(e)=>{pe(process.version);let t=Ee(e),s=()=>t().then(he),i=es(e);W(process.version);let o={profile:e?.profile,logger:i.logger};return{...i,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??a(Le,o),bodyLengthChecker:e?.bodyLengthChecker??Qe,defaultUserAgentProvider:e?.defaultUserAgentProvider??Q({serviceId:i.serviceId,clientVersion:ct.version}),maxAttempts:e?.maxAttempts??a(qe,e),region:e?.region??a(Re,{...Ce,...o}),requestHandler:Je.create(e?.requestHandler??s),retryMode:e?.retryMode??a({...$e,default:async()=>(await s()).retryMode||Fe},e),streamCollector:e?.streamCollector??Ye,useDualstackEndpoint:e?.useDualstackEndpoint??a(ve,o),useFipsEndpoint:e?.useFipsEndpoint??a(Pe,o),userAgentAppId:e?.userAgentAppId??a(Y,o)}},ss=(e)=>{let{httpAuthSchemes:t,httpAuthSchemeProvider:s,credentials:i}=e;return{setHttpAuthScheme(o){let h=t.findIndex((P)=>P.schemeId===o.schemeId);if(h===-1)t.push(o);else t.splice(h,1,o)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(o){s=o},httpAuthSchemeProvider(){return s},setCredentials(o){i=o},credentials(){return i}}},os=(e)=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),ns=(e,t)=>{let s=Object.assign(J(e),ge(e),we(e),ss(e));return t.forEach((i)=>i.configure(s)),Object.assign(e,X(s),me(s),ke(s),os(s))};class y extends _e{config;constructor(...[e]){let t=ts(e||{});super(t);this.initConfig=t;let s=rt(t),i=Z(s),o=Ue(i),h=xe(o),P=ee(h),j=Te(P),L=nt(j),K=ns(L,e?.extensions||[]);this.config=K,this.middlewareStack.use(Me(this.config)),this.middlewareStack.use(te(this.config)),this.middlewareStack.use(Ge(this.config)),this.middlewareStack.use(be(this.config)),this.middlewareStack.use(se(this.config)),this.middlewareStack.use(oe(this.config)),this.middlewareStack.use(ne(this.config)),this.middlewareStack.use(ie(this.config,{httpAuthSchemeParametersProvider:et,identityProviderConfigProvider:async(V)=>new ae({"aws.auth#sigv4":V.credentials})})),this.middlewareStack.use(ce(this.config))}destroy(){super.destroy()}}var rs=Se(it,"SWBPortalService","SSOClient",De),is={},as=(e,t,s,i)=>[];class O extends rs(is,as,"GetRoleCredentials",Zt){}var cs={GetRoleCredentialsCommand:O};class G extends y{}fe(cs,G);var M=O;var z=y;export{M as GetRoleCredentialsCommand,z as SSOClient};