@madarco/agentbox 0.25.1 → 0.26.1

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 (121) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +8 -7
  3. package/dist/{_cloud-attach-FGMI2ZHO.js → _cloud-attach-7WRQH6XZ.js} +5 -5
  4. package/dist/{chunk-5VNL6SHJ.js → chunk-7ZZAZPYX.js} +3 -3
  5. package/dist/{chunk-ZTSVY3YL.js → chunk-BA2VLJVU.js} +3 -3
  6. package/dist/{chunk-3BR63LCB.js → chunk-DJQMK4RN.js} +12 -4
  7. package/dist/chunk-DJQMK4RN.js.map +1 -0
  8. package/dist/{chunk-6GZK74GT.js → chunk-DQHMDDAT.js} +2 -2
  9. package/dist/{chunk-P5U6AP6K.js → chunk-I2OAJS3L.js} +40 -377
  10. package/dist/{chunk-P5U6AP6K.js.map → chunk-I2OAJS3L.js.map} +1 -1
  11. package/dist/{chunk-5F5SOSDY.js → chunk-JGZSA5ZI.js} +72 -23
  12. package/dist/chunk-JGZSA5ZI.js.map +1 -0
  13. package/dist/{chunk-67VF2QZC.js → chunk-K5KOLYIL.js} +3 -3
  14. package/dist/{chunk-4LS2TOF3.js → chunk-PK2QF4IR.js} +569 -195
  15. package/dist/chunk-PK2QF4IR.js.map +1 -0
  16. package/dist/{chunk-3PSRBK24.js → chunk-UIFL7F2G.js} +54 -37
  17. package/dist/chunk-UIFL7F2G.js.map +1 -0
  18. package/dist/{chunk-4DBLYT2F.js → chunk-ZY7M7MXH.js} +41 -16
  19. package/dist/chunk-ZY7M7MXH.js.map +1 -0
  20. package/dist/chunk-ZYKNSHOH.js +259 -0
  21. package/dist/chunk-ZYKNSHOH.js.map +1 -0
  22. package/dist/{dist-X7R2EMJL.js → dist-5IICYSR6.js} +42 -374
  23. package/dist/{dist-X7R2EMJL.js.map → dist-5IICYSR6.js.map} +1 -1
  24. package/dist/{dist-5G42NFOG.js → dist-AR5CHRSV.js} +86 -45
  25. package/dist/{dist-5G42NFOG.js.map → dist-AR5CHRSV.js.map} +1 -1
  26. package/dist/{dist-AZUD2LUA.js → dist-DTNYMBQ5.js} +12 -12
  27. package/dist/{dist-MEK44IS5.js → dist-K4LNH3EC.js} +6 -6
  28. package/dist/{dist-SN6ABGMD.js → dist-POVRY7HO.js} +8 -4
  29. package/dist/{dist-SBDYDH7H.js → dist-U2SVLJUQ.js} +4 -2
  30. package/dist/{dist-4I7XHDC3.js → dist-XYY6SIKG.js} +6 -6
  31. package/dist/dist-YA7EXBGG.js +809 -0
  32. package/dist/dist-YA7EXBGG.js.map +1 -0
  33. package/dist/index.js +971 -591
  34. package/dist/index.js.map +1 -1
  35. package/dist/{prepared-state-75DIZ55S-5UAKJX3L.js → prepared-state-75DIZ55S-W6NU3S3B.js} +2 -2
  36. package/package.json +8 -7
  37. package/runtime/_shared/ctl.cjs +83 -36
  38. package/runtime/digitalocean/ctl.cjs +83 -36
  39. package/runtime/docker/packages/ctl/dist/bin.cjs +83 -36
  40. package/runtime/e2b/ctl.cjs +83 -36
  41. package/runtime/hetzner/ctl.cjs +83 -36
  42. package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
  43. package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
  44. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js +1 -1
  45. package/runtime/hub/apps/hub/.next/server/app/(auth)/api/auth/[...all]/route.js.nft.json +1 -1
  46. package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -1
  47. package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +1 -1
  48. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  49. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  50. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  51. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  52. package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  53. package/runtime/hub/apps/hub/.next/server/chunks/0-fj_better-auth_dist_adapters_kysely-adapter_index_mjs_0btft52._.js +3 -0
  54. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0d1lmiq._.js +5 -5
  55. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0keu6we._.js +1 -1
  56. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1-9g0ae._.js +1 -1
  57. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1bqbkd5._.js +1 -1
  58. package/runtime/hub/apps/hub/.next/server/chunks/{[root-of-the-server]__19pc87s._.js → [root-of-the-server]__1k8g143._.js} +2 -2
  59. package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qa4a0v._.js +1 -1
  60. package/runtime/hub/apps/hub/.next/server/chunks/_0760z6y._.js +4 -4
  61. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_0xy-j7z._.js +1 -1
  62. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_010858m.js +1 -1
  63. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_04zwxnx.js +1 -1
  64. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_06exuc7.js +1 -1
  65. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_0f2ldrt.js +1 -1
  66. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_0f2tzep.js +1 -1
  67. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_116nh32.js +1 -1
  68. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_11dyjcb.js +1 -1
  69. package/runtime/hub/apps/hub/.next/server/chunks/ssr/09xn_next_dist_esm_build_templates_app-page_1_4knli.js +1 -1
  70. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__08-1wwu._.js +1 -1
  71. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0c9mbcn._.js +1 -1
  72. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0gdfxj4._.js +1 -1
  73. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0kc-hwp._.js +1 -1
  74. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0lu73p6._.js +1 -1
  75. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__10bfmwi._.js +1 -1
  76. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__18qvdzb._.js +1 -1
  77. package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__1l2urlw._.js +1 -1
  78. package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ro6vh6._.js +1 -1
  79. package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +3 -3
  80. package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -1
  81. package/runtime/hub/apps/hub/{auth-MVL4NCQC.js → auth-DC44GQZY.js} +2 -2
  82. package/runtime/hub/apps/hub/{auth-config-GRIXACTV.js → auth-config-LALRDYDO.js} +2 -2
  83. package/runtime/hub/apps/hub/{chunk-JLG5JJXD.js → chunk-3FJNKSNZ.js} +1 -1
  84. package/runtime/hub/apps/hub/{chunk-RSENJ2FT.js → chunk-4QY2VZCF.js} +502 -132
  85. package/runtime/hub/apps/hub/{chunk-23AU7VYS.js → chunk-BARD2DI6.js} +11 -3
  86. package/runtime/hub/apps/hub/{chunk-V3OMPMI3.js → chunk-QSMPSV5Z.js} +70 -21
  87. package/runtime/hub/apps/hub/{chunk-GARA7RQW.js → chunk-XZZXPEVV.js} +57 -36
  88. package/runtime/hub/apps/hub/{dist-WZKTIA2R.js → dist-3ENKQN5G.js} +35 -365
  89. package/runtime/hub/apps/hub/{dist-TP4SXMDY.js → dist-6VGJOQYK.js} +84 -43
  90. package/runtime/hub/apps/hub/{dist-JVU3QCLG.js → dist-AE6IV4FV.js} +4 -4
  91. package/runtime/hub/apps/hub/{dist-IZ2JCN5R.js → dist-EQV4L7KP.js} +3 -1
  92. package/runtime/hub/apps/hub/dist-NNBELNA7.js +1017 -0
  93. package/runtime/hub/apps/hub/{dist-DZGSA3US.js → dist-RJJ2SDYO.js} +4 -4
  94. package/runtime/hub/apps/hub/{dist-VWSHZIPN.js → dist-TU7D6UTB.js} +37 -366
  95. package/runtime/hub/apps/hub/{dist-YWY2DSSL.js → dist-WAZKGVYL.js} +7 -3
  96. package/runtime/hub/apps/hub/{hub-token-BJG6Q5II.js → hub-token-COBZGSLS.js} +2 -2
  97. package/runtime/hub/apps/hub/package.json +1 -0
  98. package/runtime/hub/apps/hub/{prepared-state-75DIZ55S-JDILR4OP.js → prepared-state-75DIZ55S-NYEDSU2U.js} +1 -1
  99. package/runtime/hub/apps/hub/server.js +20 -16
  100. package/runtime/relay/bin.cjs +57 -20
  101. package/runtime/vercel/ctl.cjs +83 -36
  102. package/dist/chunk-3BR63LCB.js.map +0 -1
  103. package/dist/chunk-3PSRBK24.js.map +0 -1
  104. package/dist/chunk-4DBLYT2F.js.map +0 -1
  105. package/dist/chunk-4LS2TOF3.js.map +0 -1
  106. package/dist/chunk-5F5SOSDY.js.map +0 -1
  107. package/runtime/hub/apps/hub/.next/server/chunks/0zhp_better-auth_dist_adapters_kysely-adapter_index_mjs_1rl4qnh._.js +0 -3
  108. /package/dist/{_cloud-attach-FGMI2ZHO.js.map → _cloud-attach-7WRQH6XZ.js.map} +0 -0
  109. /package/dist/{chunk-5VNL6SHJ.js.map → chunk-7ZZAZPYX.js.map} +0 -0
  110. /package/dist/{chunk-ZTSVY3YL.js.map → chunk-BA2VLJVU.js.map} +0 -0
  111. /package/dist/{chunk-6GZK74GT.js.map → chunk-DQHMDDAT.js.map} +0 -0
  112. /package/dist/{chunk-67VF2QZC.js.map → chunk-K5KOLYIL.js.map} +0 -0
  113. /package/dist/{dist-4I7XHDC3.js.map → dist-DTNYMBQ5.js.map} +0 -0
  114. /package/dist/{dist-MEK44IS5.js.map → dist-K4LNH3EC.js.map} +0 -0
  115. /package/dist/{dist-AZUD2LUA.js.map → dist-POVRY7HO.js.map} +0 -0
  116. /package/dist/{dist-SBDYDH7H.js.map → dist-U2SVLJUQ.js.map} +0 -0
  117. /package/dist/{dist-SN6ABGMD.js.map → dist-XYY6SIKG.js.map} +0 -0
  118. /package/dist/{prepared-state-75DIZ55S-5UAKJX3L.js.map → prepared-state-75DIZ55S-W6NU3S3B.js.map} +0 -0
  119. /package/runtime/hub/apps/hub/.next/static/{fo5EgsHa6PFLTBagfLiuM → mJYh9UHTsLaGGyRjBSvme}/_buildManifest.js +0 -0
  120. /package/runtime/hub/apps/hub/.next/static/{fo5EgsHa6PFLTBagfLiuM → mJYh9UHTsLaGGyRjBSvme}/_clientMiddlewareManifest.js +0 -0
  121. /package/runtime/hub/apps/hub/.next/static/{fo5EgsHa6PFLTBagfLiuM → mJYh9UHTsLaGGyRjBSvme}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},96253,(e,t,r)=>{"use strict";t.exports=e.r(18622)},85132,(e,t,r)=>{"use strict";t.exports=e.r(96253).vendored["react-rsc"].React},86109,(e,t,r)=>{"use strict";var n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i={},u={RequestCookies:()=>g,ResponseCookies:()=>h,parseCookie:()=>p,parseSetCookie:()=>d,stringifyCookie:()=>c};for(var l in u)n(i,l,{get:u[l],enumerable:!0});function c(e){var t;let r=["path"in e&&e.path&&`Path=${e.path}`,"expires"in e&&(e.expires||0===e.expires)&&`Expires=${("number"==typeof e.expires?new Date(e.expires):e.expires).toUTCString()}`,"maxAge"in e&&"number"==typeof e.maxAge&&`Max-Age=${e.maxAge}`,"domain"in e&&e.domain&&`Domain=${e.domain}`,"secure"in e&&e.secure&&"Secure","httpOnly"in e&&e.httpOnly&&"HttpOnly","sameSite"in e&&e.sameSite&&`SameSite=${e.sameSite}`,"partitioned"in e&&e.partitioned&&"Partitioned","priority"in e&&e.priority&&`Priority=${e.priority}`].filter(Boolean),n=`${e.name}=${encodeURIComponent(null!=(t=e.value)?t:"")}`;return 0===r.length?n:`${n}; ${r.join("; ")}`}function p(e){let t=new Map;for(let r of e.split(/; */)){if(!r)continue;let e=r.indexOf("=");if(-1===e){t.set(r,"true");continue}let[n,o]=[r.slice(0,e),r.slice(e+1)];try{t.set(n,decodeURIComponent(null!=o?o:"true"))}catch{}}return t}function d(e){if(!e)return;let[[t,r],...n]=p(e),{domain:o,expires:s,httponly:a,maxage:i,path:u,samesite:l,secure:c,partitioned:d,priority:g}=Object.fromEntries(n.map(([e,t])=>[e.toLowerCase().replace(/-/g,""),t]));{var h,b,v={name:t,value:decodeURIComponent(r),domain:o,...s&&{expires:new Date(s)},...a&&{httpOnly:!0},..."string"==typeof i&&{maxAge:Number(i)},path:u,...l&&{sameSite:f.includes(h=(h=l).toLowerCase())?h:void 0},...c&&{secure:!0},...g&&{priority:m.includes(b=(b=g).toLowerCase())?b:void 0},...d&&{partitioned:!0}};let e={};for(let t in v)v[t]&&(e[t]=v[t]);return e}}t.exports=((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of s(t))a.call(e,i)||void 0===i||n(e,i,{get:()=>t[i],enumerable:!(r=o(t,i))||r.enumerable});return e})(n({},"__esModule",{value:!0}),i);var f=["strict","lax","none"],m=["low","medium","high"],g=class{constructor(e){this._parsed=new Map,this._headers=e;const t=e.get("cookie");if(t)for(const[e,r]of p(t))this._parsed.set(e,{name:e,value:r})}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed);if(!e.length)return r.map(([e,t])=>t);let n="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(([e])=>e===n).map(([e,t])=>t)}has(e){return this._parsed.has(e)}set(...e){let[t,r]=1===e.length?[e[0].name,e[0].value]:e,n=this._parsed;return n.set(t,{name:t,value:r}),this._headers.set("cookie",Array.from(n).map(([e,t])=>c(t)).join("; ")),this}delete(e){let t=this._parsed,r=Array.isArray(e)?e.map(e=>t.delete(e)):t.delete(e);return this._headers.set("cookie",Array.from(t).map(([e,t])=>c(t)).join("; ")),r}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(e=>`${e.name}=${encodeURIComponent(e.value)}`).join("; ")}},h=class{constructor(e){var t,r,n;this._parsed=new Map,this._headers=e;const o=null!=(n=null!=(r=null==(t=e.getSetCookie)?void 0:t.call(e))?r:e.get("set-cookie"))?n:[];for(const e of Array.isArray(o)?o:function(e){if(!e)return[];var t,r,n,o,s,a=[],i=0;function u(){for(;i<e.length&&/\s/.test(e.charAt(i));)i+=1;return i<e.length}for(;i<e.length;){for(t=i,s=!1;u();)if(","===(r=e.charAt(i))){for(n=i,i+=1,u(),o=i;i<e.length&&"="!==(r=e.charAt(i))&&";"!==r&&","!==r;)i+=1;i<e.length&&"="===e.charAt(i)?(s=!0,i=o,a.push(e.substring(t,n)),t=i):i=n+1}else i+=1;(!s||i>=e.length)&&a.push(e.substring(t,e.length))}return a}(o)){const t=d(e);t&&this._parsed.set(t.name,t)}}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed.values());if(!e.length)return r;let n="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(e=>e.name===n)}has(e){return this._parsed.has(e)}set(...e){let[t,r,n]=1===e.length?[e[0].name,e[0].value,e[0]]:e,o=this._parsed;return o.set(t,function(e={name:"",value:""}){return"number"==typeof e.expires&&(e.expires=new Date(e.expires)),e.maxAge&&(e.expires=new Date(Date.now()+1e3*e.maxAge)),(null===e.path||void 0===e.path)&&(e.path="/"),e}({name:t,value:r,...n})),function(e,t){for(let[,r]of(t.delete("set-cookie"),e)){let e=c(r);t.append("set-cookie",e)}}(o,this._headers),this}delete(...e){let[t,r]="string"==typeof e[0]?[e[0]]:[e[0].name,e[0]];return this.set({...r,name:t,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(c).join("; ")}}},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},54799,(e,t,r)=>{t.exports=e.x("crypto",()=>require("crypto"))},24868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},5365,(e,t,r)=>{t.exports=e.x("process",()=>require("process"))},874,(e,t,r)=>{t.exports=e.x("buffer",()=>require("buffer"))},53733,e=>{"use strict";let t={invalid_request:400,unauthorized:401,not_found:404,conflict:409,backend_unavailable:503,internal:500};function r(e,r,n){let o=t[e];return Response.json({error:{code:e,message:r,...void 0===n?{}:{details:n}}},{status:o})}e.s(["fail",0,r,"failFromAction",0,function(e){return r(/\b(not found|no such|does not exist)\b/i.test(e)||/\bunknown (project|box)\b/i.test(e)||/no pending approval/i.test(e)?"not_found":"conflict",e)},"ok",0,function(e,t=200){return Response.json(e,{status:t})}])},82477,e=>{"use strict";var t=e.i(89551);function r(e){if(e.originUrl){let t=e.originUrl.replace(/\.git$/,"").split(/[/:]/).pop();if(t)return t}return e.name}function n(e){var t;return t=e.originUrl??e.name,Buffer.from(t).toString("base64url")}function o(e){return{claude:e?.claude,codex:e?.codex,opencode:e?.opencode}}function s(e){if(!e)return"stopped";let{claude:t,codex:r,opencode:n}=o(e);return[t?.state,r?.state,n?.state].includes("error")?"error":t?.sessionRunning||r?.sessionRunning||n?.sessionRunning?"running":"stopped"}let a=null;async function i(){var t;let i=process.env.POSTGRES_URL??process.env.RELAY_STORE_URL;if(!i)throw Error("hub: POSTGRES_URL required for the hosted source");let u=await (!a&&(a=(async()=>{let{PostgresStore:t}=await e.A(59249),r=new t({connectionString:i});return await r.migrate(),r})().catch(e=>{throw a=null,e})),a),l=await u.listBoxes(),c=new Map((await u.listStatuses()).map(e=>[e.boxId,e.status])),p=[];for(let e of l)for(let r of(await u.listPendingPrompts(e.boxId)))p.push((t=e.boxId,{id:r.ev.id,boxId:t,message:r.ev.message,detail:r.ev.detail,command:r.ev.context?.command,cwd:r.ev.context?.cwd,argv:r.ev.context?.argv,defaultAnswer:r.ev.defaultAnswer??"n",createdAt:Date.parse(r.createdAt)||Date.now()}));return{user:{login:"hub",name:"hub"},github:{available:!1,installed:!1,appName:"GitHub App",account:"",installedAt:0,repos:[]},projects:function(e){let t=new Map;for(let o of e){let e=n(o),s=Date.parse(o.createdAt??o.registeredAt)||Date.now(),a=t.get(e);a?s<a.createdAt&&(a.createdAt=s):t.set(e,{key:e,name:r(o),createdAt:s})}return[...t.values()].map(e=>({id:e.key,name:e.name,repo:e.name,defaultBranch:"main",provider:"cloud",createdAt:e.createdAt})).sort((e,t)=>t.createdAt-e.createdAt)}(l),boxes:l.map(e=>(function(e,t){let{claude:a,codex:i,opencode:u}=o(t),l=Date.parse(e.createdAt??e.registeredAt)||Date.now();return{id:e.boxId,projectId:n(e),repo:r(e),branch:e.worktrees?.[0]?.branch??"",task:a?.sessionTitle??i?.sessionTitle??u?.sessionTitle??e.name,agent:i?.sessionRunning?"codex":u?.sessionRunning?"opencode":"claude",status:s(t),createdAt:l,lastActivity:l,host:e.backend?`${e.kind??"cloud"} \xb7 ${e.backend}`:e.kind??"cloud",provider:e.kind??"docker",commits:null,filesTouched:null,error:"error"===s(t)?a?.sessionTitle??"Agent reported an error":null,webUrl:null,vncUrl:null}})(e,c.get(e.boxId))),approvals:p,providers:[]}}async function u(){let e=globalThis.__AGENTBOX_HUB_BACKEND;return e?{...await e.getData(),authMode:(0,t.authMode)()}:process.env.POSTGRES_URL??process.env.RELAY_STORE_URL?{...await i(),authMode:(0,t.authMode)()}:{user:{login:"user",name:"user"},github:{available:!1,installed:!1,appName:"GitHub App",account:"",installedAt:0,repos:[]},projects:[],boxes:[],approvals:[],providers:[],authMode:(0,t.authMode)()}}async function l(){return u()}e.s(["backendOrNull",0,function(){return globalThis.__AGENTBOX_HUB_BACKEND??null},"readState",0,l],82477)},49714,e=>{"use strict";let t=["claude","codex","opencode","none"],r=["docker","daytona","hetzner","vercel","e2b","digitalocean"],n=["start","pause","resume","stop","destroy","screen"];function o(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let s=["checkout","branch","pull","push","push-host"],a=["claude","codex","herdr","cmux","vscode","iterm2","finder"];function i(e,t){return void 0===e?{ok:!0,value:void 0}:"string"!=typeof e?{ok:!1,message:`${t} must be a string`}:{ok:!0,value:e}}function u(e,t){return void 0===e?{ok:!0,value:void 0}:"boolean"!=typeof e?{ok:!1,message:`${t} must be a boolean`}:{ok:!0,value:e}}async function l(e){let t=await e.text();if(0===t.trim().length)return{ok:!0,value:{}};try{return{ok:!0,value:JSON.parse(t)}}catch{return{ok:!1,message:"body is not valid JSON"}}}e.s(["GIT_OPS",0,s,"LIFECYCLE_ACTIONS",0,n,"isGitOp",0,function(e){return s.includes(e)},"isLifecycleAction",0,function(e){return n.includes(e)},"isProviderId",0,function(e){return r.includes(e)},"parseAnswer",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{answer:t}=e;return"y"!==t&&"n"!==t?{ok:!1,message:"answer must be 'y' or 'n'"}:{ok:!0,value:t}},"parseCreateBox",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{projectId:n,agent:s,provider:a,name:l,prompt:c,fromBranch:p,setupWizard:d}=e;if("string"!=typeof n||0===n.length)return{ok:!1,message:"projectId is required (string)"};if("string"!=typeof s||!t.includes(s))return{ok:!1,message:`agent must be one of ${t.join(", ")}`,details:{got:s}};if(void 0!==a&&("string"!=typeof a||!r.includes(a)))return{ok:!1,message:`provider must be one of ${r.join(", ")}`,details:{got:a}};if(void 0!==l&&"string"!=typeof l)return{ok:!1,message:"name must be a string"};if(void 0!==c&&"string"!=typeof c)return{ok:!1,message:"prompt must be a string"};let f=i(p,"fromBranch");if(!f.ok)return f;let m=u(d,"setupWizard");return m.ok?{ok:!0,value:{projectId:n,agent:s,provider:a,name:l,prompt:c,fromBranch:f.value,setupWizard:m.value}}:m},"parseGitBranch",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{name:t,from:r}=e;if("string"!=typeof t||0===t.trim().length)return{ok:!1,message:"name is required (non-empty string)"};let n=i(r,"from");return n.ok?{ok:!0,value:{name:t,from:n.value}}:n},"parseGitCheckout",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{branch:t}=e;return"string"!=typeof t||0===t.trim().length?{ok:!1,message:"branch is required (non-empty string)"}:{ok:!0,value:{branch:t}}},"parseGitPull",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t=i(e.remote,"remote");if(!t.ok)return t;let r=u(e.ffOnly,"ffOnly");return r.ok?{ok:!0,value:{remote:t.value,ffOnly:r.value}}:r},"parseGitPush",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t=i(e.remote,"remote");if(!t.ok)return t;let r=u(e.force,"force");return r.ok?{ok:!0,value:{remote:t.value,force:r.value}}:r},"parseGitPushHost",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t=i(e.as,"as");if(!t.ok)return t;let r=u(e.force,"force");return r.ok?{ok:!0,value:{as:t.value,force:r.value}}:r},"parseLoginCode",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{code:t}=e;return"string"!=typeof t||0===t.trim().length?{ok:!1,message:"code is required (non-empty string)"}:{ok:!0,value:{code:t.trim()}}},"parseOpenIn",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{app:t}=e;return"string"==typeof t&&a.includes(t)?{ok:!0,value:{app:t}}:{ok:!1,message:`app must be one of ${a.join(", ")}`,details:{got:t}}},"parseProject",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{path:t}=e;return"string"!=typeof t||0===t.length?{ok:!1,message:"path is required (absolute directory path)"}:{ok:!0,value:{path:t}}},"parseProviderCredentials",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t={};for(let[r,n]of Object.entries(e)){if("string"!=typeof n)return{ok:!1,message:`field ${r} must be a string`};t[r]=n}return 0===Object.keys(t).length?{ok:!1,message:"at least one credential field is required"}:{ok:!0,value:t}},"parseProviderPrepare",0,function(e){if(null==e)return{ok:!0,value:{}};if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{force:t,claudeInstall:r}=e,n=u(t,"force");return n.ok?void 0!==r&&"native"!==r&&"npm"!==r?{ok:!1,message:"claudeInstall must be 'native' or 'npm'"}:{ok:!0,value:{force:n.value,claudeInstall:r}}:n},"parseRenameBox",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{displayName:t}=e;return"string"!=typeof t?{ok:!1,message:"displayName is required (string; empty string clears the label)"}:t.trim().length>60?{ok:!1,message:"displayName too long (max 60 chars)"}:{ok:!0,value:{displayName:t}}},"parseServiceRestart",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t=i(e.name,"name");return t.ok?{ok:!0,value:{name:t.value}}:t},"readJson",0,l])}];
1
+ module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},96253,(e,t,r)=>{"use strict";t.exports=e.r(18622)},85132,(e,t,r)=>{"use strict";t.exports=e.r(96253).vendored["react-rsc"].React},86109,(e,t,r)=>{"use strict";var n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i={},u={RequestCookies:()=>g,ResponseCookies:()=>h,parseCookie:()=>p,parseSetCookie:()=>d,stringifyCookie:()=>c};for(var l in u)n(i,l,{get:u[l],enumerable:!0});function c(e){var t;let r=["path"in e&&e.path&&`Path=${e.path}`,"expires"in e&&(e.expires||0===e.expires)&&`Expires=${("number"==typeof e.expires?new Date(e.expires):e.expires).toUTCString()}`,"maxAge"in e&&"number"==typeof e.maxAge&&`Max-Age=${e.maxAge}`,"domain"in e&&e.domain&&`Domain=${e.domain}`,"secure"in e&&e.secure&&"Secure","httpOnly"in e&&e.httpOnly&&"HttpOnly","sameSite"in e&&e.sameSite&&`SameSite=${e.sameSite}`,"partitioned"in e&&e.partitioned&&"Partitioned","priority"in e&&e.priority&&`Priority=${e.priority}`].filter(Boolean),n=`${e.name}=${encodeURIComponent(null!=(t=e.value)?t:"")}`;return 0===r.length?n:`${n}; ${r.join("; ")}`}function p(e){let t=new Map;for(let r of e.split(/; */)){if(!r)continue;let e=r.indexOf("=");if(-1===e){t.set(r,"true");continue}let[n,o]=[r.slice(0,e),r.slice(e+1)];try{t.set(n,decodeURIComponent(null!=o?o:"true"))}catch{}}return t}function d(e){if(!e)return;let[[t,r],...n]=p(e),{domain:o,expires:s,httponly:a,maxage:i,path:u,samesite:l,secure:c,partitioned:d,priority:g}=Object.fromEntries(n.map(([e,t])=>[e.toLowerCase().replace(/-/g,""),t]));{var h,b,v={name:t,value:decodeURIComponent(r),domain:o,...s&&{expires:new Date(s)},...a&&{httpOnly:!0},..."string"==typeof i&&{maxAge:Number(i)},path:u,...l&&{sameSite:f.includes(h=(h=l).toLowerCase())?h:void 0},...c&&{secure:!0},...g&&{priority:m.includes(b=(b=g).toLowerCase())?b:void 0},...d&&{partitioned:!0}};let e={};for(let t in v)v[t]&&(e[t]=v[t]);return e}}t.exports=((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of s(t))a.call(e,i)||void 0===i||n(e,i,{get:()=>t[i],enumerable:!(r=o(t,i))||r.enumerable});return e})(n({},"__esModule",{value:!0}),i);var f=["strict","lax","none"],m=["low","medium","high"],g=class{constructor(e){this._parsed=new Map,this._headers=e;const t=e.get("cookie");if(t)for(const[e,r]of p(t))this._parsed.set(e,{name:e,value:r})}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed);if(!e.length)return r.map(([e,t])=>t);let n="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(([e])=>e===n).map(([e,t])=>t)}has(e){return this._parsed.has(e)}set(...e){let[t,r]=1===e.length?[e[0].name,e[0].value]:e,n=this._parsed;return n.set(t,{name:t,value:r}),this._headers.set("cookie",Array.from(n).map(([e,t])=>c(t)).join("; ")),this}delete(e){let t=this._parsed,r=Array.isArray(e)?e.map(e=>t.delete(e)):t.delete(e);return this._headers.set("cookie",Array.from(t).map(([e,t])=>c(t)).join("; ")),r}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(e=>`${e.name}=${encodeURIComponent(e.value)}`).join("; ")}},h=class{constructor(e){var t,r,n;this._parsed=new Map,this._headers=e;const o=null!=(n=null!=(r=null==(t=e.getSetCookie)?void 0:t.call(e))?r:e.get("set-cookie"))?n:[];for(const e of Array.isArray(o)?o:function(e){if(!e)return[];var t,r,n,o,s,a=[],i=0;function u(){for(;i<e.length&&/\s/.test(e.charAt(i));)i+=1;return i<e.length}for(;i<e.length;){for(t=i,s=!1;u();)if(","===(r=e.charAt(i))){for(n=i,i+=1,u(),o=i;i<e.length&&"="!==(r=e.charAt(i))&&";"!==r&&","!==r;)i+=1;i<e.length&&"="===e.charAt(i)?(s=!0,i=o,a.push(e.substring(t,n)),t=i):i=n+1}else i+=1;(!s||i>=e.length)&&a.push(e.substring(t,e.length))}return a}(o)){const t=d(e);t&&this._parsed.set(t.name,t)}}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed.values());if(!e.length)return r;let n="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(e=>e.name===n)}has(e){return this._parsed.has(e)}set(...e){let[t,r,n]=1===e.length?[e[0].name,e[0].value,e[0]]:e,o=this._parsed;return o.set(t,function(e={name:"",value:""}){return"number"==typeof e.expires&&(e.expires=new Date(e.expires)),e.maxAge&&(e.expires=new Date(Date.now()+1e3*e.maxAge)),(null===e.path||void 0===e.path)&&(e.path="/"),e}({name:t,value:r,...n})),function(e,t){for(let[,r]of(t.delete("set-cookie"),e)){let e=c(r);t.append("set-cookie",e)}}(o,this._headers),this}delete(...e){let[t,r]="string"==typeof e[0]?[e[0]]:[e[0].name,e[0]];return this.set({...r,name:t,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(c).join("; ")}}},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},54799,(e,t,r)=>{t.exports=e.x("crypto",()=>require("crypto"))},24868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},5365,(e,t,r)=>{t.exports=e.x("process",()=>require("process"))},874,(e,t,r)=>{t.exports=e.x("buffer",()=>require("buffer"))},53733,e=>{"use strict";let t={invalid_request:400,unauthorized:401,not_found:404,conflict:409,backend_unavailable:503,internal:500};function r(e,r,n){let o=t[e];return Response.json({error:{code:e,message:r,...void 0===n?{}:{details:n}}},{status:o})}e.s(["fail",0,r,"failFromAction",0,function(e){return r(/\b(not found|no such|does not exist)\b/i.test(e)||/\bunknown (project|box)\b/i.test(e)||/no pending approval/i.test(e)?"not_found":"conflict",e)},"ok",0,function(e,t=200){return Response.json(e,{status:t})}])},82477,e=>{"use strict";var t=e.i(89551);function r(e){if(e.originUrl){let t=e.originUrl.replace(/\.git$/,"").split(/[/:]/).pop();if(t)return t}return e.name}function n(e){var t;return t=e.originUrl??e.name,Buffer.from(t).toString("base64url")}function o(e){return{claude:e?.claude,codex:e?.codex,opencode:e?.opencode}}function s(e){if(!e)return"stopped";let{claude:t,codex:r,opencode:n}=o(e);return[t?.state,r?.state,n?.state].includes("error")?"error":t?.sessionRunning||r?.sessionRunning||n?.sessionRunning?"running":"stopped"}let a=null;async function i(){var t;let i=process.env.POSTGRES_URL??process.env.RELAY_STORE_URL;if(!i)throw Error("hub: POSTGRES_URL required for the hosted source");let u=await (!a&&(a=(async()=>{let{PostgresStore:t}=await e.A(59249),r=new t({connectionString:i});return await r.migrate(),r})().catch(e=>{throw a=null,e})),a),l=await u.listBoxes(),c=new Map((await u.listStatuses()).map(e=>[e.boxId,e.status])),p=[];for(let e of l)for(let r of(await u.listPendingPrompts(e.boxId)))p.push((t=e.boxId,{id:r.ev.id,boxId:t,message:r.ev.message,detail:r.ev.detail,command:r.ev.context?.command,cwd:r.ev.context?.cwd,argv:r.ev.context?.argv,defaultAnswer:r.ev.defaultAnswer??"n",createdAt:Date.parse(r.createdAt)||Date.now()}));return{user:{login:"hub",name:"hub"},github:{available:!1,installed:!1,appName:"GitHub App",account:"",installedAt:0,repos:[]},projects:function(e){let t=new Map;for(let o of e){let e=n(o),s=Date.parse(o.createdAt??o.registeredAt)||Date.now(),a=t.get(e);a?s<a.createdAt&&(a.createdAt=s):t.set(e,{key:e,name:r(o),createdAt:s})}return[...t.values()].map(e=>({id:e.key,name:e.name,repo:e.name,defaultBranch:"main",provider:"cloud",createdAt:e.createdAt})).sort((e,t)=>t.createdAt-e.createdAt)}(l),boxes:l.map(e=>(function(e,t){let{claude:a,codex:i,opencode:u}=o(t),l=Date.parse(e.createdAt??e.registeredAt)||Date.now();return{id:e.boxId,projectId:n(e),repo:r(e),branch:e.worktrees?.[0]?.branch??"",task:a?.sessionTitle??i?.sessionTitle??u?.sessionTitle??e.name,agent:i?.sessionRunning?"codex":u?.sessionRunning?"opencode":"claude",status:s(t),createdAt:l,lastActivity:l,host:e.backend?`${e.kind??"cloud"} \xb7 ${e.backend}`:e.kind??"cloud",provider:e.kind??"docker",commits:null,filesTouched:null,error:"error"===s(t)?a?.sessionTitle??"Agent reported an error":null,webUrl:null,vncUrl:null}})(e,c.get(e.boxId))),approvals:p,providers:[]}}async function u(){let e=globalThis.__AGENTBOX_HUB_BACKEND;return e?{...await e.getData(),authMode:(0,t.authMode)()}:process.env.POSTGRES_URL??process.env.RELAY_STORE_URL?{...await i(),authMode:(0,t.authMode)()}:{user:{login:"user",name:"user"},github:{available:!1,installed:!1,appName:"GitHub App",account:"",installedAt:0,repos:[]},projects:[],boxes:[],approvals:[],providers:[],authMode:(0,t.authMode)()}}async function l(){return u()}e.s(["backendOrNull",0,function(){return globalThis.__AGENTBOX_HUB_BACKEND??null},"readState",0,l],82477)},49714,e=>{"use strict";let t=["claude","codex","opencode","none"],r=["docker","daytona","hetzner","vercel","e2b","digitalocean","remote-docker"],n=["start","pause","resume","stop","destroy","screen"];function o(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let s=["checkout","branch","pull","push","push-host"],a=["claude","codex","herdr","cmux","vscode","iterm2","finder"];function i(e,t){return void 0===e?{ok:!0,value:void 0}:"string"!=typeof e?{ok:!1,message:`${t} must be a string`}:{ok:!0,value:e}}function u(e,t){return void 0===e?{ok:!0,value:void 0}:"boolean"!=typeof e?{ok:!1,message:`${t} must be a boolean`}:{ok:!0,value:e}}async function l(e){let t=await e.text();if(0===t.trim().length)return{ok:!0,value:{}};try{return{ok:!0,value:JSON.parse(t)}}catch{return{ok:!1,message:"body is not valid JSON"}}}e.s(["GIT_OPS",0,s,"LIFECYCLE_ACTIONS",0,n,"isGitOp",0,function(e){return s.includes(e)},"isLifecycleAction",0,function(e){return n.includes(e)},"isProviderId",0,function(e){return r.includes(e)},"parseAnswer",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{answer:t}=e;return"y"!==t&&"n"!==t?{ok:!1,message:"answer must be 'y' or 'n'"}:{ok:!0,value:t}},"parseCreateBox",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{projectId:n,agent:s,provider:a,name:l,prompt:c,fromBranch:p,setupWizard:d}=e;if("string"!=typeof n||0===n.length)return{ok:!1,message:"projectId is required (string)"};if("string"!=typeof s||!t.includes(s))return{ok:!1,message:`agent must be one of ${t.join(", ")}`,details:{got:s}};if(void 0!==a&&("string"!=typeof a||!r.includes(a)))return{ok:!1,message:`provider must be one of ${r.join(", ")}`,details:{got:a}};if(void 0!==l&&"string"!=typeof l)return{ok:!1,message:"name must be a string"};if(void 0!==c&&"string"!=typeof c)return{ok:!1,message:"prompt must be a string"};let f=i(p,"fromBranch");if(!f.ok)return f;let m=u(d,"setupWizard");return m.ok?{ok:!0,value:{projectId:n,agent:s,provider:a,name:l,prompt:c,fromBranch:f.value,setupWizard:m.value}}:m},"parseGitBranch",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{name:t,from:r}=e;if("string"!=typeof t||0===t.trim().length)return{ok:!1,message:"name is required (non-empty string)"};let n=i(r,"from");return n.ok?{ok:!0,value:{name:t,from:n.value}}:n},"parseGitCheckout",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{branch:t}=e;return"string"!=typeof t||0===t.trim().length?{ok:!1,message:"branch is required (non-empty string)"}:{ok:!0,value:{branch:t}}},"parseGitPull",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t=i(e.remote,"remote");if(!t.ok)return t;let r=u(e.ffOnly,"ffOnly");return r.ok?{ok:!0,value:{remote:t.value,ffOnly:r.value}}:r},"parseGitPush",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t=i(e.remote,"remote");if(!t.ok)return t;let r=u(e.force,"force");return r.ok?{ok:!0,value:{remote:t.value,force:r.value}}:r},"parseGitPushHost",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t=i(e.as,"as");if(!t.ok)return t;let r=u(e.force,"force");return r.ok?{ok:!0,value:{as:t.value,force:r.value}}:r},"parseLoginCode",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{code:t}=e;return"string"!=typeof t||0===t.trim().length?{ok:!1,message:"code is required (non-empty string)"}:{ok:!0,value:{code:t.trim()}}},"parseOpenIn",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{app:t}=e;return"string"==typeof t&&a.includes(t)?{ok:!0,value:{app:t}}:{ok:!1,message:`app must be one of ${a.join(", ")}`,details:{got:t}}},"parseProject",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{path:t}=e;return"string"!=typeof t||0===t.length?{ok:!1,message:"path is required (absolute directory path)"}:{ok:!0,value:{path:t}}},"parseProviderCredentials",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t={};for(let[r,n]of Object.entries(e)){if("string"!=typeof n)return{ok:!1,message:`field ${r} must be a string`};t[r]=n}return 0===Object.keys(t).length?{ok:!1,message:"at least one credential field is required"}:{ok:!0,value:t}},"parseProviderPrepare",0,function(e){if(null==e)return{ok:!0,value:{}};if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{force:t,claudeInstall:r}=e,n=u(t,"force");return n.ok?void 0!==r&&"native"!==r&&"npm"!==r?{ok:!1,message:"claudeInstall must be 'native' or 'npm'"}:{ok:!0,value:{force:n.value,claudeInstall:r}}:n},"parseRenameBox",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let{displayName:t}=e;return"string"!=typeof t?{ok:!1,message:"displayName is required (string; empty string clears the label)"}:t.trim().length>60?{ok:!1,message:"displayName too long (max 60 chars)"}:{ok:!0,value:{displayName:t}}},"parseServiceRestart",0,function(e){if(!o(e))return{ok:!1,message:"body must be a JSON object"};let t=i(e.name,"name");return t.ok?{ok:!0,value:{name:t.value}}:t},"readJson",0,l])}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__0keu6we._.js.map
@@ -59,7 +59,7 @@ module.exports=[2157,(e,t,r)=>{t.exports=e.x("node:fs",()=>require("node:fs"))},
59
59
 
60
60
  `)}t.write("payload.value = newResult;"),t.write("return payload;");let s=t.compile();return(t,r)=>s(e,t,r)})(t.shape)),l=r(l,d),c)?r4([],u,l,d,n,e):l:i(l,d):(l.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),l)}});function r9(e,t,r,n){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;let i=e.filter(e=>!e0(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>e6(e,n,eT())))}),t)}let r7=e_("$ZodUnion",(e,t)=>{rA.init(e,t),e$(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),e$(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),e$(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),e$(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>eC(e.source)).join("|")})$`)}});let r=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(n,i)=>{if(r)return r(n,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:n.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(0===t.issues.length)return t;o.push(t)}}return a?Promise.all(o).then(t=>r9(t,n,e,i)):r9(o,n,e,i)}});function ne(e,t,r,n){let i=e.filter(e=>0===e.issues.length);return 1===i.length?t.value=i[0].value:0===i.length?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>e6(e,n,eT())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t}(e,t)=>{r7.init(e,t),t.inclusive=!1;let r=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(n,i)=>{if(r)return r(n,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:n.value,issues:[]},i);t instanceof Promise?(o.push(t),a=!0):o.push(t)}return a?Promise.all(o).then(t=>ne(t,n,e,i)):ne(o,n,e,i)}},(e,t)=>{t.inclusive=!1,r7.init(e,t);let r=e._zod.parse;e$(e._zod,"propValues",()=>{let e={};for(let r of t.options){let n=r._zod.propValues;if(!n||0===Object.keys(n).length)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let[t,r]of Object.entries(n))for(let n of(e[t]||(e[t]=new Set),r))e[t].add(n)}return e});let n=eO(()=>{let e=t.options,r=new Map;for(let n of e){let e=n._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let t of e){if(r.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,n)}}return r});e._zod.parse=(i,a)=>{let o=i.value;if(!eq(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:e}),i;let s=n.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||"backward"===a.direction?r(i,a):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}};let nt=e_("$ZodIntersection",(e,t)=>{rA.init(e,t),e._zod.parse=(e,r)=>{let n=e.value,i=t.left._zod.run({value:n,issues:[]},r),a=t.right._zod.run({value:n,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,r])=>nr(e,t,r)):nr(e,i,a)}});function nr(e,t,r){let n,i=new Map;for(let r of t.issues)if("unrecognized_keys"===r.code)for(let e of(n??(n=r),r.keys))i.has(e)||i.set(e,{}),i.get(e).l=!0;else e.issues.push(r);for(let t of r.issues)if("unrecognized_keys"===t.code)for(let e of t.keys)i.has(e)||i.set(e,{}),i.get(e).r=!0;else e.issues.push(t);let a=[...i].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&n&&e.issues.push({...n,keys:a}),e0(e))return e;let o=function e(t,r){if(t===r||t instanceof Date&&r instanceof Date&&+t==+r)return{valid:!0,data:t};if(eV(t)&&eV(r)){let n=Object.keys(r),i=Object.keys(t).filter(e=>-1!==n.indexOf(e)),a={...t,...r};for(let n of i){let i=e(t[n],r[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};a[n]=i.data}return{valid:!0,data:a}}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let i=0;i<t.length;i++){let a=e(t[i],r[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}(t.value,r.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}let nn=e_("$ZodTuple",(e,t)=>{rA.init(e,t);let r=t.items;e._zod.parse=(n,i)=>{let a=n.value;if(!Array.isArray(a))return n.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let o=[],s=ni(r,"optin"),c=ni(r,"optout");if(!t.rest){if(a.length<s)return n.issues.push({code:"too_small",minimum:s,inclusive:!0,input:a,inst:e,origin:"array"}),n;a.length>r.length&&n.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:a,inst:e,origin:"array"})}let l=Array(r.length);for(let e=0;e<r.length;e++){let t=r[e]._zod.run({value:a[e],issues:[]},i);t instanceof Promise?o.push(t.then(t=>{l[e]=t})):l[e]=t}if(t.rest){let e=r.length-1;for(let s of a.slice(r.length)){e++;let r=t.rest._zod.run({value:s,issues:[]},i);r instanceof Promise?o.push(r.then(t=>na(t,n,e))):na(r,n,e)}}return o.length?Promise.all(o).then(()=>no(l,n,r,a,c)):no(l,n,r,a,c)}});function ni(e,t){for(let r=e.length-1;r>=0;r--)if("optional"!==e[r]._zod[t])return r+1;return 0}function na(e,t,r){e.issues.length&&t.issues.push(...e2(r,e.issues)),t.value[r]=e.value}function no(e,t,r,n,i){for(let a=0;a<r.length;a++){let r=e[a],o=a<n.length;if(r.issues.length){if(!o&&a>=i){t.value.length=a;break}t.issues.push(...e2(a,r.issues))}t.value[a]=r.value}for(let e=t.value.length-1;e>=n.length;e--)if("optional"===r[e]._zod.optout&&void 0===t.value[e])t.value.length=e;else break;return t}let ns=e_("$ZodRecord",(e,t)=>{rA.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!eV(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let a=[],o=t.keyType._zod.values;if(o){let s;r.value={};let c=new Set;for(let s of o)if("string"==typeof s||"number"==typeof s||"symbol"==typeof s){c.add("number"==typeof s?s.toString():s);let o=t.keyType._zod.run({value:s,issues:[]},n);if(o instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(o.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(e=>e6(e,n,eT())),input:s,path:[s],inst:e});continue}let l=o.value,d=t.valueType._zod.run({value:i[s],issues:[]},n);d instanceof Promise?a.push(d.then(e=>{e.issues.length&&r.issues.push(...e2(s,e.issues)),r.value[l]=e.value})):(d.issues.length&&r.issues.push(...e2(s,d.issues)),r.value[l]=d.value)}for(let e in i)c.has(e)||(s=s??[]).push(e);s&&s.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:s})}else for(let o of(r.value={},Reflect.ownKeys(i))){if("__proto__"===o||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},n);if(s instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof o&&tP.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},n);if(e instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===e.issues.length&&(s=e)}if(s.issues.length){"loose"===t.mode?r.value[o]=i[o]:r.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(e=>e6(e,n,eT())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},n);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&r.issues.push(...e2(o,e.issues)),r.value[s.value]=e.value})):(c.issues.length&&r.issues.push(...e2(o,c.issues)),r.value[s.value]=c.value)}return a.length?Promise.all(a).then(()=>r):r}});function nc(e,t,r,n,i,a,o){e.issues.length&&(eK.has(typeof n)?r.issues.push(...e2(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:i,inst:a,issues:e.issues.map(e=>e6(e,o,eT()))})),t.issues.length&&(eK.has(typeof n)?r.issues.push(...e2(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:i,inst:a,key:n,issues:t.issues.map(e=>e6(e,o,eT()))})),r.value.set(e.value,t.value)}function nl(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}(e,t)=>{rA.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let a=[];for(let[o,s]of(r.value=new Map,i)){let c=t.keyType._zod.run({value:o,issues:[]},n),l=t.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||l instanceof Promise?a.push(Promise.all([c,l]).then(([t,a])=>{nc(t,a,r,o,i,e,n)})):nc(c,l,r,o,i,e,n)}return a.length?Promise.all(a).then(()=>r):r}},(e,t)=>{rA.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let a=[];for(let e of(r.value=new Set,i)){let i=t.valueType._zod.run({value:e,issues:[]},n);i instanceof Promise?a.push(i.then(e=>nl(e,r))):nl(i,r)}return a.length?Promise.all(a).then(()=>r):r}};let nd=e_("$ZodEnum",(e,t)=>{rA.init(e,t);let r=eI(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=RegExp(`^(${r.filter(e=>eK.has(typeof e)).map(e=>"string"==typeof e?eF(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{let a=t.value;return n.has(a)||t.issues.push({code:"invalid_value",values:r,input:a,inst:e}),t}}),nu=((e,t)=>{if(rA.init(e,t),0===t.values.length)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=RegExp(`^(${t.values.map(e=>"string"==typeof e?eF(e):e?eF(e.toString()):String(e)).join("|")})$`),e._zod.parse=(n,i)=>{let a=n.value;return r.has(a)||n.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),n}},e_("$ZodTransform",(e,t)=>{rA.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new ex(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(r.value=e,r.fallback=!0,r));if(i instanceof Promise)throw new eS;return r.value=i,r.fallback=!0,r}}));function np(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let nf=e_("$ZodOptional",(e,t)=>{rA.init(e,t),e._zod.optin="optional",e._zod.optout="optional",e$(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),e$(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${eC(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){let n=e.value,i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(e=>np(e,n)):np(i,n)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),nh=e_("$ZodExactOptional",(e,t)=>{nf.init(e,t),e$(e._zod,"values",()=>t.innerType._zod.values),e$(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),nm=e_("$ZodNullable",(e,t)=>{rA.init(e,t),e$(e._zod,"optin",()=>t.innerType._zod.optin),e$(e._zod,"optout",()=>t.innerType._zod.optout),e$(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${eC(e.source)}|null)$`):void 0}),e$(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),ny=e_("$ZodDefault",(e,t)=>{rA.init(e,t),e._zod.optin="optional",e$(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>ng(e,t)):ng(n,t)}});function ng(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let nw=e_("$ZodPrefault",(e,t)=>{rA.init(e,t),e._zod.optin="optional",e$(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),nb=e_("$ZodNonOptional",(e,t)=>{rA.init(e,t),e$(e._zod,"values",()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(t=>nA(t,e)):nA(i,e)}});function nA(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}(e,t)=>{rA.init(e,t),e._zod.parse=(e,r)=>{if("backward"===r.direction)throw new ex("ZodSuccess");let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(t=>(e.value=0===t.issues.length,e)):(e.value=0===n.issues.length,e)}};let nE=e_("$ZodCatch",(e,t)=>{rA.init(e,t),e._zod.optin="optional",e$(e._zod,"optout",()=>t.innerType._zod.optout),e$(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>e6(e,r,eT()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>e6(e,r,eT()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),nv=((e,t)=>{rA.init(e,t),e._zod.parse=(t,r)=>("number"==typeof t.value&&Number.isNaN(t.value)||t.issues.push({input:t.value,inst:e,expected:"nan",code:"invalid_type"}),t)},e_("$ZodPipe",(e,t)=>{rA.init(e,t),e$(e._zod,"values",()=>t.in._zod.values),e$(e._zod,"optin",()=>t.in._zod.optin),e$(e._zod,"optout",()=>t.out._zod.optout),e$(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){let n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>nk(e,t.in,r)):nk(n,t.in,r)}let n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>nk(e,t.out,r)):nk(n,t.out,r)}}));function nk(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}function n_(e,t,r){if(e.issues.length)return e.aborted=!0,e;if("forward"===(r.direction||"forward")){let n=t.transform(e.value,e);return n instanceof Promise?n.then(n=>nS(e,n,t.out,r)):nS(e,n,t.out,r)}{let n=t.reverseTransform(e.value,e);return n instanceof Promise?n.then(n=>nS(e,n,t.in,r)):nS(e,n,t.in,r)}}function nS(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}(e,t)=>{rA.init(e,t),e$(e._zod,"values",()=>t.in._zod.values),e$(e._zod,"optin",()=>t.in._zod.optin),e$(e._zod,"optout",()=>t.out._zod.optout),e$(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("forward"===(r.direction||"forward")){let n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>n_(e,t,r)):n_(n,t,r)}{let n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>n_(e,t,r)):n_(n,t,r)}}},(e,t)=>{nv.init(e,t)};let nx=e_("$ZodReadonly",(e,t)=>{rA.init(e,t),e$(e._zod,"propValues",()=>t.innerType._zod.propValues),e$(e._zod,"values",()=>t.innerType._zod.values),e$(e._zod,"optin",()=>t.innerType?._zod?.optin),e$(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(nR):nR(n)}});function nR(e){return e.value=Object.freeze(e.value),e}(e,t)=>{rA.init(e,t);let r=[];for(let e of t.parts)if("object"==typeof e&&null!==e){if(!e._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);let t=e._zod.pattern instanceof RegExp?e._zod.pattern.source:e._zod.pattern;if(!t)throw Error(`Invalid template literal part: ${e._zod.traits}`);let n=+!!t.startsWith("^"),i=t.endsWith("$")?t.length-1:t.length;r.push(t.slice(n,i))}else if(null===e||eW.has(typeof e))r.push(eF(`${e}`));else throw Error(`Invalid template literal part: ${e}`);e._zod.pattern=RegExp(`^${r.join("")}$`),e._zod.parse=(r,n)=>("string"!=typeof r.value?r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source})),r)},(e,t)=>{rA.init(e,t),e$(e._zod,"innerType",()=>(t._cachedInner||(t._cachedInner=t.getter()),t._cachedInner)),e$(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),e$(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),e$(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),e$(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,r)=>e._zod.innerType._zod.run(t,r)};let nT=e_("$ZodCustom",(e,t)=>{tG.init(e,t),rA.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(t=>nI(t,r,n,e));nI(i,r,n,e)}});function nI(e,t,r,n){if(!e){let e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(e3(e))}}Symbol("ZodOutput"),Symbol("ZodInput");(m=globalThis).__zod_globalRegistry??(m.__zod_globalRegistry=new class e{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});let nU=globalThis.__zod_globalRegistry;function nO(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...eZ(t)})}function nP(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...eZ(t)})}function nC(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...eZ(t)})}function nD(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...eZ(t)})}function nL(e,t){return new tY({check:"less_than",...eZ(t),value:e,inclusive:!1})}function n$(e,t){return new tY({check:"less_than",...eZ(t),value:e,inclusive:!0})}function nz(e,t){return new tX({check:"greater_than",...eZ(t),value:e,inclusive:!1})}function nN(e,t){return new tX({check:"greater_than",...eZ(t),value:e,inclusive:!0})}function nj(e,t){return new t0({check:"multiple_of",...eZ(t),value:e})}function nH(e,t){return new t8({check:"max_length",...eZ(t),maximum:e})}function nB(e,t){return new t3({check:"min_length",...eZ(t),minimum:e})}function nq(e,t){return new t9({check:"length_equals",...eZ(t),length:e})}function nM(e){return new ro({check:"overwrite",tx:e})}e.i(10107);var nV=e.i(2721),nV=nV;function nK(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??nU,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function nW(e,t,r={path:[],schemaPath:[]}){var n;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,r.schemaPath.includes(e)&&(a.cycle=r.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,n);else{let r=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,r,n)}let a=e._zod.parent;a&&(o.ref||(o.ref=a),nW(a,t,n),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),"input"===t.io&&function e(t,r){let n=r??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);let i=t._zod.def;if("transform"===i.type)return!0;if("array"===i.type)return e(i.element,n);if("set"===i.type)return e(i.valueType,n);if("lazy"===i.type)return e(i.getter(),n);if("promise"===i.type||"optional"===i.type||"nonoptional"===i.type||"nullable"===i.type||"readonly"===i.type||"default"===i.type||"prefault"===i.type)return e(i.innerType,n);if("intersection"===i.type)return e(i.left,n)||e(i.right,n);if("record"===i.type||"map"===i.type)return e(i.keyType,n)||e(i.valueType,n);if("pipe"===i.type)return!!t._zod.traits.has("$ZodCodec")||e(i.in,n)||e(i.out,n);if("object"===i.type){for(let t in i.shape)if(e(i.shape[t],n))return!0;return!1}if("union"===i.type){for(let t of i.options)if(e(t,n))return!0;return!1}if("tuple"===i.type){for(let t of i.items)if(e(t,n))return!0;if(i.rest&&e(i.rest,n))return!0}return!1}(e)&&(delete o.schema.examples,delete o.schema.default),"input"===t.io&&"_prefault"in o.schema&&((n=o.schema).default??(n.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function nF(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let t of e.seen.entries()){let r=e.metadataRegistry.get(t[0])?.id;if(r){let e=n.get(r);if(e&&e!==t[0])throw Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(r,t[0])}}let i=t=>{if(t[1].schema.$ref)return;let n=t[1],{ref:i,defId:a}=(t=>{let n="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){let r=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(r)return{ref:i(r)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i("__shared")}#/${n}/${a}`}}if(t[1]===r)return{ref:"#"};let i=`#/${n}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}})(t);n.def={...n.schema},a&&(n.defId=a);let o=n.schema;for(let e in o)delete o[e];o.$ref=i};if("throw"===e.cycles)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
61
61
 
62
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let r of e.seen.entries()){let n=r[1];if(t===r[0]){i(r);continue}if(e.external){let n=e.external.registry.get(r[0])?.id;if(t!==r[0]&&n){i(r);continue}}if(e.metadataRegistry.get(r[0])?.id||n.cycle||n.count>1&&"ref"===e.reused){i(r);continue}}}function nJ(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=t=>{let r=e.seen.get(t);if(null===r.ref)return;let i=r.def??r.schema,a={...i},o=r.ref;if(r.ref=null,o){n(o);let r=e.seen.get(o),s=r.schema;if(s.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)"$ref"!==e&&"allOf"!==e&&(e in a||delete i[e]);if(s.$ref&&r.def)for(let e in i)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(i[e])===JSON.stringify(r.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){n(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:r.path??[]})};for(let t of[...e.seen.entries()].reverse())n(t[0]);let i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let r=e.external.registry.get(t)?.id;if(!r)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(r)}Object.assign(i,r.def??r.schema);let a=e.metadataRegistry.get(t)?.id;void 0!==a&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?i.$defs=o:i.definitions=o);try{let r=JSON.parse(JSON.stringify(i));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:nZ(t,"input",e.processors),output:nZ(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw Error("Error converting schema to JSON.")}}let nZ=(e,t,r={})=>n=>{let{libraryOptions:i,target:a}=n??{},o=nK({...i??{},target:a,io:t,processors:r});return nW(e,o),nF(o,e),nJ(o,e)},nG={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},nQ=(e,t,r,n)=>{let i=e._zod.def;nW(i.innerType,t,n),t.seen.get(e).ref=i.innerType},nY=e_("ZodISODateTime",(e,t)=>{rD.init(e,t),ip.init(e,t)}),nX=e_("ZodISODate",(e,t)=>{rL.init(e,t),ip.init(e,t)}),n0=e_("ZodISOTime",(e,t)=>{r$.init(e,t),ip.init(e,t)}),n1=e_("ZodISODuration",(e,t)=>{rz.init(e,t),ip.init(e,t)}),n2=e_("ZodError",(e,t)=>{rl.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let r={_errors:[]},n=(e,i=[])=>{for(let a of e.issues)if("invalid_union"===a.code&&a.errors.length)a.errors.map(e=>n({issues:e},[...i,...a.path]));else if("invalid_key"===a.code)n({issues:a.issues},[...i,...a.path]);else if("invalid_element"===a.code)n({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(0===e.length)r._errors.push(t(a));else{let n=r,i=0;for(;i<e.length;){let r=e[i];i===e.length-1?(n[r]=n[r]||{_errors:[]},n[r]._errors.push(t(a))):n[r]=n[r]||{_errors:[]},n=n[r],i++}}}};return n(e),r})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,eU,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,eU,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),n5=ru(n2),n6=rf(n2),n4=rm(n2),n8=rg(n2),n3=(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return ru(n2)(e,t,n)},n9=(e,t,r)=>ru(n2)(e,t,r),n7=async(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return rf(n2)(e,t,n)},ie=async(e,t,r)=>rf(n2)(e,t,r),it=(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return rm(n2)(e,t,n)},ir=(e,t,r)=>rm(n2)(e,t,r),ii=async(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return rg(n2)(e,t,n)},ia=async(e,t,r)=>rg(n2)(e,t,r),io=new WeakMap;function is(e,t,r){let n=Object.getPrototypeOf(e),i=io.get(n);if(i||(i=new Set,io.set(n,i)),!i.has(t))for(let e in i.add(t),r){let t=r[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,get(){let r=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:r}),r},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}let ic=e_("ZodType",(e,t)=>(rA.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:nZ(e,"input"),output:nZ(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{let n=nK({...r,processors:t});return nW(e,n),nF(n,e),nJ(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,r)=>n5(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>n4(e,t,r),e.parseAsync=async(t,r)=>n6(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>n8(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>n3(e,t,r),e.decode=(t,r)=>n9(e,t,r),e.encodeAsync=async(t,r)=>n7(e,t,r),e.decodeAsync=async(t,r)=>ie(e,t,r),e.safeEncode=(t,r)=>it(e,t,r),e.safeDecode=(t,r)=>ir(e,t,r),e.safeEncodeAsync=async(t,r)=>ii(e,t,r),e.safeDecodeAsync=async(t,r)=>ia(e,t,r),is(e,"ZodType",{check(...e){let t=this.def;return this.clone(nV.mergeDefs(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return eJ(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return new aa({type:"custom",check:"custom",fn:e,...eZ(t)})}(e,t))},superRefine(e,t){return this.check(function(e,t){var r;let n,i;return r=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(e3(e,t.value,n._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=n),e.continue??(e.continue=!n._zod.def.abort),t.issues.push(e3(e)))},e(t.value,t)),(i=new tG({check:"custom",...eZ(t)}))._zod.check=r,n=i}(e,t))},overwrite(e){return this.check(nM(e))},optional(){return i6(this)},exactOptional(){var e;return e=this,new i4({type:"optional",innerType:e})},nullable(){return i3(this)},nullish(){return i6(i3(this))},nonoptional(e){var t,r;return t=this,r=e,new ae({type:"nonoptional",innerType:t,...nV.normalizeParams(r)})},array(){return iF(this)},or(e){return new iG({type:"union",options:[this,e],...nV.normalizeParams(void 0)})},and(e){var t;return t=this,new iQ({type:"intersection",left:t,right:e})},transform(e){return an(this,new i2({type:"transform",transform:e}))},default(e){var t,r;return t=this,r=e,new i9({type:"default",innerType:t,get defaultValue(){return"function"==typeof r?r():nV.shallowClone(r)}})},prefault(e){var t,r;return t=this,r=e,new i7({type:"prefault",innerType:t,get defaultValue(){return"function"==typeof r?r():nV.shallowClone(r)}})},catch(e){var t,r;return t=this,new at({type:"catch",innerType:t,catchValue:"function"==typeof(r=e)?r:()=>r})},pipe(e){return an(this,e)},readonly(){var e;return e=this,new ai({type:"readonly",innerType:e})},describe(e){let t=this.clone();return nU.add(t,{description:e}),t},meta(...e){if(0===e.length)return nU.get(this);let t=this.clone();return nU.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>nU.get(e)?.description,configurable:!0}),e)),il=e_("_ZodString",(e,t)=>{rE.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{r.type="string";let{minimum:i,maximum:a,format:o,patterns:s,contentEncoding:c}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof a&&(r.maxLength=a),o&&(r.format=nG[o]??o,""===r.format&&delete r.format,"time"===o&&delete r.format),c&&(r.contentEncoding=c),s&&s.size>0){let e=[...s];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,r,0);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,is(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new re({check:"string_format",format:"regex",...eZ(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new rn({check:"string_format",format:"includes",...eZ(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new ri({check:"string_format",format:"starts_with",...eZ(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new ra({check:"string_format",format:"ends_with",...eZ(t),suffix:e})}(...e))},min(...e){return this.check(nB(...e))},max(...e){return this.check(nH(...e))},length(...e){return this.check(nq(...e))},nonempty(...e){return this.check(nB(1,...e))},lowercase(e){return this.check(new rt({check:"string_format",format:"lowercase",...eZ(e)}))},uppercase(e){return this.check(new rr({check:"string_format",format:"uppercase",...eZ(e)}))},trim(){return this.check(nM(e=>e.trim()))},normalize(...e){return this.check(function(e){return nM(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(nM(e=>e.toLowerCase()))},toUpperCase(){return this.check(nM(e=>e.toUpperCase()))},slugify(){return this.check(nM(e=>eH(e)))}})}),id=e_("ZodString",(e,t)=>{rE.init(e,t),il.init(e,t),e.email=t=>e.check(nO(ih,t)),e.url=t=>e.check(new ig({type:"string",format:"url",check:"string_format",abort:!1,...eZ(t)})),e.jwt=t=>e.check(new iP({type:"string",format:"jwt",check:"string_format",abort:!1,...eZ(t)})),e.emoji=t=>e.check(new iw({type:"string",format:"emoji",check:"string_format",abort:!1,...eZ(t)})),e.guid=t=>e.check(nP(im,t)),e.uuid=t=>e.check(new iy({type:"string",format:"uuid",check:"string_format",abort:!1,...eZ(t)})),e.uuidv4=t=>e.check(new iy({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...eZ(t)})),e.uuidv6=t=>e.check(new iy({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...eZ(t)})),e.uuidv7=t=>e.check(new iy({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...eZ(t)})),e.nanoid=t=>e.check(new ib({type:"string",format:"nanoid",check:"string_format",abort:!1,...eZ(t)})),e.guid=t=>e.check(nP(im,t)),e.cuid=t=>e.check(new iA({type:"string",format:"cuid",check:"string_format",abort:!1,...eZ(t)})),e.cuid2=t=>e.check(new iE({type:"string",format:"cuid2",check:"string_format",abort:!1,...eZ(t)})),e.ulid=t=>e.check(new iv({type:"string",format:"ulid",check:"string_format",abort:!1,...eZ(t)})),e.base64=t=>e.check(new iI({type:"string",format:"base64",check:"string_format",abort:!1,...eZ(t)})),e.base64url=t=>e.check(new iU({type:"string",format:"base64url",check:"string_format",abort:!1,...eZ(t)})),e.xid=t=>e.check(new ik({type:"string",format:"xid",check:"string_format",abort:!1,...eZ(t)})),e.ksuid=t=>e.check(new i_({type:"string",format:"ksuid",check:"string_format",abort:!1,...eZ(t)})),e.ipv4=t=>e.check(nC(iS,t)),e.ipv6=t=>e.check(nD(ix,t)),e.cidrv4=t=>e.check(new iR({type:"string",format:"cidrv4",check:"string_format",abort:!1,...eZ(t)})),e.cidrv6=t=>e.check(new iT({type:"string",format:"cidrv6",check:"string_format",abort:!1,...eZ(t)})),e.e164=t=>e.check(new iO({type:"string",format:"e164",check:"string_format",abort:!1,...eZ(t)})),e.datetime=t=>e.check(new nY({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...eZ(t)})),e.date=t=>e.check(new nX({type:"string",format:"date",check:"string_format",...eZ(t)})),e.time=t=>e.check(new n0({type:"string",format:"time",check:"string_format",precision:null,...eZ(t)})),e.duration=t=>e.check(new n1({type:"string",format:"duration",check:"string_format",...eZ(t)}))});function iu(e){return new id({type:"string",...eZ(e)})}let ip=e_("ZodStringFormat",(e,t)=>{rv.init(e,t),il.init(e,t)}),ih=e_("ZodEmail",(e,t)=>{rS.init(e,t),ip.init(e,t)}),im=e_("ZodGUID",(e,t)=>{rk.init(e,t),ip.init(e,t)}),iy=e_("ZodUUID",(e,t)=>{r_.init(e,t),ip.init(e,t)}),ig=e_("ZodURL",(e,t)=>{rx.init(e,t),ip.init(e,t)}),iw=e_("ZodEmoji",(e,t)=>{rR.init(e,t),ip.init(e,t)}),ib=e_("ZodNanoID",(e,t)=>{rT.init(e,t),ip.init(e,t)}),iA=e_("ZodCUID",(e,t)=>{rI.init(e,t),ip.init(e,t)}),iE=e_("ZodCUID2",(e,t)=>{rU.init(e,t),ip.init(e,t)}),iv=e_("ZodULID",(e,t)=>{rO.init(e,t),ip.init(e,t)}),ik=e_("ZodXID",(e,t)=>{rP.init(e,t),ip.init(e,t)}),i_=e_("ZodKSUID",(e,t)=>{rC.init(e,t),ip.init(e,t)}),iS=e_("ZodIPv4",(e,t)=>{rN.init(e,t),ip.init(e,t)}),ix=e_("ZodIPv6",(e,t)=>{rj.init(e,t),ip.init(e,t)}),iR=e_("ZodCIDRv4",(e,t)=>{rH.init(e,t),ip.init(e,t)}),iT=e_("ZodCIDRv6",(e,t)=>{rB.init(e,t),ip.init(e,t)}),iI=e_("ZodBase64",(e,t)=>{rM.init(e,t),ip.init(e,t)}),iU=e_("ZodBase64URL",(e,t)=>{rV.init(e,t),ip.init(e,t)}),iO=e_("ZodE164",(e,t)=>{rK.init(e,t),ip.init(e,t)}),iP=e_("ZodJWT",(e,t)=>{rW.init(e,t),ip.init(e,t)}),iC=e_("ZodNumber",(e,t)=>{rF.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let{minimum:i,maximum:a,format:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l}=e._zod.bag;"string"==typeof o&&o.includes("int")?r.type="integer":r.type="number";let d="number"==typeof l&&l>=(i??-1/0),u="number"==typeof c&&c<=(a??1/0),p="draft-04"===t.target||"openapi-3.0"===t.target;d?p?(r.minimum=l,r.exclusiveMinimum=!0):r.exclusiveMinimum=l:"number"==typeof i&&(r.minimum=i),u?p?(r.maximum=c,r.exclusiveMaximum=!0):r.exclusiveMaximum=c:"number"==typeof a&&(r.maximum=a),"number"==typeof s&&(r.multipleOf=s)})(e,t,r,0),is(e,"ZodNumber",{gt(e,t){return this.check(nz(e,t))},gte(e,t){return this.check(nN(e,t))},min(e,t){return this.check(nN(e,t))},lt(e,t){return this.check(nL(e,t))},lte(e,t){return this.check(n$(e,t))},max(e,t){return this.check(n$(e,t))},int(e){return this.check(i$(e))},safe(e){return this.check(i$(e))},positive(e){return this.check(nz(0,e))},nonnegative(e){return this.check(nN(0,e))},negative(e){return this.check(nL(0,e))},nonpositive(e){return this.check(n$(0,e))},multipleOf(e,t){return this.check(nj(e,t))},step(e,t){return this.check(nj(e,t))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??-1/0,r.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(r.maximum??1/0,r.exclusiveMaximum??1/0)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function iD(e){return new iC({type:"number",checks:[],...eZ(e)})}let iL=e_("ZodNumberFormat",(e,t)=>{rJ.init(e,t),iC.init(e,t)});function i$(e){return new iL({type:"number",check:"number_format",abort:!1,format:"safeint",...eZ(e)})}let iz=e_("ZodBoolean",(e,t)=>{rZ.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{t.type="boolean"}});function iN(e){return new iz({type:"boolean",...eZ(e)})}let ij=e_("ZodBigInt",(e,t)=>{rG.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema")})(0,e,0,0),e.gte=(t,r)=>e.check(nN(t,r)),e.min=(t,r)=>e.check(nN(t,r)),e.gt=(t,r)=>e.check(nz(t,r)),e.gte=(t,r)=>e.check(nN(t,r)),e.min=(t,r)=>e.check(nN(t,r)),e.lt=(t,r)=>e.check(nL(t,r)),e.lte=(t,r)=>e.check(n$(t,r)),e.max=(t,r)=>e.check(n$(t,r)),e.positive=t=>e.check(nz(BigInt(0),t)),e.negative=t=>e.check(nL(BigInt(0),t)),e.nonpositive=t=>e.check(n$(BigInt(0),t)),e.nonnegative=t=>e.check(nN(BigInt(0),t)),e.multipleOf=(t,r)=>e.check(nj(t,r));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null}),iH=e_("ZodAny",(e,t)=>{rQ.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function iB(){return new iH({type:"any"})}let iq=e_("ZodUnknown",(e,t)=>{rY.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function iM(){return new iq({type:"unknown"})}let iV=e_("ZodNever",(e,t)=>{rX.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{t.not={}}}),iK=e_("ZodDate",(e,t)=>{r0.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Date cannot be represented in JSON Schema")})(0,e,0,0),e.min=(t,r)=>e.check(nN(t,r)),e.max=(t,r)=>e.check(n$(t,r));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null}),iW=e_("ZodArray",(e,t)=>{r2.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let i=e._zod.def,{minimum:a,maximum:o}=e._zod.bag;"number"==typeof a&&(r.minItems=a),"number"==typeof o&&(r.maxItems=o),r.type="array",r.items=nW(i.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,is(e,"ZodArray",{min(e,t){return this.check(nB(e,t))},nonempty(e){return this.check(nB(1,e))},max(e,t){return this.check(nH(e,t))},length(e,t){return this.check(nq(e,t))},unwrap(){return this.element}})});function iF(e,t){return new iW({type:"array",element:e,...eZ(t)})}let iJ=e_("ZodObject",(e,t)=>{r3.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let i=e._zod.def;r.type="object",r.properties={};let a=i.shape;for(let e in a)r.properties[e]=nW(a[e],t,{...n,path:[...n.path,"properties",e]});let o=new Set([...new Set(Object.keys(a))].filter(e=>{let r=i.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));o.size>0&&(r.required=Array.from(o)),i.catchall?._zod.def.type==="never"?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=nW(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)})(e,t,r,n),nV.defineLazy(e,"shape",()=>t.shape),is(e,"ZodObject",{keyof(){return i1(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:iM()})},loose(){return this.clone({...this._zod.def,catchall:iM()})},strict(){return this.clone({...this._zod.def,catchall:new iV({type:"never",...eZ(void 0)})})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return nV.extend(this,e)},safeExtend(e){return nV.safeExtend(this,e)},merge(e){return nV.merge(this,e)},pick(e){return nV.pick(this,e)},omit(e){return nV.omit(this,e)},partial(...e){return nV.partial(i5,this,e[0])},required(...e){return nV.required(ae,this,e[0])}})});function iZ(e,t){return new iJ({type:"object",shape:e??{},...nV.normalizeParams(t)})}let iG=e_("ZodUnion",(e,t)=>{r7.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{var i,a,o,s;let c,l,d;return i=e,a=t,o=r,s=n,l=!1===(c=i._zod.def).inclusive,d=c.options.map((e,t)=>nW(e,a,{...s,path:[...s.path,l?"oneOf":"anyOf",t]})),void(l?o.oneOf=d:o.anyOf=d)},e.options=t.options}),iQ=e_("ZodIntersection",(e,t)=>{nt.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i,a,o,s;return a=nW((i=e._zod.def).left,t,{...n,path:[...n.path,"allOf",0]}),o=nW(i.right,t,{...n,path:[...n.path,"allOf",1]}),void(r.allOf=[...(s=e=>"allOf"in e&&1===Object.keys(e).length)(a)?a.allOf:[a],...s(o)?o.allOf:[o]])}}),iY=e_("ZodRecord",(e,t)=>{ns.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let i=e._zod.def;r.type="object";let a=i.keyType,o=a._zod.bag,s=o?.patterns;if("loose"===i.mode&&s&&s.size>0){let e=nW(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});for(let t of(r.patternProperties={},s))r.patternProperties[t.source]=e}else("draft-07"===t.target||"draft-2020-12"===t.target)&&(r.propertyNames=nW(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),r.additionalProperties=nW(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let c=a._zod.values;if(c){let e=[...c].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(r.required=e)}})(e,t,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function iX(e,t,r){return new iY(t&&t._zod?{type:"record",keyType:e,valueType:t,...nV.normalizeParams(r)}:{type:"record",keyType:iu(),valueType:e,...nV.normalizeParams(t)})}let i0=e_("ZodEnum",(e,t)=>{nd.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;(i=eI(e._zod.def.entries)).every(e=>"number"==typeof e)&&(r.type="number"),i.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=i},e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{let i={};for(let n of e)if(r.has(n))i[n]=t.entries[n];else throw Error(`Key ${n} not found in enum`);return new i0({...t,checks:[],...nV.normalizeParams(n),entries:i})},e.exclude=(e,n)=>{let i={...t.entries};for(let t of e)if(r.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new i0({...t,checks:[],...nV.normalizeParams(n),entries:i})}});function i1(e,t){return new i0({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...nV.normalizeParams(t)})}let i2=e_("ZodTransform",(e,t)=>{nu.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")})(0,e,0,0),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new ex(e.constructor.name);r.addIssue=n=>{"string"==typeof n?r.issues.push(nV.issue(n,r.value,t)):(n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=e),r.issues.push(nV.issue(n)))};let i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}}),i5=e_("ZodOptional",(e,t)=>{nf.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>nQ(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function i6(e){return new i5({type:"optional",innerType:e})}let i4=e_("ZodExactOptional",(e,t)=>{nh.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>nQ(e,t,r,n),e.unwrap=()=>e._zod.def.innerType}),i8=e_("ZodNullable",(e,t)=>{nm.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i,a,o;return a=nW((i=e._zod.def).innerType,t,n),o=t.seen.get(e),void("openapi-3.0"===t.target?(o.ref=i.innerType,r.nullable=!0):r.anyOf=[a,{type:"null"}])},e.unwrap=()=>e._zod.def.innerType});function i3(e){return new i8({type:"nullable",innerType:e})}let i9=e_("ZodDefault",(e,t)=>{ny.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;nW((i=e._zod.def).innerType,t,n),t.seen.get(e).ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),i7=e_("ZodPrefault",(e,t)=>{nw.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;nW((i=e._zod.def).innerType,t,n),t.seen.get(e).ref=i.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},e.unwrap=()=>e._zod.def.innerType}),ae=e_("ZodNonOptional",(e,t)=>{nb.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;nW((i=e._zod.def).innerType,t,n),t.seen.get(e).ref=i.innerType},e.unwrap=()=>e._zod.def.innerType}),at=e_("ZodCatch",(e,t)=>{nE.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let i,a=e._zod.def;nW(a.innerType,t,n),t.seen.get(e).ref=a.innerType;try{i=a.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),ar=e_("ZodPipe",(e,t)=>{nv.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i,a,o;return a=(i=e._zod.def).in._zod.traits.has("$ZodTransform"),void(nW(o="input"===t.io?a?i.out:i.in:i.out,t,n),t.seen.get(e).ref=o)},e.in=t.in,e.out=t.out});function an(e,t){return new ar({type:"pipe",in:e,out:t})}let ai=e_("ZodReadonly",(e,t)=>{nx.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;nW((i=e._zod.def).innerType,t,n),t.seen.get(e).ref=i.innerType,r.readOnly=!0},e.unwrap=()=>e._zod.def.innerType}),aa=e_("ZodCustom",(e,t)=>{nT.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")})(0,e,0,0)}),ao={};function as(e){switch(e.constructor.name){case"ZodString":default:return"string";case"ZodNumber":return"number";case"ZodBoolean":return"boolean";case"ZodObject":return"object";case"ZodArray":return"array"}}function ac(e){let t=[];return e.metadata?.openapi?.parameters?t.push(...e.metadata.openapi.parameters):e.query instanceof iJ&&Object.entries(e.query.shape).forEach(([e,r])=>{r instanceof iJ&&t.push({name:e,in:"query",schema:{type:as(r),..."minLength"in r&&r.minLength?{minLength:r.minLength}:{},description:r.description}})}),t}function al(e){return{400:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}},required:["message"]}}},description:"Bad Request. Usually due to missing parameters, or invalid parameters."},401:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}},required:["message"]}}},description:"Unauthorized. Due to missing or invalid authentication."},403:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}}}}},description:"Forbidden. You do not have permission to access this resource or to perform this action."},404:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}}}}},description:"Not Found. The requested resource was not found."},429:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}}}}},description:"Too Many Requests. You have exceeded the rate limit. Try again later."},500:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}}}}},description:"Internal Server Error. This is a problem with the server that you cannot fix."},...e}}async function ad(e,t){return Object.entries(e).forEach(([e,t])=>{let r=t.options;if(!(!t.path||r.metadata?.SERVER_ONLY)&&("GET"===r.method&&(ao[t.path]={get:{tags:["Default",...r.metadata?.openapi?.tags||[]],description:r.metadata?.openapi?.description,operationId:r.metadata?.openapi?.operationId,security:[{bearerAuth:[]}],parameters:ac(r),responses:al(r.metadata?.openapi?.responses)}}),"POST"===r.method)){let e=function(e){if(e.metadata?.openapi?.requestBody)return e.metadata.openapi.requestBody;if(e.body&&(e.body instanceof iJ||e.body instanceof i5)){let t=e.body.shape;if(!t)return;let r={},n=[];return Object.entries(t).forEach(([e,t])=>{t instanceof iJ&&(r[e]={type:as(t),description:t.description},t instanceof i5||n.push(e))}),{required:!(e.body instanceof i5)&&!!e.body,content:{"application/json":{schema:{type:"object",properties:r,required:n}}}}}}(r);ao[t.path]={post:{tags:["Default",...r.metadata?.openapi?.tags||[]],description:r.metadata?.openapi?.description,operationId:r.metadata?.openapi?.operationId,security:[{bearerAuth:[]}],parameters:ac(r),...e?{requestBody:e}:{requestBody:{content:{"application/json":{schema:{type:"object",properties:{}}}}}},responses:al(r.metadata?.openapi?.responses)}}}}),{openapi:"3.1.1",info:{title:"Better Auth",description:"API Reference for your Better Auth Instance",version:"1.1.0"},components:{schemas:{}},security:[{apiKeyCookie:[]}],servers:[{url:t?.url}],tags:[{name:"Default",description:"Default endpoints that are included with Better Auth by default. These endpoints are not part of any plugin."}],paths:ao}}let au=((o=function(){}).prototype=Object.create(null),Object.freeze(o.prototype),o);function ap(){return{root:{key:""},static:new au}}function af(e){let[t,...r]=e.split("/");return""===r[r.length-1]?r.slice(0,-1):r}function ah(e,t){let r=new au;for(let[n,i]of t){let t=n<0?e.slice(-(n+1)).join("/"):e[n];if("string"==typeof i)r[i]=t;else{let e=t.match(i);if(e)for(let t in e.groups)r[t]=e.groups[t]}}return r}function am(e,t="",r,n){t=t.toUpperCase(),47!==r.charCodeAt(0)&&(r=`/${r}`);let i=af(r=r.replace(/\\:/g,"%3A")),a=e.root,o=0,s=[],c=[];for(let e=0;e<i.length;e++){let t=i[e];if(t.startsWith("**")){a.wildcard||(a.wildcard={key:"**"}),a=a.wildcard,s.push([-(e+1),t.split(":")[1]||"_",2===t.length]);break}if("*"===t||t.includes(":")){if(a.param||(a.param={key:"*"}),a=a.param,"*"===t)s.push([e,`_${o++}`,!0]);else if(t.includes(":",1)){let r=function(e){let t=e.replace(/:(\w+)/g,(e,t)=>`(?<${t}>[^/]+)`).replace(/\./g,"\\.");return RegExp(`^${t}$`)}(t);c[e]=r,a.hasRegexParam=!0,s.push([e,r,!1])}else s.push([e,t.slice(1),!1]);continue}"\\*"===t?t=i[e]="*":"\\*\\*"===t&&(t=i[e]="**");let r=a.static?.[t];if(r)a=r;else{let e={key:t};a.static||(a.static=new au),a.static[t]=e,a=e}}let l=s.length>0;a.methods||(a.methods=new au),a.methods[t]??=[],a.methods[t].push({data:n||null,paramsRegexp:c,paramsMap:l?s:void 0}),l||(e.static["/"+i.join("/")]=a)}function ay(e){return e instanceof X.APIError||e instanceof Y.APIError||e?.name==="APIError"}let ag=ek(async()=>({})),aw=ek.create({use:[ag,ek(async()=>({}))]}),ab=[ag];function aA(e,t,r){let n="string"==typeof e?e:void 0,i="object"==typeof t?t:e,a="function"==typeof t?t:r,o=async e=>{try{return await Q(e,()=>a(e))}catch(r){var t;throw t=e.responseHeaders,ay(r)&&t&&Object.defineProperty(r,X.kAPIErrorHeaderSymbol,{enumerable:!1,configurable:!0,value:t,writable:!1}),r}};return n?ev(n,{...i,use:[...i?.use||[],...ab]},o):ev({...i,use:[...i?.use||[],...ab]},o)}aA.serverOnly=(e,t)=>aA({...e,metadata:{...e.metadata,SERVER_ONLY:!0}},t);var aE=e.i(89551),av=e.i(12714),ak=e.i(50227),a_=e.i(43651),aS=e.i(80527);async function ax(t,r){let n;if(t.database)n="function"==typeof t.database?t.database(t):await r(t);else{let r=Object.keys((0,a_.getAuthTables)(t)).reduce((e,t)=>(e[t]=[],e),{}),{memoryAdapter:i}=await e.A(16432);n=i(r)(t)}return n.transaction||(aS.logger.warn("Adapter does not correctly implement transaction function, patching it automatically. Please update your adapter implementation."),n.transaction=async e=>e(n)),n}async function aR(t){return ax(t,async t=>{let{createKyselyAdapter:r}=await e.A(19783),{kysely:n,databaseType:i,transaction:a}=await r(t);if(!n)throw new Y.BetterAuthError("Failed to initialize database adapter");let{kyselyAdapter:o}=await e.A(19783);return o(n,{type:i||"sqlite",debugLogs:!!t.database&&"debugLogs"in t.database&&t.database.debugLogs,transaction:a})(t)})}var aT=e.i(13906),aI=e.i(15272),aU=e.i(97495),aO=e.i(29401);let aP={postgres:{string:["character varying","varchar","text","uuid"],number:["int4","integer","bigint","smallint","numeric","real","double precision"],boolean:["bool","boolean"],date:["timestamptz","timestamp","date"],json:["json","jsonb"]},mysql:{string:["varchar","text","uuid"],number:["integer","int","bigint","smallint","decimal","float","double"],boolean:["boolean","tinyint"],date:["timestamp","datetime","date"],json:["json"]},sqlite:{string:["TEXT"],number:["INTEGER","REAL"],boolean:["INTEGER","BOOLEAN"],date:["DATE","INTEGER"],json:["TEXT"]},mssql:{string:["varchar","nvarchar","uniqueidentifier"],number:["int","bigint","smallint","decimal","float","double"],boolean:["bit","smallint"],date:["datetime2","date","datetime"],json:["varchar","nvarchar"]}};async function aC(e){try{let t=await aO.sql`SHOW search_path`.execute(e),r=t.rows[0]?.search_path??t.rows[0]?.searchPath;if(r)return r.split(",").map(e=>e.trim()).map(e=>e.replace(/^["']|["']$/g,"")).filter(e=>!e.startsWith("$")&&!e.startsWith("\\$"))[0]||"public"}catch{}return"public"}async function aD(e){let t=function(e){let t=(0,a_.getAuthTables)(e),r={};for(let e in t){let n=t[e],i=n.fields,a={};if(Object.entries(i).forEach(([e,r])=>{if(a[r.fieldName||e]=r,r.references){let n=t[r.references.model];n&&(a[r.fieldName||e].references={...r.references,model:n.modelName,field:r.references.field})}}),r[n.modelName]){r[n.modelName].fields={...r[n.modelName].fields,...a},n.disableMigrations&&(r[n.modelName].disableMigrations=!0);continue}r[n.modelName]={fields:a,order:n.order||1/0,disableMigrations:n.disableMigrations}}return r}(e),r=(0,aS.createLogger)(e.logger),{kysely:n,databaseType:i}=await (0,aT.createKyselyAdapter)(e);i||(r.warn("Could not determine database type, defaulting to sqlite. Please provide a type in the database options to avoid this."),i="sqlite"),n||(r.error("Only kysely adapter is supported for migrations. You can use `generate` command to generate the schema, if you're using a different adapter."),process.exit(1));let a="public";if("postgres"===i){a=await aC(n),r.debug(`PostgreSQL migration: Using schema '${a}' (from search_path)`);try{let e=await aO.sql`
62
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let r of e.seen.entries()){let n=r[1];if(t===r[0]){i(r);continue}if(e.external){let n=e.external.registry.get(r[0])?.id;if(t!==r[0]&&n){i(r);continue}}if(e.metadataRegistry.get(r[0])?.id||n.cycle||n.count>1&&"ref"===e.reused){i(r);continue}}}function nJ(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=t=>{let r=e.seen.get(t);if(null===r.ref)return;let i=r.def??r.schema,a={...i},o=r.ref;if(r.ref=null,o){n(o);let r=e.seen.get(o),s=r.schema;if(s.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)"$ref"!==e&&"allOf"!==e&&(e in a||delete i[e]);if(s.$ref&&r.def)for(let e in i)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(i[e])===JSON.stringify(r.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){n(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:r.path??[]})};for(let t of[...e.seen.entries()].reverse())n(t[0]);let i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let r=e.external.registry.get(t)?.id;if(!r)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(r)}Object.assign(i,r.def??r.schema);let a=e.metadataRegistry.get(t)?.id;void 0!==a&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?i.$defs=o:i.definitions=o);try{let r=JSON.parse(JSON.stringify(i));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:nZ(t,"input",e.processors),output:nZ(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw Error("Error converting schema to JSON.")}}let nZ=(e,t,r={})=>n=>{let{libraryOptions:i,target:a}=n??{},o=nK({...i??{},target:a,io:t,processors:r});return nW(e,o),nF(o,e),nJ(o,e)},nG={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},nQ=(e,t,r,n)=>{let i=e._zod.def;nW(i.innerType,t,n),t.seen.get(e).ref=i.innerType},nY=e_("ZodISODateTime",(e,t)=>{rD.init(e,t),ip.init(e,t)}),nX=e_("ZodISODate",(e,t)=>{rL.init(e,t),ip.init(e,t)}),n0=e_("ZodISOTime",(e,t)=>{r$.init(e,t),ip.init(e,t)}),n1=e_("ZodISODuration",(e,t)=>{rz.init(e,t),ip.init(e,t)}),n2=e_("ZodError",(e,t)=>{rl.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let r={_errors:[]},n=(e,i=[])=>{for(let a of e.issues)if("invalid_union"===a.code&&a.errors.length)a.errors.map(e=>n({issues:e},[...i,...a.path]));else if("invalid_key"===a.code)n({issues:a.issues},[...i,...a.path]);else if("invalid_element"===a.code)n({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(0===e.length)r._errors.push(t(a));else{let n=r,i=0;for(;i<e.length;){let r=e[i];i===e.length-1?(n[r]=n[r]||{_errors:[]},n[r]._errors.push(t(a))):n[r]=n[r]||{_errors:[]},n=n[r],i++}}}};return n(e),r})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,eU,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,eU,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),n5=ru(n2),n6=rf(n2),n4=rm(n2),n8=rg(n2),n3=(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return ru(n2)(e,t,n)},n9=(e,t,r)=>ru(n2)(e,t,r),n7=async(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return rf(n2)(e,t,n)},ie=async(e,t,r)=>rf(n2)(e,t,r),it=(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return rm(n2)(e,t,n)},ir=(e,t,r)=>rm(n2)(e,t,r),ii=async(e,t,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return rg(n2)(e,t,n)},ia=async(e,t,r)=>rg(n2)(e,t,r),io=new WeakMap;function is(e,t,r){let n=Object.getPrototypeOf(e),i=io.get(n);if(i||(i=new Set,io.set(n,i)),!i.has(t))for(let e in i.add(t),r){let t=r[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,get(){let r=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:r}),r},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}let ic=e_("ZodType",(e,t)=>(rA.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:nZ(e,"input"),output:nZ(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{let n=nK({...r,processors:t});return nW(e,n),nF(n,e),nJ(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,r)=>n5(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>n4(e,t,r),e.parseAsync=async(t,r)=>n6(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>n8(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>n3(e,t,r),e.decode=(t,r)=>n9(e,t,r),e.encodeAsync=async(t,r)=>n7(e,t,r),e.decodeAsync=async(t,r)=>ie(e,t,r),e.safeEncode=(t,r)=>it(e,t,r),e.safeDecode=(t,r)=>ir(e,t,r),e.safeEncodeAsync=async(t,r)=>ii(e,t,r),e.safeDecodeAsync=async(t,r)=>ia(e,t,r),is(e,"ZodType",{check(...e){let t=this.def;return this.clone(nV.mergeDefs(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return eJ(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return new aa({type:"custom",check:"custom",fn:e,...eZ(t)})}(e,t))},superRefine(e,t){return this.check(function(e,t){var r;let n,i;return r=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(e3(e,t.value,n._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=n),e.continue??(e.continue=!n._zod.def.abort),t.issues.push(e3(e)))},e(t.value,t)),(i=new tG({check:"custom",...eZ(t)}))._zod.check=r,n=i}(e,t))},overwrite(e){return this.check(nM(e))},optional(){return i6(this)},exactOptional(){var e;return e=this,new i4({type:"optional",innerType:e})},nullable(){return i3(this)},nullish(){return i6(i3(this))},nonoptional(e){var t,r;return t=this,r=e,new ae({type:"nonoptional",innerType:t,...nV.normalizeParams(r)})},array(){return iF(this)},or(e){return new iG({type:"union",options:[this,e],...nV.normalizeParams(void 0)})},and(e){var t;return t=this,new iQ({type:"intersection",left:t,right:e})},transform(e){return an(this,new i2({type:"transform",transform:e}))},default(e){var t,r;return t=this,r=e,new i9({type:"default",innerType:t,get defaultValue(){return"function"==typeof r?r():nV.shallowClone(r)}})},prefault(e){var t,r;return t=this,r=e,new i7({type:"prefault",innerType:t,get defaultValue(){return"function"==typeof r?r():nV.shallowClone(r)}})},catch(e){var t,r;return t=this,new at({type:"catch",innerType:t,catchValue:"function"==typeof(r=e)?r:()=>r})},pipe(e){return an(this,e)},readonly(){var e;return e=this,new ai({type:"readonly",innerType:e})},describe(e){let t=this.clone();return nU.add(t,{description:e}),t},meta(...e){if(0===e.length)return nU.get(this);let t=this.clone();return nU.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>nU.get(e)?.description,configurable:!0}),e)),il=e_("_ZodString",(e,t)=>{rE.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{r.type="string";let{minimum:i,maximum:a,format:o,patterns:s,contentEncoding:c}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof a&&(r.maxLength=a),o&&(r.format=nG[o]??o,""===r.format&&delete r.format,"time"===o&&delete r.format),c&&(r.contentEncoding=c),s&&s.size>0){let e=[...s];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,r,0);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,is(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new re({check:"string_format",format:"regex",...eZ(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new rn({check:"string_format",format:"includes",...eZ(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new ri({check:"string_format",format:"starts_with",...eZ(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new ra({check:"string_format",format:"ends_with",...eZ(t),suffix:e})}(...e))},min(...e){return this.check(nB(...e))},max(...e){return this.check(nH(...e))},length(...e){return this.check(nq(...e))},nonempty(...e){return this.check(nB(1,...e))},lowercase(e){return this.check(new rt({check:"string_format",format:"lowercase",...eZ(e)}))},uppercase(e){return this.check(new rr({check:"string_format",format:"uppercase",...eZ(e)}))},trim(){return this.check(nM(e=>e.trim()))},normalize(...e){return this.check(function(e){return nM(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(nM(e=>e.toLowerCase()))},toUpperCase(){return this.check(nM(e=>e.toUpperCase()))},slugify(){return this.check(nM(e=>eH(e)))}})}),id=e_("ZodString",(e,t)=>{rE.init(e,t),il.init(e,t),e.email=t=>e.check(nO(ih,t)),e.url=t=>e.check(new ig({type:"string",format:"url",check:"string_format",abort:!1,...eZ(t)})),e.jwt=t=>e.check(new iP({type:"string",format:"jwt",check:"string_format",abort:!1,...eZ(t)})),e.emoji=t=>e.check(new iw({type:"string",format:"emoji",check:"string_format",abort:!1,...eZ(t)})),e.guid=t=>e.check(nP(im,t)),e.uuid=t=>e.check(new iy({type:"string",format:"uuid",check:"string_format",abort:!1,...eZ(t)})),e.uuidv4=t=>e.check(new iy({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...eZ(t)})),e.uuidv6=t=>e.check(new iy({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...eZ(t)})),e.uuidv7=t=>e.check(new iy({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...eZ(t)})),e.nanoid=t=>e.check(new ib({type:"string",format:"nanoid",check:"string_format",abort:!1,...eZ(t)})),e.guid=t=>e.check(nP(im,t)),e.cuid=t=>e.check(new iA({type:"string",format:"cuid",check:"string_format",abort:!1,...eZ(t)})),e.cuid2=t=>e.check(new iE({type:"string",format:"cuid2",check:"string_format",abort:!1,...eZ(t)})),e.ulid=t=>e.check(new iv({type:"string",format:"ulid",check:"string_format",abort:!1,...eZ(t)})),e.base64=t=>e.check(new iI({type:"string",format:"base64",check:"string_format",abort:!1,...eZ(t)})),e.base64url=t=>e.check(new iU({type:"string",format:"base64url",check:"string_format",abort:!1,...eZ(t)})),e.xid=t=>e.check(new ik({type:"string",format:"xid",check:"string_format",abort:!1,...eZ(t)})),e.ksuid=t=>e.check(new i_({type:"string",format:"ksuid",check:"string_format",abort:!1,...eZ(t)})),e.ipv4=t=>e.check(nC(iS,t)),e.ipv6=t=>e.check(nD(ix,t)),e.cidrv4=t=>e.check(new iR({type:"string",format:"cidrv4",check:"string_format",abort:!1,...eZ(t)})),e.cidrv6=t=>e.check(new iT({type:"string",format:"cidrv6",check:"string_format",abort:!1,...eZ(t)})),e.e164=t=>e.check(new iO({type:"string",format:"e164",check:"string_format",abort:!1,...eZ(t)})),e.datetime=t=>e.check(new nY({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...eZ(t)})),e.date=t=>e.check(new nX({type:"string",format:"date",check:"string_format",...eZ(t)})),e.time=t=>e.check(new n0({type:"string",format:"time",check:"string_format",precision:null,...eZ(t)})),e.duration=t=>e.check(new n1({type:"string",format:"duration",check:"string_format",...eZ(t)}))});function iu(e){return new id({type:"string",...eZ(e)})}let ip=e_("ZodStringFormat",(e,t)=>{rv.init(e,t),il.init(e,t)}),ih=e_("ZodEmail",(e,t)=>{rS.init(e,t),ip.init(e,t)}),im=e_("ZodGUID",(e,t)=>{rk.init(e,t),ip.init(e,t)}),iy=e_("ZodUUID",(e,t)=>{r_.init(e,t),ip.init(e,t)}),ig=e_("ZodURL",(e,t)=>{rx.init(e,t),ip.init(e,t)}),iw=e_("ZodEmoji",(e,t)=>{rR.init(e,t),ip.init(e,t)}),ib=e_("ZodNanoID",(e,t)=>{rT.init(e,t),ip.init(e,t)}),iA=e_("ZodCUID",(e,t)=>{rI.init(e,t),ip.init(e,t)}),iE=e_("ZodCUID2",(e,t)=>{rU.init(e,t),ip.init(e,t)}),iv=e_("ZodULID",(e,t)=>{rO.init(e,t),ip.init(e,t)}),ik=e_("ZodXID",(e,t)=>{rP.init(e,t),ip.init(e,t)}),i_=e_("ZodKSUID",(e,t)=>{rC.init(e,t),ip.init(e,t)}),iS=e_("ZodIPv4",(e,t)=>{rN.init(e,t),ip.init(e,t)}),ix=e_("ZodIPv6",(e,t)=>{rj.init(e,t),ip.init(e,t)}),iR=e_("ZodCIDRv4",(e,t)=>{rH.init(e,t),ip.init(e,t)}),iT=e_("ZodCIDRv6",(e,t)=>{rB.init(e,t),ip.init(e,t)}),iI=e_("ZodBase64",(e,t)=>{rM.init(e,t),ip.init(e,t)}),iU=e_("ZodBase64URL",(e,t)=>{rV.init(e,t),ip.init(e,t)}),iO=e_("ZodE164",(e,t)=>{rK.init(e,t),ip.init(e,t)}),iP=e_("ZodJWT",(e,t)=>{rW.init(e,t),ip.init(e,t)}),iC=e_("ZodNumber",(e,t)=>{rF.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let{minimum:i,maximum:a,format:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l}=e._zod.bag;"string"==typeof o&&o.includes("int")?r.type="integer":r.type="number";let d="number"==typeof l&&l>=(i??-1/0),u="number"==typeof c&&c<=(a??1/0),p="draft-04"===t.target||"openapi-3.0"===t.target;d?p?(r.minimum=l,r.exclusiveMinimum=!0):r.exclusiveMinimum=l:"number"==typeof i&&(r.minimum=i),u?p?(r.maximum=c,r.exclusiveMaximum=!0):r.exclusiveMaximum=c:"number"==typeof a&&(r.maximum=a),"number"==typeof s&&(r.multipleOf=s)})(e,t,r,0),is(e,"ZodNumber",{gt(e,t){return this.check(nz(e,t))},gte(e,t){return this.check(nN(e,t))},min(e,t){return this.check(nN(e,t))},lt(e,t){return this.check(nL(e,t))},lte(e,t){return this.check(n$(e,t))},max(e,t){return this.check(n$(e,t))},int(e){return this.check(i$(e))},safe(e){return this.check(i$(e))},positive(e){return this.check(nz(0,e))},nonnegative(e){return this.check(nN(0,e))},negative(e){return this.check(nL(0,e))},nonpositive(e){return this.check(n$(0,e))},multipleOf(e,t){return this.check(nj(e,t))},step(e,t){return this.check(nj(e,t))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??-1/0,r.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(r.maximum??1/0,r.exclusiveMaximum??1/0)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function iD(e){return new iC({type:"number",checks:[],...eZ(e)})}let iL=e_("ZodNumberFormat",(e,t)=>{rJ.init(e,t),iC.init(e,t)});function i$(e){return new iL({type:"number",check:"number_format",abort:!1,format:"safeint",...eZ(e)})}let iz=e_("ZodBoolean",(e,t)=>{rZ.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{t.type="boolean"}});function iN(e){return new iz({type:"boolean",...eZ(e)})}let ij=e_("ZodBigInt",(e,t)=>{rG.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema")})(0,e,0,0),e.gte=(t,r)=>e.check(nN(t,r)),e.min=(t,r)=>e.check(nN(t,r)),e.gt=(t,r)=>e.check(nz(t,r)),e.gte=(t,r)=>e.check(nN(t,r)),e.min=(t,r)=>e.check(nN(t,r)),e.lt=(t,r)=>e.check(nL(t,r)),e.lte=(t,r)=>e.check(n$(t,r)),e.max=(t,r)=>e.check(n$(t,r)),e.positive=t=>e.check(nz(BigInt(0),t)),e.negative=t=>e.check(nL(BigInt(0),t)),e.nonpositive=t=>e.check(n$(BigInt(0),t)),e.nonnegative=t=>e.check(nN(BigInt(0),t)),e.multipleOf=(t,r)=>e.check(nj(t,r));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null}),iH=e_("ZodAny",(e,t)=>{rQ.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function iB(){return new iH({type:"any"})}let iq=e_("ZodUnknown",(e,t)=>{rY.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function iM(){return new iq({type:"unknown"})}let iV=e_("ZodNever",(e,t)=>{rX.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{t.not={}}}),iK=e_("ZodDate",(e,t)=>{r0.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Date cannot be represented in JSON Schema")})(0,e,0,0),e.min=(t,r)=>e.check(nN(t,r)),e.max=(t,r)=>e.check(n$(t,r));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null}),iW=e_("ZodArray",(e,t)=>{r2.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let i=e._zod.def,{minimum:a,maximum:o}=e._zod.bag;"number"==typeof a&&(r.minItems=a),"number"==typeof o&&(r.maxItems=o),r.type="array",r.items=nW(i.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,is(e,"ZodArray",{min(e,t){return this.check(nB(e,t))},nonempty(e){return this.check(nB(1,e))},max(e,t){return this.check(nH(e,t))},length(e,t){return this.check(nq(e,t))},unwrap(){return this.element}})});function iF(e,t){return new iW({type:"array",element:e,...eZ(t)})}let iJ=e_("ZodObject",(e,t)=>{r3.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let i=e._zod.def;r.type="object",r.properties={};let a=i.shape;for(let e in a)r.properties[e]=nW(a[e],t,{...n,path:[...n.path,"properties",e]});let o=new Set([...new Set(Object.keys(a))].filter(e=>{let r=i.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));o.size>0&&(r.required=Array.from(o)),i.catchall?._zod.def.type==="never"?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=nW(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)})(e,t,r,n),nV.defineLazy(e,"shape",()=>t.shape),is(e,"ZodObject",{keyof(){return i1(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:iM()})},loose(){return this.clone({...this._zod.def,catchall:iM()})},strict(){return this.clone({...this._zod.def,catchall:new iV({type:"never",...eZ(void 0)})})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return nV.extend(this,e)},safeExtend(e){return nV.safeExtend(this,e)},merge(e){return nV.merge(this,e)},pick(e){return nV.pick(this,e)},omit(e){return nV.omit(this,e)},partial(...e){return nV.partial(i5,this,e[0])},required(...e){return nV.required(ae,this,e[0])}})});function iZ(e,t){return new iJ({type:"object",shape:e??{},...nV.normalizeParams(t)})}let iG=e_("ZodUnion",(e,t)=>{r7.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{var i,a,o,s;let c,l,d;return i=e,a=t,o=r,s=n,l=!1===(c=i._zod.def).inclusive,d=c.options.map((e,t)=>nW(e,a,{...s,path:[...s.path,l?"oneOf":"anyOf",t]})),void(l?o.oneOf=d:o.anyOf=d)},e.options=t.options}),iQ=e_("ZodIntersection",(e,t)=>{nt.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i,a,o,s;return a=nW((i=e._zod.def).left,t,{...n,path:[...n.path,"allOf",0]}),o=nW(i.right,t,{...n,path:[...n.path,"allOf",1]}),void(r.allOf=[...(s=e=>"allOf"in e&&1===Object.keys(e).length)(a)?a.allOf:[a],...s(o)?o.allOf:[o]])}}),iY=e_("ZodRecord",(e,t)=>{ns.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let i=e._zod.def;r.type="object";let a=i.keyType,o=a._zod.bag,s=o?.patterns;if("loose"===i.mode&&s&&s.size>0){let e=nW(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});for(let t of(r.patternProperties={},s))r.patternProperties[t.source]=e}else("draft-07"===t.target||"draft-2020-12"===t.target)&&(r.propertyNames=nW(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),r.additionalProperties=nW(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let c=a._zod.values;if(c){let e=[...c].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(r.required=e)}})(e,t,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function iX(e,t,r){return new iY(t&&t._zod?{type:"record",keyType:e,valueType:t,...nV.normalizeParams(r)}:{type:"record",keyType:iu(),valueType:e,...nV.normalizeParams(t)})}let i0=e_("ZodEnum",(e,t)=>{nd.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;(i=eI(e._zod.def.entries)).every(e=>"number"==typeof e)&&(r.type="number"),i.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=i},e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{let i={};for(let n of e)if(r.has(n))i[n]=t.entries[n];else throw Error(`Key ${n} not found in enum`);return new i0({...t,checks:[],...nV.normalizeParams(n),entries:i})},e.exclude=(e,n)=>{let i={...t.entries};for(let t of e)if(r.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new i0({...t,checks:[],...nV.normalizeParams(n),entries:i})}});function i1(e,t){return new i0({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...nV.normalizeParams(t)})}let i2=e_("ZodTransform",(e,t)=>{nu.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")})(0,e,0,0),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new ex(e.constructor.name);r.addIssue=n=>{"string"==typeof n?r.issues.push(nV.issue(n,r.value,t)):(n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=e),r.issues.push(nV.issue(n)))};let i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}}),i5=e_("ZodOptional",(e,t)=>{nf.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>nQ(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function i6(e){return new i5({type:"optional",innerType:e})}let i4=e_("ZodExactOptional",(e,t)=>{nh.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>nQ(e,t,r,n),e.unwrap=()=>e._zod.def.innerType}),i8=e_("ZodNullable",(e,t)=>{nm.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i,a,o;return a=nW((i=e._zod.def).innerType,t,n),o=t.seen.get(e),void("openapi-3.0"===t.target?(o.ref=i.innerType,r.nullable=!0):r.anyOf=[a,{type:"null"}])},e.unwrap=()=>e._zod.def.innerType});function i3(e){return new i8({type:"nullable",innerType:e})}let i9=e_("ZodDefault",(e,t)=>{ny.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;nW((i=e._zod.def).innerType,t,n),t.seen.get(e).ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),i7=e_("ZodPrefault",(e,t)=>{nw.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;nW((i=e._zod.def).innerType,t,n),t.seen.get(e).ref=i.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},e.unwrap=()=>e._zod.def.innerType}),ae=e_("ZodNonOptional",(e,t)=>{nb.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;nW((i=e._zod.def).innerType,t,n),t.seen.get(e).ref=i.innerType},e.unwrap=()=>e._zod.def.innerType}),at=e_("ZodCatch",(e,t)=>{nE.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{let i,a=e._zod.def;nW(a.innerType,t,n),t.seen.get(e).ref=a.innerType;try{i=a.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),ar=e_("ZodPipe",(e,t)=>{nv.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i,a,o;return a=(i=e._zod.def).in._zod.traits.has("$ZodTransform"),void(nW(o="input"===t.io?a?i.out:i.in:i.out,t,n),t.seen.get(e).ref=o)},e.in=t.in,e.out=t.out});function an(e,t){return new ar({type:"pipe",in:e,out:t})}let ai=e_("ZodReadonly",(e,t)=>{nx.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(t,r,n)=>{let i;nW((i=e._zod.def).innerType,t,n),t.seen.get(e).ref=i.innerType,r.readOnly=!0},e.unwrap=()=>e._zod.def.innerType}),aa=e_("ZodCustom",(e,t)=>{nT.init(e,t),ic.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r,n)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")})(0,e,0,0)}),ao={};function as(e){switch(e.constructor.name){case"ZodString":default:return"string";case"ZodNumber":return"number";case"ZodBoolean":return"boolean";case"ZodObject":return"object";case"ZodArray":return"array"}}function ac(e){let t=[];return e.metadata?.openapi?.parameters?t.push(...e.metadata.openapi.parameters):e.query instanceof iJ&&Object.entries(e.query.shape).forEach(([e,r])=>{r instanceof iJ&&t.push({name:e,in:"query",schema:{type:as(r),..."minLength"in r&&r.minLength?{minLength:r.minLength}:{},description:r.description}})}),t}function al(e){return{400:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}},required:["message"]}}},description:"Bad Request. Usually due to missing parameters, or invalid parameters."},401:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}},required:["message"]}}},description:"Unauthorized. Due to missing or invalid authentication."},403:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}}}}},description:"Forbidden. You do not have permission to access this resource or to perform this action."},404:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}}}}},description:"Not Found. The requested resource was not found."},429:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}}}}},description:"Too Many Requests. You have exceeded the rate limit. Try again later."},500:{content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}}}}},description:"Internal Server Error. This is a problem with the server that you cannot fix."},...e}}async function ad(e,t){return Object.entries(e).forEach(([e,t])=>{let r=t.options;if(!(!t.path||r.metadata?.SERVER_ONLY)&&("GET"===r.method&&(ao[t.path]={get:{tags:["Default",...r.metadata?.openapi?.tags||[]],description:r.metadata?.openapi?.description,operationId:r.metadata?.openapi?.operationId,security:[{bearerAuth:[]}],parameters:ac(r),responses:al(r.metadata?.openapi?.responses)}}),"POST"===r.method)){let e=function(e){if(e.metadata?.openapi?.requestBody)return e.metadata.openapi.requestBody;if(e.body&&(e.body instanceof iJ||e.body instanceof i5)){let t=e.body.shape;if(!t)return;let r={},n=[];return Object.entries(t).forEach(([e,t])=>{t instanceof iJ&&(r[e]={type:as(t),description:t.description},t instanceof i5||n.push(e))}),{required:!(e.body instanceof i5)&&!!e.body,content:{"application/json":{schema:{type:"object",properties:r,required:n}}}}}}(r);ao[t.path]={post:{tags:["Default",...r.metadata?.openapi?.tags||[]],description:r.metadata?.openapi?.description,operationId:r.metadata?.openapi?.operationId,security:[{bearerAuth:[]}],parameters:ac(r),...e?{requestBody:e}:{requestBody:{content:{"application/json":{schema:{type:"object",properties:{}}}}}},responses:al(r.metadata?.openapi?.responses)}}}}),{openapi:"3.1.1",info:{title:"Better Auth",description:"API Reference for your Better Auth Instance",version:"1.1.0"},components:{schemas:{}},security:[{apiKeyCookie:[]}],servers:[{url:t?.url}],tags:[{name:"Default",description:"Default endpoints that are included with Better Auth by default. These endpoints are not part of any plugin."}],paths:ao}}let au=((o=function(){}).prototype=Object.create(null),Object.freeze(o.prototype),o);function ap(){return{root:{key:""},static:new au}}function af(e){let[t,...r]=e.split("/");return""===r[r.length-1]?r.slice(0,-1):r}function ah(e,t){let r=new au;for(let[n,i]of t){let t=n<0?e.slice(-(n+1)).join("/"):e[n];if("string"==typeof i)r[i]=t;else{let e=t.match(i);if(e)for(let t in e.groups)r[t]=e.groups[t]}}return r}function am(e,t="",r,n){t=t.toUpperCase(),47!==r.charCodeAt(0)&&(r=`/${r}`);let i=af(r=r.replace(/\\:/g,"%3A")),a=e.root,o=0,s=[],c=[];for(let e=0;e<i.length;e++){let t=i[e];if(t.startsWith("**")){a.wildcard||(a.wildcard={key:"**"}),a=a.wildcard,s.push([-(e+1),t.split(":")[1]||"_",2===t.length]);break}if("*"===t||t.includes(":")){if(a.param||(a.param={key:"*"}),a=a.param,"*"===t)s.push([e,`_${o++}`,!0]);else if(t.includes(":",1)){let r=function(e){let t=e.replace(/:(\w+)/g,(e,t)=>`(?<${t}>[^/]+)`).replace(/\./g,"\\.");return RegExp(`^${t}$`)}(t);c[e]=r,a.hasRegexParam=!0,s.push([e,r,!1])}else s.push([e,t.slice(1),!1]);continue}"\\*"===t?t=i[e]="*":"\\*\\*"===t&&(t=i[e]="**");let r=a.static?.[t];if(r)a=r;else{let e={key:t};a.static||(a.static=new au),a.static[t]=e,a=e}}let l=s.length>0;a.methods||(a.methods=new au),a.methods[t]??=[],a.methods[t].push({data:n||null,paramsRegexp:c,paramsMap:l?s:void 0}),l||(e.static["/"+i.join("/")]=a)}function ay(e){return e instanceof X.APIError||e instanceof Y.APIError||e?.name==="APIError"}let ag=ek(async()=>({})),aw=ek.create({use:[ag,ek(async()=>({}))]}),ab=[ag];function aA(e,t,r){let n="string"==typeof e?e:void 0,i="object"==typeof t?t:e,a="function"==typeof t?t:r,o=async e=>{try{return await Q(e,()=>a(e))}catch(r){var t;throw t=e.responseHeaders,ay(r)&&t&&Object.defineProperty(r,X.kAPIErrorHeaderSymbol,{enumerable:!1,configurable:!0,value:t,writable:!1}),r}};return n?ev(n,{...i,use:[...i?.use||[],...ab]},o):ev({...i,use:[...i?.use||[],...ab]},o)}aA.serverOnly=(e,t)=>aA({...e,metadata:{...e.metadata,SERVER_ONLY:!0}},t);var aE=e.i(89551),av=e.i(12714),ak=e.i(50227),a_=e.i(43651),aS=e.i(80527);async function ax(t,r){let n;if(t.database)n="function"==typeof t.database?t.database(t):await r(t);else{let r=Object.keys((0,a_.getAuthTables)(t)).reduce((e,t)=>(e[t]=[],e),{}),{memoryAdapter:i}=await e.A(16432);n=i(r)(t)}return n.transaction||(aS.logger.warn("Adapter does not correctly implement transaction function, patching it automatically. Please update your adapter implementation."),n.transaction=async e=>e(n)),n}async function aR(t){return ax(t,async t=>{let{createKyselyAdapter:r}=await e.A(92291),{kysely:n,databaseType:i,transaction:a}=await r(t);if(!n)throw new Y.BetterAuthError("Failed to initialize database adapter");let{kyselyAdapter:o}=await e.A(92291);return o(n,{type:i||"sqlite",debugLogs:!!t.database&&"debugLogs"in t.database&&t.database.debugLogs,transaction:a})(t)})}var aT=e.i(13906),aI=e.i(15272),aU=e.i(97495),aO=e.i(29401);let aP={postgres:{string:["character varying","varchar","text","uuid"],number:["int4","integer","bigint","smallint","numeric","real","double precision"],boolean:["bool","boolean"],date:["timestamptz","timestamp","date"],json:["json","jsonb"]},mysql:{string:["varchar","text","uuid"],number:["integer","int","bigint","smallint","decimal","float","double"],boolean:["boolean","tinyint"],date:["timestamp","datetime","date"],json:["json"]},sqlite:{string:["TEXT"],number:["INTEGER","REAL"],boolean:["INTEGER","BOOLEAN"],date:["DATE","INTEGER"],json:["TEXT"]},mssql:{string:["varchar","nvarchar","uniqueidentifier"],number:["int","bigint","smallint","decimal","float","double"],boolean:["bit","smallint"],date:["datetime2","date","datetime"],json:["varchar","nvarchar"]}};async function aC(e){try{let t=await aO.sql`SHOW search_path`.execute(e),r=t.rows[0]?.search_path??t.rows[0]?.searchPath;if(r)return r.split(",").map(e=>e.trim()).map(e=>e.replace(/^["']|["']$/g,"")).filter(e=>!e.startsWith("$")&&!e.startsWith("\\$"))[0]||"public"}catch{}return"public"}async function aD(e){let t=function(e){let t=(0,a_.getAuthTables)(e),r={};for(let e in t){let n=t[e],i=n.fields,a={};if(Object.entries(i).forEach(([e,r])=>{if(a[r.fieldName||e]=r,r.references){let n=t[r.references.model];n&&(a[r.fieldName||e].references={...r.references,model:n.modelName,field:r.references.field})}}),r[n.modelName]){r[n.modelName].fields={...r[n.modelName].fields,...a},n.disableMigrations&&(r[n.modelName].disableMigrations=!0);continue}r[n.modelName]={fields:a,order:n.order||1/0,disableMigrations:n.disableMigrations}}return r}(e),r=(0,aS.createLogger)(e.logger),{kysely:n,databaseType:i}=await (0,aT.createKyselyAdapter)(e);i||(r.warn("Could not determine database type, defaulting to sqlite. Please provide a type in the database options to avoid this."),i="sqlite"),n||(r.error("Only kysely adapter is supported for migrations. You can use `generate` command to generate the schema, if you're using a different adapter."),process.exit(1));let a="public";if("postgres"===i){a=await aC(n),r.debug(`PostgreSQL migration: Using schema '${a}' (from search_path)`);try{let e=await aO.sql`
63
63
  SELECT schema_name
64
64
  FROM information_schema.schemata
65
65
  WHERE schema_name = ${a}
@@ -1,4 +1,4 @@
1
- module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},96253,(e,t,r)=>{"use strict";t.exports=e.r(18622)},85132,(e,t,r)=>{"use strict";t.exports=e.r(96253).vendored["react-rsc"].React},86109,(e,t,r)=>{"use strict";var s=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a={},p={RequestCookies:()=>y,ResponseCookies:()=>g,parseCookie:()=>l,parseSetCookie:()=>u,stringifyCookie:()=>d};for(var c in p)s(a,c,{get:p[c],enumerable:!0});function d(e){var t;let r=["path"in e&&e.path&&`Path=${e.path}`,"expires"in e&&(e.expires||0===e.expires)&&`Expires=${("number"==typeof e.expires?new Date(e.expires):e.expires).toUTCString()}`,"maxAge"in e&&"number"==typeof e.maxAge&&`Max-Age=${e.maxAge}`,"domain"in e&&e.domain&&`Domain=${e.domain}`,"secure"in e&&e.secure&&"Secure","httpOnly"in e&&e.httpOnly&&"HttpOnly","sameSite"in e&&e.sameSite&&`SameSite=${e.sameSite}`,"partitioned"in e&&e.partitioned&&"Partitioned","priority"in e&&e.priority&&`Priority=${e.priority}`].filter(Boolean),s=`${e.name}=${encodeURIComponent(null!=(t=e.value)?t:"")}`;return 0===r.length?s:`${s}; ${r.join("; ")}`}function l(e){let t=new Map;for(let r of e.split(/; */)){if(!r)continue;let e=r.indexOf("=");if(-1===e){t.set(r,"true");continue}let[s,n]=[r.slice(0,e),r.slice(e+1)];try{t.set(s,decodeURIComponent(null!=n?n:"true"))}catch{}}return t}function u(e){if(!e)return;let[[t,r],...s]=l(e),{domain:n,expires:o,httponly:i,maxage:a,path:p,samesite:c,secure:d,partitioned:u,priority:y}=Object.fromEntries(s.map(([e,t])=>[e.toLowerCase().replace(/-/g,""),t]));{var g,b,f={name:t,value:decodeURIComponent(r),domain:n,...o&&{expires:new Date(o)},...i&&{httpOnly:!0},..."string"==typeof a&&{maxAge:Number(a)},path:p,...c&&{sameSite:h.includes(g=(g=c).toLowerCase())?g:void 0},...d&&{secure:!0},...y&&{priority:m.includes(b=(b=y).toLowerCase())?b:void 0},...u&&{partitioned:!0}};let e={};for(let t in f)f[t]&&(e[t]=f[t]);return e}}t.exports=((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let a of o(t))i.call(e,a)||void 0===a||s(e,a,{get:()=>t[a],enumerable:!(r=n(t,a))||r.enumerable});return e})(s({},"__esModule",{value:!0}),a);var h=["strict","lax","none"],m=["low","medium","high"],y=class{constructor(e){this._parsed=new Map,this._headers=e;const t=e.get("cookie");if(t)for(const[e,r]of l(t))this._parsed.set(e,{name:e,value:r})}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed);if(!e.length)return r.map(([e,t])=>t);let s="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(([e])=>e===s).map(([e,t])=>t)}has(e){return this._parsed.has(e)}set(...e){let[t,r]=1===e.length?[e[0].name,e[0].value]:e,s=this._parsed;return s.set(t,{name:t,value:r}),this._headers.set("cookie",Array.from(s).map(([e,t])=>d(t)).join("; ")),this}delete(e){let t=this._parsed,r=Array.isArray(e)?e.map(e=>t.delete(e)):t.delete(e);return this._headers.set("cookie",Array.from(t).map(([e,t])=>d(t)).join("; ")),r}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(e=>`${e.name}=${encodeURIComponent(e.value)}`).join("; ")}},g=class{constructor(e){var t,r,s;this._parsed=new Map,this._headers=e;const n=null!=(s=null!=(r=null==(t=e.getSetCookie)?void 0:t.call(e))?r:e.get("set-cookie"))?s:[];for(const e of Array.isArray(n)?n:function(e){if(!e)return[];var t,r,s,n,o,i=[],a=0;function p(){for(;a<e.length&&/\s/.test(e.charAt(a));)a+=1;return a<e.length}for(;a<e.length;){for(t=a,o=!1;p();)if(","===(r=e.charAt(a))){for(s=a,a+=1,p(),n=a;a<e.length&&"="!==(r=e.charAt(a))&&";"!==r&&","!==r;)a+=1;a<e.length&&"="===e.charAt(a)?(o=!0,a=n,i.push(e.substring(t,s)),t=a):a=s+1}else a+=1;(!o||a>=e.length)&&i.push(e.substring(t,e.length))}return i}(n)){const t=u(e);t&&this._parsed.set(t.name,t)}}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed.values());if(!e.length)return r;let s="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(e=>e.name===s)}has(e){return this._parsed.has(e)}set(...e){let[t,r,s]=1===e.length?[e[0].name,e[0].value,e[0]]:e,n=this._parsed;return n.set(t,function(e={name:"",value:""}){return"number"==typeof e.expires&&(e.expires=new Date(e.expires)),e.maxAge&&(e.expires=new Date(Date.now()+1e3*e.maxAge)),(null===e.path||void 0===e.path)&&(e.path="/"),e}({name:t,value:r,...s})),function(e,t){for(let[,r]of(t.delete("set-cookie"),e)){let e=d(r);t.append("set-cookie",e)}}(n,this._headers),this}delete(...e){let[t,r]="string"==typeof e[0]?[e[0]]:[e[0].name,e[0]];return this.set({...r,name:t,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(d).join("; ")}}},48806,e=>{"use strict";let t={description:"Error",content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}}};e.s(["buildOpenApi",0,function(){return{openapi:"3.1.0",info:{title:"AgentBox Hub API",version:"1.0.0",description:'Launch and manage AgentBox sandboxes ("boxes") programmatically. Every endpoint except /health, /openapi.json and /docs requires an Authorization: Bearer <hub token> header (the token the hub prints on boot, also at ~/.agentbox/hub/token). Errors always return { error: { code, message, details? } }.'},servers:[{url:"/api/v1"}],security:[{bearerAuth:[]}],tags:[{name:"System",description:"Liveness and API version."},{name:"Boxes",description:"Create, inspect, and run lifecycle actions on boxes."},{name:"Box git",description:"Git state and operations on a box's branch."},{name:"Box services",description:"A box's agentbox.yaml service/task/port status."},{name:"Projects",description:"Register folders as projects and list their branches."},{name:"Providers",description:"Sandbox providers: status, credentials, base-image bake."},{name:"Approvals",description:"Pending host-action approvals."},{name:"Jobs",description:"Async create/bake job status and log streams."}],paths:{"/health":{get:{tags:["System"],summary:"Get liveness + API version",security:[],responses:{200:{description:"OK",content:{"application/json":{schema:{$ref:"#/components/schemas/Health"}}}}}}},"/boxes":{get:{tags:["Boxes"],summary:"List boxes",responses:{200:{description:"Boxes",content:{"application/json":{schema:{type:"object",properties:{boxes:{type:"array",items:{$ref:"#/components/schemas/Box"}}},required:["boxes"]}}}},401:t}},post:{tags:["Boxes"],summary:"Create a box",description:'Async — returns a job id. agent "none" just creates the box without starting an agent (prompt ignored). provider defaults to docker; a cloud provider must be configured on the host (see GET /providers).',requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/CreateBox"}}}},responses:{202:{description:"Accepted — build job enqueued",content:{"application/json":{schema:{type:"object",properties:{jobId:{type:"string"}},required:["jobId"]}}}},400:t,401:t,404:t,503:t}}},"/boxes/{id}":{get:{tags:["Boxes"],summary:"Get one box",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Box",content:{"application/json":{schema:{$ref:"#/components/schemas/Box"}}}},401:t,404:t}}},"/boxes/{id}/{action}":{post:{tags:["Boxes"],summary:"Run a lifecycle action",description:"One of start | pause | resume | stop | destroy | screen. start brings a stopped box back up (resumes if paused, no-op if already running); it does not restart the agent session — that happens on the next attach. screen is the open-VNC prep step: it points the in-box browser at the box’s web app so the VNC desktop shows the app instead of a blank X screen — call it right before opening the box’s vncUrl.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}},{name:"action",in:"path",required:!0,schema:{type:"string",enum:["start","pause","resume","stop","destroy","screen"]}}],responses:{200:{description:"Done",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},400:t,401:t,404:t,409:t,503:t}}},"/boxes/{id}/git":{get:{tags:["Box git"],summary:"Get the box's live git summary",description:"The worktree's current branch, dirty, ahead/behind.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Git info",content:{"application/json":{schema:{$ref:"#/components/schemas/GitInfo"}}}},401:t,404:t,503:t}}},"/boxes/{id}/git/{op}":{post:{tags:["Box git"],summary:"Run a git op on the box branch",description:"checkout {branch}; branch {name, from?} (create+switch a new agentbox/* branch); pull {remote?, ffOnly?}; push {remote?, force?}; push-host {as?, force?} (land in the host repo only, publishes nothing).",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}},{name:"op",in:"path",required:!0,schema:{type:"string",enum:["checkout","branch","pull","push","push-host"]}}],requestBody:{required:!1,content:{"application/json":{schema:{$ref:"#/components/schemas/GitOpBody"}}}},responses:{200:{description:"Done (git stdout/stderr)",content:{"application/json":{schema:{$ref:"#/components/schemas/GitOpResult"}}}},400:t,401:t,404:t,409:t,503:t}}},"/boxes/{id}/branches":{get:{tags:["Box git"],summary:"List the box project's branches",description:"Local + remote branches and the current HEAD, for the box git-panel branch picker.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Branches",content:{"application/json":{schema:{$ref:"#/components/schemas/BranchList"}}}},400:t,401:t,404:t,503:t}}},"/boxes/{id}/services":{get:{tags:["Box services"],summary:"Get the box's service/task/port status",description:"From the box's agentbox.yaml — live, or the persisted snapshot when the box isn't running.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Services",content:{"application/json":{schema:{$ref:"#/components/schemas/Services"}}}},401:t,503:t}}},"/boxes/{id}/services/restart":{post:{tags:["Box services"],summary:"Restart services",description:"Restart one service (body {name}) or every service (empty body).",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],requestBody:{required:!1,content:{"application/json":{schema:{type:"object",properties:{name:{type:"string"}}}}}},responses:{200:{description:"Restarted",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},400:t,401:t,404:t,409:t,503:t}}},"/boxes/{id}/open":{post:{tags:["Box services"],summary:"Open the box in a host app",description:"Launch the box in a host GUI app (Codex, VS Code/Cursor, cmux, Herdr, iTerm2) by re-shelling `agentbox open --in <app>`. Only works on a localhost hub running on macOS; a remote hub / non-macOS host refuses. An app must be installed and provider-eligible (e.g. Codex is Hetzner-only) — see GET /open-targets.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],requestBody:{required:!0,content:{"application/json":{schema:{type:"object",properties:{app:{type:"string",enum:["codex","herdr","cmux","vscode","iterm2"]}},required:["app"]}}}},responses:{200:{description:"Launched",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},400:t,401:t,404:t,409:t,503:t}}},"/open-targets":{get:{tags:["Box services"],summary:"Which host apps this hub can open a box in",description:'Reports whether the hub can launch host GUI apps (`supported` — true only on a localhost hub on macOS) and, if so, which of Codex/Herdr/cmux/VS Code/iTerm2 are installed plus their provider eligibility. Backs the box detail page "Apps" launchers.',responses:{200:{description:"Open targets",content:{"application/json":{schema:{type:"object",properties:{supported:{type:"boolean"},targets:{type:["object","null"],additionalProperties:{type:"object",properties:{available:{type:"boolean"},providers:{type:"array",items:{type:"string"}}},required:["available"]}}},required:["supported","targets"]}}}},401:t}}},"/projects":{get:{tags:["Projects"],summary:"List registered projects",responses:{200:{description:"Projects",content:{"application/json":{schema:{type:"object",properties:{projects:{type:"array",items:{$ref:"#/components/schemas/Project"}}},required:["projects"]}}}},401:t}},post:{tags:["Projects"],summary:"Register a folder as a project",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",properties:{path:{type:"string",description:"Absolute path to the folder."}},required:["path"]}}}},responses:{200:{description:"Registered",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},400:t,401:t,503:t}}},"/projects/{id}":{delete:{tags:["Projects"],summary:"Unregister an empty project",description:"Folder/files on disk are untouched.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Removed",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},401:t,404:t,409:t,503:t}}},"/projects/{id}/branches":{get:{tags:["Projects"],summary:"List a project's branches",description:"Local + remote branches and the current HEAD, for the create-box base-branch picker.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Branches",content:{"application/json":{schema:{$ref:"#/components/schemas/BranchList"}}}},400:t,401:t,404:t,503:t}}},"/providers":{get:{tags:["Providers"],summary:"List sandbox providers",description:"With credential + baked status on this host.",responses:{200:{description:"Providers",content:{"application/json":{schema:{type:"object",properties:{providers:{type:"array",items:{$ref:"#/components/schemas/Provider"}}},required:["providers"]}}}},401:t}}},"/providers/{id}/credentials":{post:{tags:["Providers"],summary:"Set a provider's credentials",description:"API keys/tokens, validated then saved to secrets.env. Never echoes secret values.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string",enum:["docker","daytona","hetzner","vercel","e2b","digitalocean"]}}],requestBody:{required:!0,content:{"application/json":{schema:{type:"object",additionalProperties:{type:"string"},description:"Provider-specific fields, e.g. { apiKey } (e2b), { token } (hetzner), { apiKey } or { jwtToken, organizationId } (daytona), { token, teamId?, projectId? } (vercel)."}}}},responses:{200:{description:"Saved",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},400:t,401:t,503:t}}},"/providers/{id}/prepare":{post:{tags:["Providers"],summary:"Bake a provider's base image",description:"Async — returns a job id. Progress streams over GET /jobs/{id}/logs.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string",enum:["docker","daytona","hetzner","vercel","e2b","digitalocean"]}}],requestBody:{required:!1,content:{"application/json":{schema:{type:"object",properties:{force:{type:"boolean"},claudeInstall:{type:"string",enum:["native","npm"]}}}}}},responses:{202:{description:"Bake enqueued",content:{"application/json":{schema:{type:"object",properties:{jobId:{type:"string"}},required:["jobId"]}}}},400:t,401:t,409:t,503:t}}},"/approvals":{get:{tags:["Approvals"],summary:"List pending host-action approvals",responses:{200:{description:"Approvals",content:{"application/json":{schema:{type:"object",properties:{approvals:{type:"array",items:{$ref:"#/components/schemas/Approval"}}},required:["approvals"]}}}},401:t}}},"/approvals/{id}/answer":{post:{tags:["Approvals"],summary:"Answer a pending approval",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],requestBody:{required:!0,content:{"application/json":{schema:{type:"object",properties:{answer:{type:"string",enum:["y","n"]}},required:["answer"]}}}},responses:{200:{description:"Resolved",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},400:t,401:t,404:t,503:t}}},"/jobs/{id}":{get:{tags:["Jobs"],summary:"Get a create job status",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Job",content:{"application/json":{schema:{$ref:"#/components/schemas/Job"}}}},401:t,404:t}}},"/jobs/{id}/logs":{get:{tags:["Jobs"],summary:"Stream a create job log (SSE)",description:"text/event-stream. Emits `open`, then `log` events per line, then a terminal `end` event with the final status.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"SSE stream",content:{"text/event-stream":{}}},401:t,404:t,503:t}}}},components:{securitySchemes:{bearerAuth:{type:"http",scheme:"bearer",description:"The hub token (Authorization: Bearer <token>)."}},schemas:{Health:{type:"object",properties:{ok:{const:!0},apiVersion:{type:"string"},profile:{type:"string"}},required:["ok","apiVersion"]},Error:{type:"object",properties:{error:{type:"object",properties:{code:{type:"string"},message:{type:"string"},details:{}},required:["code","message"]}},required:["error"]},Box:{type:"object",properties:{id:{type:"string"},projectId:{type:"string"},repo:{type:"string"},branch:{type:"string"},task:{type:"string"},agent:{type:"string"},status:{type:"string",enum:["running","paused","stopped","creating","error"]},createdAt:{type:"number"},lastActivity:{type:"number"},host:{type:"string"},commits:{type:["number","null"]},filesTouched:{type:["number","null"]},error:{type:["string","null"]},displayName:{type:["string","null"],description:"Cosmetic user-set label (rename); null when unset"},webUrl:{type:["string","null"],description:"Host-openable web-service URL; null when absent/unreachable (e.g. paused)"},vncUrl:{type:["string","null"],description:"Host-openable VNC desktop URL; null when absent/unreachable"},state:{type:"string",enum:["running","paused","stopped","missing"],description:"Raw provider runtime state (host topology only). Absent on synthetic creating/error rows — presence distinguishes a real box whose agent errored from a failed create job."},name:{type:"string"},provider:{type:"string",description:"Raw provider id ('docker', 'daytona', …; plugin ids possible)"},projectRoot:{type:"string",description:"Absolute host path of the project. Host topology only — never emitted by the hosted plane"},projectIndex:{type:"number"},vncEnabled:{type:"boolean"},gitWorktrees:{type:"array",items:{type:"object",properties:{kind:{type:"string"},branch:{type:"string"}}}},claudeSessionTitle:{type:"string"},codexSessionTitle:{type:"string"},opencodeSessionTitle:{type:"string"},claudeActivity:{type:"string",description:"working | idle | waiting | end-plan | question | compacting | error | unknown"},codexActivity:{type:"string"}},required:["id","projectId","status","agent"]},Project:{type:"object",properties:{id:{type:"string"},name:{type:"string"},repo:{type:"string"},defaultBranch:{type:"string"},currentBranch:{type:"string",nullable:!0},needsSetup:{type:"boolean",description:"No agentbox.yaml + no default snapshot — the create form offers the setup wizard"},provider:{type:"string"},createdAt:{type:"number"}},required:["id","name"]},BranchList:{type:"object",properties:{current:{type:"string",nullable:!0,description:"The repo's current HEAD (the default base ref)"},branches:{type:"array",items:{type:"string"},description:"Local + remote-tracking branch names"}},required:["branches"]},Approval:{type:"object",properties:{id:{type:"string"},boxId:{type:"string"},message:{type:"string"},detail:{type:"string"},command:{type:"string"},cwd:{type:"string"},argv:{type:"array",items:{type:"string"}},defaultAnswer:{type:"string",enum:["y","n"]},createdAt:{type:"number"}},required:["id","boxId","message","defaultAnswer"]},Job:{type:"object",properties:{id:{type:"string"},status:{type:"string",enum:["queued","running","done","failed","cancelled"]},boxId:{type:"string"}},required:["id","status"]},CreateBox:{type:"object",properties:{projectId:{type:"string"},agent:{type:"string",enum:["claude","codex","opencode","none"]},provider:{type:"string",enum:["docker","daytona","hetzner","vercel","e2b","digitalocean"],default:"docker"},name:{type:"string"},prompt:{type:"string"},fromBranch:{type:"string",description:"Base ref the box's per-box branch forks from (branch / tag / SHA); default the project's HEAD"},setupWizard:{type:"boolean",description:'Seed the agent\'s first turn to generate agentbox.yaml (for projects with none). Inert for agent "none".'}},required:["projectId","agent"]},Provider:{type:"object",properties:{id:{type:"string",enum:["docker","daytona","hetzner","vercel","e2b","digitalocean"]},label:{type:"string"},configured:{type:"boolean",description:"Base image baked (usable for create) on this host."},hasCredentials:{type:"boolean",description:"Credentials present (docker: always true). Can be true while not yet configured (baked)."},jobId:{type:"string",description:"Id of an in-flight bake (prepare) job for this provider, if any."},reason:{type:"string"}},required:["id","label","configured"]},GitOpBody:{type:"object",description:"Union of git-op fields; only those for the chosen {op} are read (extras are ignored).",properties:{branch:{type:"string",description:"checkout: branch to switch to"},name:{type:"string",description:"branch: new branch name (agentbox/ prefix added when missing)"},from:{type:"string",description:"branch: base ref to fork from (default: box's HEAD)"},remote:{type:"string",description:"push/pull: remote name (default: origin)"},force:{type:"boolean",description:"push: force the remote push; push-host: overwrite the destination branch"},ffOnly:{type:"boolean",description:"pull: pass --ff-only to the merge"},as:{type:"string",description:"push-host: destination branch name in the host repo (default: the box's branch)"}}},GitOpResult:{type:"object",properties:{ok:{const:!0},stdout:{type:"string"},stderr:{type:"string"}},required:["ok"]},GitInfo:{type:"object",properties:{ok:{type:"boolean"},branch:{type:"string"},dirty:{type:"boolean"},ahead:{type:"number"},behind:{type:"number"},error:{type:"string"}},required:["ok"]},Services:{type:"object",properties:{source:{type:"string",enum:["live","persisted","unavailable"]},services:{type:"array",items:{type:"object",properties:{name:{type:"string"},state:{type:"string"},pid:{type:["number","null"]},restarts:{type:"number"},lastExitCode:{type:["number","null"]},blockedOn:{type:"array",items:{type:"string"}},command:{type:"string"}},required:["name","state"]}},tasks:{type:"array",items:{type:"object",properties:{name:{type:"string"},state:{type:"string"}},required:["name","state"]}},ports:{type:"array",items:{type:"object",properties:{port:{type:"number"},service:{type:["string","null"]}},required:["port"]}},error:{type:"string"}},required:["source","services","tasks","ports"]}}}}},"docsHtml",0,function(){return`<!doctype html>
1
+ module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},96253,(e,t,r)=>{"use strict";t.exports=e.r(18622)},85132,(e,t,r)=>{"use strict";t.exports=e.r(96253).vendored["react-rsc"].React},86109,(e,t,r)=>{"use strict";var s=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a={},p={RequestCookies:()=>y,ResponseCookies:()=>g,parseCookie:()=>l,parseSetCookie:()=>u,stringifyCookie:()=>d};for(var c in p)s(a,c,{get:p[c],enumerable:!0});function d(e){var t;let r=["path"in e&&e.path&&`Path=${e.path}`,"expires"in e&&(e.expires||0===e.expires)&&`Expires=${("number"==typeof e.expires?new Date(e.expires):e.expires).toUTCString()}`,"maxAge"in e&&"number"==typeof e.maxAge&&`Max-Age=${e.maxAge}`,"domain"in e&&e.domain&&`Domain=${e.domain}`,"secure"in e&&e.secure&&"Secure","httpOnly"in e&&e.httpOnly&&"HttpOnly","sameSite"in e&&e.sameSite&&`SameSite=${e.sameSite}`,"partitioned"in e&&e.partitioned&&"Partitioned","priority"in e&&e.priority&&`Priority=${e.priority}`].filter(Boolean),s=`${e.name}=${encodeURIComponent(null!=(t=e.value)?t:"")}`;return 0===r.length?s:`${s}; ${r.join("; ")}`}function l(e){let t=new Map;for(let r of e.split(/; */)){if(!r)continue;let e=r.indexOf("=");if(-1===e){t.set(r,"true");continue}let[s,n]=[r.slice(0,e),r.slice(e+1)];try{t.set(s,decodeURIComponent(null!=n?n:"true"))}catch{}}return t}function u(e){if(!e)return;let[[t,r],...s]=l(e),{domain:n,expires:o,httponly:i,maxage:a,path:p,samesite:c,secure:d,partitioned:u,priority:y}=Object.fromEntries(s.map(([e,t])=>[e.toLowerCase().replace(/-/g,""),t]));{var g,b,f={name:t,value:decodeURIComponent(r),domain:n,...o&&{expires:new Date(o)},...i&&{httpOnly:!0},..."string"==typeof a&&{maxAge:Number(a)},path:p,...c&&{sameSite:h.includes(g=(g=c).toLowerCase())?g:void 0},...d&&{secure:!0},...y&&{priority:m.includes(b=(b=y).toLowerCase())?b:void 0},...u&&{partitioned:!0}};let e={};for(let t in f)f[t]&&(e[t]=f[t]);return e}}t.exports=((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let a of o(t))i.call(e,a)||void 0===a||s(e,a,{get:()=>t[a],enumerable:!(r=n(t,a))||r.enumerable});return e})(s({},"__esModule",{value:!0}),a);var h=["strict","lax","none"],m=["low","medium","high"],y=class{constructor(e){this._parsed=new Map,this._headers=e;const t=e.get("cookie");if(t)for(const[e,r]of l(t))this._parsed.set(e,{name:e,value:r})}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed);if(!e.length)return r.map(([e,t])=>t);let s="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(([e])=>e===s).map(([e,t])=>t)}has(e){return this._parsed.has(e)}set(...e){let[t,r]=1===e.length?[e[0].name,e[0].value]:e,s=this._parsed;return s.set(t,{name:t,value:r}),this._headers.set("cookie",Array.from(s).map(([e,t])=>d(t)).join("; ")),this}delete(e){let t=this._parsed,r=Array.isArray(e)?e.map(e=>t.delete(e)):t.delete(e);return this._headers.set("cookie",Array.from(t).map(([e,t])=>d(t)).join("; ")),r}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(e=>`${e.name}=${encodeURIComponent(e.value)}`).join("; ")}},g=class{constructor(e){var t,r,s;this._parsed=new Map,this._headers=e;const n=null!=(s=null!=(r=null==(t=e.getSetCookie)?void 0:t.call(e))?r:e.get("set-cookie"))?s:[];for(const e of Array.isArray(n)?n:function(e){if(!e)return[];var t,r,s,n,o,i=[],a=0;function p(){for(;a<e.length&&/\s/.test(e.charAt(a));)a+=1;return a<e.length}for(;a<e.length;){for(t=a,o=!1;p();)if(","===(r=e.charAt(a))){for(s=a,a+=1,p(),n=a;a<e.length&&"="!==(r=e.charAt(a))&&";"!==r&&","!==r;)a+=1;a<e.length&&"="===e.charAt(a)?(o=!0,a=n,i.push(e.substring(t,s)),t=a):a=s+1}else a+=1;(!o||a>=e.length)&&i.push(e.substring(t,e.length))}return i}(n)){const t=u(e);t&&this._parsed.set(t.name,t)}}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed.values());if(!e.length)return r;let s="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(e=>e.name===s)}has(e){return this._parsed.has(e)}set(...e){let[t,r,s]=1===e.length?[e[0].name,e[0].value,e[0]]:e,n=this._parsed;return n.set(t,function(e={name:"",value:""}){return"number"==typeof e.expires&&(e.expires=new Date(e.expires)),e.maxAge&&(e.expires=new Date(Date.now()+1e3*e.maxAge)),(null===e.path||void 0===e.path)&&(e.path="/"),e}({name:t,value:r,...s})),function(e,t){for(let[,r]of(t.delete("set-cookie"),e)){let e=d(r);t.append("set-cookie",e)}}(n,this._headers),this}delete(...e){let[t,r]="string"==typeof e[0]?[e[0]]:[e[0].name,e[0]];return this.set({...r,name:t,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(d).join("; ")}}},48806,e=>{"use strict";let t={description:"Error",content:{"application/json":{schema:{$ref:"#/components/schemas/Error"}}}};e.s(["buildOpenApi",0,function(){return{openapi:"3.1.0",info:{title:"AgentBox Hub API",version:"1.0.0",description:'Launch and manage AgentBox sandboxes ("boxes") programmatically. Every endpoint except /health, /openapi.json and /docs requires an Authorization: Bearer <hub token> header (the token the hub prints on boot, also at ~/.agentbox/hub/token). Errors always return { error: { code, message, details? } }.'},servers:[{url:"/api/v1"}],security:[{bearerAuth:[]}],tags:[{name:"System",description:"Liveness and API version."},{name:"Boxes",description:"Create, inspect, and run lifecycle actions on boxes."},{name:"Box git",description:"Git state and operations on a box's branch."},{name:"Box services",description:"A box's agentbox.yaml service/task/port status."},{name:"Projects",description:"Register folders as projects and list their branches."},{name:"Providers",description:"Sandbox providers: status, credentials, base-image bake."},{name:"Approvals",description:"Pending host-action approvals."},{name:"Jobs",description:"Async create/bake job status and log streams."}],paths:{"/health":{get:{tags:["System"],summary:"Get liveness + API version",security:[],responses:{200:{description:"OK",content:{"application/json":{schema:{$ref:"#/components/schemas/Health"}}}}}}},"/boxes":{get:{tags:["Boxes"],summary:"List boxes",responses:{200:{description:"Boxes",content:{"application/json":{schema:{type:"object",properties:{boxes:{type:"array",items:{$ref:"#/components/schemas/Box"}}},required:["boxes"]}}}},401:t}},post:{tags:["Boxes"],summary:"Create a box",description:'Async — returns a job id. agent "none" just creates the box without starting an agent (prompt ignored). provider defaults to docker; a cloud provider must be configured on the host (see GET /providers).',requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/CreateBox"}}}},responses:{202:{description:"Accepted — build job enqueued",content:{"application/json":{schema:{type:"object",properties:{jobId:{type:"string"}},required:["jobId"]}}}},400:t,401:t,404:t,503:t}}},"/boxes/{id}":{get:{tags:["Boxes"],summary:"Get one box",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Box",content:{"application/json":{schema:{$ref:"#/components/schemas/Box"}}}},401:t,404:t}}},"/boxes/{id}/{action}":{post:{tags:["Boxes"],summary:"Run a lifecycle action",description:"One of start | pause | resume | stop | destroy | screen. start brings a stopped box back up (resumes if paused, no-op if already running); it does not restart the agent session — that happens on the next attach. screen is the open-VNC prep step: it points the in-box browser at the box’s web app so the VNC desktop shows the app instead of a blank X screen — call it right before opening the box’s vncUrl.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}},{name:"action",in:"path",required:!0,schema:{type:"string",enum:["start","pause","resume","stop","destroy","screen"]}}],responses:{200:{description:"Done",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},400:t,401:t,404:t,409:t,503:t}}},"/boxes/{id}/git":{get:{tags:["Box git"],summary:"Get the box's live git summary",description:"The worktree's current branch, dirty, ahead/behind.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Git info",content:{"application/json":{schema:{$ref:"#/components/schemas/GitInfo"}}}},401:t,404:t,503:t}}},"/boxes/{id}/git/{op}":{post:{tags:["Box git"],summary:"Run a git op on the box branch",description:"checkout {branch}; branch {name, from?} (create+switch a new agentbox/* branch); pull {remote?, ffOnly?}; push {remote?, force?}; push-host {as?, force?} (land in the host repo only, publishes nothing).",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}},{name:"op",in:"path",required:!0,schema:{type:"string",enum:["checkout","branch","pull","push","push-host"]}}],requestBody:{required:!1,content:{"application/json":{schema:{$ref:"#/components/schemas/GitOpBody"}}}},responses:{200:{description:"Done (git stdout/stderr)",content:{"application/json":{schema:{$ref:"#/components/schemas/GitOpResult"}}}},400:t,401:t,404:t,409:t,503:t}}},"/boxes/{id}/branches":{get:{tags:["Box git"],summary:"List the box project's branches",description:"Local + remote branches and the current HEAD, for the box git-panel branch picker.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Branches",content:{"application/json":{schema:{$ref:"#/components/schemas/BranchList"}}}},400:t,401:t,404:t,503:t}}},"/boxes/{id}/services":{get:{tags:["Box services"],summary:"Get the box's service/task/port status",description:"From the box's agentbox.yaml — live, or the persisted snapshot when the box isn't running.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Services",content:{"application/json":{schema:{$ref:"#/components/schemas/Services"}}}},401:t,503:t}}},"/boxes/{id}/services/restart":{post:{tags:["Box services"],summary:"Restart services",description:"Restart one service (body {name}) or every service (empty body).",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],requestBody:{required:!1,content:{"application/json":{schema:{type:"object",properties:{name:{type:"string"}}}}}},responses:{200:{description:"Restarted",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},400:t,401:t,404:t,409:t,503:t}}},"/boxes/{id}/open":{post:{tags:["Box services"],summary:"Open the box in a host app",description:"Launch the box in a host GUI app (Codex, VS Code/Cursor, cmux, Herdr, iTerm2) by re-shelling `agentbox open --in <app>`. Only works on a localhost hub running on macOS; a remote hub / non-macOS host refuses. An app must be installed and provider-eligible (e.g. Codex is Hetzner-only) — see GET /open-targets.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],requestBody:{required:!0,content:{"application/json":{schema:{type:"object",properties:{app:{type:"string",enum:["codex","herdr","cmux","vscode","iterm2"]}},required:["app"]}}}},responses:{200:{description:"Launched",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},400:t,401:t,404:t,409:t,503:t}}},"/open-targets":{get:{tags:["Box services"],summary:"Which host apps this hub can open a box in",description:'Reports whether the hub can launch host GUI apps (`supported` — true only on a localhost hub on macOS) and, if so, which of Codex/Herdr/cmux/VS Code/iTerm2 are installed plus their provider eligibility. Backs the box detail page "Apps" launchers.',responses:{200:{description:"Open targets",content:{"application/json":{schema:{type:"object",properties:{supported:{type:"boolean"},targets:{type:["object","null"],additionalProperties:{type:"object",properties:{available:{type:"boolean"},providers:{type:"array",items:{type:"string"}}},required:["available"]}}},required:["supported","targets"]}}}},401:t}}},"/projects":{get:{tags:["Projects"],summary:"List registered projects",responses:{200:{description:"Projects",content:{"application/json":{schema:{type:"object",properties:{projects:{type:"array",items:{$ref:"#/components/schemas/Project"}}},required:["projects"]}}}},401:t}},post:{tags:["Projects"],summary:"Register a folder as a project",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",properties:{path:{type:"string",description:"Absolute path to the folder."}},required:["path"]}}}},responses:{200:{description:"Registered",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},400:t,401:t,503:t}}},"/projects/{id}":{delete:{tags:["Projects"],summary:"Unregister an empty project",description:"Folder/files on disk are untouched.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Removed",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},401:t,404:t,409:t,503:t}}},"/projects/{id}/branches":{get:{tags:["Projects"],summary:"List a project's branches",description:"Local + remote branches and the current HEAD, for the create-box base-branch picker.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Branches",content:{"application/json":{schema:{$ref:"#/components/schemas/BranchList"}}}},400:t,401:t,404:t,503:t}}},"/providers":{get:{tags:["Providers"],summary:"List sandbox providers",description:"With credential + baked status on this host.",responses:{200:{description:"Providers",content:{"application/json":{schema:{type:"object",properties:{providers:{type:"array",items:{$ref:"#/components/schemas/Provider"}}},required:["providers"]}}}},401:t}}},"/providers/{id}/credentials":{post:{tags:["Providers"],summary:"Set a provider's credentials",description:"API keys/tokens, validated then saved to secrets.env. Never echoes secret values.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string",enum:["docker","daytona","hetzner","vercel","e2b","digitalocean","remote-docker"]}}],requestBody:{required:!0,content:{"application/json":{schema:{type:"object",additionalProperties:{type:"string"},description:"Provider-specific fields, e.g. { apiKey } (e2b), { token } (hetzner), { apiKey } or { jwtToken, organizationId } (daytona), { token, teamId?, projectId? } (vercel)."}}}},responses:{200:{description:"Saved",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},400:t,401:t,503:t}}},"/providers/{id}/prepare":{post:{tags:["Providers"],summary:"Bake a provider's base image",description:"Async — returns a job id. Progress streams over GET /jobs/{id}/logs.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string",enum:["docker","daytona","hetzner","vercel","e2b","digitalocean","remote-docker"]}}],requestBody:{required:!1,content:{"application/json":{schema:{type:"object",properties:{force:{type:"boolean"},claudeInstall:{type:"string",enum:["native","npm"]}}}}}},responses:{202:{description:"Bake enqueued",content:{"application/json":{schema:{type:"object",properties:{jobId:{type:"string"}},required:["jobId"]}}}},400:t,401:t,409:t,503:t}}},"/approvals":{get:{tags:["Approvals"],summary:"List pending host-action approvals",responses:{200:{description:"Approvals",content:{"application/json":{schema:{type:"object",properties:{approvals:{type:"array",items:{$ref:"#/components/schemas/Approval"}}},required:["approvals"]}}}},401:t}}},"/approvals/{id}/answer":{post:{tags:["Approvals"],summary:"Answer a pending approval",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],requestBody:{required:!0,content:{"application/json":{schema:{type:"object",properties:{answer:{type:"string",enum:["y","n"]}},required:["answer"]}}}},responses:{200:{description:"Resolved",content:{"application/json":{schema:{type:"object",properties:{ok:{const:!0}},required:["ok"]}}}},400:t,401:t,404:t,503:t}}},"/jobs/{id}":{get:{tags:["Jobs"],summary:"Get a create job status",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"Job",content:{"application/json":{schema:{$ref:"#/components/schemas/Job"}}}},401:t,404:t}}},"/jobs/{id}/logs":{get:{tags:["Jobs"],summary:"Stream a create job log (SSE)",description:"text/event-stream. Emits `open`, then `log` events per line, then a terminal `end` event with the final status.",parameters:[{name:"id",in:"path",required:!0,schema:{type:"string"}}],responses:{200:{description:"SSE stream",content:{"text/event-stream":{}}},401:t,404:t,503:t}}}},components:{securitySchemes:{bearerAuth:{type:"http",scheme:"bearer",description:"The hub token (Authorization: Bearer <token>)."}},schemas:{Health:{type:"object",properties:{ok:{const:!0},apiVersion:{type:"string"},profile:{type:"string"}},required:["ok","apiVersion"]},Error:{type:"object",properties:{error:{type:"object",properties:{code:{type:"string"},message:{type:"string"},details:{}},required:["code","message"]}},required:["error"]},Box:{type:"object",properties:{id:{type:"string"},projectId:{type:"string"},repo:{type:"string"},branch:{type:"string"},task:{type:"string"},agent:{type:"string"},status:{type:"string",enum:["running","paused","stopped","creating","error"]},createdAt:{type:"number"},lastActivity:{type:"number"},host:{type:"string"},commits:{type:["number","null"]},filesTouched:{type:["number","null"]},error:{type:["string","null"]},displayName:{type:["string","null"],description:"Cosmetic user-set label (rename); null when unset"},webUrl:{type:["string","null"],description:"Host-openable web-service URL; null when absent/unreachable (e.g. paused)"},vncUrl:{type:["string","null"],description:"Host-openable VNC desktop URL; null when absent/unreachable"},state:{type:"string",enum:["running","paused","stopped","missing"],description:"Raw provider runtime state (host topology only). Absent on synthetic creating/error rows — presence distinguishes a real box whose agent errored from a failed create job."},name:{type:"string"},provider:{type:"string",description:"Raw provider id ('docker', 'daytona', …; plugin ids possible)"},projectRoot:{type:"string",description:"Absolute host path of the project. Host topology only — never emitted by the hosted plane"},projectIndex:{type:"number"},vncEnabled:{type:"boolean"},gitWorktrees:{type:"array",items:{type:"object",properties:{kind:{type:"string"},branch:{type:"string"}}}},claudeSessionTitle:{type:"string"},codexSessionTitle:{type:"string"},opencodeSessionTitle:{type:"string"},claudeActivity:{type:"string",description:"working | idle | waiting | end-plan | question | compacting | error | unknown"},codexActivity:{type:"string"}},required:["id","projectId","status","agent"]},Project:{type:"object",properties:{id:{type:"string"},name:{type:"string"},repo:{type:"string"},defaultBranch:{type:"string"},currentBranch:{type:"string",nullable:!0},needsSetup:{type:"boolean",description:"No agentbox.yaml + no default snapshot — the create form offers the setup wizard"},provider:{type:"string"},createdAt:{type:"number"}},required:["id","name"]},BranchList:{type:"object",properties:{current:{type:"string",nullable:!0,description:"The repo's current HEAD (the default base ref)"},branches:{type:"array",items:{type:"string"},description:"Local + remote-tracking branch names"}},required:["branches"]},Approval:{type:"object",properties:{id:{type:"string"},boxId:{type:"string"},message:{type:"string"},detail:{type:"string"},command:{type:"string"},cwd:{type:"string"},argv:{type:"array",items:{type:"string"}},defaultAnswer:{type:"string",enum:["y","n"]},createdAt:{type:"number"}},required:["id","boxId","message","defaultAnswer"]},Job:{type:"object",properties:{id:{type:"string"},status:{type:"string",enum:["queued","running","done","failed","cancelled"]},boxId:{type:"string"}},required:["id","status"]},CreateBox:{type:"object",properties:{projectId:{type:"string"},agent:{type:"string",enum:["claude","codex","opencode","none"]},provider:{type:"string",enum:["docker","daytona","hetzner","vercel","e2b","digitalocean","remote-docker"],default:"docker"},name:{type:"string"},prompt:{type:"string"},fromBranch:{type:"string",description:"Base ref the box's per-box branch forks from (branch / tag / SHA); default the project's HEAD"},setupWizard:{type:"boolean",description:'Seed the agent\'s first turn to generate agentbox.yaml (for projects with none). Inert for agent "none".'}},required:["projectId","agent"]},Provider:{type:"object",properties:{id:{type:"string",enum:["docker","daytona","hetzner","vercel","e2b","digitalocean","remote-docker"]},label:{type:"string"},configured:{type:"boolean",description:"Base image baked (usable for create) on this host."},hasCredentials:{type:"boolean",description:"Credentials present (docker: always true). Can be true while not yet configured (baked)."},jobId:{type:"string",description:"Id of an in-flight bake (prepare) job for this provider, if any."},reason:{type:"string"}},required:["id","label","configured"]},GitOpBody:{type:"object",description:"Union of git-op fields; only those for the chosen {op} are read (extras are ignored).",properties:{branch:{type:"string",description:"checkout: branch to switch to"},name:{type:"string",description:"branch: new branch name (agentbox/ prefix added when missing)"},from:{type:"string",description:"branch: base ref to fork from (default: box's HEAD)"},remote:{type:"string",description:"push/pull: remote name (default: origin)"},force:{type:"boolean",description:"push: force the remote push; push-host: overwrite the destination branch"},ffOnly:{type:"boolean",description:"pull: pass --ff-only to the merge"},as:{type:"string",description:"push-host: destination branch name in the host repo (default: the box's branch)"}}},GitOpResult:{type:"object",properties:{ok:{const:!0},stdout:{type:"string"},stderr:{type:"string"}},required:["ok"]},GitInfo:{type:"object",properties:{ok:{type:"boolean"},branch:{type:"string"},dirty:{type:"boolean"},ahead:{type:"number"},behind:{type:"number"},error:{type:"string"}},required:["ok"]},Services:{type:"object",properties:{source:{type:"string",enum:["live","persisted","unavailable"]},services:{type:"array",items:{type:"object",properties:{name:{type:"string"},state:{type:"string"},pid:{type:["number","null"]},restarts:{type:"number"},lastExitCode:{type:["number","null"]},blockedOn:{type:"array",items:{type:"string"}},command:{type:"string"}},required:["name","state"]}},tasks:{type:"array",items:{type:"object",properties:{name:{type:"string"},state:{type:"string"}},required:["name","state"]}},ports:{type:"array",items:{type:"object",properties:{port:{type:"number"},service:{type:["string","null"]}},required:["port"]}},error:{type:"string"}},required:["source","services","tasks","ports"]}}}}},"docsHtml",0,function(){return`<!doctype html>
2
2
  <html>
3
3
  <head>
4
4
  <title>AgentBox Hub API</title>
@@ -1,3 +1,3 @@
1
- module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},96253,(e,t,r)=>{"use strict";t.exports=e.r(18622)},85132,(e,t,r)=>{"use strict";t.exports=e.r(96253).vendored["react-rsc"].React},86109,(e,t,r)=>{"use strict";var s=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o={},p={RequestCookies:()=>f,ResponseCookies:()=>g,parseCookie:()=>d,parseSetCookie:()=>c,stringifyCookie:()=>u};for(var l in p)s(o,l,{get:p[l],enumerable:!0});function u(e){var t;let r=["path"in e&&e.path&&`Path=${e.path}`,"expires"in e&&(e.expires||0===e.expires)&&`Expires=${("number"==typeof e.expires?new Date(e.expires):e.expires).toUTCString()}`,"maxAge"in e&&"number"==typeof e.maxAge&&`Max-Age=${e.maxAge}`,"domain"in e&&e.domain&&`Domain=${e.domain}`,"secure"in e&&e.secure&&"Secure","httpOnly"in e&&e.httpOnly&&"HttpOnly","sameSite"in e&&e.sameSite&&`SameSite=${e.sameSite}`,"partitioned"in e&&e.partitioned&&"Partitioned","priority"in e&&e.priority&&`Priority=${e.priority}`].filter(Boolean),s=`${e.name}=${encodeURIComponent(null!=(t=e.value)?t:"")}`;return 0===r.length?s:`${s}; ${r.join("; ")}`}function d(e){let t=new Map;for(let r of e.split(/; */)){if(!r)continue;let e=r.indexOf("=");if(-1===e){t.set(r,"true");continue}let[s,n]=[r.slice(0,e),r.slice(e+1)];try{t.set(s,decodeURIComponent(null!=n?n:"true"))}catch{}}return t}function c(e){if(!e)return;let[[t,r],...s]=d(e),{domain:n,expires:i,httponly:a,maxage:o,path:p,samesite:l,secure:u,partitioned:c,priority:f}=Object.fromEntries(s.map(([e,t])=>[e.toLowerCase().replace(/-/g,""),t]));{var g,x,_={name:t,value:decodeURIComponent(r),domain:n,...i&&{expires:new Date(i)},...a&&{httpOnly:!0},..."string"==typeof o&&{maxAge:Number(o)},path:p,...l&&{sameSite:h.includes(g=(g=l).toLowerCase())?g:void 0},...u&&{secure:!0},...f&&{priority:m.includes(x=(x=f).toLowerCase())?x:void 0},...c&&{partitioned:!0}};let e={};for(let t in _)_[t]&&(e[t]=_[t]);return e}}t.exports=((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of i(t))a.call(e,o)||void 0===o||s(e,o,{get:()=>t[o],enumerable:!(r=n(t,o))||r.enumerable});return e})(s({},"__esModule",{value:!0}),o);var h=["strict","lax","none"],m=["low","medium","high"],f=class{constructor(e){this._parsed=new Map,this._headers=e;const t=e.get("cookie");if(t)for(const[e,r]of d(t))this._parsed.set(e,{name:e,value:r})}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed);if(!e.length)return r.map(([e,t])=>t);let s="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(([e])=>e===s).map(([e,t])=>t)}has(e){return this._parsed.has(e)}set(...e){let[t,r]=1===e.length?[e[0].name,e[0].value]:e,s=this._parsed;return s.set(t,{name:t,value:r}),this._headers.set("cookie",Array.from(s).map(([e,t])=>u(t)).join("; ")),this}delete(e){let t=this._parsed,r=Array.isArray(e)?e.map(e=>t.delete(e)):t.delete(e);return this._headers.set("cookie",Array.from(t).map(([e,t])=>u(t)).join("; ")),r}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(e=>`${e.name}=${encodeURIComponent(e.value)}`).join("; ")}},g=class{constructor(e){var t,r,s;this._parsed=new Map,this._headers=e;const n=null!=(s=null!=(r=null==(t=e.getSetCookie)?void 0:t.call(e))?r:e.get("set-cookie"))?s:[];for(const e of Array.isArray(n)?n:function(e){if(!e)return[];var t,r,s,n,i,a=[],o=0;function p(){for(;o<e.length&&/\s/.test(e.charAt(o));)o+=1;return o<e.length}for(;o<e.length;){for(t=o,i=!1;p();)if(","===(r=e.charAt(o))){for(s=o,o+=1,p(),n=o;o<e.length&&"="!==(r=e.charAt(o))&&";"!==r&&","!==r;)o+=1;o<e.length&&"="===e.charAt(o)?(i=!0,o=n,a.push(e.substring(t,s)),t=o):o=s+1}else o+=1;(!i||o>=e.length)&&a.push(e.substring(t,e.length))}return a}(n)){const t=c(e);t&&this._parsed.set(t.name,t)}}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed.values());if(!e.length)return r;let s="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(e=>e.name===s)}has(e){return this._parsed.has(e)}set(...e){let[t,r,s]=1===e.length?[e[0].name,e[0].value,e[0]]:e,n=this._parsed;return n.set(t,function(e={name:"",value:""}){return"number"==typeof e.expires&&(e.expires=new Date(e.expires)),e.maxAge&&(e.expires=new Date(Date.now()+1e3*e.maxAge)),(null===e.path||void 0===e.path)&&(e.path="/"),e}({name:t,value:r,...s})),function(e,t){for(let[,r]of(t.delete("set-cookie"),e)){let e=u(r);t.append("set-cookie",e)}}(n,this._headers),this}delete(...e){let[t,r]="string"==typeof e[0]?[e[0]]:[e[0].name,e[0]];return this.set({...r,name:t,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(u).join("; ")}}},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},54799,(e,t,r)=>{t.exports=e.x("crypto",()=>require("crypto"))},24868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},5365,(e,t,r)=>{t.exports=e.x("process",()=>require("process"))},874,(e,t,r)=>{t.exports=e.x("buffer",()=>require("buffer"))},12714,(e,t,r)=>{t.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},5086,e=>{"use strict";e.s(["DialectAdapterBase",0,class{get supportsCreateIfNotExists(){return!0}get supportsMultipleConnections(){return!0}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!1}get supportsOutput(){return!1}}])},2350,e=>{"use strict";var t=e.i(44700);let r=/"/g,s=/[\\'"]/g;class n extends t.DefaultQueryCompiler{visitOrAction(e){this.append("or "),this.append(e.action)}getCurrentParameterPlaceholder(){return"?"}getLeftExplainOptionsWrapper(){return""}getRightExplainOptionsWrapper(){return""}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}sanitizeIdentifier(e){return e.replace(r,'""')}sanitizeJSONPathMemberValue(e){return e.replace(s,e=>"\\"===e?"\\\\":"'"===e?"''":'\\"')}visitDefaultInsertValue(e){this.append("null")}}e.s(["SqliteQueryCompiler",0,n])},39844,e=>{"use strict";var t=e.i(5086);class r extends t.DialectAdapterBase{get supportsMultipleConnections(){return!1}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(e,t){}async releaseMigrationLock(e,t){}}e.s(["SqliteAdapter",0,r])},66680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},19741,e=>{e.v(t=>Promise.all(["server/chunks/0d-b_next_dist_server_app-render_after-task-async-storage_external_0-exn7p.js","server/chunks/09xn_next_0tn6frk._.js"].map(t=>e.l(t))).then(()=>t(41422)))},16432,e=>{e.v(t=>Promise.all(["server/chunks/09mp_@better-auth_memory-adapter_dist_index_mjs_0ti_30h._.js"].map(t=>e.l(t))).then(()=>t(71100)))},19783,e=>{e.v(t=>Promise.all(["server/chunks/0zhp_better-auth_dist_adapters_kysely-adapter_index_mjs_1rl4qnh._.js"].map(t=>e.l(t))).then(()=>t(49457)))},46358,e=>{e.v(e=>Promise.resolve().then(()=>e(57762)))},16909,e=>{e.v(t=>Promise.all(["server/chunks/01te_@better-auth_kysely-adapter_dist_0z6cvsk._.js"].map(t=>e.l(t))).then(()=>t(94336)))},12008,e=>{e.v(t=>Promise.all(["server/chunks/01te_@better-auth_kysely-adapter_dist_0jw_ngm._.js"].map(t=>e.l(t))).then(()=>t(88543)))},33387,e=>{e.v(t=>Promise.all(["server/chunks/01te_@better-auth_kysely-adapter_dist_210bxd8._.js"].map(t=>e.l(t))).then(()=>t(400)))},6194,e=>{e.v(t=>Promise.all(["server/chunks/[externals]_pg_15jfwkh._.js"].map(t=>e.l(t))).then(()=>t(8844)))}];
1
+ module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},96253,(e,t,r)=>{"use strict";t.exports=e.r(18622)},85132,(e,t,r)=>{"use strict";t.exports=e.r(96253).vendored["react-rsc"].React},86109,(e,t,r)=>{"use strict";var s=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o={},p={RequestCookies:()=>f,ResponseCookies:()=>g,parseCookie:()=>d,parseSetCookie:()=>c,stringifyCookie:()=>u};for(var l in p)s(o,l,{get:p[l],enumerable:!0});function u(e){var t;let r=["path"in e&&e.path&&`Path=${e.path}`,"expires"in e&&(e.expires||0===e.expires)&&`Expires=${("number"==typeof e.expires?new Date(e.expires):e.expires).toUTCString()}`,"maxAge"in e&&"number"==typeof e.maxAge&&`Max-Age=${e.maxAge}`,"domain"in e&&e.domain&&`Domain=${e.domain}`,"secure"in e&&e.secure&&"Secure","httpOnly"in e&&e.httpOnly&&"HttpOnly","sameSite"in e&&e.sameSite&&`SameSite=${e.sameSite}`,"partitioned"in e&&e.partitioned&&"Partitioned","priority"in e&&e.priority&&`Priority=${e.priority}`].filter(Boolean),s=`${e.name}=${encodeURIComponent(null!=(t=e.value)?t:"")}`;return 0===r.length?s:`${s}; ${r.join("; ")}`}function d(e){let t=new Map;for(let r of e.split(/; */)){if(!r)continue;let e=r.indexOf("=");if(-1===e){t.set(r,"true");continue}let[s,n]=[r.slice(0,e),r.slice(e+1)];try{t.set(s,decodeURIComponent(null!=n?n:"true"))}catch{}}return t}function c(e){if(!e)return;let[[t,r],...s]=d(e),{domain:n,expires:i,httponly:a,maxage:o,path:p,samesite:l,secure:u,partitioned:c,priority:f}=Object.fromEntries(s.map(([e,t])=>[e.toLowerCase().replace(/-/g,""),t]));{var g,x,_={name:t,value:decodeURIComponent(r),domain:n,...i&&{expires:new Date(i)},...a&&{httpOnly:!0},..."string"==typeof o&&{maxAge:Number(o)},path:p,...l&&{sameSite:h.includes(g=(g=l).toLowerCase())?g:void 0},...u&&{secure:!0},...f&&{priority:m.includes(x=(x=f).toLowerCase())?x:void 0},...c&&{partitioned:!0}};let e={};for(let t in _)_[t]&&(e[t]=_[t]);return e}}t.exports=((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of i(t))a.call(e,o)||void 0===o||s(e,o,{get:()=>t[o],enumerable:!(r=n(t,o))||r.enumerable});return e})(s({},"__esModule",{value:!0}),o);var h=["strict","lax","none"],m=["low","medium","high"],f=class{constructor(e){this._parsed=new Map,this._headers=e;const t=e.get("cookie");if(t)for(const[e,r]of d(t))this._parsed.set(e,{name:e,value:r})}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed);if(!e.length)return r.map(([e,t])=>t);let s="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(([e])=>e===s).map(([e,t])=>t)}has(e){return this._parsed.has(e)}set(...e){let[t,r]=1===e.length?[e[0].name,e[0].value]:e,s=this._parsed;return s.set(t,{name:t,value:r}),this._headers.set("cookie",Array.from(s).map(([e,t])=>u(t)).join("; ")),this}delete(e){let t=this._parsed,r=Array.isArray(e)?e.map(e=>t.delete(e)):t.delete(e);return this._headers.set("cookie",Array.from(t).map(([e,t])=>u(t)).join("; ")),r}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(e=>`${e.name}=${encodeURIComponent(e.value)}`).join("; ")}},g=class{constructor(e){var t,r,s;this._parsed=new Map,this._headers=e;const n=null!=(s=null!=(r=null==(t=e.getSetCookie)?void 0:t.call(e))?r:e.get("set-cookie"))?s:[];for(const e of Array.isArray(n)?n:function(e){if(!e)return[];var t,r,s,n,i,a=[],o=0;function p(){for(;o<e.length&&/\s/.test(e.charAt(o));)o+=1;return o<e.length}for(;o<e.length;){for(t=o,i=!1;p();)if(","===(r=e.charAt(o))){for(s=o,o+=1,p(),n=o;o<e.length&&"="!==(r=e.charAt(o))&&";"!==r&&","!==r;)o+=1;o<e.length&&"="===e.charAt(o)?(i=!0,o=n,a.push(e.substring(t,s)),t=o):o=s+1}else o+=1;(!i||o>=e.length)&&a.push(e.substring(t,e.length))}return a}(n)){const t=c(e);t&&this._parsed.set(t.name,t)}}get(...e){let t="string"==typeof e[0]?e[0]:e[0].name;return this._parsed.get(t)}getAll(...e){var t;let r=Array.from(this._parsed.values());if(!e.length)return r;let s="string"==typeof e[0]?e[0]:null==(t=e[0])?void 0:t.name;return r.filter(e=>e.name===s)}has(e){return this._parsed.has(e)}set(...e){let[t,r,s]=1===e.length?[e[0].name,e[0].value,e[0]]:e,n=this._parsed;return n.set(t,function(e={name:"",value:""}){return"number"==typeof e.expires&&(e.expires=new Date(e.expires)),e.maxAge&&(e.expires=new Date(Date.now()+1e3*e.maxAge)),(null===e.path||void 0===e.path)&&(e.path="/"),e}({name:t,value:r,...s})),function(e,t){for(let[,r]of(t.delete("set-cookie"),e)){let e=u(r);t.append("set-cookie",e)}}(n,this._headers),this}delete(...e){let[t,r]="string"==typeof e[0]?[e[0]]:[e[0].name,e[0]];return this.set({...r,name:t,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(u).join("; ")}}},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},54799,(e,t,r)=>{t.exports=e.x("crypto",()=>require("crypto"))},24868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},5365,(e,t,r)=>{t.exports=e.x("process",()=>require("process"))},874,(e,t,r)=>{t.exports=e.x("buffer",()=>require("buffer"))},12714,(e,t,r)=>{t.exports=e.x("node:fs/promises",()=>require("node:fs/promises"))},5086,e=>{"use strict";e.s(["DialectAdapterBase",0,class{get supportsCreateIfNotExists(){return!0}get supportsMultipleConnections(){return!0}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!1}get supportsOutput(){return!1}}])},2350,e=>{"use strict";var t=e.i(44700);let r=/"/g,s=/[\\'"]/g;class n extends t.DefaultQueryCompiler{visitOrAction(e){this.append("or "),this.append(e.action)}getCurrentParameterPlaceholder(){return"?"}getLeftExplainOptionsWrapper(){return""}getRightExplainOptionsWrapper(){return""}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}sanitizeIdentifier(e){return e.replace(r,'""')}sanitizeJSONPathMemberValue(e){return e.replace(s,e=>"\\"===e?"\\\\":"'"===e?"''":'\\"')}visitDefaultInsertValue(e){this.append("null")}}e.s(["SqliteQueryCompiler",0,n])},39844,e=>{"use strict";var t=e.i(5086);class r extends t.DialectAdapterBase{get supportsMultipleConnections(){return!1}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(e,t){}async releaseMigrationLock(e,t){}}e.s(["SqliteAdapter",0,r])},66680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},19741,e=>{e.v(t=>Promise.all(["server/chunks/0d-b_next_dist_server_app-render_after-task-async-storage_external_0-exn7p.js","server/chunks/09xn_next_0tn6frk._.js"].map(t=>e.l(t))).then(()=>t(41422)))},16432,e=>{e.v(t=>Promise.all(["server/chunks/09mp_@better-auth_memory-adapter_dist_index_mjs_0ti_30h._.js"].map(t=>e.l(t))).then(()=>t(71100)))},92291,e=>{e.v(t=>Promise.all(["server/chunks/0-fj_better-auth_dist_adapters_kysely-adapter_index_mjs_0btft52._.js"].map(t=>e.l(t))).then(()=>t(83844)))},46358,e=>{e.v(e=>Promise.resolve().then(()=>e(57762)))},16909,e=>{e.v(t=>Promise.all(["server/chunks/01te_@better-auth_kysely-adapter_dist_0z6cvsk._.js"].map(t=>e.l(t))).then(()=>t(94336)))},12008,e=>{e.v(t=>Promise.all(["server/chunks/01te_@better-auth_kysely-adapter_dist_0jw_ngm._.js"].map(t=>e.l(t))).then(()=>t(88543)))},33387,e=>{e.v(t=>Promise.all(["server/chunks/01te_@better-auth_kysely-adapter_dist_210bxd8._.js"].map(t=>e.l(t))).then(()=>t(400)))},6194,e=>{e.v(t=>Promise.all(["server/chunks/[externals]_pg_15jfwkh._.js"].map(t=>e.l(t))).then(()=>t(8844)))}];
2
2
 
3
- //# sourceMappingURL=%5Broot-of-the-server%5D__19pc87s._.js.map
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__1k8g143._.js.map