@cline/core 0.0.95 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/dist/ClineCore.d.ts +6 -1
  2. package/dist/account/rpc.d.ts +3 -1
  3. package/dist/cline-core/runtime-services.d.ts +4 -2
  4. package/dist/cloud/controller.d.ts +5 -2
  5. package/dist/cloud/hub-client.d.ts +51 -0
  6. package/dist/cloud/hub-protocol.d.ts +18 -0
  7. package/dist/cloud/index.d.ts +2 -0
  8. package/dist/cloud/index.js +16 -16
  9. package/dist/cloud/types.d.ts +4 -1
  10. package/dist/extensions/context/compaction-shared.d.ts +1 -0
  11. package/dist/extensions/context/compaction.d.ts +7 -0
  12. package/dist/extensions/context/summarize-conversation.d.ts +7 -0
  13. package/dist/extensions/context/summary-generation.d.ts +14 -0
  14. package/dist/extensions/mcp/apps.d.ts +16 -0
  15. package/dist/extensions/mcp/client.d.ts +1 -0
  16. package/dist/extensions/mcp/index.d.ts +5 -1
  17. package/dist/extensions/mcp/manager.d.ts +2 -1
  18. package/dist/extensions/mcp/session-apps.d.ts +28 -0
  19. package/dist/extensions/mcp/types.d.ts +22 -0
  20. package/dist/extensions/plugin/plugin-command-origin.d.ts +8 -0
  21. package/dist/extensions/plugin/plugin-registry.d.ts +1 -0
  22. package/dist/extensions/plugin/plugin-runtime.d.ts +7 -0
  23. package/dist/hub/client/index.d.ts +6 -0
  24. package/dist/hub/client/managed-hub-build-watcher.d.ts +2 -0
  25. package/dist/hub/client/plugin-commands.d.ts +4 -0
  26. package/dist/hub/client/session-client.d.ts +2 -0
  27. package/dist/hub/daemon/entry.js +241 -228
  28. package/dist/hub/index.d.ts +1 -0
  29. package/dist/hub/index.js +231 -218
  30. package/dist/hub/runtime-host/hub-runtime-host.d.ts +6 -0
  31. package/dist/hub/server/cloud-session-service.d.ts +50 -0
  32. package/dist/hub/server/handlers/capability-handlers.d.ts +18 -1
  33. package/dist/hub/server/handlers/context.d.ts +13 -2
  34. package/dist/hub/server/handlers/mcp-apps-handlers.d.ts +5 -0
  35. package/dist/hub/server/hub-server-options.d.ts +3 -0
  36. package/dist/hub/server/hub-server-transport.d.ts +2 -0
  37. package/dist/index.d.ts +8 -4
  38. package/dist/index.js +278 -258
  39. package/dist/plugin-runtime/node_modules/@cline/agents/dist/index.js +76 -0
  40. package/dist/plugin-runtime/node_modules/@cline/agents/package.json +1 -0
  41. package/dist/plugin-runtime/node_modules/@cline/core/dist/ai-sdk-b1d8eb67.js +1 -0
  42. package/dist/plugin-runtime/node_modules/@cline/core/dist/anthropic-33qvrctr.js +1 -0
  43. package/dist/plugin-runtime/node_modules/@cline/core/dist/bedrock-paabhz8w.js +1 -0
  44. package/dist/plugin-runtime/node_modules/@cline/core/dist/cline-yhsfqcy1.js +1 -0
  45. package/dist/plugin-runtime/node_modules/@cline/core/dist/cloud/index.js +21 -0
  46. package/dist/plugin-runtime/node_modules/@cline/core/dist/community-gqgs7446.js +1 -0
  47. package/dist/plugin-runtime/node_modules/@cline/core/dist/foundation-models-embedding-model-strategy-SAVQFBF4-822304b0.js +1 -0
  48. package/dist/plugin-runtime/node_modules/@cline/core/dist/foundation-models-language-model-strategy-BPQO66W7-hky2m2yx.js +1 -0
  49. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-bsd-sqf1kd37.js +1 -0
  50. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-bsd-tx1kp6xn.js +1 -0
  51. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-darwin-6cpgjxme.js +2 -0
  52. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-darwin-fxchqbze.js +2 -0
  53. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-linux-m3bzwmzc.js +1 -0
  54. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-linux-pr9sb5fr.js +1 -0
  55. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-unsupported-nckraycx.js +1 -0
  56. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-unsupported-w91yq3tm.js +1 -0
  57. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-win-xdyxc2tf.js +1 -0
  58. package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-win-yxsvs11a.js +1 -0
  59. package/dist/plugin-runtime/node_modules/@cline/core/dist/google-pgdk2dm9.js +1 -0
  60. package/dist/plugin-runtime/node_modules/@cline/core/dist/hub/daemon/entry.js +1160 -0
  61. package/dist/plugin-runtime/node_modules/@cline/core/dist/hub/index.js +1147 -0
  62. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-02jpyn9y.js +85 -0
  63. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-0cb4390m.js +137 -0
  64. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-0f8xrhgt.js +209 -0
  65. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-1f8vb421.js +2 -0
  66. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-28c7m0fv.js +16 -0
  67. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-2em3jg4q.js +1 -0
  68. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-4n1zpzbe.js +2 -0
  69. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-54eea0ex.js +2 -0
  70. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-5j92dtg5.js +16 -0
  71. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-6akf3a5d.js +2 -0
  72. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-6k6ep10s.js +136 -0
  73. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-71ym4q6s.js +2 -0
  74. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-91p1ghfk.js +14 -0
  75. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-9qkpjy7x.js +2 -0
  76. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-9swk4nej.js +3 -0
  77. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-aa2s5myc.js +1 -0
  78. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-ae0ajw38.js +13 -0
  79. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-bxvyzjhc.js +1 -0
  80. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-bzy863k0.js +6 -0
  81. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-d96n0s70.js +20 -0
  82. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-dsd6vt8c.js +1 -0
  83. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-e2q4azd9.js +119 -0
  84. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-egd18jj2.js +4 -0
  85. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-eh83hr16.js +2 -0
  86. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-ev9r2dy3.js +1204 -0
  87. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-f2mvvryf.js +190 -0
  88. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-h7gn5v3f.js +2 -0
  89. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-h7s1a560.js +12 -0
  90. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-hkhq3jtz.js +21 -0
  91. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-j8r18nfg.js +15 -0
  92. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-jhny555h.js +6 -0
  93. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-m1gpa2eg.js +146 -0
  94. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-m2ad6tgj.js +1 -0
  95. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-m7mks2jq.js +4 -0
  96. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-mcnngj50.js +62 -0
  97. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-n2srkkh0.js +39 -0
  98. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-nbs1tsny.js +142 -0
  99. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-nqjnz7m4.js +9 -0
  100. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-rmhzyxr8.js +3 -0
  101. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-rtzf3vvk.js +6 -0
  102. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-sw74pcm3.js +2 -0
  103. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-t3eanyjj.js +3 -0
  104. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-tseksj1v.js +1 -0
  105. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-v0ctpcdr.js +12 -0
  106. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-v4-dx8bd4wq.js +1 -0
  107. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-v695918t.js +14 -0
  108. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-v96yy1pw.js +1 -0
  109. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-vfm7r9wk.js +65 -0
  110. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-xecthgrg.js +9 -0
  111. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-xn1xhp06.js +9 -0
  112. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-yfdscfdx.js +1 -0
  113. package/dist/plugin-runtime/node_modules/@cline/core/dist/index-yrnwqsdt.js +2 -0
  114. package/dist/plugin-runtime/node_modules/@cline/core/dist/index.js +1 -0
  115. package/dist/plugin-runtime/node_modules/@cline/core/dist/jiti-static-3mgy2y9y.js +473 -0
  116. package/dist/plugin-runtime/node_modules/@cline/core/dist/jiti-w1xrs0vd.js +1 -0
  117. package/dist/plugin-runtime/node_modules/@cline/core/dist/langfuse-stream-telemetry-9tppg77c.js +1 -0
  118. package/dist/plugin-runtime/node_modules/@cline/core/dist/langfuse-telemetry-y658kpzy.js +1 -0
  119. package/dist/plugin-runtime/node_modules/@cline/core/dist/mistral-cmhqd91b.js +1 -0
  120. package/dist/plugin-runtime/node_modules/@cline/core/dist/multipart-parser-qkjjf8mm.js +2 -0
  121. package/dist/plugin-runtime/node_modules/@cline/core/dist/ollama-8z6y9d1h.js +1 -0
  122. package/dist/plugin-runtime/node_modules/@cline/core/dist/openai-cfmja1ez.js +1 -0
  123. package/dist/plugin-runtime/node_modules/@cline/core/dist/openai-compatible-1t7n5sxj.js +1 -0
  124. package/dist/plugin-runtime/node_modules/@cline/core/dist/orchestration-embedding-model-strategy-GT27AFII-k6yqgnyd.js +1 -0
  125. package/dist/plugin-runtime/node_modules/@cline/core/dist/orchestration-language-model-strategy-YEQPUCOT-6rdyebbq.js +1 -0
  126. package/dist/plugin-runtime/node_modules/@cline/core/dist/services/feature-flags/posthog.js +2 -0
  127. package/dist/plugin-runtime/node_modules/@cline/core/dist/services/telemetry/index.js +1 -0
  128. package/dist/plugin-runtime/node_modules/@cline/core/dist/token-1h068py9.js +1 -0
  129. package/dist/plugin-runtime/node_modules/@cline/core/dist/token-util-7jchft51.js +1 -0
  130. package/dist/plugin-runtime/node_modules/@cline/core/dist/vertex-qfxfsrn4.js +1 -0
  131. package/dist/plugin-runtime/node_modules/@cline/core/package.json +1 -0
  132. package/dist/plugin-runtime/node_modules/@cline/llms/dist/index.browser.js +16 -0
  133. package/dist/plugin-runtime/node_modules/@cline/llms/dist/index.js +1 -0
  134. package/dist/plugin-runtime/node_modules/@cline/llms/package.json +1 -0
  135. package/dist/plugin-runtime/node_modules/@cline/sdk/dist/index.js +1 -0
  136. package/dist/plugin-runtime/node_modules/@cline/sdk/package.json +1 -0
  137. package/dist/plugin-runtime/node_modules/@cline/shared/dist/automation/index.js +57 -0
  138. package/dist/plugin-runtime/node_modules/@cline/shared/dist/db/index.js +127 -0
  139. package/dist/plugin-runtime/node_modules/@cline/shared/dist/index.browser.js +110 -0
  140. package/dist/plugin-runtime/node_modules/@cline/shared/dist/index.js +1 -0
  141. package/dist/plugin-runtime/node_modules/@cline/shared/dist/node.js +1 -0
  142. package/dist/plugin-runtime/node_modules/@cline/shared/dist/remote-config/index.js +68 -0
  143. package/dist/plugin-runtime/node_modules/@cline/shared/dist/storage/index.js +1 -0
  144. package/dist/plugin-runtime/node_modules/@cline/shared/dist/types/index.js +1 -0
  145. package/dist/plugin-runtime/node_modules/@cline/shared/package.json +1 -0
  146. package/dist/plugin-runtime/package.json +1 -0
  147. package/dist/{extensions → plugin-runtime}/plugin-sandbox-bootstrap.js +129 -129
  148. package/dist/remote/remote-environments.d.ts +1 -0
  149. package/dist/runtime/config/agent-runtime-config-builder.d.ts +2 -0
  150. package/dist/runtime/host/local-runtime-host.d.ts +10 -0
  151. package/dist/runtime/host/runtime-host.d.ts +6 -0
  152. package/dist/runtime/orchestration/runtime-oauth-token-manager.d.ts +3 -0
  153. package/dist/runtime/orchestration/session-runtime-orchestrator.d.ts +10 -1
  154. package/dist/runtime/orchestration/session-runtime.d.ts +2 -0
  155. package/dist/runtime/tools/subprocess-sandbox.d.ts +22 -0
  156. package/dist/services/llms/cline-recommended-models.d.ts +2 -0
  157. package/dist/services/local-runtime-bootstrap.d.ts +1 -0
  158. package/dist/services/plugin-command-api.d.ts +47 -0
  159. package/dist/services/plugin-commands.d.ts +25 -27
  160. package/dist/services/skills-cli.d.ts +2 -0
  161. package/dist/services/telemetry/core-events.d.ts +26 -0
  162. package/dist/services/telemetry/index.js +1 -1
  163. package/dist/services/telemetry/run-health.d.ts +40 -0
  164. package/dist/services/telemetry/stall-signals.d.ts +12 -0
  165. package/dist/types/config.d.ts +1 -0
  166. package/dist/types/session.d.ts +7 -0
  167. package/package.json +6 -5
@@ -0,0 +1,190 @@
1
+ import Ff from"node:path";import ie from"node:fs/promises";import gn from"node:path";import{createHmac as em}from"node:crypto";import{basename as tm}from"node:path";import xe from"node:path";import{basename as Om}from"node:path";import{webcrypto as ui}from"node:crypto";import{existsSync as ih,mkdirSync as oh,readFileSync as ah,writeFileSync as sh}from"node:fs";import{dirname as lh,resolve as uh}from"node:path";function Qt(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,r])=>t.indexOf(+n)===-1).map(([n,r])=>r)}function Jn(e,t="|"){return e.map((n)=>vi(n)).join(t)}function en(e,t){if(typeof t==="bigint")return t.toString();return t}class fi{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function Nt(e){return new fi(e)}function Aa(e){return e===null||e===void 0}function En(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function xa(e,t){let n=e/t,r=Math.round(n),i=4*Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-r)<i)return 0;return n-r}function ae(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Tn(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function ue(e){return Tn(e._zod.def)??e._zod.def.shape}function mi(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return ae(this,t,r),r},enumerable:!0,configurable:!0})}function hi(e,t,n){if(t in e)ae(e,t,n);else e[t]=n}function Ie(e,t,n,r){let i=ue(t);for(let o of n){let a=Object.getOwnPropertyDescriptor(i,o);if(!a.enumerable)continue;if(a.get)mi(e,o,()=>{let s=t._zod.def.shape[o];return r?r(s,o):s});else hi(e,o,r?r(a.value,o):a.value)}}function Ca(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);if(!r.enumerable)continue;if(r.get)mi(e,n,()=>t[n]);else hi(e,n,r.value)}}function Y(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Na(e){return JSON.stringify(e)}function Pa(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var gi="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function tt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Ra=Nt(()=>{if(Q.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function Le(e){if(tt(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let n=t.prototype;if(tt(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function yi(e){if(Le(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var za=new Set(["string","number","symbol"]);function Me(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function we(e,t,n){let r=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)r._zod.parent=e;return r}function w(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function vi(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function $a(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var _i=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),La={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Ma(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return Ie(i,e,Pt(e,t)),we(e,Y(n,{shape:i,checks:[]}))}function Pt(e,t){let n=ue(e),r=[];for(let i of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,i)?.enumerable)throw Error(`Unrecognized key: "${String(i)}"`);if(t[i])r.push(i)}return r}function Da(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Pt(e,t)),o={};return Ie(o,e,Reflect.ownKeys(ue(e)).filter((a)=>!i.has(a))),we(e,Y(n,{shape:o,checks:[]}))}function Ua(e,t){if(!Le(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let r=ue(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(r,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return we(e,Y(e._zod.def,{shape:bi(e,t)}))}function bi(e,t){let n={};return Ie(n,e,Reflect.ownKeys(ue(e))),Ca(n,t),n}function ja(e,t){if(!Le(t))throw Error("Invalid input to safeExtend: expected a plain object");return we(e,Y(e._zod.def,{shape:bi(e,t)}))}function Ba(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};Ie(n,e,Reflect.ownKeys(ue(e))),Ie(n,t,Reflect.ownKeys(ue(t)));let r=Y(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return we(e,r)}function Wn(e,t,n,r="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let o=n?new Set(Pt(t,n)):void 0,a={};return Ie(a,t,Reflect.ownKeys(ue(t)),e&&((s,l)=>o&&!o.has(l)?s:new e({type:"optional",innerType:s}))),we(t,Y(t._zod.def,{shape:a,checks:[]}))}function Fa(e,t,n){let r=n?new Set(Pt(t,n)):void 0,i={};return Ie(i,t,Reflect.ownKeys(ue(t)),(o,a)=>r&&!r.has(a)?o:new e({type:"nonoptional",innerType:o})),we(t,Y(t._zod.def,{shape:i}))}function re(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Za(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function ye(e,t){return t.map((n)=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function He(e){return typeof e==="string"?e:e?.message}function Kn(e){let t=[];for(let n of e??[]){let r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;let i=r.maximum??r.length??r.size;if(i>=0)t.push([i,n])}return t}function tn(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function _e(e,t,n){var r;let i=e.inst?._zod?.traits;if(i?.has("$ZodType"))if(i.has("$ZodCheck"))(r=e).schema??(r.schema=e.inst);else e.schema=e.inst;let o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,a=e.message?e.message:He(e.inst?._zod.def?.error?.(e))??He(o?.(e))??He(t?.error?.(e))??He(n.customError?.(e))??He(n.localeError?.(e))??"Invalid input",s={};for(let l of Object.keys(e)){if(l==="inst"||l==="schema"||l==="continue"||l==="input"||l==="__proto__")continue;s[l]=e[l]}if(s.path??(s.path=[]),s.message=a,t?.reportInput)s.input=e.input;return s}var Ha=/[\uD800-\uDBFF]/;function Sn(e){let t=e.length;if(!Ha.test(e))return t;let n=t;for(let r=0;r<t-1;r++)if((e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320)n--,r++;return n}function In(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function qa(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function nt(...e){let[t,n,r]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:r};return{...t}}function Va(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);if(r.get)Object.defineProperty(e,n,{...r,enumerable:!1});else Ja(e,n,r.value)}}function be(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function ki(e,t,n){return be(e,t,n,!1)}function On(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return be(this,n,r(this))},set(i){be(this,n,i)}})}return t}function Ja(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:be(this,t,n.bind(this))},set(r){be(this,t,r)}})}function Wa(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var jt,me=!1,Ka={configurable:!0,get(){me=!0;return}};function x(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&jt!==e._zod){jt=void 0;return}jt=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Ka);let i=me;me=!1;try{let o=n(this);if(me)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o});return me=me||i,o}catch(o){throw delete this[t],me=me||i,o}},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i})}})}function Ga(e,t,n,r){let i=Wa(e,t);if(!i)return;Object.defineProperty(i,t,{configurable:!0,get(){let o={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,o),o.value=n(this),Object.defineProperty(this,t,o),o.value},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:o})}})}var Ya="~constantCatch";function Xa(e){let t=()=>e;return t[Ya]=!0,t}var Gn,Bt={value:void 0,enumerable:!1},Yn="captureStackTrace"in Error?Error:null;function Qa(e){let t=Yn;if(t){let n=t.stackTraceLimit;if(typeof n==="number"){try{t.stackTraceLimit=0}catch{return Yn=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function h(e,t,n,r){let i={};function o(f){this.def=f,this.constr=p,this.traits=new Set}o.prototype=i;let a=n,s=a&&new WeakSet;function l(f,m){if(!f._zod){Bt.value=new o(m);try{Object.defineProperty(f,"_zod",Bt)}finally{Bt.value=void 0}}else if(f._zod.traits.has(e))return;if(f._zod.traits.add(e),t(f,m),s){let y=Object.getPrototypeOf(f),T=f._zod.constr.prototype,b=y;while(b&&b!==T)b=Object.getPrototypeOf(b);let D=b??y;if(!s.has(D))s.add(D),Va(D,a)}let g=p.prototype;for(let y in g){if(!Object.prototype.hasOwnProperty.call(g,y))continue;if(!(y in f))f[y]=g[y].bind(f)}}let u=r?.Parent??Object;class d extends u{}Object.defineProperty(d,"name",{value:e});function p(f){let m=r?.Parent?Qa(d):this;l(m,f);let g=m._zod.deferred;if(g){for(let T of g)T();m._zod.deferred=void 0}let y=globalThis.__zod_globalConfig?.postProcessor;if(y)y(m);return m}return Object.defineProperty(p,"init",{value:l}),Object.defineProperty(p,Symbol.hasInstance,{value:(f)=>{if(r?.Parent&&f instanceof r.Parent)return!0;return f?._zod?.traits?.has(e)}}),Object.defineProperty(p,"name",{value:e}),p}class ve extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class An extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Gn=globalThis).__zod_globalConfig??(Gn.__zod_globalConfig={});var Q=globalThis.__zod_globalConfig;function oe(e){if(e)Object.assign(Q,e);return Q}function es(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,en,2)),e.message}function ts(e){this._zod.message=e}var ns={get:es,set:ts,enumerable:!0,configurable:!0},Ft={value:void 0,enumerable:!1},Xn=new WeakSet([Object.prototype,Error.prototype]),Ei=(e,t)=>{e.name="$ZodError",Ft.value=t,Object.defineProperty(e,"issues",Ft),Ft.value=void 0,Object.defineProperty(e,"message",ns);let n=Object.getPrototypeOf(e);if(!Xn.has(n))Xn.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}})},rs=h("$ZodError",Ei),Ti=h("$ZodError",Ei,void 0,{Parent:Error});function is(e,t,n){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0});else e[t]=n();return e[t]}function os(e,t=(n)=>n.message){let n={},r=[];for(let i of e.issues)if(i.path.length>0)is(n,i.path[0],()=>[]).push(t(i));else r.push(t(i));return{formErrors:r,fieldErrors:n}}function as(e,t=(n)=>n.message){let n={_errors:[]},r=(i,o=[])=>{for(let a of i.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map((s)=>r({issues:s},[...o,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...o,...a.path]);else{let s=[...o,...a.path];if(s.length===0)n._errors.push(t(a));else{let l=n,u=0;while(u<s.length){let d=s[u],p=u===s.length-1;if(d==="_errors"){if(p)l._errors.push(t(a));u++;continue}if(!Object.prototype.hasOwnProperty.call(l,d))Object.defineProperty(l,d,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let f=l[d];if(p)f._errors.push(t(a));l=f,u++}}}};return r(e),n}function ss(e){let t=[],n=e.map((r)=>typeof r==="object"?r.key:r);for(let r of n)if(typeof r==="number")t.push(`[${r}]`);else if(typeof r==="symbol")t.push(`[${JSON.stringify(String(r))}]`);else if(/[^\w$]/.test(r))t.push(`[${JSON.stringify(r)}]`);else{if(t.length)t.push(".");t.push(r)}return t.join("")}function cs(e){let t=[],n=[...e.issues].sort((r,i)=>(r.path??[]).length-(i.path??[]).length);for(let r of n)if(t.push(`✖ ${r.message}`),r.path?.length)t.push(` → at ${ss(r.path)}`);return t.join(`
2
+ `)}function Rt(e,t){return{callee:t?.callee??e,Err:t?.Err}}var zt=(e)=>{let t=(n,r,i,o)=>{let a=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},a);if(s instanceof Promise)throw new ve;if(s.issues.length){let l=new(o?.Err??e)(s.issues.map((u)=>_e(u,a,oe())));throw gi(l,o?.callee??t),l}return s.value};return t},Qn=zt(Ti),$t=(e)=>{let t=async(n,r,i,o)=>{let a=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},a);if(s instanceof Promise)s=await s;if(s.issues.length){let l=new(o?.Err??e)(s.issues.map((u)=>_e(u,a,oe())));throw gi(l,o?.callee??t),l}return s.value};return t},er=$t(Ti),xn=(e)=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new ve;return o.issues.length?Si(e,o.issues,i):{success:!0,data:o.value}};function Si(e,t,n){let r;return{success:!1,get error(){if(!r)r=new e(t.map((i)=>_e(i,n,oe()))),t=void 0,n=void 0;return r},set error(i){r=i,t=void 0,n=void 0}}}var Cn=(e)=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)o=await o;return o.issues.length?Si(e,o.issues,i):{success:!0,data:o.value}},fs=Symbol.for("zod.compile.invalid"),ms=Symbol.for("zod.compile.fallback"),hs=(e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==fs)return!0;if(r.definite===!0&&n===void 0)return!1}return gs(e,t,n)};function gs(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,o;if(i)r[ms]=!0,o=i({value:t,issues:[]},r);else o=e._zod.run({value:t,issues:[]},r);if(o instanceof Promise)throw new ve;return o.issues.length===0}var ys=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);if(i instanceof Promise)i=await i;return i.issues.length===0},vs=(e)=>{let t=zt(e),n=(r,i,o,a)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return t(r,i,s,Rt(n,a))};return n},_s=(e)=>{let t=zt(e),n=(r,i,o,a)=>t(r,i,o,Rt(n,a));return n},bs=(e)=>{let t=$t(e),n=async(r,i,o,a)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return await t(r,i,s,Rt(n,a))};return n},ws=(e)=>{let t=$t(e),n=async(r,i,o,a)=>await t(r,i,o,Rt(n,a));return n},ks=(e)=>(t,n,r)=>{let i=r?{...r,direction:"backward"}:{direction:"backward"};return xn(e)(t,n,i)},Es=(e)=>(t,n,r)=>xn(e)(t,n,r),Ts=(e)=>async(t,n,r)=>{let i=r?{...r,direction:"backward"}:{direction:"backward"};return Cn(e)(t,n,i)},Ss=(e)=>async(t,n,r)=>Cn(e)(t,n,r),Is=/^[cC][0-9a-z]{6,}$/,Os=/^[0-9a-z]+$/,As=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,xs=/^[0-9a-vA-V]{20}$/,Cs=/^[A-Za-z0-9]{27}$/,Ns=/^[a-zA-Z0-9_-]{21}$/;function Ps(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Rs=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,zs=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,tr=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},$s=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ls="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Ms(){return new RegExp(Ls,"u")}var Ds=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Us=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,js=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Bs=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Fs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zs=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Hs=/^https?$/,qs=/^\+[1-9]\d{6,14}$/,Ii="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Vs(e){return new RegExp(`^${e}$`)}var Js=Vs(Ii);function nn(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Ws(e){return new RegExp(`^${nn(e)}$`)}function Ks(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${nn({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${nn({precision:e.precision})}`:n;return new RegExp(`^${Ii}T(?:${r})$`)}var Gs=/^[\s\S]{0,}$/,Ys=/^-?\d+$/,Nn=/^-?\d+(?:\.\d+)?$/,Xs=/^(?:true|false)$/i,Qs=/^[^A-Z]*$/,el=/^[^a-z]*$/,G=h("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Rn=(e)=>{let t=e.value;return!Aa(t)&&t.length!==void 0},wt={number:"number",bigint:"bigint",object:"date"},Oi=h("$ZodCheckLessThan",(e,t)=>{G.init(e,t);let n=wt[typeof t.value];e._zod.check=(r)=>{if(t.inclusive?r.value<=t.value:r.value<t.value)return;r.issues.push({origin:wt[typeof r.value]??n,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ai=h("$ZodCheckGreaterThan",(e,t)=>{G.init(e,t);let n=wt[typeof t.value];e._zod.check=(r)=>{if(t.inclusive?r.value>=t.value:r.value>t.value)return;r.issues.push({origin:wt[typeof r.value]??n,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tl=h("$ZodCheckMultipleOf",(e,t)=>{G.init(e,t),e._zod.check=(n)=>{if(typeof n.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):xa(n.value,t.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),rl=h("$ZodCheckNumberFormat",(e,t)=>{G.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[i,o]=_i[t.format];e._zod.check=(a)=>{let s=a.value;if(n){if(!Number.isInteger(s)){a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){if(s>0)a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});else a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}if(s<i)a.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort});if(s>o)a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),ol=h("$ZodCheckMaxLength",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=Rn),e._zod.check=(r)=>{let i=r.value,o=i.length;if((typeof i==="string"&&o>t.maximum?Sn(i):o)<=t.maximum)return;let a=In(i);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),sl=h("$ZodCheckMinLength",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=Rn),e._zod.check=(r)=>{let i=r.value,o=i.length;if((typeof i==="string"&&o>=t.minimum&&o<t.minimum*2?Sn(i):o)>=t.minimum)return;let a=In(i);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),ll=h("$ZodCheckLengthEquals",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=Rn),e._zod.check=(r)=>{let i=r.value,o=i.length,a=typeof i==="string"&&o>=t.length&&o<=t.length*2?Sn(i):o;if(a===t.length)return;let s=In(i),l=a>t.length;r.issues.push({origin:s,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Lt=h("$ZodCheckStringFormat",(e,t)=>{var n,r;if(G.init(e,t),t.pattern)(n=e._zod).check??(n.check=(i)=>{if(t.pattern.lastIndex=0,t.pattern.test(i.value))return;i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(r=e._zod).check??(r.check=()=>{})}),ul=h("$ZodCheckRegex",(e,t)=>{Lt.init(e,t),e._zod.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),cl=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Qs),Lt.init(e,t)}),dl=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=el),Lt.init(e,t)}),pl=h("$ZodCheckIncludes",(e,t)=>{G.init(e,t);let n=Me(t.includes),r=new RegExp(typeof t.position==="number"?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=(i)=>{if(i.value.includes(t.includes,t.position))return;i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),fl=h("$ZodCheckStartsWith",(e,t)=>{G.init(e,t);let n=new RegExp(`^${Me(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=(r)=>{if(r.value.startsWith(t.prefix))return;r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),ml=h("$ZodCheckEndsWith",(e,t)=>{G.init(e,t);let n=new RegExp(`.*${Me(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=(r)=>{if(r.value.endsWith(t.suffix))return;r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),hl=h("$ZodCheckOverwrite",(e,t)=>{G.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class xi{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split(`
3
+ `).filter((i)=>i),n=Math.min(...t.map((i)=>i.length-i.trimStart().length)),r=t.map((i)=>i.slice(n)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of r)this.content.push(i)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
4
+ ${t.join(`
5
+ `)}
6
+ };`)(...Object.values(this.closed))}}var gl={major:4,minor:6,patch:7},R=h("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=gl;let r=e._zod.def.checks,i=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let o of i)for(let a of o._zod.onattach)a(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(s,l,u)=>{if(s.memo)return s;let d=re(s),p;for(let f of l){if(f._zod.def.when){if(Za(s))continue;if(!f._zod.def.when(s))continue}else if(d)continue;let m=s.issues.length,g=f._zod.check(s);if(g instanceof Promise&&u?.async===!1)throw new ve;if(p||g instanceof Promise)p=(p??Promise.resolve()).then(async()=>{if(await g,s.issues.length===m)return;if(tn(s.issues,m,e),!d)d=re(s,m)});else{if(s.issues.length===m)continue;if(tn(s.issues,m,e),!d)d=re(s,m)}}if(p)return p.then(()=>s);return s},a=(s,l,u)=>{if(re(s))return s.aborted=!0,s;let d=o(l,i,u);if(d instanceof Promise){if(u.async===!1)throw new ve;return d.then((p)=>e._zod.parse(p,u))}return e._zod.parse(d,u)};e._zod.run=(s,l)=>{if(l.skipChecks)return e._zod.parse(s,l);if(l.direction==="backward"){let d=e._zod.parse({value:s.value,issues:[]},{...l,skipChecks:!0});if(d instanceof Promise)return d.then((p)=>a(p,s,l));return a(d,s,l)}let u=e._zod.parse(s,l);if(u instanceof Promise){if(l.async===!1)throw new ve;return u.then((d)=>o(d,i,l))}return o(u,i,l)}}},{get "~standard"(){return ki(this,"~standard",Ni(this))},set "~standard"(e){be(this,"~standard",e)}}),Ci=(e,t)=>e.issues.length?{issues:e.issues.map((n)=>_e(n,t,oe()))}:{value:e.value};async function yl(e,t){let n={async:!0};return Ci(await e._zod.run({value:t,issues:[]},n),n)}function Ni(e){return{validate:(t)=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Ci(r,n)}catch(r){}return yl(e,t)},vendor:"zod",version:1}}var zn=h("$ZodString",(e,t)=>{R.init(e,t),e._zod.pattern=t.pattern??Gs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(i){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),j=h("$ZodStringFormat",(e,t)=>{Lt.init(e,t),zn.init(e,t)}),vl=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=zs),j.init(e,t)}),_l=h("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=tr(n))}else t.pattern??(t.pattern=tr());j.init(e,t)}),bl=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=$s),j.init(e,t)}),Pi=1,kt=2;function Ri(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function wl(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return Ri(e)||kt;return kl(e,t)}function kl(e,t){if(!t.normalize&&t.protocol?.source===Hs.source&&!/^https?:\/\//i.test(e))return Pi;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse==="function")return n.parse(e)??kt}return new URL(e)}catch{return kt}}var El=/[\t\n\r]/g;function nr(e){return e.replace(El,"")}function Tl(e,t){return t.lastIndex=0,t.test(e.hostname)}function Sl(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Il=h("$ZodURL",(e,t)=>{j.init(e,t),e._zod.check=(n)=>{try{let r=n.value.trim(),i=wl(r,t);if(i===Pi){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(i===kt){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=nr(r);return}if(t.hostname&&!Tl(i,t.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort});if(t.protocol&&!Sl(i,t.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort});n.value=t.normalize?i.href:nr(r);return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Ol=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Ms()),j.init(e,t)}),Al=h("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?Ns:Ps(t.length)),j.init(e,t)}),xl=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Is),j.init(e,t)}),Cl=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Os),j.init(e,t)}),Nl=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=As),j.init(e,t)}),Pl=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=xs),j.init(e,t)}),Rl=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Cs),j.init(e,t)}),zl=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ks(t)),j.init(e,t)}),$l=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Js),j.init(e,t)}),Ll=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ws(t)),j.init(e,t)}),Ml=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Rs),j.init(e,t)}),Dl=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ds),j.init(e,t)}),Ul=/^[0-9a-fA-F:.]+$/;function zi(e){if(!Ul.test(e))return!1;return Ri(`http://[${e}]`)}var jl=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Us),j.init(e,t),e._zod.check=(n)=>{if(!zi(n.value))n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Bl=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=js),j.init(e,t)});function Fl(e){let t=e.split("/");if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);if(`${i}`!==r)return!1;if(i<0||i>128)return!1;return zi(n)}var Zl=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Bs),j.init(e,t),e._zod.check=(n)=>{if(!Fl(n.value))n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function $i(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Li=/^[0-9a-zA-Z+/]*={0,2}$/,Hl=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Li),j.init(e,t),e._zod.check=(n)=>{if($i(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),$n=/^[A-Za-z0-9_-]*$/;function ql(e){if(!$n.test(e))return!1;let t=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return $i(n)}var Vl=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=$n),j.init(e,t),e._zod.check=(n)=>{if(ql(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Jl=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=qs),j.init(e,t)});function Wl(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));if("typ"in i&&i?.typ!=="JWT")return!1;if(!i.alg)return!1;if(t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}var Kl=h("$ZodJWT",(e,t)=>{j.init(e,t),e._zod.check=(n)=>{if(Wl(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Mi=h("$ZodNumber",(e,t)=>{R.init(e,t),e._zod.pattern=Nn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(a){}let i=n.value;if(typeof i==="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;let o=typeof i==="number"?Number.isNaN(i)?"NaN":!Number.isFinite(i)?String(i):void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),Gl=h("$ZodNumberFormat",(e,t)=>{rl.init(e,t),Mi.init(e,t)}),Yl=h("$ZodBoolean",(e,t)=>{R.init(e,t),e._zod.pattern=Xs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(o){}let i=n.value;if(typeof i==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),Xl=h("$ZodUnknown",(e,t)=>{R.init(e,t),e._zod.parse=(n)=>n}),Ql=h("$ZodNever",(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),eu=h("$ZodVoid",(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(typeof i>"u")return n;return n.issues.push({expected:"void",code:"invalid_type",input:i,inst:e}),n}}),tu=h("$ZodDate",(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(a){}let i=n.value,o=i instanceof Date;if(o&&!Number.isNaN(i.getTime()))return n;return n.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:e}),n}});function nu(e,t){let n=Kn(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map((o)=>o[0])),i=e._zod.parse;e._zod.parse=(o,a)=>{let s=t(o.value);if(s>r&&!a?.skipChecks&&a?.direction!=="backward"){for(let[l,u]of Kn(e._zod.def.checks))if(s>l&&u._zod.def.when(o)){let d=o.issues.length;return u._zod.check(o),o.issues[d].continue=!1,tn(o.issues,d,e),o}}return i(o,a)}}var ru=(e)=>Array.isArray(e)?e.length:-1;function rr(e,t,n){if(e.issues.length)t.issues.push(...ye(n,e.issues));t.value[n]=e.value}var iu=h("$ZodArray",(e,t)=>{R.init(e,t);let n=Q.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=n?n.alloc(e,r,Array(o.length),i):Array(o.length);let a=[],s=i?.abortEarly;for(let l=0;l<o.length;l++){let u=o[l],d=t.element._zod.run({value:u,issues:[]},i);if(d instanceof Promise)a.push(d.then((p)=>rr(p,r,l)));else if(rr(d,r,l),s&&d.issues.length!==0&&re(d))break}if(a.length)return Promise.all(a).then(()=>r);return r},nu(e,ru)});function Et(e,t,n,r,i,o){let a=n in r,s=o==="optional";if(!a&&s&&i==="optional")return;if(e.issues.length){if(i!==void 0&&s&&!a)return;t.issues.push(...ye(n,e.issues))}if(!a&&i===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(e.value===void 0){if(a||i==="defaulted"&&!s)t.value[n]=void 0}else t.value[n]=e.value}var ou=[];function Di(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:ou,i=r.length?[...t,...r]:t;for(let a of i)if(!e.shape?.[a]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(a)}": expected a Zod schema`);let o=$a(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function Ui(e,t,n,r,i,o,a){let s=[],l=i.keySet,u=i.catchall._zod,d=u.def.type,{optin:p,optout:f}=u,m=0;for(let g in t){if(a&&n.issues.length!==m){if(re(n,m))break;m=n.issues.length}if(l.has(g))continue;if(g==="__proto__"){if(d==="never")s.push(g);continue}if(d==="never"){s.push(g);continue}let y=u.run({value:t[g],issues:[]},r);if(y instanceof Promise)e.push(y.then((T)=>Et(T,n,g,t,p,f)));else Et(y,n,g,t,p,f)}if(s.length)n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o,continue:!0});if(!e.length)return n;return Promise.all(e).then(()=>n)}var au=h("$ZodObject",(e,t)=>{R.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){let u=()=>{let d={...r};return Object.defineProperty(t,"shape",{value:d}),u.raw=d,d};u.raw=r,Object.defineProperty(t,"shape",{get:u})}let i=Nt(()=>Di(t));x(e,"propValues",(u)=>{let d=u.def.shape,p={};for(let f in d){let m=d[f]._zod;if(m.values){if(!Object.prototype.hasOwnProperty.call(p,f))ae(p,f,new Set);for(let g of m.values)p[f].add(g);if(m.optin!==void 0)p[f].add(void 0)}}return p});let o=tt,a=t.catchall,s,l=Q.memoizer;l?.attach(e),e._zod.parse=(u,d)=>{s??(s=i.value);let p=u.value;if(!o(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value=l?l.alloc(e,u,{},d):{};let f=[],m=s.shape,g=d?.abortEarly,y=u.issues.length;for(let T of s.allKeys){if(g&&u.issues.length!==y){if(re(u,y))break;y=u.issues.length}if(T==="__proto__")continue;let b=m[T],D=b._zod.optin,C=b._zod.optout,N=b._zod.run({value:p[T],issues:[]},d);if(N instanceof Promise)f.push(N.then((S)=>Et(S,u,T,p,D,C)));else Et(N,u,T,p,D,C)}if(!a)return f.length?Promise.all(f).then(()=>u):u;return Ui(f,p,u,d,i.value,e,g===!0)}}),su=h("$ZodObjectJIT",(e,t)=>{au.init(e,t);let n=e._zod.parse,r=Nt(()=>Di(t)),i=Q.memoizer,o=(f)=>{let m=r.value,g=m.symbolKeys,y=new xi(["payload","ctx"],{shape:f,inst:e,memo:i,syms:g}),T=(N)=>`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`,b=(N,S)=>`
7
+ let ${N}_ab = false;
8
+ for (let i = 0; i < ${N}.issues.length; i++) {
9
+ const iss = ${N}.issues[i];
10
+ iss.path = iss.path ? [${S}, ...iss.path] : [${S}];
11
+ payload.issues.push(iss);
12
+ if (iss.continue !== true) ${N}_ab = true;
13
+ }
14
+ if (${N}_ab && ctx && ctx.abortEarly) {
15
+ payload.value = newResult;
16
+ return payload;
17
+ }`;y.write("const input = payload.value;");let D=Object.create(null),C=0;for(let N of m.allKeys)D[N]=`key_${C++}`;y.write(i?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let N of m.allKeys){if(N==="__proto__")continue;let S=D[N],q=typeof N==="symbol"?`syms[${g.indexOf(N)}]`:Na(N),ce=`${q} in input`,ke=f[N],Be=ke?._zod?.optin,Fe=Be!==void 0,Dt=ke?._zod?.optout==="optional";if(y.write(`const ${S} = ${T(q)};`),Fe&&Dt){let Ze=Be==="optional"?`${S}_present`:`${S}.value !== undefined || ${S}_present`;y.write(`
18
+ const ${S}_present = ${ce};
19
+ if (!${S}.issues.length || ${S}_present) {
20
+ if (${S}.issues.length) {${b(S,q)}
21
+ }
22
+
23
+ if (${Ze}) {
24
+ newResult[${q}] = ${S}.value;
25
+ }
26
+ }
27
+
28
+ `)}else if(!Fe)y.write(`
29
+ const ${S}_present = ${ce};
30
+ if (${S}.issues.length) {${b(S,q)}
31
+ }
32
+ if (!${S}_present && !${S}.issues.length) {
33
+ payload.issues.push({
34
+ code: "invalid_type",
35
+ expected: "nonoptional",
36
+ input: undefined,
37
+ path: [${q}]
38
+ });
39
+ if (ctx && ctx.abortEarly) {
40
+ payload.value = newResult;
41
+ return payload;
42
+ }
43
+ }
44
+
45
+ if (${S}_present) {
46
+ newResult[${q}] = ${S}.value;
47
+ }
48
+
49
+ `);else if(y.write(`
50
+ if (${S}.issues.length) {${b(S,q)}
51
+ }
52
+ `),Be==="defaulted")y.write(`newResult[${q}] = ${S}.value;`);else y.write(`
53
+ if (${S}.value !== undefined || ${ce}) {
54
+ newResult[${q}] = ${S}.value;
55
+ }
56
+ `)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()},a,s=tt,l=!Q.jitless,u=l&&Ra.value,d=t.catchall,p;e._zod.parse=(f,m)=>{p??(p=r.value);let g=f.value;if(!s(g))return f.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),f;if(l&&u&&m?.async===!1&&m.jitless!==!0){if(!a)a=o(t.shape);if(f=a(f,m),!d)return f;return Ui([],g,f,m,p,e,m?.abortEarly===!0)}return n(f,m)}});function ir(e,t,n,r){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let i=e.filter((o)=>!re(o));if(i.length===1)return t.value=i[0].value,i[0];return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((o)=>o.issues.map((a)=>_e(a,r,oe())))}),t}var ji=h("$ZodUnion",(e,t)=>{R.init(e,t),x(e,"optin",(r)=>r.def.options.some((i)=>i._zod.optin==="defaulted")?"defaulted":r.def.options.some((i)=>i._zod.optin!==void 0)?"optional":void 0),x(e,"optout",(r)=>r.def.options.some((i)=>i._zod.optout==="optional")?"optional":void 0),x(e,"values",(r)=>{if(r.def.options.every((i)=>i._zod.values))return new Set(r.def.options.flatMap((i)=>Array.from(i._zod.values)));return}),x(e,"pattern",(r)=>{if(r.def.options.every((i)=>i._zod.pattern)){let i=r.def.options.map((o)=>o._zod.pattern);return new RegExp(`^(${i.map((o)=>En(o.source)).join("|")})$`)}return});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let o=!1,a=[];for(let s of t.options){let l=s._zod.run({value:r.value,issues:[]},i);if(l instanceof Promise)a.push(l),o=!0;else{if(l.issues.length===0)return l;a.push(l)}}if(!o)return ir(a,r,e,i);return Promise.all(a).then((s)=>ir(s,r,e,i))}});function lu(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let i of r)if(t.has(i)){if(i!==void 0)throw Error(`Duplicate discriminator value "${String(i)}"`);t.set(i,null)}else t.set(i,n)}return t}var uu=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ji.init(e,t);let n=e._zod.parse;x(e,"propValues",(i)=>{let o={},a=0;for(let s of i.def.options){let l=s._zod.propValues;if(!l||Object.keys(l).length===0)throw Error(`Invalid discriminated union option at index "${i.def.options.indexOf(s)}"`);if(l[i.def.discriminator]?.has(void 0))a++;for(let[u,d]of Object.entries(l)){if(!Object.prototype.hasOwnProperty.call(o,u))ae(o,u,new Set);for(let p of d)o[u].add(p)}}if(!i.def.unionFallback&&a>1)o[i.def.discriminator]?.delete(void 0);return o}),t.options.forEach((i,o)=>{let a=Tn(i._zod.def);if(a&&!Object.prototype.hasOwnProperty.call(a,t.discriminator))throw Error(`Invalid discriminated union option at index "${o}"`)});let r=Nt(()=>lu(t));e._zod.parse=(i,o)=>{let a=i.value;if(!tt(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),i;let s=a?.[t.discriminator],l=r.value.get(s);if(l&&(s!==void 0||o.direction!=="backward"))return l._zod.run(i,o);if(t.unionFallback||o.direction==="backward")return n(i,o);return i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter((u)=>r.value.get(u)!==null),input:a,path:[t.discriminator],inst:e}),i}}),cu=h("$ZodIntersection",(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{let i=n.value,o=t.left._zod.run({value:i,issues:[]},r),a=t.right._zod.run({value:i,issues:[]},r);if(o instanceof Promise||a instanceof Promise)return Promise.all([o,a]).then(([s,l])=>or(n,s,l));return or(n,o,a)}});function rn(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Le(e)&&Le(t)){let n=Object.keys(t),r=Object.keys(e).filter((o)=>n.indexOf(o)!==-1),i={...e,...t};if(Object.prototype.hasOwnProperty.call(i,"__proto__"))delete i.__proto__;for(let o of r){if(o==="__proto__")continue;let a=rn(e[o],t[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};i[o]=a.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=t[r],a=rn(i,o);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function or(e,t,n){let r=new Map,i,o=new Map,a=(u,d)=>{let p;if(u.code==="unrecognized_keys"&&!u.path?.length)i??(i=u),p=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let f=String(u.path[0]);if(!o.has(f))o.set(f,u);p=[f]}else return!1;for(let f of p){if(!r.has(f))r.set(f,{});r.get(f)[d]=!0}return!0};for(let u of t.issues)if(!a(u,"l"))e.issues.push(u);for(let u of n.issues)if(!a(u,"r"))e.issues.push(u);let s=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(s.length){let u=i?s.filter((d)=>i.keys.includes(d)):[];if(u.length)e.issues.push({...i,keys:u});for(let d of s)if(!u.includes(d)&&o.has(d))e.issues.push(o.get(d))}let l=rn(t.value,n.value);if(!l.valid){if(re(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(l.mergeErrorPath)}`)}return e.value=l.data,e}var Bi=h("$ZodTuple",(e,t)=>{R.init(e,t);let n=t.items,r=Q.memoizer;r?.attach(e),e._zod.parse=(i,o)=>{let a=i.value;if(!Array.isArray(a))return i.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),i;i.value=r?r.alloc(e,i,[],o):[];let s=[],l=ar(n,"optin"),u=ar(n,"optout");if(!t.rest){if(a.length<l)return i.issues.push({code:"too_small",minimum:l,inclusive:!0,input:a,inst:e,origin:"array"}),i;if(a.length>n.length)i.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:a,inst:e,origin:"array"})}let d=Array(n.length),p=t.rest?o?.abortEarly:void 0,f=!1;for(let m=0;m<n.length;m++){let g=n[m]._zod.run({value:a[m],issues:[]},o);if(g instanceof Promise)s.push(g.then((y)=>{d[m]=y}));else if(d[m]=g,p&&!f&&g.issues.length)f=re(g)}if(t.rest&&!f){let m=n.length-1,g=a.slice(n.length),y=i.issues.length;for(let T of g){if(p&&i.issues.length!==y){if(re(i,y))break;y=i.issues.length}m++;let b=t.rest._zod.run({value:T,issues:[]},o);if(b instanceof Promise)s.push(b.then((D)=>sr(D,i,m)));else sr(b,i,m)}}if(s.length)return Promise.all(s).then(()=>lr(d,i,n,a,u));return lr(d,i,n,a,u)}});function ar(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function sr(e,t,n){if(e.issues.length)t.issues.push(...ye(n,e.issues));t.value[n]=e.value}function lr(e,t,n,r,i){for(let o=0;o<n.length;o++){let a=e[o],s=o<r.length;if(!s&&o>=i&&n[o]._zod.optin==="optional"){t.value.length=o;break}if(a.issues.length){if(!s&&o>=i){t.value.length=o;break}t.issues.push(...ye(o,a.issues))}t.value[o]=a.value}for(let o=t.value.length-1;o>=r.length;o--)if(n[o]._zod.optout==="optional"&&t.value[o]===void 0)t.value.length=o;else break;return t}var du=h("$ZodRecord",(e,t)=>{R.init(e,t);let n=Q.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let o=r.value;if(!Le(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let a=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let l=new Set;for(let d of s)if(typeof d==="string"||typeof d==="number"||typeof d==="symbol"){if(l.add(typeof d==="number"?d.toString():d),d==="__proto__")continue;let p=t.keyType._zod.run({value:d,issues:[]},i);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(p.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map((g)=>_e(g,i,oe())),input:d,path:[d],inst:e});continue}let f=p.value;if(f==="__proto__")continue;let m=t.valueType._zod.run({value:o[d],issues:[]},i);if(m instanceof Promise)a.push(m.then((g)=>{if(g.issues.length)r.issues.push(...ye(d,g.issues));r.value[f]=g.value}));else{if(m.issues.length)r.issues.push(...ye(d,m.issues));r.value[f]=m.value}}let u;for(let d in o)if(!l.has(d))if(t.mode==="loose"){if(d==="__proto__")continue;r.value[d]=o[d]}else u=u??[],u.push(d);if(u&&u.length>0)r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:u,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let l;for(let u of Reflect.ownKeys(o)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(o,u))continue;let d=t.keyType._zod.run({value:u,issues:[]},i);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&Nn.test(u)&&d.issues.length){let m=t.keyType._zod.run({value:Number(u),issues:[]},i);if(m instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(m.issues.length===0)d=m}if(d.issues.length){if(t.mode==="loose")r.value[u]=o[u];else if(s)l=l??[],l.push(u);else r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((m)=>_e(m,i,oe())),input:u,path:[u],inst:e});continue}let p=d.value;if(p==="__proto__")continue;let f=t.valueType._zod.run({value:o[u],issues:[]},i);if(f instanceof Promise)a.push(f.then((m)=>{if(m.issues.length)r.issues.push(...ye(u,m.issues));r.value[p]=m.value}));else{if(f.issues.length)r.issues.push(...ye(u,f.issues));r.value[p]=f.value}}if(l&&l.length>0)r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:l,continue:!0})}if(a.length)return Promise.all(a).then(()=>r);return r}}),pu=h("$ZodEnum",(e,t)=>{R.init(e,t);let n=Qt(t.entries),r=new Set(n);e._zod.values=r,x(e,"pattern",(i)=>{let o=Qt(i.def.entries).filter((a)=>za.has(typeof a));return new RegExp(o.length?`^(${o.map((a)=>Me(a.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(i,o)=>{let a=i.value;if(r.has(a))return i;return i.issues.push({code:"invalid_value",values:n,input:a,inst:e}),i}}),fu=h("$ZodLiteral",(e,t)=>{R.init(e,t);let n=new Set(t.values);e._zod.values=n,x(e,"pattern",(r)=>{let i=r.def.values;return new RegExp(i.length?`^(${i.map((o)=>typeof o==="string"?Me(o):o?Me(o.toString()):String(o)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,i)=>{let o=r.value;if(n.has(o))return r;return r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),mu=h("$ZodTransform",(e,t)=>{R.init(e,t),e._zod.optin="optional",Q.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new An(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then((o)=>(n.value=o,n));if(i instanceof Promise)throw new ve;return n.value=i,n}});function ur(e,t){return e.value=t.issues.length?void 0:t.value,e}var Fi=h("$ZodOptional",(e,t)=>{R.init(e,t),x(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",x(e,"values",(n)=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),x(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${En(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let i=t.innerType._zod.run({value:n.value,issues:[]},r);if(i instanceof Promise)return i.then((o)=>ur(n,o));return ur(n,i)}return t.innerType._zod.run(n,r)}}),hu=h("$ZodExactOptional",(e,t)=>{Fi.init(e,t),x(e,"values",(n)=>n.def.innerType._zod.values),x(e,"pattern",(n)=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),gu=h("$ZodNullable",(e,t)=>{R.init(e,t),x(e,"optin",(n)=>n.def.innerType._zod.optin),x(e,"optout",(n)=>n.def.innerType._zod.optout),x(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${En(r.source)}|null)$`):void 0}),x(e,"values",(n)=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>{if(n.value===null)return n;return t.innerType._zod.run(n,r)}}),yu=h("$ZodDefault",(e,t)=>{R.init(e,t),e._zod.optin="defaulted",x(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;let i=t.innerType._zod.run(n,r);if(i instanceof Promise)return i.then((o)=>cr(o,t));return cr(i,t)}});function cr(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var vu=h("$ZodPrefault",(e,t)=>{R.init(e,t),e._zod.optin="defaulted",x(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)n.value=t.defaultValue;return t.innerType._zod.run(n,r)}}),_u=h("$ZodNonOptional",(e,t)=>{R.init(e,t),x(e,"values",(n)=>{let r=n.def.innerType._zod.values;return r?new Set([...r].filter((i)=>i!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);if(i instanceof Promise)return i.then((o)=>dr(o,e));return dr(i,e)}});function dr(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function pr(e,t,n,r){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map((i)=>_e(i,r,oe()))},input:e.value}),e}var bu=h("$ZodCatch",(e,t)=>{R.init(e,t),x(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),x(e,"optout",(n)=>n.def.innerType._zod.optout),x(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let i=t.innerType._zod.run({value:n.value,issues:[]},r);if(i instanceof Promise)return i.then((o)=>pr(n,o,t,r));return pr(n,i,t,r)}}),Zi=h("$ZodPipe",(e,t)=>{R.init(e,t),x(e,"values",(n)=>n.def.in._zod.values),x(e,"optin",(n)=>n.def.in._zod.optin),x(e,"optout",(n)=>n.def.out._zod.optout),x(e,"propValues",(n)=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let o=t.out._zod.run(n,r);if(o instanceof Promise)return o.then((a)=>st(a,t.in,r));return st(o,t.in,r)}let i=t.in._zod.run(n,r);if(i instanceof Promise)return i.then((o)=>st(o,t.out,r));return st(i,t.out,r)}});function st(e,t,n){if(e.issues.some((r)=>r.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},n)}var wu=h("$ZodPreprocess",(e,t)=>{Zi.init(e,t)}),ku=h("$ZodReadonly",(e,t)=>{R.init(e,t),x(e,"propValues",(n)=>n.def.innerType._zod.propValues),x(e,"values",(n)=>n.def.innerType._zod.values),x(e,"optin",(n)=>n.def.innerType?._zod?.optin),x(e,"optout",(n)=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let i=t.innerType._zod.run(n,r);if(i instanceof Promise)return i.then(fr);return fr(i)}});function fr(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Eu=h("$ZodFunction",(e,t)=>(R.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=(n)=>{if(typeof n!=="function")throw Error("implement() must be called with a function");return Object.defineProperty(function(...r){let i=e._def.input?Qn(e._def.input,r):r,o=Reflect.apply(n,this,i);if(e._def.output)return Qn(e._def.output,o);return o},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=(n)=>{if(typeof n!=="function")throw Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){let i=e._def.input?await er(e._def.input,r):r,o=await Reflect.apply(n,this,i);if(e._def.output)return await er(e._def.output,o);return o},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(n,r)=>{if(typeof n.value!=="function")return n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n;if(e._def.output&&e._def.output._zod.def.type==="promise")n.value=e.implementAsync(n.value);else n.value=e.implement(n.value);return n},e.input=(...n)=>{let r=e.constructor;if(Array.isArray(n[0]))return new r({type:"function",input:new Bi({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output});return new r({type:"function",input:n[0],output:e._def.output})},e.output=(n)=>new e.constructor({type:"function",input:e._def.input,output:n}),e)),Tu=h("$ZodPromise",(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>Promise.resolve(n.value).then((i)=>t.innerType._zod.run({value:i,issues:[]},r))}),Su=h("$ZodCustom",(e,t)=>{G.init(e,t),R.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=(n)=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then((o)=>mr(o,n,r,e));mr(i,n,r,e);return}});function mr(e,t,n,r){if(!e){let i={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};if(r._zod.def.params)i.params=r._zod.def.params;t.issues.push(nt(i))}}class Hi extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var on="~memo",hr=[];function Vi(e){return e!==null&&typeof e==="object"}function Zt(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Ji=new WeakMap,We=0,gt=1,Xe=2;function yt(e,t,n){let r=Ji.get(e);if(r!==void 0)return r?Xe:We;if(t.has(e))return Xe;t.add(e);let i=We,o=(d)=>{if(i!==Xe&&d?._zod){let p=yt(d,t,n);if(p>i)i=p}},a=(d,p)=>{let f=We;for(let m of Reflect.ownKeys(d)){let g=Object.getOwnPropertyDescriptor(d,m);if(p&&!g.enumerable)continue;let y=g.get?gt:g.value?._zod?yt(g.value,t,n):We;if(y>f)f=y}return f},s=(d)=>{if(d>i)i=d},l=e._zod.def;switch(l.type){case"object":{let d=Tn(l);s(d?a(d,!0):gt),o(l.catchall);break}case"array":o(l.element);break;case"tuple":for(let d of l.items)o(d);o(l.rest);break;case"record":case"map":o(l.keyType),o(l.valueType);break;case"set":o(l.valueType);break;case"union":for(let d of l.options)o(d);break;case"intersection":o(l.left),o(l.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":o(l.innerType);break;case"pipe":o(l.in),o(l.out);break;case"function":o(l.input),o(l.output);break;case"lazy":{let d=l._cachedInner??(n?e._zod.innerType:void 0);s(d?yt(d,t,!1):gt);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let d in l){let p=Object.getOwnPropertyDescriptor(l,d);if(!p||p.get)continue;let f=p.value;if(!f||typeof f!=="object")continue;if(f._zod)o(f);else if(Array.isArray(f))for(let m of f)o(m)}}return t.delete(e),Iu(e,i)}function Iu(e,t){if(t!==gt)Ji.set(e,t===Xe);return t}function Ou(e,t){let n=e.buckets.get(t);if(!n)n=new WeakMap,e.buckets.set(t,n);return n}var lt,ut=[],Au={alloc(e,t,n){let r=lt;if(!r)return n;lt=void 0;let i={value:n,issues:null};return r.set(t.value,i),ut.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,r=(i,o)=>{if(o.direction!=="backward"&&Cu(o,i.value))throw new Hi;return n(i,o)};if(e._zod.parse=r,e._zod.run===n)e._zod.run=r})},attach(e){var t;let n,r=!1,i,o;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let a=e._zod.parse,s=(l,u)=>{if(n===void 0){let b=yt(e,new Set,!1);if(b===We){if(e._zod.parse=a,e._zod.run===s)e._zod.run=a;return a(l,u)}if(b===Xe||r)n=!0;else r=!0}let d=l.value;if(!Vi(d))return a(l,u);let p=u[on];if(!p)p={buckets:new WeakMap,backEdges:void 0},u[on]=p;let f;if(i===u)f=o;else f=Ou(p,e),i=u,o=f;let m=f.get(d);if(m){if(l.value=m.value,m.issues){if(m.issues.length)l.issues.push(...Zt(m.issues))}else l.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(m.value);return l}lt=f;let g=ut.length,y=a(l,u);lt=void 0;let T=ut.length>g?ut.pop():void 0;if(y instanceof Promise)return y.then((b)=>{if(T)T.issues=b.issues.length?Zt(b.issues):hr;return b});if(T)T.issues=y.issues.length?Zt(y.issues):hr;return y};if(e._zod.parse=s,e._zod.run===a)e._zod.run=s})}};function xu(){return Au}function Cu(e,t){let n=e[on]?.backEdges;return n!==void 0&&Vi(t)&&n.has(t)}var Nu=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[o]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function i(o,a){if(o==="number"&&typeof a==="number"&&!Number.isFinite(a))return String(a);return r[o]??o}return(o)=>{switch(o.code){case"invalid_type":{let a=i(o.expected),s=qa(o.input),l=i(s,o.input);return`Invalid input: expected ${a}, received ${l}`}case"invalid_value":if(o.values.length===1)return`Invalid input: expected ${vi(o.values[0])}`;return`Invalid option: expected one of ${Jn(o.values,"|")}`;case"too_big":{let a=o.exact?"exactly ":o.inclusive?"<=":"<",s=t(o.origin);if(s)return`Too big: expected ${o.origin??"value"} to have ${a}${o.maximum.toString()} ${s.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${a}${o.maximum.toString()}`}case"too_small":{let a=o.exact?"exactly ":o.inclusive?">=":">",s=t(o.origin);if(s)return`Too small: expected ${o.origin} to have ${a}${o.minimum.toString()} ${s.unit}`;return`Too small: expected ${o.origin} to be ${a}${o.minimum.toString()}`}case"invalid_format":{let a=o;if(a.format==="starts_with")return`Invalid string: must start with "${a.prefix}"`;if(a.format==="ends_with")return`Invalid string: must end with "${a.suffix}"`;if(a.format==="includes")return`Invalid string: must include "${a.includes}"`;if(a.format==="regex")return`Invalid string: must match pattern ${a.pattern}`;return`Invalid ${n[a.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${Jn(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":if(o.options&&Array.isArray(o.options)&&o.options.length>0)return`Invalid discriminator value. Expected ${o.options.map((a)=>`'${a}'`).join(" | ")}`;if(o.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Pu(){return{localeError:Nu()}}var gr;class Wi{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==="object"&&"id"in n)this._idmap.set(n.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Ru(){return new Wi}(gr=globalThis).__zod_globalRegistry??(gr.__zod_globalRegistry=Ru());var Ke=globalThis.__zod_globalRegistry;function Ki(e){if(e.checks)e.checks=[...e.checks];return e}function zu(e,t){return new e(Ki({type:"string",...w(t)}))}function $u(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...w(t)})}function Lu(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...w(t)})}function Mu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...w(t)})}function Du(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...w(t)})}function Uu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...w(t)})}function ju(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...w(t)})}function Bu(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...w(t)})}function Fu(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}function qu(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...w(t)})}function Wu(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...w(t)})}function Gu(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}function ec(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...w(t)})}function tc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...w(t)})}function nc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...w(t)})}function rc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...w(t)})}function ic(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...w(t)})}function oc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...w(t)})}function ac(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...w(t)})}function sc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...w(t)})}function lc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...w(t)})}function uc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...w(t)})}function cc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...w(t)})}function pc(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...w(t)})}function fc(e,t){return new e({type:"string",format:"date",check:"string_format",...w(t)})}function mc(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...w(t)})}function hc(e,t){return new e({type:"string",format:"duration",check:"string_format",...w(t)})}function gc(e,t){return new e(Ki({type:"number",checks:[],...w(t)}))}function yc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...w(t)})}function vc(e,t){return new e({type:"boolean",...w(t)})}function _c(e){return new e({type:"unknown"})}function bc(e,t){return new e({type:"never",...w(t)})}function wc(e,t){return new e({type:"void",...w(t)})}function kc(e,t){return new e({type:"date",...w(t)})}function yr(e,t){return new Oi({check:"less_than",...w(t),value:e,inclusive:!1})}function vt(e,t){return new Oi({check:"less_than",...w(t),value:e,inclusive:!0})}function vr(e,t){return new Ai({check:"greater_than",...w(t),value:e,inclusive:!1})}function _t(e,t){return new Ai({check:"greater_than",...w(t),value:e,inclusive:!0})}function _r(e,t){return new tl({check:"multiple_of",...w(t),value:e})}function Gi(e,t){return new ol({check:"max_length",...w(t),maximum:e})}function Tt(e,t){return new sl({check:"min_length",...w(t),minimum:e})}function Yi(e,t){return new ll({check:"length_equals",...w(t),length:e})}function Ec(e,t){return new ul({check:"string_format",format:"regex",...w(t),pattern:e})}function Tc(e){return new cl({check:"string_format",format:"lowercase",...w(e)})}function Sc(e){return new dl({check:"string_format",format:"uppercase",...w(e)})}function Ic(e,t){return new pl({check:"string_format",format:"includes",...w(t),includes:e})}function Oc(e,t){return new fl({check:"string_format",format:"starts_with",...w(t),prefix:e})}function Ac(e,t){return new ml({check:"string_format",format:"ends_with",...w(t),suffix:e})}function je(e){return new hl({check:"overwrite",tx:e})}function xc(e){return je((t)=>t.normalize(e))}function Cc(){return je((e)=>e.trim())}function Nc(){return je((e)=>e.toLowerCase())}function Pc(){return je((e)=>e.toUpperCase())}function Rc(){return je((e)=>Pa(e))}function zc(e,t,n){return new e({type:"array",element:t,...w(n)})}function $c(e,t,n){let r=w(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function Lc(e,t,n){return new e({type:"custom",check:"custom",fn:t,...w(n)})}function Mc(e,t){let n=Dc((r)=>(r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(nt(i,r.value,n._zod.def));else{let o=i;if(o.fatal)o.continue=!1;if(o.code??(o.code="custom"),!("input"in o))o.input=r.value;o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),r.issues.push(nt(o))}},e(r.value,r)),t);return n}function Dc(e,t){let n=new G({check:"custom",...w(t)});return n._zod.check=e,n}function Qe(e,...t){for(let n of t)for(let r of Reflect.ownKeys(n))if(Object.prototype.propertyIsEnumerable.call(n,r))ae(e,r,n[r]);return e}function St(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Ke,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function J(e,t,n,r,i){let o=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(o==="any")return!1;if(o===void 0||o==="throw")throw Error(i);return Object.assign(n,o),!0}function M(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,o=t.seen.get(e);if(o){if(o.count++,n.schemaPath.includes(e))o.cycle=n.path;return o.schema}let a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let u={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,u);else{let p=a.schema,f=t.processors[i.type];if(!f)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);f(e,t,p,u)}let d=e._zod.parent;if(d){if(!a.ref)a.ref=d;M(d,t,u),t.seen.get(d).isParent=!0}}let l=t.metadataRegistry.get(e);if(l)Qe(a.schema,l);if(t.io==="input"&&W(e))delete a.schema.examples,delete a.schema.default;if(t.io==="input"&&"_prefault"in a.schema)(r=a.schema).default??(r.default=a.schema._prefault);return delete a.schema._prefault,t.seen.get(e).schema}function br(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function It(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let l=r.get(s);if(l&&l!==a[0])throw Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(s,a[0])}}let i=(a)=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(a[0])?.id,f=e.external.uri??((g)=>g);if(p)return{ref:f(p)};let m=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=m,{defId:m,ref:`${f("__shared")}#/${s}/${br(m)}`}}let l="#",u=`${l}/${s}/`;if(a[1]===n&&!a[1].schema.id)return{ref:l};let d=a[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+br(d)}},o=(a)=>{if(a[1].schema.$ref)return;let s=a[1],{ref:l,defId:u}=i(a);if(s.def={...s.schema},u)s.defId=u;let d=s.schema;for(let p in d)delete d[p];d.$ref=l};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
57
+
58
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){o(a);continue}if(e.external){let l=e.external.registry.get(a[0])?.id;if(t!==a[0]&&l){o(a);continue}}if(e.metadataRegistry.get(a[0])?.id){o(a);continue}if(s.cycle){o(a);continue}if(s.count>1){if(e.reused==="ref")o(a)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Xi(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let r of t){if(!r||typeof r!=="object")return;Xi(r);let i=Object.keys(r);if(i.length!==1||i[0]!=="type")return;let o=r.type;for(let a of Array.isArray(o)?o:[o]){if(typeof a!=="string")return;if(!n.includes(a))n.push(a)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Qi=new Set(["type","properties","required","additionalProperties"]),wr=["oneOf","anyOf"];function kr(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function an(e){let t=[];for(let o of e){if(typeof o!=="object"||o.type!=="object")return null;for(let a in o)if(!Qi.has(a))return null;t.push(o)}let n={},r=new Set;for(let o of t){for(let a in o.properties){if(Object.prototype.hasOwnProperty.call(n,a))continue;let s=[];for(let u of t){let d=u.properties?.[a]??kr(u);if(d===null||d===void 0)continue;if(!s.some((p)=>JSON.stringify(p)===JSON.stringify(d)))s.push(d)}let l=s.length===1?s[0]:an(s)??{allOf:s};ae(n,a,l)}for(let a of o.required??[])r.add(a)}let i={type:"object",properties:n};if(r.size)i.required=[...r];if(t.every((o)=>o.additionalProperties===!1))i.additionalProperties=!1;else{let o=[];for(let a of t){let s=kr(a);if(s&&!o.some((l)=>JSON.stringify(l)===JSON.stringify(s)))o.push(s)}if(o.length===1)i.additionalProperties=o[0];else if(o.length>1)i.additionalProperties={allOf:o}}return i}function Uc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let i of Qi)if(i in e)return;let n=t.filter((i)=>wr.some((o)=>Array.isArray(i[o]))),r=null;if(!n.length)r=an(t);else{let i=n[0],o=wr.find((l)=>Array.isArray(i[l]));if(Object.keys(i).length!==1)return;let a=t.filter((l)=>l!==i),s=i[o].map((l)=>an([...a,l]));if(s.some((l)=>!l))return;r={[o]:s}}if(!r)return;delete e.allOf,Qe(e,r)}function Ot(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(s)=>{let l=e.seen.get(s);if(l.ref===null)return;let u=l.def??l.schema,d={...u},p=l.ref;if(l.ref=null,p){r(p);let m=e.seen.get(p),g=m.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(g);else Qe(u,g);if(Qe(u,d),s._zod.parent===p)for(let y in u){if(y==="$ref"||y==="allOf")continue;if(!(y in d))delete u[y]}if(g.$ref&&m.def)for(let y in u){if(y==="$ref"||y==="allOf")continue;if(y in m.def&&JSON.stringify(u[y])===JSON.stringify(m.def[y]))delete u[y]}}let f=s._zod.parent;if(f&&f!==p){r(f);let m=e.seen.get(f);if(m?.schema.$ref){if(u.$ref=m.schema.$ref,m.def)for(let g in u){if(g==="$ref"||g==="allOf")continue;if(g in m.def&&JSON.stringify(u[g])===JSON.stringify(m.def[g]))delete u[g]}}}e.override({zodSchema:s,jsonSchema:u,path:l.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let s of[...e.seen.entries()].reverse())r(s[0]);if(e.target!=="openapi-3.0")for(let s of e.seen.entries())Xi(s[1].def??s[1].schema);for(let s of e.deferred)s();if(e.intersections.length){let s=new Map;for(let l of e.seen.values())for(let u of[l.schema,l.def]){let d=u?.allOf;if(!Array.isArray(d))continue;let p=s.get(d);if(p)p.push(u);else s.set(d,[u])}for(let l of e.intersections)for(let u of s.get(l)??[])Uc(u)}}let i={};if(e.target==="draft-2020-12")i.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")i.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")i.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(s)}Qe(i,n.defId?n.schema:n.def??n.schema);let o=e.metadataRegistry.get(t)?.id;if(o!==void 0&&i.id===o)delete i.id;let a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let s of e.seen.entries()){let l=s[1];if(l.def&&l.defId){if(l.def.id===l.defId)delete l.def.id;ae(a,l.defId,l.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(a).length>0)if(e.target==="draft-2020-12")i.$defs=a;else i.definitions=a;try{let s=JSON.parse(JSON.stringify(i));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:At(t,"input",e.processors),output:At(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch(s){throw Error("Error converting schema to JSON.")}}function W(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return W(r.element,n);if(r.type==="set")return W(r.valueType,n);if(r.type==="lazy")return W(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return W(r.innerType,n);if(r.type==="intersection")return W(r.left,n)||W(r.right,n);if(r.type==="record"||r.type==="map")return W(r.keyType,n)||W(r.valueType,n);if(r.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return W(r.in,n)||W(r.out,n)}if(r.type==="object"){for(let i in r.shape)if(W(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(let i of r.options)if(W(i,n))return!0;return!1}if(r.type==="tuple"){for(let i of r.items)if(W(i,n))return!0;if(r.rest&&W(r.rest,n))return!0;return!1}return!1}var jc=(e,t={})=>(n)=>{let r=St({...n,processors:t});return M(e,r),It(r,e),Ot(r,e)},At=(e,t,n={})=>(r)=>{let{libraryOptions:i,target:o}=r??{},a=St({...i??{},target:o,io:t,processors:n});return M(e,a),It(a,e),Ot(a,e)},De=(e,t,n)=>{if(e[t]===void 0||n>e[t])e[t]=n},Ue=(e,t,n)=>{if(e[t]===void 0||n<e[t])e[t]=n},Er=(e,t)=>{De(e,"minimum",t),Ue(e,"maximum",t)},eo=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},to=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},no=(e,t)=>{e.mime=e.mime?e.mime.filter((n)=>t.includes(n)):[...t]},ro=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Tr=(e,t)=>De(e,"minimum",t.minimum),Sr=(e,t)=>Ue(e,"maximum",t.maximum),Ir=(e)=>(t,n)=>{ro(t,n.format);let[r,i]=e[n.format];De(t,"minimum",r),Ue(t,"maximum",i)},Bc={greater_than:(e,t)=>De(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Ue(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>eo(e,t.value),number_format:Ir(_i),bigint_format:Ir(La),min_length:Tr,max_length:Sr,length_equals:(e,t)=>Er(e,t.length),min_size:Tr,max_size:Sr,size_equals:(e,t)=>Er(e,t.size),string_format:(e,t)=>{if(ro(e,t.format),t.pattern)to(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>no(e,t.mime)};function K(e){let t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let o of r)Bc[o._zod.def.check]?.(t,o._zod.def);let i=e._zod.bag;if(i.minimum!==void 0)De(t,"minimum",i.minimum);if(i.exclusiveMinimum!==void 0)De(t,"exclusiveMinimum",i.exclusiveMinimum);if(i.maximum!==void 0)Ue(t,"maximum",i.maximum);if(i.exclusiveMaximum!==void 0)Ue(t,"exclusiveMaximum",i.exclusiveMaximum);if(i.multipleOf!==void 0)eo(t,i.multipleOf);if(i.format!==void 0){if(t.format??(t.format=i.format),i.format.includes("int"))t.isInt=!0}if(i.mime)no(t,i.mime);for(let o of i.patterns??[])to(t,o);return t}var Fc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Zc=new Map([[Li,Fs],[$n,Zs]]),io=(e)=>Zc.get(e)??e,oo=(e,t,n,r)=>{let i=n;i.type="string";let{minimum:o,maximum:a,format:s,patterns:l,contentEncoding:u,laxFormat:d}=K(e);if(typeof o==="number")i.minLength=o;if(typeof a==="number")i.maxLength=a;if(s){if(i.format=Fc[s]??s,i.format==="")delete i.format;if(s==="time"||d)delete i.format}if(u)i.contentEncoding=u;if(l&&l.size>0){let p=[...l].map(io);if(p.length===1)i.pattern=p[0].source;else if(p.length>1)i.allOf=[...p.map((f)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))]}},ao=(e,t,n,r)=>{let i=n,{minimum:o,maximum:a,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:u,isInt:d}=K(e);i.type=d?"integer":"number";let p=typeof u==="number"&&u>=(o??Number.NEGATIVE_INFINITY),f=typeof l==="number"&&l<=(a??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(p)if(m)i.minimum=u,i.exclusiveMinimum=!0;else i.exclusiveMinimum=u;else if(typeof o==="number")i.minimum=o;if(f)if(m)i.maximum=l,i.exclusiveMaximum=!0;else i.exclusiveMaximum=l;else if(typeof a==="number")i.maximum=a;if(s){let g=new Set;for(let b of s)if(Number.isFinite(b)&&b!==0)g.add(Math.abs(b));else J(e,t,i,r,`A multipleOf divisor of ${b} cannot be represented in JSON Schema`);let[y,...T]=g;if(y!==void 0)i.multipleOf=y;if(T.length)i.allOf=[...i.allOf??[],...T.map((b)=>({multipleOf:b}))]}},so=(e,t,n,r)=>{n.type="boolean"},Hc=(e,t,n,r)=>{J(e,t,n,r,"BigInt cannot be represented in JSON Schema")},qc=(e,t,n,r)=>{J(e,t,n,r,"Symbols cannot be represented in JSON Schema")},Vc=(e,t,n,r)=>{if(t.target==="openapi-3.0")n.type="string",n.nullable=!0,n.enum=[null];else n.type="null"},Jc=(e,t,n,r)=>{J(e,t,n,r,"Undefined cannot be represented in JSON Schema")},lo=(e,t,n,r)=>{J(e,t,n,r,"Void cannot be represented in JSON Schema")},uo=(e,t,n,r)=>{n.not={}},Wc=(e,t,n,r)=>{},co=(e,t,n,r)=>{},po=(e,t,n,r)=>{J(e,t,n,r,"Date cannot be represented in JSON Schema")},fo=(e,t,n,r)=>{let i=e._zod.def,o=Qt(i.entries);if(o.length===0){n.not={};return}if(o.every((a)=>typeof a==="number"))n.type="number";if(o.every((a)=>typeof a==="string"))n.type="string";n.enum=o},mo=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let o=[];for(let a of i.values)if(a===void 0){if(J(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof a==="bigint"){if(J(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(a))}else o.push(a);if(o.length===0);else if(o.length===1){let a=o[0];if(n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0")n.enum=[a];else n.const=a}else{if(o.every((a)=>typeof a==="number"))n.type="number";if(o.every((a)=>typeof a==="string"))n.type="string";if(o.every((a)=>typeof a==="boolean"))n.type="boolean";if(o.every((a)=>a===null))n.type="null";n.enum=o}},Kc=(e,t,n,r)=>{J(e,t,n,r,"NaN cannot be represented in JSON Schema")},Gc=(e,t,n,r)=>{let i=n,o=e._zod.pattern;if(!o)throw Error("Pattern not found in template literal");i.type="string",i.pattern=o.source},Yc=(e,t,n,r)=>{let i=n;i.type="string",i.format="binary",i.contentEncoding="binary";let{minimum:o,maximum:a,mime:s}=K(e);if(o!==void 0)i.minLength=o;if(a!==void 0)i.maxLength=a;if(!s)return;if(s.length===0)i.not={};else if(s.length===1)i.contentMediaType=s[0];else i.anyOf=s.map((l)=>({contentMediaType:l}))},Xc=(e,t,n,r)=>{n.type="boolean"},ho=(e,t,n,r)=>{J(e,t,n,r,"Custom types cannot be represented in JSON Schema")},go=(e,t,n,r)=>{J(e,t,n,r,"Function types cannot be represented in JSON Schema")},yo=(e,t,n,r)=>{J(e,t,n,r,"Transforms cannot be represented in JSON Schema")},Qc=(e,t,n,r)=>{J(e,t,n,r,"Map cannot be represented in JSON Schema")},ed=(e,t,n,r)=>{J(e,t,n,r,"Set cannot be represented in JSON Schema")},vo=(e,t,n,r)=>{let i=n,o=e._zod.def,{minimum:a,maximum:s}=K(e);if(typeof a==="number")i.minItems=a;if(typeof s==="number")i.maxItems=s;i.type="array",i.items=M(o.element,t,{...r,path:[...r.path,"items"]})};function rt(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return rt(t.out);if(t.type==="catch")return rt(t.innerType);return e._zod.optin}var _o=(e,t,n,r)=>{let i=n,o=e._zod.def,a=o.shape;if(Object.getOwnPropertySymbols(a).length&&J(e,t,i,r,"Symbol keys cannot be represented in JSON Schema"))return;i.type="object",i.properties={};for(let l in a)ae(i.properties,l,M(a[l],t,{...r,path:[...r.path,"properties",l]}));let s=[];for(let l of Object.keys(a)){let u=o.shape[l];if(t.io==="input"?rt(u)===void 0:u._zod.optout===void 0)s.push(l)}if(s.length>0)i.required=s;if(o.catchall?._zod.def.type==="never")i.additionalProperties=!1;else if(!o.catchall){if(t.io==="output")i.additionalProperties=!1}else if(o.catchall)i.additionalProperties=M(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})},bo=(e,t,n,r)=>{let i=e._zod.def,o=i.inclusive===!1,a=i.options.map((s,l)=>M(s,t,{...r,path:[...r.path,o?"oneOf":"anyOf",l]}));if(o)n.oneOf=a;else n.anyOf=a},wo=(e,t,n,r)=>{let i=e._zod.def,o=M(i.left,t,{...r,path:[...r.path,"allOf",0]}),a=M(i.right,t,{...r,path:[...r.path,"allOf",1]}),s=(u)=>("allOf"in u)&&Object.keys(u).length===1,l=[...s(o)?o.allOf:[o],...s(a)?a.allOf:[a]];n.allOf=l,t.intersections.push(l)},ko=(e,t,n,r)=>{let i=n,o=e._zod.def;i.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",l=o.items.map((y,T)=>M(y,t,{...r,path:[...r.path,a,T]})),u=o.rest?M(o.rest,t,{...r,path:[...r.path,s,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null,d=o.items.length;while(d>0){let y=o.items[d-1];if(!(t.io==="input"?rt(y)!==void 0:y._zod.optout==="optional"))break;d--}let p=o.items.length,f=!o.rest;if(t.target==="draft-2020-12"){if(i.prefixItems=l,f)i.items=!1;else if(u)i.items=u;if(d>0)i.minItems=d;if(f)i.maxItems=p}else if(t.target==="openapi-3.0"){if(i.items={anyOf:l},u)i.items.anyOf.push(u);if(d>0)i.minItems=d;if(f)i.maxItems=p}else{if(i.items=l,f)i.additionalItems=!1;else if(u)i.additionalItems=u;if(d>0)i.minItems=d;if(f)i.maxItems=p}let{minimum:m,maximum:g}=K(e);if(typeof m==="number")i.minItems=m;if(typeof g==="number")i.maxItems=g};function sn(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let g=e.get(t)?.def;if(!g)return t;let y=sn(e,g,n);return y===g?t:y}for(let g of["anyOf","oneOf"]){let y=t[g];if(!Array.isArray(y))continue;let T=y.map((b)=>sn(e,b,n));if(T.some((b,D)=>b!==y[D]))t={...t,[g]:T}}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes("string")&&r.some((g)=>g==="number"||g==="integer"),o=t.enum??(t.const!==void 0?[t.const]:void 0);if(!i&&!o?.some((g)=>typeof g==="number"))return t;let{minimum:a,maximum:s,exclusiveMinimum:l,exclusiveMaximum:u,multipleOf:d,format:p,id:f,...m}=t;if(m.enum)m.enum=m.enum.map((g)=>typeof g==="number"?String(g):g);else if(typeof m.const==="number")m.const=String(m.const);if(!i)return m;if(m.type="string",!o)m.pattern=(r.includes("number")?Nn:Ys).source;return m}var ln=new WeakMap;function td(e){let t=new Map;for(let r of e.seen.values())if(r.def&&!t.has(r.schema))t.set(r.schema,r);let n=new Map;for(let r of ln.get(e)??[]){let i=e.seen.get(r),o=(i?.def??i?.schema)?.propertyNames;if(!o||o===!0||n.has(o))continue;let a=sn(t,o,new Set);if(a!==o)n.set(o,a)}if(!n.size)return;for(let r of e.seen.values())for(let i of[r.schema,r.def]){let o=i&&n.get(i.propertyNames);if(o)i.propertyNames=o}}var Eo=(e,t,n,r)=>{let i=n,o=e._zod.def;i.type="object";let a=o.keyType,s=K(a).patterns;if(o.mode==="loose"&&s&&s.size>0){let d=M(o.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(let p of s)ae(i.patternProperties,io(p).source,d)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){i.propertyNames=M(o.keyType,t,{...r,path:[...r.path,"propertyNames"]});let d=ln.get(t);if(!d)d=[],ln.set(t,d),t.deferred.push(()=>td(t));d.push(e)}i.additionalProperties=M(o.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let l=a._zod.values,u=t.io==="input"&&rt(o.valueType)!==void 0;if(l&&!o.partial&&!u){let d=[...l].filter((p)=>typeof p==="string"||typeof p==="number");if(d.length>0)i.required=d.map(String)}},To=(e,t,n,r)=>{let i=e._zod.def,o=M(i.innerType,t,r),a=t.seen.get(e);if(t.target==="openapi-3.0")a.ref=i.innerType,n.nullable=!0;else n.anyOf=[o,{type:"null"}]},So=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let o=t.seen.get(e);o.ref=i.innerType},Ln=Symbol();function Io(e,t,n,r,i){let o=!1,a=JSON.stringify(e,(s,l)=>{if(typeof l!=="bigint")return l;return o=!0,null});if(!o)return JSON.parse(a);return J(t,n,r,i,"BigInt defaults cannot be represented in JSON Schema"),Ln}var Oo=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let o=t.seen.get(e);o.ref=i.innerType;let a=Io(i.defaultValue,e,t,n,r);if(a!==Ln)n.default=a},Ao=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let o=t.seen.get(e);if(o.ref=i.innerType,t.io!=="input")return;let a=Io(i.defaultValue,e,t,n,r);if(a!==Ln)n._prefault=a},xo=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let o=t.seen.get(e);o.ref=i.innerType;let a;try{a=i.catchValue(void 0)}catch{J(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=a},Co=(e,t,n,r)=>{let i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?o?i.out:i.in:i.out;M(a,t,r);let s=t.seen.get(e);s.ref=a},No=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let o=t.seen.get(e);o.ref=i.innerType,n.readOnly=!0},Po=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let o=t.seen.get(e);o.ref=i.innerType},Mn=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let o=t.seen.get(e);o.ref=i.innerType},nd=(e,t,n,r)=>{let i=e._zod.innerType;M(i,t,r);let o=t.seen.get(e);o.ref=i},Or={string:oo,number:ao,boolean:so,bigint:Hc,symbol:qc,null:Vc,undefined:Jc,void:lo,never:uo,any:Wc,unknown:co,date:po,enum:fo,literal:mo,nan:Kc,template_literal:Gc,file:Yc,success:Xc,custom:ho,function:go,transform:yo,map:Qc,set:ed,array:vo,object:_o,union:bo,intersection:wo,tuple:ko,record:Eo,nullable:To,nonoptional:So,default:Oo,prefault:Ao,catch:xo,pipe:Co,readonly:No,promise:Po,optional:Mn,lazy:nd};function rd(e,t){if("_idmap"in e){let r=e,i=St({...t,processors:Or}),o={};for(let l of r._idmap.entries()){let[u,d]=l;M(d,i)}let a={},s={registry:r,uri:t?.uri,defs:o};i.external=s;for(let l of r._idmap.entries()){let[u,d]=l;It(i,d),ae(a,u,Ot(i,d))}if(Object.keys(o).length>0){let l=i.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[l]:o}}return{schemas:a}}let n=St({...t,processors:Or});return M(e,n),It(n,e),Ot(n,e)}var Ar=new WeakSet([Object.prototype,Error.prototype]);function ct(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}var id=(e,t)=>{rs.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);if(Ar.has(n))return;Ar.add(n),ct(n,"format",(r)=>(i)=>as(r,i)),ct(n,"flatten",(r)=>(i)=>os(r,i)),ct(n,"addIssue",(r)=>(i)=>{r.issues.push(i),r.message=JSON.stringify(r.issues,en,2)}),ct(n,"addIssues",(r)=>(i)=>{r.issues.push(...i),r.message=JSON.stringify(r.issues,en,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})},ee=h("ZodError",id,void 0,{Parent:Error}),od=zt(ee),ad=$t(ee),sd=xn(ee),ld=Cn(ee),ud=vs(ee),cd=_s(ee),dd=bs(ee),pd=ws(ee),fd=ks(ee),md=Es(ee),hd=Ts(ee),gd=Ss(ee);function yd(){if(!Q.localeError)oe(Pu())}function it(){if(!Q.memoizer)oe({memoizer:xu()})}var z=h("ZodType",(e,t)=>(yd(),R.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Y(t,{checks:[...t.checks??[],...e.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return we(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(wp(e,t))},superRefine(e,t){return this.check(kp(e,t))},overwrite(e){return this.check(je(e))},optional(){return Nr(this)},exactOptional(){return sp(this)},nullable(){return Pr(this)},nullish(){return Nr(Pr(this))},nonoptional(e){return fp(this,e)},array(){return I(this)},or(e){return Ne([this,e])},and(e){return Qd(this,e)},transform(e){return Rr(this,Lo(e))},default(e){return cp(this,e)},prefault(e){return pp(this,e)},catch(e){return hp(this,e)},pipe(e){return Rr(this,e)},readonly(){return vp(this)},describe(e){let t=this.clone();return Ke.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ke.get(this);let t=this.clone();return Ke.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return ki(this,"~standard",{...Ni(this),jsonSchema:{input:At(this,"input"),output:At(this,"output")}})},set "~standard"(e){be(this,"~standard",e)},parse:function e(t,n){return od(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await ad(this,t,n,{callee:e})},safeParse(e,t){return sd(this,e,t)},async safeParseAsync(e,t){return ld(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){be(this,"spa",e)},validate(e,t){return hs(this,e,t)},validateAsync(e,t){return ys(this,e,t)},encode:function e(t,n){return ud(this,t,n,{callee:e})},decode:function e(t,n){return cd(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await dd(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await pd(this,t,n,{callee:e})},safeEncode(e,t){return fd(this,e,t)},safeDecode(e,t){return md(this,e,t)},async safeEncodeAsync(e,t){return hd(this,e,t)},async safeDecodeAsync(e,t){return gd(this,e,t)},toJSONSchema(e){return jc(this,{})(e)},get description(){return Ke.get(this)?.description},get _def(){return this._zod.def}}),Ro=h("_ZodString",(e,t)=>{zn.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>oo(e,n,r,i)},On({format:(e)=>K(e).format??null,minLength:(e)=>K(e).minimum??null,maxLength:(e)=>K(e).maximum??null},{regex(...e){return this.check(Ec(...e))},includes(...e){return this.check(Ic(...e))},startsWith(...e){return this.check(Oc(...e))},endsWith(...e){return this.check(Ac(...e))},min(...e){return this.check(Tt(...e))},max(...e){return this.check(Gi(...e))},length(...e){return this.check(Yi(...e))},nonempty(...e){return this.check(Tt(1,...e))},lowercase(e){return this.check(Tc(e))},uppercase(e){return this.check(Sc(e))},trim(){return this.check(Cc())},normalize(...e){return this.check(xc(...e))},toLowerCase(){return this.check(Nc())},toUpperCase(){return this.check(Pc())},slugify(){return this.check(Rc())}})),vd=h("ZodString",(e,t)=>{zn.init(e,t),Ro.init(e,t)},{email(e){return this.check($u(Ed,e))},url(e){return this.check(Bu(Sd,e))},jwt(e){return this.check(cc(jd,e))},emoji(e){return this.check(Fu(Id,e))},guid(e){return this.check(Lu(Td,e))},uuid(e){return this.check(Mu(dt,e))},uuidv4(e){return this.check(Du(dt,e))},uuidv6(e){return this.check(Uu(dt,e))},uuidv7(e){return this.check(ju(dt,e))},nanoid(e){return this.check(qu(Od,e))},cuid(e){return this.check(Wu(Ad,e))},cuid2(e){return this.check(Gu(xd,e))},ulid(e){return this.check(ec(Cd,e))},base64(e){return this.check(sc(Md,e))},base64url(e){return this.check(lc(Dd,e))},xid(e){return this.check(tc(Nd,e))},ksuid(e){return this.check(nc(Pd,e))},ipv4(e){return this.check(rc(Rd,e))},ipv6(e){return this.check(ic(zd,e))},cidrv4(e){return this.check(oc($d,e))},cidrv6(e){return this.check(ac(Ld,e))},e164(e){return this.check(uc(Ud,e))},datetime(e){return this.check(pc(_d,e))},date(e){return this.check(fc(bd,e))},time(e){return this.check(mc(wd,e))},duration(e){return this.check(hc(kd,e))}});function c(e){return zu(vd,e)}var B=h("ZodStringFormat",(e,t)=>{j.init(e,t),Ro.init(e,t)}),_d=h("ZodISODateTime",(e,t)=>{zl.init(e,t),B.init(e,t)}),bd=h("ZodISODate",(e,t)=>{$l.init(e,t),B.init(e,t)}),wd=h("ZodISOTime",(e,t)=>{Ll.init(e,t),B.init(e,t)}),kd=h("ZodISODuration",(e,t)=>{Ml.init(e,t),B.init(e,t)}),Ed=h("ZodEmail",(e,t)=>{bl.init(e,t),B.init(e,t)}),Td=h("ZodGUID",(e,t)=>{vl.init(e,t),B.init(e,t)}),dt=h("ZodUUID",(e,t)=>{_l.init(e,t),B.init(e,t)}),Sd=h("ZodURL",(e,t)=>{Il.init(e,t),B.init(e,t)}),Id=h("ZodEmoji",(e,t)=>{Ol.init(e,t),B.init(e,t)}),Od=h("ZodNanoID",(e,t)=>{Al.init(e,t),B.init(e,t)}),Ad=h("ZodCUID",(e,t)=>{xl.init(e,t),B.init(e,t)}),xd=h("ZodCUID2",(e,t)=>{Cl.init(e,t),B.init(e,t)}),Cd=h("ZodULID",(e,t)=>{Nl.init(e,t),B.init(e,t)}),Nd=h("ZodXID",(e,t)=>{Pl.init(e,t),B.init(e,t)}),Pd=h("ZodKSUID",(e,t)=>{Rl.init(e,t),B.init(e,t)}),Rd=h("ZodIPv4",(e,t)=>{Dl.init(e,t),B.init(e,t)}),zd=h("ZodIPv6",(e,t)=>{jl.init(e,t),B.init(e,t)}),$d=h("ZodCIDRv4",(e,t)=>{Bl.init(e,t),B.init(e,t)}),Ld=h("ZodCIDRv6",(e,t)=>{Zl.init(e,t),B.init(e,t)}),Md=h("ZodBase64",(e,t)=>{Hl.init(e,t),B.init(e,t)}),Dd=h("ZodBase64URL",(e,t)=>{Vl.init(e,t),B.init(e,t)}),Ud=h("ZodE164",(e,t)=>{Jl.init(e,t),B.init(e,t)}),jd=h("ZodJWT",(e,t)=>{Kl.init(e,t),B.init(e,t)}),zo=h("ZodNumber",(e,t)=>{Mi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ao(e,n,r,i),e.isFinite=!0},On({minValue:(e)=>{let{minimum:t,exclusiveMinimum:n}=K(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:n}=K(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:n}=K(e);return!!t||!!n?.some(Number.isSafeInteger)},format:(e)=>K(e).format??null},{gt(e,t){return this.check(vr(e,t))},gte(e,t){return this.check(_t(e,t))},min(e,t){return this.check(_t(e,t))},lt(e,t){return this.check(yr(e,t))},lte(e,t){return this.check(vt(e,t))},max(e,t){return this.check(vt(e,t))},int(e){return this.check(xr(e))},safe(e){return this.check(xr(e))},positive(e){return this.check(vr(0,e))},nonnegative(e){return this.check(_t(0,e))},negative(e){return this.check(yr(0,e))},nonpositive(e){return this.check(vt(0,e))},multipleOf(e,t){return this.check(_r(e,t))},step(e,t){return this.check(_r(e,t))},finite(){return this}}));function _(e){return gc(zo,e)}var Bd=h("ZodNumberFormat",(e,t)=>{Gl.init(e,t),zo.init(e,t)});function xr(e){return yc(Bd,e)}var Fd=h("ZodBoolean",(e,t)=>{Yl.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>so(e,n,r,i)});function A(e){return vc(Fd,e)}var Zd=h("ZodUnknown",(e,t)=>{Xl.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>co(e,n,r,i)});function V(){return _c(Zd)}var Hd=h("ZodNever",(e,t)=>{Ql.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>uo(e,n,r,i)});function qd(e){return bc(Hd,e)}var Vd=h("ZodVoid",(e,t)=>{eu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>lo(e,n,r,i)});function Jd(e){return wc(Vd,e)}var Wd=h("ZodDate",(e,t)=>{tu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>po(e,n,r,i),e.min=(n,r)=>e.check(_t(n,r)),e.max=(n,r)=>e.check(vt(n,r))},On({minDate:(e)=>{let{minimum:t}=K(e);return t?new Date(t):null},maxDate:(e)=>{let{maximum:t}=K(e);return t?new Date(t):null}},{}));function xt(e){return kc(Wd,e)}var Kd=h("ZodArray",(e,t)=>{it(),iu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>vo(e,n,r,i),e.element=t.element},{min(e,t){return this.check(Tt(e,t))},nonempty(e){return this.check(Tt(1,e))},max(e,t){return this.check(Gi(e,t))},length(e,t){return this.check(Yi(e,t))},unwrap(){return this.element}});function I(e,t){return zc(Kd,e,t)}var Gd=h("ZodObject",(e,t)=>{it(),su.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>_o(e,n,r,i),Ga(e,"shape",(n)=>n._zod.def.shape,!1)},{keyof(){return O(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Y(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Y(this._zod.def,{catchall:V()}))},loose(){return this.clone(Y(this._zod.def,{catchall:V()}))},strict(){return this.clone(Y(this._zod.def,{catchall:qd()}))},strip(){return this.clone(Y(this._zod.def,{catchall:void 0}))},extend(e){return Ua(this,e)},safeExtend(e){return ja(this,e)},merge(e){return Ba(this,e)},pick(e){return Ma(this,e)},omit(e){return Da(this,e)},partial(...e){return Wn(Un,this,e[0])},exactPartial(...e){return Wn(Mo,this,e[0],"exactPartial")},required(...e){return Fa(Do,this,e[0])}});function v(e,t){let n={type:"object",shape:e??{},...w(t)};return new Gd(n)}var $o=h("ZodUnion",(e,t)=>{ji.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>bo(e,n,r,i),e.options=t.options});function Ne(e,t){return new $o({type:"union",options:e,...w(t)})}var Yd=h("ZodDiscriminatedUnion",(e,t)=>{$o.init(e,t),uu.init(e,t)});function Dn(e,t,n){return new Yd({type:"union",options:t,discriminator:e,...w(n)})}var Xd=h("ZodIntersection",(e,t)=>{cu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>wo(e,n,r,i)});function Qd(e,t){return new Xd({type:"intersection",left:e,right:t})}var np=h("ZodTuple",(e,t)=>{it(),Bi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ko(e,n,r,i)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((t)=>new Un({type:"optional",innerType:t}))})}});function rp(e,t,n){let r=t instanceof R;return new np({type:"tuple",items:e,rest:r?t:null,...w(r?n:t)})}var Cr=h("ZodRecord",(e,t)=>{it(),du.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Eo(e,n,r,i),e.keyType=t.keyType,e.valueType=t.valueType});function H(e,t,n){if(!t||!t._zod)return new Cr({type:"record",keyType:c(),valueType:e,...w(t)});return new Cr({type:"record",keyType:e,valueType:t,...w(n)})}var un=h("ZodEnum",(e,t)=>{pu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,i,o)=>fo(e,r,i,o),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(r,i)=>{let o={};for(let a of r)if(n.has(a))o[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new un({...t,checks:[],...w(i),entries:o})},e.exclude=(r,i)=>{let o={...t.entries};for(let a of r)if(n.has(a))delete o[a];else throw Error(`Key ${a} not found in enum`);return new un({...t,checks:[],...w(i),entries:o})}});function O(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new un({type:"enum",entries:n,...w(t)})}var op=h("ZodLiteral",(e,t)=>{fu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>mo(e,n,r,i),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Z(e,t){return new op({type:"literal",values:Array.isArray(e)?e:[e],...w(t)})}var ap=h("ZodTransform",(e,t)=>{it(),mu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>yo(e,n,r,i),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new An(e.constructor.name);n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(nt(o,n.value,t));else{let a=o;if(a.fatal)a.continue=!1;if(a.code??(a.code="custom"),!("input"in a))a.input=n.value;a.inst??(a.inst=e),n.issues.push(nt(a))}};let i=t.transform(n.value,n);if(i instanceof Promise)return i.then((o)=>(n.value=o,n));return n.value=i,n}});function Lo(e){return new ap({type:"transform",transform:e})}var Un=h("ZodOptional",(e,t)=>{Fi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Mn(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Nr(e){return new Un({type:"optional",innerType:e})}var Mo=h("ZodExactOptional",(e,t)=>{hu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Mn(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function sp(e){return new Mo({type:"optional",innerType:e})}var lp=h("ZodNullable",(e,t)=>{gu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>To(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Pr(e){return new lp({type:"nullable",innerType:e})}var up=h("ZodDefault",(e,t)=>{yu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Oo(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function cp(e,t){return new up({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():yi(t)}})}var dp=h("ZodPrefault",(e,t)=>{vu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ao(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function pp(e,t){return new dp({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():yi(t)}})}var Do=h("ZodNonOptional",(e,t)=>{_u.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>So(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function fp(e,t){return new Do({type:"nonoptional",innerType:e,...w(t)})}var mp=h("ZodCatch",(e,t)=>{bu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>xo(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function hp(e,t){return new mp({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Xa(t)})}var Uo=h("ZodPipe",(e,t)=>{Zi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Co(e,n,r,i),e.in=t.in,e.out=t.out});function Rr(e,t){return new Uo({type:"pipe",in:e,out:t})}var gp=h("ZodPreprocess",(e,t)=>{Uo.init(e,t),wu.init(e,t)}),yp=h("ZodReadonly",(e,t)=>{ku.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>No(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function vp(e){return new yp({type:"readonly",innerType:e})}var _p=h("ZodPromise",(e,t)=>{Tu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Po(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Ht(e){return new _p({type:"promise",innerType:e})}var bp=h("ZodFunction",(e,t)=>{Eu.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>go(e,n,r,i)});function pt(e){return new bp({type:"function",input:Array.isArray(e?.input)?rp(e?.input):e?.input??I(V()),output:e?.output??V()})}var jo=h("ZodCustom",(e,t)=>{Su.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ho(e,n,r,i)});function X(e,t){return $c(jo,e??(()=>!0),t)}function wp(e,t={}){return Lc(jo,e,t)}function kp(e,t){return Mc(e,t)}function Bo(e,t){return new gp({type:"pipe",in:Lo(e),out:t})}var Vu=["none","minimal","low","medium","high","xhigh","max"],bI=O(Vu),Ku=bI.exclude(["none"]),Ep=O([...Vu,"default"]).nullable(),vI=Dn("type",[v({type:Z("toggle")}).strict(),v({type:Z("effort"),values:I(Ep)}).strict(),v({type:Z("budget_tokens"),min:_().min(-1).optional(),max:_().min(0).optional()}).strict().refine((e)=>e.min===void 0||e.max===void 0||e.min<=e.max,{message:"Minimum reasoning budget cannot exceed maximum",path:["min"]})]),wI=O(["default","openai-responses","r1"]),NS={DEFAULT:"default",OPENAI_RESPONSES:"openai-responses",R1:"r1"},kI=O(["images","video","tools","streaming","prompt-cache","reasoning","reasoning-effort","computer-use","global-endpoint","structured_output","temperature","files"]),TI=O(["active","preview","deprecated","legacy"]),_I=v({input:_().optional(),output:_().optional(),cacheWrite:_().optional(),cacheRead:_().optional()}),II=v({maxBudget:_().optional(),outputPrice:_().optional(),thinkingLevel:O(["low","high"]).optional()}),SI=v({reasoningDefaultOn:A().optional(),apiProtocol:O(["openai-chat","openai-responses","anthropic","gemini"]).optional()}).catchall(V()),Zv=O(["text","image","audio","video","pdf"]),EI=v({input:I(Zv),output:I(Zv)});function RI(e){return(e?.input===void 0||e.input.includes("text"))&&(e?.output===void 0||e.output.includes("text"))}var OI=O(["language","image-generation","speech-generation","video-generation","transcription","realtime"]);function Hu(e){let t=e.modalities?.input,n=e.modalities?.output;return t?.length===1&&t[0]==="audio"&&n?.length===1&&n[0]==="text"}function lf(e){return(e.operation===void 0||e.operation==="language")&&RI(e.modalities)}var AI=O(["batch","streaming"]);function ls(e){return e.modalities?.input.includes("text")===!0&&e.modalities.output.includes("image")}function il(e){return e.operation==="image-generation"}function ew(e,t,n){let r=e.capabilities;if(r===void 0||r.length===0)return n?.assumeWhenUnspecified??!1;return r.includes(t)}function uf(e){return ew(e,"tools",{assumeWhenUnspecified:!0})}function LS(e){return ew(e,"images",{assumeWhenUnspecified:!0})}var tw=v({id:c(),name:c().optional(),description:c().optional(),maxTokens:_().optional(),contextWindow:_().optional(),maxInputTokens:_().optional(),capabilities:I(kI).optional(),operation:OI.optional(),operationModes:I(AI).optional(),modalities:EI.optional(),reasoningOptions:I(vI).optional(),apiFormat:wI.optional(),systemRole:O(["system","developer"]).optional(),temperature:_().optional(),pricing:_I.optional(),thinkingConfig:II.optional(),status:TI.optional(),deprecationNotice:c().optional(),replacedBy:c().optional(),releaseDate:c().optional(),deprecationDate:c().optional(),family:c().optional(),metadata:SI.optional()}),BS="This tool call was rejected by the user and not executed.",pf="NOT a tool or system failure. Clarify with user before proceeding.",CI=v({id:c(),name:c(),execution:O(["client","provider"]).optional(),input:V(),output:V(),error:c().optional(),durationMs:_(),startedAt:xt(),endedAt:xt()}),PI=O(["completed","max_iterations","aborted","mistake_limit","error"]),DI=v({inputTokens:_(),outputTokens:_(),cacheReadTokens:_().optional(),cacheWriteTokens:_().optional(),totalCost:_().optional()}),US=v({text:c(),usage:DI,messages:I(X()),toolCalls:I(CI),iterations:_(),finishReason:PI,model:v({id:c(),provider:c(),info:tw.optional()}),startedAt:xt(),endedAt:xt(),durationMs:_()}),FS=v({distinctId:c().optional(),sessionId:c().optional(),providerId:c(),modelId:c(),apiKey:c().optional(),baseUrl:c().url().optional(),headers:H(c(),c()).optional(),knownModels:H(c(),tw).optional(),providerConfig:V().optional(),initialMessages:I(X()).optional(),systemPrompt:c(),tools:I(X()),modelTools:I(X()).optional(),maxIterations:_().positive().optional(),maxParallelToolCalls:_().int().positive().default(8),maxTokensPerTurn:_().positive().optional(),temperature:_().nonnegative().optional(),apiTimeoutMs:_().positive().default(180000),userFileContentLoader:pt().input([c()]).output(Ht(c())).optional(),toolContextMetadata:H(c(),V()).optional(),execution:v({maxConsecutiveMistakes:_().int().positive().optional(),reminderAfterIterations:_().nonnegative().optional(),reminderText:c().optional(),loopDetection:Ne([Z(!1),v({softThreshold:_().int().positive().optional(),hardThreshold:_().int().positive().optional()})]).optional()}).optional(),reasoningEffort:Ku.optional(),thinkingBudgetTokens:_().positive().optional(),thinking:A().optional(),onEvent:pt().input([X()]).output(Jd()).optional(),hooks:X().optional(),parentAgentId:c().optional(),extensions:I(X()).optional(),hookErrorMode:O(["ignore","throw"]).default("ignore"),toolPolicies:H(c(),v({enabled:A().optional(),autoApprove:A().optional()})).optional(),requestToolApproval:pt().input([v({sessionId:c(),agentId:c(),conversationId:c(),iteration:_(),toolCallId:c(),toolName:c(),input:V(),policy:v({enabled:A().optional(),autoApprove:A().optional()}).default({})})]).output(Ne([v({approved:A(),reason:c().optional()}),Ht(v({approved:A(),reason:c().optional()}))])).optional(),onConsecutiveMistakeLimitReached:pt().input([v({iteration:_().int().positive(),consecutiveMistakes:_().int().positive(),maxConsecutiveMistakes:_().int().positive(),reason:O(["api_error","invalid_tool_call","tool_execution_failed"]),details:c().optional()})]).output(Ne([v({action:Z("continue"),guidance:c().optional()}),v({action:Z("stop"),reason:c().optional()}),Ht(Ne([v({action:Z("continue"),guidance:c().optional()}),v({action:Z("stop"),reason:c().optional()})]))])).optional(),logger:X().optional(),extensionContext:X().optional(),abortSignal:X().optional()}),WI=O(["connector.started","connector.stopping","session.authorize","message.received","message.denied","message.completed","message.failed","session.started","session.reused","session.reset","schedule.delivery.started","schedule.delivery.sent","schedule.delivery.failed"]),MI=v({id:c().optional(),label:c().optional(),role:c().optional(),participantKey:c().optional(),participantLabel:c().optional(),platformUserId:c().optional(),metadata:H(c(),V()).optional()}),NI=v({source:c(),sourceEvent:c(),threadId:c(),channelId:c(),isDM:A(),sessionId:c().optional(),workspaceRoot:c().optional(),metadata:H(c(),V()).optional()}),jS=v({actor:MI,context:NI,payload:H(c(),V()).optional()}),$S=v({action:O(["allow","deny"]).default("allow"),message:c().optional(),reason:c().optional(),metadata:H(c(),V()).optional()}),qS=v({adapter:c(),botUserName:c().optional(),event:WI,payload:H(c(),V()),ts:c()}),LI=[{name:"discord",description:"Discord interactions and gateway bridge backed by RPC runtime sessions"},{name:"gchat",description:"Google Chat webhook bridge backed by RPC runtime sessions"},{name:"linear",description:"Linear webhook bridge backed by RPC runtime sessions"},{name:"slack",description:"Slack webhook/socket bridge backed by RPC runtime sessions"},{name:"telegram",description:"Bridge Telegram bot messages into RPC chat sessions"},{name:"whatsapp",description:"Bridge WhatsApp webhook messages into RPC chat sessions"}];function BI(){return LI.map((e)=>({...e}))}function UI(e,t){let n=e.includeWhen;if(!n)return!0;let r=t[n.flag]??"";if(n.equals!==void 0&&r!==n.equals)return!1;if(n.notEquals!==void 0&&r===n.notEquals)return!1;return!0}function zS(e,t,n){let r={};for(let o of e.fields){let a=t[o.flag];r[o.flag]=typeof a==="string"?a.trim():o.initialValue??""}let i=[];for(let o of e.fields){if(!UI(o,r))continue;let a=r[o.flag]??"";if(!a){if(o.required)throw Error(`${o.label} is required`);continue}i.push(o.flag,a)}if(n?.enabled===!0&&e.security){let o={};for(let a of e.security.fields){let s=n.values[a.key]?.trim();if(!s)throw Error(a.requiredMessage);let l=a.validate?.(s);if(l)throw Error(l);o[a.key]=s}i.push(...e.security.buildArgs(o))}return i}function Tp(e,t){if(t.has(e))return{managed:!0,consumesNext:!0};for(let n of t)if(e.startsWith(`${n}=`))return{managed:!0,consumesNext:!1};return{managed:!1,consumesNext:!1}}function GS(e,t,n,r){let i=new Set([...e.fields.flatMap((a)=>[a.flag,...a.aliases??[]]),...e.derivedReconnectFlags??[]]);if(r.replaceSecurityArgs)for(let a of e.security?.argumentFlags??[])i.add(a);let o=[];for(let a=0;a<t.length;a+=1){let s=t[a]??"",l=Tp(s,i);if(!l.managed){o.push(s);continue}if(l.consumesNext)a+=1}return[...o,...n]}function VS(e=FI){let t=new Set(BI().map((n)=>n.name));return e.filter((n)=>t.has(n.id)).map((n)=>({id:n.id,name:n.name,type:n.type,hint:n.hint,fields:n.fields.map((r)=>({flag:r.flag,label:r.label,placeholder:r.placeholder,required:r.required,help:r.help,initialValue:r.initialValue,options:r.options,includeWhen:r.includeWhen})),security:n.security?{prompt:n.security.prompt,fields:n.security.fields.map((r)=>({key:r.key,label:r.label,placeholder:r.placeholder,help:r.help,requiredMessage:r.requiredMessage}))}:void 0}))}function Sp(e){return/^\d+$/.test(e)?void 0:"Telegram user ID must contain digits only"}function Ip(e){return/^T[A-Z0-9]+$/.test(e)?void 0:"Slack workspace ID must start with T and contain uppercase letters or digits only"}function Op(e){return/^[UW][A-Z0-9]+$/.test(e)?void 0:"Slack member ID must start with U or W and contain uppercase letters or digits only"}var FI=[{id:"telegram",name:"Telegram",type:"polling",hint:"Easiest to set up. No public URL needed.",derivedReconnectFlags:["-m","--bot-username"],fields:[{flag:"-k",aliases:["--bot-token"],label:"Bot token",placeholder:"7123456789:AAH...",required:!0,help:["Open Telegram and start a chat with @BotFather","Send /newbot and follow the prompts","BotFather gives you this after creating the bot","It looks like 7123456789:AAHxxx..."]}],security:{prompt:"By default, anyone who finds your bot can message it and run tasks on your machine. Restrict access to your Telegram user ID?",fields:[{key:"userId",label:"Your Telegram user ID",placeholder:"123456789",help:["Message @userinfobot on Telegram","It will reply with your numeric user ID"],requiredMessage:"User ID is required to restrict access",validate:Sp}],argumentFlags:["--allowed-user-id","--hook-command"],buildArgs:({userId:e})=>["--allowed-user-id",e??""]}},{id:"slack",name:"Slack",type:"hybrid",hint:"Public URL for webhook mode; leave blank for socket mode.",fields:[{flag:"--bot-token",label:"Bot token",placeholder:"xoxb-...",required:!0,help:["Go to api.slack.com/apps and create a new app","Add Bot Token Scopes: chat:write, app_mentions:read, channels:history, channels:read, im:history, im:read, im:write, users:read","Install to workspace and copy the Bot Token"]},{flag:"--base-url",label:"Public base URL",placeholder:"leave blank for socket mode",help:["Enter a publicly accessible URL for webhook mode","Leave blank to use Slack socket mode instead"]},{flag:"--signing-secret",label:"Signing secret",required:!0,help:["Found in your app's Basic Information page"],includeWhen:{flag:"--base-url",notEquals:""}},{flag:"--app-token",label:"App-level token",placeholder:"xapp-...",required:!0,help:["Enable Socket Mode in the Slack app","Generate an app-level token with the connections:write scope"],includeWhen:{flag:"--base-url",equals:""}}],security:{prompt:"Restrict which Slack users can interact with the bot?",fields:[{key:"teamId",label:"Allowed Slack workspace ID",placeholder:"T01ABC123",help:["Open your Slack workspace URL in a browser","The workspace ID is the segment after /client/, for example T01ABC123"],requiredMessage:"Workspace ID is required to restrict access",validate:Ip},{key:"userId",label:"Allowed Slack member ID",placeholder:"U01ABC123",help:["Click a user's name in Slack, then View full profile","Click ... and Copy member ID"],requiredMessage:"Member ID is required to restrict access",validate:Op}],argumentFlags:["--hook-command"],buildArgs:({teamId:e,userId:t})=>["--hook-command",`jq -r ".payload.actor.participantKey" | grep -qx "slack:team:${e}:user:${t}" && echo '{"action":"allow"}' || echo '{"action":"deny"}'`]}},{id:"discord",name:"Discord",type:"webhook",hint:"Requires a Discord app and public URL.",fields:[{flag:"--application-id",aliases:["--app-id"],label:"Application ID",required:!0,help:["Go to discord.com/developers/applications","Create a new app, copy the Application ID"]},{flag:"--bot-token",aliases:["--token"],label:"Bot token",required:!0,help:["Go to Bot section, create a bot, copy the token"]},{flag:"--public-key",label:"Public key",required:!0,help:["Found in General Information of your app"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0,help:["Base URL for the connector","For Discord, set the Interactions Endpoint URL to <base-url>/api/webhooks/discord"]}]},{id:"whatsapp",name:"WhatsApp",type:"webhook",hint:"Requires Meta developer account and public URL.",fields:[{flag:"--phone-number-id",label:"Phone number ID",required:!0,help:["From your WhatsApp Business account in Meta Developer portal"]},{flag:"--access-token",label:"Access token",required:!0,help:["Generate a permanent token in Meta Developer portal"]},{flag:"--app-secret",label:"App secret",required:!0,help:["Found in App Settings > Basic"]},{flag:"--verify-token",label:"Webhook verify token",placeholder:"my-verify-token",required:!0,help:["Any string you choose, used to verify webhook setup"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"gchat",name:"Google Chat",type:"webhook",hint:"Requires Google Cloud project and public URL.",fields:[{flag:"--credentials-json",label:"Service account credentials JSON",required:!0,help:["Create a service account in Google Cloud Console","Download the credentials JSON file","Paste the JSON content here"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"linear",name:"Linear",type:"webhook",hint:"React to Linear issues and comments.",fields:[{flag:"--api-key",label:"API key",required:!0,help:["Go to Linear Settings > API > Personal API keys"]},{flag:"--webhook-secret",label:"Webhook signing secret",required:!0,help:["Go to Settings > API > Webhooks, create one","Copy the signing secret"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]}],Fo=[];function jI(e){Fo.push(e)}async function KS(){let e=Fo.splice(0);await Promise.all(e.map((t)=>{try{return(typeof t==="function"?t():t.dispose())??Promise.resolve()}catch{return Promise.resolve()}}))}var Ap=["hooks","tools","commands","rules","skills","messageBuilders","providers","automationEvents","mcp"],xp=new Set(Ap);function Zo(e,t){return e.name||`extension_${String(t).padStart(4,"0")}`}function zr(e){return Array.isArray(e)&&e.every((t)=>typeof t==="string")}function $r(e){if(!Array.isArray(e))return;let t=e.filter((n)=>typeof n==="string").map((n)=>n.trim()).filter((n)=>n.length>0);return t.length>0?t:void 0}function $I(e){let t=$r(e.providerIds),n=$r(e.modelIds);return{...e,...t?{providerIds:t}:{},...n?{modelIds:n}:{}}}function Cp(e,t){let n=Zo(e,t),r=e.manifest;if(!r||typeof r!=="object")throw Error(`Invalid manifest for extension "${n}": manifest is required`);if(!Array.isArray(r.capabilities)||r.capabilities.length===0)throw Error(`Invalid manifest for extension "${n}": capabilities must be a non-empty array`);let i=new Set;for(let a of r.capabilities){if(!xp.has(a))throw Error(`Invalid manifest for extension "${n}": unsupported capability "${String(a)}"`);i.add(a)}if(Object.hasOwn(r,"providerIds")&&!zr(r.providerIds))throw Error(`Invalid manifest for extension "${n}": providerIds must be a string array when provided`);if(Object.hasOwn(r,"modelIds")&&!zr(r.modelIds))throw Error(`Invalid manifest for extension "${n}": modelIds must be a string array when provided`);let o=i.has("hooks");if(e.hooks!==void 0&&!o)throw Error(`Invalid manifest for extension "${n}": runtime hooks require the "hooks" capability`);return{capabilities:i,raw:$I(r)}}function Np(e,t){if(!e||typeof e!=="object")throw Error(`Invalid automation event contribution for extension "${t}": expected object`);let n=typeof e.eventType==="string"?e.eventType.trim():"",r=typeof e.source==="string"?e.source.trim():"";if(!n)throw Error(`Invalid automation event contribution for extension "${t}": eventType is required`);if(!r)throw Error(`Invalid automation event contribution for extension "${t}": source is required`);return{...e,eventType:n,source:r,examples:e.examples?[...e.examples]:void 0,metadata:e.metadata?{...e.metadata}:void 0}}class iw{extensions;registry={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]};normalized=[];phase="resolve";setupContext;constructor(e={}){this.extensions=e.extensions??[],this.setupContext=e.setupContext??{}}resolve(){if(this.phase!=="resolve")return;this.normalized=this.extensions.map((e,t)=>({extension:e,order:t,manifest:{capabilities:new Set,raw:e.manifest}})),this.phase="validate"}validate(){if(this.phase==="resolve")this.resolve();if(this.phase!=="validate")return;this.normalized=this.normalized.map((e)=>({...e,manifest:Cp(e.extension,e.order)})),this.phase="setup"}async setup(e={}){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase!=="setup")return;let t,n=[];for(let r of this.normalized){let{extension:i}=r;if(i.disabled)continue;let o=Zo(i,r.order),a={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]},s={registerTool:(u)=>a.tools.push(u),registerCommand:(u)=>a.commands.push(u),registerRule:(u)=>{if(!r.manifest.capabilities.has("rules"))throw Error(`Invalid setup for extension "${o}": registerRule requires the "rules" capability`);a.rules.push(u)},registerMessageBuilder:(u)=>a.messageBuilder.push(u),registerProvider:(u)=>a.providers.push(u),registerAutomationEventType:(u)=>{if(!r.manifest.capabilities.has("automationEvents"))throw Error(`Invalid setup for extension "${o}": registerAutomationEventType requires the "automationEvents" capability`);a.automationEventTypes.push(Np(u,o))},registerMcpServer:(u)=>{if(!r.manifest.capabilities.has("mcp"))throw Error(`Invalid setup for extension "${o}": registerMcpServer requires the "mcp" capability`);a.mcpServers.push({...u,metadata:{...u.metadata??{},source:"plugin",plugin:o}})}},l=r.manifest.capabilities.has("automationEvents")?this.setupContext:{...this.setupContext,automation:void 0};try{await i.setup?.(s,l),n.push(a)}catch(u){if(e.tolerateSetupErrors!==!0)throw u;t??=u}}if(t&&e.tolerateSetupErrors!==!0)throw t;for(let r of n)this.registry.tools.push(...r.tools),this.registry.commands.push(...r.commands),this.registry.rules.push(...r.rules),this.registry.messageBuilder.push(...r.messageBuilder),this.registry.providers.push(...r.providers),this.registry.automationEventTypes.push(...r.automationEventTypes),this.registry.mcpServers.push(...r.mcpServers);if(this.phase="activate",t)throw t}activate(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase==="setup")throw Error("Contribution registry setup must complete before activation");if(this.phase!=="activate")return;this.phase="run"}async initialize(e={}){this.resolve(),this.validate();try{await this.setup(e)}finally{if(this.phase==="activate")this.activate()}}isActivated(){return this.phase==="run"}getRegistrySnapshot(){return{tools:[...this.registry.tools],commands:[...this.registry.commands],rules:[...this.registry.rules],messageBuilder:[...this.registry.messageBuilder],providers:[...this.registry.providers],automationEventTypes:[...this.registry.automationEventTypes],mcpServers:[...this.registry.mcpServers]}}getRegisteredTools(){return[...this.registry.tools]}getRegisteredRules(){return[...this.registry.rules]}getRegisteredAutomationEventTypes(){return[...this.registry.automationEventTypes]}getRegisteredMcpServers(){return[...this.registry.mcpServers]}getValidatedExtensions(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();return this.normalized.slice().sort((e,t)=>e.order-t.order).map(({extension:e})=>e)}}function HS(e={}){return new iw(e)}var QS=[".js",".ts"],Qu={CLINE_PASS:"ext-cline-pass",CODE_CLOUD_AGENTS:"code-cloud-agents",CODE_ONBOARDING_GITHUB:"code-onboarding-github",CLINE_COMPOSIO_BETA:"CLINE_COMPOSIO_BETA"},JS={[Qu.CLINE_PASS]:!1,[Qu.CODE_CLOUD_AGENTS]:!1,[Qu.CODE_ONBOARDING_GITHUB]:!1,[Qu.CLINE_COMPOSIO_BETA]:!1},YS=Object.values(Qu),qI=O(["agent_start","agent_resume","agent_abort","agent_end","agent_error","tool_call","tool_result","prompt_submit","pre_compact","session_shutdown"]),Oe=H(c(),c()),Pp=v({toolName:c(),parameters:Oe}),Rp=v({toolName:c(),parameters:Oe,result:c(),success:A(),executionTimeMs:_()}),zp=v({prompt:c(),attachments:I(c())}),$p=v({taskMetadata:Oe}),Lp=v({taskMetadata:Oe,previousState:Oe}),Mp=v({taskMetadata:Oe}),Dp=v({taskMetadata:Oe}),Up=v({taskId:c(),ulid:c(),contextSize:_(),compactionStrategy:c(),previousApiReqIndex:_(),tokensIn:_(),tokensOut:_(),tokensInCache:_(),tokensOutCache:_(),deletedRangeStart:_(),deletedRangeEnd:_(),contextJsonPath:c(),contextRawPath:c()}),zI=v({clineVersion:c(),hookName:qI,timestamp:c(),taskId:c(),sessionContext:v({rootSessionId:c().optional(),hookLogPath:c().optional()}).optional(),workspaceRoots:I(c()),workspaceInfo:X().optional(),userId:c(),agent_id:c(),parent_agent_id:c().nullable(),iteration:_().optional(),reason:c().optional(),tool_call:v({id:c(),name:c(),input:V()}).optional(),tool_result:X().optional(),turn:V().optional(),error:v({name:c(),message:c(),stack:c().optional()}).optional(),preToolUse:Pp.optional(),postToolUse:Rp.optional(),userPromptSubmit:zp.optional(),taskStart:$p.optional(),taskResume:Lp.optional(),taskCancel:Mp.optional(),taskComplete:Dp.optional(),preCompact:Up.optional()}).passthrough();function XS(e){let t=zI.safeParse(e);if(!t.success)return;return t.data}var ZS="v1",e6="v1",t6="v1",i6=["client.register","client.list","session.create","session.list","session.get","session.run","session.abort","schedule.create","schedule.list","task.create","task.list","task.get","task.update","task.approve","task.cancel","task.run","task.automation.get","task.automation.set","settings.get","settings.set","connector.start","connector.stop","connector.supervised","run.enqueue","run.list","hub.drain","hub.status","plugins.list","plugins.status","plugins.reload","stream.replay"];function ft(e){let t=/^v(\d+)$/.exec(e?.trim()??"");if(!t)return;return Number.parseInt(t[1]??"",10)}function n6(e,t="v1"){let n=ft(e.protocolVersion),r=ft(t);if(n===void 0||r===void 0)return{compatible:!1,reason:"missing_protocol"};let i=ft(e.minClientProtocolVersion)??n,o=ft(e.maxClientProtocolVersion)??n;return r>=i&&r<=o?{compatible:!0}:{compatible:!1,reason:"unsupported_protocol"}}var a6="approval.respond",o6="0",r6="__hubScheduleRunAt",nw=["act","plan","yolo"];function GI(e){return nw.some((t)=>t===e)}function s6(e,t){if(!e||!Object.hasOwn(e,"mode"))return t;let n=e.mode;if(GI(n))return n;throw Error(`mode must be one of: ${nw.join(", ")}`)}var VI=30000,c6=5000;function KI(e){switch(e){case"run.start":case"session.send_input":case"plugins.commands.run":return null;default:return VI}}function l6(e,t){return t===void 0?KI(e):t}var HI=["readFile","search","bash","webFetch","editor","applyPatch","skills","askQuestion","submit"],jp=new Set(HI);function u6(e){return typeof e==="string"&&jp.has(e)}var p6="tool_executor.",d6="custom_tool.",m6="hook.",h6="compaction.compact",g6="checkpoint.create",f6="mistake_limit.decide",y6="user_instructions.snapshot";function x6(e){let t=e.activeSessionCount;if(typeof t!=="number"||t<=0)return"active sessions from other Cline clients";let n=`${t} active session${t===1?"":"s"}`,r=e.participantClientCount;if(typeof r!=="number"||r<=0)return n;return`${n} from ${r} connected Cline client${r===1?"":"s"}`}function QI(e,t){return`<file_content path="${e}">
59
+ ${t}
60
+ </file_content>`}function b6(e,t="act"){return`<user_input mode="${t}">${e}</user_input>`}function v6(e,t){return`<user_command slash="${t}">${e}</user_command>`}var Bp=/<user_input\b[^>]*\bmode="(act|plan|yolo)"/;function w6(e){let t=Bp.exec(e??"");return t?t[1]:void 0}function k6(e,t){return`<mode_notice>The user switched from ${e} mode to ${t} mode before sending this message.</mode_notice>`}function T6(){let e=null;return{record(t,n){if(t===n)return;if(e){e=e.from===n?null:{from:e.from,to:n};return}e={from:t,to:n}},consume(){let t=e;return e=null,t}}}function Fp(e,t){let n=e.trim(),r=new RegExp(`^<${t}\\b([^>]*)>([\\s\\S]*?)<\\/${t}>$`,"i").exec(n);if(!r)return;return{attrs:r[1]??"",content:r[2]??""}}function Zp(e,t){return new RegExp(`${t}="([^"]+)"`,"i").exec(e)?.[1]?.trim()||void 0}function JI(e){if(!e?.trim())return;let t=Fp(e,"user_command");if(!t)return;let n=Zp(t.attrs,"slash");if(!n)return;return{slash:n,content:t.content.trim()}}function YI(e){if(!e?.trim())return"";let t=e.trim();for(let n of["user_input","user_command"]){let r=t5(t,n);t=(r!==t?r:t.replace(new RegExp(`<${n}[^>]*>`,"g"),"")).trim()}return t}function XI(e){if(!e?.trim())return"";return Hp(e,"mode_notice").trim()}function Hp(e,t){let n=`<${t}>`,r=`</${t}>`,i=e,o=i.indexOf(n);while(o!==-1){let a=i.indexOf(r,o+n.length);if(a===-1)break;i=i.slice(0,o)+i.slice(a+r.length),o=i.indexOf(n,o)}return i}function aw(e){let t=XI(YI(e)),n=JI(e);if(!n)return t;if(n.slash.toLowerCase()==="team"){let r=t.toLowerCase().startsWith("spawn a team of agents for the following task:")?t.slice(46).trim():t;return r?`/team ${r}`:"/team"}return t?`/${n.slash} ${t}`:`/${n.slash}`}var ZI=240,e5=480;function Ho(e,t){let n=e.replace(/\s+/gu," ").trim();if(n.length<=t)return n;return`${n.slice(0,t-1).trimEnd()}…`}function _6(e){return Ho(aw(e),ZI)}function I6(e,t){let n=t?.trim()??"",r=e.toLowerCase(),i=r==="user"||r==="session"?aw(n):n;return Ho(i,e5)}function t5(e,t){if(!e?.trim())return"";if(!t)return e;let n=new RegExp(`<${t}\\b[^>]*>([\\s\\S]*?)</${t}>`,"g");return e.replace(n,"$1")}var us="[media omitted: invalid or exceeds size limit]",wm="[Image attached — this model cannot view images]",i5=O(["image","audio","video","file"]),n5=Dn("type",[v({type:Z("base64"),data:c().min(1)}),v({type:Z("url"),url:c().url().refine((e)=>{let t=new URL(e).protocol;return t==="http:"||t==="https:"},"Generated media URLs must use HTTP or HTTPS")}),v({type:Z("artifact"),artifactId:c().min(1)})]);function qo(e){if(e.startsWith("image/"))return"image";if(e.startsWith("audio/"))return"audio";if(e.startsWith("video/"))return"video";return"file"}var km=v({id:c().min(1),modality:i5,mediaType:c().min(1),source:n5,name:c().min(1).optional(),sizeBytes:_().int().nonnegative().optional()}).refine((e)=>qo(e.mediaType)===e.modality,{message:"Generated media modality must match its media type",path:["modality"]});function S6(e){return km.safeParse(e).success}function df(e){return qo(e)}var ow=["image/png","image/jpeg","image/gif","image/webp"],rw=5242880,pi=rw,qi=6291456,a5=8388608;function E6(e){return e.length}function sw(e){let t=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.floor(e.length*3/4)-t}function R6(e=rw){return Math.floor(e*3/4)}function o5(e){return Math.ceil(e/3)*4}function cw(e={}){return{maxImageEncodedBytes:e.maxImageEncodedBytes??pi,maxImageDecodedBytes:e.maxImageDecodedBytes??qi,maxTotalMediaBytes:e.maxTotalMediaBytes??a5}}function ps(){return{totalEncodedBytes:0,keptImages:0,omittedImages:0,omittedReasons:{}}}function bt(e,t){e.omittedImages+=1,e.omittedReasons[t]=(e.omittedReasons[t]??0)+1}function ds(e,t,n,r){let i=cw(n);if(e>i.maxImageEncodedBytes){let o={ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${i.maxImageEncodedBytes} byte encoded limit`};return bt(r,o.reason),o}if(t>i.maxImageDecodedBytes){let o={ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${i.maxImageDecodedBytes} byte decoded limit`};return bt(r,o.reason),o}if(r.totalEncodedBytes+e>i.maxTotalMediaBytes){let o={ok:!1,reason:"total_limit",message:`Image media exceeds the ${i.maxTotalMediaBytes} byte total media limit`};return bt(r,o.reason),o}return r.totalEncodedBytes+=e,r.keptImages+=1,null}function r5(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===47}function mf(e){return e.length>0&&jn(e,0,e.length)}function Tm(e,t,n){let r=Vo(e),i=r.end-r.start;if(i===0)return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let o=cw(t);if(n.totalEncodedBytes+i>o.maxTotalMediaBytes)return{ok:!1,reason:"total_limit",message:`Generated media exceeds the ${o.maxTotalMediaBytes} byte total media limit`};if(!jn(e,r.start,r.end))return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let a=e.slice(r.start,r.end);return n.totalEncodedBytes+=i,{ok:!0,base64:a,encodedBytes:i,decodedBytes:sw(a)}}function jn(e,t,n){let r=n-t;if(r%4!==0)return!1;let i=n;if(r>=2&&e.charCodeAt(n-2)===61&&e.charCodeAt(n-1)===61)i-=2;else if(r>=1&&e.charCodeAt(n-1)===61)i-=1;for(let o=t;o<i;o++)if(!r5(e.charCodeAt(o)))return!1;for(let o=i;o<n;o++)if(e.charCodeAt(o)!==61)return!1;return!0}function qp(e,t,n){return n-t>=5&&(e.charCodeAt(t)|32)===100&&(e.charCodeAt(t+1)|32)===97&&(e.charCodeAt(t+2)|32)===116&&(e.charCodeAt(t+3)|32)===97&&e.charCodeAt(t+4)===58}function Vo(e){let t=0,n=e.length;while(t<n&&/\s/.test(e[t]??""))t+=1;while(n>t&&/\s/.test(e[n-1]??""))n-=1;return{start:t,end:n}}function Vp(e,t,n){if(!qp(e,t,n))return;let r=t+5,i=e.indexOf(",",r);if(i===-1||i>=n)return;if(i-r>128)return;let o=e.slice(r,i).toLowerCase(),a=";base64";if(!o.endsWith(a))return;let s=o.slice(0,-a.length);if(!s||s.includes(";"))return;return{mediaType:s,base64Start:i+1,base64End:n}}function Ju(e,t,n={}){let r=n.maxEncodedBytes??pi,i=n.maxDecodedBytes??qi,o=new Set(n.supportedMediaTypes??ow),a=e?.toLowerCase(),s=Vo(t),{start:l,end:u}=s,d=Vp(t,s.start,s.end);if(d){if(a&&a!==d.mediaType)return{ok:!1,reason:"media_type_mismatch",message:`Image media type ${e} does not match data URL type ${d.mediaType}`};a=d.mediaType,l=d.base64Start,u=d.base64End}if(!a||!o.has(a))return{ok:!1,reason:"unsupported_media_type",message:`Unsupported image media type: ${e??"unknown"}`};let p=u-l;if(p===0)return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};if(p>r)return{ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${r} byte encoded limit`};if(!jn(t,l,u))return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};let f=t.slice(l,u),m=sw(f);if(m>i)return{ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${i} byte decoded limit`};return{ok:!0,mediaType:a,base64:f,encodedBytes:p,decodedBytes:m}}function Yo(e,t,n,r){let i=Ju(e,t,{maxEncodedBytes:n.maxImageEncodedBytes,maxDecodedBytes:n.maxImageDecodedBytes});if(!i.ok)return bt(r,i.reason),i;let o=ds(i.encodedBytes,i.decodedBytes,n,r);if(o)return o;return i}function wi(e){return e.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"�")}var _m="ERROR: EMPTY CONTENT",Jp="[image attached]",Wp="[generated image]";function Kp(e){return`[generated ${e}]`}function mt(e){return{type:"text",text:`[generated ${e.modality} unavailable to this model]`}}function qt(e,t){let n=e[e.length-1];if(t.role==="tool"&&n?.role==="tool"&&Array.isArray(n.content)&&Array.isArray(t.content)){n.content.push(...t.content);return}e.push(t)}function Gp(e){if(!Array.isArray(e)||e.length===0)return!1;return e.every((t)=>{if(!t||typeof t!=="object")return!1;let n=t;if(n.type==="text")return typeof n.text==="string";if(n.type==="image")return typeof n.data==="string"&&typeof n.mediaType==="string";return!1})}function Ee(){return{type:"text",text:us}}function Lr(e){return ds(pi,0,{maxImageEncodedBytes:pi,maxImageDecodedBytes:qi},e)===null}function Jo(e){try{return new URL(e).protocol}catch{return}}function cn(e,t){let n=Yo(e.mediaType,e.data,{maxImageEncodedBytes:pi,maxImageDecodedBytes:qi},t);if(!n.ok)return Ee();return Wo(n.base64,n.mediaType)}function Wo(e,t){return{type:"file",data:{type:"data",data:e},mediaType:t}}function Ce(e,t){return{type:"file",data:e,mediaType:t??"image"}}function dn(e,t){if(e.image instanceof URL){if(e.image.protocol==="data:"){let o=Yo(e.mediaType,e.image.href,{maxImageEncodedBytes:pi,maxImageDecodedBytes:qi},t);if(!o.ok)return Ee();return Ce(`data:${o.mediaType};base64,${o.base64}`,o.mediaType)}if(e.image.protocol!=="http:"&&e.image.protocol!=="https:")return Ee();if(!Lr(t))return Ee();return Ce(e.image,e.mediaType)}if(typeof e.image==="string"){let o=Jo(e.image);if(o==="http:"||o==="https:"){if(!Lr(t))return Ee();return Ce(e.image,e.mediaType)}let a=o==="data:",s=Yo(e.mediaType??(a?void 0:"image/png"),e.image,{maxImageEncodedBytes:pi,maxImageDecodedBytes:qi},t);if(!s.ok)return Ee();return Ce(a?`data:${s.mediaType};base64,${s.base64}`:s.base64,s.mediaType)}let n=e.image.byteLength,r=o5(n),i=e.mediaType?.toLowerCase()??"image/png";if(!ow.includes(i)||ds(r,n,{maxImageEncodedBytes:pi,maxImageDecodedBytes:qi},t))return Ee();return Ce(e.image,i)}function Yp(e,t){if(!t)return!0;if(e.modality==="file")return e.mediaType==="application/pdf"&&t.includes("pdf");return t.includes(e.modality)}function Mr(e,t,n){if(!Yp(e,n))return mt(e);if(e.modality==="image"){if(e.source.type==="artifact")return mt(e);return dn({type:"image",image:e.source.type==="url"?e.source.url:e.source.data,mediaType:e.mediaType},t)}if(e.source.type==="artifact")return mt(e);if(e.source.type==="url"){let r=Jo(e.source.url);if(r!=="http:"&&r!=="https:"&&r!=="data:")return mt(e)}return Ce(e.source.type==="url"?e.source.url:e.source.data,e.mediaType)}function pn(e,t,n,r){let{hoistImages:i,inlineImagePlaceholder:o}=r;if(e==null||typeof e!=="object")return{value:e,changed:!1,mediaChanged:!1};if(Array.isArray(e)){let d=[],p=!1,f=!1;for(let m of e){if(m&&typeof m==="object"){let y=m;if(y.type==="image"&&typeof y.data==="string"&&typeof y.mediaType==="string"){if(!i){d.push(o),p=!0,f=!0;continue}let T={type:"image",data:y.data,mediaType:y.mediaType},b=cn(T,n);if(b.type==="file")t.push({type:"image",data:b.data.data,mediaType:b.mediaType});else d.push(b.text);p=!0,f=!0;continue}if(y.type==="image"){d.push(us),p=!0,f=!0;continue}if(y.type==="text"&&typeof y.text==="string"){d.push(y.text),p=!0;continue}}let g=pn(m,t,n,r);d.push(g.value),p||=g.changed,f||=g.mediaChanged}return{value:p?d:e,changed:p,mediaChanged:f}}let a=e;if(a.type==="image"){if(typeof a.data==="string"&&typeof a.mediaType==="string"){if(!i)return{value:o,changed:!0,mediaChanged:!0};let d={type:"image",data:a.data,mediaType:a.mediaType},p=cn(d,n);if(p.type==="file")return t.push({type:"image",data:p.data.data,mediaType:p.mediaType}),{value:Jp,changed:!0,mediaChanged:!0};return{value:p.text,changed:!0,mediaChanged:!0}}return{value:us,changed:!0,mediaChanged:!0}}let s={},l=!1,u=!1;for(let[d,p]of Object.entries(a)){let f=pn(p,t,n,r);s[d]=f.value,l||=f.changed,u||=f.mediaChanged}return{value:l?s:e,changed:l,mediaChanged:u}}function et(e){if(typeof e==="string")return wi(e);if(Array.isArray(e))return e.map((t)=>et(t));if(e!==null&&typeof e==="object"){let t=e,n={};for(let[r,i]of Object.entries(t))n[r]=et(i);return n}return e}function s5(e,t=!1,n=ps(),r){let i=r?.supportsImages??!0;if(typeof e==="string")return{type:t?"error-text":"text",value:wi(e)};if(!t&&Gp(e))return{type:"content",value:e.map((o)=>o.type==="image"?i?cn(o,n):{type:"text",text:wm}:{type:"text",text:wi(o.text)})};if(e!==null&&typeof e==="object"){let o=[],a=pn(e,o,n,{hoistImages:!t&&i,inlineImagePlaceholder:i?us:wm});if(!t&&o.length>0)return{type:"content",value:[{type:"text",text:typeof a.value==="string"?wi(a.value):JSON.stringify(et(a.value))},...o.map((s)=>Wo(s.data,s.mediaType))]};if(a.mediaChanged)return{type:t?"error-json":"json",value:et(a.value)}}if(e===null||typeof e==="boolean"||typeof e==="number"||typeof e==="object")return{type:t?"error-json":"json",value:et(e)};return{type:t?"error-text":"text",value:wi(String(e))}}function hf(e,t,n){let r=n?.assistantToolCallArgKey??"input",i=n?.supportedInputModalities,o=!i||i.includes("image"),a=[],s=ps(),l=[],u=()=>l.splice(0).map((d)=>d.type==="image"?o?dn(d,s):{type:"text",text:wm}:Mr(d.media,s,i));if(typeof e==="string"&&e.trim().length>0||Array.isArray(e)&&e.length>0)a.push({role:"system",content:typeof e==="string"?wi(e):e});for(let d of t){let p=d.content;if(typeof p==="string"){let y=d.role==="user"&&l.length>0?u():[];if(y.length>0){a.push({role:d.role,content:[{type:"text",text:p.trim().length>0?wi(p):_m},...y]});continue}if(p.trim().length===0){a.push({role:d.role,content:[{type:"text",text:_m}]});continue}a.push({role:d.role,content:wi(p)});continue}let f=[],m=[];if(p.length===0){a.push({role:d.role,content:[{type:"text",text:_m}]});continue}for(let y of p)switch(y.type){case"text":f.push({type:"text",text:wi(y.text),...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"reasoning":f.push({type:"reasoning",text:wi(y.text),...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"image":if(d.role==="assistant")l.push(y),f.push({type:"text",text:Wp});else f.push(o?dn(y,s):{type:"text",text:wm});break;case"media":if(d.role==="assistant")l.push(y),f.push({type:"text",text:Kp(y.media.modality)});else f.push(Mr(y.media,s,i));break;case"file":f.push({type:"text",text:QI(y.path,wi(y.content))});break;case"tool-call":if(d.role==="assistant")f.push({type:"tool-call",toolCallId:y.toolCallId,toolName:y.toolName,[r]:y.input,...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"tool-result":{m.push({type:"tool-result",toolCallId:y.toolCallId,toolName:y.toolName,output:s5(y.output,y.isError??!1,s,{supportsImages:o})});break}}let g=m.length>0;if(d.role==="user"&&!g&&l.length>0)f.push(...u());if(f.length>0&&f.every((y)=>y.type==="text"&&typeof y.text==="string"&&y.text.trim().length===0))f.splice(0,f.length,{type:"text",text:_m});if(f.length>0)qt(a,{role:d.role,content:f});if(g)qt(a,{role:"tool",content:m})}if(l.length>0)qt(a,{role:"user",content:u()});return a}var gf=["show","hide","subscription"];function Dr(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Yu(e,t){if(!e&&!t)return;let n=e?.metadata,r=t?.metadata,i={...e??{},...t??{}};if(Dr(n)&&Dr(r))i.metadata={...n,...r};return i}var O6=["web_search","image_generation"],A6=["web_search"],Im={max:1,xhigh:0.95,high:0.8,medium:0.5,low:0.2,minimal:0.1,none:0},C6=void 0;function P6(e,t){if(typeof e==="string"&&e.toLowerCase()in Im)return e.toLowerCase();return t?void 0:void 0}function c5(e,t){let n=typeof e==="string"?e.toLowerCase():void 0;if(n&&n in Im)return Im[n];if(t?.fallbackEffort)return Im[t.fallbackEffort];return}function Xu(e){let t=c5(e.effort,{fallbackEffort:e.fallbackEffort});if(t===void 0)return;if(t<=0)return 0;let n=e.minimumBudget??1;if(e.maxBudget<n)return;let r=e.scaleTokens??e.maxBudget;return Math.min(Math.max(Math.floor(r*t),n),e.maxBudget)}function D6(e){return e instanceof Error?{name:e.name,message:e.message}:e}var W6=3;function Xo(e){return Math.max(1,Math.ceil(e/3))}var l5=1600;function u5(){let e=0;return{replacer:(t,n)=>{if(n===null||typeof n!=="object"||n.type!=="image")return n;let r=n;if(typeof r.data==="string")return e+=1,{...r,data:""};if("image"in r)return e+=1,{...r,image:""};return n},imageCount:()=>e}}function Vt(e){let t=new WeakSet;try{return JSON.stringify(e,(n,r)=>{if(typeof r==="bigint")return r.toString();if(typeof r!=="object"||r===null)return r;if(t.has(r))return"[Circular]";return t.add(r),r})??""}catch{return String(e??"")}}function ff(e){let{replacer:t,imageCount:n}=u5(),r,i=0;try{r=JSON.stringify({systemPrompt:e.systemPrompt,messages:e.messages,tools:e.tools},t),i=n()}catch{r=[Vt(e.systemPrompt),Vt(e.messages),Vt(e.tools)].join(`
61
+ `)}return Xo(r.length)+i*l5}var M6={debug:()=>{},log:()=>{},error:()=>{}},N6=60,L6=1,B6=3600;function p5(e){return typeof e==="number"&&Number.isFinite(e)}function d5(e){return Math.min(Math.max(e,1),3600)}function U6(e){if(!p5(e))return 60;return d5(e)}function F6(e,t,n){let r=n?` (${n})`:"",i=Math.round(t/100)/10;return`MCP request to "${e}"${r} timed out after ${i}s. Increase the "timeout" field (in seconds) for this server in cline_mcp_settings.json.`}function j6(e){if(e instanceof Error)return e.message;return String(e)}function $6(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return""}class Te extends Error{constructor(e,t){super(`${e} at position ${t}`);this.position=t}}function Xp(e){return/^[0-9A-Fa-f]$/.test(e)}function pe(e){return e>="0"&&e<="9"}function Qp(e){return e>=" "}function qe(e){return`,:[]/{}()
62
+ +`.includes(e)}function Ur(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"||e==="$"}function Jt(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"||e==="$"||e>="0"&&e<="9"}var jr=/^(http|https|ftp|mailto|file|data|irc):\/\/$/,Br=/^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;function Fr(e){return`,[]/{}
63
+ +`.includes(e)}function Zr(e){return Ge(e)||ef.test(e)}var ef=/^[[{\w-]$/;function Hr(e){return e===`
64
+ `||e==="\r"||e==="\t"||e==="\b"||e==="\f"}function ge(e,t){let n=e.charCodeAt(t);return n===32||n===10||n===9||n===13}function tf(e,t){let n=e.charCodeAt(t);return n===32||n===9||n===13}function nf(e,t){let n=e.charCodeAt(t);return n===160||n===6158||n>=8192&&n<=8203||n===8239||n===8287||n===12288||n===65279}function Ge(e){return Ko(e)||fn(e)}function Ko(e){return e==='"'||e==="“"||e==="”"}function qr(e){return e==='"'}function fn(e){return e==="'"||e==="‘"||e==="’"||e==="`"||e==="´"}function Vr(e){return e==="'"}function Ve(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=e.lastIndexOf(t);return r!==-1?e.substring(0,r)+(n?"":e.substring(r+1)):e}function te(e,t){let n=e.length;if(!ge(e,n-1))return e+t;while(ge(e,n-1))n--;return e.substring(0,n)+t+e.substring(n)}function rf(e,t,n){return e.substring(0,t)+e.substring(t+n)}function of(e){return/[,\n][ \t\r]*$/.test(e)}var af={"&quot;":'"',"&amp;":"&","&lt;":"<","&gt;":">","&apos;":"'"},Jr=12;function Wr(e){if(e.charAt(0)!=="&")return null;let t=e.indexOf(";");if(t===-1)return null;let n=e.substring(0,t+1),r=af[n];if(r!==void 0)return{char:r,length:n.length};if(e.charAt(1)==="#"){let i=e.substring(2,t),o=i.charAt(0)==="x"||i.charAt(0)==="X",a=o?i.substring(1):i;if(a.length>0){let s=Number.parseInt(a,o?16:10);if(!Number.isNaN(s)&&s>=0&&s<=1114111)return{char:String.fromCodePoint(s),length:n.length}}}return null}function sf(e){return e!==null&&e.char==='"'}function cf(e){return e!==null&&e.char==="'"}function Ae(e,t){let n=0;for(let r=0;r<e.length;r++)if(e.charAt(r)===t)n++;return n}function Nf(e,t){switch(t){case")":return Ae(e,"(")>Ae(e,")");case"]":return Ae(e,"[")>Ae(e,"]");case"}":return Ae(e,"{")>Ae(e,"}");default:return!1}}var Kr={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},Pf={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
65
+ `,r:"\r",t:"\t"};function zf(e){let t=0,n="";if(l(["```","[```","{```"]),!i())Ta();l(["```","```]","```}"]);let r=d(",");if(r)o();if(Zr(e[t])&&of(n)){if(!r)n=te(n,",");T()}else if(r)n=Ve(n,",");while(e[t]==="}"||e[t]==="]")t++,o();if(t>=e.length)return n;Ze();function i(){o();let k=g()||y()||b()||C()||N()||q(!1)||ce();return o(),k}function o(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,E=t,P=a(k);do if(P=s(),P)P=a(k);while(P);return t>E}function a(k){let E=k?ge:tf,P="";while(!0)if(E(e,t))P+=e[t],t++;else if(nf(e,t))P+=" ",t++;else break;if(P.length>0)return n+=P,!0;return!1}function s(){if(e[t]==="/"&&e[t+1]==="*"){while(t<e.length&&!$f(e,t))t++;return t+=2,!0}if(e[t]==="/"&&e[t+1]==="/"){while(t<e.length&&e[t]!==`
66
+ `)t++;return!0}return!1}function l(k){if(u(k)){if(Ur(e[t]))while(t<e.length&&Jt(e[t]))t++;return o(),!0}return!1}function u(k){a(!0);for(let E of k){let P=t+E.length;if(e.slice(t,P)===E)return t=P,!0}return!1}function d(k){if(e[t]===k)return n+=e[t],t++,!0;return!1}function p(k){if(e[t]===k)return t++,!0;return!1}function f(){return p("\\")}function m(){if(o(),e[t]==="."&&e[t+1]==="."&&e[t+2]===".")return t+=3,o(),p(","),!0;return!1}function g(){if(e[t]==="{"){if(n+="{",t++,o(),p(","))o();let k=!0;while(t<e.length&&e[t]!=="}"){let E;if(!k){if(E=d(","),!E)n=te(n,",");o()}else E=!0;if(m(),!(b()||q(!0))){if(e[t]==="}"||e[t]==="{"||e[t]==="]"||e[t]==="["||e[t]===void 0){if(!k)n=Ve(n,",")}else Sa();break}o();let P=d(":"),se=t>=e.length;if(!P)if(Zr(e[t])||se)n=te(n,":");else Hn();if(!i())if(P||se)n+="null";else Hn();k=!1}if(e[t]==="}")n+="}",t++;else n=te(n,"}");return!0}return!1}function y(){if(e[t]==="["){if(n+="[",t++,o(),p(","))o();let k=!0;while(t<e.length&&e[t]!=="]"){if(!k){if(!d(","))n=te(n,",")}if(m(),!i()){if(!k)n=Ve(n,",");break}k=!1}if(e[t]==="]")n+="]",t++;else n=te(n,"]");return!0}return!1}function T(){let k=!0,E=!0;while(E){if(!k){if(!d(","))n=te(n,",")}else k=!1;E=i()}if(!E)n=Ve(n,",");n=`[
67
+ ${n}
68
+ ]`}function b(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,P=e[t]==="\\";if(P){if(t++,!Ge(e[t]))Ze()}let se=e[t]==="&"?Wr(e.slice(t,t+Jr)):null,Ut=sf(se)||cf(se);if(Ge(e[t])||Ut){let Oa=qr(e[t])?qr:Vr(e[t])?Vr:fn(e[t])?fn:Ko,ot=t,at=n.length,L='"';t+=Ut&&se?se.length:1;while(!0){if(t>=e.length){let F=ke(t-1);if(!k&&qe(e.charAt(F)))return t=ot,n=n.substring(0,at),b(!0);return L=te(L,'"'),n+=L,!0}if(t===E)return L=te(L,'"'),n+=L,!0;let le=Ut&&e[t]==="&"?Wr(e.slice(t,t+Jr)):null;if(le&&se?le.char===se.char:Oa(e[t])){let F=t,de=L.length;if(L+='"',t+=le?le.length:1,n+=L,o(!1),k||t>=e.length||qe(e[t])&&!Nf(L,e[t])||Ge(e[t])&&!Be(t)||pe(e[t]))return D(),!0;if(e[t]==="\\")Ze();let qn=ke(F-1),Vn=e.charAt(qn);if(Vn===",")return t=ot,n=n.substring(0,at),b(!1,qn);if(qe(Vn))return t=ot,n=n.substring(0,at),b(!0);n=n.substring(0,at),t=F+(le?le.length:1),L=`${L.substring(0,de)}\\${L.substring(de)}`}else if(k&&Fr(e[t])){if(e[t-1]===":"&&jr.test(e.substring(ot+1,t+2)))while(t<e.length&&Br.test(e[t]))L+=e[t],t++;return L=te(L,'"'),n+=L,D(),!0}else if(le){let F=le.char;if(F==='"')L+="\\\"";else if(Hr(F))L+=Kr[F];else L+=F;t+=le.length}else if(e[t]==="\\"){let F=e.charAt(t+1);if(Pf[F]!==void 0)L+=e.slice(t,t+2),t+=2;else if(F==="u"){let de=2;while(de<6&&Xp(e[t+de]))de++;if(de===6)L+=e.slice(t,t+6),t+=6;else if(t+de>=e.length)t=e.length;else Ia()}else if(F===`
69
+ `)L+="\\n",t+=2;else L+=F,t+=2}else{let F=e.charAt(t);if(F==='"'&&e[t-1]!=="\\")L+=`\\${F}`,t++;else if(Hr(F))L+=Kr[F],t++;else{if(!Qp(F))Dt(F);L+=F,t++}}if(P)f()}}return!1}function D(){let k=!1;o();while(e[t]==="+"){k=!0,t++,o(),n=Ve(n,'"',!0);let E=n.length;if(b())n=rf(n,E,1);else n=te(n,'"')}return k}function C(){let k=t,E="",P=!1;if(e[t]==="-"){if(E+=e[t],t++,!pe(e[t])&&Fe())E+="0"}if(e[t]==="0"&&pe(e[t+1]))P=!0;while(pe(e[t]))E+=e[t],t++;if(e[t]==="."){if(E===""||E==="-")E+="0";if(E+=e[t],t++,!pe(e[t]))E+="0";while(pe(e[t]))E+=e[t],t++}if(t>k){if(e[t]==="e"||e[t]==="E"){if(E==="-")P=!0;if(E+=e[t],t++,e[t]==="-"||e[t]==="+")E+=e[t],t++;if(!pe(e[t]))E+="0";while(pe(e[t]))E+=e[t],t++}if(!Fe())return t=k,!1;return n+=P?`"${e.substring(k,t)}"`:E,!0}return!1}function N(){return S("true","true")||S("false","false")||S("null","null")||S("True","true")||S("False","false")||S("None","null")}function S(k,E){if(e.slice(t,t+k.length)===k&&!Jt(e[t+k.length]))return n+=E,t+=k.length,!0;return!1}function q(k){let E=t;if(Ur(e[t])){while(t<e.length&&Jt(e[t]))t++;let P=t;while(ge(e,P))P++;if(e[P]==="("){if(t=P+1,i(),e[t]===")"){if(t++,e[t]===";")t++}return!0}}while(t<e.length&&!Fr(e[t])&&!Ge(e[t])&&(!k||e[t]!==":"))t++;if(e[t-1]===":"&&jr.test(e.substring(E,t+2)))while(t<e.length&&Br.test(e[t]))t++;if(t>E){while(ge(e,t-1)&&t>0)t--;let P=e.slice(E,t);if(n+=P==="undefined"?"null":JSON.stringify(P),e[t]==='"')t++;return!0}}function ce(){if(e[t]==="/"){let k=t;t++;while(t<e.length&&(e[t]!=="/"||e[t-1]==="\\"))t++;return t++,n+=JSON.stringify(e.substring(k,t)),!0}}function ke(k){let E=k;while(E>0&&ge(e,E))E--;return E}function Be(k){let E=k+1;while(E<e.length&&ge(e,E))E++;return E>=e.length||qe(e[E])}function Fe(){return t>=e.length||qe(e[t])||ge(e,t)}function Dt(k){throw new Te(`Invalid character ${JSON.stringify(k)}`,t)}function Ze(){throw new Te(`Unexpected character ${JSON.stringify(e[t])}`,t)}function Ta(){throw new Te("Unexpected end of json string",e.length)}function Sa(){throw new Te("Object key expected",t)}function Hn(){throw new Te("Colon expected",t)}function Ia(){let k=e.slice(t,t+6);throw new Te(`Invalid unicode character "${k}"`,t)}}function $f(e,t){return e[t]==="*"&&e[t+1]==="/"}function Lf(e){let t=!1,n=!1,r=!1;for(let i=0;i<e.length;i+=1){let o=e[i];if(r){r=!1;continue}if(o==="\\"){r=!0;continue}if(!n&&o==='"')t=!t;else if(!t&&o==="'")n=!n}return t||n}var Mf=/^\{\s*"([A-Za-z0-9_.$-]+)"\s*:\s*([\s\S]+?)\s*\}$/;function Df(e){let t=e.match(Mf);if(!t)return;let[,n,r]=t,i=r.trim();if(!i)return;let o=i[0];if(o==='"'||o==="{"||o==="["||i==="true"||i==="false"||i==="null"||Number.isFinite(Number(i)))return;return JSON.parse(`{"${n}":${JSON.stringify(i)}}`)}function yf(e){if(typeof e!=="string")return e;let t=e.trimStart();if(t[0]!=="{"&&t[0]!=="[")return e;try{return JSON.parse(t)}catch{}if(!Lf(t))try{return JSON.parse(zf(t))}catch{}return Df(t)??e}function xf(e){let t=new WeakSet;try{return JSON.stringify(e,(n,r)=>{if(typeof r==="bigint")return r.toString();if(r&&typeof r==="object"){if(t.has(r))return"[Circular]";t.add(r)}return r})??"null"}catch{return String(e)}}function Zu(e){try{return JSON.parse(e)}catch{return}}function Pe(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Uf(e){let t=e.type;if(typeof t==="string")return[t];return Array.isArray(t)?t.filter((n)=>typeof n==="string"):[]}function mn(e,t){if(Uf(e).includes(t))return!0;for(let n of["anyOf","oneOf","allOf"]){let r=e[n];if(Array.isArray(r)&&r.some((i)=>Pe(i)&&mn(i,t)))return!0}return!1}function jf(e,t){if(typeof e!=="string")return e;let n=e.trim(),r=mn(t,"array"),i=mn(t,"object");if((!r||!n.startsWith("["))&&(!i||!n.startsWith("{")))return e;try{let o=JSON.parse(n);if(Array.isArray(o))return r?o:e;if(Pe(o))return i?o:e;return e}catch{return e}}function ep(e,t){let n=jf(e,t);if(Array.isArray(n)){let a=t.items;if(!Pe(a))return n;let s=!1,l=n.map((u)=>{let d=ep(u,a);return s||=d!==u,d});return s?l:n}if(!Pe(n))return n;let r=t.properties;if(!Pe(r))return n;let i=!1,o={...n};for(let[a,s]of Object.entries(r)){if(!(a in n)||!Pe(s))continue;let l=ep(n[a],s);if(l!==n[a])o[a]=l,i=!0}return i?o:n}function Bf(e){if(typeof globalThis.atob==="function")try{let t=globalThis.atob(e),n=Uint8Array.from(t,(r)=>r.charCodeAt(0));return new TextDecoder().decode(n)}catch{return null}if(typeof Buffer<"u")try{return Buffer.from(e,"base64").toString("utf8")}catch{return null}return null}function bf(e){let t=e?.trim();if(!t)return null;try{let n=t.split(".");if(n.length!==3)return null;let r=n[1];if(!r)return null;let i=r.replace(/-/g,"+").replace(/_/g,"/"),o=i.padEnd(i.length+(4-i.length%4)%4,"="),a=Bf(o);return a?JSON.parse(a):null}catch{return null}}function vf(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function q6(e){return e.split(Ff.sep).join("/")}function Go(e){let t=e.replaceAll("\\","/"),n=t.lastIndexOf("/");return(n>=0?t.slice(n+1):t).toLowerCase()}function z6(e){return e==="win32"?"powershell":"/bin/bash"}function lw(e){let t=Go(e);if(tp(e)!==void 0)return"powershell";if(t==="cmd"||t==="cmd.exe")return"cmd";if(t==="wsl"||t==="wsl.exe")return"wsl";return"posix"}var Zf=new Set(["-nologo","-noninteractive","-noprofile"]),Hf="-noprofile";function qf(e,t){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(i==="`"&&r+1<e.length){let o=e[r+1];if(o==="u"&&t==="core"&&e[r+2]==="{"){let a=e.indexOf("}",r+3),s=a>r+3?e.slice(r+3,a):"",l=Number.parseInt(s,16);if(s.length<=6&&/^[0-9a-fA-F]+$/.test(s)&&l<=1114111){n+=String.fromCodePoint(l),r=a;continue}}switch(o){case"n":n+=`
70
+ `;break;case"r":n+="\r";break;case"t":n+="\t";break;case"b":n+="\b";break;case"f":n+="\f";break;case"v":n+="\v";break;case"0":n+="\x00";break;case"a":n+="\x07";break;case"e":n+=t==="core"?"\x1B":"e";break;default:n+=o}r++;continue}if(i==='"'&&e[r+1]==='"'){n+='"',r++;continue}n+=i}return n}function Vf(e){let t=e[0];if(t!=="'"&&t!=='"')return;for(let n=1;n<e.length;n++){let r=e[n];if(t==='"'&&r==="`"){n++;continue}if(r===t){if(e[n+1]===t){n++;continue}if(e.slice(n+1).trim()!=="")return;return{quote:t,body:e.slice(1,n)}}}return}function tp(e){let t=Go(e);if(t==="powershell"||t==="powershell.exe")return"windows";if(t==="pwsh"||t==="pwsh.exe")return"core";return}function Jf(e,t){let n=Vf(e);if(!n)return;let r=(n.quote==="'"?n.body.replaceAll("''","'"):qf(n.body,t)).trim();return r.length>0?r:void 0}function Wf(e,t){let n=/^[ \t]*(?:&[ \t]*(?:"([^"$`]*)"|'((?:[^']|'')*)')|(?:&[ \t]*)?([^\s$`"';&|<>(){}#@,]+))[ \t]+([\S\s]*)$/.exec(e);if(!n)return;let r=n[1]??n[2]?.replaceAll("''","'")??n[3],i=tp(t);if(!i||!tp(r))return;let o=n[4],a=!1;for(;;){let s=/^(-[^\s=]+)[ \t]*([\S\s]*)$/.exec(o);if(!s)return;let l=s[1].toLowerCase();if(l==="-command"){let u=a?Jf(s[2],i):void 0;return u===void 0?void 0:{executable:r,script:u}}if(!Zf.has(l))return;if(l===Hf)a=!0;o=s[2]}}function Kf(e,t){if(!/[\\/:]/.test(t)&&tp(t)===tp(e))return e;return t}function m5(e,t){switch(lw(e)){case"powershell":{let n={executable:e,script:t};for(;;){let r=Wf(n.script,n.executable);if(!r)break;n={executable:Kf(e,r.executable),script:r.script}}return{executable:n.executable,args:["-NoProfile","-NonInteractive","-Command","[Console]::InputEncoding=[Text.UTF8Encoding]::new();[Console]::OutputEncoding=[Text.UTF8Encoding]::new();$ErrorActionPreference='Stop';$c=[Console]::In.ReadToEnd();$c+=[Environment]::NewLine+'if(-not $?){exit 1}';& ([ScriptBlock]::Create($c))"],input:n.script}}case"cmd":return{executable:e,args:["/d","/s","/c",t]};case"wsl":return{executable:e,args:["bash","-c",t]};case"posix":return{executable:e,args:["-c",t]}}}function G6(e,t){if(lw(e)==="powershell")return["-NoProfile","-NonInteractive","-Command",t];return m5(e,t).args}function V6(e){return e.toLowerCase().replace(/[^\w.-]+/g,"_")}function di(e){let t=e?.trim();return t?t:void 0}function h5(e,t){if(e.length<=t)return e;return`${e.slice(0,t-1)}…`}function K6(e,t="/",n=100){if(!e||e.length<=n)return e||"";let r=e.split(t)?.shift()?.trim()?.slice(0,n-1);return r?`${r}…`:h5(e,n)}function H6(e){if(e.length<=8)return"****";return`${e.slice(0,4)}...${e.slice(-4)}`}function Q6(e){return e.charCodeAt(0)===65279?e.slice(1):e}function J6(e){if(!e)return"(unknown-date)";let t=new Date(e);if(Number.isNaN(t.getTime()))return e;return t.toLocaleString("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0})}function Y6(e){let t=Math.max(0,Math.floor(e/1000)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),o=t%60;if(n>0)return`${n}d ${r}h`;if(r>0)return`${r}h ${i}m`;if(i>0)return`${i}m ${o}s`;return`${o}s`}function X6(e,t){let n=e.safeParse(t);if(!n.success)throw Error(cs(n.error));return n.data}function g5(e){return rd(e)}function Pn(e){return e==="cline"||e==="cline-pass"}var Gf=`You are Cline, an AI coding agent. Your primary goal is to assist users with various coding tasks by leveraging your knowledge and the tools at your disposal. Given the user's prompt, you should use the tools available to you to answer user's question.
71
+
72
+ Always gather all the necessary context before starting to work on a task. For example, if you are generating a unit test or new code, make sure you understand the requirement, the naming conventions, frameworks and libraries used and aligned in the current codebase, and the environment and commands used to run and test the code etc. Always validate the new unit test at the end including running the code if possible for live feedback.
73
+ Review each question carefully and answer it with detailed, accurate information.
74
+ If you need more information, use one of the available tools or ask for clarification instead of making assumptions or lies.
75
+
76
+ Environment you are running in:
77
+ <env>
78
+ 1. Platform: {{PLATFORM_NAME}}
79
+ 2. Date: {{CURRENT_DATE}}
80
+ 3. IDE: {{IDE_NAME}}
81
+ 4. Working Directory: {{CWD}}
82
+ </env>
83
+
84
+ Remember:
85
+ - Always adhere to existing code conventions and patterns.
86
+ - Use only libraries and frameworks that are confirmed to be in use in the current codebase.
87
+ - Provide complete and functional code without omissions or placeholders.
88
+ - Be explicit about any assumptions or limitations in your solution.
89
+ - Always show your planning process before executing any task. This will help ensure that you have a clear understanding of the requirements and that your approach aligns with the user's needs.
90
+ - Always use absolute paths when referring to files.
91
+ - You can call multiple tools in a single response. Before using tools, identify every independent read, search, command, or edit needed for the next step and emit all of those tool calls now, either as multiple tool calls or as one batched input for tools that accept arrays. Do not wait for one independent result before requesting another. Do not split independent reads, searches, checks, or edits across separate turns.
92
+ - Good parallelism examples: read all known relevant files in one read_files call; run independent inspection commands in one run_commands call; emit independent read_files, search_codebase, and run_commands calls together in one response; emit multiple editor calls together when editing different files or non-overlapping regions.
93
+ - Always verify the files you have edited or created at the end of the task to ensure they are completed and working as expected.
94
+
95
+ Begin by analyzing the user's input and gathering any necessary additional context. Then, present your plan at the start of your response along with tool calls before proceeding with the task. It's OK for this section to be quite long.
96
+
97
+ REMEMBER, be helpful and proactive! Don't ask for permission to do something when you can do it! Do not indicates you will be using a tool unless you are actually going to use it.
98
+
99
+ IMPORTANT: Always includes tool calls in your response until the task is completed. Response without tool calls will considered as completed with final answer.
100
+
101
+ When you have completed the task, please provide a summary of what you did and any relevant information that the user should know. This will help ensure that the user understands the changes made and can easily follow up if they have any questions or need further assistance. Do not indicate that you will perform an action without actually doing it. Always provide the final result in your response. Always validate your answer with checking the code and running it if possible.
102
+
103
+ If user asked a simple question without any coding context, answer it directly without using any tools.
104
+ {{CLINE_RULES}}
105
+ {{CLINE_METADATA}}`,Yf=`You are Cline, a careful and helpful coding agent that works in the background.
106
+ You are tasked to solve an issue reported by the user who you cannot communicate with directly.
107
+ Your goal is to utilize the tools at your disposal to investigate and answer the question according to user's instructions with the aim to verify that the issue is resolved.
108
+
109
+ RULES:
110
+ - Always match output format exactly as shown in examples or existing files.
111
+ - Use only libraries and frameworks that are confirmed and compatible to be in use in the current codebase.
112
+ - Provide complete and functional code without omissions or placeholders.
113
+ - During thinking stage, show your planning process. Keep the plan to one short paragraph.
114
+ - Be proactive and avoid overthinking. Once the next action is clear, execute it. Do not seek perfect certainty, repeatedly compare alternatives, or revisit settled decisions without new evidence. Use focused tool calls to resolve uncertainty.
115
+ - If repeated fixes fail without new evidence, stop making similar edits. Test your assumptions with a focused check or minimal reproduction, then adjust your approach based on the result.
116
+ - Put complete code, commands, and edit payloads in the tool arguments. Do not draft them in full in your plan if you can execute them directly.
117
+ - Provide text response when it adds value: a brief plan summary for multi-step work, a meaningful progress update, concise task notes, a blocker, or the final result. Routine tool calls need no text preamble. Keep plan summaries and progress updates to one short paragraph, reporting decisions and new evidence rather than internal deliberation.
118
+ - Keep task notes focused on confirmed facts, decisions, and remaining work. Update existing notes when possible instead of repeating the task history.
119
+ - Always use absolute paths when referring to files.
120
+ - You can call multiple tools in a single response. Before using tools, identify every independent read, search, command, or edit needed for the next step and emit all of those tool calls now, either as multiple tool calls or as one batched input for tools that accept arrays. Do not wait for one independent result before requesting another. Do not split independent reads, searches, checks, or edits across separate turns.
121
+ - Good parallelism examples: read all known relevant files in one read_files call; run independent inspection commands in one run_commands call; emit independent read_files, search_codebase, and run_commands calls together in one response; emit multiple editor calls together when editing different files or non-overlapping regions.
122
+ - Always verify the files you have edited or created at the end of the task to ensure they are completed and working as expected.
123
+
124
+ Environment you are running in:
125
+ <env>
126
+ 1. Platform: {{PLATFORM_NAME}}
127
+ 2. Date: {{CURRENT_DATE}}
128
+ 3. IDE: {{IDE_NAME}}
129
+ 4. Working Directory: {{CWD}}
130
+ </env>
131
+
132
+ IMPORTANT:
133
+ - When the user describes a bug, unexpected behavior, or provides a bug report, your primary goal is to produce a correct fix in the source code that resolves the issue.
134
+ - A correct fix means the underlying behavior is fixed — not just the symptoms addressed superficially.
135
+ - Verify by execution, never by assumption. Before considering any task done, gather concrete evidence from your own tool output that every requirement is satisfied:
136
+ - If a test suite, tests, or assertions are provided or referenced, run them and confirm they pass. If they fail, analyze the failures, revise, and re-run until they pass.
137
+ - If no tests are provided, construct your own verification: actually run the program, script, or command you produced; confirm every required output file exists at the exact path requested; and confirm its contents match the expected format, data types, and values described in the task. Read the output back to confirm.
138
+ - Treat "this should work", "assume it works", or "probably correct" as a signal that you have NOT verified yet — go run the check instead of finishing.
139
+ - Do not consider the task complete until you have observed evidence that all stated requirements are met.
140
+ - Always includes tool calls in your response until the task is completed. You should only end the task when all the requirements are met by calling the 'submit_and_exit' tool.
141
+ - When you call 'submit_and_exit', set 'verified' to true only if your tool output shows the requirements are met; otherwise set it to false.
142
+ - Response without the submit_and_exit tool call will considered not completed and the task will continue.
143
+ {{CLINE_RULES}}
144
+ {{CLINE_METADATA}}`,Gr={ACT:Gf,YOLO:Yf},hn="# Workspace Configuration",f5=`# Plan / Act Modes
145
+
146
+ User messages arrive wrapped in a <user_input mode="..."> tag. The mode attribute is the interaction mode the user was in when they sent that message: "plan" means plan-mode constraints applied (explore, analyze, and align on a plan -- no edits or state-changing commands), while "act" (or "yolo") means implementation was allowed. If the mode attribute changes between messages, the user switched modes -- the newest message's mode is what governs right now, regardless of what earlier messages allowed. A <mode_notice> block inside a message marks exactly when such a switch happened.`,Qo=`# Plan Mode
147
+
148
+ You are in Plan mode. Your role is to explore, analyze, and plan -- not to execute.
149
+
150
+ - Read files, search the codebase, and gather context to understand the problem
151
+ - Ask clarifying questions when requirements are ambiguous
152
+ - Present your plan as a structured outline with clear steps
153
+ - Explain tradeoffs between different approaches when they exist
154
+ - Do NOT edit files, write code, run destructive commands, or make any changes
155
+ - Do NOT implement anything -- focus on understanding and alignment first
156
+
157
+ The run_commands tool remains available in plan mode strictly for read-only inspection -- listing files, searching (grep), reading configs, inspecting git history and diffs, checking tool versions, and the like. Never use it to change anything: no creating, modifying, or deleting files, no writing scripts that make changes, and no state-changing commands (installs, migrations, database or schema changes, container commands that mutate state, etc.). File-editing commands (rm/mv/cp, in-place edits like sed -i, output redirection to files outside /tmp, git commands that change the working tree, package installs) are hard-blocked in plan mode: they are not executed and return a tool error instead, so do not attempt them. If the task requires a mutation, put it in the plan; it happens only after the user switches to act mode.`,y5=`${Qo}
158
+
159
+ Once the user has reviewed your plan and explicitly approved it in a follow-up message, use the switch_to_act_mode tool to switch to act mode and begin implementation. Calling switch_to_act_mode immediately starts execution, so never call it in the same turn you present a plan and never treat the original task request as approval -- end your turn after presenting the plan and wait for the user's response.`,x5=`${Qo}
160
+
161
+ Once you have presented your plan, end your turn and wait for the user's response. You do NOT have the ability to switch to act mode yourself -- the user must do it manually with the Plan/Act toggle once they are satisfied with the plan. If the task requires tools that are only available in act mode, ask the user to "toggle to Act mode" (use those words).`;function Xf(e){let t=e.indexOf("://");if(t<1)return e;let n=t+3,r=n;while(r<e.length){let o=e[r];if(o==="/"||o==="?"||o==="#"||o.charCodeAt(0)<=32)break;r++}let i=e.lastIndexOf("@",r-1);if(i<n)return e;return e.slice(0,n)+e.slice(i+1)}function Z6(e){return JSON.stringify({workspaces:{[e.rootPath]:{hint:e.hint,associatedRemoteUrls:e.associatedRemoteUrls?.map(Xf),latestGitCommitHash:e.latestGitCommitHash,latestGitBranchName:e.latestGitBranchName}}},null,2)}function Yr(e,t,n){if(n?.trim()?.includes(hn))return n.trim();let r=n||JSON.stringify({workspaces:{[e]:{hint:t||e.split("/").at(-1)||e}}},null,2);return`
162
+ ${hn}
163
+ ${r}`}function eE(e){let{ide:t="Terminal Shell",mode:n,platform:r="unknown",workspaceName:i,metadata:o,rules:a,overridePrompt:s,providerId:l,planModeSwitchTool:u=!0}=e,d=e.workspaceRoot??e.rootPath??"",p=Pn(l||"");if(s?.trim()){let g=s.trim();if(p&&o?.trim()&&!g.includes(hn))return`${g}
164
+
165
+ ${Yr(d,i,o)}`.trim();return g}let f=n==="yolo"?Gr.YOLO:Gr.ACT,m=[a,n==="yolo"?void 0:f5,n==="plan"?u?y5:x5:void 0].filter(Boolean).join(`
166
+
167
+ `);return f.replace("{{PLATFORM_NAME}}",r).replace("{{CWD}}",d).replace("{{CURRENT_DATE}}",new Date().toLocaleDateString()).replace("{{IDE_NAME}}",t).replace("{{CLINE_METADATA}}",p?Yr(d,i,o):"").replace("{{CLINE_RULES}}",m).trim()}function tE(e){return e?.metadata?.apiKeyOptional===!0}function wf(e){let t=e?.metadata?.localCliCommand;if(typeof t!=="string"||!t.trim())return;return{command:t.trim(),docsUrl:e?.docsUrl}}var ip="anthropic/claude-sonnet-5.5";async function Qf(e){try{return await ie.access(e),!0}catch{return!1}}class ea{filePath;constructor(e){this.filePath=e}async read(){try{return JSON.parse(await ie.readFile(this.filePath,"utf8"))}catch(e){if(e.code==="ENOENT")return;throw e}}async write(e){await ie.mkdir(gn.dirname(this.filePath),{recursive:!0}),await ie.writeFile(this.filePath,JSON.stringify(e,null,2),"utf8")}async clear(){await ie.rm(this.filePath,{force:!0})}}class Bn{async writeText(e,t){await ie.mkdir(gn.dirname(e),{recursive:!0}),await ie.writeFile(e,t,"utf8")}async remove(e){await ie.rm(e,{recursive:!0,force:!0})}async removeChildren(e){if(!await Qf(e))return;let t=await ie.readdir(e);await Promise.all(t.map((n)=>ie.rm(gn.join(e,n),{recursive:!0,force:!0})))}}var yn=new TextEncoder,nm={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"},rm=new Set(["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"]);class Fn{constructor({accessKeyId:e,secretAccessKey:t,sessionToken:n,service:r,region:i,cache:o,retries:a,initRetryMs:s}){if(e==null)throw TypeError("accessKeyId is a required option");if(t==null)throw TypeError("secretAccessKey is a required option");this.accessKeyId=e,this.secretAccessKey=t,this.sessionToken=n,this.service=r,this.region=i,this.cache=o||new Map,this.retries=a!=null?a:10,this.initRetryMs=s||50}async sign(e,t){if(e instanceof Request){let{method:i,url:o,headers:a,body:s}=e;if(t=Object.assign({method:i,url:o,headers:a},t),t.body==null&&a.has("Content-Type"))t.body=s!=null&&a.has("X-Amz-Content-Sha256")?s:await e.clone().arrayBuffer();e=o}let n=new ta(Object.assign({url:e.toString()},t,this,t&&t.aws)),r=Object.assign({},t,await n.sign());delete r.aws;try{return new Request(r.url.toString(),r)}catch(i){if(i instanceof TypeError)return new Request(r.url.toString(),Object.assign({duplex:"half"},r));throw i}}async fetch(e,t){for(let n=0;n<=this.retries;n++){let r=fetch(await this.sign(e,t));if(n===this.retries)return r;let i=await r;if(i.status<500&&i.status!==429)return i;await new Promise((o)=>setTimeout(o,Math.random()*this.initRetryMs*Math.pow(2,n)))}throw Error("An unknown error occurred, ensure retries is not negative")}}class ta{constructor({method:e,url:t,headers:n,body:r,accessKeyId:i,secretAccessKey:o,sessionToken:a,service:s,region:l,cache:u,datetime:d,signQuery:p,appendSessionToken:f,allHeaders:m,singleEncode:g}){if(t==null)throw TypeError("url is a required option");if(i==null)throw TypeError("accessKeyId is a required option");if(o==null)throw TypeError("secretAccessKey is a required option");this.method=e||(r?"POST":"GET"),this.url=new URL(t),this.headers=new Headers(n||{}),this.body=r,this.accessKeyId=i,this.secretAccessKey=o,this.sessionToken=a;let y,T;if(!s||!l)[y,T]=im(this.url,this.headers);if(this.service=s||y||"",this.region=l||T||"us-east-1",this.cache=u||new Map,this.datetime=d||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=p,this.appendSessionToken=f||this.service==="iotdevicegateway",this.headers.delete("Host"),this.service==="s3"&&!this.signQuery&&!this.headers.has("X-Amz-Content-Sha256"))this.headers.set("X-Amz-Content-Sha256","UNSIGNED-PAYLOAD");let b=this.signQuery?this.url.searchParams:this.headers;if(b.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken)b.set("X-Amz-Security-Token",this.sessionToken);if(this.signableHeaders=["host",...this.headers.keys()].filter((C)=>m||!rm.has(C)).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map((C)=>C+":"+(C==="host"?this.url.host:(this.headers.get(C)||"").replace(/\s+/g," "))).join(`
168
+ `),this.credentialString=[this.datetime.slice(0,8),this.region,this.service,"aws4_request"].join("/"),this.signQuery){if(this.service==="s3"&&!b.has("X-Amz-Expires"))b.set("X-Amz-Expires","86400");b.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),b.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),b.set("X-Amz-SignedHeaders",this.signedHeaders)}if(this.service==="s3")try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch(C){this.encodedPath=this.url.pathname}else this.encodedPath=this.url.pathname.replace(/\/+/g,"/");if(!g)this.encodedPath=encodeURIComponent(this.encodedPath).replace(/%2F/g,"/");this.encodedPath=ei(this.encodedPath);let D=new Set;this.encodedSearch=[...this.url.searchParams].filter(([C])=>{if(!C)return!1;if(this.service==="s3"){if(D.has(C))return!1;D.add(C)}return!0}).map((C)=>C.map((N)=>ei(encodeURIComponent(N)))).sort(([C,N],[S,q])=>C<S?-1:C>S?1:N<q?-1:N>q?1:0).map((C)=>C.join("=")).join("&")}async sign(){if(this.signQuery){if(this.url.searchParams.set("X-Amz-Signature",await this.signature()),this.sessionToken&&this.appendSessionToken)this.url.searchParams.set("X-Amz-Security-Token",this.sessionToken)}else this.headers.set("Authorization",await this.authHeader());return{method:this.method,url:this.url,headers:this.headers,body:this.body}}async authHeader(){return["AWS4-HMAC-SHA256 Credential="+this.accessKeyId+"/"+this.credentialString,"SignedHeaders="+this.signedHeaders,"Signature="+await this.signature()].join(", ")}async signature(){let e=this.datetime.slice(0,8),t=[this.secretAccessKey,e,this.region,this.service].join(),n=this.cache.get(t);if(!n){let r=await Je("AWS4"+this.secretAccessKey,e),i=await Je(r,this.region),o=await Je(i,this.service);n=await Je(o,"aws4_request"),this.cache.set(t,n)}return Wt(await Je(n,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,Wt(await Xr(await this.canonicalString()))].join(`
169
+ `)}async canonicalString(){return[this.method.toUpperCase(),this.encodedPath,this.encodedSearch,this.canonicalHeaders+`
170
+ `,this.signedHeaders,await this.hexBodyHash()].join(`
171
+ `)}async hexBodyHash(){let e=this.headers.get("X-Amz-Content-Sha256")||(this.service==="s3"&&this.signQuery?"UNSIGNED-PAYLOAD":null);if(e==null){if(this.body&&typeof this.body!=="string"&&!("byteLength"in this.body))throw Error("body must be a string, ArrayBuffer or ArrayBufferView, unless you include the X-Amz-Content-Sha256 header");e=Wt(await Xr(this.body||""))}return e}}async function Je(e,t){let n=await crypto.subtle.importKey("raw",typeof e==="string"?yn.encode(e):e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return crypto.subtle.sign("HMAC",n,yn.encode(t))}async function Xr(e){return crypto.subtle.digest("SHA-256",typeof e==="string"?yn.encode(e):e)}var Qr=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function Wt(e){let t=new Uint8Array(e),n="";for(let r=0;r<t.length;r++){let i=t[r];n+=Qr[i>>>4&15],n+=Qr[i&15]}return n}function ei(e){return e.replace(/[!'()*]/g,(t)=>"%"+t.charCodeAt(0).toString(16).toUpperCase())}function im(e,t){let{hostname:n,pathname:r}=e;if(n.endsWith(".on.aws")){let s=n.match(/^[^.]{1,63}\.lambda-url\.([^.]{1,63})\.on\.aws$/);return s!=null?["lambda",s[1]||""]:["",""]}if(n.endsWith(".r2.cloudflarestorage.com"))return["s3","auto"];if(n.endsWith(".backblazeb2.com")){let s=n.match(/^(?:[^.]{1,63}\.)?s3\.([^.]{1,63})\.backblazeb2\.com$/);return s!=null?["s3",s[1]||""]:["",""]}let i=n.replace("dualstack.","").match(/([^.]{1,63})\.(?:([^.]{0,63})\.)?amazonaws\.com(?:\.cn)?$/),o=i&&i[1]||"",a=i&&i[2];if(a==="us-gov")a="us-gov-west-1";else if(a==="s3"||a==="s3-accelerate")a="us-east-1",o="s3";else if(o==="iot")if(n.startsWith("iot."))o="execute-api";else if(n.startsWith("data.jobs.iot."))o="iot-jobs-data";else o=r==="/mqtt"?"iotdevicegateway":"iotdata";else if(o==="autoscaling"){let s=(t.get("X-Amz-Target")||"").split(".")[0];if(s==="AnyScaleFrontendService")o="application-autoscaling";else if(s==="AnyScaleScalingPlannerFrontendService")o="autoscaling-plans"}else if(a==null&&o.startsWith("s3-"))a=o.slice(3).replace(/^fips-|^external-1/,""),o="s3";else if(o.endsWith("-fips"))o=o.slice(0,-5);else if(a&&/-\d$/.test(o)&&!/-\d$/.test(a))[o,a]=[a,o];return[nm[o]||o,a||""]}var b5="enterprise.blobUpload",Ct=new Map;function Kt(e,t){return{adapterType:e,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,region:t.region,bucket:t.bucket,endpoint:t.endpoint,accountId:t.accountId}}function na(e){return{adapterType:e.adapterType,bucket:e.bucket,region:e.region,endpoint:e.endpoint,accountId:e.accountId}}function om(e){if(!e||e.enabled!==!0)return;if(e.type==="s3_access_keys"&&e.s3AccessSettings)return Kt("s3",e.s3AccessSettings);if(e.type==="r2_access_keys"&&e.r2AccessSettings)return Kt("r2",e.r2AccessSettings);if(e.type==="azure_access_keys"&&e.azureAccessSettings)return Kt("azure",e.azureAccessSettings);return}function ra(e){return om(e?.enterpriseTelemetry?.promptUploading)}function iE(e,t){let n=ra(e);if(!n)return;return{version:1,storage:na(n),userDistinctId:t}}function nE(e,t,n){let r=ra(t);if(!r){Ct.delete(e);return}return Ct.set(e,r),{version:1,storage:na(r),userDistinctId:n}}function aE(e){Ct.delete(e)}function ia(e,t,n){let r=`${t}/${n}`;return{async write(i,o){let a=await e.fetch(`${r}/${i}`,{method:"PUT",body:o,headers:{"Content-Type":"application/json; charset=utf-8"}});if(!a.ok)throw Error(`Failed to write ${i}: ${a.status}`)}}}function am(e){let{bucket:t,accessKeyId:n,secretAccessKey:r}=e;if(!t||!n||!r)return;let i=e.region||"us-east-1",o=e.endpoint||`https://s3.${i}.amazonaws.com`;return ia(new Fn({region:i,accessKeyId:n,secretAccessKey:r}),o,t)}function sm(e){let{accountId:t,endpoint:n,bucket:r,accessKeyId:i,secretAccessKey:o}=e;if(!n&&!t||!r||!i||!o)return;return ia(new Fn({accessKeyId:i,secretAccessKey:o}),e.endpoint??`https://${t}.r2.cloudflarestorage.com`,r)}function lm(e,t,n,r,i){let o=i["Content-Length"]||"",a=i["Content-Type"]||"",s=Object.entries(i).filter(([f])=>f.toLowerCase().startsWith("x-ms-")).sort(([f],[m])=>f.toLowerCase().localeCompare(m.toLowerCase())).map(([f,m])=>`${f.toLowerCase()}:${m}`).join(`
172
+ `),l=`/${e}${r}`,u=[n,"","",o,"",a,"","","","","","",s,l].join(`
173
+ `),d=Buffer.from(t,"base64"),p=em("sha256",d).update(u,"utf8").digest("base64");return`SharedKey ${e}:${p}`}function um(e){let{accessKeyId:t,secretAccessKey:n,bucket:r}=e;if(!t||!n||!r)return;let i=e.endpoint||`https://${t}.blob.core.windows.net`;return{async write(o,a){let s=`/${r}/${o}`,l=new Date().toUTCString(),u=Buffer.from(a,"utf8"),d={"x-ms-date":l,"x-ms-version":"2024-11-04","x-ms-blob-type":"BlockBlob","Content-Type":"application/json; charset=utf-8","Content-Length":u.byteLength.toString()};d.Authorization=lm(t,n,"PUT",s,d);let p=await fetch(`${i}${s}`,{method:"PUT",body:u,headers:d});if(!p.ok){let f=await p.text().catch(()=>"");throw Error(`Failed to write ${o}: ${p.status} ${f}`.trim())}}}}function cm(e){if(e.adapterType==="s3")return am(e);if(e.adapterType==="r2")return sm(e);if(e.adapterType==="azure")return um(e);return}function ti(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function v5(e){let t=e?.metadata?.[b5];if(!ti(t))return;let n=t.storage;if(!ti(n))return;let r=n.adapterType;if(r!=="s3"&&r!=="r2"&&r!=="azure")return;if(typeof n.bucket!=="string")return;return{version:1,storage:{adapterType:r,bucket:n.bucket,region:typeof n.region==="string"?n.region:void 0,endpoint:typeof n.endpoint==="string"?n.endpoint:void 0,accountId:typeof n.accountId==="string"?n.accountId:void 0},keyPrefix:typeof t.keyPrefix==="string"?t.keyPrefix:void 0,userDistinctId:typeof t.userDistinctId==="string"?t.userDistinctId:void 0}}function dm(e,t,n){return["sessions",n.userDistinctId?.trim()||"unknown",e,t?.endsWith("messages.json")?"messages.json":tm(t)].filter((r)=>Boolean(r?.trim())).join("/")}function oE(){let e=new Map;return{async uploadMessagesFile({sessionId:t,path:n,contents:r,row:i}){let o=v5(i);if(!o)return;let a=Ct.get(t);if(!a)return;let s=JSON.stringify(a),l=e.get(s);if(!l){if(l=cm(a),!l)return;e.set(s,l)}await l.write(dm(t,n,o),r)}}}function ni(e,t,n){return{id:`remote-config:${e}:${n}:${t.name}`,name:t.name,kind:e,contents:t.contents,alwaysEnabled:t.alwaysEnabled}}var rE="remote://";function ri(e){let t="",n=!1;for(let r of e.trim().toLowerCase()){let i=r.charCodeAt(0);if(i>=97&&i<=122||i>=48&&i<=57||r==="."||r==="_"||r==="-"){if(n&&t&&t[t.length-1]!=="-")t+="-";n=!1,t+=r}else n=!0;if(t.length>=80)break}while(t.endsWith("-"))t=t.slice(0,-1);while(t.startsWith("-"))t=t.slice(1);return t||"item"}function pm(e){let t=e?.globalRules?.map((r,i)=>ni("rule",r,`${i}`))??[],n=e?.globalWorkflows?.map((r,i)=>ni("workflow",r,`${i}`))??[];return[...t,...n]}function fm(e){return[...pm(e.remoteConfig),...e.managedInstructions??[]]}function mm(e){return e.map((t)=>{let n=`## ${t.name}`,r=t.alwaysEnabled?`_Always enabled_
174
+ `:"";return`${n}
175
+
176
+ ${r}${t.contents.trim()}`}).join(`
177
+
178
+ `)}function Gt(e,t){return e.filter((n)=>n.kind===t)}class oa{async materialize(e){let t=fm(e.bundle),n=Gt(t,"rule"),r=Gt(t,"workflow"),i=Gt(t,"skill");await e.artifactStore.removeChildren(e.paths.workflowsPath),await e.artifactStore.removeChildren(e.paths.skillsPath);let o=[];if(n.length>0)await e.artifactStore.writeText(e.paths.rulesFilePath,mm(n)),o.push(...n.map((a)=>({kind:a.kind,filePath:e.paths.rulesFilePath,id:a.id,name:a.name})));else await e.artifactStore.remove(e.paths.rulesFilePath);for(let a of r){let s=`${e.paths.workflowsPath}/${ri(a.name.replace(/\.(md|markdown|txt)$/i,""))}.md`;await e.artifactStore.writeText(s,a.contents),o.push({kind:a.kind,filePath:s,id:a.id,name:a.name})}for(let a of i){let s=`${e.paths.skillsPath}/${ri(a.name)}/SKILL.md`;await e.artifactStore.writeText(s,a.contents),o.push({kind:a.kind,filePath:s,id:a.id,name:a.name})}return await e.artifactStore.writeText(e.paths.manifestPath,JSON.stringify({source:e.bundle.source,version:e.bundle.version,files:o},null,2)),{paths:e.paths,rulesFilePath:n.length>0?e.paths.rulesFilePath:void 0,files:o}}}var hm="remote-config";function aa(e){let t=e.pluginName??hm,n=xe.join(e.workspacePath,".cline",t);return{pluginName:t,pluginPath:n,workflowsPath:xe.join(n,"workflows"),skillsPath:xe.join(n,"skills"),bundleCachePath:xe.join(n,"cache","bundle.json"),manifestPath:xe.join(n,"managed.json"),rulesFilePath:xe.join(n,"rules.md")}}function gm(e){return{workflowsDirectories:[e.workflowsPath],skillsDirectories:[e.skillsPath]}}function ym(e){if(!e)return;return{enabled:e.openTelemetryEnabled??!1,metricsExporter:e.openTelemetryMetricsExporter,logsExporter:e.openTelemetryLogsExporter,otlpProtocol:e.openTelemetryOtlpProtocol,otlpEndpoint:e.openTelemetryOtlpEndpoint,otlpHeaders:e.openTelemetryOtlpHeaders,otlpMetricsProtocol:e.openTelemetryOtlpMetricsProtocol,otlpMetricsEndpoint:e.openTelemetryOtlpMetricsEndpoint,otlpMetricsHeaders:e.openTelemetryOtlpMetricsHeaders,otlpLogsProtocol:e.openTelemetryOtlpLogsProtocol,otlpLogsEndpoint:e.openTelemetryOtlpLogsEndpoint,otlpLogsHeaders:e.openTelemetryOtlpLogsHeaders,metricExportInterval:e.openTelemetryMetricExportInterval,otlpInsecure:e.openTelemetryOtlpInsecure,logBatchSize:e.openTelemetryLogBatchSize,logBatchTimeout:e.openTelemetryLogBatchTimeout,logMaxQueueSize:e.openTelemetryLogMaxQueueSize}}function sa(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function fe(e,t){let n=e[t];return typeof n==="string"?n:void 0}function ii(e,t){let n=e[t];return typeof n==="boolean"?n:void 0}function ht(e,t){let n=e[t];return typeof n==="number"&&Number.isFinite(n)?n:void 0}function Yt(e,t){let n=e[t];if(!sa(n))return;let r=Object.entries(n).filter((i)=>typeof i[1]==="string");return r.length>0?Object.fromEntries(r):void 0}function vm(e){if(!sa(e))return;let t={enabled:ii(e,"enabled"),metricsExporter:fe(e,"metricsExporter"),logsExporter:fe(e,"logsExporter"),otlpProtocol:fe(e,"otlpProtocol"),otlpEndpoint:fe(e,"otlpEndpoint"),otlpHeaders:Yt(e,"otlpHeaders"),otlpMetricsProtocol:fe(e,"otlpMetricsProtocol"),otlpMetricsEndpoint:fe(e,"otlpMetricsEndpoint"),otlpMetricsHeaders:Yt(e,"otlpMetricsHeaders"),otlpLogsProtocol:fe(e,"otlpLogsProtocol"),otlpLogsEndpoint:fe(e,"otlpLogsEndpoint"),otlpLogsHeaders:Yt(e,"otlpLogsHeaders"),metricExportInterval:ht(e,"metricExportInterval"),otlpInsecure:ii(e,"otlpInsecure"),logBatchSize:ht(e,"logBatchSize"),logBatchTimeout:ht(e,"logBatchTimeout"),logMaxQueueSize:ht(e,"logMaxQueueSize")};return Object.values(t).some((n)=>n!==void 0)?t:void 0}class la{name="remote-config";resolveTelemetry(e,t){return{...ym(e.remoteConfig),...vm(e.telemetry)}}}async function sE(e){let t=aa(e),n=e.artifactStore??new Bn;await n.removeChildren(t.workflowsPath),await n.removeChildren(t.skillsPath),await n.remove(t.rulesFilePath),await n.remove(t.manifestPath),await n.remove(t.bundleCachePath)}function ua(e){return e?.claims}function ca(e,t){if(!e)return[];if(t.claimsMapper)return t.claimsMapper.mapClaimsToRoles(e);return e.roles??[]}function bm(e,t){return{...e,metadata:{...e.metadata??{},paths:t}}}class da{options;constructor(e){this.options=e}async sync(e){let t=await this.options.controlPlane.fetchBundle({workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:this.options.logger});if(!t)throw Error("Remote config control plane returned no bundle");await this.options.bundleStore.write(t);let n=await this.options.materializer.materialize({bundle:t,paths:e.paths,artifactStore:this.options.artifactStore}),r=this.options.telemetryAdapter?await this.options.telemetryAdapter.resolveTelemetry(t,{workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:this.options.logger}):void 0,i=ua(t),o=ca(i,this.options);return{bundle:t,materialized:n,telemetry:r,roles:o,claims:i}}}function Em(e){let t=e?.name??"remote-config";return{name:t,manifest:{capabilities:["providers"]},async setup(n,r){n.registerProvider?.({name:t,description:"Remote-config managed runtime integration"}),await e?.setup?.(n,r)}}}async function cE(e){let t=aa({workspacePath:e.workspacePath,pluginName:e.pluginName}),n=e.bundleStore??new ea(t.bundleCachePath),r=e.artifactStore??new Bn,i=e.materializer??new oa,o=e.telemetryAdapter??new la,a,s,l=[],u,d=!1,p=!1;if(e.controlPlane){let m=new da({controlPlane:e.controlPlane,bundleStore:n,artifactStore:r,materializer:i,telemetryAdapter:o,claimsMapper:e.claimsMapper,logger:e.logger});try{let g=await m.sync({workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,paths:t,signal:e.signal,now:e.now});a=g.bundle,s=g.telemetry,l=g.roles,u=g.claims,p=!0}catch(g){if(e.useCachedBundle!==!1)a=await n.read(),d=Boolean(a);if(!a)throw g}}else if(e.useCachedBundle!==!1)a=await n.read(),d=Boolean(a);if(!a&&e.requireBundle)throw Error("Remote config runtime preparation requires a bundle");if(a){let m=bm(a,t);if(await n.write(m),!p)await i.materialize({bundle:m,paths:t,artifactStore:r});u??=ua(m),l=l.length>0?l:ca(u,e),s??=await o.resolveTelemetry(m,{workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:e.logger}),a=m}let f=gm(t);return{pluginName:t.pluginName,pluginDefinition:Em({name:t.pluginName}),paths:t,bundle:a,telemetry:s,roles:l,claims:u,usedCachedBundle:d,workflowsDirectories:f.workflowsDirectories,skillsDirectories:f.skillsDirectories}}var w5=v({id:c(),temperature:_().optional(),maxTokens:_().optional(),contextWindow:_().optional(),inputPrice:_().optional(),outputPrice:_().optional(),supportsImages:A().optional()}),k5=v({models:I(w5).optional(),openAiBaseUrl:c().optional(),openAiHeaders:H(c(),c()).optional(),azureApiVersion:c().optional(),azureIdentity:A().optional()}),T5=v({id:c(),thinkingBudgetTokens:_().optional()}),_5=v({name:c(),baseModelId:c(),thinkingBudgetTokens:_().optional()}),I5=v({models:I(T5).optional(),customModels:I(_5).optional(),awsRegion:c().optional(),awsUseCrossRegionInference:A().optional(),awsUseGlobalInference:A().optional(),awsBedrockUsePromptCache:A().optional(),awsBedrockEndpoint:c().optional()}),S5=v({id:c()}),E5=v({models:I(S5).optional()}),R5=v({id:c(),thinkingBudgetTokens:_().optional()}),O5=v({models:I(R5).optional(),vertexProjectId:c().optional(),vertexRegion:c().optional()}),A5=v({id:c(),thinkingBudgetTokens:_().optional(),promptCachingEnabled:A().optional()}),C5=v({models:I(A5).optional(),baseUrl:c().optional()}),P5=v({id:c(),thinkingBudgetTokens:_().optional()}),D5=v({models:I(P5).optional(),baseUrl:c().optional()}),Sm=v({OpenAiCompatible:k5.optional(),AwsBedrock:I5.optional(),Cline:E5.optional(),Vertex:O5.optional(),LiteLLM:C5.optional(),Anthropic:D5.optional()}),W5=v({id:c()}),M5=v({name:c(),url:c(),alwaysEnabled:A().optional(),headers:H(c(),c()).optional()}),uw=v({alwaysEnabled:A(),name:c(),contents:c()}),kf=v({bucket:c(),accessKeyId:c(),secretAccessKey:c(),region:c().optional(),endpoint:c().optional(),accountId:c().optional()}),N5=v({enabled:A().optional(),type:Ne([Z("s3_access_keys"),Z("r2_access_keys"),Z("azure_access_keys")]).optional(),s3AccessSettings:kf.optional(),r2AccessSettings:kf.optional(),azureAccessSettings:kf.optional()}),L5=v({promptUploading:N5.optional()}),lE=v({version:c(),providerSettings:Sm.optional(),telemetryEnabled:A().optional(),kanbanEnabled:A().optional(),mcpMarketplaceEnabled:A().optional(),allowedMCPServers:I(W5).optional(),remoteMCPServers:I(M5).optional(),blockPersonalRemoteMCPServers:A().optional(),yoloModeAllowed:A().optional(),openTelemetryEnabled:A().optional(),openTelemetryMetricsExporter:c().optional(),openTelemetryLogsExporter:c().optional(),openTelemetryOtlpProtocol:c().optional(),openTelemetryOtlpEndpoint:c().optional(),openTelemetryOtlpHeaders:H(c(),c()).optional(),openTelemetryOtlpMetricsProtocol:c().optional(),openTelemetryOtlpMetricsEndpoint:c().optional(),openTelemetryOtlpMetricsHeaders:H(c(),c()).optional(),openTelemetryOtlpLogsProtocol:c().optional(),openTelemetryOtlpLogsEndpoint:c().optional(),openTelemetryOtlpLogsHeaders:H(c(),c()).optional(),openTelemetryMetricExportInterval:_().optional(),openTelemetryOtlpInsecure:A().optional(),openTelemetryLogBatchSize:_().optional(),openTelemetryLogBatchTimeout:_().optional(),openTelemetryLogMaxQueueSize:_().optional(),enterpriseTelemetry:L5.optional(),globalRules:I(uw).optional(),globalWorkflows:I(uw).optional()}),uE=H(c(),c()),pE=25463,dE=25466,mE=4317,hE="127.0.0.1:4317",gE=O(["reasoning","prompt-cache","tools","provider-tools","oauth","temperature","files","streaming","vision","computer-use","local-auth","popular"]),fE=O(["anthropic","gemini","openai-chat","openai-responses","openai-r1","ai-sdk"]),yE=O(["anthropic","ai-sdk","ai-sdk-community","openai","openai-compatible","openai-r1","gemini","bedrock","custom","fetch","vertex"]),xE="runtime.team.progress.v1",bE="runtime.team.lifecycle.v1",Tf="CLINE_BUILD_ENV",B5="CLINE_DEBUG_HOST",U5="CLINE_DEBUG_PORT_BASE";function pa(e){let t=e?.trim().toLowerCase();if(t==="development"||t==="production")return t;return}function Am(e){for(let t=0;t<e.length;t+=1){let n=e[t]?.trim();if(!n)continue;if(n==="--conditions"&&e[t+1]?.trim()==="development")return!0;if(n.startsWith("--conditions=")&&n.slice(13).split(",").map((r)=>r.trim()).includes("development"))return!0}return!1}function xm(e){if(!e?.trim())return!1;let t=Om(e).toLowerCase();return t==="node"||t==="node.exe"||t==="bun"||t==="bun.exe"}function Cm(e){return e.some((t)=>t==="--inspect"||t.startsWith("--inspect=")||t==="--inspect-brk"||t.startsWith("--inspect-brk="))}function Nm(e){return e.some((t)=>t==="--enable-source-maps")}function Pm(e){return e[B5]?.trim()||"127.0.0.1"}function Rm(e){let t=e[U5]?.trim();if(!t)return;let n=Number.parseInt(t,10);return Number.isInteger(n)&&n>0?n:void 0}function zm(e){switch(e){case"rpc":return 0;case"hook":return 1;case"plugin-sandbox":return 2;case"connector":return 3;case"sandbox":return 4;default:return 9}}function pw(e={}){let t=e.env??process.env,n=e.execArgv??process.execArgv,r=pa(t[Tf]);if(r)return r;let i=t.NODE_ENV?.trim().toLowerCase();if(i==="production")return"production";if(i==="development")return"development";return Am(n)?"development":"production"}function vE(e=process.env,t={}){if(pa(e[Tf]))return e;return{...e,[Tf]:pw({env:e,execArgv:t.execArgv})}}function wE(e,t={}){if(e.length===0||!xm(e[0]))return[...e];if(pw(t)!=="development")return[...e];let n=t.env??process.env,r=[...n.NODE_OPTIONS?.split(/\s+/).filter(Boolean)??[],...e.slice(1)],i=[];if(!Cm(r)){let o=Pm(n),a=Rm(n),s=a===void 0?0:a+zm(t.debugRole);i.push(`--inspect=${o}:${s}`)}if(!Nm(r))i.push("--enable-source-maps");return[e[0],...i,...e.slice(1)]}function kE(e){let t=e?.trim();if(!t)return!1;if(t.startsWith("/$bunfs/"))return!0;return t.replace(/\\/g,"/").toLowerCase().startsWith("b:/~bun/")}function fa(){return globalThis}function TE(e){fa().__clineClientIdentity=e}function _f(){return fa().__clineClientIdentity}var _E="CLINE_ENVIRONMENT",IE="CLINE_ENVIRONMENT_OVERRIDE",dw={production:{environment:"production",appBaseUrl:"https://app.cline.bot",apiBaseUrl:"https://api.cline.bot",mcpBaseUrl:"https://api.cline.bot/v1/mcp",workOsClientId:"client_01K3A541FN8TA3EPPHTD2325AR"},staging:{environment:"staging",appBaseUrl:"https://staging-app.cline.bot",apiBaseUrl:"https://core-api.staging.int.cline.bot",mcpBaseUrl:"https://core-api.staging.int.cline.bot/v1/mcp",workOsClientId:"client_01K3A5415VF6QBQBG3XYCW91G6"},local:{environment:"local",appBaseUrl:"http://localhost:3000",apiBaseUrl:"http://localhost:7777",mcpBaseUrl:"http://localhost:7777/v1/mcp",workOsClientId:"client_01K6XQAY7JK6T5HXVSZW2S5VYK"}},SE="production";function oi(e){let t=e?.trim().toLowerCase();if(t==="production"||t==="staging"||t==="local")return t;return}function ma(){if(typeof process>"u"||!process?.env)return{};return process.env}function F5(){let e=ma();return oi(e.CLINE_ENVIRONMENT_OVERRIDE)??oi(e.CLINE_ENVIRONMENT)??"production"}function $m(e){if(typeof e==="string")return dw[e];return dw[F5()]}function Lm(e,t){if(t.CLINE_API_BASE_URL)e={...e,apiBaseUrl:t.CLINE_API_BASE_URL,mcpBaseUrl:`${t.CLINE_API_BASE_URL}/v1/mcp`};return e}function dc(e){let t=$m(e);return Lm(t,ma())}var EE="CLINE_RUN_AS_HUB_DAEMON",RE="CLINE_CONNECTOR_CLI_LAUNCH",OE="CLINE_CONNECTOR_STARTING_INSTANCE",AE="CLINE_CONNECTOR_SUPERVISED",CE="CLINE_HUB_LAUNCHER_CLIENT",PE="CLINE_HUB_LAUNCHER_VERSION",DE="CLINE_HUB_LAUNCHER_TRANSPORT";function WE(e,t){if(e.CLINE_HUB_LAUNCHER_CLIENT?.trim())return e;let n=t?.client?.trim();if(!n)return e;let r=t?.version?.trim();return{...e,["CLINE_HUB_LAUNCHER_CLIENT"]:n,...r?{["CLINE_HUB_LAUNCHER_VERSION"]:r}:{},["CLINE_HUB_LAUNCHER_TRANSPORT"]:t?.transport??"local"}}function ME(e=process.env){let t=j5(e);return delete e.CLINE_HUB_LAUNCHER_CLIENT,delete e.CLINE_HUB_LAUNCHER_VERSION,delete e.CLINE_HUB_LAUNCHER_TRANSPORT,t}function j5(e=process.env){let t=e.CLINE_HUB_LAUNCHER_CLIENT?.trim();if(!t)return;let n=e.CLINE_HUB_LAUNCHER_VERSION?.trim(),r=e.CLINE_HUB_LAUNCHER_TRANSPORT?.trim();return{client:t,...n?{version:n}:{},...r==="ssh"||r==="local"?{transport:r}:{}}}var vn;function NE(e=process.env){return vn=e.CLINE_RUN_AS_HUB_DAEMON==="1",delete e.CLINE_RUN_AS_HUB_DAEMON,vn}function LE(e){if(e)return e.CLINE_RUN_AS_HUB_DAEMON==="1";return vn??process.env.CLINE_RUN_AS_HUB_DAEMON==="1"}function BE(e,t=process.env){t.CLINE_CONNECTOR_CLI_LAUNCH=JSON.stringify(e)}var _n;function UE(e=process.env){return _n=e.CLINE_CONNECTOR_SUPERVISED==="1",delete e.CLINE_CONNECTOR_SUPERVISED,_n}function FE(e){if(e)return e.CLINE_CONNECTOR_SUPERVISED==="1";return _n??process.env.CLINE_CONNECTOR_SUPERVISED==="1"}function jE(e,t=process.env){t.CLINE_CONNECTOR_STARTING_INSTANCE=JSON.stringify(e)}function $E(e=process.env){let t=e.CLINE_CONNECTOR_STARTING_INSTANCE;if(!t)return;try{let n=JSON.parse(t);if(typeof n.channel!=="string"||!n.channel.trim()||typeof n.instanceId!=="string"||!n.instanceId.trim())return;return{channel:n.channel,instanceId:n.instanceId}}catch{return}}function qE(e=process.env){let t=e.CLINE_CONNECTOR_CLI_LAUNCH;if(!t)return;try{let n=JSON.parse(t);if(typeof n.launcher!=="string"||!n.launcher.trim()||!Array.isArray(n.connectArgsPrefix)||!n.connectArgsPrefix.every((r)=>typeof r==="string")||typeof n.cwd!=="string"||!n.cwd.trim())return;return{launcher:n.launcher,connectArgsPrefix:n.connectArgsPrefix,cwd:n.cwd}}catch{return}}var Mm=["HTTP_PROXY","http_proxy","HTTPS_PROXY","https_proxy","ALL_PROXY","all_proxy"],$5=["localhost","127.0.0.1","::1","[::1]"];function Dm(e){for(let t of Mm){let n=e[t]?.trim();if(n)return n}return}function bn(e){return(e??"").split(",").map((t)=>t.trim()).filter((t)=>t.length>0)}function Um(e,t){let n=[],r=new Set;for(let i of[...bn(e),...bn(t),...$5]){let o=i.toLowerCase();if(o!=="*"&&!r.has(o))r.add(o),n.push(i)}return n.join(",")}function ai(e){return bn(e).includes("*")}function zE(e=process.env){if(!Dm(e))return;let t=ai(e.NO_PROXY),n=ai(e.no_proxy);if(t&&n)return;let r=Um(e.NO_PROXY,e.no_proxy);if(!t)e.NO_PROXY=r;if(!n)e.no_proxy=r}var GE="NoDefaultCurrentDirectoryInExePath";function VE(e={}){let{env:t=process.env,platform:n=process.platform}=e;if(n!=="win32")return;t.NoDefaultCurrentDirectoryInExePath="1"}var KE="agent.reasoning.unexpected_tokens",If="task.provider_request_started",Sf="task.provider_stream_started",Ef="task.first_chunk_received",Rf="task.provider_stream_failed",Of="task.cancelled",nl="task.max_tokens_recovery",HE=["initial","crash_restart","rollout_fallback","rollout_demotion","user_restart"],QE="sdk.error",Se=new Map;function JE(){Se.clear()}function jm(e,t){let n=typeof t.error_message==="string"?t.error_message:"";return[e,t.component,t.operation,t.error_type,t.error_code??"",t.error_status??"",n.replace(/\d+/g,"#").replace(/\s+/g," ").trim().toLowerCase().slice(0,256)].join("\x00")}function Bm(e){let t=Date.now(),n=Se.get(e);if(n&&t-n.startMs<3600000){if(n.emitted<5)return n.emitted+=1,{emit:!0,suppressed:0};return n.suppressed+=1,{emit:!1,suppressed:n.suppressed}}let r=n?.suppressed??0;if(Se.delete(e),Se.size>=512){let i=Se.keys().next();if(!i.done)Se.delete(i.value)}return Se.set(e,{startMs:t,emitted:1,suppressed:0}),{emit:!0,suppressed:r}}function Af(e,t){e?.capture({event:"agent.reasoning.unexpected_tokens",properties:Zn({sessionId:t.sessionId,agentId:t.agentId,runId:t.runId,iteration:t.iteration,providerId:t.providerId,modelId:t.modelId,requestedThinking:t.requestedThinking,reasoningTokenCount:t.reasoningTokenCount})})}function Cf(e,t){if(!e)return;e.capture({event:t.event,properties:Zn({sessionId:t.sessionId,modelRequestId:t.modelRequestId,ulid:t.ulid??t.sessionId,agentId:t.agentId,conversationId:t.conversationId,runId:t.runId,iteration:t.iteration,provider:t.providerId,providerId:t.providerId,model:t.modelId,modelId:t.modelId,phase:t.phase,durationMs:t.durationMs,eventType:t.eventType,...t.error===void 0?{}:mw(t.error,t.messageLimit),error_class:t.errorClass})})}function al(e,t){if(!e)return!1;let n=t.event??"sdk.error",r=q5(t),i=0;try{let o=Bm(jm(n,r));if(!o.emit)return!0;i=o.suppressed}catch{}return e.capture({event:n,properties:i>0?{...r,suppressed_count:i}:r}),!0}function q5(e){return Zn({...e.context??{},component:e.component,operation:e.operation,severity:e.severity??"error",handled:e.handled??!0,...mw(e.error,e.messageLimit,e.errorMessage)})}function Zn(e){let t={};for(let[n,r]of Object.entries(e))if(r!==void 0)t[n]=r;return t}function mw(e,t=500,n){let r=si(e)?e:void 0,i=e instanceof Error?e:void 0,o=Ye(n)??Ye(i?.message)??Ye(r?.message)??Hm(e)??"Unknown error",a=li(r?.code),s=[],l=new Set([e]),u=r?.cause;while(si(u)&&!l.has(u)&&s.length<8)l.add(u),s.push(u),u=u.cause;let d=s.map((f)=>li(f.code)).find((f)=>f!==void 0),p=Xt(r?.status)??Xt(r?.statusCode)??Xt(r?.responseStatus);return{error_type:i?.name?.trim()||Ye(r?.name)||i?.constructor?.name||"Error",error_message:Zm(Fm(o),t),...a!==void 0?{error_code:a}:{},...d!==void 0?{error_cause_code:d}:{},...typeof r?.isRetryable==="boolean"?{error_retryable:r.isRetryable}:{},...p!==void 0?{error_status:p}:{}}}function Fm(e){return e.replace(/(authorization=Bearer\s+)[^&\s]+/gi,"$1[redacted]").replace(/(api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|password|secret)=([^&\s]+)/gi,"$1=[redacted]").replace(/(Bearer\s+)[A-Za-z0-9._~+/-]+=*/gi,"$1[redacted]").replace(/\/Users\/[^/\s]+/g,"/Users/[redacted]").replace(/\/home\/[^/\s]+/g,"/home/[redacted]").replace(/([A-Za-z]:[\\/]+Users[\\/]+)[^\\/\s]+/g,"$1[redacted]")}function Zm(e,t){let n=Math.max(1,Math.floor(t));return e.length>n?e.substring(0,n):e}function si(e){return typeof e==="object"&&e!==null}function Ye(e){return typeof e==="string"&&e.trim().length>0?e:void 0}function Hm(e){if(e instanceof Error)return;let t=typeof e==="string"?e:String(e);return t==="[object Object]"?void 0:Ye(t)}function li(e){if(typeof e==="string"&&e.trim().length>0)return e;if(typeof e==="number"&&Number.isFinite(e))return e;return}function Xt(e){return typeof e==="number"&&Number.isFinite(e)?e:void 0}var hw="_clineOtlpTraceRelay";function YE(e){e[hw]=!0}function XE(e){return!!e&&typeof e==="object"&&e[hw]===!0}function qm(e){let t={};if(!e)return t;return e.split(",").forEach((n)=>{let r=n.indexOf("=");if(r<=0)return;try{let i=decodeURIComponent(n.substring(0,r).trim()),o=decodeURIComponent(n.substring(r+1).trim());if(!i||!o)return;t[i]=o}catch{}}),t}function Vm(){if(!process.env)return{enabled:!1};return{enabled:process.env.OTEL_TELEMETRY_ENABLED==="1"||process.env.OTEL_TELEMETRY_ENABLED==="true",metricsExporter:process.env.OTEL_METRICS_EXPORTER||"otlp",logsExporter:process.env.OTEL_LOGS_EXPORTER||"otlp",tracesExporter:process.env.OTEL_TRACES_EXPORTER,otlpProtocol:process.env.OTEL_EXPORTER_OTLP_PROTOCOL||"http/json",otlpEndpoint:process.env.OTEL_EXPORTER_OTLP_ENDPOINT,metricExportInterval:process.env.OTEL_METRIC_EXPORT_INTERVAL?Number.parseInt(process.env.OTEL_METRIC_EXPORT_INTERVAL,10):void 0,otlpHeaders:process.env.OTEL_EXPORTER_OTLP_HEADERS?qm(process.env.OTEL_EXPORTER_OTLP_HEADERS):void 0}}function z5(e={}){return{extension_version:"unknown",cline_type:"unknown",platform:"terminal",platform_version:process?.version||"unknown",os_type:process?.platform||"unknown",os_version:process?.platform==="win32"?process?.env?.OS??"unknown":"unknown",...e}}function ZE(e={}){return{...Vm(),...e,metadata:z5(e.metadata)}}var Jm=new Set(["http:","https:"]);function Wm(e){if(!e)return"";try{let t=new URL(e);return Jm.has(t.protocol)&&t.host?t.host:"invalid-endpoint-url"}catch{return"invalid-endpoint-url"}}function e4(e){return{telemetry_selfcheck:!0,enabled:e.enabled===!0,otlp_endpoint_host:Wm(e.otlpEndpoint),logs_exporter:e.logsExporter??"",metrics_exporter:e.metricsExporter??"",traces_exporter:e.tracesExporter??""}}function ha(e){let t=e?.trim();return t?t:void 0}function t4(e,t){if(!e)return;let n=typeof e==="function"?e(t):e;if(!n)return;let r=ha(n.rootSessionId);if(!r)return;return{rootSessionId:r}}function i4(e){return ha(e?.rootSessionId)}var Km=128,he,Re;function Gm(e){if(e<0)throw RangeError("Wrong ID size");try{if(!he||he.length<e)he=Buffer.allocUnsafe(e*Km),ui.getRandomValues(he),Re=0;else if(Re+e>he.length)ui.getRandomValues(he),Re=0}catch(t){throw he=void 0,t}Re+=e}function Ym(e){return Gm(e|=0),he.subarray(Re-e,Re)}function Xm(e,t,n){let r=256-256%e.length;if(r===256){let o=e.length-1;return(a=t)=>{if(!a)return"";let s="";while(!0){let l=n(a),u=a;while(u--)if(s+=e[l[u]&o],s.length>=a)return s}}}let i=Math.ceil(409.6*t/r);return(o=t)=>{if(!o)return"";let a="";while(!0){let s=n(i),l=i;while(l--)if(s[l]<r){if(a+=e[s[l]%e.length],a.length>=o)return a}}}}function Qm(e,t=21){return Xm(e,t,Ym)}function n4(e="",t=""){let n=Qm("1234567890abcdefghijklmnopqrstuvwxyz",10);return`${e}${Date.now()}_${n(5)}${t}`}var a4=["idle","running","pending","completed","failed","cancelled"],gw=["rules","skills","workflows","plugins","hooks"],G5=gw,eh=new Set(gw);function V5(e){return typeof e==="string"&&eh.has(e)}function o4(e){if(!Array.isArray(e))return;let t=e.map((n)=>typeof n==="string"?n.trim():"").filter(V5);return[...new Set(t)]}function r4(e,t){return new Set(e??G5).has(t)}var K5=v({rootPath:c().min(1),hint:c().min(1).optional(),associatedRemoteUrls:I(c().min(1)).optional(),latestGitCommitHash:c().min(1).optional(),latestGitBranchName:c().min(1).optional()}),H5=v({currentWorkspacePath:c().min(1).optional(),workspaces:H(c().min(1),K5)});function s4(){return{workspaces:{}}}function c4(e,t){let n={...e,workspaces:{...e.workspaces,[t.rootPath]:t}};if(!n.currentWorkspacePath)n.currentWorkspacePath=t.rootPath;return H5.parse(n)}var l4="workspaces",u4="chat";function p4(e){let t=e.trim(),n=/^[A-Za-z]:[\\/]/.test(t)||t.startsWith("\\\\"),r=t.startsWith("/");if(!n&&!r)return!1;let i=t.split(n?/[\\/]+/:/\/+/).filter(Boolean),o=i.at(-1)??"",a=i.at(-2)??"",s=i.at(-3)??"";return(i.at(-4)??"")===".cline"&&s==="data"&&a==="workspaces"&&o==="chat"}var Q5=["current_state","boundary_analysis","interface_proposal"],d4=3600000,m4=240,h4=400,ne=Bo((e)=>e instanceof Date?e.toISOString():e,c().datetime()),ze=O(["pending","in_progress","blocked","completed"]),ga=O(["queued","running","completed","failed","cancelled","interrupted"]),Mt=O(["draft","in_review","finalized"]),th=v({agentId:c(),role:O(["lead","teammate"]),description:c().optional(),status:O(["idle","running","stopped"])}),g4=v({agentId:c(),rolePrompt:c(),modelId:c().optional(),maxIterations:_().optional()});function U(e){return Bo((t)=>t===null?void 0:t,e.optional())}var f4=v({agentId:c().min(1).describe("Teammate identifier"),rolePrompt:c().min(1).describe("System prompt describing teammate role")}).strict(),y4=v({agentId:c().min(1).describe("Teammate identifier"),reason:U(c().min(1)).describe("Optional shutdown reason")}),x4=v({}),nh={create:["title","description"],list:[],claim:["taskId"],complete:["taskId","summary"],block:["taskId","reason"]},b4={create:["status","taskId","summary","reason"]},v4=v({action:O(["create","list","claim","complete","block"]),title:U(c().min(1)).describe("Task title"),description:U(c().min(1)).describe("Task details"),dependsOn:U(I(c().describe("Dependency task ID"))).describe("Array of dependency task IDs"),assignee:U(c().min(1)).describe("Optional assignee"),status:U(O(["pending","in_progress","blocked","completed"])).describe("Optional task status filter"),taskId:U(c()).describe("Task ID"),summary:U(c().min(1)).describe("Completion summary"),reason:U(c().min(1)).describe("Blocking reason")}).superRefine((e,t)=>{for(let n of nh[e.action]){if(e[n]!==void 0)continue;t.addIssue({code:"custom",path:[n],message:`Field "${n}" is required when action=${e.action}`})}}),w4=v({agentId:c().describe("Teammate agent ID"),task:c().min(1).describe("Task instructions for the teammate"),taskId:U(c()).describe("Optional shared task list ID"),runMode:U(O(["sync","async"])).describe("Execution mode: 'sync' blocks until the teammate finishes and returns the result (default if omitted); 'async' queues the run and returns a runId immediately — use team_await_runs to collect results later."),continueConversation:U(A()).describe("If true, continue the teammate conversation; otherwise start fresh")}),k4=v({status:U(O(["queued","running","completed","failed","cancelled","interrupted"])).describe("Optional run status filter. Omit to include all statuses."),agentId:U(c().min(1)).describe("Optional teammate ID filter. Omit to include all teammates."),includeCompleted:U(A()).describe("Include completed/failed runs (default true)")}),T4=v({runId:c().min(1).describe("Run ID"),reason:U(c().min(1)).describe("Optional cancellation reason")}),_4=v({runId:U(c().min(1)).describe("Optional async run ID to await. Omit to wait for all active async runs.")}).strict(),I4=v({toAgentId:c().min(1).describe("Recipient agent ID"),subject:c().min(1).describe("Message subject"),body:c().min(1).describe("Message body"),taskId:U(c().min(1)).describe("Optional task ID context")}),S4=v({subject:c().min(1).describe("Message subject"),body:c().min(1).describe("Message body"),taskId:U(c().min(1)).describe("Optional task ID context")}),E4=v({unreadOnly:U(A()).describe("Only unread messages for read action (default true)")}),R4=v({kind:O(["progress","handoff","blocked","decision","done","error"]),summary:c().min(1).describe("Update summary"),taskId:U(c().min(1)).describe("Optional task ID context"),evidence:U(I(c().min(1))).describe("Optional evidence links/snippets"),nextAction:U(c().min(1)).describe("Planned next step")}),O4=v({}),A4=v({title:c().describe("Outcome title"),requiredSections:I(c()).default(Q5).describe("Required sections for finalization gate (defaults to current_state,boundary_analysis,interface_proposal)")}),C4=v({outcomeId:c().describe("Outcome ID"),section:c().describe("Section name"),sourceRunId:U(c()).describe("Optional source run ID"),content:c().describe("Section fragment content")}),P4=v({fragmentId:c().describe("Fragment ID"),approved:A().describe("Review decision")}),D4=v({outcomeId:c().describe("Outcome ID")}),W4=v({}),M4=v({teamId:c(),teamName:c(),members:I(th),taskCounts:H(ze,_()),unreadMessages:_(),missionLogEntries:_(),activeRuns:_(),queuedRuns:_(),outcomeCounts:H(Mt,_())}),J5=v({id:c(),title:c(),description:c(),status:ze,createdAt:ne,updatedAt:ne,createdBy:c(),assignee:c().optional(),dependsOn:I(c()),summary:c().optional(),isReady:A(),blockedBy:I(c())}),N4=Dn("action",[v({action:Z("create"),taskId:c(),status:ze,ignoredFields:I(c()).optional(),note:c().optional()}),v({action:Z("list"),tasks:I(J5)}),v({action:Z("claim"),taskId:c(),status:ze,nextStep:c()}),v({action:Z("complete"),taskId:c(),status:ze}),v({action:Z("block"),taskId:c(),status:ze})]),L4=v({agentId:c(),mode:O(["sync","async"]),status:O(["dispatched","running","queued","joined"]),dispatched:A(),message:c(),deduped:A().optional(),runId:c().optional(),text:c().optional(),iterations:_().optional()}),Y5=v({textPreview:c(),iterations:_(),finishReason:c(),durationMs:_(),usage:v({inputTokens:_(),outputTokens:_(),cacheReadTokens:_().optional(),cacheWriteTokens:_().optional(),totalCost:_().optional()})}),B4=v({id:c(),agentId:c(),taskId:c().optional(),status:ga,messagePreview:c(),priority:_(),retryCount:_(),maxRetries:_(),nextAttemptAt:ne.optional(),continueConversation:A().optional(),startedAt:ne,endedAt:ne.optional(),leaseOwner:c().optional(),heartbeatAt:ne.optional(),lastProgressAt:ne.optional(),lastProgressMessage:c().optional(),currentActivity:c().optional(),error:c().optional(),resultSummary:Y5.optional()}),U4=v({id:c(),teamId:c(),fromAgentId:c(),toAgentId:c(),subject:c(),body:c(),taskId:c().optional(),sentAt:ne,readAt:ne.optional()}),F4=v({id:c(),teamId:c(),title:c(),status:Mt,requiredSections:I(c()),createdBy:c(),createdAt:ne,finalizedAt:ne.optional()}),j4=v({outcomeId:c(),status:Mt,requiredSections:I(c())}),$4=v({agentId:c(),status:c()}),q4=v({runId:c(),status:ga}),z4=v({id:c(),toAgentId:c()}),G4=v({delivered:_()}),V4=v({id:c()}),K4=v({status:c()}),H4=v({fragmentId:c(),status:c()}),Q4=v({outcomeId:c(),status:Mt}),X5;((e)=>{e.TaskStart="task_start",e.TaskEnd="task_end",e.AgentEvent="agent_event",e.TeammateSpawned="teammate_spawned",e.TeammateShutdown="teammate_shutdown",e.TeamTaskUpdated="team_task_updated",e.TeamMessage="team_message",e.TeamMissionLog="team_mission_log",e.TeamTaskCompleted="team_task_completed",e.RunStarted="run_started",e.RunQueued="run_queued",e.RunProgress="run_progress",e.RunCompleted="run_completed",e.RunFailed="run_failed",e.RunCancelled="run_cancelled",e.RunInterrupted="run_interrupted",e.OutcomeCreated="outcome_created",e.OutcomeFragmentAttached="outcome_fragment_attached",e.OutcomeFragmentReviewed="outcome_fragment_reviewed",e.OutcomeFinalized="outcome_finalized"})(X5||={});function rh(e){let{$schema:t,...n}=e;if(typeof n.type==="string")return n;if("properties"in n||"required"in n||"additionalProperties"in n)return{type:"object",...n};for(let r of["oneOf","anyOf","allOf"]){let i=n[r];if(!Array.isArray(i)||i.length===0)continue;if(r==="allOf"){if(i.some((o)=>o&&typeof o==="object"&&o.type==="object"))return{type:"object",...n};throw Error('Tool inputSchema must describe an object at the top level, but the schema has a top-level "allOf" with no branch that asserts type: "object". Add type: "object" to at least one allOf branch to make the object constraint explicit.')}if(i.every((o)=>o&&typeof o==="object"&&o.type==="object"))return{type:"object",...n};throw Error(`Tool inputSchema must describe an object at the top level, but the schema has a top-level "${r}" whose branches include non-object types. Pass the strict object schema as inputSchema and reserve union/coercion schemas for use inside execute().`)}return n}function J4(e){let t=rh(e.inputSchema instanceof z?g5(e.inputSchema):e.inputSchema);return{name:e.name,resultPolicy:e.resultPolicy,description:e.description,inputSchema:t,lifecycle:e.lifecycle,successContext:e.successContext,executionMode:e.executionMode,timeoutMs:e.timeoutMs??30000,retryable:e.retryable??!0,maxRetries:e.maxRetries??3,execute:e.execute}}var Z5=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function Y4(e){let t=(e instanceof Error?e.message:String(e)).toLowerCase();return Z5.some((n)=>t.includes(n))}var ch=new Set(["accesskeyid","secretaccesskey","idtoken","refreshtoken","accesstoken","access_token","refresh_token","apikey","api_key","authorization","password","secret","token","email","displayname","display_name","userinfo"]),dh=["id","balance","cost","secret"];function ph(e){let t=e.toLowerCase();if(ch.has(t))return!0;for(let n of dh){if(t===n)return!0;if(t.endsWith(n)&&t.length>n.length){let r=t[t.length-n.length-1];if(r==="_"||r==="-")return!0;let i=e[e.length-n.length];if(i&&i===i.toUpperCase()&&i!==i.toLowerCase())return!0}if(t.endsWith(`_${n}`))return!0}return!1}var fh=[{pattern:/AKIA[A-Z0-9]{16}/g,replacement:"AKIA_REDACTED"},{pattern:/\/Users\/[A-Za-z0-9._-]+/g,replacement:"/Users/REDACTED_USER"},{pattern:/\/home\/[A-Za-z0-9._-]+/g,replacement:"/home/REDACTED_USER"}];function ya(e){let t=e;for(let{pattern:n,replacement:r}of fh)t=t.replace(n,r);return t}function wn(e){if(Array.isArray(e))return e.map(wn);if(!e||typeof e!=="object")return e;return Object.fromEntries(Object.entries(e).sort(([t],[n])=>mh(t,n)).map(([t,n])=>[t,wn(n)]))}function mh(e,t){if(e<t)return-1;if(e>t)return 1;return 0}function ci(e){return JSON.stringify(wn(e))}var hh=[{pattern:/tasks\/[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+\/api_conversation_history/g,replacement:"tasks/usr-test/taskid/api_conversation_history"},{pattern:/\/(org|usr|mbr|ses|gen|req|msg|tsk|sch|exe|srv|cli|wkr|evt|sub|tkn)-[A-Za-z0-9]{10,}(?=[/?#]|$)/g,replacement:"/$1-REDACTED"}];function kn(e){let t=e;for(let{pattern:n,replacement:r}of hh)t=t.replace(n,r);return t}function $e(e){if(e===null||e===void 0)return e;if(typeof e==="string"){try{let t=JSON.parse(e);if(typeof t==="object"&&t!==null)return JSON.stringify($e(t))}catch{}return ya(e)}if(Array.isArray(e))return e.map($e);if(typeof e==="object"){let t={};for(let[n,r]of Object.entries(e))if(ph(n)&&(typeof r==="string"||typeof r==="number"))t[n]="REDACTED";else t[n]=$e(r);return t}return e}function gh(e){let t=new URLSearchParams(e),n=Array.from(t.entries());if(n.length===0||n.some(([i])=>i.length===0))return;let r={};for(let[i,o]of n){let a=r[i];if(a===void 0)r[i]=o;else if(Array.isArray(a))a.push(o);else r[i]=[a,o]}return r}function yh(e){return e?.toLowerCase().split(";")[0]?.trim()==="application/x-www-form-urlencoded"}function va(e,t){try{return ci($e(JSON.parse(e)))}catch{if(yh(t)){let n=gh(e);if(n)return ci($e(n))}return ya(e)}}function vh(e,t){let n={...e},r=t&&e.body!==void 0?va(e.body,e.requestContentType):void 0;if(delete n.body,delete n.requestContentType,r!==void 0)n.requestBody=r;if(typeof n.path==="string")n.path=kn(n.path);if(n.response!==void 0)n.response=$e(n.response);return n}function _a(e){try{let t=new URL(e),n=`${t.protocol}//${t.host}`,r=t.pathname+t.search;return{scope:n,path:r}}catch{return{scope:"",path:e}}}function ba(e){if(typeof e==="string")return e;if(e instanceof URL)return e.toString();if(e&&typeof e.url==="string")return e.url;return String(e)}function wa(e,t){if(t?.method)return t.method.toUpperCase();if(e&&typeof e.method==="string")return e.method.toUpperCase();return"GET"}function _h(e){if(!e)return;return new Headers(e).get("content-type")??void 0}function ka(e,t){let n=_h(t?.headers);if(n)return n;if(t?.body instanceof URLSearchParams)return"application/x-www-form-urlencoded;charset=UTF-8";if(e instanceof Request)return e.headers.get("content-type")??void 0;return}async function Ea(e,t){if(t?.body){if(typeof t.body==="string")return t.body;if(t.body instanceof URLSearchParams)return t.body.toString();if(t.body instanceof ArrayBuffer)return new TextDecoder().decode(t.body);if(ArrayBuffer.isView(t.body))return new TextDecoder().decode(new Uint8Array(t.body.buffer,t.body.byteOffset,t.body.byteLength));return}if(e instanceof Request)try{return await e.clone().text()}catch{return}return}function bh(e){if(!e)return null;if(!process.env.CLINE_VCR_CASSETTE)return process.stderr.write(`[VCR] No CLINE_VCR_CASSETTE: requests will not be recorded or played back.
179
+ `),null;if(e!=="record"&&e!=="playback")process.stderr.write(`[VCR] Invalid CLINE_VCR value: "${e}". Expected "record" or "playback".
180
+ `),process.exit(1);let t=uh(process.env.CLINE_VCR_CASSETTE),n=process.env.CLINE_VCR_FILTER??"",r=process.env.CLINE_VCR_INCLUDE_REQUEST_BODY==="1"||process.env.CLINE_VCR_INCLUDE_REQUEST_BODY==="true";return{mode:e,cassettePath:t,filter:n,includeRequestBody:r}}function wh(e,t,n){let r=[],i=[],o=globalThis.fetch;function a(u){if(u.finalized)return;u.finalized=!0;let d=new TextDecoder,p=u.chunks.map((m)=>d.decode(m,{stream:!0})).join("")+d.decode(),f;try{f=JSON.parse(p)}catch{f=p}r.push({scope:u.scope,method:u.method,path:u.path,body:u.body,requestContentType:u.requestContentType,status:u.status,response:f,responseIsBinary:!1,contentType:u.contentType})}globalThis.fetch=Object.assign(async(u,d)=>{let p=ba(u),f=wa(u,d),{scope:m,path:g}=_a(p),y=await Ea(u,d),T=ka(u,d),b=await o(u,d);if(t&&!g.includes(t))return b;let D=b.headers.get("content-type")??void 0;if(!b.body)return r.push({scope:m,method:f,path:g,body:y??"",requestContentType:T,status:b.status,response:"",responseIsBinary:!1,contentType:D}),b;let C={scope:m,method:f,path:g,body:y??"",requestContentType:T,status:b.status,contentType:D,chunks:[],finalized:!1};i.push(C);let N=b.body,S=new TransformStream({transform(ce,ke){C.chunks.push(ce),ke.enqueue(ce)},flush(){a(C)}}),q=N.pipeThrough(S);return new Response(q,{status:b.status,statusText:b.statusText,headers:b.headers})},{preconnect:(u)=>{}});let s=t?`matching path "*${t}*"`:"all paths";process.stderr.write(`[VCR] Recording HTTP requests (${s}). Cassette will be saved to: ${e}
181
+ `);let l=!1;jI(()=>{if(l)return;l=!0,globalThis.fetch=o;for(let p of i)a(p);if(r.length===0){process.stderr.write(`[VCR] No HTTP requests${t?` matching "${t}"`:""} were recorded.
182
+ `);return}let u=lh(e);oh(u,{recursive:!0});let d=r.map((p)=>vh(p,n));sh(e,JSON.stringify(d,null,2)),process.stderr.write(`[VCR] Saved ${d.length} recorded HTTP interaction(s) to ${e}
183
+ `)})}function kh(e){let t=[],n=e.split(/\n\n/);for(let r of n){let i=r.trim();if(i)t.push(`${i}
184
+
185
+ `)}return t}function Eh(e,t){let n=new TextEncoder,r=0;return new ReadableStream({async pull(i){if(r>=e.length){i.close();return}if(r>0&&t>0)await new Promise((a)=>setTimeout(a,t));let o=e[r];if(o===void 0){i.close();return}i.enqueue(n.encode(o)),r+=1}})}async function Th(e){if(e.recording.requestBody===void 0)return;let t=await Ea(e.requestInput,e.requestInit),n=ka(e.requestInput,e.requestInit),r=va(t??"",n);if(r!==e.recording.requestBody)throw Error(`[VCR] Request body mismatch for ${e.method} ${e.path}.
186
+ expected: ${e.recording.requestBody}
187
+ actual: ${r}
188
+ Re-record the cassette if the request change is intentional.`)}function Sh(e,t){if(!ih(e))process.stderr.write(`[VCR] Cassette file not found: ${e}
189
+ `),process.exit(1);let n=JSON.parse(ah(e,"utf-8")),r=Number.parseInt(process.env.CLINE_VCR_SSE_DELAY??"100",10),i=Array(n.length).fill(!1),o=globalThis.fetch;globalThis.fetch=Object.assign(async(s,l)=>{let u=ba(s),d=wa(s,l),{path:p}=_a(u),f=kn(p);if(t&&!p.includes(t))return o(s,l);let m=n.findIndex((g,y)=>{if(i[y])return!1;let T=kn(g.path);return g.method.toUpperCase()===d&&T===f});if(m>=0){let g=n[m];if(!g)return o(s,l);await Th({recording:g,requestInput:s,requestInit:l,method:d,path:f}),i[m]=!0;let y=typeof g.response==="string"?g.response:JSON.stringify(g.response),T=new Headers;if(g.contentType)T.set("content-type",g.contentType);else if(typeof g.response==="string"&&g.response.trimStart().startsWith("data:"))T.set("content-type","text/event-stream");else if(typeof g.response==="object")T.set("content-type","application/json");let b=T.get("content-type")?.includes("text/event-stream")??!1;if(b)T.set("cache-control","no-cache"),T.set("connection","keep-alive");if(b&&typeof g.response==="string"){let D=kh(g.response);if(D.length>1){let C=Eh(D,r);return new Response(C,{status:g.status,headers:T})}}return new Response(y,{status:g.status,headers:T})}if(!t)throw Error(`[VCR] No matching recording for ${d} ${u} (path: ${f}). ${n.length} recording(s) loaded from ${e}.`);return o(s,l)},{preconnect:(s)=>{}});let a=t?`(only paths matching "*${t}*", all other requests go through normally)`:"(all requests intercepted)";process.stderr.write(`[VCR] Playing back ${n.length} recorded HTTP interaction(s) from ${e} ${a}
190
+ `)}function X4(e){let t=bh(e);if(!t)return;if(t.mode==="record")wh(t.cassettePath,t.filter,t.includeRequestBody);else Sh(t.cassettePath,t.filter)}export{Vu,bI,Ku,vI,wI,NS,kI,TI,_I,II,SI,Zv,EI,RI,OI,Hu,lf,AI,ls,il,ew,uf,LS,tw,BS,pf,CI,PI,DI,US,FS,WI,MI,NI,jS,$S,qS,LI,BI,UI,zS,GS,VS,FI,jI,KS,$I,iw,HS,QS,Qu,JS,YS,qI,zI,XS,ZS,e6,t6,i6,n6,a6,o6,r6,nw,GI,s6,VI,c6,KI,l6,HI,u6,p6,d6,m6,h6,g6,f6,y6,x6,QI,b6,v6,w6,k6,T6,JI,YI,XI,aw,ZI,e5,_6,I6,t5,us,wm,i5,n5,km,S6,df,ow,rw,pi,qi,a5,E6,sw,R6,o5,cw,ps,ds,r5,mf,Tm,Ju,Yo,wi,_m,s5,hf,gf,Yu,O6,A6,Im,C6,P6,c5,Xu,D6,W6,Xo,l5,u5,ff,M6,N6,L6,B6,p5,d5,U6,F6,j6,$6,yf,xf,Zu,ep,bf,vf,q6,z6,lw,tp,m5,G6,V6,di,h5,K6,H6,Q6,J6,Y6,X6,g5,Pn,f5,y5,x5,Z6,eE,tE,wf,ip,b5,iE,nE,aE,v5,oE,rE,sE,cE,w5,k5,T5,_5,I5,S5,E5,R5,O5,A5,C5,P5,D5,W5,M5,uw,kf,N5,L5,lE,uE,pE,dE,mE,hE,gE,fE,yE,xE,bE,Tf,B5,U5,pw,vE,wE,kE,TE,_f,_E,IE,dw,SE,F5,dc,EE,RE,OE,AE,CE,PE,DE,WE,ME,j5,NE,LE,BE,UE,FE,jE,$E,qE,$5,zE,GE,VE,KE,If,Sf,Ef,Rf,Of,nl,HE,QE,JE,Af,Cf,al,q5,mw,hw,YE,XE,z5,ZE,e4,t4,i4,n4,a4,gw,G5,V5,o4,r4,K5,H5,s4,c4,l4,u4,p4,Q5,d4,m4,h4,g4,f4,y4,x4,b4,v4,w4,k4,T4,_4,I4,S4,E4,R4,O4,A4,C4,P4,D4,W4,M4,J5,N4,L4,Y5,B4,U4,F4,j4,$4,q4,z4,G4,V4,K4,H4,Q4,X5,J4,Z5,Y4,X4};