@cline/shared 0.0.88 → 0.0.89-nightly.1790822319

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.
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- function pt(e){let t=Object.values(e).filter((r)=>typeof r==="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function $n(e,t="|"){return e.map((n)=>Bn(n)).join(t)}function mt(e,t){if(typeof t==="bigint")return t.toString();return t}class _i{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 ft(e){return new _i(e)}function vi(e){return e===null||e===void 0}function Bt(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Ti(e,t){let n=e/t,r=Math.round(n),o=4*Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-r)<o)return 0;return n-r}function te(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function gt(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function be(e){return gt(e._zod.def)??e._zod.def.shape}function Ci(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return te(this,t,r),r},enumerable:!0,configurable:!0})}function ki(e,t,n){if(t in e)te(e,t,n);else e[t]=n}function Oe(e,t,n,r){let o=be(t);for(let i of n){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)Ci(e,i,()=>{let a=t._zod.def.shape[i];return r?r(a,i):a});else ki(e,i,r?r(s.value,i):s.value)}}function bp(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);if(!r.enumerable)continue;if(r.get)Ci(e,n,()=>t[n]);else ki(e,n,r.value)}}function ne(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Ei(e){return JSON.stringify(e)}function Ri(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ln="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ue(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Ai=ft(()=>{if(Y.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ze(e){if(Ue(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(Ue(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function Dn(e){if(ze(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 wi=new Set(["string","number","symbol"]);function Ee(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ue(e,t,n){let r=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)r._zod.parent=e;return r}function _(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 Bn(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Ii(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Ut=(()=>({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]}))(),Un={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function xp(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 Oe(i,e,Zt(e,t)),ue(e,ne(n,{shape:i,checks:[]}))}function Zt(e,t){let n=be(e),r=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])r.push(o)}return r}function Sp(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Zt(e,t)),s={};return Oe(s,e,Reflect.ownKeys(be(e)).filter((a)=>!i.has(a))),ue(e,ne(n,{shape:s,checks:[]}))}function _p(e,t){if(!ze(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=be(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ue(e,ne(e._zod.def,{shape:Pi(e,t)}))}function Pi(e,t){let n={};return Oe(n,e,Reflect.ownKeys(be(e))),bp(n,t),n}function vp(e,t){if(!ze(t))throw Error("Invalid input to safeExtend: expected a plain object");return ue(e,ne(e._zod.def,{shape:Pi(e,t)}))}function Tp(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={};Oe(n,e,Reflect.ownKeys(be(e))),Oe(n,t,Reflect.ownKeys(be(t)));let r=ne(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ue(e,r)}function Mi(e,t,n,r="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Zt(t,n)):void 0,c={};return Oe(c,t,Reflect.ownKeys(be(t)),e&&((l,d)=>a&&!a.has(d)?l:new e({type:"optional",innerType:l}))),ue(t,ne(t._zod.def,{shape:c,checks:[]}))}function Cp(e,t,n){let r=n?new Set(Zt(t,n)):void 0,o={};return Oe(o,t,Reflect.ownKeys(be(t)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),ue(t,ne(t._zod.def,{shape:o}))}function oe(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 Oi(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 de(e,t){return t.map((n)=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function dt(e){return typeof e==="string"?e:e?.message}function Zn(e,t,n){var r;for(let o=t;o<e.length;o++)(r=e[o]).schema??(r.schema=n)}function pe(e,t,n){var r;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(r=e).schema??(r.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:dt(e.inst?._zod.def?.error?.(e))??dt(i?.(e))??dt(t?.error?.(e))??dt(n.customError?.(e))??dt(n.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=s,t?.reportInput)a.input=e.input;return a}var kp=/[\uD800-\uDBFF]/;function Ft(e){let t=e.length;if(!kp.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 Ht(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function zi(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 Ne(...e){let[t,n,r]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:r};return{...t}}function Ni(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);if(r.get)Object.defineProperty(e,n,{...r,enumerable:!1});else Ep(e,n,r.value)}}function xe(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function jt(e,t,n){return xe(e,t,n,!1)}function Fn(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return xe(this,n,r(this))},set(o){xe(this,n,o)}})}return t}function Ep(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:xe(this,t,n.bind(this))},set(r){xe(this,t,r)}})}function Rp(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Nn,ke=!1,Ap={configurable:!0,get(){ke=!0;return}};function P(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Nn!==e._zod){Nn=void 0;return}Nn=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Ap);let o=ke;ke=!1;try{let i=n(this);if(ke)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return ke=ke||o,i}catch(i){throw delete this[t],ke=ke||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function wp(e,t,n,r){let o=Rp(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,i),i.value=n(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:i})}})}var Ip="~constantCatch";function $i(e){let t=()=>e;return t[Ip]=!0,t}var Li;var Hn={value:void 0,enumerable:!1},Di="captureStackTrace"in Error?Error:null;function Pp(e){let t=Di;if(t){let n=t.stackTraceLimit;if(typeof n==="number"){try{t.stackTraceLimit=0}catch{return Di=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function h(e,t,n,r){let o={};function i(m){this.def=m,this.constr=p,this.traits=new Set}i.prototype=o;let s=n,a=s&&new WeakSet;function c(m,f){if(!m._zod){Hn.value=new i(f);try{Object.defineProperty(m,"_zod",Hn)}finally{Hn.value=void 0}}else if(m._zod.traits.has(e))return;if(m._zod.traits.add(e),t(m,f),a){let y=Object.getPrototypeOf(m),S=m._zod.constr.prototype,v=y;while(v&&v!==S)v=Object.getPrototypeOf(v);let k=v??y;if(!a.has(k))a.add(k),Ni(k,s)}let g=p.prototype;for(let y in g){if(!Object.prototype.hasOwnProperty.call(g,y))continue;if(!(y in m))m[y]=g[y].bind(m)}}let l=r?.Parent??Object;class d extends l{}Object.defineProperty(d,"name",{value:e});function p(m){let f=r?.Parent?Pp(d):this;c(f,m);let g=f._zod.deferred;if(g){for(let S of g)S();f._zod.deferred=void 0}let y=globalThis.__zod_globalConfig?.postProcessor;if(y)y(f);return f}return Object.defineProperty(p,"init",{value:c}),Object.defineProperty(p,Symbol.hasInstance,{value:(m)=>{if(r?.Parent&&m instanceof r.Parent)return!0;return m?._zod?.traits?.has(e)}}),Object.defineProperty(p,"name",{value:e}),p}class me extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ht extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Li=globalThis).__zod_globalConfig??(Li.__zod_globalConfig={});var Y=globalThis.__zod_globalConfig;function Q(e){if(e)Object.assign(Y,e);return Y}function Mp(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,mt,2)),e.message}function Op(e){this._zod.message=e}var zp={get:Mp,set:Op,enumerable:!0,configurable:!0},Vn={value:void 0,enumerable:!1},Bi=new WeakSet([Object.prototype,Error.prototype]),Ui=(e,t)=>{e.name="$ZodError",Vn.value=t,Object.defineProperty(e,"issues",Vn),Vn.value=void 0,Object.defineProperty(e,"message",zp);let n=Object.getPrototypeOf(e);if(!Bi.has(n))Bi.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})}})},Zi=h("$ZodError",Ui),qn=h("$ZodError",Ui,void 0,{Parent:Error});function Np(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 Gn(e,t=(n)=>n.message){let n={},r=[];for(let o of e.issues)if(o.path.length>0)Np(n,o.path[0],()=>[]).push(t(o));else r.push(t(o));return{formErrors:r,fieldErrors:n}}function Kn(e,t=(n)=>n.message){let n={_errors:[]},r=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>r({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)n._errors.push(t(s));else{let c=n,l=0;while(l<a.length){let d=a[l],p=l===a.length-1;if(d==="_errors"){if(p)c._errors.push(t(s));l++;continue}if(!Object.prototype.hasOwnProperty.call(c,d))Object.defineProperty(c,d,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=c[d];if(p)m._errors.push(t(s));c=m,l++}}}};return r(e),n}function $p(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 Fi(e){let t=[],n=[...e.issues].sort((r,o)=>(r.path??[]).length-(o.path??[]).length);for(let r of n)if(t.push(`✖ ${r.message}`),r.path?.length)t.push(` → at ${$p(r.path)}`);return t.join(`
2
- `)}function Vt(e,t){return{callee:t?.callee??e,Err:t?.Err}}var yt=(e)=>{let t=(n,r,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new me;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>pe(l,s,Q())));throw Ln(c,i?.callee??t),c}return a.value};return t},Wn=yt(qn),bt=(e)=>{let t=async(n,r,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>pe(l,s,Q())));throw Ln(c,i?.callee??t),c}return a.value};return t},Jn=bt(qn),qt=(e)=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new me;return i.issues.length?Hi(e,i.issues,o):{success:!0,data:i.value}};function Hi(e,t,n){let r;return{success:!1,get error(){if(!r)r=new e(t.map((o)=>pe(o,n,Q()))),t=void 0,n=void 0;return r},set error(o){r=o,t=void 0,n=void 0}}}var Gt=(e)=>async(t,n,r)=>{let o=r?{...r,async:!0}:{async:!0},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?Hi(e,i.issues,o):{success:!0,data:i.value}};var Dp=Symbol.for("zod.compile.invalid"),Bp=Symbol.for("zod.compile.fallback"),Yn=(e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Dp)return!0;if(r.definite===!0&&n===void 0)return!1}return Up(e,t,n)};function Up(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)r[Bp]=!0,i=o({value:t,issues:[]},r);else i=e._zod.run({value:t,issues:[]},r);if(i instanceof Promise)throw new me;return i.issues.length===0}var Xn=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},r);if(o instanceof Promise)o=await o;return o.issues.length===0},ji=(e)=>{let t=yt(e),n=(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(r,o,a,Vt(n,s))};return n};var Vi=(e)=>{let t=yt(e),n=(r,o,i,s)=>t(r,o,i,Vt(n,s));return n};var qi=(e)=>{let t=bt(e),n=async(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(r,o,a,Vt(n,s))};return n};var Gi=(e)=>{let t=bt(e),n=async(r,o,i,s)=>await t(r,o,i,Vt(n,s));return n};var Ki=(e)=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return qt(e)(t,n,o)};var Wi=(e)=>(t,n,r)=>qt(e)(t,n,r);var Ji=(e)=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Gt(e)(t,n,o)};var Yi=(e)=>async(t,n,r)=>Gt(e)(t,n,r);var Xi=/^[cC][0-9a-z]{6,}$/,Qi=/^[0-9a-z]+$/,es=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ts=/^[0-9a-vA-V]{20}$/,ns=/^[A-Za-z0-9]{27}$/,rs=/^[a-zA-Z0-9_-]{21}$/;function os(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var is=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var ss=/^([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})$/,er=(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})$`)};var as=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Zp="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function cs(){return new RegExp(Zp,"u")}var us=/^(?:(?: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])$/,ls=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var 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])\/([0-9]|[1-2][0-9]|3[0-2])$/,ps=/^(([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])$/,ms=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,fs=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var gs=/^https?$/,hs=/^\+[1-9]\d{6,14}$/;var ys="(?:(?:\\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 Fp(e){return new RegExp(`^${e}$`)}var bs=Fp(ys);function Qn(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 xs(e){return new RegExp(`^${Qn(e)}$`)}function Ss(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${Qn({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${Qn({precision:e.precision})}`:n;return new RegExp(`^${ys}T(?:${r})$`)}var _s=/^[\s\S]{0,}$/;var tr=/^-?\d+$/,xt=/^-?\d+(?:\.\d+)?$/,vs=/^(?:true|false)$/i;var Ts=/^[^A-Z]*$/,Cs=/^[^a-z]*$/;var G=h("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});var nr=(e)=>{let t=e.value;return!vi(t)&&t.length!==void 0},Kt={number:"number",bigint:"bigint",object:"date"},rr=h("$ZodCheckLessThan",(e,t)=>{G.init(e,t);let n=Kt[typeof t.value];e._zod.check=(r)=>{if(t.inclusive?r.value<=t.value:r.value<t.value)return;r.issues.push({origin:Kt[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})}}),or=h("$ZodCheckGreaterThan",(e,t)=>{G.init(e,t);let n=Kt[typeof t.value];e._zod.check=(r)=>{if(t.inclusive?r.value>=t.value:r.value>t.value)return;r.issues.push({origin:Kt[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})}}),ks=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):Ti(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})}}),Es=h("$ZodCheckNumberFormat",(e,t)=>{G.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[o,i]=Ut[t.format];e._zod.check=(s)=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,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 s.issues.push({input:a,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(a<o)s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(a>i)s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Rs=h("$ZodCheckMaxLength",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=nr),e._zod.check=(r)=>{let o=r.value,i=o.length;if((typeof o==="string"&&i>t.maximum?Ft(o):i)<=t.maximum)return;let a=Ht(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),As=h("$ZodCheckMinLength",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=nr),e._zod.check=(r)=>{let o=r.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?Ft(o):i)>=t.minimum)return;let a=Ht(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ws=h("$ZodCheckLengthEquals",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=nr),e._zod.check=(r)=>{let o=r.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?Ft(o):i;if(s===t.length)return;let a=Ht(o),c=s>t.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),St=h("$ZodCheckStringFormat",(e,t)=>{var n,r;if(G.init(e,t),t.pattern)(n=e._zod).check??(n.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(r=e._zod).check??(r.check=()=>{})}),Is=h("$ZodCheckRegex",(e,t)=>{St.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})}}),Ps=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ts),St.init(e,t)}),Ms=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Cs),St.init(e,t)}),Os=h("$ZodCheckIncludes",(e,t)=>{G.init(e,t);let n=Ee(t.includes),r=new RegExp(typeof t.position==="number"?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),zs=h("$ZodCheckStartsWith",(e,t)=>{G.init(e,t);let n=new RegExp(`^${Ee(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})}}),Ns=h("$ZodCheckEndsWith",(e,t)=>{G.init(e,t);let n=new RegExp(`.*${Ee(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})}});var $s=h("$ZodCheckOverwrite",(e,t)=>{G.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class ir{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 n=e.split(`
3
- `).filter((i)=>i),r=Math.min(...n.map((i)=>i.length-i.trimStart().length)),o=n.map((i)=>i.slice(r)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
1
+ function pt(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,r])=>t.indexOf(+o)===-1).map(([o,r])=>r)}function $n(e,t="|"){return e.map((n)=>Bn(n)).join(t)}function mt(e,t){if(typeof t==="bigint")return t.toString();return t}class _i{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 ft(e){return new _i(e)}function vi(e){return e===null||e===void 0}function Bt(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Ti(e,t){let n=e/t,o=Math.round(n),r=4*Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-o)<r)return 0;return n-o}function te(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function gt(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function be(e){return gt(e._zod.def)??e._zod.def.shape}function Ci(e,t,n){Object.defineProperty(e,t,{get(){let o=n();return te(this,t,o),o},enumerable:!0,configurable:!0})}function ki(e,t,n){if(t in e)te(e,t,n);else e[t]=n}function Oe(e,t,n,o){let r=be(t);for(let i of n){let s=Object.getOwnPropertyDescriptor(r,i);if(!s.enumerable)continue;if(s.get)Ci(e,i,()=>{let a=t._zod.def.shape[i];return o?o(a,i):a});else ki(e,i,o?o(s.value,i):s.value)}}function bp(e,t){for(let n of Reflect.ownKeys(t)){let o=Object.getOwnPropertyDescriptor(t,n);if(!o.enumerable)continue;if(o.get)Ci(e,n,()=>t[n]);else ki(e,n,o.value)}}function ne(...e){let t={};for(let n of e){let o=Object.getOwnPropertyDescriptors(n);Object.assign(t,o)}return Object.defineProperties({},t)}function Ei(e){return JSON.stringify(e)}function Ri(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ln="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ue(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Ai=ft(()=>{if(Y.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ze(e){if(Ue(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(Ue(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function Dn(e){if(ze(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 Ii=new Set(["string","number","symbol"]);function Ee(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ue(e,t,n){let o=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)o._zod.parent=e;return o}function _(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 Bn(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function wi(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Ut=(()=>({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]}))(),Un={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function xp(e,t){let n=e._zod.def,o=n.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return Oe(i,e,Zt(e,t)),ue(e,ne(n,{shape:i,checks:[]}))}function Zt(e,t){let n=be(e),o=[];for(let r of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,r)?.enumerable)throw Error(`Unrecognized key: "${String(r)}"`);if(t[r])o.push(r)}return o}function Sp(e,t){let n=e._zod.def,o=n.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Zt(e,t)),s={};return Oe(s,e,Reflect.ownKeys(be(e)).filter((a)=>!i.has(a))),ue(e,ne(n,{shape:s,checks:[]}))}function _p(e,t){if(!ze(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let r=be(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 ue(e,ne(e._zod.def,{shape:Pi(e,t)}))}function Pi(e,t){let n={};return Oe(n,e,Reflect.ownKeys(be(e))),bp(n,t),n}function vp(e,t){if(!ze(t))throw Error("Invalid input to safeExtend: expected a plain object");return ue(e,ne(e._zod.def,{shape:Pi(e,t)}))}function Tp(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={};Oe(n,e,Reflect.ownKeys(be(e))),Oe(n,t,Reflect.ownKeys(be(t)));let o=ne(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ue(e,o)}function Mi(e,t,n,o="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${o}() cannot be used on object schemas containing refinements`);let a=n?new Set(Zt(t,n)):void 0,c={};return Oe(c,t,Reflect.ownKeys(be(t)),e&&((l,d)=>a&&!a.has(d)?l:new e({type:"optional",innerType:l}))),ue(t,ne(t._zod.def,{shape:c,checks:[]}))}function Cp(e,t,n){let o=n?new Set(Zt(t,n)):void 0,r={};return Oe(r,t,Reflect.ownKeys(be(t)),(i,s)=>o&&!o.has(s)?i:new e({type:"nonoptional",innerType:i})),ue(t,ne(t._zod.def,{shape:r}))}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 Oi(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 de(e,t){return t.map((n)=>{var o;return(o=n).path??(o.path=[]),n.path.unshift(e),n})}function dt(e){return typeof e==="string"?e:e?.message}function Zn(e,t,n){var o;for(let r=t;r<e.length;r++)(o=e[r]).schema??(o.schema=n)}function pe(e,t,n){var o;let r=e.inst?._zod?.traits;if(r?.has("$ZodType"))if(r.has("$ZodCheck"))(o=e).schema??(o.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:dt(e.inst?._zod.def?.error?.(e))??dt(i?.(e))??dt(t?.error?.(e))??dt(n.customError?.(e))??dt(n.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=s,t?.reportInput)a.input=e.input;return a}var kp=/[\uD800-\uDBFF]/;function Ft(e){let t=e.length;if(!kp.test(e))return t;let n=t;for(let o=0;o<t-1;o++)if((e.charCodeAt(o)&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320)n--,o++;return n}function Ht(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function zi(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 Ne(...e){let[t,n,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:o};return{...t}}function Ni(e,t){for(let n in t){let o=Object.getOwnPropertyDescriptor(t,n);if(o.get)Object.defineProperty(e,n,{...o,enumerable:!1});else Ep(e,n,o.value)}}function xe(e,t,n,o=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:o,value:n}),n}function jt(e,t,n){return xe(e,t,n,!1)}function Fn(e,t){for(let n in e){let o=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return xe(this,n,o(this))},set(r){xe(this,n,r)}})}return t}function Ep(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:xe(this,t,n.bind(this))},set(o){xe(this,t,o)}})}function Rp(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Nn,ke=!1,Ap={configurable:!0,get(){ke=!0;return}};function P(e,t,n){let o=Object.getPrototypeOf(e._zod);if(t in o&&Nn!==e._zod){Nn=void 0;return}Nn=e._zod,Object.defineProperty(o,t,{configurable:!0,get(){Object.defineProperty(this,t,Ap);let r=ke;ke=!1;try{let i=n(this);if(ke)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return ke=ke||r,i}catch(i){throw delete this[t],ke=ke||r,i}},set(r){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r})}})}function Ip(e,t,n,o){let r=Rp(e,t);if(!r)return;Object.defineProperty(r,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:o,value:void 0};return Object.defineProperty(this,t,i),i.value=n(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:o,value:i})}})}var wp="~constantCatch";function $i(e){let t=()=>e;return t[wp]=!0,t}var Li;var Hn={value:void 0,enumerable:!1},Di="captureStackTrace"in Error?Error:null;function Pp(e){let t=Di;if(t){let n=t.stackTraceLimit;if(typeof n==="number"){try{t.stackTraceLimit=0}catch{return Di=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function h(e,t,n,o){let r={};function i(m){this.def=m,this.constr=p,this.traits=new Set}i.prototype=r;let s=n,a=s&&new WeakSet;function c(m,f){if(!m._zod){Hn.value=new i(f);try{Object.defineProperty(m,"_zod",Hn)}finally{Hn.value=void 0}}else if(m._zod.traits.has(e))return;if(m._zod.traits.add(e),t(m,f),a){let y=Object.getPrototypeOf(m),S=m._zod.constr.prototype,v=y;while(v&&v!==S)v=Object.getPrototypeOf(v);let k=v??y;if(!a.has(k))a.add(k),Ni(k,s)}let g=p.prototype;for(let y in g){if(!Object.prototype.hasOwnProperty.call(g,y))continue;if(!(y in m))m[y]=g[y].bind(m)}}let l=o?.Parent??Object;class d extends l{}Object.defineProperty(d,"name",{value:e});function p(m){let f=o?.Parent?Pp(d):this;c(f,m);let g=f._zod.deferred;if(g){for(let S of g)S();f._zod.deferred=void 0}let y=globalThis.__zod_globalConfig?.postProcessor;if(y)y(f);return f}return Object.defineProperty(p,"init",{value:c}),Object.defineProperty(p,Symbol.hasInstance,{value:(m)=>{if(o?.Parent&&m instanceof o.Parent)return!0;return m?._zod?.traits?.has(e)}}),Object.defineProperty(p,"name",{value:e}),p}class me extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ht extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Li=globalThis).__zod_globalConfig??(Li.__zod_globalConfig={});var Y=globalThis.__zod_globalConfig;function Q(e){if(e)Object.assign(Y,e);return Y}function Mp(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,mt,2)),e.message}function Op(e){this._zod.message=e}var zp={get:Mp,set:Op,enumerable:!0,configurable:!0},Vn={value:void 0,enumerable:!1},Bi=new WeakSet([Object.prototype,Error.prototype]),Ui=(e,t)=>{e.name="$ZodError",Vn.value=t,Object.defineProperty(e,"issues",Vn),Vn.value=void 0,Object.defineProperty(e,"message",zp);let n=Object.getPrototypeOf(e);if(!Bi.has(n))Bi.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let o=()=>this.message;return Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0})}})},Zi=h("$ZodError",Ui),qn=h("$ZodError",Ui,void 0,{Parent:Error});function Np(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 Gn(e,t=(n)=>n.message){let n={},o=[];for(let r of e.issues)if(r.path.length>0)Np(n,r.path[0],()=>[]).push(t(r));else o.push(t(r));return{formErrors:o,fieldErrors:n}}function Kn(e,t=(n)=>n.message){let n={_errors:[]},o=(r,i=[])=>{for(let s of r.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>o({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")o({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")o({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)n._errors.push(t(s));else{let c=n,l=0;while(l<a.length){let d=a[l],p=l===a.length-1;if(d==="_errors"){if(p)c._errors.push(t(s));l++;continue}if(!Object.prototype.hasOwnProperty.call(c,d))Object.defineProperty(c,d,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=c[d];if(p)m._errors.push(t(s));c=m,l++}}}};return o(e),n}function $p(e){let t=[],n=e.map((o)=>typeof o==="object"?o.key:o);for(let o of n)if(typeof o==="number")t.push(`[${o}]`);else if(typeof o==="symbol")t.push(`[${JSON.stringify(String(o))}]`);else if(/[^\w$]/.test(o))t.push(`[${JSON.stringify(o)}]`);else{if(t.length)t.push(".");t.push(o)}return t.join("")}function Fi(e){let t=[],n=[...e.issues].sort((o,r)=>(o.path??[]).length-(r.path??[]).length);for(let o of n)if(t.push(`✖ ${o.message}`),o.path?.length)t.push(` → at ${$p(o.path)}`);return t.join(`
2
+ `)}function Vt(e,t){return{callee:t?.callee??e,Err:t?.Err}}var yt=(e)=>{let t=(n,o,r,i)=>{let s=r?{...r,async:!1}:{async:!1},a=n._zod.run({value:o,issues:[]},s);if(a instanceof Promise)throw new me;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>pe(l,s,Q())));throw Ln(c,i?.callee??t),c}return a.value};return t},Wn=yt(qn),bt=(e)=>{let t=async(n,o,r,i)=>{let s=r?{...r,async:!0}:{async:!0},a=n._zod.run({value:o,issues:[]},s);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>pe(l,s,Q())));throw Ln(c,i?.callee??t),c}return a.value};return t},Jn=bt(qn),qt=(e)=>(t,n,o)=>{let r=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},r);if(i instanceof Promise)throw new me;return i.issues.length?Hi(e,i.issues,r):{success:!0,data:i.value}};function Hi(e,t,n){let o;return{success:!1,get error(){if(!o)o=new e(t.map((r)=>pe(r,n,Q()))),t=void 0,n=void 0;return o},set error(r){o=r,t=void 0,n=void 0}}}var Gt=(e)=>async(t,n,o)=>{let r=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:n,issues:[]},r);if(i instanceof Promise)i=await i;return i.issues.length?Hi(e,i.issues,r):{success:!0,data:i.value}};var Dp=Symbol.for("zod.compile.invalid"),Bp=Symbol.for("zod.compile.fallback"),Yn=(e,t,n)=>{let o=e._zod.bag.validator;if(o!==void 0){if(o(t)!==Dp)return!0;if(o.definite===!0&&n===void 0)return!1}return Up(e,t,n)};function Up(e,t,n){let o=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},r=e._zod.bag.fallbackRun,i;if(r)o[Bp]=!0,i=r({value:t,issues:[]},o);else i=e._zod.run({value:t,issues:[]},o);if(i instanceof Promise)throw new me;return i.issues.length===0}var Xn=async(e,t,n)=>{let o=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},r=e._zod.run({value:t,issues:[]},o);if(r instanceof Promise)r=await r;return r.issues.length===0},ji=(e)=>{let t=yt(e),n=(o,r,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(o,r,a,Vt(n,s))};return n};var Vi=(e)=>{let t=yt(e),n=(o,r,i,s)=>t(o,r,i,Vt(n,s));return n};var qi=(e)=>{let t=bt(e),n=async(o,r,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(o,r,a,Vt(n,s))};return n};var Gi=(e)=>{let t=bt(e),n=async(o,r,i,s)=>await t(o,r,i,Vt(n,s));return n};var Ki=(e)=>(t,n,o)=>{let r=o?{...o,direction:"backward"}:{direction:"backward"};return qt(e)(t,n,r)};var Wi=(e)=>(t,n,o)=>qt(e)(t,n,o);var Ji=(e)=>async(t,n,o)=>{let r=o?{...o,direction:"backward"}:{direction:"backward"};return Gt(e)(t,n,r)};var Yi=(e)=>async(t,n,o)=>Gt(e)(t,n,o);var Xi=/^[cC][0-9a-z]{6,}$/,Qi=/^[0-9a-z]+$/,es=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ts=/^[0-9a-vA-V]{20}$/,ns=/^[A-Za-z0-9]{27}$/,os=/^[a-zA-Z0-9_-]{21}$/;function rs(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var is=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var ss=/^([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})$/,eo=(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})$`)};var as=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Zp="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function cs(){return new RegExp(Zp,"u")}var us=/^(?:(?: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])$/,ls=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var 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])\/([0-9]|[1-2][0-9]|3[0-2])$/,ps=/^(([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])$/,ms=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,fs=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var gs=/^https?$/,hs=/^\+[1-9]\d{6,14}$/;var ys="(?:(?:\\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 Fp(e){return new RegExp(`^${e}$`)}var bs=Fp(ys);function Qn(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 xs(e){return new RegExp(`^${Qn(e)}$`)}function Ss(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${Qn({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,o=e.local?`${n}|${Qn({precision:e.precision})}`:n;return new RegExp(`^${ys}T(?:${o})$`)}var _s=/^[\s\S]{0,}$/;var to=/^-?\d+$/,xt=/^-?\d+(?:\.\d+)?$/,vs=/^(?:true|false)$/i;var Ts=/^[^A-Z]*$/,Cs=/^[^a-z]*$/;var G=h("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});var no=(e)=>{let t=e.value;return!vi(t)&&t.length!==void 0},Kt={number:"number",bigint:"bigint",object:"date"},oo=h("$ZodCheckLessThan",(e,t)=>{G.init(e,t);let n=Kt[typeof t.value];e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:Kt[typeof o.value]??n,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ro=h("$ZodCheckGreaterThan",(e,t)=>{G.init(e,t);let n=Kt[typeof t.value];e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:Kt[typeof o.value]??n,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ks=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):Ti(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})}}),Es=h("$ZodCheckNumberFormat",(e,t)=>{G.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),o=n?"int":"number",[r,i]=Ut[t.format];e._zod.check=(s)=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}if(a<r)s.issues.push({origin:"number",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(a>i)s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Rs=h("$ZodCheckMaxLength",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=no),e._zod.check=(o)=>{let r=o.value,i=r.length;if((typeof r==="string"&&i>t.maximum?Ft(r):i)<=t.maximum)return;let a=Ht(r);o.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),As=h("$ZodCheckMinLength",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=no),e._zod.check=(o)=>{let r=o.value,i=r.length;if((typeof r==="string"&&i>=t.minimum&&i<t.minimum*2?Ft(r):i)>=t.minimum)return;let a=Ht(r);o.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Is=h("$ZodCheckLengthEquals",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=no),e._zod.check=(o)=>{let r=o.value,i=r.length,s=typeof r==="string"&&i>=t.length&&i<=t.length*2?Ft(r):i;if(s===t.length)return;let a=Ht(r),c=s>t.length;o.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),St=h("$ZodCheckStringFormat",(e,t)=>{var n,o;if(G.init(e,t),t.pattern)(n=e._zod).check??(n.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),ws=h("$ZodCheckRegex",(e,t)=>{St.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})}}),Ps=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ts),St.init(e,t)}),Ms=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Cs),St.init(e,t)}),Os=h("$ZodCheckIncludes",(e,t)=>{G.init(e,t);let n=Ee(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position},}${n}`:n);t.pattern=o,e._zod.check=(r)=>{if(r.value.includes(t.includes,t.position))return;r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),zs=h("$ZodCheckStartsWith",(e,t)=>{G.init(e,t);let n=new RegExp(`^${Ee(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Ns=h("$ZodCheckEndsWith",(e,t)=>{G.init(e,t);let n=new RegExp(`.*${Ee(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var $s=h("$ZodCheckOverwrite",(e,t)=>{G.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class io{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 n=e.split(`
3
+ `).filter((i)=>i),o=Math.min(...n.map((i)=>i.length-i.trimStart().length)),r=n.map((i)=>i.slice(o)).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
4
  ${t.join(`
5
5
  `)}
6
- };`)(...Object.values(this.closed))}}var Ds={major:4,minor:6,patch:5};var z=h("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ds;let r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,l)=>{if(a.memo)return a;let d=oe(a),p;for(let m of c){if(m._zod.def.when){if(Oi(a))continue;if(!m._zod.def.when(a))continue}else if(d)continue;let f=a.issues.length,g=m._zod.check(a);if(g instanceof Promise&&l?.async===!1)throw new me;if(p||g instanceof Promise)p=(p??Promise.resolve()).then(async()=>{if(await g,a.issues.length===f)return;if(Zn(a.issues,f,e),!d)d=oe(a,f)});else{if(a.issues.length===f)continue;if(Zn(a.issues,f,e),!d)d=oe(a,f)}}if(p)return p.then(()=>a);return a},s=(a,c,l)=>{if(oe(a))return a.aborted=!0,a;let d=i(c,o,l);if(d instanceof Promise){if(l.async===!1)throw new me;return d.then((p)=>e._zod.parse(p,l))}return e._zod.parse(d,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let d=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(d instanceof Promise)return d.then((p)=>s(p,a,c));return s(d,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new me;return l.then((d)=>i(d,o,c))}return i(l,o,c)}}},{get "~standard"(){return jt(this,"~standard",ar(this))},set "~standard"(e){xe(this,"~standard",e)}}),Xs=(e,t)=>e.issues.length?{issues:e.issues.map((n)=>pe(n,t,Q()))}:{value:e.value};async function Hp(e,t){let n={async:!0};return Xs(await e._zod.run({value:t,issues:[]},n),n)}function ar(e){return{validate:(t)=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Xs(r,n)}catch(r){}return Hp(e,t)},vendor:"zod",version:1}}var Xt=h("$ZodString",(e,t)=>{z.init(e,t),e._zod.pattern=t.pattern??_s,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),U=h("$ZodStringFormat",(e,t)=>{St.init(e,t),Xt.init(e,t)}),Qs=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ss),U.init(e,t)}),ea=h("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=er(r))}else t.pattern??(t.pattern=er());U.init(e,t)}),ta=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=as),U.init(e,t)}),na=1,Jt=2;function ra(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function jp(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return ra(e)||Jt;return Vp(e,t)}function Vp(e,t){if(!t.normalize&&t.protocol?.source===gs.source&&!/^https?:\/\//i.test(e))return na;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse==="function")return n.parse(e)??Jt}return new URL(e)}catch{return Jt}}var qp=/[\t\n\r]/g;function Bs(e){return e.replace(qp,"")}function Gp(e,t){return t.lastIndex=0,t.test(e.hostname)}function Kp(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var oa=h("$ZodURL",(e,t)=>{U.init(e,t),e._zod.check=(n)=>{try{let r=n.value.trim(),o=jp(r,t);if(o===na){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(o===Jt){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(o===!0){n.value=Bs(r);return}if(t.hostname&&!Gp(o,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&&!Kp(o,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?o.href:Bs(r);return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),ia=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=cs()),U.init(e,t)}),sa=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?rs:os(t.length)),U.init(e,t)}),aa=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Xi),U.init(e,t)}),ca=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Qi),U.init(e,t)}),ua=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=es),U.init(e,t)}),la=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ts),U.init(e,t)}),da=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ns),U.init(e,t)}),pa=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ss(t)),U.init(e,t)}),ma=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=bs),U.init(e,t)}),fa=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=xs(t)),U.init(e,t)}),ga=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=is),U.init(e,t)}),ha=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=us),U.init(e,t)}),Wp=/^[0-9a-fA-F:.]+$/;function ya(e){if(!Wp.test(e))return!1;return ra(`http://[${e}]`)}var ba=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ls),U.init(e,t),e._zod.check=(n)=>{if(!ya(n.value))n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}});var xa=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ds),U.init(e,t)});function Jp(e){let t=e.split("/");if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let o=Number(r);if(`${o}`!==r)return!1;if(o<0||o>128)return!1;return ya(n)}var Sa=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ps),U.init(e,t),e._zod.check=(n)=>{if(!Jp(n.value))n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function _a(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 cr=/^[0-9a-zA-Z+/]*={0,2}$/,va=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=cr),U.init(e,t),e._zod.check=(n)=>{if(_a(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),Qt=/^[A-Za-z0-9_-]*$/;function Yp(e){if(!Qt.test(e))return!1;let t=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return _a(n)}var Ta=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Qt),U.init(e,t),e._zod.check=(n)=>{if(Yp(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Ca=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=hs),U.init(e,t)});function Xp(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var ka=h("$ZodJWT",(e,t)=>{U.init(e,t),e._zod.check=(n)=>{if(Xp(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});var ur=h("$ZodNumber",(e,t)=>{z.init(e,t),e._zod.pattern=xt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}let o=n.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),Ea=h("$ZodNumberFormat",(e,t)=>{Es.init(e,t),ur.init(e,t)}),Ra=h("$ZodBoolean",(e,t)=>{z.init(e,t),e._zod.pattern=vs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(i){}let o=n.value;if(typeof o==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}});var Aa=h("$ZodUnknown",(e,t)=>{z.init(e,t),e._zod.parse=(n)=>n}),wa=h("$ZodNever",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),Ia=h("$ZodVoid",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;if(typeof o>"u")return n;return n.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),n}}),Pa=h("$ZodDate",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(a){}let o=n.value,i=o instanceof Date;if(i&&!Number.isNaN(o.getTime()))return n;return n.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),n}});function Us(e,t,n){if(e.issues.length)t.issues.push(...de(n,e.issues));t.value[n]=e.value}var Ma=h("$ZodArray",(e,t)=>{z.init(e,t);let n=Y.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=n?n.alloc(e,r,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){let l=i[c],d=t.element._zod.run({value:l,issues:[]},o);if(d instanceof Promise)s.push(d.then((p)=>Us(p,r,c)));else if(Us(d,r,c),a&&d.issues.length!==0&&oe(d))break}if(s.length)return Promise.all(s).then(()=>r);return r}});function Yt(e,t,n,r,o,i){let s=n in r,a=i==="optional";if(!s&&a&&o==="optional")return;if(e.issues.length){if(o!==void 0&&a&&!s)return;t.issues.push(...de(n,e.issues))}if(!s&&o===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(s||o==="defaulted"&&!a)t.value[n]=void 0}else t.value[n]=e.value}var Qp=[];function Oa(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Qp,o=r.length?[...t,...r]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Ii(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function za(e,t,n,r,o,i,s){let a=[],c=o.keySet,l=o.catchall._zod,d=l.def.type,{optin:p,optout:m}=l,f=0;for(let g in t){if(s&&n.issues.length!==f){if(oe(n,f))break;f=n.issues.length}if(c.has(g))continue;if(g==="__proto__"){if(d==="never")a.push(g);continue}if(d==="never"){a.push(g);continue}let y=l.run({value:t[g],issues:[]},r);if(y instanceof Promise)e.push(y.then((S)=>Yt(S,n,g,t,p,m)));else Yt(y,n,g,t,p,m)}if(a.length)n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0});if(!e.length)return n;return Promise.all(e).then(()=>n)}var em=h("$ZodObject",(e,t)=>{z.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){let l=()=>{let d={...r};return Object.defineProperty(t,"shape",{value:d}),l.raw=d,d};l.raw=r,Object.defineProperty(t,"shape",{get:l})}let o=ft(()=>Oa(t));P(e,"propValues",(l)=>{let d=l.def.shape,p={};for(let m in d){let f=d[m]._zod;if(f.values){if(!Object.prototype.hasOwnProperty.call(p,m))te(p,m,new Set);for(let g of f.values)p[m].add(g);if(f.optin!==void 0)p[m].add(void 0)}}return p});let i=Ue,s=t.catchall,a,c=Y.memoizer;c?.attach(e),e._zod.parse=(l,d)=>{a??(a=o.value);let p=l.value;if(!i(p))return l.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),l;l.value=c?c.alloc(e,l,{},d):{};let m=[],f=a.shape,g=d?.abortEarly,y=l.issues.length;for(let S of a.allKeys){if(g&&l.issues.length!==y){if(oe(l,y))break;y=l.issues.length}if(S==="__proto__")continue;let v=f[S],k=v._zod.optin,M=v._zod.optout,R=v._zod.run({value:p[S],issues:[]},d);if(R instanceof Promise)m.push(R.then((B)=>Yt(B,l,S,p,k,M)));else Yt(R,l,S,p,k,M)}if(!s)return m.length?Promise.all(m).then(()=>l):l;return za(m,p,l,d,o.value,e,g===!0)}}),Na=h("$ZodObjectJIT",(e,t)=>{em.init(e,t);let n=e._zod.parse,r=ft(()=>Oa(t)),o=Y.memoizer,i=(f)=>{let g=r.value,y=g.symbolKeys,S=new ir(["payload","ctx"],{shape:f,inst:e,memo:o,syms:y}),v=(B)=>`shape[${B}]._zod.run({ value: input[${B}], issues: [] }, ctx)`,k=(B,A)=>`
6
+ };`)(...Object.values(this.closed))}}var Ds={major:4,minor:6,patch:5};var z=h("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ds;let o=e._zod.def.checks,r=e._zod.traits.has("$ZodCheck")?[e,...o??[]]:o?.length?[...o]:[];for(let i of r)for(let s of i._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,l)=>{if(a.memo)return a;let d=re(a),p;for(let m of c){if(m._zod.def.when){if(Oi(a))continue;if(!m._zod.def.when(a))continue}else if(d)continue;let f=a.issues.length,g=m._zod.check(a);if(g instanceof Promise&&l?.async===!1)throw new me;if(p||g instanceof Promise)p=(p??Promise.resolve()).then(async()=>{if(await g,a.issues.length===f)return;if(Zn(a.issues,f,e),!d)d=re(a,f)});else{if(a.issues.length===f)continue;if(Zn(a.issues,f,e),!d)d=re(a,f)}}if(p)return p.then(()=>a);return a},s=(a,c,l)=>{if(re(a))return a.aborted=!0,a;let d=i(c,r,l);if(d instanceof Promise){if(l.async===!1)throw new me;return d.then((p)=>e._zod.parse(p,l))}return e._zod.parse(d,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let d=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(d instanceof Promise)return d.then((p)=>s(p,a,c));return s(d,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new me;return l.then((d)=>i(d,r,c))}return i(l,r,c)}}},{get "~standard"(){return jt(this,"~standard",ao(this))},set "~standard"(e){xe(this,"~standard",e)}}),Xs=(e,t)=>e.issues.length?{issues:e.issues.map((n)=>pe(n,t,Q()))}:{value:e.value};async function Hp(e,t){let n={async:!0};return Xs(await e._zod.run({value:t,issues:[]},n),n)}function ao(e){return{validate:(t)=>{let n={async:!1};try{let o=e._zod.run({value:t,issues:[]},n);if(!(o instanceof Promise))return Xs(o,n)}catch(o){}return Hp(e,t)},vendor:"zod",version:1}}var Xt=h("$ZodString",(e,t)=>{z.init(e,t),e._zod.pattern=t.pattern??_s,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),U=h("$ZodStringFormat",(e,t)=>{St.init(e,t),Xt.init(e,t)}),Qs=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ss),U.init(e,t)}),ea=h("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=eo(o))}else t.pattern??(t.pattern=eo());U.init(e,t)}),ta=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=as),U.init(e,t)}),na=1,Jt=2;function oa(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function jp(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return oa(e)||Jt;return Vp(e,t)}function Vp(e,t){if(!t.normalize&&t.protocol?.source===gs.source&&!/^https?:\/\//i.test(e))return na;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse==="function")return n.parse(e)??Jt}return new URL(e)}catch{return Jt}}var qp=/[\t\n\r]/g;function Bs(e){return e.replace(qp,"")}function Gp(e,t){return t.lastIndex=0,t.test(e.hostname)}function Kp(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var ra=h("$ZodURL",(e,t)=>{U.init(e,t),e._zod.check=(n)=>{try{let o=n.value.trim(),r=jp(o,t);if(r===na){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(r===Jt){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(r===!0){n.value=Bs(o);return}if(t.hostname&&!Gp(r,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&&!Kp(r,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?r.href:Bs(o);return}catch(o){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),ia=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=cs()),U.init(e,t)}),sa=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?os:rs(t.length)),U.init(e,t)}),aa=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Xi),U.init(e,t)}),ca=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Qi),U.init(e,t)}),ua=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=es),U.init(e,t)}),la=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ts),U.init(e,t)}),da=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ns),U.init(e,t)}),pa=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ss(t)),U.init(e,t)}),ma=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=bs),U.init(e,t)}),fa=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=xs(t)),U.init(e,t)}),ga=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=is),U.init(e,t)}),ha=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=us),U.init(e,t)}),Wp=/^[0-9a-fA-F:.]+$/;function ya(e){if(!Wp.test(e))return!1;return oa(`http://[${e}]`)}var ba=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ls),U.init(e,t),e._zod.check=(n)=>{if(!ya(n.value))n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}});var xa=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ds),U.init(e,t)});function Jp(e){let t=e.split("/");if(t.length!==2)return!1;let[n,o]=t;if(!o)return!1;let r=Number(o);if(`${r}`!==o)return!1;if(r<0||r>128)return!1;return ya(n)}var Sa=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ps),U.init(e,t),e._zod.check=(n)=>{if(!Jp(n.value))n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function _a(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 co=/^[0-9a-zA-Z+/]*={0,2}$/,va=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=co),U.init(e,t),e._zod.check=(n)=>{if(_a(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),Qt=/^[A-Za-z0-9_-]*$/;function Yp(e){if(!Qt.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return _a(n)}var Ta=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Qt),U.init(e,t),e._zod.check=(n)=>{if(Yp(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Ca=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=hs),U.init(e,t)});function Xp(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[o]=n;if(!o)return!1;let r=JSON.parse(atob(o));if("typ"in r&&r?.typ!=="JWT")return!1;if(!r.alg)return!1;if(t&&(!("alg"in r)||r.alg!==t))return!1;return!0}catch{return!1}}var ka=h("$ZodJWT",(e,t)=>{U.init(e,t),e._zod.check=(n)=>{if(Xp(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});var uo=h("$ZodNumber",(e,t)=>{z.init(e,t),e._zod.pattern=xt,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}let r=n.value;if(typeof r==="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;let i=typeof r==="number"?Number.isNaN(r)?"NaN":!Number.isFinite(r)?String(r):void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...i?{received:i}:{}}),n}}),Ea=h("$ZodNumberFormat",(e,t)=>{Es.init(e,t),uo.init(e,t)}),Ra=h("$ZodBoolean",(e,t)=>{z.init(e,t),e._zod.pattern=vs,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(i){}let r=n.value;if(typeof r==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}});var Aa=h("$ZodUnknown",(e,t)=>{z.init(e,t),e._zod.parse=(n)=>n}),Ia=h("$ZodNever",(e,t)=>{z.init(e,t),e._zod.parse=(n,o)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),wa=h("$ZodVoid",(e,t)=>{z.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(typeof r>"u")return n;return n.issues.push({expected:"void",code:"invalid_type",input:r,inst:e}),n}}),Pa=h("$ZodDate",(e,t)=>{z.init(e,t),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(a){}let r=n.value,i=r instanceof Date;if(i&&!Number.isNaN(r.getTime()))return n;return n.issues.push({expected:"date",code:"invalid_type",input:r,...i?{received:"Invalid Date"}:{},inst:e}),n}});function Us(e,t,n){if(e.issues.length)t.issues.push(...de(n,e.issues));t.value[n]=e.value}var Ma=h("$ZodArray",(e,t)=>{z.init(e,t);let n=Y.memoizer;n?.attach(e),e._zod.parse=(o,r)=>{let i=o.value;if(!Array.isArray(i))return o.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),o;o.value=n?n.alloc(e,o,Array(i.length),r):Array(i.length);let s=[],a=r?.abortEarly;for(let c=0;c<i.length;c++){let l=i[c],d=t.element._zod.run({value:l,issues:[]},r);if(d instanceof Promise)s.push(d.then((p)=>Us(p,o,c)));else if(Us(d,o,c),a&&d.issues.length!==0&&re(d))break}if(s.length)return Promise.all(s).then(()=>o);return o}});function Yt(e,t,n,o,r,i){let s=n in o,a=i==="optional";if(!s&&a&&r==="optional")return;if(e.issues.length){if(r!==void 0&&a&&!s)return;t.issues.push(...de(n,e.issues))}if(!s&&r===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(s||r==="defaulted"&&!a)t.value[n]=void 0}else t.value[n]=e.value}var Qp=[];function Oa(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),o=n.length?n:Qp,r=o.length?[...t,...o]:t;for(let s of r)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=wi(e.shape);return{...e,allKeys:r,symbolKeys:o,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function za(e,t,n,o,r,i,s){let a=[],c=r.keySet,l=r.catchall._zod,d=l.def.type,{optin:p,optout:m}=l,f=0;for(let g in t){if(s&&n.issues.length!==f){if(re(n,f))break;f=n.issues.length}if(c.has(g))continue;if(g==="__proto__"){if(d==="never")a.push(g);continue}if(d==="never"){a.push(g);continue}let y=l.run({value:t[g],issues:[]},o);if(y instanceof Promise)e.push(y.then((S)=>Yt(S,n,g,t,p,m)));else Yt(y,n,g,t,p,m)}if(a.length)n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0});if(!e.length)return n;return Promise.all(e).then(()=>n)}var em=h("$ZodObject",(e,t)=>{z.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),o=n?.get?n.get.raw:t.shape??{};if(o){let l=()=>{let d={...o};return Object.defineProperty(t,"shape",{value:d}),l.raw=d,d};l.raw=o,Object.defineProperty(t,"shape",{get:l})}let r=ft(()=>Oa(t));P(e,"propValues",(l)=>{let d=l.def.shape,p={};for(let m in d){let f=d[m]._zod;if(f.values){if(!Object.prototype.hasOwnProperty.call(p,m))te(p,m,new Set);for(let g of f.values)p[m].add(g);if(f.optin!==void 0)p[m].add(void 0)}}return p});let i=Ue,s=t.catchall,a,c=Y.memoizer;c?.attach(e),e._zod.parse=(l,d)=>{a??(a=r.value);let p=l.value;if(!i(p))return l.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),l;l.value=c?c.alloc(e,l,{},d):{};let m=[],f=a.shape,g=d?.abortEarly,y=l.issues.length;for(let S of a.allKeys){if(g&&l.issues.length!==y){if(re(l,y))break;y=l.issues.length}if(S==="__proto__")continue;let v=f[S],k=v._zod.optin,M=v._zod.optout,R=v._zod.run({value:p[S],issues:[]},d);if(R instanceof Promise)m.push(R.then((B)=>Yt(B,l,S,p,k,M)));else Yt(R,l,S,p,k,M)}if(!s)return m.length?Promise.all(m).then(()=>l):l;return za(m,p,l,d,r.value,e,g===!0)}}),Na=h("$ZodObjectJIT",(e,t)=>{em.init(e,t);let n=e._zod.parse,o=ft(()=>Oa(t)),r=Y.memoizer,i=(f)=>{let g=o.value,y=g.symbolKeys,S=new io(["payload","ctx"],{shape:f,inst:e,memo:r,syms:y}),v=(B)=>`shape[${B}]._zod.run({ value: input[${B}], issues: [] }, ctx)`,k=(B,A)=>`
7
7
  let ${B}_ab = false;
8
8
  for (let i = 0; i < ${B}.issues.length; i++) {
9
9
  const iss = ${B}.issues[i];
@@ -14,7 +14,7 @@ ${t.join(`
14
14
  if (${B}_ab && ctx && ctx.abortEarly) {
15
15
  payload.value = newResult;
16
16
  return payload;
17
- }`;S.write("const input = payload.value;");let M=Object.create(null),R=0;for(let B of g.allKeys)M[B]=`key_${R++}`;S.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let B of g.allKeys){if(B==="__proto__")continue;let A=M[B],J=typeof B==="symbol"?`syms[${y.indexOf(B)}]`:Ei(B),Te=`${J} in input`,Me=f[B],ct=Me?._zod?.optin,ut=ct!==void 0,On=Me?._zod?.optout==="optional";if(S.write(`const ${A} = ${v(J)};`),ut&&On){let lt=ct==="optional"?`${A}_present`:`${A}.value !== undefined || ${A}_present`;S.write(`
17
+ }`;S.write("const input = payload.value;");let M=Object.create(null),R=0;for(let B of g.allKeys)M[B]=`key_${R++}`;S.write(r?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let B of g.allKeys){if(B==="__proto__")continue;let A=M[B],J=typeof B==="symbol"?`syms[${y.indexOf(B)}]`:Ei(B),Te=`${J} in input`,Me=f[B],ct=Me?._zod?.optin,ut=ct!==void 0,On=Me?._zod?.optout==="optional";if(S.write(`const ${A} = ${v(J)};`),ut&&On){let lt=ct==="optional"?`${A}_present`:`${A}.value !== undefined || ${A}_present`;S.write(`
18
18
  const ${A}_present = ${Te};
19
19
  if (!${A}.issues.length || ${A}_present) {
20
20
  if (${A}.issues.length) {${k(A,J)}
@@ -53,21 +53,21 @@ ${t.join(`
53
53
  if (${A}.value !== undefined || ${Te}) {
54
54
  newResult[${J}] = ${A}.value;
55
55
  }
56
- `)}return S.write("payload.value = newResult;"),S.write("return payload;"),S.compile()},s,a=Ue,c=!Y.jitless,d=c&&Ai.value,p=t.catchall,m;e._zod.parse=(f,g)=>{m??(m=r.value);let y=f.value;if(!a(y))return f.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),f;if(c&&d&&g?.async===!1&&g.jitless!==!0){if(!s)s=i(t.shape);if(f=s(f,g),!p)return f;return za([],y,f,g,m,e,g?.abortEarly===!0)}return n(f,g)}});function Zs(e,t,n,r){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter((i)=>!oe(i));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((i)=>i.issues.map((s)=>pe(s,r,Q())))}),t}var lr=h("$ZodUnion",(e,t)=>{z.init(e,t),P(e,"optin",(r)=>r.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),P(e,"optout",(r)=>r.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),P(e,"values",(r)=>{if(r.def.options.every((o)=>o._zod.values))return new Set(r.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),P(e,"pattern",(r)=>{if(r.def.options.every((o)=>o._zod.pattern)){let o=r.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>Bt(i.source)).join("|")})$`)}return});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}if(!i)return Zs(s,r,e,o);return Promise.all(s).then((a)=>Zs(a,r,e,o))}});function tm(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 o of r)if(t.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,n)}return t}var $a=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,lr.init(e,t);let n=e._zod.parse;P(e,"propValues",(o)=>{let i={},s=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);if(c[o.def.discriminator]?.has(void 0))s++;for(let[l,d]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(i,l))te(i,l,new Set);for(let p of d)i[l].add(p)}}if(!o.def.unionFallback&&s>1)i[o.def.discriminator]?.delete(void 0);return i}),t.options.forEach((o,i)=>{let s=gt(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let r=ft(()=>tm(t));e._zod.parse=(o,i)=>{let s=o.value;if(!Ue(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=s?.[t.discriminator],c=r.value.get(a);if(c&&(a!==void 0||i.direction!=="backward"))return c._zod.run(o,i);if(t.unionFallback||i.direction==="backward")return n(o,i);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter((l)=>r.value.get(l)!==null),input:s,path:[t.discriminator],inst:e}),o}}),La=h("$ZodIntersection",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{let o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([c,l])=>Fs(n,c,l));return Fs(n,i,s)}});function sr(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(ze(e)&&ze(t)){let n=Object.keys(t),r=Object.keys(e).filter((i)=>n.indexOf(i)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of r){if(i==="__proto__")continue;let s=sr(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}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 o=e[r],i=t[r],s=sr(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Fs(e,t,n){let r=new Map,o,i=new Map,s=(l,d)=>{let p;if(l.code==="unrecognized_keys"&&!l.path?.length)o??(o=l),p=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let m=String(l.path[0]);if(!i.has(m))i.set(m,l);p=[m]}else return!1;for(let m of p){if(!r.has(m))r.set(m,{});r.get(m)[d]=!0}return!0};for(let l of t.issues)if(!s(l,"l"))e.issues.push(l);for(let l of n.issues)if(!s(l,"r"))e.issues.push(l);let a=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=o?a.filter((d)=>o.keys.includes(d)):[];if(l.length)e.issues.push({...o,keys:l});for(let d of a)if(!l.includes(d)&&i.has(d))e.issues.push(i.get(d))}let c=sr(t.value,n.value);if(!c.valid){if(oe(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var dr=h("$ZodTuple",(e,t)=>{z.init(e,t);let n=t.items,r=Y.memoizer;r?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=r?r.alloc(e,o,[],i):[];let a=[],c=Hs(n,"optin"),l=Hs(n,"optout");if(!t.rest){if(s.length<c)return o.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),o;if(s.length>n.length)o.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:s,inst:e,origin:"array"})}let d=Array(n.length),p=t.rest?i?.abortEarly:void 0,m=!1;for(let f=0;f<n.length;f++){let g=n[f]._zod.run({value:s[f],issues:[]},i);if(g instanceof Promise)a.push(g.then((y)=>{d[f]=y}));else if(d[f]=g,p&&!m&&g.issues.length)m=oe(g)}if(t.rest&&!m){let f=n.length-1,g=s.slice(n.length),y=o.issues.length;for(let S of g){if(p&&o.issues.length!==y){if(oe(o,y))break;y=o.issues.length}f++;let v=t.rest._zod.run({value:S,issues:[]},i);if(v instanceof Promise)a.push(v.then((k)=>js(k,o,f)));else js(v,o,f)}}if(a.length)return Promise.all(a).then(()=>Vs(d,o,n,s,l));return Vs(d,o,n,s,l)}});function Hs(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 js(e,t,n){if(e.issues.length)t.issues.push(...de(n,e.issues));t.value[n]=e.value}function Vs(e,t,n,r,o){for(let i=0;i<n.length;i++){let s=e[i],a=i<r.length;if(!a&&i>=o&&n[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!a&&i>=o){t.value.length=i;break}t.issues.push(...de(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=r.length;i--)if(n[i]._zod.optout==="optional"&&t.value[i]===void 0)t.value.length=i;else break;return t}var Da=h("$ZodRecord",(e,t)=>{z.init(e,t);let n=Y.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!ze(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){r.value=n?n.alloc(e,r,{},o):{};let c=new Set;for(let d of a)if(typeof d==="string"||typeof d==="number"||typeof d==="symbol"){if(c.add(typeof d==="number"?d.toString():d),d==="__proto__")continue;let p=t.keyType._zod.run({value:d,issues:[]},o);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)=>pe(g,o,Q())),input:d,path:[d],inst:e});continue}let m=p.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:i[d],issues:[]},o);if(f instanceof Promise)s.push(f.then((g)=>{if(g.issues.length)r.issues.push(...de(d,g.issues));r.value[m]=g.value}));else{if(f.issues.length)r.issues.push(...de(d,f.issues));r.value[m]=f.value}}let l;for(let d in i)if(!c.has(d))if(t.mode==="loose"){if(d==="__proto__")continue;r.value[d]=i[d]}else l=l??[],l.push(d);if(l&&l.length>0)r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},o):{};let c;for(let l of Reflect.ownKeys(i)){if(l==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,l))continue;let d=t.keyType._zod.run({value:l,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof l==="string"&&xt.test(l)&&d.issues.length){let g=t.keyType._zod.run({value:Number(l),issues:[]},o);if(g instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(g.issues.length===0)d=g}if(d.issues.length){if(t.mode==="loose")r.value[l]=i[l];else if(a)c=c??[],c.push(l);else r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((g)=>pe(g,o,Q())),input:l,path:[l],inst:e});continue}let m=d.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:i[l],issues:[]},o);if(f instanceof Promise)s.push(f.then((g)=>{if(g.issues.length)r.issues.push(...de(l,g.issues));r.value[m]=g.value}));else{if(f.issues.length)r.issues.push(...de(l,f.issues));r.value[m]=f.value}}if(c&&c.length>0)r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}if(s.length)return Promise.all(s).then(()=>r);return r}});var Ba=h("$ZodEnum",(e,t)=>{z.init(e,t);let n=pt(t.entries),r=new Set(n);e._zod.values=r,P(e,"pattern",(o)=>{let i=pt(o.def.entries).filter((s)=>wi.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>Ee(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(r.has(s))return o;return o.issues.push({code:"invalid_value",values:n,input:s,inst:e}),o}}),Ua=h("$ZodLiteral",(e,t)=>{z.init(e,t);let n=new Set(t.values);e._zod.values=n,P(e,"pattern",(r)=>{let o=r.def.values;return new RegExp(o.length?`^(${o.map((i)=>typeof i==="string"?Ee(i):i?Ee(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{let i=r.value;if(n.has(i))return r;return r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}});var Za=h("$ZodTransform",(e,t)=>{z.init(e,t),e._zod.optin="optional",Y.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ht(e.constructor.name);let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(n.value=s,n));if(o instanceof Promise)throw new me;return n.value=o,n}});function qs(e,t){return e.value=t.issues.length?void 0:t.value,e}var pr=h("$ZodOptional",(e,t)=>{z.init(e,t),P(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",P(e,"values",(n)=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),P(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Bt(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let o=t.innerType._zod.run({value:n.value,issues:[]},r);if(o instanceof Promise)return o.then((i)=>qs(n,i));return qs(n,o)}return t.innerType._zod.run(n,r)}}),Fa=h("$ZodExactOptional",(e,t)=>{pr.init(e,t),P(e,"values",(n)=>n.def.innerType._zod.values),P(e,"pattern",(n)=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Ha=h("$ZodNullable",(e,t)=>{z.init(e,t),P(e,"optin",(n)=>n.def.innerType._zod.optin),P(e,"optout",(n)=>n.def.innerType._zod.optout),P(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Bt(r.source)}|null)$`):void 0}),P(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)}}),ja=h("$ZodDefault",(e,t)=>{z.init(e,t),e._zod.optin="defaulted",P(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 o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then((i)=>Gs(i,t));return Gs(o,t)}});function Gs(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Va=h("$ZodPrefault",(e,t)=>{z.init(e,t),e._zod.optin="defaulted",P(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)}}),qa=h("$ZodNonOptional",(e,t)=>{z.init(e,t),P(e,"values",(n)=>{let r=n.def.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(n,r)=>{let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then((i)=>Ks(i,e));return Ks(o,e)}});function Ks(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 Ws(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((o)=>pe(o,r,Q()))},input:e.value}),e}var Ga=h("$ZodCatch",(e,t)=>{z.init(e,t),P(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),P(e,"optout",(n)=>n.def.innerType._zod.optout),P(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 o=t.innerType._zod.run({value:n.value,issues:[]},r);if(o instanceof Promise)return o.then((i)=>Ws(n,i,t,r));return Ws(n,o,t,r)}});var mr=h("$ZodPipe",(e,t)=>{z.init(e,t),P(e,"values",(n)=>n.def.in._zod.values),P(e,"optin",(n)=>n.def.in._zod.optin),P(e,"optout",(n)=>n.def.out._zod.optout),P(e,"propValues",(n)=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let i=t.out._zod.run(n,r);if(i instanceof Promise)return i.then((s)=>Wt(s,t.in,r));return Wt(i,t.in,r)}let o=t.in._zod.run(n,r);if(o instanceof Promise)return o.then((i)=>Wt(i,t.out,r));return Wt(o,t.out,r)}});function Wt(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 Ka=h("$ZodPreprocess",(e,t)=>{mr.init(e,t)}),Wa=h("$ZodReadonly",(e,t)=>{z.init(e,t),P(e,"propValues",(n)=>n.def.innerType._zod.propValues),P(e,"values",(n)=>n.def.innerType._zod.values),P(e,"optin",(n)=>n.def.innerType?._zod?.optin),P(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 o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then(Js);return Js(o)}});function Js(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Ja=h("$ZodFunction",(e,t)=>(z.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 o=e._def.input?Wn(e._def.input,r):r,i=Reflect.apply(n,this,o);if(e._def.output)return Wn(e._def.output,i);return i},"_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 o=e._def.input?await Jn(e._def.input,r):r,i=await Reflect.apply(n,this,o);if(e._def.output)return await Jn(e._def.output,i);return i},"_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 dr({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)),Ya=h("$ZodPromise",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>Promise.resolve(n.value).then((o)=>t.innerType._zod.run({value:o,issues:[]},r))});var Xa=h("$ZodCustom",(e,t)=>{G.init(e,t),z.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=(n)=>{let r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then((i)=>Ys(i,n,r,e));Ys(o,n,r,e);return}});function Ys(e,t,n,r){if(!e){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};if(r._zod.def.params)o.params=r._zod.def.params;t.issues.push(Ne(o))}}class ec extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var gr="~memo",Qa=[];function tc(e){return e!==null&&typeof e==="object"}function fr(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var nc=new WeakMap,_t=0,nn=1,vt=2;function rn(e,t,n){let r=nc.get(e);if(r!==void 0)return r?vt:_t;if(t.has(e))return vt;t.add(e);let o=_t,i=(d)=>{if(o!==vt&&d?._zod){let p=rn(d,t,n);if(p>o)o=p}},s=(d,p)=>{let m=_t;for(let f of Reflect.ownKeys(d)){let g=Object.getOwnPropertyDescriptor(d,f);if(p&&!g.enumerable)continue;let y=g.get?nn:g.value?._zod?rn(g.value,t,n):_t;if(y>m)m=y}return m},a=(d)=>{if(d>o)o=d},c=e._zod.def,l=c.type;switch(l){case"object":{let d=gt(c);a(d?s(d,!0):nn),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let d of c.items)i(d);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(let d of c.options)i(d);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{let d=c._cachedInner??(n?e._zod.innerType:void 0);a(d?rn(d,t,!1):nn);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 c){let p=Object.getOwnPropertyDescriptor(c,d);if(!p||p.get)continue;let m=p.value;if(!m||typeof m!=="object")continue;if(m._zod)i(m);else if(Array.isArray(m))for(let f of m)i(f)}}return t.delete(e),nm(e,o)}function nm(e,t){if(t!==nn)nc.set(e,t===vt);return t}function rm(e,t){let n=e.buckets.get(t);if(!n)n=new WeakMap,e.buckets.set(t,n);return n}var en,tn=[],om={alloc(e,t,n){let r=en;if(!r)return n;en=void 0;let o={value:n,issues:null};return r.set(t.value,o),tn.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,r=(o,i)=>{if(i.direction!=="backward"&&im(i,o.value))throw new ec;return n(o,i)};if(e._zod.parse=r,e._zod.run===n)e._zod.run=r})},attach(e){var t;let n,r=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,l)=>{if(n===void 0){let v=rn(e,new Set,!1);if(v===_t){if(e._zod.parse=s,e._zod.run===a)e._zod.run=s;return s(c,l)}if(v===vt||r)n=!0;else r=!0}let d=c.value;if(!tc(d))return s(c,l);let p=l[gr];if(!p)p={buckets:new WeakMap,backEdges:void 0},l[gr]=p;let m;if(o===l)m=i;else m=rm(p,e),o=l,i=m;let f=m.get(d);if(f){if(c.value=f.value,f.issues){if(f.issues.length)c.issues.push(...fr(f.issues))}else c.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(f.value);return c}en=m;let g=tn.length,y=s(c,l);en=void 0;let S=tn.length>g?tn.pop():void 0;if(y instanceof Promise)return y.then((v)=>{if(S)S.issues=v.issues.length?fr(v.issues):Qa;return v});if(S)S.issues=y.issues.length?fr(y.issues):Qa;return y};if(e._zod.parse=a,e._zod.run===s)e._zod.run=a})}};function hr(){return om}function im(e,t){let n=e[gr]?.backEdges;return n!==void 0&&tc(t)&&n.has(t)}var sm=()=>{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(i){return e[i]??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 o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return r[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=zi(i.input),c=o(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${Bn(i.values[0])}`;return`Invalid option: expected one of ${$n(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",a=t(i.origin);if(a)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",a=t(i.origin);if(a)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${n[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${$n(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((a)=>`'${a}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function yr(){return{localeError:sm()}}var rc;class oc{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 ic(){return new oc}(rc=globalThis).__zod_globalRegistry??(rc.__zod_globalRegistry=ic());var Re=globalThis.__zod_globalRegistry;function sc(e){if(e.checks)e.checks=[...e.checks];return e}function ac(e,t){return new e(sc({type:"string",..._(t)}))}function cc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}function uc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}function lc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}function dc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}function pc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}function mc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}function fc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}function gc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}function hc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}function yc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}function bc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}function xc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}function Sc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}function _c(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}function vc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}function Tc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}function Cc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}function kc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}function Ec(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}function Rc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}function Ac(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}function wc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}function Ic(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}function Pc(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}function Mc(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}function Oc(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}function zc(e,t){return new e(sc({type:"number",checks:[],..._(t)}))}function Nc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}function $c(e,t){return new e({type:"boolean",..._(t)})}function Lc(e){return new e({type:"unknown"})}function Dc(e,t){return new e({type:"never",..._(t)})}function Bc(e,t){return new e({type:"void",..._(t)})}function Uc(e,t){return new e({type:"date",..._(t)})}function on(e,t){return new rr({check:"less_than",..._(t),value:e,inclusive:!1})}function Fe(e,t){return new rr({check:"less_than",..._(t),value:e,inclusive:!0})}function sn(e,t){return new or({check:"greater_than",..._(t),value:e,inclusive:!1})}function He(e,t){return new or({check:"greater_than",..._(t),value:e,inclusive:!0})}function an(e,t){return new ks({check:"multiple_of",..._(t),value:e})}function cn(e,t){return new Rs({check:"max_length",..._(t),maximum:e})}function je(e,t){return new As({check:"min_length",..._(t),minimum:e})}function un(e,t){return new ws({check:"length_equals",..._(t),length:e})}function br(e,t){return new Is({check:"string_format",format:"regex",..._(t),pattern:e})}function xr(e){return new Ps({check:"string_format",format:"lowercase",..._(e)})}function Sr(e){return new Ms({check:"string_format",format:"uppercase",..._(e)})}function _r(e,t){return new Os({check:"string_format",format:"includes",..._(t),includes:e})}function vr(e,t){return new zs({check:"string_format",format:"starts_with",..._(t),prefix:e})}function Tr(e,t){return new Ns({check:"string_format",format:"ends_with",..._(t),suffix:e})}function Ae(e){return new $s({check:"overwrite",tx:e})}function Cr(e){return Ae((t)=>t.normalize(e))}function kr(){return Ae((e)=>e.trim())}function Er(){return Ae((e)=>e.toLowerCase())}function Rr(){return Ae((e)=>e.toUpperCase())}function Ar(){return Ae((e)=>Ri(e))}function Zc(e,t,n){return new e({type:"array",element:t,..._(n)})}function Fc(e,t,n){let r=_(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function Hc(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._(n)})}function jc(e,t){let n=am((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(Ne(o,r.value,n._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=r.value;i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(Ne(i))}},e(r.value,r)),t);return n}function am(e,t){let n=new G({check:"custom",..._(t)});return n._zod.check=e,n}function Tt(e,...t){for(let n of t)for(let r of Reflect.ownKeys(n))if(Object.prototype.propertyIsEnumerable.call(n,r))te(e,r,n[r]);return e}function kt(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??Re,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 q(e,t,n,r,o){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(o);return Object.assign(n,i),!0}function D(e,t,n={path:[],schemaPath:[]}){var r;let o=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,n.schemaPath.includes(e))i.cycle=n.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let d={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,d);else{let m=s.schema,f=t.processors[o.type];if(!f)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,m,d)}let p=e._zod.parent;if(p){if(!s.ref)s.ref=p;D(p,t,d),t.seen.get(p).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Tt(s.schema,c);if(t.io==="input"&&X(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(r=s.schema).default??(r.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function Vc(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Et(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 s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=r.get(a);if(c&&c!==s[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}let o=(s)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(s[0])?.id,m=e.external.uri??((g)=>g);if(p)return{ref:m(p)};let f=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=f,{defId:f,ref:`${m("__shared")}#/${a}/${Vc(f)}`}}let c="#",l=`${c}/${a}/`;if(s[1]===n&&!s[1].schema.id)return{ref:c};let d=s[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:l+Vc(d)}},i=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:l}=o(s);if(a.def={...a.schema},l)a.defId=l;let d=a.schema;for(let p in d)delete d[p];d.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
56
+ `)}return S.write("payload.value = newResult;"),S.write("return payload;"),S.compile()},s,a=Ue,c=!Y.jitless,d=c&&Ai.value,p=t.catchall,m;e._zod.parse=(f,g)=>{m??(m=o.value);let y=f.value;if(!a(y))return f.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),f;if(c&&d&&g?.async===!1&&g.jitless!==!0){if(!s)s=i(t.shape);if(f=s(f,g),!p)return f;return za([],y,f,g,m,e,g?.abortEarly===!0)}return n(f,g)}});function Zs(e,t,n,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let r=e.filter((i)=>!re(i));if(r.length===1)return t.value=r[0].value,r[0];return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((i)=>i.issues.map((s)=>pe(s,o,Q())))}),t}var lo=h("$ZodUnion",(e,t)=>{z.init(e,t),P(e,"optin",(o)=>o.def.options.some((r)=>r._zod.optin==="defaulted")?"defaulted":o.def.options.some((r)=>r._zod.optin!==void 0)?"optional":void 0),P(e,"optout",(o)=>o.def.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),P(e,"values",(o)=>{if(o.def.options.every((r)=>r._zod.values))return new Set(o.def.options.flatMap((r)=>Array.from(r._zod.values)));return}),P(e,"pattern",(o)=>{if(o.def.options.every((r)=>r._zod.pattern)){let r=o.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${r.map((i)=>Bt(i.source)).join("|")})$`)}return});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,r)=>{if(n)return n(o,r);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},r);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}if(!i)return Zs(s,o,e,r);return Promise.all(s).then((a)=>Zs(a,o,e,r))}});function tm(e){let t=new Map;for(let n of e.options){let o=n._zod.propValues?.[e.discriminator];if(!o||o.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let r of o)if(t.has(r)){if(r!==void 0)throw Error(`Duplicate discriminator value "${String(r)}"`);t.set(r,null)}else t.set(r,n)}return t}var $a=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,lo.init(e,t);let n=e._zod.parse;P(e,"propValues",(r)=>{let i={},s=0;for(let a of r.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw Error(`Invalid discriminated union option at index "${r.def.options.indexOf(a)}"`);if(c[r.def.discriminator]?.has(void 0))s++;for(let[l,d]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(i,l))te(i,l,new Set);for(let p of d)i[l].add(p)}}if(!r.def.unionFallback&&s>1)i[r.def.discriminator]?.delete(void 0);return i}),t.options.forEach((r,i)=>{let s=gt(r._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let o=ft(()=>tm(t));e._zod.parse=(r,i)=>{let s=r.value;if(!Ue(s))return r.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),r;let a=s?.[t.discriminator],c=o.value.get(a);if(c&&(a!==void 0||i.direction!=="backward"))return c._zod.run(r,i);if(t.unionFallback||i.direction==="backward")return n(r,i);return r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()).filter((l)=>o.value.get(l)!==null),input:s,path:[t.discriminator],inst:e}),r}}),La=h("$ZodIntersection",(e,t)=>{z.init(e,t),e._zod.parse=(n,o)=>{let r=n.value,i=t.left._zod.run({value:r,issues:[]},o),s=t.right._zod.run({value:r,issues:[]},o);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([c,l])=>Fs(n,c,l));return Fs(n,i,s)}});function so(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(ze(e)&&ze(t)){let n=Object.keys(t),o=Object.keys(e).filter((i)=>n.indexOf(i)!==-1),r={...e,...t};if(Object.prototype.hasOwnProperty.call(r,"__proto__"))delete r.__proto__;for(let i of o){if(i==="__proto__")continue;let s=so(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};r[i]=s.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let o=0;o<e.length;o++){let r=e[o],i=t[o],s=so(r,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Fs(e,t,n){let o=new Map,r,i=new Map,s=(l,d)=>{let p;if(l.code==="unrecognized_keys"&&!l.path?.length)r??(r=l),p=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let m=String(l.path[0]);if(!i.has(m))i.set(m,l);p=[m]}else return!1;for(let m of p){if(!o.has(m))o.set(m,{});o.get(m)[d]=!0}return!0};for(let l of t.issues)if(!s(l,"l"))e.issues.push(l);for(let l of n.issues)if(!s(l,"r"))e.issues.push(l);let a=[...o].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=r?a.filter((d)=>r.keys.includes(d)):[];if(l.length)e.issues.push({...r,keys:l});for(let d of a)if(!l.includes(d)&&i.has(d))e.issues.push(i.get(d))}let c=so(t.value,n.value);if(!c.valid){if(re(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var po=h("$ZodTuple",(e,t)=>{z.init(e,t);let n=t.items,o=Y.memoizer;o?.attach(e),e._zod.parse=(r,i)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=o?o.alloc(e,r,[],i):[];let a=[],c=Hs(n,"optin"),l=Hs(n,"optout");if(!t.rest){if(s.length<c)return r.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),r;if(s.length>n.length)r.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:s,inst:e,origin:"array"})}let d=Array(n.length),p=t.rest?i?.abortEarly:void 0,m=!1;for(let f=0;f<n.length;f++){let g=n[f]._zod.run({value:s[f],issues:[]},i);if(g instanceof Promise)a.push(g.then((y)=>{d[f]=y}));else if(d[f]=g,p&&!m&&g.issues.length)m=re(g)}if(t.rest&&!m){let f=n.length-1,g=s.slice(n.length),y=r.issues.length;for(let S of g){if(p&&r.issues.length!==y){if(re(r,y))break;y=r.issues.length}f++;let v=t.rest._zod.run({value:S,issues:[]},i);if(v instanceof Promise)a.push(v.then((k)=>js(k,r,f)));else js(v,r,f)}}if(a.length)return Promise.all(a).then(()=>Vs(d,r,n,s,l));return Vs(d,r,n,s,l)}});function Hs(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 js(e,t,n){if(e.issues.length)t.issues.push(...de(n,e.issues));t.value[n]=e.value}function Vs(e,t,n,o,r){for(let i=0;i<n.length;i++){let s=e[i],a=i<o.length;if(!a&&i>=r&&n[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!a&&i>=r){t.value.length=i;break}t.issues.push(...de(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=o.length;i--)if(n[i]._zod.optout==="optional"&&t.value[i]===void 0)t.value.length=i;else break;return t}var Da=h("$ZodRecord",(e,t)=>{z.init(e,t);let n=Y.memoizer;n?.attach(e),e._zod.parse=(o,r)=>{let i=o.value;if(!ze(i))return o.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),o;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){o.value=n?n.alloc(e,o,{},r):{};let c=new Set;for(let d of a)if(typeof d==="string"||typeof d==="number"||typeof d==="symbol"){if(c.add(typeof d==="number"?d.toString():d),d==="__proto__")continue;let p=t.keyType._zod.run({value:d,issues:[]},r);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(p.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map((g)=>pe(g,r,Q())),input:d,path:[d],inst:e});continue}let m=p.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:i[d],issues:[]},r);if(f instanceof Promise)s.push(f.then((g)=>{if(g.issues.length)o.issues.push(...de(d,g.issues));o.value[m]=g.value}));else{if(f.issues.length)o.issues.push(...de(d,f.issues));o.value[m]=f.value}}let l;for(let d in i)if(!c.has(d))if(t.mode==="loose"){if(d==="__proto__")continue;o.value[d]=i[d]}else l=l??[],l.push(d);if(l&&l.length>0)o.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{o.value=n?n.alloc(e,o,{},r):{};let c;for(let l of Reflect.ownKeys(i)){if(l==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,l))continue;let d=t.keyType._zod.run({value:l,issues:[]},r);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof l==="string"&&xt.test(l)&&d.issues.length){let g=t.keyType._zod.run({value:Number(l),issues:[]},r);if(g instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(g.issues.length===0)d=g}if(d.issues.length){if(t.mode==="loose")o.value[l]=i[l];else if(a)c=c??[],c.push(l);else o.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((g)=>pe(g,r,Q())),input:l,path:[l],inst:e});continue}let m=d.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:i[l],issues:[]},r);if(f instanceof Promise)s.push(f.then((g)=>{if(g.issues.length)o.issues.push(...de(l,g.issues));o.value[m]=g.value}));else{if(f.issues.length)o.issues.push(...de(l,f.issues));o.value[m]=f.value}}if(c&&c.length>0)o.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}if(s.length)return Promise.all(s).then(()=>o);return o}});var Ba=h("$ZodEnum",(e,t)=>{z.init(e,t);let n=pt(t.entries),o=new Set(n);e._zod.values=o,P(e,"pattern",(r)=>{let i=pt(r.def.entries).filter((s)=>Ii.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>Ee(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,i)=>{let s=r.value;if(o.has(s))return r;return r.issues.push({code:"invalid_value",values:n,input:s,inst:e}),r}}),Ua=h("$ZodLiteral",(e,t)=>{z.init(e,t);let n=new Set(t.values);e._zod.values=n,P(e,"pattern",(o)=>{let r=o.def.values;return new RegExp(r.length?`^(${r.map((i)=>typeof i==="string"?Ee(i):i?Ee(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,r)=>{let i=o.value;if(n.has(i))return o;return o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}});var Za=h("$ZodTransform",(e,t)=>{z.init(e,t),e._zod.optin="optional",Y.memoizer?.guard(e),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new ht(e.constructor.name);let r=t.transform(n.value,n);if(o.async)return(r instanceof Promise?r:Promise.resolve(r)).then((s)=>(n.value=s,n));if(r instanceof Promise)throw new me;return n.value=r,n}});function qs(e,t){return e.value=t.issues.length?void 0:t.value,e}var mo=h("$ZodOptional",(e,t)=>{z.init(e,t),P(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",P(e,"values",(n)=>{let o=n.def.innerType._zod.values;return o?new Set([...o,void 0]):void 0}),P(e,"pattern",(n)=>{let o=n.def.innerType._zod.pattern;return o?new RegExp(`^(${Bt(o.source)})?$`):void 0}),e._zod.parse=(n,o)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let r=t.innerType._zod.run({value:n.value,issues:[]},o);if(r instanceof Promise)return r.then((i)=>qs(n,i));return qs(n,r)}return t.innerType._zod.run(n,o)}}),Fa=h("$ZodExactOptional",(e,t)=>{mo.init(e,t),P(e,"values",(n)=>n.def.innerType._zod.values),P(e,"pattern",(n)=>n.def.innerType._zod.pattern),e._zod.parse=(n,o)=>t.innerType._zod.run(n,o)}),Ha=h("$ZodNullable",(e,t)=>{z.init(e,t),P(e,"optin",(n)=>n.def.innerType._zod.optin),P(e,"optout",(n)=>n.def.innerType._zod.optout),P(e,"pattern",(n)=>{let o=n.def.innerType._zod.pattern;return o?new RegExp(`^(${Bt(o.source)}|null)$`):void 0}),P(e,"values",(n)=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,o)=>{if(n.value===null)return n;return t.innerType._zod.run(n,o)}}),ja=h("$ZodDefault",(e,t)=>{z.init(e,t),e._zod.optin="defaulted",P(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);if(n.value===void 0)return n.value=t.defaultValue,n;let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>Gs(i,t));return Gs(r,t)}});function Gs(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Va=h("$ZodPrefault",(e,t)=>{z.init(e,t),e._zod.optin="defaulted",P(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);if(n.value===void 0)n.value=t.defaultValue;return t.innerType._zod.run(n,o)}}),qa=h("$ZodNonOptional",(e,t)=>{z.init(e,t),P(e,"values",(n)=>{let o=n.def.innerType._zod.values;return o?new Set([...o].filter((r)=>r!==void 0)):void 0}),e._zod.parse=(n,o)=>{let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>Ks(i,e));return Ks(r,e)}});function Ks(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 Ws(e,t,n,o){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((r)=>pe(r,o,Q()))},input:e.value}),e}var Ga=h("$ZodCatch",(e,t)=>{z.init(e,t),P(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),P(e,"optout",(n)=>n.def.innerType._zod.optout),P(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);let r=t.innerType._zod.run({value:n.value,issues:[]},o);if(r instanceof Promise)return r.then((i)=>Ws(n,i,t,o));return Ws(n,r,t,o)}});var fo=h("$ZodPipe",(e,t)=>{z.init(e,t),P(e,"values",(n)=>n.def.in._zod.values),P(e,"optin",(n)=>n.def.in._zod.optin),P(e,"optout",(n)=>n.def.out._zod.optout),P(e,"propValues",(n)=>n.def.in._zod.propValues),e._zod.parse=(n,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(n,o);if(i instanceof Promise)return i.then((s)=>Wt(s,t.in,o));return Wt(i,t.in,o)}let r=t.in._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>Wt(i,t.out,o));return Wt(r,t.out,o)}});function Wt(e,t,n){if(e.issues.some((o)=>o.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},n)}var Ka=h("$ZodPreprocess",(e,t)=>{fo.init(e,t)}),Wa=h("$ZodReadonly",(e,t)=>{z.init(e,t),P(e,"propValues",(n)=>n.def.innerType._zod.propValues),P(e,"values",(n)=>n.def.innerType._zod.values),P(e,"optin",(n)=>n.def.innerType?._zod?.optin),P(e,"optout",(n)=>n.def.innerType?._zod?.optout),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);let r=t.innerType._zod.run(n,o);if(r instanceof Promise)return r.then(Js);return Js(r)}});function Js(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Ja=h("$ZodFunction",(e,t)=>(z.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(...o){let r=e._def.input?Wn(e._def.input,o):o,i=Reflect.apply(n,this,r);if(e._def.output)return Wn(e._def.output,i);return i},"_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(...o){let r=e._def.input?await Jn(e._def.input,o):o,i=await Reflect.apply(n,this,r);if(e._def.output)return await Jn(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(n,o)=>{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 o=e.constructor;if(Array.isArray(n[0]))return new o({type:"function",input:new po({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output});return new o({type:"function",input:n[0],output:e._def.output})},e.output=(n)=>new e.constructor({type:"function",input:e._def.input,output:n}),e)),Ya=h("$ZodPromise",(e,t)=>{z.init(e,t),e._zod.parse=(n,o)=>Promise.resolve(n.value).then((r)=>t.innerType._zod.run({value:r,issues:[]},o))});var Xa=h("$ZodCustom",(e,t)=>{G.init(e,t),z.init(e,t),e._zod.parse=(n,o)=>n,e._zod.check=(n)=>{let o=n.value,r=t.fn(o);if(r instanceof Promise)return r.then((i)=>Ys(i,n,o,e));Ys(r,n,o,e);return}});function Ys(e,t,n,o){if(!e){let r={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)r.params=o._zod.def.params;t.issues.push(Ne(r))}}class ec extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var ho="~memo",Qa=[];function tc(e){return e!==null&&typeof e==="object"}function go(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var nc=new WeakMap,_t=0,nn=1,vt=2;function on(e,t,n){let o=nc.get(e);if(o!==void 0)return o?vt:_t;if(t.has(e))return vt;t.add(e);let r=_t,i=(d)=>{if(r!==vt&&d?._zod){let p=on(d,t,n);if(p>r)r=p}},s=(d,p)=>{let m=_t;for(let f of Reflect.ownKeys(d)){let g=Object.getOwnPropertyDescriptor(d,f);if(p&&!g.enumerable)continue;let y=g.get?nn:g.value?._zod?on(g.value,t,n):_t;if(y>m)m=y}return m},a=(d)=>{if(d>r)r=d},c=e._zod.def,l=c.type;switch(l){case"object":{let d=gt(c);a(d?s(d,!0):nn),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let d of c.items)i(d);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(let d of c.options)i(d);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{let d=c._cachedInner??(n?e._zod.innerType:void 0);a(d?on(d,t,!1):nn);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 c){let p=Object.getOwnPropertyDescriptor(c,d);if(!p||p.get)continue;let m=p.value;if(!m||typeof m!=="object")continue;if(m._zod)i(m);else if(Array.isArray(m))for(let f of m)i(f)}}return t.delete(e),nm(e,r)}function nm(e,t){if(t!==nn)nc.set(e,t===vt);return t}function om(e,t){let n=e.buckets.get(t);if(!n)n=new WeakMap,e.buckets.set(t,n);return n}var en,tn=[],rm={alloc(e,t,n){let o=en;if(!o)return n;en=void 0;let r={value:n,issues:null};return o.set(t.value,r),tn.push(r),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,o=(r,i)=>{if(i.direction!=="backward"&&im(i,r.value))throw new ec;return n(r,i)};if(e._zod.parse=o,e._zod.run===n)e._zod.run=o})},attach(e){var t;let n,o=!1,r,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,l)=>{if(n===void 0){let v=on(e,new Set,!1);if(v===_t){if(e._zod.parse=s,e._zod.run===a)e._zod.run=s;return s(c,l)}if(v===vt||o)n=!0;else o=!0}let d=c.value;if(!tc(d))return s(c,l);let p=l[ho];if(!p)p={buckets:new WeakMap,backEdges:void 0},l[ho]=p;let m;if(r===l)m=i;else m=om(p,e),r=l,i=m;let f=m.get(d);if(f){if(c.value=f.value,f.issues){if(f.issues.length)c.issues.push(...go(f.issues))}else c.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(f.value);return c}en=m;let g=tn.length,y=s(c,l);en=void 0;let S=tn.length>g?tn.pop():void 0;if(y instanceof Promise)return y.then((v)=>{if(S)S.issues=v.issues.length?go(v.issues):Qa;return v});if(S)S.issues=y.issues.length?go(y.issues):Qa;return y};if(e._zod.parse=a,e._zod.run===s)e._zod.run=a})}};function yo(){return rm}function im(e,t){let n=e[ho]?.backEdges;return n!==void 0&&tc(t)&&n.has(t)}var sm=()=>{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(i){return e[i]??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"},o={nan:"NaN"};function r(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return o[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=r(i.expected),a=zi(i.input),c=r(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${Bn(i.values[0])}`;return`Invalid option: expected one of ${$n(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",a=t(i.origin);if(a)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",a=t(i.origin);if(a)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${n[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${$n(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((a)=>`'${a}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function bo(){return{localeError:sm()}}var oc;class rc{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 o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function ic(){return new rc}(oc=globalThis).__zod_globalRegistry??(oc.__zod_globalRegistry=ic());var Re=globalThis.__zod_globalRegistry;function sc(e){if(e.checks)e.checks=[...e.checks];return e}function ac(e,t){return new e(sc({type:"string",..._(t)}))}function cc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}function uc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}function lc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}function dc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}function pc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}function mc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}function fc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}function gc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}function hc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}function yc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}function bc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}function xc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}function Sc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}function _c(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}function vc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}function Tc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}function Cc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}function kc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}function Ec(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}function Rc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}function Ac(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}function Ic(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}function wc(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}function Pc(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}function Mc(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}function Oc(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}function zc(e,t){return new e(sc({type:"number",checks:[],..._(t)}))}function Nc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}function $c(e,t){return new e({type:"boolean",..._(t)})}function Lc(e){return new e({type:"unknown"})}function Dc(e,t){return new e({type:"never",..._(t)})}function Bc(e,t){return new e({type:"void",..._(t)})}function Uc(e,t){return new e({type:"date",..._(t)})}function rn(e,t){return new oo({check:"less_than",..._(t),value:e,inclusive:!1})}function Fe(e,t){return new oo({check:"less_than",..._(t),value:e,inclusive:!0})}function sn(e,t){return new ro({check:"greater_than",..._(t),value:e,inclusive:!1})}function He(e,t){return new ro({check:"greater_than",..._(t),value:e,inclusive:!0})}function an(e,t){return new ks({check:"multiple_of",..._(t),value:e})}function cn(e,t){return new Rs({check:"max_length",..._(t),maximum:e})}function je(e,t){return new As({check:"min_length",..._(t),minimum:e})}function un(e,t){return new Is({check:"length_equals",..._(t),length:e})}function xo(e,t){return new ws({check:"string_format",format:"regex",..._(t),pattern:e})}function So(e){return new Ps({check:"string_format",format:"lowercase",..._(e)})}function _o(e){return new Ms({check:"string_format",format:"uppercase",..._(e)})}function vo(e,t){return new Os({check:"string_format",format:"includes",..._(t),includes:e})}function To(e,t){return new zs({check:"string_format",format:"starts_with",..._(t),prefix:e})}function Co(e,t){return new Ns({check:"string_format",format:"ends_with",..._(t),suffix:e})}function Ae(e){return new $s({check:"overwrite",tx:e})}function ko(e){return Ae((t)=>t.normalize(e))}function Eo(){return Ae((e)=>e.trim())}function Ro(){return Ae((e)=>e.toLowerCase())}function Ao(){return Ae((e)=>e.toUpperCase())}function Io(){return Ae((e)=>Ri(e))}function Zc(e,t,n){return new e({type:"array",element:t,..._(n)})}function Fc(e,t,n){let o=_(n);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Hc(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._(n)})}function jc(e,t){let n=am((o)=>(o.addIssue=(r)=>{if(typeof r==="string")o.issues.push(Ne(r,o.value,n._zod.def));else{let i=r;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=o.value;i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),o.issues.push(Ne(i))}},e(o.value,o)),t);return n}function am(e,t){let n=new G({check:"custom",..._(t)});return n._zod.check=e,n}function Tt(e,...t){for(let n of t)for(let o of Reflect.ownKeys(n))if(Object.prototype.propertyIsEnumerable.call(n,o))te(e,o,n[o]);return e}function kt(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??Re,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 q(e,t,n,o,r){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:o.path,message:r}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(r);return Object.assign(n,i),!0}function D(e,t,n={path:[],schemaPath:[]}){var o;let r=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,n.schemaPath.includes(e))i.cycle=n.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let d={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,d);else{let m=s.schema,f=t.processors[r.type];if(!f)throw Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);f(e,t,m,d)}let p=e._zod.parent;if(p){if(!s.ref)s.ref=p;D(p,t,d),t.seen.get(p).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Tt(s.schema,c);if(t.io==="input"&&X(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(o=s.schema).default??(o.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function Vc(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Et(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 o=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=o.get(a);if(c&&c!==s[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,s[0])}}let r=(s)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(s[0])?.id,m=e.external.uri??((g)=>g);if(p)return{ref:m(p)};let f=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=f,{defId:f,ref:`${m("__shared")}#/${a}/${Vc(f)}`}}let c="#",l=`${c}/${a}/`;if(s[1]===n&&!s[1].schema.id)return{ref:c};let d=s[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:l+Vc(d)}},i=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:l}=r(s);if(a.def={...a.schema},l)a.defId=l;let d=a.schema;for(let p in d)delete d[p];d.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
57
57
 
58
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Kc(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;Kc(r);let o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;let i=r.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!n.includes(s))n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Wc=new Set(["type","properties","required","additionalProperties"]),qc=["oneOf","anyOf"];function Gc(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 wr(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!Wc.has(s))return null;t.push(i)}let n={},r=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let a=[];for(let l of t){let d=l.properties?.[s]??Gc(l);if(d===null||d===void 0)continue;if(!a.some((p)=>JSON.stringify(p)===JSON.stringify(d)))a.push(d)}let c=a.length===1?a[0]:wr(a)??{allOf:a};te(n,s,c)}for(let s of i.required??[])r.add(s)}let o={type:"object",properties:n};if(r.size)o.required=[...r];if(t.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let a=Gc(s);if(a&&!i.some((c)=>JSON.stringify(c)===JSON.stringify(a)))i.push(a)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function cm(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Wc)if(o in e)return;let n=t.filter((o)=>qc.some((i)=>Array.isArray(o[i]))),r=null;if(!n.length)r=wr(t);else{let o=n[0],i=qc.find((c)=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let s=t.filter((c)=>c!==o),a=o[i].map((c)=>wr([...s,c]));if(a.some((c)=>!c))return;r={[i]:a}}if(!r)return;delete e.allOf,Tt(e,r)}function Rt(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,d={...l},p=c.ref;if(c.ref=null,p){r(p);let f=e.seen.get(p),g=f.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(g);else Tt(l,g);if(Tt(l,d),a._zod.parent===p)for(let S in l){if(S==="$ref"||S==="allOf")continue;if(!(S in d))delete l[S]}if(g.$ref&&f.def)for(let S in l){if(S==="$ref"||S==="allOf")continue;if(S in f.def&&JSON.stringify(l[S])===JSON.stringify(f.def[S]))delete l[S]}}let m=a._zod.parent;if(m&&m!==p){r(m);let f=e.seen.get(m);if(f?.schema.$ref){if(l.$ref=f.schema.$ref,f.def)for(let g in l){if(g==="$ref"||g==="allOf")continue;if(g in f.def&&JSON.stringify(l[g])===JSON.stringify(f.def[g]))delete l[g]}}}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())r(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Kc(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let l of[c.schema,c.def]){let d=l?.allOf;if(!Array.isArray(d))continue;let p=a.get(d);if(p)p.push(l);else a.set(d,[l])}for(let c of e.intersections)for(let l of a.get(c)??[])cm(l)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Tt(o,n.defId?n.schema:n.def??n.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;te(s,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ct(t,"input",e.processors),output:Ct(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function X(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 X(r.element,n);if(r.type==="set")return X(r.valueType,n);if(r.type==="lazy")return X(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 X(r.innerType,n);if(r.type==="intersection")return X(r.left,n)||X(r.right,n);if(r.type==="record"||r.type==="map")return X(r.keyType,n)||X(r.valueType,n);if(r.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return X(r.in,n)||X(r.out,n)}if(r.type==="object"){for(let o in r.shape)if(X(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(let o of r.options)if(X(o,n))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if(X(o,n))return!0;if(r.rest&&X(r.rest,n))return!0;return!1}return!1}var Jc=(e,t={})=>(n)=>{let r=kt({...n,processors:t});return D(e,r),Et(r,e),Rt(r,e)},Ct=(e,t,n={})=>(r)=>{let{libraryOptions:o,target:i}=r??{},s=kt({...o??{},target:i,io:t,processors:n});return D(e,s),Et(s,e),Rt(s,e)};var Ve=(e,t,n)=>{if(e[t]===void 0||n>e[t])e[t]=n},qe=(e,t,n)=>{if(e[t]===void 0||n<e[t])e[t]=n},Yc=(e,t)=>{Ve(e,"minimum",t),qe(e,"maximum",t)},nu=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},ru=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},ou=(e,t)=>{e.mime=e.mime?e.mime.filter((n)=>t.includes(n)):[...t]},iu=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Xc=(e,t)=>Ve(e,"minimum",t.minimum),Qc=(e,t)=>qe(e,"maximum",t.maximum),eu=(e)=>(t,n)=>{iu(t,n.format);let[r,o]=e[n.format];Ve(t,"minimum",r),qe(t,"maximum",o)},um={greater_than:(e,t)=>Ve(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>qe(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>nu(e,t.value),number_format:eu(Ut),bigint_format:eu(Un),min_length:Xc,max_length:Qc,length_equals:(e,t)=>Yc(e,t.length),min_size:Xc,max_size:Qc,size_equals:(e,t)=>Yc(e,t.size),string_format:(e,t)=>{if(iu(e,t.format),t.pattern)ru(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)=>ou(e,t.mime)};function W(e){let t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let i of r)um[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)Ve(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)Ve(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)qe(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)qe(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)nu(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)ou(t,o.mime);for(let i of o.patterns??[])ru(t,i);return t}var lm={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},dm=new Map([[cr,ms],[Qt,fs]]),su=(e)=>dm.get(e)??e,Mr=(e,t,n,r)=>{let o=n;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:l,laxFormat:d}=W(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(a){if(o.format=lm[a]??a,o.format==="")delete o.format;if(a==="time"||d)delete o.format}if(l)o.contentEncoding=l;if(c&&c.size>0){let p=[...c].map(su);if(p.length===1)o.pattern=p[0].source;else if(p.length>1)o.allOf=[...p.map((m)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))]}},Or=(e,t,n,r)=>{let o=n,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:d}=W(e);o.type=d?"integer":"number";let p=typeof l==="number"&&l>=(i??Number.NEGATIVE_INFINITY),m=typeof c==="number"&&c<=(s??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";if(p)if(f)o.minimum=l,o.exclusiveMinimum=!0;else o.exclusiveMinimum=l;else if(typeof i==="number")o.minimum=i;if(m)if(f)o.maximum=c,o.exclusiveMaximum=!0;else o.exclusiveMaximum=c;else if(typeof s==="number")o.maximum=s;if(a){let g=new Set;for(let v of a)if(Number.isFinite(v)&&v!==0)g.add(Math.abs(v));else q(e,t,o,r,`A multipleOf divisor of ${v} cannot be represented in JSON Schema`);let[y,...S]=g;if(y!==void 0)o.multipleOf=y;if(S.length)o.allOf=[...o.allOf??[],...S.map((v)=>({multipleOf:v}))]}},zr=(e,t,n,r)=>{n.type="boolean"},au=(e,t,n,r)=>{q(e,t,n,r,"BigInt cannot be represented in JSON Schema")},cu=(e,t,n,r)=>{q(e,t,n,r,"Symbols cannot be represented in JSON Schema")},uu=(e,t,n,r)=>{if(t.target==="openapi-3.0")n.type="string",n.nullable=!0,n.enum=[null];else n.type="null"},lu=(e,t,n,r)=>{q(e,t,n,r,"Undefined cannot be represented in JSON Schema")},Nr=(e,t,n,r)=>{q(e,t,n,r,"Void cannot be represented in JSON Schema")},$r=(e,t,n,r)=>{n.not={}},du=(e,t,n,r)=>{},Lr=(e,t,n,r)=>{},Dr=(e,t,n,r)=>{q(e,t,n,r,"Date cannot be represented in JSON Schema")},Br=(e,t,n,r)=>{let o=e._zod.def,i=pt(o.entries);if(i.length===0){n.not={};return}if(i.every((s)=>typeof s==="number"))n.type="number";if(i.every((s)=>typeof s==="string"))n.type="string";n.enum=i},Ur=(e,t,n,r)=>{let o=e._zod.def;if(o.values.length===0){n.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(q(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(q(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")n.enum=[s];else n.const=s}else{if(i.every((s)=>typeof s==="number"))n.type="number";if(i.every((s)=>typeof s==="string"))n.type="string";if(i.every((s)=>typeof s==="boolean"))n.type="boolean";if(i.every((s)=>s===null))n.type="null";n.enum=i}},pu=(e,t,n,r)=>{q(e,t,n,r,"NaN cannot be represented in JSON Schema")},mu=(e,t,n,r)=>{let o=n,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},fu=(e,t,n,r)=>{let o=n;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=W(e);if(i!==void 0)o.minLength=i;if(s!==void 0)o.maxLength=s;if(!a)return;if(a.length===0)o.not={};else if(a.length===1)o.contentMediaType=a[0];else o.anyOf=a.map((c)=>({contentMediaType:c}))},gu=(e,t,n,r)=>{n.type="boolean"},Zr=(e,t,n,r)=>{q(e,t,n,r,"Custom types cannot be represented in JSON Schema")},Fr=(e,t,n,r)=>{q(e,t,n,r,"Function types cannot be represented in JSON Schema")},Hr=(e,t,n,r)=>{q(e,t,n,r,"Transforms cannot be represented in JSON Schema")},hu=(e,t,n,r)=>{q(e,t,n,r,"Map cannot be represented in JSON Schema")},yu=(e,t,n,r)=>{q(e,t,n,r,"Set cannot be represented in JSON Schema")},jr=(e,t,n,r)=>{let o=n,i=e._zod.def,{minimum:s,maximum:a}=W(e);if(typeof s==="number")o.minItems=s;if(typeof a==="number")o.maxItems=a;o.type="array",o.items=D(i.element,t,{...r,path:[...r.path,"items"]})};function At(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return At(t.out);if(t.type==="catch")return At(t.innerType);return e._zod.optin}var Vr=(e,t,n,r)=>{let o=n,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&q(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in s)te(o.properties,l,D(s[l],t,{...r,path:[...r.path,"properties",l]}));let c=[];for(let l of Object.keys(s)){let d=i.shape[l];if(t.io==="input"?At(d)===void 0:d._zod.optout===void 0)c.push(l)}if(c.length>0)o.required=c;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=D(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})},qr=(e,t,n,r)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>D(a,t,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));if(i)n.oneOf=s;else n.anyOf=s},Gr=(e,t,n,r)=>{let o=e._zod.def,i=D(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=D(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=(l)=>("allOf"in l)&&Object.keys(l).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)},Kr=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((y,S)=>D(y,t,{...r,path:[...r.path,s,S]})),l=i.rest?D(i.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,d=i.items.length;while(d>0){let y=i.items[d-1];if(!(t.io==="input"?At(y)!==void 0:y._zod.optout==="optional"))break;d--}let p=i.items.length,m=!i.rest;if(t.target==="draft-2020-12"){if(o.prefixItems=c,m)o.items=!1;else if(l)o.items=l;if(d>0)o.minItems=d;if(m)o.maxItems=p}else if(t.target==="openapi-3.0"){if(o.items={anyOf:c},l)o.items.anyOf.push(l);if(d>0)o.minItems=d;if(m)o.maxItems=p}else{if(o.items=c,m)o.additionalItems=!1;else if(l)o.additionalItems=l;if(d>0)o.minItems=d;if(m)o.maxItems=p}let{minimum:f,maximum:g}=W(e);if(typeof f==="number")o.minItems=f;if(typeof g==="number")o.maxItems=g};function Ir(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=Ir(e,g,n);return y===g?t:y}for(let g of["anyOf","oneOf"]){let y=t[g];if(!Array.isArray(y))continue;let S=y.map((v)=>Ir(e,v,n));if(S.some((v,k)=>v!==y[k]))t={...t,[g]:S}}let r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.some((g)=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some((g)=>typeof g==="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:d,format:p,id:m,...f}=t;if(f.enum)f.enum=f.enum.map((g)=>typeof g==="number"?String(g):g);else if(typeof f.const==="number")f.const=String(f.const);if(!o)return f;if(f.type="string",!i)f.pattern=(r.includes("number")?xt:tr).source;return f}var Pr=new WeakMap;function pm(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 Pr.get(e)??[]){let o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||n.has(i))continue;let s=Ir(t,i,new Set);if(s!==i)n.set(i,s)}if(!n.size)return;for(let r of e.seen.values())for(let o of[r.schema,r.def]){let i=o&&n.get(o.propertyNames);if(i)o.propertyNames=i}}var Wr=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="object";let s=i.keyType,a=W(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let d=D(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let p of a)te(o.patternProperties,su(p).source,d)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=D(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});let d=Pr.get(t);if(!d)d=[],Pr.set(t,d),t.deferred.push(()=>pm(t));d.push(e)}o.additionalProperties=D(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let c=s._zod.values,l=t.io==="input"&&At(i.valueType)!==void 0;if(c&&!i.partial&&!l){let d=[...c].filter((p)=>typeof p==="string"||typeof p==="number");if(d.length>0)o.required=d.map(String)}},Jr=(e,t,n,r)=>{let o=e._zod.def,i=D(o.innerType,t,r),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=o.innerType,n.nullable=!0;else n.anyOf=[i,{type:"null"}]},Yr=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},Xr=Symbol();function bu(e,t,n,r,o){let i=!1,s=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return i=!0,null});if(!i)return JSON.parse(s);return q(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),Xr}var Qr=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s=bu(o.defaultValue,e,t,n,r);if(s!==Xr)n.default=s},eo=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=bu(o.defaultValue,e,t,n,r);if(s!==Xr)n._prefault=s},to=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{q(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},no=(e,t,n,r)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;D(s,t,r);let a=t.seen.get(e);a.ref=s},ro=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},oo=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},ln=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},xu=(e,t,n,r)=>{let o=e._zod.innerType;D(o,t,r);let i=t.seen.get(e);i.ref=o},tu={string:Mr,number:Or,boolean:zr,bigint:au,symbol:cu,null:uu,undefined:lu,void:Nr,never:$r,any:du,unknown:Lr,date:Dr,enum:Br,literal:Ur,nan:pu,template_literal:mu,file:fu,success:gu,custom:Zr,function:Fr,transform:Hr,map:hu,set:yu,array:jr,object:Vr,union:qr,intersection:Gr,tuple:Kr,record:Wr,nullable:Jr,nonoptional:Yr,default:Qr,prefault:eo,catch:to,pipe:no,readonly:ro,promise:oo,optional:ln,lazy:xu};function Su(e,t){if("_idmap"in e){let r=e,o=kt({...t,processors:tu}),i={};for(let c of r._idmap.entries()){let[l,d]=c;D(d,o)}let s={},a={registry:r,uri:t?.uri,defs:i};o.external=a;for(let c of r._idmap.entries()){let[l,d]=c;Et(o,d),te(s,l,Rt(o,d))}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let n=kt({...t,processors:tu});return D(e,n),Et(n,e),Rt(n,e)}var _u=new WeakSet([Object.prototype,Error.prototype]);function pn(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 _m=(e,t)=>{Zi.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);if(_u.has(n))return;_u.add(n),pn(n,"format",(r)=>(o)=>Kn(r,o)),pn(n,"flatten",(r)=>(o)=>Gn(r,o)),pn(n,"addIssue",(r)=>(o)=>{r.issues.push(o),r.message=JSON.stringify(r.issues,mt,2)}),pn(n,"addIssues",(r)=>(o)=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,mt,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var re=h("ZodError",_m,void 0,{Parent:Error});var vu=yt(re),Tu=bt(re),Cu=qt(re),ku=Gt(re),Eu=ji(re),Ru=Vi(re),Au=qi(re),wu=Gi(re),Iu=Ki(re),Pu=Wi(re),Mu=Ji(re),Ou=Yi(re);function Tm(){if(!Y.localeError)Q(yr())}function wt(){if(!Y.memoizer)Q({memoizer:hr()})}var N=h("ZodType",(e,t)=>(Tm(),z.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(ne(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 ue(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(kf(e,t))},superRefine(e,t){return this.check(Ef(e,t))},overwrite(e){return this.check(Ae(e))},optional(){return $u(this)},exactOptional(){return df(this)},nullable(){return Lu(this)},nullish(){return $u(Lu(this))},nonoptional(e){return yf(this,e)},array(){return E(this)},or(e){return Ge([this,e])},and(e){return sf(this,e)},transform(e){return Du(this,Fu(e))},default(e){return ff(this,e)},prefault(e){return hf(this,e)},catch(e){return xf(this,e)},pipe(e){return Du(this,e)},readonly(){return vf(this)},describe(e){let t=this.clone();return Re.add(t,{description:e}),t},meta(...e){if(e.length===0)return Re.get(this);let t=this.clone();return Re.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 jt(this,"~standard",{...ar(this),jsonSchema:{input:Ct(this,"input"),output:Ct(this,"output")}})},set "~standard"(e){xe(this,"~standard",e)},parse:function e(t,n){return vu(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Tu(this,t,n,{callee:e})},safeParse(e,t){return Cu(this,e,t)},async safeParseAsync(e,t){return ku(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){xe(this,"spa",e)},validate(e,t){return Yn(this,e,t)},validateAsync(e,t){return Xn(this,e,t)},encode:function e(t,n){return Eu(this,t,n,{callee:e})},decode:function e(t,n){return Ru(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Au(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await wu(this,t,n,{callee:e})},safeEncode(e,t){return Iu(this,e,t)},safeDecode(e,t){return Pu(this,e,t)},async safeEncodeAsync(e,t){return Mu(this,e,t)},async safeDecodeAsync(e,t){return Ou(this,e,t)},toJSONSchema(e){return Jc(this,{})(e)},get description(){return Re.get(this)?.description},get _def(){return this._zod.def}}),Bu=h("_ZodString",(e,t)=>{Xt.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mr(e,n,r,o)},Fn({format:(e)=>W(e).format??null,minLength:(e)=>W(e).minimum??null,maxLength:(e)=>W(e).maximum??null},{regex(...e){return this.check(br(...e))},includes(...e){return this.check(_r(...e))},startsWith(...e){return this.check(vr(...e))},endsWith(...e){return this.check(Tr(...e))},min(...e){return this.check(je(...e))},max(...e){return this.check(cn(...e))},length(...e){return this.check(un(...e))},nonempty(...e){return this.check(je(1,...e))},lowercase(e){return this.check(xr(e))},uppercase(e){return this.check(Sr(e))},trim(){return this.check(kr())},normalize(...e){return this.check(Cr(...e))},toLowerCase(){return this.check(Er())},toUpperCase(){return this.check(Rr())},slugify(){return this.check(Ar())}})),Cm=h("ZodString",(e,t)=>{Xt.init(e,t),Bu.init(e,t)},{email(e){return this.check(cc(wm,e))},url(e){return this.check(fc(Pm,e))},jwt(e){return this.check(wc(qm,e))},emoji(e){return this.check(gc(Mm,e))},guid(e){return this.check(uc(Im,e))},uuid(e){return this.check(lc(mn,e))},uuidv4(e){return this.check(dc(mn,e))},uuidv6(e){return this.check(pc(mn,e))},uuidv7(e){return this.check(mc(mn,e))},nanoid(e){return this.check(hc(Om,e))},cuid(e){return this.check(yc(zm,e))},cuid2(e){return this.check(bc(Nm,e))},ulid(e){return this.check(xc($m,e))},base64(e){return this.check(Ec(Hm,e))},base64url(e){return this.check(Rc(jm,e))},xid(e){return this.check(Sc(Lm,e))},ksuid(e){return this.check(_c(Dm,e))},ipv4(e){return this.check(vc(Bm,e))},ipv6(e){return this.check(Tc(Um,e))},cidrv4(e){return this.check(Cc(Zm,e))},cidrv6(e){return this.check(kc(Fm,e))},e164(e){return this.check(Ac(Vm,e))},datetime(e){return this.check(Ic(km,e))},date(e){return this.check(Pc(Em,e))},time(e){return this.check(Mc(Rm,e))},duration(e){return this.check(Oc(Am,e))}});function u(e){return ac(Cm,e)}var F=h("ZodStringFormat",(e,t)=>{U.init(e,t),Bu.init(e,t)}),km=h("ZodISODateTime",(e,t)=>{pa.init(e,t),F.init(e,t)}),Em=h("ZodISODate",(e,t)=>{ma.init(e,t),F.init(e,t)}),Rm=h("ZodISOTime",(e,t)=>{fa.init(e,t),F.init(e,t)}),Am=h("ZodISODuration",(e,t)=>{ga.init(e,t),F.init(e,t)}),wm=h("ZodEmail",(e,t)=>{ta.init(e,t),F.init(e,t)});var Im=h("ZodGUID",(e,t)=>{Qs.init(e,t),F.init(e,t)});var mn=h("ZodUUID",(e,t)=>{ea.init(e,t),F.init(e,t)});var Pm=h("ZodURL",(e,t)=>{oa.init(e,t),F.init(e,t)});var Mm=h("ZodEmoji",(e,t)=>{ia.init(e,t),F.init(e,t)});var Om=h("ZodNanoID",(e,t)=>{sa.init(e,t),F.init(e,t)});var zm=h("ZodCUID",(e,t)=>{aa.init(e,t),F.init(e,t)});var Nm=h("ZodCUID2",(e,t)=>{ca.init(e,t),F.init(e,t)});var $m=h("ZodULID",(e,t)=>{ua.init(e,t),F.init(e,t)});var Lm=h("ZodXID",(e,t)=>{la.init(e,t),F.init(e,t)});var Dm=h("ZodKSUID",(e,t)=>{da.init(e,t),F.init(e,t)});var Bm=h("ZodIPv4",(e,t)=>{ha.init(e,t),F.init(e,t)});var Um=h("ZodIPv6",(e,t)=>{ba.init(e,t),F.init(e,t)});var Zm=h("ZodCIDRv4",(e,t)=>{xa.init(e,t),F.init(e,t)});var Fm=h("ZodCIDRv6",(e,t)=>{Sa.init(e,t),F.init(e,t)});var Hm=h("ZodBase64",(e,t)=>{va.init(e,t),F.init(e,t)});var jm=h("ZodBase64URL",(e,t)=>{Ta.init(e,t),F.init(e,t)});var Vm=h("ZodE164",(e,t)=>{Ca.init(e,t),F.init(e,t)});var qm=h("ZodJWT",(e,t)=>{ka.init(e,t),F.init(e,t)});var Uu=h("ZodNumber",(e,t)=>{ur.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Or(e,n,r,o),e.isFinite=!0},Fn({minValue:(e)=>{let{minimum:t,exclusiveMinimum:n}=W(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:n}=W(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:n}=W(e);return!!t||!!n?.some(Number.isSafeInteger)},format:(e)=>W(e).format??null},{gt(e,t){return this.check(sn(e,t))},gte(e,t){return this.check(He(e,t))},min(e,t){return this.check(He(e,t))},lt(e,t){return this.check(on(e,t))},lte(e,t){return this.check(Fe(e,t))},max(e,t){return this.check(Fe(e,t))},int(e){return this.check(zu(e))},safe(e){return this.check(zu(e))},positive(e){return this.check(sn(0,e))},nonnegative(e){return this.check(He(0,e))},negative(e){return this.check(on(0,e))},nonpositive(e){return this.check(Fe(0,e))},multipleOf(e,t){return this.check(an(e,t))},step(e,t){return this.check(an(e,t))},finite(){return this}}));function x(e){return zc(Uu,e)}var Gm=h("ZodNumberFormat",(e,t)=>{Ea.init(e,t),Uu.init(e,t)});function zu(e){return Nc(Gm,e)}var Km=h("ZodBoolean",(e,t)=>{Ra.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zr(e,n,r,o)});function I(e){return $c(Km,e)}var Wm=h("ZodUnknown",(e,t)=>{Aa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lr(e,n,r,o)});function K(){return Lc(Wm)}var Jm=h("ZodNever",(e,t)=>{wa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$r(e,n,r,o)});function Ym(e){return Dc(Jm,e)}var Xm=h("ZodVoid",(e,t)=>{Ia.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nr(e,n,r,o)});function Qm(e){return Bc(Xm,e)}var ef=h("ZodDate",(e,t)=>{Pa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Dr(e,n,r,o),e.min=(n,r)=>e.check(He(n,r)),e.max=(n,r)=>e.check(Fe(n,r))},Fn({minDate:(e)=>{let{minimum:t}=W(e);return t?new Date(t):null},maxDate:(e)=>{let{maximum:t}=W(e);return t?new Date(t):null}},{}));function fn(e){return Uc(ef,e)}var tf=h("ZodArray",(e,t)=>{wt(),Ma.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jr(e,n,r,o),e.element=t.element},{min(e,t){return this.check(je(e,t))},nonempty(e){return this.check(je(1,e))},max(e,t){return this.check(cn(e,t))},length(e,t){return this.check(un(e,t))},unwrap(){return this.element}});function E(e,t){return Zc(tf,e,t)}var nf=h("ZodObject",(e,t)=>{wt(),Na.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vr(e,n,r,o),wp(e,"shape",(n)=>n._zod.def.shape,!1)},{keyof(){return w(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ne(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ne(this._zod.def,{catchall:K()}))},loose(){return this.clone(ne(this._zod.def,{catchall:K()}))},strict(){return this.clone(ne(this._zod.def,{catchall:Ym()}))},strip(){return this.clone(ne(this._zod.def,{catchall:void 0}))},extend(e){return _p(this,e)},safeExtend(e){return vp(this,e)},merge(e){return Tp(this,e)},pick(e){return xp(this,e)},omit(e){return Sp(this,e)},partial(...e){return Mi(ao,this,e[0])},exactPartial(...e){return Mi(Hu,this,e[0],"exactPartial")},required(...e){return Cp(ju,this,e[0])}});function b(e,t){let n={type:"object",shape:e??{},..._(t)};return new nf(n)}var Zu=h("ZodUnion",(e,t)=>{lr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qr(e,n,r,o),e.options=t.options});function Ge(e,t){return new Zu({type:"union",options:e,..._(t)})}var rf=h("ZodDiscriminatedUnion",(e,t)=>{Zu.init(e,t),$a.init(e,t)});function so(e,t,n){return new rf({type:"union",options:t,discriminator:e,..._(n)})}var of=h("ZodIntersection",(e,t)=>{La.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gr(e,n,r,o)});function sf(e,t){return new of({type:"intersection",left:e,right:t})}var af=h("ZodTuple",(e,t)=>{wt(),dr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Kr(e,n,r,o)},{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 ao({type:"optional",innerType:t}))})}});function cf(e,t,n){let r=t instanceof z,o=r?n:t;return new af({type:"tuple",items:e,rest:r?t:null,..._(o)})}var Nu=h("ZodRecord",(e,t)=>{wt(),Da.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wr(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function j(e,t,n){if(!t||!t._zod)return new Nu({type:"record",keyType:u(),valueType:e,..._(t)});return new Nu({type:"record",keyType:e,valueType:t,..._(n)})}var io=h("ZodEnum",(e,t)=>{Ba.init(e,t),N.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Br(e,r,o,i),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{let i={};for(let s of r)if(n.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new io({...t,checks:[],..._(o),entries:i})},e.exclude=(r,o)=>{let i={...t.entries};for(let s of r)if(n.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new io({...t,checks:[],..._(o),entries:i})}});function w(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new io({type:"enum",entries:n,..._(t)})}var uf=h("ZodLiteral",(e,t)=>{Ua.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ur(e,n,r,o),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 V(e,t){return new uf({type:"literal",values:Array.isArray(e)?e:[e],..._(t)})}var lf=h("ZodTransform",(e,t)=>{wt(),Za.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hr(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ht(e.constructor.name);n.addIssue=(i)=>{if(typeof i==="string")n.issues.push(Ne(i,n.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=n.value;s.inst??(s.inst=e),n.issues.push(Ne(s))}};let o=t.transform(n.value,n);if(o instanceof Promise)return o.then((i)=>(n.value=i,n));return n.value=o,n}});function Fu(e){return new lf({type:"transform",transform:e})}var ao=h("ZodOptional",(e,t)=>{pr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ln(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function $u(e){return new ao({type:"optional",innerType:e})}var Hu=h("ZodExactOptional",(e,t)=>{Fa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ln(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function df(e){return new Hu({type:"optional",innerType:e})}var pf=h("ZodNullable",(e,t)=>{Ha.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jr(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Lu(e){return new pf({type:"nullable",innerType:e})}var mf=h("ZodDefault",(e,t)=>{ja.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qr(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ff(e,t){return new mf({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Dn(t)}})}var gf=h("ZodPrefault",(e,t)=>{Va.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>eo(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function hf(e,t){return new gf({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Dn(t)}})}var ju=h("ZodNonOptional",(e,t)=>{qa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yr(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function yf(e,t){return new ju({type:"nonoptional",innerType:e,..._(t)})}var bf=h("ZodCatch",(e,t)=>{Ga.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>to(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function xf(e,t){return new bf({type:"catch",innerType:e,catchValue:typeof t==="function"?t:$i(t)})}var Vu=h("ZodPipe",(e,t)=>{mr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>no(e,n,r,o),e.in=t.in,e.out=t.out});function Du(e,t){return new Vu({type:"pipe",in:e,out:t})}var Sf=h("ZodPreprocess",(e,t)=>{Vu.init(e,t),Ka.init(e,t)}),_f=h("ZodReadonly",(e,t)=>{Wa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ro(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function vf(e){return new _f({type:"readonly",innerType:e})}var Tf=h("ZodPromise",(e,t)=>{Ya.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>oo(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function co(e){return new Tf({type:"promise",innerType:e})}var Cf=h("ZodFunction",(e,t)=>{Ja.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fr(e,n,r,o)});function gn(e){return new Cf({type:"function",input:Array.isArray(e?.input)?cf(e?.input):e?.input??E(K()),output:e?.output??K()})}var qu=h("ZodCustom",(e,t)=>{Xa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zr(e,n,r,o)});function se(e,t){return Fc(qu,e??(()=>!0),t)}function kf(e,t={}){return Hc(qu,e,t)}function Ef(e,t){return jc(e,t)}function Gu(e,t){return new Sf({type:"pipe",in:Fu(e),out:t})}var hn=["none","minimal","low","medium","high","xhigh","max"],uo=w(hn),yn=uo.exclude(["none"]),Rf=w([...hn,"default"]).nullable(),lo=so("type",[b({type:V("toggle")}).strict(),b({type:V("effort"),values:E(Rf)}).strict(),b({type:V("budget_tokens"),min:x().min(-1).optional(),max:x().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"]})]);var Ku=w(["default","openai-responses","r1"]),Af={DEFAULT:"default",OPENAI_RESPONSES:"openai-responses",R1:"r1"},Wu=w(["images","video","tools","streaming","prompt-cache","reasoning","reasoning-effort","computer-use","global-endpoint","structured_output","temperature","files"]),Ju=w(["active","preview","deprecated","legacy"]),Yu=b({input:x().optional(),output:x().optional(),cacheWrite:x().optional(),cacheRead:x().optional()}),Xu=b({maxBudget:x().optional(),outputPrice:x().optional(),thinkingLevel:w(["low","high"]).optional()}),Qu=b({reasoningDefaultOn:I().optional(),apiProtocol:w(["openai-chat","openai-responses","anthropic","gemini"]).optional()}).catchall(K()),po=w(["text","image","audio","video","pdf"]),el=b({input:E(po),output:E(po)});function tl(e){return(e?.input===void 0||e.input.includes("text"))&&(e?.output===void 0||e.output.includes("text"))}var nl=w(["language","image-generation","speech-generation","video-generation","transcription","realtime"]);function wf(e){let t=e.modalities?.input,n=e.modalities?.output;return t?.length===1&&t[0]==="audio"&&n?.length===1&&n[0]==="text"}function If(e){return(e.operation===void 0||e.operation==="language")&&tl(e.modalities)}var rl=w(["batch","streaming"]);function Pf(e){return e.modalities?.input.includes("text")===!0&&e.modalities.output.includes("image")}function Mf(e){return e.operation==="image-generation"}function mo(e,t,n){let r=e.capabilities;if(r===void 0||r.length===0)return n?.assumeWhenUnspecified??!1;return r.includes(t)}function Of(e){return mo(e,"tools",{assumeWhenUnspecified:!0})}function zf(e){return mo(e,"images",{assumeWhenUnspecified:!0})}var bn=b({id:u(),name:u().optional(),description:u().optional(),maxTokens:x().optional(),contextWindow:x().optional(),maxInputTokens:x().optional(),capabilities:E(Wu).optional(),operation:nl.optional(),operationModes:E(rl).optional(),modalities:el.optional(),reasoningOptions:E(lo).optional(),apiFormat:Ku.optional(),systemRole:w(["system","developer"]).optional(),temperature:x().optional(),pricing:Yu.optional(),thinkingConfig:Xu.optional(),status:Ju.optional(),deprecationNotice:u().optional(),replacedBy:u().optional(),releaseDate:u().optional(),deprecationDate:u().optional(),family:u().optional(),metadata:Qu.optional()});var Nf="This tool call was rejected by the user and not executed.",$f="NOT a tool or system failure. Clarify with user before proceeding.",fo=b({id:u(),name:u(),execution:w(["client","provider"]).optional(),input:K(),output:K(),error:u().optional(),durationMs:x(),startedAt:fn(),endedAt:fn()});var Lf=w(["completed","max_iterations","aborted","mistake_limit","error"]),Df=b({inputTokens:x(),outputTokens:x(),cacheReadTokens:x().optional(),cacheWriteTokens:x().optional(),totalCost:x().optional()}),ov=b({text:u(),usage:Df,messages:E(se()),toolCalls:E(fo),iterations:x(),finishReason:Lf,model:b({id:u(),provider:u(),info:bn.optional()}),startedAt:fn(),endedAt:fn(),durationMs:x()}),iv=b({distinctId:u().optional(),sessionId:u().optional(),providerId:u(),modelId:u(),apiKey:u().optional(),baseUrl:u().url().optional(),headers:j(u(),u()).optional(),knownModels:j(u(),bn).optional(),providerConfig:K().optional(),initialMessages:E(se()).optional(),systemPrompt:u(),tools:E(se()),modelTools:E(se()).optional(),maxIterations:x().positive().optional(),maxParallelToolCalls:x().int().positive().default(8),maxTokensPerTurn:x().positive().optional(),temperature:x().nonnegative().optional(),apiTimeoutMs:x().positive().default(180000),userFileContentLoader:gn().input([u()]).output(co(u())).optional(),toolContextMetadata:j(u(),K()).optional(),execution:b({maxConsecutiveMistakes:x().int().positive().optional(),reminderAfterIterations:x().nonnegative().optional(),reminderText:u().optional(),loopDetection:Ge([V(!1),b({softThreshold:x().int().positive().optional(),hardThreshold:x().int().positive().optional()})]).optional()}).optional(),reasoningEffort:yn.optional(),thinkingBudgetTokens:x().positive().optional(),thinking:I().optional(),onEvent:gn().input([se()]).output(Qm()).optional(),hooks:se().optional(),parentAgentId:u().optional(),extensions:E(se()).optional(),hookErrorMode:w(["ignore","throw"]).default("ignore"),toolPolicies:j(u(),b({enabled:I().optional(),autoApprove:I().optional()})).optional(),requestToolApproval:gn().input([b({sessionId:u(),agentId:u(),conversationId:u(),iteration:x(),toolCallId:u(),toolName:u(),input:K(),policy:b({enabled:I().optional(),autoApprove:I().optional()}).default({})})]).output(Ge([b({approved:I(),reason:u().optional()}),co(b({approved:I(),reason:u().optional()}))])).optional(),onConsecutiveMistakeLimitReached:gn().input([b({iteration:x().int().positive(),consecutiveMistakes:x().int().positive(),maxConsecutiveMistakes:x().int().positive(),reason:w(["api_error","invalid_tool_call","tool_execution_failed"]),details:u().optional()})]).output(Ge([b({action:V("continue"),guidance:u().optional()}),b({action:V("stop"),reason:u().optional()}),co(Ge([b({action:V("continue"),guidance:u().optional()}),b({action:V("stop"),reason:u().optional()})]))])).optional(),logger:se().optional(),extensionContext:se().optional(),abortSignal:se().optional()});var ol=w(["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"]),il=b({id:u().optional(),label:u().optional(),role:u().optional(),participantKey:u().optional(),participantLabel:u().optional(),platformUserId:u().optional(),metadata:j(u(),K()).optional()}),sl=b({source:u(),sourceEvent:u(),threadId:u(),channelId:u(),isDM:I(),sessionId:u().optional(),workspaceRoot:u().optional(),metadata:j(u(),K()).optional()}),Bf=b({actor:il,context:sl,payload:j(u(),K()).optional()}),Uf=b({action:w(["allow","deny"]).default("allow"),message:u().optional(),reason:u().optional(),metadata:j(u(),K()).optional()}),Zf=b({adapter:u(),botUserName:u().optional(),event:ol,payload:j(u(),K()),ts:u()});var al=[{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 cl(){return al.map((e)=>({...e}))}function ul(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 Ff(e,t,n){let r={};for(let i of e.fields){let s=t[i.flag];r[i.flag]=typeof s==="string"?s.trim():i.initialValue??""}let o=[];for(let i of e.fields){if(!ul(i,r))continue;let s=r[i.flag]??"";if(!s){if(i.required)throw Error(`${i.label} is required`);continue}o.push(i.flag,s)}if(n?.enabled===!0&&e.security){let i={};for(let s of e.security.fields){let a=n.values[s.key]?.trim();if(!a)throw Error(s.requiredMessage);let c=s.validate?.(a);if(c)throw Error(c);i[s.key]=a}o.push(...e.security.buildArgs(i))}return o}function Hf(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 jf(e,t,n,r){let o=new Set([...e.fields.flatMap((s)=>[s.flag,...s.aliases??[]]),...e.derivedReconnectFlags??[]]);if(r.replaceSecurityArgs)for(let s of e.security?.argumentFlags??[])o.add(s);let i=[];for(let s=0;s<t.length;s+=1){let a=t[s]??"",c=Hf(a,o);if(!c.managed){i.push(a);continue}if(c.consumesNext)s+=1}return[...i,...n]}function Vf(e=ll){let t=new Set(cl().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 qf(e){return/^\d+$/.test(e)?void 0:"Telegram user ID must contain digits only"}function Gf(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 Kf(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 ll=[{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:qf}],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:Gf},{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:Kf}],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}]}];var dl=[];function go(e){dl.push(e)}async function Wf(){let e=dl.splice(0);await Promise.all(e.map((t)=>{try{return(typeof t==="function"?t():t.dispose())??Promise.resolve()}catch{return Promise.resolve()}}))}var Jf=["hooks","tools","commands","rules","skills","messageBuilders","providers","automationEvents","mcp"],Yf=new Set(Jf);function fl(e,t){return e.name||`extension_${String(t).padStart(4,"0")}`}function pl(e){return Array.isArray(e)&&e.every((t)=>typeof t==="string")}function ml(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 gl(e){let t=ml(e.providerIds),n=ml(e.modelIds);return{...e,...t?{providerIds:t}:{},...n?{modelIds:n}:{}}}function Xf(e,t){let n=fl(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 o=new Set;for(let a of r.capabilities){if(!Yf.has(a))throw Error(`Invalid manifest for extension "${n}": unsupported capability "${String(a)}"`);o.add(a)}if(Object.hasOwn(r,"providerIds")&&!pl(r.providerIds))throw Error(`Invalid manifest for extension "${n}": providerIds must be a string array when provided`);if(Object.hasOwn(r,"modelIds")&&!pl(r.modelIds))throw Error(`Invalid manifest for extension "${n}": modelIds must be a string array when provided`);let i=o.has("hooks");if(e.hooks!==void 0&&!i)throw Error(`Invalid manifest for extension "${n}": runtime hooks require the "hooks" capability`);return{capabilities:o,raw:gl(r)}}function Qf(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 ho{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:Xf(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:o}=r;if(o.disabled)continue;let i=fl(o,r.order),s={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]},a={registerTool:(l)=>s.tools.push(l),registerCommand:(l)=>s.commands.push(l),registerRule:(l)=>{if(!r.manifest.capabilities.has("rules"))throw Error(`Invalid setup for extension "${i}": registerRule requires the "rules" capability`);s.rules.push(l)},registerMessageBuilder:(l)=>s.messageBuilder.push(l),registerProvider:(l)=>s.providers.push(l),registerAutomationEventType:(l)=>{if(!r.manifest.capabilities.has("automationEvents"))throw Error(`Invalid setup for extension "${i}": registerAutomationEventType requires the "automationEvents" capability`);s.automationEventTypes.push(Qf(l,i))},registerMcpServer:(l)=>{if(!r.manifest.capabilities.has("mcp"))throw Error(`Invalid setup for extension "${i}": registerMcpServer requires the "mcp" capability`);s.mcpServers.push({...l,metadata:{...l.metadata??{},source:"plugin",plugin:i}})}},c=r.manifest.capabilities.has("automationEvents")?this.setupContext:{...this.setupContext,automation:void 0};try{await o.setup?.(a,c),n.push(s)}catch(l){if(e.tolerateSetupErrors!==!0)throw l;t??=l}}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 eg(e={}){return new ho(e)}var tg=[".js",".ts"];var Ke={CLINE_PASS:"ext-cline-pass",CODE_CLOUD_AGENTS:"code-cloud-agents",CODE_ONBOARDING_GITHUB:"code-onboarding-github",CLINE_COMPOSIO_BETA:"CLINE_COMPOSIO_BETA"},ng={[Ke.CLINE_PASS]:!1,[Ke.CODE_CLOUD_AGENTS]:!1,[Ke.CODE_ONBOARDING_GITHUB]:!1,[Ke.CLINE_COMPOSIO_BETA]:!1},rg=Object.values(Ke);var hl=w(["agent_start","agent_resume","agent_abort","agent_end","agent_error","tool_call","tool_result","prompt_submit","pre_compact","session_shutdown"]),$e=j(u(),u()),og=b({toolName:u(),parameters:$e}),ig=b({toolName:u(),parameters:$e,result:u(),success:I(),executionTimeMs:x()}),sg=b({prompt:u(),attachments:E(u())}),ag=b({taskMetadata:$e}),cg=b({taskMetadata:$e,previousState:$e}),ug=b({taskMetadata:$e}),lg=b({taskMetadata:$e}),dg=b({taskId:u(),ulid:u(),contextSize:x(),compactionStrategy:u(),previousApiReqIndex:x(),tokensIn:x(),tokensOut:x(),tokensInCache:x(),tokensOutCache:x(),deletedRangeStart:x(),deletedRangeEnd:x(),contextJsonPath:u(),contextRawPath:u()}),yl=b({clineVersion:u(),hookName:hl,timestamp:u(),taskId:u(),sessionContext:b({rootSessionId:u().optional(),hookLogPath:u().optional()}).optional(),workspaceRoots:E(u()),workspaceInfo:se().optional(),userId:u(),agent_id:u(),parent_agent_id:u().nullable(),iteration:x().optional(),reason:u().optional(),tool_call:b({id:u(),name:u(),input:K()}).optional(),tool_result:se().optional(),turn:K().optional(),error:b({name:u(),message:u(),stack:u().optional()}).optional(),preToolUse:og.optional(),postToolUse:ig.optional(),userPromptSubmit:sg.optional(),taskStart:ag.optional(),taskResume:cg.optional(),taskCancel:ug.optional(),taskComplete:lg.optional(),preCompact:dg.optional()}).passthrough();function pg(e){let t=yl.safeParse(e);if(!t.success)return;return t.data}var xv="v1",Sv="v1",_v="v1",vv=["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","stream.replay"];function xn(e){let t=/^v(\d+)$/.exec(e?.trim()??"");if(!t)return;return Number.parseInt(t[1]??"",10)}function Tv(e,t="v1"){let n=xn(e.protocolVersion),r=xn(t);if(n===void 0||r===void 0)return{compatible:!1,reason:"missing_protocol"};let o=xn(e.minClientProtocolVersion)??n,i=xn(e.maxClientProtocolVersion)??n;return r>=o&&r<=i?{compatible:!0}:{compatible:!1,reason:"unsupported_protocol"}}var Cv="approval.respond",kv="0",Ev="__hubScheduleRunAt",bl=["act","plan","yolo"];function mg(e){return bl.some((t)=>t===e)}function Rv(e,t){if(!e||!Object.hasOwn(e,"mode"))return t;let n=e.mode;if(mg(n))return n;throw Error(`mode must be one of: ${bl.join(", ")}`)}var fg=30000,Av=5000;function gg(e){switch(e){case"run.start":case"session.send_input":return null;default:return fg}}function wv(e,t){return t===void 0?gg(e):t}var hg=["readFile","search","bash","webFetch","editor","applyPatch","skills","askQuestion","submit"],yg=new Set(hg);function Iv(e){return typeof e==="string"&&yg.has(e)}var Pv="tool_executor.",Mv="custom_tool.",Ov="hook.",zv="compaction.compact",Nv="checkpoint.create",$v="mistake_limit.decide",Lv="user_instructions.snapshot";function Dv(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 yo(e,t){return`<file_content path="${e}">
58
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Kc(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let o of t){if(!o||typeof o!=="object")return;Kc(o);let r=Object.keys(o);if(r.length!==1||r[0]!=="type")return;let i=o.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!n.includes(s))n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Wc=new Set(["type","properties","required","additionalProperties"]),qc=["oneOf","anyOf"];function Gc(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 wo(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!Wc.has(s))return null;t.push(i)}let n={},o=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let a=[];for(let l of t){let d=l.properties?.[s]??Gc(l);if(d===null||d===void 0)continue;if(!a.some((p)=>JSON.stringify(p)===JSON.stringify(d)))a.push(d)}let c=a.length===1?a[0]:wo(a)??{allOf:a};te(n,s,c)}for(let s of i.required??[])o.add(s)}let r={type:"object",properties:n};if(o.size)r.required=[...o];if(t.every((i)=>i.additionalProperties===!1))r.additionalProperties=!1;else{let i=[];for(let s of t){let a=Gc(s);if(a&&!i.some((c)=>JSON.stringify(c)===JSON.stringify(a)))i.push(a)}if(i.length===1)r.additionalProperties=i[0];else if(i.length>1)r.additionalProperties={allOf:i}}return r}function cm(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let r of Wc)if(r in e)return;let n=t.filter((r)=>qc.some((i)=>Array.isArray(r[i]))),o=null;if(!n.length)o=wo(t);else{let r=n[0],i=qc.find((c)=>Array.isArray(r[c]));if(Object.keys(r).length!==1)return;let s=t.filter((c)=>c!==r),a=r[i].map((c)=>wo([...s,c]));if(a.some((c)=>!c))return;o={[i]:a}}if(!o)return;delete e.allOf,Tt(e,o)}function Rt(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,d={...l},p=c.ref;if(c.ref=null,p){o(p);let f=e.seen.get(p),g=f.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(g);else Tt(l,g);if(Tt(l,d),a._zod.parent===p)for(let S in l){if(S==="$ref"||S==="allOf")continue;if(!(S in d))delete l[S]}if(g.$ref&&f.def)for(let S in l){if(S==="$ref"||S==="allOf")continue;if(S in f.def&&JSON.stringify(l[S])===JSON.stringify(f.def[S]))delete l[S]}}let m=a._zod.parent;if(m&&m!==p){o(m);let f=e.seen.get(m);if(f?.schema.$ref){if(l.$ref=f.schema.$ref,f.def)for(let g in l){if(g==="$ref"||g==="allOf")continue;if(g in f.def&&JSON.stringify(l[g])===JSON.stringify(f.def[g]))delete l[g]}}}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())o(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Kc(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let l of[c.schema,c.def]){let d=l?.allOf;if(!Array.isArray(d))continue;let p=a.get(d);if(p)p.push(l);else a.set(d,[l])}for(let c of e.intersections)for(let l of a.get(c)??[])cm(l)}}let r={};if(e.target==="draft-2020-12")r.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")r.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")r.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");r.$id=e.external.uri(a)}Tt(r,n.defId?n.schema:n.def??n.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&r.id===i)delete r.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;te(s,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")r.$defs=s;else r.definitions=s;try{let a=JSON.parse(JSON.stringify(r));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ct(t,"input",e.processors),output:Ct(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function X(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return X(o.element,n);if(o.type==="set")return X(o.valueType,n);if(o.type==="lazy")return X(o.getter(),n);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return X(o.innerType,n);if(o.type==="intersection")return X(o.left,n)||X(o.right,n);if(o.type==="record"||o.type==="map")return X(o.keyType,n)||X(o.valueType,n);if(o.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return X(o.in,n)||X(o.out,n)}if(o.type==="object"){for(let r in o.shape)if(X(o.shape[r],n))return!0;return!1}if(o.type==="union"){for(let r of o.options)if(X(r,n))return!0;return!1}if(o.type==="tuple"){for(let r of o.items)if(X(r,n))return!0;if(o.rest&&X(o.rest,n))return!0;return!1}return!1}var Jc=(e,t={})=>(n)=>{let o=kt({...n,processors:t});return D(e,o),Et(o,e),Rt(o,e)},Ct=(e,t,n={})=>(o)=>{let{libraryOptions:r,target:i}=o??{},s=kt({...r??{},target:i,io:t,processors:n});return D(e,s),Et(s,e),Rt(s,e)};var Ve=(e,t,n)=>{if(e[t]===void 0||n>e[t])e[t]=n},qe=(e,t,n)=>{if(e[t]===void 0||n<e[t])e[t]=n},Yc=(e,t)=>{Ve(e,"minimum",t),qe(e,"maximum",t)},nu=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},ou=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},ru=(e,t)=>{e.mime=e.mime?e.mime.filter((n)=>t.includes(n)):[...t]},iu=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Xc=(e,t)=>Ve(e,"minimum",t.minimum),Qc=(e,t)=>qe(e,"maximum",t.maximum),eu=(e)=>(t,n)=>{iu(t,n.format);let[o,r]=e[n.format];Ve(t,"minimum",o),qe(t,"maximum",r)},um={greater_than:(e,t)=>Ve(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>qe(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>nu(e,t.value),number_format:eu(Ut),bigint_format:eu(Un),min_length:Xc,max_length:Qc,length_equals:(e,t)=>Yc(e,t.length),min_size:Xc,max_size:Qc,size_equals:(e,t)=>Yc(e,t.size),string_format:(e,t)=>{if(iu(e,t.format),t.pattern)ou(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)=>ru(e,t.mime)};function W(e){let t={},n=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let i of o)um[i._zod.def.check]?.(t,i._zod.def);let r=e._zod.bag;if(r.minimum!==void 0)Ve(t,"minimum",r.minimum);if(r.exclusiveMinimum!==void 0)Ve(t,"exclusiveMinimum",r.exclusiveMinimum);if(r.maximum!==void 0)qe(t,"maximum",r.maximum);if(r.exclusiveMaximum!==void 0)qe(t,"exclusiveMaximum",r.exclusiveMaximum);if(r.multipleOf!==void 0)nu(t,r.multipleOf);if(r.format!==void 0){if(t.format??(t.format=r.format),r.format.includes("int"))t.isInt=!0}if(r.mime)ru(t,r.mime);for(let i of r.patterns??[])ou(t,i);return t}var lm={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},dm=new Map([[co,ms],[Qt,fs]]),su=(e)=>dm.get(e)??e,Oo=(e,t,n,o)=>{let r=n;r.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:l,laxFormat:d}=W(e);if(typeof i==="number")r.minLength=i;if(typeof s==="number")r.maxLength=s;if(a){if(r.format=lm[a]??a,r.format==="")delete r.format;if(a==="time"||d)delete r.format}if(l)r.contentEncoding=l;if(c&&c.size>0){let p=[...c].map(su);if(p.length===1)r.pattern=p[0].source;else if(p.length>1)r.allOf=[...p.map((m)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))]}},zo=(e,t,n,o)=>{let r=n,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:d}=W(e);r.type=d?"integer":"number";let p=typeof l==="number"&&l>=(i??Number.NEGATIVE_INFINITY),m=typeof c==="number"&&c<=(s??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";if(p)if(f)r.minimum=l,r.exclusiveMinimum=!0;else r.exclusiveMinimum=l;else if(typeof i==="number")r.minimum=i;if(m)if(f)r.maximum=c,r.exclusiveMaximum=!0;else r.exclusiveMaximum=c;else if(typeof s==="number")r.maximum=s;if(a){let g=new Set;for(let v of a)if(Number.isFinite(v)&&v!==0)g.add(Math.abs(v));else q(e,t,r,o,`A multipleOf divisor of ${v} cannot be represented in JSON Schema`);let[y,...S]=g;if(y!==void 0)r.multipleOf=y;if(S.length)r.allOf=[...r.allOf??[],...S.map((v)=>({multipleOf:v}))]}},No=(e,t,n,o)=>{n.type="boolean"},au=(e,t,n,o)=>{q(e,t,n,o,"BigInt cannot be represented in JSON Schema")},cu=(e,t,n,o)=>{q(e,t,n,o,"Symbols cannot be represented in JSON Schema")},uu=(e,t,n,o)=>{if(t.target==="openapi-3.0")n.type="string",n.nullable=!0,n.enum=[null];else n.type="null"},lu=(e,t,n,o)=>{q(e,t,n,o,"Undefined cannot be represented in JSON Schema")},$o=(e,t,n,o)=>{q(e,t,n,o,"Void cannot be represented in JSON Schema")},Lo=(e,t,n,o)=>{n.not={}},du=(e,t,n,o)=>{},Do=(e,t,n,o)=>{},Bo=(e,t,n,o)=>{q(e,t,n,o,"Date cannot be represented in JSON Schema")},Uo=(e,t,n,o)=>{let r=e._zod.def,i=pt(r.entries);if(i.length===0){n.not={};return}if(i.every((s)=>typeof s==="number"))n.type="number";if(i.every((s)=>typeof s==="string"))n.type="string";n.enum=i},Zo=(e,t,n,o)=>{let r=e._zod.def;if(r.values.length===0){n.not={};return}let i=[];for(let s of r.values)if(s===void 0){if(q(e,t,n,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(q(e,t,n,o,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")n.enum=[s];else n.const=s}else{if(i.every((s)=>typeof s==="number"))n.type="number";if(i.every((s)=>typeof s==="string"))n.type="string";if(i.every((s)=>typeof s==="boolean"))n.type="boolean";if(i.every((s)=>s===null))n.type="null";n.enum=i}},pu=(e,t,n,o)=>{q(e,t,n,o,"NaN cannot be represented in JSON Schema")},mu=(e,t,n,o)=>{let r=n,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");r.type="string",r.pattern=i.source},fu=(e,t,n,o)=>{let r=n;r.type="string",r.format="binary",r.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=W(e);if(i!==void 0)r.minLength=i;if(s!==void 0)r.maxLength=s;if(!a)return;if(a.length===0)r.not={};else if(a.length===1)r.contentMediaType=a[0];else r.anyOf=a.map((c)=>({contentMediaType:c}))},gu=(e,t,n,o)=>{n.type="boolean"},Fo=(e,t,n,o)=>{q(e,t,n,o,"Custom types cannot be represented in JSON Schema")},Ho=(e,t,n,o)=>{q(e,t,n,o,"Function types cannot be represented in JSON Schema")},jo=(e,t,n,o)=>{q(e,t,n,o,"Transforms cannot be represented in JSON Schema")},hu=(e,t,n,o)=>{q(e,t,n,o,"Map cannot be represented in JSON Schema")},yu=(e,t,n,o)=>{q(e,t,n,o,"Set cannot be represented in JSON Schema")},Vo=(e,t,n,o)=>{let r=n,i=e._zod.def,{minimum:s,maximum:a}=W(e);if(typeof s==="number")r.minItems=s;if(typeof a==="number")r.maxItems=a;r.type="array",r.items=D(i.element,t,{...o,path:[...o.path,"items"]})};function At(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return At(t.out);if(t.type==="catch")return At(t.innerType);return e._zod.optin}var qo=(e,t,n,o)=>{let r=n,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&q(e,t,r,o,"Symbol keys cannot be represented in JSON Schema"))return;r.type="object",r.properties={};for(let l in s)te(r.properties,l,D(s[l],t,{...o,path:[...o.path,"properties",l]}));let c=[];for(let l of Object.keys(s)){let d=i.shape[l];if(t.io==="input"?At(d)===void 0:d._zod.optout===void 0)c.push(l)}if(c.length>0)r.required=c;if(i.catchall?._zod.def.type==="never")r.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")r.additionalProperties=!1}else if(i.catchall)r.additionalProperties=D(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},Go=(e,t,n,o)=>{let r=e._zod.def,i=r.inclusive===!1,s=r.options.map((a,c)=>D(a,t,{...o,path:[...o.path,i?"oneOf":"anyOf",c]}));if(i)n.oneOf=s;else n.anyOf=s},Ko=(e,t,n,o)=>{let r=e._zod.def,i=D(r.left,t,{...o,path:[...o.path,"allOf",0]}),s=D(r.right,t,{...o,path:[...o.path,"allOf",1]}),a=(l)=>("allOf"in l)&&Object.keys(l).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)},Wo=(e,t,n,o)=>{let r=n,i=e._zod.def;r.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((y,S)=>D(y,t,{...o,path:[...o.path,s,S]})),l=i.rest?D(i.rest,t,{...o,path:[...o.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,d=i.items.length;while(d>0){let y=i.items[d-1];if(!(t.io==="input"?At(y)!==void 0:y._zod.optout==="optional"))break;d--}let p=i.items.length,m=!i.rest;if(t.target==="draft-2020-12"){if(r.prefixItems=c,m)r.items=!1;else if(l)r.items=l;if(d>0)r.minItems=d;if(m)r.maxItems=p}else if(t.target==="openapi-3.0"){if(r.items={anyOf:c},l)r.items.anyOf.push(l);if(d>0)r.minItems=d;if(m)r.maxItems=p}else{if(r.items=c,m)r.additionalItems=!1;else if(l)r.additionalItems=l;if(d>0)r.minItems=d;if(m)r.maxItems=p}let{minimum:f,maximum:g}=W(e);if(typeof f==="number")r.minItems=f;if(typeof g==="number")r.maxItems=g};function Po(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=Po(e,g,n);return y===g?t:y}for(let g of["anyOf","oneOf"]){let y=t[g];if(!Array.isArray(y))continue;let S=y.map((v)=>Po(e,v,n));if(S.some((v,k)=>v!==y[k]))t={...t,[g]:S}}let o=Array.isArray(t.type)?t.type:[t.type],r=!o.includes("string")&&o.some((g)=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!r&&!i?.some((g)=>typeof g==="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:d,format:p,id:m,...f}=t;if(f.enum)f.enum=f.enum.map((g)=>typeof g==="number"?String(g):g);else if(typeof f.const==="number")f.const=String(f.const);if(!r)return f;if(f.type="string",!i)f.pattern=(o.includes("number")?xt:to).source;return f}var Mo=new WeakMap;function pm(e){let t=new Map;for(let o of e.seen.values())if(o.def&&!t.has(o.schema))t.set(o.schema,o);let n=new Map;for(let o of Mo.get(e)??[]){let r=e.seen.get(o),i=(r?.def??r?.schema)?.propertyNames;if(!i||i===!0||n.has(i))continue;let s=Po(t,i,new Set);if(s!==i)n.set(i,s)}if(!n.size)return;for(let o of e.seen.values())for(let r of[o.schema,o.def]){let i=r&&n.get(r.propertyNames);if(i)r.propertyNames=i}}var Jo=(e,t,n,o)=>{let r=n,i=e._zod.def;r.type="object";let s=i.keyType,a=W(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let d=D(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});r.patternProperties={};for(let p of a)te(r.patternProperties,su(p).source,d)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){r.propertyNames=D(i.keyType,t,{...o,path:[...o.path,"propertyNames"]});let d=Mo.get(t);if(!d)d=[],Mo.set(t,d),t.deferred.push(()=>pm(t));d.push(e)}r.additionalProperties=D(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let c=s._zod.values,l=t.io==="input"&&At(i.valueType)!==void 0;if(c&&!i.partial&&!l){let d=[...c].filter((p)=>typeof p==="string"||typeof p==="number");if(d.length>0)r.required=d.map(String)}},Yo=(e,t,n,o)=>{let r=e._zod.def,i=D(r.innerType,t,o),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=r.innerType,n.nullable=!0;else n.anyOf=[i,{type:"null"}]},Xo=(e,t,n,o)=>{let r=e._zod.def;D(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType},Qo=Symbol();function bu(e,t,n,o,r){let i=!1,s=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return i=!0,null});if(!i)return JSON.parse(s);return q(t,n,o,r,"BigInt defaults cannot be represented in JSON Schema"),Qo}var er=(e,t,n,o)=>{let r=e._zod.def;D(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType;let s=bu(r.defaultValue,e,t,n,o);if(s!==Qo)n.default=s},tr=(e,t,n,o)=>{let r=e._zod.def;D(r.innerType,t,o);let i=t.seen.get(e);if(i.ref=r.innerType,t.io!=="input")return;let s=bu(r.defaultValue,e,t,n,o);if(s!==Qo)n._prefault=s},nr=(e,t,n,o)=>{let r=e._zod.def;D(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType;let s;try{s=r.catchValue(void 0)}catch{q(e,t,n,o,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},or=(e,t,n,o)=>{let r=e._zod.def,i=r.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?r.out:r.in:r.out;D(s,t,o);let a=t.seen.get(e);a.ref=s},rr=(e,t,n,o)=>{let r=e._zod.def;D(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType,n.readOnly=!0},ir=(e,t,n,o)=>{let r=e._zod.def;D(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType},ln=(e,t,n,o)=>{let r=e._zod.def;D(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType},xu=(e,t,n,o)=>{let r=e._zod.innerType;D(r,t,o);let i=t.seen.get(e);i.ref=r},tu={string:Oo,number:zo,boolean:No,bigint:au,symbol:cu,null:uu,undefined:lu,void:$o,never:Lo,any:du,unknown:Do,date:Bo,enum:Uo,literal:Zo,nan:pu,template_literal:mu,file:fu,success:gu,custom:Fo,function:Ho,transform:jo,map:hu,set:yu,array:Vo,object:qo,union:Go,intersection:Ko,tuple:Wo,record:Jo,nullable:Yo,nonoptional:Xo,default:er,prefault:tr,catch:nr,pipe:or,readonly:rr,promise:ir,optional:ln,lazy:xu};function Su(e,t){if("_idmap"in e){let o=e,r=kt({...t,processors:tu}),i={};for(let c of o._idmap.entries()){let[l,d]=c;D(d,r)}let s={},a={registry:o,uri:t?.uri,defs:i};r.external=a;for(let c of o._idmap.entries()){let[l,d]=c;Et(r,d),te(s,l,Rt(r,d))}if(Object.keys(i).length>0){let c=r.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let n=kt({...t,processors:tu});return D(e,n),Et(n,e),Rt(n,e)}var _u=new WeakSet([Object.prototype,Error.prototype]);function pn(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let o=n(this);return Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0})}})}var _m=(e,t)=>{Zi.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);if(_u.has(n))return;_u.add(n),pn(n,"format",(o)=>(r)=>Kn(o,r)),pn(n,"flatten",(o)=>(r)=>Gn(o,r)),pn(n,"addIssue",(o)=>(r)=>{o.issues.push(r),o.message=JSON.stringify(o.issues,mt,2)}),pn(n,"addIssues",(o)=>(r)=>{o.issues.push(...r),o.message=JSON.stringify(o.issues,mt,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var oe=h("ZodError",_m,void 0,{Parent:Error});var vu=yt(oe),Tu=bt(oe),Cu=qt(oe),ku=Gt(oe),Eu=ji(oe),Ru=Vi(oe),Au=qi(oe),Iu=Gi(oe),wu=Ki(oe),Pu=Wi(oe),Mu=Ji(oe),Ou=Yi(oe);function Tm(){if(!Y.localeError)Q(bo())}function It(){if(!Y.memoizer)Q({memoizer:yo()})}var N=h("ZodType",(e,t)=>(Tm(),z.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(ne(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 ue(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(kf(e,t))},superRefine(e,t){return this.check(Ef(e,t))},overwrite(e){return this.check(Ae(e))},optional(){return $u(this)},exactOptional(){return df(this)},nullable(){return Lu(this)},nullish(){return $u(Lu(this))},nonoptional(e){return yf(this,e)},array(){return E(this)},or(e){return Ge([this,e])},and(e){return sf(this,e)},transform(e){return Du(this,Fu(e))},default(e){return ff(this,e)},prefault(e){return hf(this,e)},catch(e){return xf(this,e)},pipe(e){return Du(this,e)},readonly(){return vf(this)},describe(e){let t=this.clone();return Re.add(t,{description:e}),t},meta(...e){if(e.length===0)return Re.get(this);let t=this.clone();return Re.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 jt(this,"~standard",{...ao(this),jsonSchema:{input:Ct(this,"input"),output:Ct(this,"output")}})},set "~standard"(e){xe(this,"~standard",e)},parse:function e(t,n){return vu(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Tu(this,t,n,{callee:e})},safeParse(e,t){return Cu(this,e,t)},async safeParseAsync(e,t){return ku(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){xe(this,"spa",e)},validate(e,t){return Yn(this,e,t)},validateAsync(e,t){return Xn(this,e,t)},encode:function e(t,n){return Eu(this,t,n,{callee:e})},decode:function e(t,n){return Ru(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Au(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Iu(this,t,n,{callee:e})},safeEncode(e,t){return wu(this,e,t)},safeDecode(e,t){return Pu(this,e,t)},async safeEncodeAsync(e,t){return Mu(this,e,t)},async safeDecodeAsync(e,t){return Ou(this,e,t)},toJSONSchema(e){return Jc(this,{})(e)},get description(){return Re.get(this)?.description},get _def(){return this._zod.def}}),Bu=h("_ZodString",(e,t)=>{Xt.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Oo(e,n,o,r)},Fn({format:(e)=>W(e).format??null,minLength:(e)=>W(e).minimum??null,maxLength:(e)=>W(e).maximum??null},{regex(...e){return this.check(xo(...e))},includes(...e){return this.check(vo(...e))},startsWith(...e){return this.check(To(...e))},endsWith(...e){return this.check(Co(...e))},min(...e){return this.check(je(...e))},max(...e){return this.check(cn(...e))},length(...e){return this.check(un(...e))},nonempty(...e){return this.check(je(1,...e))},lowercase(e){return this.check(So(e))},uppercase(e){return this.check(_o(e))},trim(){return this.check(Eo())},normalize(...e){return this.check(ko(...e))},toLowerCase(){return this.check(Ro())},toUpperCase(){return this.check(Ao())},slugify(){return this.check(Io())}})),Cm=h("ZodString",(e,t)=>{Xt.init(e,t),Bu.init(e,t)},{email(e){return this.check(cc(Im,e))},url(e){return this.check(fc(Pm,e))},jwt(e){return this.check(Ic(qm,e))},emoji(e){return this.check(gc(Mm,e))},guid(e){return this.check(uc(wm,e))},uuid(e){return this.check(lc(mn,e))},uuidv4(e){return this.check(dc(mn,e))},uuidv6(e){return this.check(pc(mn,e))},uuidv7(e){return this.check(mc(mn,e))},nanoid(e){return this.check(hc(Om,e))},cuid(e){return this.check(yc(zm,e))},cuid2(e){return this.check(bc(Nm,e))},ulid(e){return this.check(xc($m,e))},base64(e){return this.check(Ec(Hm,e))},base64url(e){return this.check(Rc(jm,e))},xid(e){return this.check(Sc(Lm,e))},ksuid(e){return this.check(_c(Dm,e))},ipv4(e){return this.check(vc(Bm,e))},ipv6(e){return this.check(Tc(Um,e))},cidrv4(e){return this.check(Cc(Zm,e))},cidrv6(e){return this.check(kc(Fm,e))},e164(e){return this.check(Ac(Vm,e))},datetime(e){return this.check(wc(km,e))},date(e){return this.check(Pc(Em,e))},time(e){return this.check(Mc(Rm,e))},duration(e){return this.check(Oc(Am,e))}});function u(e){return ac(Cm,e)}var F=h("ZodStringFormat",(e,t)=>{U.init(e,t),Bu.init(e,t)}),km=h("ZodISODateTime",(e,t)=>{pa.init(e,t),F.init(e,t)}),Em=h("ZodISODate",(e,t)=>{ma.init(e,t),F.init(e,t)}),Rm=h("ZodISOTime",(e,t)=>{fa.init(e,t),F.init(e,t)}),Am=h("ZodISODuration",(e,t)=>{ga.init(e,t),F.init(e,t)}),Im=h("ZodEmail",(e,t)=>{ta.init(e,t),F.init(e,t)});var wm=h("ZodGUID",(e,t)=>{Qs.init(e,t),F.init(e,t)});var mn=h("ZodUUID",(e,t)=>{ea.init(e,t),F.init(e,t)});var Pm=h("ZodURL",(e,t)=>{ra.init(e,t),F.init(e,t)});var Mm=h("ZodEmoji",(e,t)=>{ia.init(e,t),F.init(e,t)});var Om=h("ZodNanoID",(e,t)=>{sa.init(e,t),F.init(e,t)});var zm=h("ZodCUID",(e,t)=>{aa.init(e,t),F.init(e,t)});var Nm=h("ZodCUID2",(e,t)=>{ca.init(e,t),F.init(e,t)});var $m=h("ZodULID",(e,t)=>{ua.init(e,t),F.init(e,t)});var Lm=h("ZodXID",(e,t)=>{la.init(e,t),F.init(e,t)});var Dm=h("ZodKSUID",(e,t)=>{da.init(e,t),F.init(e,t)});var Bm=h("ZodIPv4",(e,t)=>{ha.init(e,t),F.init(e,t)});var Um=h("ZodIPv6",(e,t)=>{ba.init(e,t),F.init(e,t)});var Zm=h("ZodCIDRv4",(e,t)=>{xa.init(e,t),F.init(e,t)});var Fm=h("ZodCIDRv6",(e,t)=>{Sa.init(e,t),F.init(e,t)});var Hm=h("ZodBase64",(e,t)=>{va.init(e,t),F.init(e,t)});var jm=h("ZodBase64URL",(e,t)=>{Ta.init(e,t),F.init(e,t)});var Vm=h("ZodE164",(e,t)=>{Ca.init(e,t),F.init(e,t)});var qm=h("ZodJWT",(e,t)=>{ka.init(e,t),F.init(e,t)});var Uu=h("ZodNumber",(e,t)=>{uo.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>zo(e,n,o,r),e.isFinite=!0},Fn({minValue:(e)=>{let{minimum:t,exclusiveMinimum:n}=W(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:n}=W(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:n}=W(e);return!!t||!!n?.some(Number.isSafeInteger)},format:(e)=>W(e).format??null},{gt(e,t){return this.check(sn(e,t))},gte(e,t){return this.check(He(e,t))},min(e,t){return this.check(He(e,t))},lt(e,t){return this.check(rn(e,t))},lte(e,t){return this.check(Fe(e,t))},max(e,t){return this.check(Fe(e,t))},int(e){return this.check(zu(e))},safe(e){return this.check(zu(e))},positive(e){return this.check(sn(0,e))},nonnegative(e){return this.check(He(0,e))},negative(e){return this.check(rn(0,e))},nonpositive(e){return this.check(Fe(0,e))},multipleOf(e,t){return this.check(an(e,t))},step(e,t){return this.check(an(e,t))},finite(){return this}}));function x(e){return zc(Uu,e)}var Gm=h("ZodNumberFormat",(e,t)=>{Ea.init(e,t),Uu.init(e,t)});function zu(e){return Nc(Gm,e)}var Km=h("ZodBoolean",(e,t)=>{Ra.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>No(e,n,o,r)});function w(e){return $c(Km,e)}var Wm=h("ZodUnknown",(e,t)=>{Aa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Do(e,n,o,r)});function K(){return Lc(Wm)}var Jm=h("ZodNever",(e,t)=>{Ia.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Lo(e,n,o,r)});function Ym(e){return Dc(Jm,e)}var Xm=h("ZodVoid",(e,t)=>{wa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>$o(e,n,o,r)});function Qm(e){return Bc(Xm,e)}var ef=h("ZodDate",(e,t)=>{Pa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Bo(e,n,o,r),e.min=(n,o)=>e.check(He(n,o)),e.max=(n,o)=>e.check(Fe(n,o))},Fn({minDate:(e)=>{let{minimum:t}=W(e);return t?new Date(t):null},maxDate:(e)=>{let{maximum:t}=W(e);return t?new Date(t):null}},{}));function fn(e){return Uc(ef,e)}var tf=h("ZodArray",(e,t)=>{It(),Ma.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Vo(e,n,o,r),e.element=t.element},{min(e,t){return this.check(je(e,t))},nonempty(e){return this.check(je(1,e))},max(e,t){return this.check(cn(e,t))},length(e,t){return this.check(un(e,t))},unwrap(){return this.element}});function E(e,t){return Zc(tf,e,t)}var nf=h("ZodObject",(e,t)=>{It(),Na.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>qo(e,n,o,r),Ip(e,"shape",(n)=>n._zod.def.shape,!1)},{keyof(){return I(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ne(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ne(this._zod.def,{catchall:K()}))},loose(){return this.clone(ne(this._zod.def,{catchall:K()}))},strict(){return this.clone(ne(this._zod.def,{catchall:Ym()}))},strip(){return this.clone(ne(this._zod.def,{catchall:void 0}))},extend(e){return _p(this,e)},safeExtend(e){return vp(this,e)},merge(e){return Tp(this,e)},pick(e){return xp(this,e)},omit(e){return Sp(this,e)},partial(...e){return Mi(cr,this,e[0])},exactPartial(...e){return Mi(Hu,this,e[0],"exactPartial")},required(...e){return Cp(ju,this,e[0])}});function b(e,t){let n={type:"object",shape:e??{},..._(t)};return new nf(n)}var Zu=h("ZodUnion",(e,t)=>{lo.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Go(e,n,o,r),e.options=t.options});function Ge(e,t){return new Zu({type:"union",options:e,..._(t)})}var of=h("ZodDiscriminatedUnion",(e,t)=>{Zu.init(e,t),$a.init(e,t)});function ar(e,t,n){return new of({type:"union",options:t,discriminator:e,..._(n)})}var rf=h("ZodIntersection",(e,t)=>{La.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ko(e,n,o,r)});function sf(e,t){return new rf({type:"intersection",left:e,right:t})}var af=h("ZodTuple",(e,t)=>{It(),po.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Wo(e,n,o,r)},{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 cr({type:"optional",innerType:t}))})}});function cf(e,t,n){let o=t instanceof z,r=o?n:t;return new af({type:"tuple",items:e,rest:o?t:null,..._(r)})}var Nu=h("ZodRecord",(e,t)=>{It(),Da.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Jo(e,n,o,r),e.keyType=t.keyType,e.valueType=t.valueType});function j(e,t,n){if(!t||!t._zod)return new Nu({type:"record",keyType:u(),valueType:e,..._(t)});return new Nu({type:"record",keyType:e,valueType:t,..._(n)})}var sr=h("ZodEnum",(e,t)=>{Ba.init(e,t),N.init(e,t),e._zod.processJSONSchema=(o,r,i)=>Uo(e,o,r,i),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(o,r)=>{let i={};for(let s of o)if(n.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new sr({...t,checks:[],..._(r),entries:i})},e.exclude=(o,r)=>{let i={...t.entries};for(let s of o)if(n.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new sr({...t,checks:[],..._(r),entries:i})}});function I(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new sr({type:"enum",entries:n,..._(t)})}var uf=h("ZodLiteral",(e,t)=>{Ua.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Zo(e,n,o,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function V(e,t){return new uf({type:"literal",values:Array.isArray(e)?e:[e],..._(t)})}var lf=h("ZodTransform",(e,t)=>{It(),Za.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>jo(e,n,o,r),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new ht(e.constructor.name);n.addIssue=(i)=>{if(typeof i==="string")n.issues.push(Ne(i,n.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=n.value;s.inst??(s.inst=e),n.issues.push(Ne(s))}};let r=t.transform(n.value,n);if(r instanceof Promise)return r.then((i)=>(n.value=i,n));return n.value=r,n}});function Fu(e){return new lf({type:"transform",transform:e})}var cr=h("ZodOptional",(e,t)=>{mo.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ln(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function $u(e){return new cr({type:"optional",innerType:e})}var Hu=h("ZodExactOptional",(e,t)=>{Fa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ln(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function df(e){return new Hu({type:"optional",innerType:e})}var pf=h("ZodNullable",(e,t)=>{Ha.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Yo(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Lu(e){return new pf({type:"nullable",innerType:e})}var mf=h("ZodDefault",(e,t)=>{ja.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>er(e,n,o,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ff(e,t){return new mf({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Dn(t)}})}var gf=h("ZodPrefault",(e,t)=>{Va.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>tr(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function hf(e,t){return new gf({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Dn(t)}})}var ju=h("ZodNonOptional",(e,t)=>{qa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Xo(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function yf(e,t){return new ju({type:"nonoptional",innerType:e,..._(t)})}var bf=h("ZodCatch",(e,t)=>{Ga.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>nr(e,n,o,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function xf(e,t){return new bf({type:"catch",innerType:e,catchValue:typeof t==="function"?t:$i(t)})}var Vu=h("ZodPipe",(e,t)=>{fo.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>or(e,n,o,r),e.in=t.in,e.out=t.out});function Du(e,t){return new Vu({type:"pipe",in:e,out:t})}var Sf=h("ZodPreprocess",(e,t)=>{Vu.init(e,t),Ka.init(e,t)}),_f=h("ZodReadonly",(e,t)=>{Wa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>rr(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function vf(e){return new _f({type:"readonly",innerType:e})}var Tf=h("ZodPromise",(e,t)=>{Ya.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ir(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function ur(e){return new Tf({type:"promise",innerType:e})}var Cf=h("ZodFunction",(e,t)=>{Ja.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ho(e,n,o,r)});function gn(e){return new Cf({type:"function",input:Array.isArray(e?.input)?cf(e?.input):e?.input??E(K()),output:e?.output??K()})}var qu=h("ZodCustom",(e,t)=>{Xa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Fo(e,n,o,r)});function se(e,t){return Fc(qu,e??(()=>!0),t)}function kf(e,t={}){return Hc(qu,e,t)}function Ef(e,t){return jc(e,t)}function Gu(e,t){return new Sf({type:"pipe",in:Fu(e),out:t})}var hn=["none","minimal","low","medium","high","xhigh","max"],lr=I(hn),yn=lr.exclude(["none"]),Rf=I([...hn,"default"]).nullable(),dr=ar("type",[b({type:V("toggle")}).strict(),b({type:V("effort"),values:E(Rf)}).strict(),b({type:V("budget_tokens"),min:x().min(-1).optional(),max:x().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"]})]);var Ku=I(["default","openai-responses","r1"]),Af={DEFAULT:"default",OPENAI_RESPONSES:"openai-responses",R1:"r1"},Wu=I(["images","video","tools","streaming","prompt-cache","reasoning","reasoning-effort","computer-use","global-endpoint","structured_output","temperature","files"]),Ju=I(["active","preview","deprecated","legacy"]),Yu=b({input:x().optional(),output:x().optional(),cacheWrite:x().optional(),cacheRead:x().optional()}),Xu=b({maxBudget:x().optional(),outputPrice:x().optional(),thinkingLevel:I(["low","high"]).optional()}),Qu=b({reasoningDefaultOn:w().optional(),apiProtocol:I(["openai-chat","openai-responses","anthropic","gemini"]).optional()}).catchall(K()),pr=I(["text","image","audio","video","pdf"]),el=b({input:E(pr),output:E(pr)});function tl(e){return(e?.input===void 0||e.input.includes("text"))&&(e?.output===void 0||e.output.includes("text"))}var nl=I(["language","image-generation","speech-generation","video-generation","transcription","realtime"]);function If(e){let t=e.modalities?.input,n=e.modalities?.output;return t?.length===1&&t[0]==="audio"&&n?.length===1&&n[0]==="text"}function wf(e){return(e.operation===void 0||e.operation==="language")&&tl(e.modalities)}var ol=I(["batch","streaming"]);function Pf(e){return e.modalities?.input.includes("text")===!0&&e.modalities.output.includes("image")}function Mf(e){return e.operation==="image-generation"}function mr(e,t,n){let o=e.capabilities;if(o===void 0||o.length===0)return n?.assumeWhenUnspecified??!1;return o.includes(t)}function Of(e){return mr(e,"tools",{assumeWhenUnspecified:!0})}function zf(e){return mr(e,"images",{assumeWhenUnspecified:!0})}var bn=b({id:u(),name:u().optional(),description:u().optional(),maxTokens:x().optional(),contextWindow:x().optional(),maxInputTokens:x().optional(),capabilities:E(Wu).optional(),operation:nl.optional(),operationModes:E(ol).optional(),modalities:el.optional(),reasoningOptions:E(dr).optional(),apiFormat:Ku.optional(),systemRole:I(["system","developer"]).optional(),temperature:x().optional(),pricing:Yu.optional(),thinkingConfig:Xu.optional(),status:Ju.optional(),deprecationNotice:u().optional(),replacedBy:u().optional(),releaseDate:u().optional(),deprecationDate:u().optional(),family:u().optional(),metadata:Qu.optional()});var Nf="This tool call was rejected by the user and not executed.",$f="NOT a tool or system failure. Clarify with user before proceeding.",fr=b({id:u(),name:u(),execution:I(["client","provider"]).optional(),input:K(),output:K(),error:u().optional(),durationMs:x(),startedAt:fn(),endedAt:fn()});var Lf=I(["completed","max_iterations","aborted","mistake_limit","error"]),Df=b({inputTokens:x(),outputTokens:x(),cacheReadTokens:x().optional(),cacheWriteTokens:x().optional(),totalCost:x().optional()}),iv=b({text:u(),usage:Df,messages:E(se()),toolCalls:E(fr),iterations:x(),finishReason:Lf,model:b({id:u(),provider:u(),info:bn.optional()}),startedAt:fn(),endedAt:fn(),durationMs:x()}),sv=b({distinctId:u().optional(),sessionId:u().optional(),providerId:u(),modelId:u(),apiKey:u().optional(),baseUrl:u().url().optional(),headers:j(u(),u()).optional(),knownModels:j(u(),bn).optional(),providerConfig:K().optional(),initialMessages:E(se()).optional(),systemPrompt:u(),tools:E(se()),modelTools:E(se()).optional(),maxIterations:x().positive().optional(),maxParallelToolCalls:x().int().positive().default(8),maxTokensPerTurn:x().positive().optional(),temperature:x().nonnegative().optional(),apiTimeoutMs:x().positive().default(180000),userFileContentLoader:gn().input([u()]).output(ur(u())).optional(),toolContextMetadata:j(u(),K()).optional(),execution:b({maxConsecutiveMistakes:x().int().positive().optional(),reminderAfterIterations:x().nonnegative().optional(),reminderText:u().optional(),loopDetection:Ge([V(!1),b({softThreshold:x().int().positive().optional(),hardThreshold:x().int().positive().optional()})]).optional()}).optional(),reasoningEffort:yn.optional(),thinkingBudgetTokens:x().positive().optional(),thinking:w().optional(),onEvent:gn().input([se()]).output(Qm()).optional(),hooks:se().optional(),parentAgentId:u().optional(),extensions:E(se()).optional(),hookErrorMode:I(["ignore","throw"]).default("ignore"),toolPolicies:j(u(),b({enabled:w().optional(),autoApprove:w().optional()})).optional(),requestToolApproval:gn().input([b({sessionId:u(),agentId:u(),conversationId:u(),iteration:x(),toolCallId:u(),toolName:u(),input:K(),policy:b({enabled:w().optional(),autoApprove:w().optional()}).default({})})]).output(Ge([b({approved:w(),reason:u().optional()}),ur(b({approved:w(),reason:u().optional()}))])).optional(),onConsecutiveMistakeLimitReached:gn().input([b({iteration:x().int().positive(),consecutiveMistakes:x().int().positive(),maxConsecutiveMistakes:x().int().positive(),reason:I(["api_error","invalid_tool_call","tool_execution_failed"]),details:u().optional()})]).output(Ge([b({action:V("continue"),guidance:u().optional()}),b({action:V("stop"),reason:u().optional()}),ur(Ge([b({action:V("continue"),guidance:u().optional()}),b({action:V("stop"),reason:u().optional()})]))])).optional(),logger:se().optional(),extensionContext:se().optional(),abortSignal:se().optional()});var rl=I(["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"]),il=b({id:u().optional(),label:u().optional(),role:u().optional(),participantKey:u().optional(),participantLabel:u().optional(),platformUserId:u().optional(),metadata:j(u(),K()).optional()}),sl=b({source:u(),sourceEvent:u(),threadId:u(),channelId:u(),isDM:w(),sessionId:u().optional(),workspaceRoot:u().optional(),metadata:j(u(),K()).optional()}),Bf=b({actor:il,context:sl,payload:j(u(),K()).optional()}),Uf=b({action:I(["allow","deny"]).default("allow"),message:u().optional(),reason:u().optional(),metadata:j(u(),K()).optional()}),Zf=b({adapter:u(),botUserName:u().optional(),event:rl,payload:j(u(),K()),ts:u()});var al=[{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 cl(){return al.map((e)=>({...e}))}function ul(e,t){let n=e.includeWhen;if(!n)return!0;let o=t[n.flag]??"";if(n.equals!==void 0&&o!==n.equals)return!1;if(n.notEquals!==void 0&&o===n.notEquals)return!1;return!0}function Ff(e,t,n){let o={};for(let i of e.fields){let s=t[i.flag];o[i.flag]=typeof s==="string"?s.trim():i.initialValue??""}let r=[];for(let i of e.fields){if(!ul(i,o))continue;let s=o[i.flag]??"";if(!s){if(i.required)throw Error(`${i.label} is required`);continue}r.push(i.flag,s)}if(n?.enabled===!0&&e.security){let i={};for(let s of e.security.fields){let a=n.values[s.key]?.trim();if(!a)throw Error(s.requiredMessage);let c=s.validate?.(a);if(c)throw Error(c);i[s.key]=a}r.push(...e.security.buildArgs(i))}return r}function Hf(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 jf(e,t,n,o){let r=new Set([...e.fields.flatMap((s)=>[s.flag,...s.aliases??[]]),...e.derivedReconnectFlags??[]]);if(o.replaceSecurityArgs)for(let s of e.security?.argumentFlags??[])r.add(s);let i=[];for(let s=0;s<t.length;s+=1){let a=t[s]??"",c=Hf(a,r);if(!c.managed){i.push(a);continue}if(c.consumesNext)s+=1}return[...i,...n]}function Vf(e=ll){let t=new Set(cl().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((o)=>({flag:o.flag,label:o.label,placeholder:o.placeholder,required:o.required,help:o.help,initialValue:o.initialValue,options:o.options,includeWhen:o.includeWhen})),security:n.security?{prompt:n.security.prompt,fields:n.security.fields.map((o)=>({key:o.key,label:o.label,placeholder:o.placeholder,help:o.help,requiredMessage:o.requiredMessage}))}:void 0}))}function qf(e){return/^\d+$/.test(e)?void 0:"Telegram user ID must contain digits only"}function Gf(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 Kf(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 ll=[{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:qf}],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:Gf},{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:Kf}],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}]}];var dl=[];function gr(e){dl.push(e)}async function Wf(){let e=dl.splice(0);await Promise.all(e.map((t)=>{try{return(typeof t==="function"?t():t.dispose())??Promise.resolve()}catch{return Promise.resolve()}}))}var Jf=["hooks","tools","commands","rules","skills","messageBuilders","providers","automationEvents","mcp"],Yf=new Set(Jf);function fl(e,t){return e.name||`extension_${String(t).padStart(4,"0")}`}function pl(e){return Array.isArray(e)&&e.every((t)=>typeof t==="string")}function ml(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 gl(e){let t=ml(e.providerIds),n=ml(e.modelIds);return{...e,...t?{providerIds:t}:{},...n?{modelIds:n}:{}}}function Xf(e,t){let n=fl(e,t),o=e.manifest;if(!o||typeof o!=="object")throw Error(`Invalid manifest for extension "${n}": manifest is required`);if(!Array.isArray(o.capabilities)||o.capabilities.length===0)throw Error(`Invalid manifest for extension "${n}": capabilities must be a non-empty array`);let r=new Set;for(let a of o.capabilities){if(!Yf.has(a))throw Error(`Invalid manifest for extension "${n}": unsupported capability "${String(a)}"`);r.add(a)}if(Object.hasOwn(o,"providerIds")&&!pl(o.providerIds))throw Error(`Invalid manifest for extension "${n}": providerIds must be a string array when provided`);if(Object.hasOwn(o,"modelIds")&&!pl(o.modelIds))throw Error(`Invalid manifest for extension "${n}": modelIds must be a string array when provided`);let i=r.has("hooks");if(e.hooks!==void 0&&!i)throw Error(`Invalid manifest for extension "${n}": runtime hooks require the "hooks" capability`);return{capabilities:r,raw:gl(o)}}function Qf(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():"",o=typeof e.source==="string"?e.source.trim():"";if(!n)throw Error(`Invalid automation event contribution for extension "${t}": eventType is required`);if(!o)throw Error(`Invalid automation event contribution for extension "${t}": source is required`);return{...e,eventType:n,source:o,examples:e.examples?[...e.examples]:void 0,metadata:e.metadata?{...e.metadata}:void 0}}class hr{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:Xf(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 o of this.normalized){let{extension:r}=o;if(r.disabled)continue;let i=fl(r,o.order),s={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]},a={registerTool:(l)=>s.tools.push(l),registerCommand:(l)=>s.commands.push(l),registerRule:(l)=>{if(!o.manifest.capabilities.has("rules"))throw Error(`Invalid setup for extension "${i}": registerRule requires the "rules" capability`);s.rules.push(l)},registerMessageBuilder:(l)=>s.messageBuilder.push(l),registerProvider:(l)=>s.providers.push(l),registerAutomationEventType:(l)=>{if(!o.manifest.capabilities.has("automationEvents"))throw Error(`Invalid setup for extension "${i}": registerAutomationEventType requires the "automationEvents" capability`);s.automationEventTypes.push(Qf(l,i))},registerMcpServer:(l)=>{if(!o.manifest.capabilities.has("mcp"))throw Error(`Invalid setup for extension "${i}": registerMcpServer requires the "mcp" capability`);s.mcpServers.push({...l,metadata:{...l.metadata??{},source:"plugin",plugin:i}})}},c=o.manifest.capabilities.has("automationEvents")?this.setupContext:{...this.setupContext,automation:void 0};try{await r.setup?.(a,c),n.push(s)}catch(l){if(e.tolerateSetupErrors!==!0)throw l;t??=l}}if(t&&e.tolerateSetupErrors!==!0)throw t;for(let o of n)this.registry.tools.push(...o.tools),this.registry.commands.push(...o.commands),this.registry.rules.push(...o.rules),this.registry.messageBuilder.push(...o.messageBuilder),this.registry.providers.push(...o.providers),this.registry.automationEventTypes.push(...o.automationEventTypes),this.registry.mcpServers.push(...o.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 eg(e={}){return new hr(e)}var tg=[".js",".ts"];var Ke={CLINE_PASS:"ext-cline-pass",CODE_CLOUD_AGENTS:"code-cloud-agents",CODE_ONBOARDING_GITHUB:"code-onboarding-github",CLINE_COMPOSIO_BETA:"CLINE_COMPOSIO_BETA"},ng={[Ke.CLINE_PASS]:!1,[Ke.CODE_CLOUD_AGENTS]:!1,[Ke.CODE_ONBOARDING_GITHUB]:!1,[Ke.CLINE_COMPOSIO_BETA]:!1},og=Object.values(Ke);var hl=I(["agent_start","agent_resume","agent_abort","agent_end","agent_error","tool_call","tool_result","prompt_submit","pre_compact","session_shutdown"]),$e=j(u(),u()),rg=b({toolName:u(),parameters:$e}),ig=b({toolName:u(),parameters:$e,result:u(),success:w(),executionTimeMs:x()}),sg=b({prompt:u(),attachments:E(u())}),ag=b({taskMetadata:$e}),cg=b({taskMetadata:$e,previousState:$e}),ug=b({taskMetadata:$e}),lg=b({taskMetadata:$e}),dg=b({taskId:u(),ulid:u(),contextSize:x(),compactionStrategy:u(),previousApiReqIndex:x(),tokensIn:x(),tokensOut:x(),tokensInCache:x(),tokensOutCache:x(),deletedRangeStart:x(),deletedRangeEnd:x(),contextJsonPath:u(),contextRawPath:u()}),yl=b({clineVersion:u(),hookName:hl,timestamp:u(),taskId:u(),sessionContext:b({rootSessionId:u().optional(),hookLogPath:u().optional()}).optional(),workspaceRoots:E(u()),workspaceInfo:se().optional(),userId:u(),agent_id:u(),parent_agent_id:u().nullable(),iteration:x().optional(),reason:u().optional(),tool_call:b({id:u(),name:u(),input:K()}).optional(),tool_result:se().optional(),turn:K().optional(),error:b({name:u(),message:u(),stack:u().optional()}).optional(),preToolUse:rg.optional(),postToolUse:ig.optional(),userPromptSubmit:sg.optional(),taskStart:ag.optional(),taskResume:cg.optional(),taskCancel:ug.optional(),taskComplete:lg.optional(),preCompact:dg.optional()}).passthrough();function pg(e){let t=yl.safeParse(e);if(!t.success)return;return t.data}var Sv="v1",_v="v1",vv="v1",Tv=["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","stream.replay"];function xn(e){let t=/^v(\d+)$/.exec(e?.trim()??"");if(!t)return;return Number.parseInt(t[1]??"",10)}function Cv(e,t="v1"){let n=xn(e.protocolVersion),o=xn(t);if(n===void 0||o===void 0)return{compatible:!1,reason:"missing_protocol"};let r=xn(e.minClientProtocolVersion)??n,i=xn(e.maxClientProtocolVersion)??n;return o>=r&&o<=i?{compatible:!0}:{compatible:!1,reason:"unsupported_protocol"}}var kv="approval.respond",Ev="0",Rv="__hubScheduleRunAt",bl=["act","plan","yolo"];function mg(e){return bl.some((t)=>t===e)}function Av(e,t){if(!e||!Object.hasOwn(e,"mode"))return t;let n=e.mode;if(mg(n))return n;throw Error(`mode must be one of: ${bl.join(", ")}`)}var fg=30000,Iv=5000;function gg(e){switch(e){case"run.start":case"session.send_input":return null;default:return fg}}function wv(e,t){return t===void 0?gg(e):t}var hg=["readFile","search","bash","webFetch","editor","applyPatch","skills","askQuestion","submit"],yg=new Set(hg);function Pv(e){return typeof e==="string"&&yg.has(e)}var Mv="tool_executor.",Ov="custom_tool.",zv="hook.",Nv="compaction.compact",$v="checkpoint.create",Lv="mistake_limit.decide",Dv="user_instructions.snapshot";function Bv(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"}`,o=e.participantClientCount;if(typeof o!=="number"||o<=0)return n;return`${n} from ${o} connected Cline client${o===1?"":"s"}`}function yr(e,t){return`<file_content path="${e}">
59
59
  ${t}
60
- </file_content>`}function bg(e,t="act"){return`<user_input mode="${t}">${e}</user_input>`}function xg(e,t){return`<user_command slash="${t}">${e}</user_command>`}var Sg=/<user_input\b[^>]*\bmode="(act|plan|yolo)"/;function _g(e){let t=Sg.exec(e??"");return t?t[1]:void 0}function vg(e,t){return`<mode_notice>The user switched from ${e} mode to ${t} mode before sending this message.</mode_notice>`}function Tg(){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 Cg(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 kg(e,t){return new RegExp(`${t}="([^"]+)"`,"i").exec(e)?.[1]?.trim()||void 0}function xl(e){if(!e?.trim())return;let t=Cg(e,"user_command");if(!t)return;let n=kg(t.attrs,"slash");if(!n)return;return{slash:n,content:t.content.trim()}}function Sl(e){if(!e?.trim())return"";let t=e.trim();for(let n of["user_input","user_command"]){let r=kl(t,n);t=(r!==t?r:t.replace(new RegExp(`<${n}[^>]*>`,"g"),"")).trim()}return t}function _l(e){if(!e?.trim())return"";return Eg(e,"mode_notice").trim()}function Eg(e,t){let n=`<${t}>`,r=`</${t}>`,o=e,i=o.indexOf(n);while(i!==-1){let s=o.indexOf(r,i+n.length);if(s===-1)break;o=o.slice(0,i)+o.slice(s+r.length),i=o.indexOf(n,i)}return o}function bo(e){let t=_l(Sl(e)),n=xl(e);if(!n)return t;if(n.slash.toLowerCase()==="team"){let o=t.toLowerCase().startsWith("spawn a team of agents for the following task:")?t.slice(46).trim():t;return o?`/team ${o}`:"/team"}return t?`/${n.slash} ${t}`:`/${n.slash}`}var vl=240,Tl=480;function Cl(e,t){let n=e.replace(/\s+/gu," ").trim();if(n.length<=t)return n;return`${n.slice(0,t-1).trimEnd()}…`}function Rg(e){return Cl(bo(e),vl)}function Ag(e,t){let n=t?.trim()??"",r=e.toLowerCase(),o=r==="user"||r==="session"?bo(n):n;return Cl(o,Tl)}function kl(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 We="[media omitted: invalid or exceeds size limit]",Je="[Image attached — this model cannot view images]",El=w(["image","audio","video","file"]),Rl=so("type",[b({type:V("base64"),data:u().min(1)}),b({type:V("url"),url:u().url().refine((e)=>{let t=new URL(e).protocol;return t==="http:"||t==="https:"},"Generated media URLs must use HTTP or HTTPS")}),b({type:V("artifact"),artifactId:u().min(1)})]);function Al(e){if(e.startsWith("image/"))return"image";if(e.startsWith("audio/"))return"audio";if(e.startsWith("video/"))return"video";return"file"}var wl=b({id:u().min(1),modality:El,mediaType:u().min(1),source:Rl,name:u().min(1).optional(),sizeBytes:x().int().nonnegative().optional()}).refine((e)=>Al(e.mediaType)===e.modality,{message:"Generated media modality must match its media type",path:["modality"]});function wg(e){return wl.safeParse(e).success}function Ig(e){return Al(e)}var _n=["image/png","image/jpeg","image/gif","image/webp"],xo=5242880,fe=xo,Se=6291456,Il=8388608;function Pg(e){return e.length}function So(e){let t=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.floor(e.length*3/4)-t}function Mg(e=xo){return Math.floor(e*3/4)}function _o(e){return Math.ceil(e/3)*4}function vo(e={}){return{maxImageEncodedBytes:e.maxImageEncodedBytes??fe,maxImageDecodedBytes:e.maxImageDecodedBytes??Se,maxTotalMediaBytes:e.maxTotalMediaBytes??Il}}function vn(){return{totalEncodedBytes:0,keptImages:0,omittedImages:0,omittedReasons:{}}}function Sn(e,t){e.omittedImages+=1,e.omittedReasons[t]=(e.omittedReasons[t]??0)+1}function It(e,t,n,r){let o=vo(n);if(e>o.maxImageEncodedBytes){let i={ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${o.maxImageEncodedBytes} byte encoded limit`};return Sn(r,i.reason),i}if(t>o.maxImageDecodedBytes){let i={ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${o.maxImageDecodedBytes} byte decoded limit`};return Sn(r,i.reason),i}if(r.totalEncodedBytes+e>o.maxTotalMediaBytes){let i={ok:!1,reason:"total_limit",message:`Image media exceeds the ${o.maxTotalMediaBytes} byte total media limit`};return Sn(r,i.reason),i}return r.totalEncodedBytes+=e,r.keptImages+=1,null}function Pl(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===47}function Og(e){return e.length>0&&To(e,0,e.length)}function zg(e,t,n){let r=Ml(e),o=r.end-r.start;if(o===0)return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let i=vo(t);if(n.totalEncodedBytes+o>i.maxTotalMediaBytes)return{ok:!1,reason:"total_limit",message:`Generated media exceeds the ${i.maxTotalMediaBytes} byte total media limit`};if(!To(e,r.start,r.end))return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let s=e.slice(r.start,r.end);return n.totalEncodedBytes+=o,{ok:!0,base64:s,encodedBytes:o,decodedBytes:So(s)}}function To(e,t,n){let r=n-t;if(r%4!==0)return!1;let o=n;if(r>=2&&e.charCodeAt(n-2)===61&&e.charCodeAt(n-1)===61)o-=2;else if(r>=1&&e.charCodeAt(n-1)===61)o-=1;for(let i=t;i<o;i++)if(!Pl(e.charCodeAt(i)))return!1;for(let i=o;i<n;i++)if(e.charCodeAt(i)!==61)return!1;return!0}function Ng(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 Ml(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 $g(e,t,n){if(!Ng(e,t,n))return;let r=t+5,o=e.indexOf(",",r);if(o===-1||o>=n)return;if(o-r>128)return;let i=e.slice(r,o).toLowerCase(),s=";base64";if(!i.endsWith(s))return;let a=i.slice(0,-s.length);if(!a||a.includes(";"))return;return{mediaType:a,base64Start:o+1,base64End:n}}function Ol(e,t,n={}){let r=n.maxEncodedBytes??fe,o=n.maxDecodedBytes??Se,i=new Set(n.supportedMediaTypes??_n),s=e?.toLowerCase(),a=Ml(t),{start:c,end:l}=a,d=$g(t,a.start,a.end);if(d){if(s&&s!==d.mediaType)return{ok:!1,reason:"media_type_mismatch",message:`Image media type ${e} does not match data URL type ${d.mediaType}`};s=d.mediaType,c=d.base64Start,l=d.base64End}if(!s||!i.has(s))return{ok:!1,reason:"unsupported_media_type",message:`Unsupported image media type: ${e??"unknown"}`};let p=l-c;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(!To(t,c,l))return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};let m=t.slice(c,l),f=So(m);if(f>o)return{ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${o} byte decoded limit`};return{ok:!0,mediaType:s,base64:m,encodedBytes:p,decodedBytes:f}}function Pt(e,t,n,r){let o=Ol(e,t,{maxEncodedBytes:n.maxImageEncodedBytes,maxDecodedBytes:n.maxImageDecodedBytes});if(!o.ok)return Sn(r,o.reason),o;let i=It(o.encodedBytes,o.decodedBytes,n,r);if(i)return i;return o}function ae(e){return e.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"�")}var Mt="ERROR: EMPTY CONTENT",Lg="[image attached]",Dg="[generated image]";function Bg(e){return`[generated ${e}]`}function Tn(e){return{type:"text",text:`[generated ${e.modality} unavailable to this model]`}}function Co(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 Ug(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 Le(){return{type:"text",text:We}}function zl(e){return It(fe,0,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},e)===null}function $l(e){try{return new URL(e).protocol}catch{return}}function ko(e,t){let n=Pt(e.mediaType,e.data,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},t);if(!n.ok)return Le();return Ll(n.base64,n.mediaType)}function Ll(e,t){return{type:"file",data:{type:"data",data:e},mediaType:t}}function Ye(e,t){return{type:"file",data:e,mediaType:t??"image"}}function Eo(e,t){if(e.image instanceof URL){if(e.image.protocol==="data:"){let s=Pt(e.mediaType,e.image.href,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},t);if(!s.ok)return Le();return Ye(`data:${s.mediaType};base64,${s.base64}`,s.mediaType)}if(e.image.protocol!=="http:"&&e.image.protocol!=="https:")return Le();if(!zl(t))return Le();return Ye(e.image,e.mediaType)}if(typeof e.image==="string"){let s=$l(e.image);if(s==="http:"||s==="https:"){if(!zl(t))return Le();return Ye(e.image,e.mediaType)}let a=s==="data:",c=Pt(e.mediaType??(a?void 0:"image/png"),e.image,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},t);if(!c.ok)return Le();return Ye(a?`data:${c.mediaType};base64,${c.base64}`:c.base64,c.mediaType)}let n=e.image.byteLength,r=_o(n),o=e.mediaType?.toLowerCase()??"image/png";if(!_n.includes(o)||It(r,n,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},t))return Le();return Ye(e.image,o)}function Zg(e,t){if(!t)return!0;if(e.modality==="file")return e.mediaType==="application/pdf"&&t.includes("pdf");return t.includes(e.modality)}function Nl(e,t,n){if(!Zg(e,n))return Tn(e);if(e.modality==="image"){if(e.source.type==="artifact")return Tn(e);return Eo({type:"image",image:e.source.type==="url"?e.source.url:e.source.data,mediaType:e.mediaType},t)}if(e.source.type==="artifact")return Tn(e);if(e.source.type==="url"){let r=$l(e.source.url);if(r!=="http:"&&r!=="https:"&&r!=="data:")return Tn(e)}return Ye(e.source.type==="url"?e.source.url:e.source.data,e.mediaType)}function Ro(e,t,n,r){let{hoistImages:o,inlineImagePlaceholder:i}=r;if(e==null||typeof e!=="object")return{value:e,changed:!1,mediaChanged:!1};if(Array.isArray(e)){let d=[],p=!1,m=!1;for(let f of e){if(f&&typeof f==="object"){let y=f;if(y.type==="image"&&typeof y.data==="string"&&typeof y.mediaType==="string"){if(!o){d.push(i),p=!0,m=!0;continue}let S={type:"image",data:y.data,mediaType:y.mediaType},v=ko(S,n);if(v.type==="file")t.push({type:"image",data:v.data.data,mediaType:v.mediaType});else d.push(v.text);p=!0,m=!0;continue}if(y.type==="image"){d.push(We),p=!0,m=!0;continue}if(y.type==="text"&&typeof y.text==="string"){d.push(y.text),p=!0;continue}}let g=Ro(f,t,n,r);d.push(g.value),p||=g.changed,m||=g.mediaChanged}return{value:p?d:e,changed:p,mediaChanged:m}}let s=e;if(s.type==="image"){if(typeof s.data==="string"&&typeof s.mediaType==="string"){if(!o)return{value:i,changed:!0,mediaChanged:!0};let d={type:"image",data:s.data,mediaType:s.mediaType},p=ko(d,n);if(p.type==="file")return t.push({type:"image",data:p.data.data,mediaType:p.mediaType}),{value:Lg,changed:!0,mediaChanged:!0};return{value:p.text,changed:!0,mediaChanged:!0}}return{value:We,changed:!0,mediaChanged:!0}}let a={},c=!1,l=!1;for(let[d,p]of Object.entries(s)){let m=Ro(p,t,n,r);a[d]=m.value,c||=m.changed,l||=m.mediaChanged}return{value:c?a:e,changed:c,mediaChanged:l}}function Ot(e){if(typeof e==="string")return ae(e);if(Array.isArray(e))return e.map((t)=>Ot(t));if(e!==null&&typeof e==="object"){let t=e,n={};for(let[r,o]of Object.entries(t))n[r]=Ot(o);return n}return e}function Dl(e,t=!1,n=vn(),r){let o=r?.supportsImages??!0;if(typeof e==="string")return{type:t?"error-text":"text",value:ae(e)};if(!t&&Ug(e))return{type:"content",value:e.map((i)=>i.type==="image"?o?ko(i,n):{type:"text",text:Je}:{type:"text",text:ae(i.text)})};if(e!==null&&typeof e==="object"){let i=[],s=Ro(e,i,n,{hoistImages:!t&&o,inlineImagePlaceholder:o?We:Je});if(!t&&i.length>0)return{type:"content",value:[{type:"text",text:typeof s.value==="string"?ae(s.value):JSON.stringify(Ot(s.value))},...i.map((c)=>Ll(c.data,c.mediaType))]};if(s.mediaChanged)return{type:t?"error-json":"json",value:Ot(s.value)}}if(e===null||typeof e==="boolean"||typeof e==="number"||typeof e==="object")return{type:t?"error-json":"json",value:Ot(e)};return{type:t?"error-text":"text",value:ae(String(e))}}function Fg(e,t,n){let r=n?.assistantToolCallArgKey??"input",o=n?.supportedInputModalities,i=!o||o.includes("image"),s=[],a=vn(),c=[],l=()=>c.splice(0).map((p)=>p.type==="image"?i?Eo(p,a):{type:"text",text:Je}:Nl(p.media,a,o));if(typeof e==="string"&&e.trim().length>0||Array.isArray(e)&&e.length>0)s.push({role:"system",content:typeof e==="string"?ae(e):e});for(let d of t){let p=d.content;if(typeof p==="string"){let y=d.role==="user"&&c.length>0?l():[];if(y.length>0){s.push({role:d.role,content:[{type:"text",text:p.trim().length>0?ae(p):Mt},...y]});continue}if(p.trim().length===0){s.push({role:d.role,content:[{type:"text",text:Mt}]});continue}s.push({role:d.role,content:ae(p)});continue}let m=[],f=[];if(p.length===0){s.push({role:d.role,content:[{type:"text",text:Mt}]});continue}for(let y of p)switch(y.type){case"text":m.push({type:"text",text:ae(y.text),...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"reasoning":m.push({type:"reasoning",text:ae(y.text),...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"image":if(d.role==="assistant")c.push(y),m.push({type:"text",text:Dg});else m.push(i?Eo(y,a):{type:"text",text:Je});break;case"media":if(d.role==="assistant")c.push(y),m.push({type:"text",text:Bg(y.media.modality)});else m.push(Nl(y.media,a,o));break;case"file":m.push({type:"text",text:yo(y.path,ae(y.content))});break;case"tool-call":if(d.role==="assistant")m.push({type:"tool-call",toolCallId:y.toolCallId,toolName:y.toolName,[r]:y.input,...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"tool-result":{f.push({type:"tool-result",toolCallId:y.toolCallId,toolName:y.toolName,output:Dl(y.output,y.isError??!1,a,{supportsImages:i})});break}}let g=f.length>0;if(d.role==="user"&&!g&&c.length>0)m.push(...l());if(m.length>0&&m.every((y)=>y.type==="text"&&typeof y.text==="string"&&y.text.trim().length===0))m.splice(0,m.length,{type:"text",text:Mt});if(m.length>0)Co(s,{role:d.role,content:m});if(g)Co(s,{role:"tool",content:f})}if(c.length>0)Co(s,{role:"user",content:l()});return s}var qv=["show","hide","subscription"];function Bl(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Hg(e,t){if(!e&&!t)return;let n=e?.metadata,r=t?.metadata,o={...e??{},...t??{}};if(Bl(n)&&Bl(r))o.metadata={...n,...r};return o}var Wv=["web_search","image_generation"],Jv=["web_search"];var zt={max:1,xhigh:0.95,high:0.8,medium:0.5,low:0.2,minimal:0.1,none:0},jg=void 0;function Vg(e,t){if(typeof e==="string"&&e.toLowerCase()in zt)return e.toLowerCase();return t?void 0:void 0}function Ul(e,t){let n=typeof e==="string"?e.toLowerCase():void 0;if(n&&n in zt)return zt[n];if(t?.fallbackEffort)return zt[t.fallbackEffort];return}function qg(e){let t=Ul(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 Gg(e){return e instanceof Error?{name:e.name,message:e.message}:e}var Kg=3;function Zl(e){return Math.max(1,Math.ceil(e/3))}function Ao(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 Wg(e){let t;try{t=JSON.stringify({systemPrompt:e.systemPrompt,messages:e.messages,tools:e.tools})}catch{t=[Ao(e.systemPrompt),Ao(e.messages),Ao(e.tools)].join(`
61
- `)}return Zl(t.length)}var Jg={debug:()=>{},log:()=>{},error:()=>{}};var nT=60,rT=1,oT=3600;function Yg(e){return typeof e==="number"&&Number.isFinite(e)}function Xg(e){return Math.min(Math.max(e,1),3600)}function iT(e){if(!Yg(e))return 60;return Xg(e)}function sT(e,t,n){let r=n?` (${n})`:"",o=Math.round(t/100)/10;return`MCP request to "${e}"${r} timed out after ${o}s. Increase the "timeout" field (in seconds) for this server in cline_mcp_settings.json.`}function Qg(e){if(e instanceof Error)return e.message;return String(e)}function eh(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return""}class we extends Error{constructor(e,t){super(`${e} at position ${t}`);this.position=t}}function Fl(e){return/^[0-9A-Fa-f]$/.test(e)}function ve(e){return e>="0"&&e<="9"}function Hl(e){return e>=" "}function Qe(e){return`,:[]/{}()
62
- +`.includes(e)}function wo(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"||e==="$"}function Cn(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"||e==="$"||e>="0"&&e<="9"}var Io=/^(http|https|ftp|mailto|file|data|irc):\/\/$/,Po=/^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;function Mo(e){return`,[]/{}
63
- +`.includes(e)}function Oo(e){return et(e)||th.test(e)}var th=/^[[{\w-]$/;function zo(e){return e===`
64
- `||e==="\r"||e==="\t"||e==="\b"||e==="\f"}function _e(e,t){let n=e.charCodeAt(t);return n===32||n===10||n===9||n===13}function jl(e,t){let n=e.charCodeAt(t);return n===32||n===9||n===13}function Vl(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 et(e){return No(e)||kn(e)}function No(e){return e==='"'||e==="“"||e==="”"}function $o(e){return e==='"'}function kn(e){return e==="'"||e==="‘"||e==="’"||e==="`"||e==="´"}function Lo(e){return e==="'"}function tt(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 ce(e,t){let n=e.length;if(!_e(e,n-1))return e+t;while(_e(e,n-1))n--;return e.substring(0,n)+t+e.substring(n)}function ql(e,t,n){return e.substring(0,t)+e.substring(t+n)}function Gl(e){return/[,\n][ \t\r]*$/.test(e)}var nh={"&quot;":'"',"&amp;":"&","&lt;":"<","&gt;":">","&apos;":"'"},Do=12;function Bo(e){if(e.charAt(0)!=="&")return null;let t=e.indexOf(";");if(t===-1)return null;let n=e.substring(0,t+1),r=nh[n];if(r!==void 0)return{char:r,length:n.length};if(e.charAt(1)==="#"){let o=e.substring(2,t),i=o.charAt(0)==="x"||o.charAt(0)==="X",s=i?o.substring(1):o;if(s.length>0){let a=Number.parseInt(s,i?16:10);if(!Number.isNaN(a)&&a>=0&&a<=1114111)return{char:String.fromCodePoint(a),length:n.length}}}return null}function Kl(e){return e!==null&&e.char==='"'}function Wl(e){return e!==null&&e.char==="'"}function Xe(e,t){let n=0;for(let r=0;r<e.length;r++)if(e.charAt(r)===t)n++;return n}function Jl(e,t){switch(t){case")":return Xe(e,"(")>Xe(e,")");case"]":return Xe(e,"[")>Xe(e,"]");case"}":return Xe(e,"{")>Xe(e,"}");default:return!1}}var Yl={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},rh={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
65
- `,r:"\r",t:"\t"};function Uo(e){let t=0,n="";if(l(["```","[```","{```"]),!i())gp();l(["```","```]","```}"]);let o=p(",");if(o)s();if(Oo(e[t])&&Gl(n)){if(!o)n=ce(n,",");v()}else if(o)n=tt(n,",");while(e[t]==="}"||e[t]==="]")t++,s();if(t>=e.length)return n;lt();function i(){s();let T=y()||S()||k()||R()||B()||J(!1)||Te();return s(),T}function s(){let T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,C=t,O=a(T);do if(O=c(),O)O=a(T);while(O);return t>C}function a(T){let C=T?_e:jl,O="";while(!0)if(C(e,t))O+=e[t],t++;else if(Vl(e,t))O+=" ",t++;else break;if(O.length>0)return n+=O,!0;return!1}function c(){if(e[t]==="/"&&e[t+1]==="*"){while(t<e.length&&!oh(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(T){if(d(T)){if(wo(e[t]))while(t<e.length&&Cn(e[t]))t++;return s(),!0}return!1}function d(T){a(!0);for(let C of T){let O=t+C.length;if(e.slice(t,O)===C)return t=O,!0}return!1}function p(T){if(e[t]===T)return n+=e[t],t++,!0;return!1}function m(T){if(e[t]===T)return t++,!0;return!1}function f(){return m("\\")}function g(){if(s(),e[t]==="."&&e[t+1]==="."&&e[t+2]===".")return t+=3,s(),m(","),!0;return!1}function y(){if(e[t]==="{"){if(n+="{",t++,s(),m(","))s();let T=!0;while(t<e.length&&e[t]!=="}"){let C;if(!T){if(C=p(","),!C)n=ce(n,",");s()}else C=!0;if(g(),!(k()||J(!0))){if(e[t]==="}"||e[t]==="{"||e[t]==="]"||e[t]==="["||e[t]===void 0){if(!T)n=tt(n,",")}else hp();break}s();let he=p(":"),Be=t>=e.length;if(!he)if(Oo(e[t])||Be)n=ce(n,":");else bi();if(!i())if(he||Be)n+="null";else bi();T=!1}if(e[t]==="}")n+="}",t++;else n=ce(n,"}");return!0}return!1}function S(){if(e[t]==="["){if(n+="[",t++,s(),m(","))s();let T=!0;while(t<e.length&&e[t]!=="]"){if(!T){if(!p(","))n=ce(n,",")}if(g(),!i()){if(!T)n=tt(n,",");break}T=!1}if(e[t]==="]")n+="]",t++;else n=ce(n,"]");return!0}return!1}function v(){let T=!0,C=!0;while(C){if(!T){if(!p(","))n=ce(n,",")}else T=!1;C=i()}if(!C)n=tt(n,",");n=`[
60
+ </file_content>`}function bg(e,t="act"){return`<user_input mode="${t}">${e}</user_input>`}function xg(e,t){return`<user_command slash="${t}">${e}</user_command>`}var Sg=/<user_input\b[^>]*\bmode="(act|plan|yolo)"/;function _g(e){let t=Sg.exec(e??"");return t?t[1]:void 0}function vg(e,t){return`<mode_notice>The user switched from ${e} mode to ${t} mode before sending this message.</mode_notice>`}function Tg(){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 Cg(e,t){let n=e.trim(),o=new RegExp(`^<${t}\\b([^>]*)>([\\s\\S]*?)<\\/${t}>$`,"i").exec(n);if(!o)return;return{attrs:o[1]??"",content:o[2]??""}}function kg(e,t){return new RegExp(`${t}="([^"]+)"`,"i").exec(e)?.[1]?.trim()||void 0}function xl(e){if(!e?.trim())return;let t=Cg(e,"user_command");if(!t)return;let n=kg(t.attrs,"slash");if(!n)return;return{slash:n,content:t.content.trim()}}function Sl(e){if(!e?.trim())return"";let t=e.trim();for(let n of["user_input","user_command"]){let o=kl(t,n);t=(o!==t?o:t.replace(new RegExp(`<${n}[^>]*>`,"g"),"")).trim()}return t}function _l(e){if(!e?.trim())return"";return Eg(e,"mode_notice").trim()}function Eg(e,t){let n=`<${t}>`,o=`</${t}>`,r=e,i=r.indexOf(n);while(i!==-1){let s=r.indexOf(o,i+n.length);if(s===-1)break;r=r.slice(0,i)+r.slice(s+o.length),i=r.indexOf(n,i)}return r}function br(e){let t=_l(Sl(e)),n=xl(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 vl=240,Tl=480;function Cl(e,t){let n=e.replace(/\s+/gu," ").trim();if(n.length<=t)return n;return`${n.slice(0,t-1).trimEnd()}…`}function Rg(e){return Cl(br(e),vl)}function Ag(e,t){let n=t?.trim()??"",o=e.toLowerCase(),r=o==="user"||o==="session"?br(n):n;return Cl(r,Tl)}function kl(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 We="[media omitted: invalid or exceeds size limit]",Je="[Image attached — this model cannot view images]",El=I(["image","audio","video","file"]),Rl=ar("type",[b({type:V("base64"),data:u().min(1)}),b({type:V("url"),url:u().url().refine((e)=>{let t=new URL(e).protocol;return t==="http:"||t==="https:"},"Generated media URLs must use HTTP or HTTPS")}),b({type:V("artifact"),artifactId:u().min(1)})]);function Al(e){if(e.startsWith("image/"))return"image";if(e.startsWith("audio/"))return"audio";if(e.startsWith("video/"))return"video";return"file"}var Il=b({id:u().min(1),modality:El,mediaType:u().min(1),source:Rl,name:u().min(1).optional(),sizeBytes:x().int().nonnegative().optional()}).refine((e)=>Al(e.mediaType)===e.modality,{message:"Generated media modality must match its media type",path:["modality"]});function Ig(e){return Il.safeParse(e).success}function wg(e){return Al(e)}var _n=["image/png","image/jpeg","image/gif","image/webp"],xr=5242880,fe=xr,Se=6291456,wl=8388608;function Pg(e){return e.length}function Sr(e){let t=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.floor(e.length*3/4)-t}function Mg(e=xr){return Math.floor(e*3/4)}function _r(e){return Math.ceil(e/3)*4}function vr(e={}){return{maxImageEncodedBytes:e.maxImageEncodedBytes??fe,maxImageDecodedBytes:e.maxImageDecodedBytes??Se,maxTotalMediaBytes:e.maxTotalMediaBytes??wl}}function vn(){return{totalEncodedBytes:0,keptImages:0,omittedImages:0,omittedReasons:{}}}function Sn(e,t){e.omittedImages+=1,e.omittedReasons[t]=(e.omittedReasons[t]??0)+1}function wt(e,t,n,o){let r=vr(n);if(e>r.maxImageEncodedBytes){let i={ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${r.maxImageEncodedBytes} byte encoded limit`};return Sn(o,i.reason),i}if(t>r.maxImageDecodedBytes){let i={ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${r.maxImageDecodedBytes} byte decoded limit`};return Sn(o,i.reason),i}if(o.totalEncodedBytes+e>r.maxTotalMediaBytes){let i={ok:!1,reason:"total_limit",message:`Image media exceeds the ${r.maxTotalMediaBytes} byte total media limit`};return Sn(o,i.reason),i}return o.totalEncodedBytes+=e,o.keptImages+=1,null}function Pl(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===47}function Og(e){return e.length>0&&Tr(e,0,e.length)}function zg(e,t,n){let o=Ml(e),r=o.end-o.start;if(r===0)return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let i=vr(t);if(n.totalEncodedBytes+r>i.maxTotalMediaBytes)return{ok:!1,reason:"total_limit",message:`Generated media exceeds the ${i.maxTotalMediaBytes} byte total media limit`};if(!Tr(e,o.start,o.end))return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let s=e.slice(o.start,o.end);return n.totalEncodedBytes+=r,{ok:!0,base64:s,encodedBytes:r,decodedBytes:Sr(s)}}function Tr(e,t,n){let o=n-t;if(o%4!==0)return!1;let r=n;if(o>=2&&e.charCodeAt(n-2)===61&&e.charCodeAt(n-1)===61)r-=2;else if(o>=1&&e.charCodeAt(n-1)===61)r-=1;for(let i=t;i<r;i++)if(!Pl(e.charCodeAt(i)))return!1;for(let i=r;i<n;i++)if(e.charCodeAt(i)!==61)return!1;return!0}function Ng(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 Ml(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 $g(e,t,n){if(!Ng(e,t,n))return;let o=t+5,r=e.indexOf(",",o);if(r===-1||r>=n)return;if(r-o>128)return;let i=e.slice(o,r).toLowerCase(),s=";base64";if(!i.endsWith(s))return;let a=i.slice(0,-s.length);if(!a||a.includes(";"))return;return{mediaType:a,base64Start:r+1,base64End:n}}function Ol(e,t,n={}){let o=n.maxEncodedBytes??fe,r=n.maxDecodedBytes??Se,i=new Set(n.supportedMediaTypes??_n),s=e?.toLowerCase(),a=Ml(t),{start:c,end:l}=a,d=$g(t,a.start,a.end);if(d){if(s&&s!==d.mediaType)return{ok:!1,reason:"media_type_mismatch",message:`Image media type ${e} does not match data URL type ${d.mediaType}`};s=d.mediaType,c=d.base64Start,l=d.base64End}if(!s||!i.has(s))return{ok:!1,reason:"unsupported_media_type",message:`Unsupported image media type: ${e??"unknown"}`};let p=l-c;if(p===0)return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};if(p>o)return{ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${o} byte encoded limit`};if(!Tr(t,c,l))return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};let m=t.slice(c,l),f=Sr(m);if(f>r)return{ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${r} byte decoded limit`};return{ok:!0,mediaType:s,base64:m,encodedBytes:p,decodedBytes:f}}function Pt(e,t,n,o){let r=Ol(e,t,{maxEncodedBytes:n.maxImageEncodedBytes,maxDecodedBytes:n.maxImageDecodedBytes});if(!r.ok)return Sn(o,r.reason),r;let i=wt(r.encodedBytes,r.decodedBytes,n,o);if(i)return i;return r}function ae(e){return e.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"�")}var Mt="ERROR: EMPTY CONTENT",Lg="[image attached]",Dg="[generated image]";function Bg(e){return`[generated ${e}]`}function Tn(e){return{type:"text",text:`[generated ${e.modality} unavailable to this model]`}}function Cr(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 Ug(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 Le(){return{type:"text",text:We}}function zl(e){return wt(fe,0,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},e)===null}function $l(e){try{return new URL(e).protocol}catch{return}}function kr(e,t){let n=Pt(e.mediaType,e.data,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},t);if(!n.ok)return Le();return Ll(n.base64,n.mediaType)}function Ll(e,t){return{type:"file",data:{type:"data",data:e},mediaType:t}}function Ye(e,t){return{type:"file",data:e,mediaType:t??"image"}}function Er(e,t){if(e.image instanceof URL){if(e.image.protocol==="data:"){let s=Pt(e.mediaType,e.image.href,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},t);if(!s.ok)return Le();return Ye(`data:${s.mediaType};base64,${s.base64}`,s.mediaType)}if(e.image.protocol!=="http:"&&e.image.protocol!=="https:")return Le();if(!zl(t))return Le();return Ye(e.image,e.mediaType)}if(typeof e.image==="string"){let s=$l(e.image);if(s==="http:"||s==="https:"){if(!zl(t))return Le();return Ye(e.image,e.mediaType)}let a=s==="data:",c=Pt(e.mediaType??(a?void 0:"image/png"),e.image,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},t);if(!c.ok)return Le();return Ye(a?`data:${c.mediaType};base64,${c.base64}`:c.base64,c.mediaType)}let n=e.image.byteLength,o=_r(n),r=e.mediaType?.toLowerCase()??"image/png";if(!_n.includes(r)||wt(o,n,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},t))return Le();return Ye(e.image,r)}function Zg(e,t){if(!t)return!0;if(e.modality==="file")return e.mediaType==="application/pdf"&&t.includes("pdf");return t.includes(e.modality)}function Nl(e,t,n){if(!Zg(e,n))return Tn(e);if(e.modality==="image"){if(e.source.type==="artifact")return Tn(e);return Er({type:"image",image:e.source.type==="url"?e.source.url:e.source.data,mediaType:e.mediaType},t)}if(e.source.type==="artifact")return Tn(e);if(e.source.type==="url"){let o=$l(e.source.url);if(o!=="http:"&&o!=="https:"&&o!=="data:")return Tn(e)}return Ye(e.source.type==="url"?e.source.url:e.source.data,e.mediaType)}function Rr(e,t,n,o){let{hoistImages:r,inlineImagePlaceholder:i}=o;if(e==null||typeof e!=="object")return{value:e,changed:!1,mediaChanged:!1};if(Array.isArray(e)){let d=[],p=!1,m=!1;for(let f of e){if(f&&typeof f==="object"){let y=f;if(y.type==="image"&&typeof y.data==="string"&&typeof y.mediaType==="string"){if(!r){d.push(i),p=!0,m=!0;continue}let S={type:"image",data:y.data,mediaType:y.mediaType},v=kr(S,n);if(v.type==="file")t.push({type:"image",data:v.data.data,mediaType:v.mediaType});else d.push(v.text);p=!0,m=!0;continue}if(y.type==="image"){d.push(We),p=!0,m=!0;continue}if(y.type==="text"&&typeof y.text==="string"){d.push(y.text),p=!0;continue}}let g=Rr(f,t,n,o);d.push(g.value),p||=g.changed,m||=g.mediaChanged}return{value:p?d:e,changed:p,mediaChanged:m}}let s=e;if(s.type==="image"){if(typeof s.data==="string"&&typeof s.mediaType==="string"){if(!r)return{value:i,changed:!0,mediaChanged:!0};let d={type:"image",data:s.data,mediaType:s.mediaType},p=kr(d,n);if(p.type==="file")return t.push({type:"image",data:p.data.data,mediaType:p.mediaType}),{value:Lg,changed:!0,mediaChanged:!0};return{value:p.text,changed:!0,mediaChanged:!0}}return{value:We,changed:!0,mediaChanged:!0}}let a={},c=!1,l=!1;for(let[d,p]of Object.entries(s)){let m=Rr(p,t,n,o);a[d]=m.value,c||=m.changed,l||=m.mediaChanged}return{value:c?a:e,changed:c,mediaChanged:l}}function Ot(e){if(typeof e==="string")return ae(e);if(Array.isArray(e))return e.map((t)=>Ot(t));if(e!==null&&typeof e==="object"){let t=e,n={};for(let[o,r]of Object.entries(t))n[o]=Ot(r);return n}return e}function Dl(e,t=!1,n=vn(),o){let r=o?.supportsImages??!0;if(typeof e==="string")return{type:t?"error-text":"text",value:ae(e)};if(!t&&Ug(e))return{type:"content",value:e.map((i)=>i.type==="image"?r?kr(i,n):{type:"text",text:Je}:{type:"text",text:ae(i.text)})};if(e!==null&&typeof e==="object"){let i=[],s=Rr(e,i,n,{hoistImages:!t&&r,inlineImagePlaceholder:r?We:Je});if(!t&&i.length>0)return{type:"content",value:[{type:"text",text:typeof s.value==="string"?ae(s.value):JSON.stringify(Ot(s.value))},...i.map((c)=>Ll(c.data,c.mediaType))]};if(s.mediaChanged)return{type:t?"error-json":"json",value:Ot(s.value)}}if(e===null||typeof e==="boolean"||typeof e==="number"||typeof e==="object")return{type:t?"error-json":"json",value:Ot(e)};return{type:t?"error-text":"text",value:ae(String(e))}}function Fg(e,t,n){let o=n?.assistantToolCallArgKey??"input",r=n?.supportedInputModalities,i=!r||r.includes("image"),s=[],a=vn(),c=[],l=()=>c.splice(0).map((p)=>p.type==="image"?i?Er(p,a):{type:"text",text:Je}:Nl(p.media,a,r));if(typeof e==="string"&&e.trim().length>0||Array.isArray(e)&&e.length>0)s.push({role:"system",content:typeof e==="string"?ae(e):e});for(let d of t){let p=d.content;if(typeof p==="string"){let y=d.role==="user"&&c.length>0?l():[];if(y.length>0){s.push({role:d.role,content:[{type:"text",text:p.trim().length>0?ae(p):Mt},...y]});continue}if(p.trim().length===0){s.push({role:d.role,content:[{type:"text",text:Mt}]});continue}s.push({role:d.role,content:ae(p)});continue}let m=[],f=[];if(p.length===0){s.push({role:d.role,content:[{type:"text",text:Mt}]});continue}for(let y of p)switch(y.type){case"text":m.push({type:"text",text:ae(y.text),...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"reasoning":m.push({type:"reasoning",text:ae(y.text),...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"image":if(d.role==="assistant")c.push(y),m.push({type:"text",text:Dg});else m.push(i?Er(y,a):{type:"text",text:Je});break;case"media":if(d.role==="assistant")c.push(y),m.push({type:"text",text:Bg(y.media.modality)});else m.push(Nl(y.media,a,r));break;case"file":m.push({type:"text",text:yr(y.path,ae(y.content))});break;case"tool-call":if(d.role==="assistant")m.push({type:"tool-call",toolCallId:y.toolCallId,toolName:y.toolName,[o]:y.input,...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"tool-result":{f.push({type:"tool-result",toolCallId:y.toolCallId,toolName:y.toolName,output:Dl(y.output,y.isError??!1,a,{supportsImages:i})});break}}let g=f.length>0;if(d.role==="user"&&!g&&c.length>0)m.push(...l());if(m.length>0&&m.every((y)=>y.type==="text"&&typeof y.text==="string"&&y.text.trim().length===0))m.splice(0,m.length,{type:"text",text:Mt});if(m.length>0)Cr(s,{role:d.role,content:m});if(g)Cr(s,{role:"tool",content:f})}if(c.length>0)Cr(s,{role:"user",content:l()});return s}var Gv=["show","hide","subscription"];function Bl(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Hg(e,t){if(!e&&!t)return;let n=e?.metadata,o=t?.metadata,r={...e??{},...t??{}};if(Bl(n)&&Bl(o))r.metadata={...n,...o};return r}var Jv=["web_search","image_generation"],Yv=["web_search"];var zt={max:1,xhigh:0.95,high:0.8,medium:0.5,low:0.2,minimal:0.1,none:0},jg=void 0;function Vg(e,t){if(typeof e==="string"&&e.toLowerCase()in zt)return e.toLowerCase();return t?void 0:void 0}function Ul(e,t){let n=typeof e==="string"?e.toLowerCase():void 0;if(n&&n in zt)return zt[n];if(t?.fallbackEffort)return zt[t.fallbackEffort];return}function qg(e){let t=Ul(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 o=e.scaleTokens??e.maxBudget;return Math.min(Math.max(Math.floor(o*t),n),e.maxBudget)}function Gg(e){return e instanceof Error?{name:e.name,message:e.message}:e}var Kg=3;function Zl(e){return Math.max(1,Math.ceil(e/3))}function Ar(e){let t=new WeakSet;try{return JSON.stringify(e,(n,o)=>{if(typeof o==="bigint")return o.toString();if(typeof o!=="object"||o===null)return o;if(t.has(o))return"[Circular]";return t.add(o),o})??""}catch{return String(e??"")}}function Wg(e){let t;try{t=JSON.stringify({systemPrompt:e.systemPrompt,messages:e.messages,tools:e.tools})}catch{t=[Ar(e.systemPrompt),Ar(e.messages),Ar(e.tools)].join(`
61
+ `)}return Zl(t.length)}var Jg={debug:()=>{},log:()=>{},error:()=>{}};var oT=60,rT=1,iT=3600;function Yg(e){return typeof e==="number"&&Number.isFinite(e)}function Xg(e){return Math.min(Math.max(e,1),3600)}function sT(e){if(!Yg(e))return 60;return Xg(e)}function aT(e,t,n){let o=n?` (${n})`:"",r=Math.round(t/100)/10;return`MCP request to "${e}"${o} timed out after ${r}s. Increase the "timeout" field (in seconds) for this server in cline_mcp_settings.json.`}function Qg(e){if(e instanceof Error)return e.message;return String(e)}function eh(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return""}class Ie extends Error{constructor(e,t){super(`${e} at position ${t}`);this.position=t}}function Fl(e){return/^[0-9A-Fa-f]$/.test(e)}function ve(e){return e>="0"&&e<="9"}function Hl(e){return e>=" "}function Qe(e){return`,:[]/{}()
62
+ +`.includes(e)}function Ir(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"||e==="$"}function Cn(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"||e==="$"||e>="0"&&e<="9"}var wr=/^(http|https|ftp|mailto|file|data|irc):\/\/$/,Pr=/^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;function Mr(e){return`,[]/{}
63
+ +`.includes(e)}function Or(e){return et(e)||th.test(e)}var th=/^[[{\w-]$/;function zr(e){return e===`
64
+ `||e==="\r"||e==="\t"||e==="\b"||e==="\f"}function _e(e,t){let n=e.charCodeAt(t);return n===32||n===10||n===9||n===13}function jl(e,t){let n=e.charCodeAt(t);return n===32||n===9||n===13}function Vl(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 et(e){return Nr(e)||kn(e)}function Nr(e){return e==='"'||e==="“"||e==="”"}function $r(e){return e==='"'}function kn(e){return e==="'"||e==="‘"||e==="’"||e==="`"||e==="´"}function Lr(e){return e==="'"}function tt(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o=e.lastIndexOf(t);return o!==-1?e.substring(0,o)+(n?"":e.substring(o+1)):e}function ce(e,t){let n=e.length;if(!_e(e,n-1))return e+t;while(_e(e,n-1))n--;return e.substring(0,n)+t+e.substring(n)}function ql(e,t,n){return e.substring(0,t)+e.substring(t+n)}function Gl(e){return/[,\n][ \t\r]*$/.test(e)}var nh={"&quot;":'"',"&amp;":"&","&lt;":"<","&gt;":">","&apos;":"'"},Dr=12;function Br(e){if(e.charAt(0)!=="&")return null;let t=e.indexOf(";");if(t===-1)return null;let n=e.substring(0,t+1),o=nh[n];if(o!==void 0)return{char:o,length:n.length};if(e.charAt(1)==="#"){let r=e.substring(2,t),i=r.charAt(0)==="x"||r.charAt(0)==="X",s=i?r.substring(1):r;if(s.length>0){let a=Number.parseInt(s,i?16:10);if(!Number.isNaN(a)&&a>=0&&a<=1114111)return{char:String.fromCodePoint(a),length:n.length}}}return null}function Kl(e){return e!==null&&e.char==='"'}function Wl(e){return e!==null&&e.char==="'"}function Xe(e,t){let n=0;for(let o=0;o<e.length;o++)if(e.charAt(o)===t)n++;return n}function Jl(e,t){switch(t){case")":return Xe(e,"(")>Xe(e,")");case"]":return Xe(e,"[")>Xe(e,"]");case"}":return Xe(e,"{")>Xe(e,"}");default:return!1}}var Yl={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},oh={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
65
+ `,r:"\r",t:"\t"};function Ur(e){let t=0,n="";if(l(["```","[```","{```"]),!i())gp();l(["```","```]","```}"]);let r=p(",");if(r)s();if(Or(e[t])&&Gl(n)){if(!r)n=ce(n,",");v()}else if(r)n=tt(n,",");while(e[t]==="}"||e[t]==="]")t++,s();if(t>=e.length)return n;lt();function i(){s();let T=y()||S()||k()||R()||B()||J(!1)||Te();return s(),T}function s(){let T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,C=t,O=a(T);do if(O=c(),O)O=a(T);while(O);return t>C}function a(T){let C=T?_e:jl,O="";while(!0)if(C(e,t))O+=e[t],t++;else if(Vl(e,t))O+=" ",t++;else break;if(O.length>0)return n+=O,!0;return!1}function c(){if(e[t]==="/"&&e[t+1]==="*"){while(t<e.length&&!rh(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(T){if(d(T)){if(Ir(e[t]))while(t<e.length&&Cn(e[t]))t++;return s(),!0}return!1}function d(T){a(!0);for(let C of T){let O=t+C.length;if(e.slice(t,O)===C)return t=O,!0}return!1}function p(T){if(e[t]===T)return n+=e[t],t++,!0;return!1}function m(T){if(e[t]===T)return t++,!0;return!1}function f(){return m("\\")}function g(){if(s(),e[t]==="."&&e[t+1]==="."&&e[t+2]===".")return t+=3,s(),m(","),!0;return!1}function y(){if(e[t]==="{"){if(n+="{",t++,s(),m(","))s();let T=!0;while(t<e.length&&e[t]!=="}"){let C;if(!T){if(C=p(","),!C)n=ce(n,",");s()}else C=!0;if(g(),!(k()||J(!0))){if(e[t]==="}"||e[t]==="{"||e[t]==="]"||e[t]==="["||e[t]===void 0){if(!T)n=tt(n,",")}else hp();break}s();let he=p(":"),Be=t>=e.length;if(!he)if(Or(e[t])||Be)n=ce(n,":");else bi();if(!i())if(he||Be)n+="null";else bi();T=!1}if(e[t]==="}")n+="}",t++;else n=ce(n,"}");return!0}return!1}function S(){if(e[t]==="["){if(n+="[",t++,s(),m(","))s();let T=!0;while(t<e.length&&e[t]!=="]"){if(!T){if(!p(","))n=ce(n,",")}if(g(),!i()){if(!T)n=tt(n,",");break}T=!1}if(e[t]==="]")n+="]",t++;else n=ce(n,"]");return!0}return!1}function v(){let T=!0,C=!0;while(C){if(!T){if(!p(","))n=ce(n,",")}else T=!1;C=i()}if(!C)n=tt(n,",");n=`[
67
67
  ${n}
68
- ]`}function k(){let T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,O=e[t]==="\\";if(O){if(t++,!et(e[t]))lt()}let he=e[t]==="&"?Bo(e.slice(t,t+Do)):null,Be=Kl(he)||Wl(he);if(et(e[t])||Be){let xi=$o(e[t])?$o:Lo(e[t])?Lo:kn(e[t])?kn:No,Lt=t,Dt=n.length,L='"';t+=Be&&he?he.length:1;while(!0){if(t>=e.length){let H=Me(t-1);if(!T&&Qe(e.charAt(H)))return t=Lt,n=n.substring(0,Dt),k(!0);return L=ce(L,'"'),n+=L,!0}if(t===C)return L=ce(L,'"'),n+=L,!0;let ye=Be&&e[t]==="&"?Bo(e.slice(t,t+Do)):null;if(ye&&he?ye.char===he.char:xi(e[t])){let H=t,zn=L.length;if(L+='"',t+=ye?ye.length:1,n+=L,s(!1),T||t>=e.length||Qe(e[t])&&!Jl(L,e[t])||et(e[t])&&!ct(t)||ve(e[t]))return M(),!0;if(e[t]==="\\")lt();let Ce=Me(H-1),Si=e.charAt(Ce);if(Si===",")return t=Lt,n=n.substring(0,Dt),k(!1,Ce);if(Qe(Si))return t=Lt,n=n.substring(0,Dt),k(!0);n=n.substring(0,Dt),t=H+(ye?ye.length:1),L=`${L.substring(0,zn)}\\${L.substring(zn)}`}else if(T&&Mo(e[t])){if(e[t-1]===":"&&Io.test(e.substring(Lt+1,t+2)))while(t<e.length&&Po.test(e[t]))L+=e[t],t++;return L=ce(L,'"'),n+=L,M(),!0}else if(ye){let H=ye.char;if(H==='"')L+="\\\"";else if(zo(H))L+=Yl[H];else L+=H;t+=ye.length}else if(e[t]==="\\"){let H=e.charAt(t+1);if(rh[H]!==void 0)L+=e.slice(t,t+2),t+=2;else if(H==="u"){let Ce=2;while(Ce<6&&Fl(e[t+Ce]))Ce++;if(Ce===6)L+=e.slice(t,t+6),t+=6;else if(t+Ce>=e.length)t=e.length;else yp()}else if(H===`
69
- `)L+="\\n",t+=2;else L+=H,t+=2}else{let H=e.charAt(t);if(H==='"'&&e[t-1]!=="\\")L+=`\\${H}`,t++;else if(zo(H))L+=Yl[H],t++;else{if(!Hl(H))On(H);L+=H,t++}}if(O)f()}}return!1}function M(){let T=!1;s();while(e[t]==="+"){T=!0,t++,s(),n=tt(n,'"',!0);let C=n.length;if(k())n=ql(n,C,1);else n=ce(n,'"')}return T}function R(){let T=t,C="",O=!1;if(e[t]==="-"){if(C+=e[t],t++,!ve(e[t])&&ut())C+="0"}if(e[t]==="0"&&ve(e[t+1]))O=!0;while(ve(e[t]))C+=e[t],t++;if(e[t]==="."){if(C===""||C==="-")C+="0";if(C+=e[t],t++,!ve(e[t]))C+="0";while(ve(e[t]))C+=e[t],t++}if(t>T){if(e[t]==="e"||e[t]==="E"){if(C==="-")O=!0;if(C+=e[t],t++,e[t]==="-"||e[t]==="+")C+=e[t],t++;if(!ve(e[t]))C+="0";while(ve(e[t]))C+=e[t],t++}if(!ut())return t=T,!1;return n+=O?`"${e.substring(T,t)}"`:C,!0}return!1}function B(){return A("true","true")||A("false","false")||A("null","null")||A("True","true")||A("False","false")||A("None","null")}function A(T,C){if(e.slice(t,t+T.length)===T&&!Cn(e[t+T.length]))return n+=C,t+=T.length,!0;return!1}function J(T){let C=t;if(wo(e[t])){while(t<e.length&&Cn(e[t]))t++;let O=t;while(_e(e,O))O++;if(e[O]==="("){if(t=O+1,i(),e[t]===")"){if(t++,e[t]===";")t++}return!0}}while(t<e.length&&!Mo(e[t])&&!et(e[t])&&(!T||e[t]!==":"))t++;if(e[t-1]===":"&&Io.test(e.substring(C,t+2)))while(t<e.length&&Po.test(e[t]))t++;if(t>C){while(_e(e,t-1)&&t>0)t--;let O=e.slice(C,t);if(n+=O==="undefined"?"null":JSON.stringify(O),e[t]==='"')t++;return!0}}function Te(){if(e[t]==="/"){let T=t;t++;while(t<e.length&&(e[t]!=="/"||e[t-1]==="\\"))t++;return t++,n+=JSON.stringify(e.substring(T,t)),!0}}function Me(T){let C=T;while(C>0&&_e(e,C))C--;return C}function ct(T){let C=T+1;while(C<e.length&&_e(e,C))C++;return C>=e.length||Qe(e[C])}function ut(){return t>=e.length||Qe(e[t])||_e(e,t)}function On(T){throw new we(`Invalid character ${JSON.stringify(T)}`,t)}function lt(){throw new we(`Unexpected character ${JSON.stringify(e[t])}`,t)}function gp(){throw new we("Unexpected end of json string",e.length)}function hp(){throw new we("Object key expected",t)}function bi(){throw new we("Colon expected",t)}function yp(){let T=e.slice(t,t+6);throw new we(`Invalid unicode character "${T}"`,t)}}function oh(e,t){return e[t]==="*"&&e[t+1]==="/"}function ih(e){let t=!1,n=!1,r=!1;for(let o=0;o<e.length;o+=1){let i=e[o];if(r){r=!1;continue}if(i==="\\"){r=!0;continue}if(!n&&i==='"')t=!t;else if(!t&&i==="'")n=!n}return t||n}var sh=/^\{\s*"([A-Za-z0-9_.$-]+)"\s*:\s*([\s\S]+?)\s*\}$/;function ah(e){let t=e.match(sh);if(!t)return;let[,n,r]=t,o=r.trim();if(!o)return;let i=o[0];if(i==='"'||i==="{"||i==="["||o==="true"||o==="false"||o==="null"||Number.isFinite(Number(o)))return;return JSON.parse(`{"${n}":${JSON.stringify(o)}}`)}function ch(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(!ih(t))try{return JSON.parse(Uo(t))}catch{}return ah(t)??e}function uh(e){let t=new WeakSet;try{return JSON.stringify(e,(r,o)=>{if(typeof o==="bigint")return o.toString();if(o&&typeof o==="object"){if(t.has(o))return"[Circular]";t.add(o)}return o})??"null"}catch{return String(e)}}function lh(e){try{return JSON.parse(e)}catch{return}}function nt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function dh(e){let t=e.type;if(typeof t==="string")return[t];return Array.isArray(t)?t.filter((n)=>typeof n==="string"):[]}function Zo(e,t){if(dh(e).includes(t))return!0;for(let r of["anyOf","oneOf","allOf"]){let o=e[r];if(Array.isArray(o)&&o.some((i)=>nt(i)&&Zo(i,t)))return!0}return!1}function ph(e,t){if(typeof e!=="string")return e;let n=e.trim(),r=Zo(t,"array"),o=Zo(t,"object");if((!r||!n.startsWith("["))&&(!o||!n.startsWith("{")))return e;try{let i=JSON.parse(n);if(Array.isArray(i))return r?i:e;if(nt(i))return o?i:e;return e}catch{return e}}function Fo(e,t){let n=ph(e,t);if(Array.isArray(n)){let s=t.items;if(!nt(s))return n;let a=!1,c=n.map((l)=>{let d=Fo(l,s);return a||=d!==l,d});return a?c:n}if(!nt(n))return n;let r=t.properties;if(!nt(r))return n;let o=!1,i={...n};for(let[s,a]of Object.entries(r)){if(!(s in n)||!nt(a))continue;let c=Fo(n[s],a);if(c!==n[s])i[s]=c,o=!0}return o?i:n}function mh(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 fh(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 o=r.replace(/-/g,"+").replace(/_/g,"/"),i=o.padEnd(o.length+(4-o.length%4)%4,"="),s=mh(i);return s?JSON.parse(s):null}catch{return null}}function gh(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}import hh from"node:path";function yh(e){return e.split(hh.sep).join("/")}function Xl(e){let t=e.replaceAll("\\","/"),n=t.lastIndexOf("/");return(n>=0?t.slice(n+1):t).toLowerCase()}function bh(e){return e==="win32"?"powershell":"/bin/bash"}function Ho(e){let t=Xl(e);if(rt(e)!==void 0)return"powershell";if(t==="cmd"||t==="cmd.exe")return"cmd";if(t==="wsl"||t==="wsl.exe")return"wsl";return"posix"}var xh=new Set(["-nologo","-noninteractive","-noprofile"]),Sh="-noprofile";function _h(e,t){let n="";for(let r=0;r<e.length;r++){let o=e[r];if(o==="`"&&r+1<e.length){let i=e[r+1];if(i==="u"&&t==="core"&&e[r+2]==="{"){let s=e.indexOf("}",r+3),a=s>r+3?e.slice(r+3,s):"",c=Number.parseInt(a,16);if(a.length<=6&&/^[0-9a-fA-F]+$/.test(a)&&c<=1114111){n+=String.fromCodePoint(c),r=s;continue}}switch(i){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+=i}r++;continue}if(o==='"'&&e[r+1]==='"'){n+='"',r++;continue}n+=o}return n}function vh(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 rt(e){let t=Xl(e);if(t==="powershell"||t==="powershell.exe")return"windows";if(t==="pwsh"||t==="pwsh.exe")return"core";return}function Th(e,t){let n=vh(e);if(!n)return;let r=(n.quote==="'"?n.body.replaceAll("''","'"):_h(n.body,t)).trim();return r.length>0?r:void 0}function Ch(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],o=rt(t);if(!o||!rt(r))return;let i=n[4],s=!1;for(;;){let a=/^(-[^\s=]+)[ \t]*([\S\s]*)$/.exec(i);if(!a)return;let c=a[1].toLowerCase();if(c==="-command"){let l=s?Th(a[2],o):void 0;return l===void 0?void 0:{executable:r,script:l}}if(!xh.has(c))return;if(c===Sh)s=!0;i=a[2]}}function kh(e,t){if(!/[\\/:]/.test(t)&&rt(t)===rt(e))return e;return t}function Ql(e,t){switch(Ho(e)){case"powershell":{let n={executable:e,script:t};for(;;){let r=Ch(n.script,n.executable);if(!r)break;n={executable:kh(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 Eh(e,t){if(Ho(e)==="powershell")return["-NoProfile","-NonInteractive","-Command",t];return Ql(e,t).args}function Rh(e){return e.toLowerCase().replace(/[^\w.-]+/g,"_")}function Ah(e){let t=e?.trim();return t?t:void 0}function ed(e,t){if(e.length<=t)return e;return`${e.slice(0,t-1)}…`}function wh(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}…`:ed(e,n)}function Ih(e){if(e.length<=8)return"****";return`${e.slice(0,4)}...${e.slice(-4)}`}function Ph(e){return e.charCodeAt(0)===65279?e.slice(1):e}function Mh(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 Oh(e){let t=Math.max(0,Math.floor(e/1000)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),o=Math.floor(t%3600/60),i=t%60;if(n>0)return`${n}d ${r}h`;if(r>0)return`${r}h ${o}m`;if(o>0)return`${o}m ${i}s`;return`${i}s`}function zh(e,t){let n=e.safeParse(t);if(!n.success)throw Error(Fi(n.error));return n.data}function jo(e){return Su(e)}function Vo(e){return e==="cline"||e==="cline-pass"}var td=`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.
68
+ ]`}function k(){let T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,O=e[t]==="\\";if(O){if(t++,!et(e[t]))lt()}let he=e[t]==="&"?Br(e.slice(t,t+Dr)):null,Be=Kl(he)||Wl(he);if(et(e[t])||Be){let xi=$r(e[t])?$r:Lr(e[t])?Lr:kn(e[t])?kn:Nr,Lt=t,Dt=n.length,L='"';t+=Be&&he?he.length:1;while(!0){if(t>=e.length){let H=Me(t-1);if(!T&&Qe(e.charAt(H)))return t=Lt,n=n.substring(0,Dt),k(!0);return L=ce(L,'"'),n+=L,!0}if(t===C)return L=ce(L,'"'),n+=L,!0;let ye=Be&&e[t]==="&"?Br(e.slice(t,t+Dr)):null;if(ye&&he?ye.char===he.char:xi(e[t])){let H=t,zn=L.length;if(L+='"',t+=ye?ye.length:1,n+=L,s(!1),T||t>=e.length||Qe(e[t])&&!Jl(L,e[t])||et(e[t])&&!ct(t)||ve(e[t]))return M(),!0;if(e[t]==="\\")lt();let Ce=Me(H-1),Si=e.charAt(Ce);if(Si===",")return t=Lt,n=n.substring(0,Dt),k(!1,Ce);if(Qe(Si))return t=Lt,n=n.substring(0,Dt),k(!0);n=n.substring(0,Dt),t=H+(ye?ye.length:1),L=`${L.substring(0,zn)}\\${L.substring(zn)}`}else if(T&&Mr(e[t])){if(e[t-1]===":"&&wr.test(e.substring(Lt+1,t+2)))while(t<e.length&&Pr.test(e[t]))L+=e[t],t++;return L=ce(L,'"'),n+=L,M(),!0}else if(ye){let H=ye.char;if(H==='"')L+="\\\"";else if(zr(H))L+=Yl[H];else L+=H;t+=ye.length}else if(e[t]==="\\"){let H=e.charAt(t+1);if(oh[H]!==void 0)L+=e.slice(t,t+2),t+=2;else if(H==="u"){let Ce=2;while(Ce<6&&Fl(e[t+Ce]))Ce++;if(Ce===6)L+=e.slice(t,t+6),t+=6;else if(t+Ce>=e.length)t=e.length;else yp()}else if(H===`
69
+ `)L+="\\n",t+=2;else L+=H,t+=2}else{let H=e.charAt(t);if(H==='"'&&e[t-1]!=="\\")L+=`\\${H}`,t++;else if(zr(H))L+=Yl[H],t++;else{if(!Hl(H))On(H);L+=H,t++}}if(O)f()}}return!1}function M(){let T=!1;s();while(e[t]==="+"){T=!0,t++,s(),n=tt(n,'"',!0);let C=n.length;if(k())n=ql(n,C,1);else n=ce(n,'"')}return T}function R(){let T=t,C="",O=!1;if(e[t]==="-"){if(C+=e[t],t++,!ve(e[t])&&ut())C+="0"}if(e[t]==="0"&&ve(e[t+1]))O=!0;while(ve(e[t]))C+=e[t],t++;if(e[t]==="."){if(C===""||C==="-")C+="0";if(C+=e[t],t++,!ve(e[t]))C+="0";while(ve(e[t]))C+=e[t],t++}if(t>T){if(e[t]==="e"||e[t]==="E"){if(C==="-")O=!0;if(C+=e[t],t++,e[t]==="-"||e[t]==="+")C+=e[t],t++;if(!ve(e[t]))C+="0";while(ve(e[t]))C+=e[t],t++}if(!ut())return t=T,!1;return n+=O?`"${e.substring(T,t)}"`:C,!0}return!1}function B(){return A("true","true")||A("false","false")||A("null","null")||A("True","true")||A("False","false")||A("None","null")}function A(T,C){if(e.slice(t,t+T.length)===T&&!Cn(e[t+T.length]))return n+=C,t+=T.length,!0;return!1}function J(T){let C=t;if(Ir(e[t])){while(t<e.length&&Cn(e[t]))t++;let O=t;while(_e(e,O))O++;if(e[O]==="("){if(t=O+1,i(),e[t]===")"){if(t++,e[t]===";")t++}return!0}}while(t<e.length&&!Mr(e[t])&&!et(e[t])&&(!T||e[t]!==":"))t++;if(e[t-1]===":"&&wr.test(e.substring(C,t+2)))while(t<e.length&&Pr.test(e[t]))t++;if(t>C){while(_e(e,t-1)&&t>0)t--;let O=e.slice(C,t);if(n+=O==="undefined"?"null":JSON.stringify(O),e[t]==='"')t++;return!0}}function Te(){if(e[t]==="/"){let T=t;t++;while(t<e.length&&(e[t]!=="/"||e[t-1]==="\\"))t++;return t++,n+=JSON.stringify(e.substring(T,t)),!0}}function Me(T){let C=T;while(C>0&&_e(e,C))C--;return C}function ct(T){let C=T+1;while(C<e.length&&_e(e,C))C++;return C>=e.length||Qe(e[C])}function ut(){return t>=e.length||Qe(e[t])||_e(e,t)}function On(T){throw new Ie(`Invalid character ${JSON.stringify(T)}`,t)}function lt(){throw new Ie(`Unexpected character ${JSON.stringify(e[t])}`,t)}function gp(){throw new Ie("Unexpected end of json string",e.length)}function hp(){throw new Ie("Object key expected",t)}function bi(){throw new Ie("Colon expected",t)}function yp(){let T=e.slice(t,t+6);throw new Ie(`Invalid unicode character "${T}"`,t)}}function rh(e,t){return e[t]==="*"&&e[t+1]==="/"}function ih(e){let t=!1,n=!1,o=!1;for(let r=0;r<e.length;r+=1){let i=e[r];if(o){o=!1;continue}if(i==="\\"){o=!0;continue}if(!n&&i==='"')t=!t;else if(!t&&i==="'")n=!n}return t||n}var sh=/^\{\s*"([A-Za-z0-9_.$-]+)"\s*:\s*([\s\S]+?)\s*\}$/;function ah(e){let t=e.match(sh);if(!t)return;let[,n,o]=t,r=o.trim();if(!r)return;let i=r[0];if(i==='"'||i==="{"||i==="["||r==="true"||r==="false"||r==="null"||Number.isFinite(Number(r)))return;return JSON.parse(`{"${n}":${JSON.stringify(r)}}`)}function ch(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(!ih(t))try{return JSON.parse(Ur(t))}catch{}return ah(t)??e}function uh(e){let t=new WeakSet;try{return JSON.stringify(e,(o,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 lh(e){try{return JSON.parse(e)}catch{return}}function nt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function dh(e){let t=e.type;if(typeof t==="string")return[t];return Array.isArray(t)?t.filter((n)=>typeof n==="string"):[]}function Zr(e,t){if(dh(e).includes(t))return!0;for(let o of["anyOf","oneOf","allOf"]){let r=e[o];if(Array.isArray(r)&&r.some((i)=>nt(i)&&Zr(i,t)))return!0}return!1}function ph(e,t){if(typeof e!=="string")return e;let n=e.trim(),o=Zr(t,"array"),r=Zr(t,"object");if((!o||!n.startsWith("["))&&(!r||!n.startsWith("{")))return e;try{let i=JSON.parse(n);if(Array.isArray(i))return o?i:e;if(nt(i))return r?i:e;return e}catch{return e}}function Fr(e,t){let n=ph(e,t);if(Array.isArray(n)){let s=t.items;if(!nt(s))return n;let a=!1,c=n.map((l)=>{let d=Fr(l,s);return a||=d!==l,d});return a?c:n}if(!nt(n))return n;let o=t.properties;if(!nt(o))return n;let r=!1,i={...n};for(let[s,a]of Object.entries(o)){if(!(s in n)||!nt(a))continue;let c=Fr(n[s],a);if(c!==n[s])i[s]=c,r=!0}return r?i:n}function mh(e){if(typeof globalThis.atob==="function")try{let t=globalThis.atob(e),n=Uint8Array.from(t,(o)=>o.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 fh(e){let t=e?.trim();if(!t)return null;try{let n=t.split(".");if(n.length!==3)return null;let o=n[1];if(!o)return null;let r=o.replace(/-/g,"+").replace(/_/g,"/"),i=r.padEnd(r.length+(4-r.length%4)%4,"="),s=mh(i);return s?JSON.parse(s):null}catch{return null}}function gh(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}import hh from"node:path";function yh(e){return e.split(hh.sep).join("/")}function Xl(e){let t=e.replaceAll("\\","/"),n=t.lastIndexOf("/");return(n>=0?t.slice(n+1):t).toLowerCase()}function bh(e){return e==="win32"?"powershell":"/bin/bash"}function Hr(e){let t=Xl(e);if(ot(e)!==void 0)return"powershell";if(t==="cmd"||t==="cmd.exe")return"cmd";if(t==="wsl"||t==="wsl.exe")return"wsl";return"posix"}var xh=new Set(["-nologo","-noninteractive","-noprofile"]),Sh="-noprofile";function _h(e,t){let n="";for(let o=0;o<e.length;o++){let r=e[o];if(r==="`"&&o+1<e.length){let i=e[o+1];if(i==="u"&&t==="core"&&e[o+2]==="{"){let s=e.indexOf("}",o+3),a=s>o+3?e.slice(o+3,s):"",c=Number.parseInt(a,16);if(a.length<=6&&/^[0-9a-fA-F]+$/.test(a)&&c<=1114111){n+=String.fromCodePoint(c),o=s;continue}}switch(i){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+=i}o++;continue}if(r==='"'&&e[o+1]==='"'){n+='"',o++;continue}n+=r}return n}function vh(e){let t=e[0];if(t!=="'"&&t!=='"')return;for(let n=1;n<e.length;n++){let o=e[n];if(t==='"'&&o==="`"){n++;continue}if(o===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 ot(e){let t=Xl(e);if(t==="powershell"||t==="powershell.exe")return"windows";if(t==="pwsh"||t==="pwsh.exe")return"core";return}function Th(e,t){let n=vh(e);if(!n)return;let o=(n.quote==="'"?n.body.replaceAll("''","'"):_h(n.body,t)).trim();return o.length>0?o:void 0}function Ch(e,t){let n=/^[ \t]*(?:&[ \t]*(?:"([^"$`]*)"|'((?:[^']|'')*)')|(?:&[ \t]*)?([^\s$`"';&|<>(){}#@,]+))[ \t]+([\S\s]*)$/.exec(e);if(!n)return;let o=n[1]??n[2]?.replaceAll("''","'")??n[3],r=ot(t);if(!r||!ot(o))return;let i=n[4],s=!1;for(;;){let a=/^(-[^\s=]+)[ \t]*([\S\s]*)$/.exec(i);if(!a)return;let c=a[1].toLowerCase();if(c==="-command"){let l=s?Th(a[2],r):void 0;return l===void 0?void 0:{executable:o,script:l}}if(!xh.has(c))return;if(c===Sh)s=!0;i=a[2]}}function kh(e,t){if(!/[\\/:]/.test(t)&&ot(t)===ot(e))return e;return t}function Ql(e,t){switch(Hr(e)){case"powershell":{let n={executable:e,script:t};for(;;){let o=Ch(n.script,n.executable);if(!o)break;n={executable:kh(e,o.executable),script:o.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 Eh(e,t){if(Hr(e)==="powershell")return["-NoProfile","-NonInteractive","-Command",t];return Ql(e,t).args}function Rh(e){return e.toLowerCase().replace(/[^\w.-]+/g,"_")}function Ah(e){let t=e?.trim();return t?t:void 0}function ed(e,t){if(e.length<=t)return e;return`${e.slice(0,t-1)}…`}function Ih(e,t="/",n=100){if(!e||e.length<=n)return e||"";let o=e.split(t)?.shift()?.trim()?.slice(0,n-1);return o?`${o}…`:ed(e,n)}function wh(e){if(e.length<=8)return"****";return`${e.slice(0,4)}...${e.slice(-4)}`}function Ph(e){return e.charCodeAt(0)===65279?e.slice(1):e}function Mh(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 Oh(e){let t=Math.max(0,Math.floor(e/1000)),n=Math.floor(t/86400),o=Math.floor(t%86400/3600),r=Math.floor(t%3600/60),i=t%60;if(n>0)return`${n}d ${o}h`;if(o>0)return`${o}h ${r}m`;if(r>0)return`${r}m ${i}s`;return`${i}s`}function zh(e,t){let n=e.safeParse(t);if(!n.success)throw Error(Fi(n.error));return n.data}function jr(e){return Su(e)}function Vr(e){return e==="cline"||e==="cline-pass"}var td=`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
71
 
72
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
73
  Review each question carefully and answer it with detailed, accurate information.
@@ -141,7 +141,7 @@ IMPORTANT:
141
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
142
  - Response without the submit_and_exit tool call will considered not completed and the task will continue.
143
143
  {{CLINE_RULES}}
144
- {{CLINE_METADATA}}`;var qo={ACT:td,YOLO:nd};var Go="# Workspace Configuration",od=`# Plan / Act Modes
144
+ {{CLINE_METADATA}}`;var qr={ACT:td,YOLO:nd};var Gr="# Workspace Configuration",rd=`# Plan / Act Modes
145
145
 
146
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.`,id=`# Plan Mode
147
147
 
@@ -158,33 +158,33 @@ The run_commands tool remains available in plan mode strictly for read-only insp
158
158
 
159
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.`,ad=`${id}
160
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 Nh(e){let t=e.indexOf("://");if(t<1)return e;let n=t+3,r=n;while(r<e.length){let i=e[r];if(i==="/"||i==="?"||i==="#"||i.charCodeAt(0)<=32)break;r++}let o=e.lastIndexOf("@",r-1);if(o<n)return e;return e.slice(0,n)+e.slice(o+1)}function $h(e){return JSON.stringify({workspaces:{[e.rootPath]:{hint:e.hint,associatedRemoteUrls:e.associatedRemoteUrls?.map(Nh),latestGitCommitHash:e.latestGitCommitHash,latestGitBranchName:e.latestGitBranchName}}},null,2)}function rd(e,t,n){if(n?.trim()?.includes(Go))return n.trim();let r=n||JSON.stringify({workspaces:{[e]:{hint:t||e.split("/").at(-1)||e}}},null,2);return`
162
- ${Go}
163
- ${r}`}function Lh(e){let{ide:t="Terminal Shell",mode:n,platform:r="unknown",workspaceName:o,metadata:i,rules:s,overridePrompt:a,providerId:c,planModeSwitchTool:l=!0}=e,d=e.workspaceRoot??e.rootPath??"",p=Vo(c||"");if(a?.trim()){let g=a.trim();if(p&&i?.trim()&&!g.includes(Go))return`${g}
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 Nh(e){let t=e.indexOf("://");if(t<1)return e;let n=t+3,o=n;while(o<e.length){let i=e[o];if(i==="/"||i==="?"||i==="#"||i.charCodeAt(0)<=32)break;o++}let r=e.lastIndexOf("@",o-1);if(r<n)return e;return e.slice(0,n)+e.slice(r+1)}function $h(e){return JSON.stringify({workspaces:{[e.rootPath]:{hint:e.hint,associatedRemoteUrls:e.associatedRemoteUrls?.map(Nh),latestGitCommitHash:e.latestGitCommitHash,latestGitBranchName:e.latestGitBranchName}}},null,2)}function od(e,t,n){if(n?.trim()?.includes(Gr))return n.trim();let o=n||JSON.stringify({workspaces:{[e]:{hint:t||e.split("/").at(-1)||e}}},null,2);return`
162
+ ${Gr}
163
+ ${o}`}function Lh(e){let{ide:t="Terminal Shell",mode:n,platform:o="unknown",workspaceName:r,metadata:i,rules:s,overridePrompt:a,providerId:c,planModeSwitchTool:l=!0}=e,d=e.workspaceRoot??e.rootPath??"",p=Vr(c||"");if(a?.trim()){let g=a.trim();if(p&&i?.trim()&&!g.includes(Gr))return`${g}
164
164
 
165
- ${rd(d,o,i)}`.trim();return g}let m=n==="yolo"?qo.YOLO:qo.ACT,f=[s,n==="yolo"?void 0:od,n==="plan"?l?sd:ad:void 0].filter(Boolean).join(`
165
+ ${od(d,r,i)}`.trim();return g}let m=n==="yolo"?qr.YOLO:qr.ACT,f=[s,n==="yolo"?void 0:rd,n==="plan"?l?sd:ad:void 0].filter(Boolean).join(`
166
166
 
167
- `);return m.replace("{{PLATFORM_NAME}}",r).replace("{{CWD}}",d).replace("{{CURRENT_DATE}}",new Date().toLocaleDateString()).replace("{{IDE_NAME}}",t).replace("{{CLINE_METADATA}}",p?rd(d,o,i):"").replace("{{CLINE_RULES}}",f).trim()}var Dh="anthropic/claude-sonnet-5";import ge from"node:fs/promises";import Ko from"node:path";async function Bh(e){try{return await ge.access(e),!0}catch{return!1}}class Wo{filePath;constructor(e){this.filePath=e}async read(){try{return JSON.parse(await ge.readFile(this.filePath,"utf8"))}catch(e){if(e.code==="ENOENT")return;throw e}}async write(e){await ge.mkdir(Ko.dirname(this.filePath),{recursive:!0}),await ge.writeFile(this.filePath,JSON.stringify(e,null,2),"utf8")}async clear(){await ge.rm(this.filePath,{force:!0})}}class En{async writeText(e,t){await ge.mkdir(Ko.dirname(e),{recursive:!0}),await ge.writeFile(e,t,"utf8")}async remove(e){await ge.rm(e,{recursive:!0,force:!0})}async removeChildren(e){if(!await Bh(e))return;let t=await ge.readdir(e);await Promise.all(t.map((n)=>ge.rm(Ko.join(e,n),{recursive:!0,force:!0})))}}import{createHmac as Hh}from"node:crypto";import{basename as jh}from"node:path";var Yo=new TextEncoder,Uh={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"},Zh=new Set(["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"]);class Rn{constructor({accessKeyId:e,secretAccessKey:t,sessionToken:n,service:r,region:o,cache:i,retries:s,initRetryMs:a}){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=o,this.cache=i||new Map,this.retries=s!=null?s:10,this.initRetryMs=a||50}async sign(e,t){if(e instanceof Request){let{method:o,url:i,headers:s,body:a}=e;if(t=Object.assign({method:o,url:i,headers:s},t),t.body==null&&s.has("Content-Type"))t.body=a!=null&&s.has("X-Amz-Content-Sha256")?a:await e.clone().arrayBuffer();e=i}let n=new dd(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(o){if(o instanceof TypeError)return new Request(r.url.toString(),Object.assign({duplex:"half"},r));throw o}}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 o=await r;if(o.status<500&&o.status!==429)return o;await new Promise((i)=>setTimeout(i,Math.random()*this.initRetryMs*Math.pow(2,n)))}throw Error("An unknown error occurred, ensure retries is not negative")}}class dd{constructor({method:e,url:t,headers:n,body:r,accessKeyId:o,secretAccessKey:i,sessionToken:s,service:a,region:c,cache:l,datetime:d,signQuery:p,appendSessionToken:m,allHeaders:f,singleEncode:g}){if(t==null)throw TypeError("url is a required option");if(o==null)throw TypeError("accessKeyId is a required option");if(i==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=o,this.secretAccessKey=i,this.sessionToken=s;let y,S;if(!a||!c)[y,S]=Fh(this.url,this.headers);if(this.service=a||y||"",this.region=c||S||"us-east-1",this.cache=l||new Map,this.datetime=d||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=p,this.appendSessionToken=m||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 v=this.signQuery?this.url.searchParams:this.headers;if(v.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken)v.set("X-Amz-Security-Token",this.sessionToken);if(this.signableHeaders=["host",...this.headers.keys()].filter((M)=>f||!Zh.has(M)).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map((M)=>M+":"+(M==="host"?this.url.host:(this.headers.get(M)||"").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"&&!v.has("X-Amz-Expires"))v.set("X-Amz-Expires","86400");v.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),v.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),v.set("X-Amz-SignedHeaders",this.signedHeaders)}if(this.service==="s3")try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch(M){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=ld(this.encodedPath);let k=new Set;this.encodedSearch=[...this.url.searchParams].filter(([M])=>{if(!M)return!1;if(this.service==="s3"){if(k.has(M))return!1;k.add(M)}return!0}).map((M)=>M.map((R)=>ld(encodeURIComponent(R)))).sort(([M,R],[B,A])=>M<B?-1:M>B?1:R<A?-1:R>A?1:0).map((M)=>M.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 Nt("AWS4"+this.secretAccessKey,e),o=await Nt(r,this.region),i=await Nt(o,this.service);n=await Nt(i,"aws4_request"),this.cache.set(t,n)}return Jo(await Nt(n,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,Jo(await cd(await this.canonicalString()))].join(`
167
+ `);return m.replace("{{PLATFORM_NAME}}",o).replace("{{CWD}}",d).replace("{{CURRENT_DATE}}",new Date().toLocaleDateString()).replace("{{IDE_NAME}}",t).replace("{{CLINE_METADATA}}",p?od(d,r,i):"").replace("{{CLINE_RULES}}",f).trim()}function Dh(e){let t=e?.metadata?.localCliCommand;if(typeof t!=="string"||!t.trim())return;return{command:t.trim(),docsUrl:e?.docsUrl}}var Bh="anthropic/claude-sonnet-5";import ge from"node:fs/promises";import Kr from"node:path";async function Uh(e){try{return await ge.access(e),!0}catch{return!1}}class Wr{filePath;constructor(e){this.filePath=e}async read(){try{return JSON.parse(await ge.readFile(this.filePath,"utf8"))}catch(e){if(e.code==="ENOENT")return;throw e}}async write(e){await ge.mkdir(Kr.dirname(this.filePath),{recursive:!0}),await ge.writeFile(this.filePath,JSON.stringify(e,null,2),"utf8")}async clear(){await ge.rm(this.filePath,{force:!0})}}class En{async writeText(e,t){await ge.mkdir(Kr.dirname(e),{recursive:!0}),await ge.writeFile(e,t,"utf8")}async remove(e){await ge.rm(e,{recursive:!0,force:!0})}async removeChildren(e){if(!await Uh(e))return;let t=await ge.readdir(e);await Promise.all(t.map((n)=>ge.rm(Kr.join(e,n),{recursive:!0,force:!0})))}}import{createHmac as jh}from"node:crypto";import{basename as Vh}from"node:path";var Yr=new TextEncoder,Zh={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"},Fh=new Set(["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"]);class Rn{constructor({accessKeyId:e,secretAccessKey:t,sessionToken:n,service:o,region:r,cache:i,retries:s,initRetryMs:a}){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=o,this.region=r,this.cache=i||new Map,this.retries=s!=null?s:10,this.initRetryMs=a||50}async sign(e,t){if(e instanceof Request){let{method:r,url:i,headers:s,body:a}=e;if(t=Object.assign({method:r,url:i,headers:s},t),t.body==null&&s.has("Content-Type"))t.body=a!=null&&s.has("X-Amz-Content-Sha256")?a:await e.clone().arrayBuffer();e=i}let n=new dd(Object.assign({url:e.toString()},t,this,t&&t.aws)),o=Object.assign({},t,await n.sign());delete o.aws;try{return new Request(o.url.toString(),o)}catch(r){if(r instanceof TypeError)return new Request(o.url.toString(),Object.assign({duplex:"half"},o));throw r}}async fetch(e,t){for(let n=0;n<=this.retries;n++){let o=fetch(await this.sign(e,t));if(n===this.retries)return o;let r=await o;if(r.status<500&&r.status!==429)return r;await new Promise((i)=>setTimeout(i,Math.random()*this.initRetryMs*Math.pow(2,n)))}throw Error("An unknown error occurred, ensure retries is not negative")}}class dd{constructor({method:e,url:t,headers:n,body:o,accessKeyId:r,secretAccessKey:i,sessionToken:s,service:a,region:c,cache:l,datetime:d,signQuery:p,appendSessionToken:m,allHeaders:f,singleEncode:g}){if(t==null)throw TypeError("url is a required option");if(r==null)throw TypeError("accessKeyId is a required option");if(i==null)throw TypeError("secretAccessKey is a required option");this.method=e||(o?"POST":"GET"),this.url=new URL(t),this.headers=new Headers(n||{}),this.body=o,this.accessKeyId=r,this.secretAccessKey=i,this.sessionToken=s;let y,S;if(!a||!c)[y,S]=Hh(this.url,this.headers);if(this.service=a||y||"",this.region=c||S||"us-east-1",this.cache=l||new Map,this.datetime=d||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=p,this.appendSessionToken=m||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 v=this.signQuery?this.url.searchParams:this.headers;if(v.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken)v.set("X-Amz-Security-Token",this.sessionToken);if(this.signableHeaders=["host",...this.headers.keys()].filter((M)=>f||!Fh.has(M)).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map((M)=>M+":"+(M==="host"?this.url.host:(this.headers.get(M)||"").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"&&!v.has("X-Amz-Expires"))v.set("X-Amz-Expires","86400");v.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),v.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),v.set("X-Amz-SignedHeaders",this.signedHeaders)}if(this.service==="s3")try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch(M){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=ld(this.encodedPath);let k=new Set;this.encodedSearch=[...this.url.searchParams].filter(([M])=>{if(!M)return!1;if(this.service==="s3"){if(k.has(M))return!1;k.add(M)}return!0}).map((M)=>M.map((R)=>ld(encodeURIComponent(R)))).sort(([M,R],[B,A])=>M<B?-1:M>B?1:R<A?-1:R>A?1:0).map((M)=>M.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 o=await Nt("AWS4"+this.secretAccessKey,e),r=await Nt(o,this.region),i=await Nt(r,this.service);n=await Nt(i,"aws4_request"),this.cache.set(t,n)}return Jr(await Nt(n,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,Jr(await cd(await this.canonicalString()))].join(`
169
169
  `)}async canonicalString(){return[this.method.toUpperCase(),this.encodedPath,this.encodedSearch,this.canonicalHeaders+`
170
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=Jo(await cd(this.body||""))}return e}}async function Nt(e,t){let n=await crypto.subtle.importKey("raw",typeof e==="string"?Yo.encode(e):e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return crypto.subtle.sign("HMAC",n,Yo.encode(t))}async function cd(e){return crypto.subtle.digest("SHA-256",typeof e==="string"?Yo.encode(e):e)}var ud=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function Jo(e){let t=new Uint8Array(e),n="";for(let r=0;r<t.length;r++){let o=t[r];n+=ud[o>>>4&15],n+=ud[o&15]}return n}function ld(e){return e.replace(/[!'()*]/g,(t)=>"%"+t.charCodeAt(0).toString(16).toUpperCase())}function Fh(e,t){let{hostname:n,pathname:r}=e;if(n.endsWith(".on.aws")){let a=n.match(/^[^.]{1,63}\.lambda-url\.([^.]{1,63})\.on\.aws$/);return a!=null?["lambda",a[1]||""]:["",""]}if(n.endsWith(".r2.cloudflarestorage.com"))return["s3","auto"];if(n.endsWith(".backblazeb2.com")){let a=n.match(/^(?:[^.]{1,63}\.)?s3\.([^.]{1,63})\.backblazeb2\.com$/);return a!=null?["s3",a[1]||""]:["",""]}let o=n.replace("dualstack.","").match(/([^.]{1,63})\.(?:([^.]{0,63})\.)?amazonaws\.com(?:\.cn)?$/),i=o&&o[1]||"",s=o&&o[2];if(s==="us-gov")s="us-gov-west-1";else if(s==="s3"||s==="s3-accelerate")s="us-east-1",i="s3";else if(i==="iot")if(n.startsWith("iot."))i="execute-api";else if(n.startsWith("data.jobs.iot."))i="iot-jobs-data";else i=r==="/mqtt"?"iotdevicegateway":"iotdata";else if(i==="autoscaling"){let a=(t.get("X-Amz-Target")||"").split(".")[0];if(a==="AnyScaleFrontendService")i="application-autoscaling";else if(a==="AnyScaleScalingPlannerFrontendService")i="autoscaling-plans"}else if(s==null&&i.startsWith("s3-"))s=i.slice(3).replace(/^fips-|^external-1/,""),i="s3";else if(i.endsWith("-fips"))i=i.slice(0,-5);else if(s&&/-\d$/.test(i)&&!/-\d$/.test(s))[i,s]=[s,i];return[Uh[i]||i,s||""]}var md="enterprise.blobUpload",An=new Map;function Xo(e,t){return{adapterType:e,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,region:t.region,bucket:t.bucket,endpoint:t.endpoint,accountId:t.accountId}}function fd(e){return{adapterType:e.adapterType,bucket:e.bucket,region:e.region,endpoint:e.endpoint,accountId:e.accountId}}function Vh(e){if(!e||e.enabled!==!0)return;if(e.type==="s3_access_keys"&&e.s3AccessSettings)return Xo("s3",e.s3AccessSettings);if(e.type==="r2_access_keys"&&e.r2AccessSettings)return Xo("r2",e.r2AccessSettings);if(e.type==="azure_access_keys"&&e.azureAccessSettings)return Xo("azure",e.azureAccessSettings);return}function gd(e){return Vh(e?.enterpriseTelemetry?.promptUploading)}function qh(e,t){let n=gd(e);if(!n)return;return{version:1,storage:fd(n),userDistinctId:t}}function Gh(e,t,n){let r=gd(t);if(!r){An.delete(e);return}return An.set(e,r),{version:1,storage:fd(r),userDistinctId:n}}function Kh(e){An.delete(e)}function hd(e,t,n){let r=`${t}/${n}`;return{async write(o,i){let s=await e.fetch(`${r}/${o}`,{method:"PUT",body:i,headers:{"Content-Type":"application/json; charset=utf-8"}});if(!s.ok)throw Error(`Failed to write ${o}: ${s.status}`)}}}function Wh(e){let{bucket:t,accessKeyId:n,secretAccessKey:r}=e;if(!t||!n||!r)return;let o=e.region||"us-east-1",i=e.endpoint||`https://s3.${o}.amazonaws.com`;return hd(new Rn({region:o,accessKeyId:n,secretAccessKey:r}),i,t)}function Jh(e){let{accountId:t,endpoint:n,bucket:r,accessKeyId:o,secretAccessKey:i}=e;if(!n&&!t||!r||!o||!i)return;return hd(new Rn({accessKeyId:o,secretAccessKey:i}),e.endpoint??`https://${t}.r2.cloudflarestorage.com`,r)}function Yh(e,t,n,r,o){let i=o["Content-Length"]||"",s=o["Content-Type"]||"",a=Object.entries(o).filter(([m])=>m.toLowerCase().startsWith("x-ms-")).sort(([m],[f])=>m.toLowerCase().localeCompare(f.toLowerCase())).map(([m,f])=>`${m.toLowerCase()}:${f}`).join(`
172
- `),c=`/${e}${r}`,l=[n,"","",i,"",s,"","","","","","",a,c].join(`
173
- `),d=Buffer.from(t,"base64"),p=Hh("sha256",d).update(l,"utf8").digest("base64");return`SharedKey ${e}:${p}`}function Xh(e){let{accessKeyId:t,secretAccessKey:n,bucket:r}=e;if(!t||!n||!r)return;let o=e.endpoint||`https://${t}.blob.core.windows.net`;return{async write(i,s){let a=`/${r}/${i}`,c=new Date().toUTCString(),l=Buffer.from(s,"utf8"),d={"x-ms-date":c,"x-ms-version":"2024-11-04","x-ms-blob-type":"BlockBlob","Content-Type":"application/json; charset=utf-8","Content-Length":l.byteLength.toString()};d.Authorization=Yh(t,n,"PUT",a,d);let p=await fetch(`${o}${a}`,{method:"PUT",body:l,headers:d});if(!p.ok){let m=await p.text().catch(()=>"");throw Error(`Failed to write ${i}: ${p.status} ${m}`.trim())}}}}function Qh(e){if(e.adapterType==="s3")return Wh(e);if(e.adapterType==="r2")return Jh(e);if(e.adapterType==="azure")return Xh(e);return}function pd(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function yd(e){let t=e?.metadata?.[md];if(!pd(t))return;let n=t.storage;if(!pd(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 ey(e,t,n){return["sessions",n.userDistinctId?.trim()||"unknown",e,t?.endsWith("messages.json")?"messages.json":jh(t)].filter((i)=>Boolean(i?.trim())).join("/")}function ty(){let e=new Map;return{async uploadMessagesFile({sessionId:t,path:n,contents:r,row:o}){let i=yd(o);if(!i)return;let s=An.get(t);if(!s)return;let a=JSON.stringify(s),c=e.get(a);if(!c){if(c=Qh(s),!c)return;e.set(a,c)}await c.write(ey(t,n,i),r)}}}function Qo(e,t,n){return{id:`remote-config:${e}:${n}:${t.name}`,name:t.name,kind:e,contents:t.contents,alwaysEnabled:t.alwaysEnabled}}var ny="remote://";function bd(e){let t="",n=!1;for(let r of e.trim().toLowerCase()){let o=r.charCodeAt(0);if(o>=97&&o<=122||o>=48&&o<=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 ry(e){let t=e?.globalRules?.map((r,o)=>Qo("rule",r,`${o}`))??[],n=e?.globalWorkflows?.map((r,o)=>Qo("workflow",r,`${o}`))??[];return[...t,...n]}function oy(e){return[...ry(e.remoteConfig),...e.managedInstructions??[]]}function iy(e){return e.map((t)=>{let n=`## ${t.name}`,r=t.alwaysEnabled?`_Always enabled_
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=Jr(await cd(this.body||""))}return e}}async function Nt(e,t){let n=await crypto.subtle.importKey("raw",typeof e==="string"?Yr.encode(e):e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return crypto.subtle.sign("HMAC",n,Yr.encode(t))}async function cd(e){return crypto.subtle.digest("SHA-256",typeof e==="string"?Yr.encode(e):e)}var ud=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function Jr(e){let t=new Uint8Array(e),n="";for(let o=0;o<t.length;o++){let r=t[o];n+=ud[r>>>4&15],n+=ud[r&15]}return n}function ld(e){return e.replace(/[!'()*]/g,(t)=>"%"+t.charCodeAt(0).toString(16).toUpperCase())}function Hh(e,t){let{hostname:n,pathname:o}=e;if(n.endsWith(".on.aws")){let a=n.match(/^[^.]{1,63}\.lambda-url\.([^.]{1,63})\.on\.aws$/);return a!=null?["lambda",a[1]||""]:["",""]}if(n.endsWith(".r2.cloudflarestorage.com"))return["s3","auto"];if(n.endsWith(".backblazeb2.com")){let a=n.match(/^(?:[^.]{1,63}\.)?s3\.([^.]{1,63})\.backblazeb2\.com$/);return a!=null?["s3",a[1]||""]:["",""]}let r=n.replace("dualstack.","").match(/([^.]{1,63})\.(?:([^.]{0,63})\.)?amazonaws\.com(?:\.cn)?$/),i=r&&r[1]||"",s=r&&r[2];if(s==="us-gov")s="us-gov-west-1";else if(s==="s3"||s==="s3-accelerate")s="us-east-1",i="s3";else if(i==="iot")if(n.startsWith("iot."))i="execute-api";else if(n.startsWith("data.jobs.iot."))i="iot-jobs-data";else i=o==="/mqtt"?"iotdevicegateway":"iotdata";else if(i==="autoscaling"){let a=(t.get("X-Amz-Target")||"").split(".")[0];if(a==="AnyScaleFrontendService")i="application-autoscaling";else if(a==="AnyScaleScalingPlannerFrontendService")i="autoscaling-plans"}else if(s==null&&i.startsWith("s3-"))s=i.slice(3).replace(/^fips-|^external-1/,""),i="s3";else if(i.endsWith("-fips"))i=i.slice(0,-5);else if(s&&/-\d$/.test(i)&&!/-\d$/.test(s))[i,s]=[s,i];return[Zh[i]||i,s||""]}var md="enterprise.blobUpload",An=new Map;function Xr(e,t){return{adapterType:e,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,region:t.region,bucket:t.bucket,endpoint:t.endpoint,accountId:t.accountId}}function fd(e){return{adapterType:e.adapterType,bucket:e.bucket,region:e.region,endpoint:e.endpoint,accountId:e.accountId}}function qh(e){if(!e||e.enabled!==!0)return;if(e.type==="s3_access_keys"&&e.s3AccessSettings)return Xr("s3",e.s3AccessSettings);if(e.type==="r2_access_keys"&&e.r2AccessSettings)return Xr("r2",e.r2AccessSettings);if(e.type==="azure_access_keys"&&e.azureAccessSettings)return Xr("azure",e.azureAccessSettings);return}function gd(e){return qh(e?.enterpriseTelemetry?.promptUploading)}function Gh(e,t){let n=gd(e);if(!n)return;return{version:1,storage:fd(n),userDistinctId:t}}function Kh(e,t,n){let o=gd(t);if(!o){An.delete(e);return}return An.set(e,o),{version:1,storage:fd(o),userDistinctId:n}}function Wh(e){An.delete(e)}function hd(e,t,n){let o=`${t}/${n}`;return{async write(r,i){let s=await e.fetch(`${o}/${r}`,{method:"PUT",body:i,headers:{"Content-Type":"application/json; charset=utf-8"}});if(!s.ok)throw Error(`Failed to write ${r}: ${s.status}`)}}}function Jh(e){let{bucket:t,accessKeyId:n,secretAccessKey:o}=e;if(!t||!n||!o)return;let r=e.region||"us-east-1",i=e.endpoint||`https://s3.${r}.amazonaws.com`;return hd(new Rn({region:r,accessKeyId:n,secretAccessKey:o}),i,t)}function Yh(e){let{accountId:t,endpoint:n,bucket:o,accessKeyId:r,secretAccessKey:i}=e;if(!n&&!t||!o||!r||!i)return;return hd(new Rn({accessKeyId:r,secretAccessKey:i}),e.endpoint??`https://${t}.r2.cloudflarestorage.com`,o)}function Xh(e,t,n,o,r){let i=r["Content-Length"]||"",s=r["Content-Type"]||"",a=Object.entries(r).filter(([m])=>m.toLowerCase().startsWith("x-ms-")).sort(([m],[f])=>m.toLowerCase().localeCompare(f.toLowerCase())).map(([m,f])=>`${m.toLowerCase()}:${f}`).join(`
172
+ `),c=`/${e}${o}`,l=[n,"","",i,"",s,"","","","","","",a,c].join(`
173
+ `),d=Buffer.from(t,"base64"),p=jh("sha256",d).update(l,"utf8").digest("base64");return`SharedKey ${e}:${p}`}function Qh(e){let{accessKeyId:t,secretAccessKey:n,bucket:o}=e;if(!t||!n||!o)return;let r=e.endpoint||`https://${t}.blob.core.windows.net`;return{async write(i,s){let a=`/${o}/${i}`,c=new Date().toUTCString(),l=Buffer.from(s,"utf8"),d={"x-ms-date":c,"x-ms-version":"2024-11-04","x-ms-blob-type":"BlockBlob","Content-Type":"application/json; charset=utf-8","Content-Length":l.byteLength.toString()};d.Authorization=Xh(t,n,"PUT",a,d);let p=await fetch(`${r}${a}`,{method:"PUT",body:l,headers:d});if(!p.ok){let m=await p.text().catch(()=>"");throw Error(`Failed to write ${i}: ${p.status} ${m}`.trim())}}}}function ey(e){if(e.adapterType==="s3")return Jh(e);if(e.adapterType==="r2")return Yh(e);if(e.adapterType==="azure")return Qh(e);return}function pd(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function yd(e){let t=e?.metadata?.[md];if(!pd(t))return;let n=t.storage;if(!pd(n))return;let o=n.adapterType;if(o!=="s3"&&o!=="r2"&&o!=="azure")return;if(typeof n.bucket!=="string")return;return{version:1,storage:{adapterType:o,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 ty(e,t,n){return["sessions",n.userDistinctId?.trim()||"unknown",e,t?.endsWith("messages.json")?"messages.json":Vh(t)].filter((i)=>Boolean(i?.trim())).join("/")}function ny(){let e=new Map;return{async uploadMessagesFile({sessionId:t,path:n,contents:o,row:r}){let i=yd(r);if(!i)return;let s=An.get(t);if(!s)return;let a=JSON.stringify(s),c=e.get(a);if(!c){if(c=ey(s),!c)return;e.set(a,c)}await c.write(ty(t,n,i),o)}}}function Qr(e,t,n){return{id:`remote-config:${e}:${n}:${t.name}`,name:t.name,kind:e,contents:t.contents,alwaysEnabled:t.alwaysEnabled}}var oy="remote://";function bd(e){let t="",n=!1;for(let o of e.trim().toLowerCase()){let r=o.charCodeAt(0);if(r>=97&&r<=122||r>=48&&r<=57||o==="."||o==="_"||o==="-"){if(n&&t&&t[t.length-1]!=="-")t+="-";n=!1,t+=o}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 ry(e){let t=e?.globalRules?.map((o,r)=>Qr("rule",o,`${r}`))??[],n=e?.globalWorkflows?.map((o,r)=>Qr("workflow",o,`${r}`))??[];return[...t,...n]}function iy(e){return[...ry(e.remoteConfig),...e.managedInstructions??[]]}function sy(e){return e.map((t)=>{let n=`## ${t.name}`,o=t.alwaysEnabled?`_Always enabled_
174
174
  `:"";return`${n}
175
175
 
176
- ${r}${t.contents.trim()}`}).join(`
176
+ ${o}${t.contents.trim()}`}).join(`
177
177
 
178
- `)}function ei(e,t){return e.filter((n)=>n.kind===t)}class ti{async materialize(e){let t=oy(e.bundle),n=ei(t,"rule"),r=ei(t,"workflow"),o=ei(t,"skill");await e.artifactStore.removeChildren(e.paths.workflowsPath),await e.artifactStore.removeChildren(e.paths.skillsPath);let i=[];if(n.length>0)await e.artifactStore.writeText(e.paths.rulesFilePath,iy(n)),i.push(...n.map((s)=>({kind:s.kind,filePath:e.paths.rulesFilePath,id:s.id,name:s.name})));else await e.artifactStore.remove(e.paths.rulesFilePath);for(let s of r){let a=`${e.paths.workflowsPath}/${bd(s.name.replace(/\.(md|markdown|txt)$/i,""))}.md`;await e.artifactStore.writeText(a,s.contents),i.push({kind:s.kind,filePath:a,id:s.id,name:s.name})}for(let s of o){let a=`${e.paths.skillsPath}/${bd(s.name)}/SKILL.md`;await e.artifactStore.writeText(a,s.contents),i.push({kind:s.kind,filePath:a,id:s.id,name:s.name})}return await e.artifactStore.writeText(e.paths.manifestPath,JSON.stringify({source:e.bundle.source,version:e.bundle.version,files:i},null,2)),{paths:e.paths,rulesFilePath:n.length>0?e.paths.rulesFilePath:void 0,files:i}}}import ot from"node:path";var sy="remote-config";function ni(e){let t=e.pluginName??sy,n=ot.join(e.workspacePath,".cline",t);return{pluginName:t,pluginPath:n,workflowsPath:ot.join(n,"workflows"),skillsPath:ot.join(n,"skills"),bundleCachePath:ot.join(n,"cache","bundle.json"),manifestPath:ot.join(n,"managed.json"),rulesFilePath:ot.join(n,"rules.md")}}function xd(e){return{workflowsDirectories:[e.workflowsPath],skillsDirectories:[e.skillsPath]}}function ay(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 _d(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ie(e,t){let n=e[t];return typeof n==="string"?n:void 0}function Sd(e,t){let n=e[t];return typeof n==="boolean"?n:void 0}function wn(e,t){let n=e[t];return typeof n==="number"&&Number.isFinite(n)?n:void 0}function ri(e,t){let n=e[t];if(!_d(n))return;let r=Object.entries(n).filter((o)=>typeof o[1]==="string");return r.length>0?Object.fromEntries(r):void 0}function cy(e){if(!_d(e))return;let t={enabled:Sd(e,"enabled"),metricsExporter:Ie(e,"metricsExporter"),logsExporter:Ie(e,"logsExporter"),otlpProtocol:Ie(e,"otlpProtocol"),otlpEndpoint:Ie(e,"otlpEndpoint"),otlpHeaders:ri(e,"otlpHeaders"),otlpMetricsProtocol:Ie(e,"otlpMetricsProtocol"),otlpMetricsEndpoint:Ie(e,"otlpMetricsEndpoint"),otlpMetricsHeaders:ri(e,"otlpMetricsHeaders"),otlpLogsProtocol:Ie(e,"otlpLogsProtocol"),otlpLogsEndpoint:Ie(e,"otlpLogsEndpoint"),otlpLogsHeaders:ri(e,"otlpLogsHeaders"),metricExportInterval:wn(e,"metricExportInterval"),otlpInsecure:Sd(e,"otlpInsecure"),logBatchSize:wn(e,"logBatchSize"),logBatchTimeout:wn(e,"logBatchTimeout"),logMaxQueueSize:wn(e,"logMaxQueueSize")};return Object.values(t).some((n)=>n!==void 0)?t:void 0}class oi{name="remote-config";resolveTelemetry(e,t){return{...ay(e.remoteConfig),...cy(e.telemetry)}}}async function uy(e){let t=ni(e),n=e.artifactStore??new En;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 vd(e){return e?.claims}function Td(e,t){if(!e)return[];if(t.claimsMapper)return t.claimsMapper.mapClaimsToRoles(e);return e.roles??[]}function ly(e,t){return{...e,metadata:{...e.metadata??{},paths:t}}}class Cd{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,o=vd(t),i=Td(o,this.options);return{bundle:t,materialized:n,telemetry:r,roles:i,claims:o}}}function dy(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 py(e){let t=ni({workspacePath:e.workspacePath,pluginName:e.pluginName}),n=e.bundleStore??new Wo(t.bundleCachePath),r=e.artifactStore??new En,o=e.materializer??new ti,i=e.telemetryAdapter??new oi,s,a,c=[],l,d=!1,p=!1;if(e.controlPlane){let f=new Cd({controlPlane:e.controlPlane,bundleStore:n,artifactStore:r,materializer:o,telemetryAdapter:i,claimsMapper:e.claimsMapper,logger:e.logger});try{let g=await f.sync({workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,paths:t,signal:e.signal,now:e.now});s=g.bundle,a=g.telemetry,c=g.roles,l=g.claims,p=!0}catch(g){if(e.useCachedBundle!==!1)s=await n.read(),d=Boolean(s);if(!s)throw g}}else if(e.useCachedBundle!==!1)s=await n.read(),d=Boolean(s);if(!s&&e.requireBundle)throw Error("Remote config runtime preparation requires a bundle");if(s){let f=ly(s,t);if(await n.write(f),!p)await o.materialize({bundle:f,paths:t,artifactStore:r});l??=vd(f),c=c.length>0?c:Td(l,e),a??=await i.resolveTelemetry(f,{workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:e.logger}),s=f}let m=xd(t);return{pluginName:t.pluginName,pluginDefinition:dy({name:t.pluginName}),paths:t,bundle:s,telemetry:a,roles:c,claims:l,usedCachedBundle:d,workflowsDirectories:m.workflowsDirectories,skillsDirectories:m.skillsDirectories}}var kd=b({id:u(),temperature:x().optional(),maxTokens:x().optional(),contextWindow:x().optional(),inputPrice:x().optional(),outputPrice:x().optional(),supportsImages:I().optional()}),Ed=b({models:E(kd).optional(),openAiBaseUrl:u().optional(),openAiHeaders:j(u(),u()).optional(),azureApiVersion:u().optional(),azureIdentity:I().optional()}),Rd=b({id:u(),thinkingBudgetTokens:x().optional()}),Ad=b({name:u(),baseModelId:u(),thinkingBudgetTokens:x().optional()}),wd=b({models:E(Rd).optional(),customModels:E(Ad).optional(),awsRegion:u().optional(),awsUseCrossRegionInference:I().optional(),awsUseGlobalInference:I().optional(),awsBedrockUsePromptCache:I().optional(),awsBedrockEndpoint:u().optional()}),Id=b({id:u()}),Pd=b({models:E(Id).optional()}),Md=b({id:u(),thinkingBudgetTokens:x().optional()}),Od=b({models:E(Md).optional(),vertexProjectId:u().optional(),vertexRegion:u().optional()}),zd=b({id:u(),thinkingBudgetTokens:x().optional(),promptCachingEnabled:I().optional()}),Nd=b({models:E(zd).optional(),baseUrl:u().optional()}),$d=b({id:u(),thinkingBudgetTokens:x().optional()}),Ld=b({models:E($d).optional(),baseUrl:u().optional()}),my=b({OpenAiCompatible:Ed.optional(),AwsBedrock:wd.optional(),Cline:Pd.optional(),Vertex:Od.optional(),LiteLLM:Nd.optional(),Anthropic:Ld.optional()}),Dd=b({id:u()}),Bd=b({name:u(),url:u(),alwaysEnabled:I().optional(),headers:j(u(),u()).optional()}),ii=b({alwaysEnabled:I(),name:u(),contents:u()}),In=b({bucket:u(),accessKeyId:u(),secretAccessKey:u(),region:u().optional(),endpoint:u().optional(),accountId:u().optional()}),Ud=b({enabled:I().optional(),type:Ge([V("s3_access_keys"),V("r2_access_keys"),V("azure_access_keys")]).optional(),s3AccessSettings:In.optional(),r2AccessSettings:In.optional(),azureAccessSettings:In.optional()}),Zd=b({promptUploading:Ud.optional()}),fy=b({version:u(),providerSettings:my.optional(),telemetryEnabled:I().optional(),kanbanEnabled:I().optional(),mcpMarketplaceEnabled:I().optional(),allowedMCPServers:E(Dd).optional(),remoteMCPServers:E(Bd).optional(),blockPersonalRemoteMCPServers:I().optional(),yoloModeAllowed:I().optional(),openTelemetryEnabled:I().optional(),openTelemetryMetricsExporter:u().optional(),openTelemetryLogsExporter:u().optional(),openTelemetryOtlpProtocol:u().optional(),openTelemetryOtlpEndpoint:u().optional(),openTelemetryOtlpHeaders:j(u(),u()).optional(),openTelemetryOtlpMetricsProtocol:u().optional(),openTelemetryOtlpMetricsEndpoint:u().optional(),openTelemetryOtlpMetricsHeaders:j(u(),u()).optional(),openTelemetryOtlpLogsProtocol:u().optional(),openTelemetryOtlpLogsEndpoint:u().optional(),openTelemetryOtlpLogsHeaders:j(u(),u()).optional(),openTelemetryMetricExportInterval:x().optional(),openTelemetryOtlpInsecure:I().optional(),openTelemetryLogBatchSize:x().optional(),openTelemetryLogBatchTimeout:x().optional(),openTelemetryLogMaxQueueSize:x().optional(),enterpriseTelemetry:Zd.optional(),globalRules:E(ii).optional(),globalWorkflows:E(ii).optional()}),gy=j(u(),u());var hy=25463,yy=25466,by=4317;var xy="127.0.0.1:4317";var Sy=w(["reasoning","prompt-cache","tools","provider-tools","oauth","temperature","files","streaming","vision","computer-use","local-auth","popular"]),_y=w(["anthropic","gemini","openai-chat","openai-responses","openai-r1","ai-sdk"]),vy=w(["anthropic","ai-sdk","ai-sdk-community","openai","openai-compatible","openai-r1","gemini","bedrock","custom","fetch","vertex"]);var Ty="runtime.team.progress.v1",Cy="runtime.team.lifecycle.v1";import{basename as ky}from"node:path";var Pn="CLINE_BUILD_ENV",Fd="CLINE_DEBUG_HOST",Hd="CLINE_DEBUG_PORT_BASE";function jd(e){let t=e?.trim().toLowerCase();if(t==="development"||t==="production")return t;return}function Ey(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 Ry(e){if(!e?.trim())return!1;let t=ky(e).toLowerCase();return t==="node"||t==="node.exe"||t==="bun"||t==="bun.exe"}function Ay(e){return e.some((t)=>t==="--inspect"||t.startsWith("--inspect=")||t==="--inspect-brk"||t.startsWith("--inspect-brk="))}function wy(e){return e.some((t)=>t==="--enable-source-maps")}function Iy(e){return e[Fd]?.trim()||"127.0.0.1"}function Py(e){let t=e[Hd]?.trim();if(!t)return;let n=Number.parseInt(t,10);return Number.isInteger(n)&&n>0?n:void 0}function My(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 si(e={}){let t=e.env??process.env,n=e.execArgv??process.execArgv,r=jd(t[Pn]);if(r)return r;let o=t.NODE_ENV?.trim().toLowerCase();if(o==="production")return"production";if(o==="development")return"development";return Ey(n)?"development":"production"}function Oy(e=process.env,t={}){if(jd(e[Pn]))return e;return{...e,[Pn]:si({env:e,execArgv:t.execArgv})}}function zy(e,t={}){if(e.length===0||!Ry(e[0]))return[...e];if(si(t)!=="development")return[...e];let n=t.env??process.env,r=[...n.NODE_OPTIONS?.split(/\s+/).filter(Boolean)??[],...e.slice(1)],o=[];if(!Ay(r)){let i=Iy(n),s=Py(n),a=s===void 0?0:s+My(t.debugRole);o.push(`--inspect=${i}:${a}`)}if(!wy(r))o.push("--enable-source-maps");return[e[0],...o,...e.slice(1)]}function Ny(e){let t=e?.trim();if(!t)return!1;if(t.startsWith("/$bunfs/"))return!0;return t.replace(/\\/g,"/").toLowerCase().startsWith("b:/~bun/")}function Vd(){return globalThis}function $y(e){Vd().__clineClientIdentity=e}function Ly(){return Vd().__clineClientIdentity}var Dy="CLINE_ENVIRONMENT",By="CLINE_ENVIRONMENT_OVERRIDE",ai={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"}},Uy="production";function qd(e){let t=e?.trim().toLowerCase();if(t==="production"||t==="staging"||t==="local")return t;return}function Gd(){if(typeof process>"u"||!process?.env)return{};return process.env}function Kd(){let e=Gd();return qd(e.CLINE_ENVIRONMENT_OVERRIDE)??qd(e.CLINE_ENVIRONMENT)??"production"}function Zy(e){if(typeof e==="string")return ai[e];return ai[Kd()]}function Fy(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 Hy(e){let t=Zy(e);return Fy(t,Gd())}var jy="CLINE_RUN_AS_HUB_DAEMON",Vy="CLINE_CONNECTOR_CLI_LAUNCH",qy="CLINE_CONNECTOR_STARTING_INSTANCE",Gy="CLINE_CONNECTOR_SUPERVISED",ci;function Ky(e=process.env){return ci=e.CLINE_RUN_AS_HUB_DAEMON==="1",delete e.CLINE_RUN_AS_HUB_DAEMON,ci}function Wy(e){if(e)return e.CLINE_RUN_AS_HUB_DAEMON==="1";return ci??process.env.CLINE_RUN_AS_HUB_DAEMON==="1"}function Jy(e,t=process.env){t.CLINE_CONNECTOR_CLI_LAUNCH=JSON.stringify(e)}var ui;function Yy(e=process.env){return ui=e.CLINE_CONNECTOR_SUPERVISED==="1",delete e.CLINE_CONNECTOR_SUPERVISED,ui}function Xy(e){if(e)return e.CLINE_CONNECTOR_SUPERVISED==="1";return ui??process.env.CLINE_CONNECTOR_SUPERVISED==="1"}function Qy(e,t=process.env){t.CLINE_CONNECTOR_STARTING_INSTANCE=JSON.stringify(e)}function eb(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 tb(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 nb=["HTTP_PROXY","http_proxy","HTTPS_PROXY","https_proxy","ALL_PROXY","all_proxy"],Jd=["localhost","127.0.0.1","::1","[::1]"];function rb(e){for(let t of nb){let n=e[t]?.trim();if(n)return n}return}function li(e){return(e??"").split(",").map((t)=>t.trim()).filter((t)=>t.length>0)}function ob(e,t){let n=[],r=new Set;for(let o of[...li(e),...li(t),...Jd]){let i=o.toLowerCase();if(i!=="*"&&!r.has(i))r.add(i),n.push(o)}return n.join(",")}function Wd(e){return li(e).includes("*")}function ib(e=process.env){if(!rb(e))return;let t=Wd(e.NO_PROXY),n=Wd(e.no_proxy);if(t&&n)return;let r=ob(e.NO_PROXY,e.no_proxy);if(!t)e.NO_PROXY=r;if(!n)e.no_proxy=r}var sb="NoDefaultCurrentDirectoryInExePath";function ab(e={}){let{env:t=process.env,platform:n=process.platform}=e;if(n!=="win32")return;t.NoDefaultCurrentDirectoryInExePath="1"}var cb="agent.reasoning.unexpected_tokens",ub="task.provider_request_started",lb="task.provider_stream_started",db="task.first_chunk_received",pb="task.provider_stream_failed",mb="task.cancelled",fb="task.max_tokens_recovery",gb=["initial","crash_restart","rollout_fallback","rollout_demotion","user_restart"],hb="sdk.error";var De=new Map;function yb(){De.clear()}function bb(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 xb(e){let t=Date.now(),n=De.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(De.delete(e),De.size>=512){let o=De.keys().next();if(!o.done)De.delete(o.value)}return De.set(e,{startMs:t,emitted:1,suppressed:0}),{emit:!0,suppressed:r}}function Sb(e,t){e?.capture({event:"agent.reasoning.unexpected_tokens",properties:pi({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 _b(e,t){if(!e)return;e.capture({event:t.event,properties:pi({sessionId:t.sessionId,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?{}:mi(t.error,t.messageLimit),error_class:t.errorClass})})}function vb(e,t){if(!e)return!1;let n=t.event??"sdk.error",r=Yd(t),o=0;try{let i=xb(bb(n,r));if(!i.emit)return!0;o=i.suppressed}catch{}return e.capture({event:n,properties:o>0?{...r,suppressed_count:o}:r}),!0}function Yd(e){return pi({...e.context??{},component:e.component,operation:e.operation,severity:e.severity??"error",handled:e.handled??!0,...mi(e.error,e.messageLimit,e.errorMessage)})}function pi(e){let t={};for(let[n,r]of Object.entries(e))if(r!==void 0)t[n]=r;return t}function mi(e,t=500,n){let r=kb(e)?e:void 0,o=e instanceof Error?e:void 0,i=$t(n)??$t(o?.message)??$t(r?.message)??Eb(e)??"Unknown error",s=Rb(r?.code),a=di(r?.status)??di(r?.statusCode)??di(r?.responseStatus);return{error_type:o?.name?.trim()||$t(r?.name)||o?.constructor?.name||"Error",error_message:Cb(Tb(i),t),...s!==void 0?{error_code:s}:{},...a!==void 0?{error_status:a}:{}}}function Tb(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 Cb(e,t){let n=Math.max(1,Math.floor(t));return e.length>n?e.substring(0,n):e}function kb(e){return typeof e==="object"&&e!==null}function $t(e){return typeof e==="string"&&e.trim().length>0?e:void 0}function Eb(e){if(e instanceof Error)return;let t=typeof e==="string"?e:String(e);return t==="[object Object]"?void 0:$t(t)}function Rb(e){if(typeof e==="string"&&e.trim().length>0)return e;if(typeof e==="number"&&Number.isFinite(e))return e;return}function di(e){return typeof e==="number"&&Number.isFinite(e)?e:void 0}var fi="_clineOtlpTraceRelay";function Ab(e){e[fi]=!0}function wb(e){return!!e&&typeof e==="object"&&e[fi]===!0}function Xd(e){let t={};if(!e)return t;return e.split(",").forEach((n)=>{let r=n.indexOf("=");if(r<=0)return;try{let o=decodeURIComponent(n.substring(0,r).trim()),i=decodeURIComponent(n.substring(r+1).trim());if(!o||!i)return;t[o]=i}catch{}}),t}function Ib(){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?Xd(process.env.OTEL_EXPORTER_OTLP_HEADERS):void 0}}function Qd(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 Pb(e={}){return{...Ib(),...e,metadata:Qd(e.metadata)}}function ep(e){let t=e?.trim();return t?t:void 0}function Mb(e,t){if(!e)return;let n=typeof e==="function"?e(t):e;if(!n)return;let r=ep(n.rootSessionId);if(!r)return;return{rootSessionId:r}}function Ob(e){return ep(e?.rootSessionId)}import{webcrypto as tp}from"node:crypto";var zb=128,Pe,it;function Nb(e){if(e<0)throw RangeError("Wrong ID size");try{if(!Pe||Pe.length<e)Pe=Buffer.allocUnsafe(e*zb),tp.getRandomValues(Pe),it=0;else if(it+e>Pe.length)tp.getRandomValues(Pe),it=0}catch(t){throw Pe=void 0,t}it+=e}function $b(e){return Nb(e|=0),Pe.subarray(it-e,it)}function Lb(e,t,n){let r=256-256%e.length;if(r===256){let i=e.length-1;return(s=t)=>{if(!s)return"";let a="";while(!0){let c=n(s),l=s;while(l--)if(a+=e[c[l]&i],a.length>=s)return a}}}let o=Math.ceil(409.6*t/r);return(i=t)=>{if(!i)return"";let s="";while(!0){let a=n(o),c=o;while(c--)if(a[c]<r){if(s+=e[a[c]%e.length],s.length>=i)return s}}}}function np(e,t=21){return Lb(e,t,$b)}function Db(e="",t=""){let n=np("1234567890abcdefghijklmnopqrstuvwxyz",10);return`${e}${Date.now()}_${n(5)}${t}`}var Bb=["idle","running","pending","completed","failed","cancelled"];var gi=["rules","skills","workflows","plugins","hooks"],rp=gi,Ub=new Set(gi);function op(e){return typeof e==="string"&&Ub.has(e)}function Zb(e){if(!Array.isArray(e))return;let t=e.map((n)=>typeof n==="string"?n.trim():"").filter(op);return[...new Set(t)]}function Fb(e,t){return new Set(e??rp).has(t)}var Hb=b({rootPath:u().min(1),hint:u().min(1).optional(),associatedRemoteUrls:E(u().min(1)).optional(),latestGitCommitHash:u().min(1).optional(),latestGitBranchName:u().min(1).optional()}),jb=b({currentWorkspacePath:u().min(1).optional(),workspaces:j(u().min(1),Hb)});function ZC(){return{workspaces:{}}}function FC(e,t){let n={...e,workspaces:{...e.workspaces,[t.rootPath]:t}};if(!n.currentWorkspacePath)n.currentWorkspacePath=t.rootPath;return jb.parse(n)}var Vb="workspaces",qb="chat";function Gb(e){let t=e.trim(),n=/^[A-Za-z]:[\\/]/.test(t)||t.startsWith("\\\\"),r=t.startsWith("/");if(!n&&!r)return!1;let o=t.split(n?/[\\/]+/:/\/+/).filter(Boolean),i=o.at(-1)??"",s=o.at(-2)??"",a=o.at(-3)??"";return(o.at(-4)??"")===".cline"&&a==="data"&&s==="workspaces"&&i==="chat"}var Kb=["current_state","boundary_analysis","interface_proposal"],qC=3600000,GC=240,KC=400,le=Gu((e)=>e instanceof Date?e.toISOString():e,u().datetime()),st=w(["pending","in_progress","blocked","completed"]),ip=w(["queued","running","completed","failed","cancelled","interrupted"]),Mn=w(["draft","in_review","finalized"]),Wb=b({agentId:u(),role:w(["lead","teammate"]),description:u().optional(),status:w(["idle","running","stopped"])}),WC=b({agentId:u(),rolePrompt:u(),modelId:u().optional(),maxIterations:x().optional()});function Z(e){return Gu((t)=>t===null?void 0:t,e.optional())}var JC=b({agentId:u().min(1).describe("Teammate identifier"),rolePrompt:u().min(1).describe("System prompt describing teammate role")}).strict(),YC=b({agentId:u().min(1).describe("Teammate identifier"),reason:Z(u().min(1)).describe("Optional shutdown reason")}),XC=b({}),Jb={create:["title","description"],list:[],claim:["taskId"],complete:["taskId","summary"],block:["taskId","reason"]},QC={create:["status","taskId","summary","reason"]},ek=b({action:w(["create","list","claim","complete","block"]),title:Z(u().min(1)).describe("Task title"),description:Z(u().min(1)).describe("Task details"),dependsOn:Z(E(u().describe("Dependency task ID"))).describe("Array of dependency task IDs"),assignee:Z(u().min(1)).describe("Optional assignee"),status:Z(w(["pending","in_progress","blocked","completed"])).describe("Optional task status filter"),taskId:Z(u()).describe("Task ID"),summary:Z(u().min(1)).describe("Completion summary"),reason:Z(u().min(1)).describe("Blocking reason")}).superRefine((e,t)=>{for(let n of Jb[e.action]){if(e[n]!==void 0)continue;t.addIssue({code:"custom",path:[n],message:`Field "${n}" is required when action=${e.action}`})}}),tk=b({agentId:u().describe("Teammate agent ID"),task:u().min(1).describe("Task instructions for the teammate"),taskId:Z(u()).describe("Optional shared task list ID"),runMode:Z(w(["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:Z(I()).describe("If true, continue the teammate conversation; otherwise start fresh")}),nk=b({status:Z(w(["queued","running","completed","failed","cancelled","interrupted"])).describe("Optional run status filter. Omit to include all statuses."),agentId:Z(u().min(1)).describe("Optional teammate ID filter. Omit to include all teammates."),includeCompleted:Z(I()).describe("Include completed/failed runs (default true)")}),rk=b({runId:u().min(1).describe("Run ID"),reason:Z(u().min(1)).describe("Optional cancellation reason")}),ok=b({runId:Z(u().min(1)).describe("Optional async run ID to await. Omit to wait for all active async runs.")}).strict(),ik=b({toAgentId:u().min(1).describe("Recipient agent ID"),subject:u().min(1).describe("Message subject"),body:u().min(1).describe("Message body"),taskId:Z(u().min(1)).describe("Optional task ID context")}),sk=b({subject:u().min(1).describe("Message subject"),body:u().min(1).describe("Message body"),taskId:Z(u().min(1)).describe("Optional task ID context")}),ak=b({unreadOnly:Z(I()).describe("Only unread messages for read action (default true)")}),ck=b({kind:w(["progress","handoff","blocked","decision","done","error"]),summary:u().min(1).describe("Update summary"),taskId:Z(u().min(1)).describe("Optional task ID context"),evidence:Z(E(u().min(1))).describe("Optional evidence links/snippets"),nextAction:Z(u().min(1)).describe("Planned next step")}),uk=b({}),lk=b({title:u().describe("Outcome title"),requiredSections:E(u()).default(Kb).describe("Required sections for finalization gate (defaults to current_state,boundary_analysis,interface_proposal)")}),dk=b({outcomeId:u().describe("Outcome ID"),section:u().describe("Section name"),sourceRunId:Z(u()).describe("Optional source run ID"),content:u().describe("Section fragment content")}),pk=b({fragmentId:u().describe("Fragment ID"),approved:I().describe("Review decision")}),mk=b({outcomeId:u().describe("Outcome ID")}),fk=b({}),gk=b({teamId:u(),teamName:u(),members:E(Wb),taskCounts:j(st,x()),unreadMessages:x(),missionLogEntries:x(),activeRuns:x(),queuedRuns:x(),outcomeCounts:j(Mn,x())}),Yb=b({id:u(),title:u(),description:u(),status:st,createdAt:le,updatedAt:le,createdBy:u(),assignee:u().optional(),dependsOn:E(u()),summary:u().optional(),isReady:I(),blockedBy:E(u())}),hk=so("action",[b({action:V("create"),taskId:u(),status:st,ignoredFields:E(u()).optional(),note:u().optional()}),b({action:V("list"),tasks:E(Yb)}),b({action:V("claim"),taskId:u(),status:st,nextStep:u()}),b({action:V("complete"),taskId:u(),status:st}),b({action:V("block"),taskId:u(),status:st})]),yk=b({agentId:u(),mode:w(["sync","async"]),status:w(["dispatched","running","queued","joined"]),dispatched:I(),message:u(),deduped:I().optional(),runId:u().optional(),text:u().optional(),iterations:x().optional()}),Xb=b({textPreview:u(),iterations:x(),finishReason:u(),durationMs:x(),usage:b({inputTokens:x(),outputTokens:x(),cacheReadTokens:x().optional(),cacheWriteTokens:x().optional(),totalCost:x().optional()})}),bk=b({id:u(),agentId:u(),taskId:u().optional(),status:ip,messagePreview:u(),priority:x(),retryCount:x(),maxRetries:x(),nextAttemptAt:le.optional(),continueConversation:I().optional(),startedAt:le,endedAt:le.optional(),leaseOwner:u().optional(),heartbeatAt:le.optional(),lastProgressAt:le.optional(),lastProgressMessage:u().optional(),currentActivity:u().optional(),error:u().optional(),resultSummary:Xb.optional()}),xk=b({id:u(),teamId:u(),fromAgentId:u(),toAgentId:u(),subject:u(),body:u(),taskId:u().optional(),sentAt:le,readAt:le.optional()}),Sk=b({id:u(),teamId:u(),title:u(),status:Mn,requiredSections:E(u()),createdBy:u(),createdAt:le,finalizedAt:le.optional()}),_k=b({outcomeId:u(),status:Mn,requiredSections:E(u())}),vk=b({agentId:u(),status:u()}),Tk=b({runId:u(),status:ip}),Ck=b({id:u(),toAgentId:u()}),kk=b({delivered:x()}),Ek=b({id:u()}),Rk=b({status:u()}),Ak=b({fragmentId:u(),status:u()}),wk=b({outcomeId:u(),status:Mn});var Qb;((R)=>{R.TaskStart="task_start";R.TaskEnd="task_end";R.AgentEvent="agent_event";R.TeammateSpawned="teammate_spawned";R.TeammateShutdown="teammate_shutdown";R.TeamTaskUpdated="team_task_updated";R.TeamMessage="team_message";R.TeamMissionLog="team_mission_log";R.TeamTaskCompleted="team_task_completed";R.RunStarted="run_started";R.RunQueued="run_queued";R.RunProgress="run_progress";R.RunCompleted="run_completed";R.RunFailed="run_failed";R.RunCancelled="run_cancelled";R.RunInterrupted="run_interrupted";R.OutcomeCreated="outcome_created";R.OutcomeFragmentAttached="outcome_fragment_attached";R.OutcomeFragmentReviewed="outcome_fragment_reviewed";R.OutcomeFinalized="outcome_finalized"})(Qb||={});function ex(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 o=n[r];if(!Array.isArray(o)||o.length===0)continue;if(r==="allOf"){if(o.some((a)=>a&&typeof a==="object"&&a.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(o.every((s)=>s&&typeof s==="object"&&s.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 tx(e){let t=ex(e.inputSchema instanceof N?jo(e.inputSchema):e.inputSchema);return{name:e.name,description:e.description,inputSchema:t,lifecycle:e.lifecycle,executionMode:e.executionMode,timeoutMs:e.timeoutMs??30000,retryable:e.retryable??!0,maxRetries:e.maxRetries??3,execute:e.execute}}var sp=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function nx(e){let t=(e instanceof Error?e.message:String(e)).toLowerCase();return sp.some((n)=>t.includes(n))}import{existsSync as rx,mkdirSync as ox,readFileSync as ix,writeFileSync as sx}from"node:fs";import{dirname as ax,resolve as cx}from"node:path";var ux=new Set(["accesskeyid","secretaccesskey","idtoken","refreshtoken","accesstoken","access_token","refresh_token","apikey","api_key","authorization","password","secret","token","email","displayname","display_name","userinfo"]),lx=["id","balance","cost","secret"];function dx(e){let t=e.toLowerCase();if(ux.has(t))return!0;for(let n of lx){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 o=e[e.length-n.length];if(o&&o===o.toUpperCase()&&o!==o.toLowerCase())return!0}if(t.endsWith(`_${n}`))return!0}return!1}var px=[{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 cp(e){let t=e;for(let{pattern:n,replacement:r}of px)t=t.replace(n,r);return t}function hi(e){if(Array.isArray(e))return e.map(hi);if(!e||typeof e!=="object")return e;return Object.fromEntries(Object.entries(e).sort(([t],[n])=>mx(t,n)).map(([t,n])=>[t,hi(n)]))}function mx(e,t){if(e<t)return-1;if(e>t)return 1;return 0}function ap(e){return JSON.stringify(hi(e))}var fx=[{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 yi(e){let t=e;for(let{pattern:n,replacement:r}of fx)t=t.replace(n,r);return t}function at(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(at(t))}catch{}return cp(e)}if(Array.isArray(e))return e.map(at);if(typeof e==="object"){let t={};for(let[n,r]of Object.entries(e))if(dx(n)&&(typeof r==="string"||typeof r==="number"))t[n]="REDACTED";else t[n]=at(r);return t}return e}function gx(e){let t=new URLSearchParams(e),n=Array.from(t.entries());if(n.length===0||n.some(([o])=>o.length===0))return;let r={};for(let[o,i]of n){let s=r[o];if(s===void 0)r[o]=i;else if(Array.isArray(s))s.push(i);else r[o]=[s,i]}return r}function hx(e){return e?.toLowerCase().split(";")[0]?.trim()==="application/x-www-form-urlencoded"}function up(e,t){try{return ap(at(JSON.parse(e)))}catch{if(hx(t)){let n=gx(e);if(n)return ap(at(n))}return cp(e)}}function yx(e,t){let n={...e},r=t&&e.body!==void 0?up(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=yi(n.path);if(n.response!==void 0)n.response=at(n.response);return n}function lp(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 dp(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 pp(e,t){if(t?.method)return t.method.toUpperCase();if(e&&typeof e.method==="string")return e.method.toUpperCase();return"GET"}function bx(e){if(!e)return;return new Headers(e).get("content-type")??void 0}function mp(e,t){let n=bx(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 fp(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 xx(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.
178
+ `)}function ei(e,t){return e.filter((n)=>n.kind===t)}class ti{async materialize(e){let t=iy(e.bundle),n=ei(t,"rule"),o=ei(t,"workflow"),r=ei(t,"skill");await e.artifactStore.removeChildren(e.paths.workflowsPath),await e.artifactStore.removeChildren(e.paths.skillsPath);let i=[];if(n.length>0)await e.artifactStore.writeText(e.paths.rulesFilePath,sy(n)),i.push(...n.map((s)=>({kind:s.kind,filePath:e.paths.rulesFilePath,id:s.id,name:s.name})));else await e.artifactStore.remove(e.paths.rulesFilePath);for(let s of o){let a=`${e.paths.workflowsPath}/${bd(s.name.replace(/\.(md|markdown|txt)$/i,""))}.md`;await e.artifactStore.writeText(a,s.contents),i.push({kind:s.kind,filePath:a,id:s.id,name:s.name})}for(let s of r){let a=`${e.paths.skillsPath}/${bd(s.name)}/SKILL.md`;await e.artifactStore.writeText(a,s.contents),i.push({kind:s.kind,filePath:a,id:s.id,name:s.name})}return await e.artifactStore.writeText(e.paths.manifestPath,JSON.stringify({source:e.bundle.source,version:e.bundle.version,files:i},null,2)),{paths:e.paths,rulesFilePath:n.length>0?e.paths.rulesFilePath:void 0,files:i}}}import rt from"node:path";var ay="remote-config";function ni(e){let t=e.pluginName??ay,n=rt.join(e.workspacePath,".cline",t);return{pluginName:t,pluginPath:n,workflowsPath:rt.join(n,"workflows"),skillsPath:rt.join(n,"skills"),bundleCachePath:rt.join(n,"cache","bundle.json"),manifestPath:rt.join(n,"managed.json"),rulesFilePath:rt.join(n,"rules.md")}}function xd(e){return{workflowsDirectories:[e.workflowsPath],skillsDirectories:[e.skillsPath]}}function cy(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 _d(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function we(e,t){let n=e[t];return typeof n==="string"?n:void 0}function Sd(e,t){let n=e[t];return typeof n==="boolean"?n:void 0}function In(e,t){let n=e[t];return typeof n==="number"&&Number.isFinite(n)?n:void 0}function oi(e,t){let n=e[t];if(!_d(n))return;let o=Object.entries(n).filter((r)=>typeof r[1]==="string");return o.length>0?Object.fromEntries(o):void 0}function uy(e){if(!_d(e))return;let t={enabled:Sd(e,"enabled"),metricsExporter:we(e,"metricsExporter"),logsExporter:we(e,"logsExporter"),otlpProtocol:we(e,"otlpProtocol"),otlpEndpoint:we(e,"otlpEndpoint"),otlpHeaders:oi(e,"otlpHeaders"),otlpMetricsProtocol:we(e,"otlpMetricsProtocol"),otlpMetricsEndpoint:we(e,"otlpMetricsEndpoint"),otlpMetricsHeaders:oi(e,"otlpMetricsHeaders"),otlpLogsProtocol:we(e,"otlpLogsProtocol"),otlpLogsEndpoint:we(e,"otlpLogsEndpoint"),otlpLogsHeaders:oi(e,"otlpLogsHeaders"),metricExportInterval:In(e,"metricExportInterval"),otlpInsecure:Sd(e,"otlpInsecure"),logBatchSize:In(e,"logBatchSize"),logBatchTimeout:In(e,"logBatchTimeout"),logMaxQueueSize:In(e,"logMaxQueueSize")};return Object.values(t).some((n)=>n!==void 0)?t:void 0}class ri{name="remote-config";resolveTelemetry(e,t){return{...cy(e.remoteConfig),...uy(e.telemetry)}}}async function ly(e){let t=ni(e),n=e.artifactStore??new En;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 vd(e){return e?.claims}function Td(e,t){if(!e)return[];if(t.claimsMapper)return t.claimsMapper.mapClaimsToRoles(e);return e.roles??[]}function dy(e,t){return{...e,metadata:{...e.metadata??{},paths:t}}}class Cd{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}),o=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,r=vd(t),i=Td(r,this.options);return{bundle:t,materialized:n,telemetry:o,roles:i,claims:r}}}function py(e){let t=e?.name??"remote-config";return{name:t,manifest:{capabilities:["providers"]},async setup(n,o){n.registerProvider?.({name:t,description:"Remote-config managed runtime integration"}),await e?.setup?.(n,o)}}}async function my(e){let t=ni({workspacePath:e.workspacePath,pluginName:e.pluginName}),n=e.bundleStore??new Wr(t.bundleCachePath),o=e.artifactStore??new En,r=e.materializer??new ti,i=e.telemetryAdapter??new ri,s,a,c=[],l,d=!1,p=!1;if(e.controlPlane){let f=new Cd({controlPlane:e.controlPlane,bundleStore:n,artifactStore:o,materializer:r,telemetryAdapter:i,claimsMapper:e.claimsMapper,logger:e.logger});try{let g=await f.sync({workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,paths:t,signal:e.signal,now:e.now});s=g.bundle,a=g.telemetry,c=g.roles,l=g.claims,p=!0}catch(g){if(e.useCachedBundle!==!1)s=await n.read(),d=Boolean(s);if(!s)throw g}}else if(e.useCachedBundle!==!1)s=await n.read(),d=Boolean(s);if(!s&&e.requireBundle)throw Error("Remote config runtime preparation requires a bundle");if(s){let f=dy(s,t);if(await n.write(f),!p)await r.materialize({bundle:f,paths:t,artifactStore:o});l??=vd(f),c=c.length>0?c:Td(l,e),a??=await i.resolveTelemetry(f,{workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:e.logger}),s=f}let m=xd(t);return{pluginName:t.pluginName,pluginDefinition:py({name:t.pluginName}),paths:t,bundle:s,telemetry:a,roles:c,claims:l,usedCachedBundle:d,workflowsDirectories:m.workflowsDirectories,skillsDirectories:m.skillsDirectories}}var kd=b({id:u(),temperature:x().optional(),maxTokens:x().optional(),contextWindow:x().optional(),inputPrice:x().optional(),outputPrice:x().optional(),supportsImages:w().optional()}),Ed=b({models:E(kd).optional(),openAiBaseUrl:u().optional(),openAiHeaders:j(u(),u()).optional(),azureApiVersion:u().optional(),azureIdentity:w().optional()}),Rd=b({id:u(),thinkingBudgetTokens:x().optional()}),Ad=b({name:u(),baseModelId:u(),thinkingBudgetTokens:x().optional()}),Id=b({models:E(Rd).optional(),customModels:E(Ad).optional(),awsRegion:u().optional(),awsUseCrossRegionInference:w().optional(),awsUseGlobalInference:w().optional(),awsBedrockUsePromptCache:w().optional(),awsBedrockEndpoint:u().optional()}),wd=b({id:u()}),Pd=b({models:E(wd).optional()}),Md=b({id:u(),thinkingBudgetTokens:x().optional()}),Od=b({models:E(Md).optional(),vertexProjectId:u().optional(),vertexRegion:u().optional()}),zd=b({id:u(),thinkingBudgetTokens:x().optional(),promptCachingEnabled:w().optional()}),Nd=b({models:E(zd).optional(),baseUrl:u().optional()}),$d=b({id:u(),thinkingBudgetTokens:x().optional()}),Ld=b({models:E($d).optional(),baseUrl:u().optional()}),fy=b({OpenAiCompatible:Ed.optional(),AwsBedrock:Id.optional(),Cline:Pd.optional(),Vertex:Od.optional(),LiteLLM:Nd.optional(),Anthropic:Ld.optional()}),Dd=b({id:u()}),Bd=b({name:u(),url:u(),alwaysEnabled:w().optional(),headers:j(u(),u()).optional()}),ii=b({alwaysEnabled:w(),name:u(),contents:u()}),wn=b({bucket:u(),accessKeyId:u(),secretAccessKey:u(),region:u().optional(),endpoint:u().optional(),accountId:u().optional()}),Ud=b({enabled:w().optional(),type:Ge([V("s3_access_keys"),V("r2_access_keys"),V("azure_access_keys")]).optional(),s3AccessSettings:wn.optional(),r2AccessSettings:wn.optional(),azureAccessSettings:wn.optional()}),Zd=b({promptUploading:Ud.optional()}),gy=b({version:u(),providerSettings:fy.optional(),telemetryEnabled:w().optional(),kanbanEnabled:w().optional(),mcpMarketplaceEnabled:w().optional(),allowedMCPServers:E(Dd).optional(),remoteMCPServers:E(Bd).optional(),blockPersonalRemoteMCPServers:w().optional(),yoloModeAllowed:w().optional(),openTelemetryEnabled:w().optional(),openTelemetryMetricsExporter:u().optional(),openTelemetryLogsExporter:u().optional(),openTelemetryOtlpProtocol:u().optional(),openTelemetryOtlpEndpoint:u().optional(),openTelemetryOtlpHeaders:j(u(),u()).optional(),openTelemetryOtlpMetricsProtocol:u().optional(),openTelemetryOtlpMetricsEndpoint:u().optional(),openTelemetryOtlpMetricsHeaders:j(u(),u()).optional(),openTelemetryOtlpLogsProtocol:u().optional(),openTelemetryOtlpLogsEndpoint:u().optional(),openTelemetryOtlpLogsHeaders:j(u(),u()).optional(),openTelemetryMetricExportInterval:x().optional(),openTelemetryOtlpInsecure:w().optional(),openTelemetryLogBatchSize:x().optional(),openTelemetryLogBatchTimeout:x().optional(),openTelemetryLogMaxQueueSize:x().optional(),enterpriseTelemetry:Zd.optional(),globalRules:E(ii).optional(),globalWorkflows:E(ii).optional()}),hy=j(u(),u());var yy=25463,by=25466,xy=4317;var Sy="127.0.0.1:4317";var _y=I(["reasoning","prompt-cache","tools","provider-tools","oauth","temperature","files","streaming","vision","computer-use","local-auth","popular"]),vy=I(["anthropic","gemini","openai-chat","openai-responses","openai-r1","ai-sdk"]),Ty=I(["anthropic","ai-sdk","ai-sdk-community","openai","openai-compatible","openai-r1","gemini","bedrock","custom","fetch","vertex"]);var Cy="runtime.team.progress.v1",ky="runtime.team.lifecycle.v1";import{basename as Ey}from"node:path";var Pn="CLINE_BUILD_ENV",Fd="CLINE_DEBUG_HOST",Hd="CLINE_DEBUG_PORT_BASE";function jd(e){let t=e?.trim().toLowerCase();if(t==="development"||t==="production")return t;return}function Ry(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((o)=>o.trim()).includes("development"))return!0}return!1}function Ay(e){if(!e?.trim())return!1;let t=Ey(e).toLowerCase();return t==="node"||t==="node.exe"||t==="bun"||t==="bun.exe"}function Iy(e){return e.some((t)=>t==="--inspect"||t.startsWith("--inspect=")||t==="--inspect-brk"||t.startsWith("--inspect-brk="))}function wy(e){return e.some((t)=>t==="--enable-source-maps")}function Py(e){return e[Fd]?.trim()||"127.0.0.1"}function My(e){let t=e[Hd]?.trim();if(!t)return;let n=Number.parseInt(t,10);return Number.isInteger(n)&&n>0?n:void 0}function Oy(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 si(e={}){let t=e.env??process.env,n=e.execArgv??process.execArgv,o=jd(t[Pn]);if(o)return o;let r=t.NODE_ENV?.trim().toLowerCase();if(r==="production")return"production";if(r==="development")return"development";return Ry(n)?"development":"production"}function zy(e=process.env,t={}){if(jd(e[Pn]))return e;return{...e,[Pn]:si({env:e,execArgv:t.execArgv})}}function Ny(e,t={}){if(e.length===0||!Ay(e[0]))return[...e];if(si(t)!=="development")return[...e];let n=t.env??process.env,o=[...n.NODE_OPTIONS?.split(/\s+/).filter(Boolean)??[],...e.slice(1)],r=[];if(!Iy(o)){let i=Py(n),s=My(n),a=s===void 0?0:s+Oy(t.debugRole);r.push(`--inspect=${i}:${a}`)}if(!wy(o))r.push("--enable-source-maps");return[e[0],...r,...e.slice(1)]}function $y(e){let t=e?.trim();if(!t)return!1;if(t.startsWith("/$bunfs/"))return!0;return t.replace(/\\/g,"/").toLowerCase().startsWith("b:/~bun/")}function Vd(){return globalThis}function Ly(e){Vd().__clineClientIdentity=e}function Dy(){return Vd().__clineClientIdentity}var By="CLINE_ENVIRONMENT",Uy="CLINE_ENVIRONMENT_OVERRIDE",ai={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"}},Zy="production";function qd(e){let t=e?.trim().toLowerCase();if(t==="production"||t==="staging"||t==="local")return t;return}function Gd(){if(typeof process>"u"||!process?.env)return{};return process.env}function Kd(){let e=Gd();return qd(e.CLINE_ENVIRONMENT_OVERRIDE)??qd(e.CLINE_ENVIRONMENT)??"production"}function Fy(e){if(typeof e==="string")return ai[e];return ai[Kd()]}function Hy(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 jy(e){let t=Fy(e);return Hy(t,Gd())}var Vy="CLINE_RUN_AS_HUB_DAEMON",qy="CLINE_CONNECTOR_CLI_LAUNCH",Gy="CLINE_CONNECTOR_STARTING_INSTANCE",Ky="CLINE_CONNECTOR_SUPERVISED",ci;function Wy(e=process.env){return ci=e.CLINE_RUN_AS_HUB_DAEMON==="1",delete e.CLINE_RUN_AS_HUB_DAEMON,ci}function Jy(e){if(e)return e.CLINE_RUN_AS_HUB_DAEMON==="1";return ci??process.env.CLINE_RUN_AS_HUB_DAEMON==="1"}function Yy(e,t=process.env){t.CLINE_CONNECTOR_CLI_LAUNCH=JSON.stringify(e)}var ui;function Xy(e=process.env){return ui=e.CLINE_CONNECTOR_SUPERVISED==="1",delete e.CLINE_CONNECTOR_SUPERVISED,ui}function Qy(e){if(e)return e.CLINE_CONNECTOR_SUPERVISED==="1";return ui??process.env.CLINE_CONNECTOR_SUPERVISED==="1"}function eb(e,t=process.env){t.CLINE_CONNECTOR_STARTING_INSTANCE=JSON.stringify(e)}function tb(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 nb(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((o)=>typeof o==="string")||typeof n.cwd!=="string"||!n.cwd.trim())return;return{launcher:n.launcher,connectArgsPrefix:n.connectArgsPrefix,cwd:n.cwd}}catch{return}}var ob=["HTTP_PROXY","http_proxy","HTTPS_PROXY","https_proxy","ALL_PROXY","all_proxy"],Jd=["localhost","127.0.0.1","::1","[::1]"];function rb(e){for(let t of ob){let n=e[t]?.trim();if(n)return n}return}function li(e){return(e??"").split(",").map((t)=>t.trim()).filter((t)=>t.length>0)}function ib(e,t){let n=[],o=new Set;for(let r of[...li(e),...li(t),...Jd]){let i=r.toLowerCase();if(i!=="*"&&!o.has(i))o.add(i),n.push(r)}return n.join(",")}function Wd(e){return li(e).includes("*")}function sb(e=process.env){if(!rb(e))return;let t=Wd(e.NO_PROXY),n=Wd(e.no_proxy);if(t&&n)return;let o=ib(e.NO_PROXY,e.no_proxy);if(!t)e.NO_PROXY=o;if(!n)e.no_proxy=o}var ab="NoDefaultCurrentDirectoryInExePath";function cb(e={}){let{env:t=process.env,platform:n=process.platform}=e;if(n!=="win32")return;t.NoDefaultCurrentDirectoryInExePath="1"}var ub="agent.reasoning.unexpected_tokens",lb="task.provider_request_started",db="task.provider_stream_started",pb="task.first_chunk_received",mb="task.provider_stream_failed",fb="task.cancelled",gb="task.max_tokens_recovery",hb=["initial","crash_restart","rollout_fallback","rollout_demotion","user_restart"],yb="sdk.error";var De=new Map;function bb(){De.clear()}function xb(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 Sb(e){let t=Date.now(),n=De.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 o=n?.suppressed??0;if(De.delete(e),De.size>=512){let r=De.keys().next();if(!r.done)De.delete(r.value)}return De.set(e,{startMs:t,emitted:1,suppressed:0}),{emit:!0,suppressed:o}}function _b(e,t){e?.capture({event:"agent.reasoning.unexpected_tokens",properties:pi({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 vb(e,t){if(!e)return;e.capture({event:t.event,properties:pi({sessionId:t.sessionId,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?{}:mi(t.error,t.messageLimit),error_class:t.errorClass})})}function Tb(e,t){if(!e)return!1;let n=t.event??"sdk.error",o=Yd(t),r=0;try{let i=Sb(xb(n,o));if(!i.emit)return!0;r=i.suppressed}catch{}return e.capture({event:n,properties:r>0?{...o,suppressed_count:r}:o}),!0}function Yd(e){return pi({...e.context??{},component:e.component,operation:e.operation,severity:e.severity??"error",handled:e.handled??!0,...mi(e.error,e.messageLimit,e.errorMessage)})}function pi(e){let t={};for(let[n,o]of Object.entries(e))if(o!==void 0)t[n]=o;return t}function mi(e,t=500,n){let o=Eb(e)?e:void 0,r=e instanceof Error?e:void 0,i=$t(n)??$t(r?.message)??$t(o?.message)??Rb(e)??"Unknown error",s=Ab(o?.code),a=di(o?.status)??di(o?.statusCode)??di(o?.responseStatus);return{error_type:r?.name?.trim()||$t(o?.name)||r?.constructor?.name||"Error",error_message:kb(Cb(i),t),...s!==void 0?{error_code:s}:{},...a!==void 0?{error_status:a}:{}}}function Cb(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 kb(e,t){let n=Math.max(1,Math.floor(t));return e.length>n?e.substring(0,n):e}function Eb(e){return typeof e==="object"&&e!==null}function $t(e){return typeof e==="string"&&e.trim().length>0?e:void 0}function Rb(e){if(e instanceof Error)return;let t=typeof e==="string"?e:String(e);return t==="[object Object]"?void 0:$t(t)}function Ab(e){if(typeof e==="string"&&e.trim().length>0)return e;if(typeof e==="number"&&Number.isFinite(e))return e;return}function di(e){return typeof e==="number"&&Number.isFinite(e)?e:void 0}var fi="_clineOtlpTraceRelay";function Ib(e){e[fi]=!0}function wb(e){return!!e&&typeof e==="object"&&e[fi]===!0}function Xd(e){let t={};if(!e)return t;return e.split(",").forEach((n)=>{let o=n.indexOf("=");if(o<=0)return;try{let r=decodeURIComponent(n.substring(0,o).trim()),i=decodeURIComponent(n.substring(o+1).trim());if(!r||!i)return;t[r]=i}catch{}}),t}function Pb(){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?Xd(process.env.OTEL_EXPORTER_OTLP_HEADERS):void 0}}function Qd(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 Mb(e={}){return{...Pb(),...e,metadata:Qd(e.metadata)}}function ep(e){let t=e?.trim();return t?t:void 0}function Ob(e,t){if(!e)return;let n=typeof e==="function"?e(t):e;if(!n)return;let o=ep(n.rootSessionId);if(!o)return;return{rootSessionId:o}}function zb(e){return ep(e?.rootSessionId)}import{webcrypto as tp}from"node:crypto";var Nb=128,Pe,it;function $b(e){if(e<0)throw RangeError("Wrong ID size");try{if(!Pe||Pe.length<e)Pe=Buffer.allocUnsafe(e*Nb),tp.getRandomValues(Pe),it=0;else if(it+e>Pe.length)tp.getRandomValues(Pe),it=0}catch(t){throw Pe=void 0,t}it+=e}function Lb(e){return $b(e|=0),Pe.subarray(it-e,it)}function Db(e,t,n){let o=256-256%e.length;if(o===256){let i=e.length-1;return(s=t)=>{if(!s)return"";let a="";while(!0){let c=n(s),l=s;while(l--)if(a+=e[c[l]&i],a.length>=s)return a}}}let r=Math.ceil(409.6*t/o);return(i=t)=>{if(!i)return"";let s="";while(!0){let a=n(r),c=r;while(c--)if(a[c]<o){if(s+=e[a[c]%e.length],s.length>=i)return s}}}}function np(e,t=21){return Db(e,t,Lb)}function Bb(e="",t=""){let n=np("1234567890abcdefghijklmnopqrstuvwxyz",10);return`${e}${Date.now()}_${n(5)}${t}`}var Ub=["idle","running","pending","completed","failed","cancelled"];var gi=["rules","skills","workflows","plugins","hooks"],op=gi,Zb=new Set(gi);function rp(e){return typeof e==="string"&&Zb.has(e)}function Fb(e){if(!Array.isArray(e))return;let t=e.map((n)=>typeof n==="string"?n.trim():"").filter(rp);return[...new Set(t)]}function Hb(e,t){return new Set(e??op).has(t)}var jb=b({rootPath:u().min(1),hint:u().min(1).optional(),associatedRemoteUrls:E(u().min(1)).optional(),latestGitCommitHash:u().min(1).optional(),latestGitBranchName:u().min(1).optional()}),Vb=b({currentWorkspacePath:u().min(1).optional(),workspaces:j(u().min(1),jb)});function HC(){return{workspaces:{}}}function jC(e,t){let n={...e,workspaces:{...e.workspaces,[t.rootPath]:t}};if(!n.currentWorkspacePath)n.currentWorkspacePath=t.rootPath;return Vb.parse(n)}var qb="workspaces",Gb="chat";function Kb(e){let t=e.trim(),n=/^[A-Za-z]:[\\/]/.test(t)||t.startsWith("\\\\"),o=t.startsWith("/");if(!n&&!o)return!1;let r=t.split(n?/[\\/]+/:/\/+/).filter(Boolean),i=r.at(-1)??"",s=r.at(-2)??"",a=r.at(-3)??"";return(r.at(-4)??"")===".cline"&&a==="data"&&s==="workspaces"&&i==="chat"}var Wb=["current_state","boundary_analysis","interface_proposal"],KC=3600000,WC=240,JC=400,le=Gu((e)=>e instanceof Date?e.toISOString():e,u().datetime()),st=I(["pending","in_progress","blocked","completed"]),ip=I(["queued","running","completed","failed","cancelled","interrupted"]),Mn=I(["draft","in_review","finalized"]),Jb=b({agentId:u(),role:I(["lead","teammate"]),description:u().optional(),status:I(["idle","running","stopped"])}),YC=b({agentId:u(),rolePrompt:u(),modelId:u().optional(),maxIterations:x().optional()});function Z(e){return Gu((t)=>t===null?void 0:t,e.optional())}var XC=b({agentId:u().min(1).describe("Teammate identifier"),rolePrompt:u().min(1).describe("System prompt describing teammate role")}).strict(),QC=b({agentId:u().min(1).describe("Teammate identifier"),reason:Z(u().min(1)).describe("Optional shutdown reason")}),ek=b({}),Yb={create:["title","description"],list:[],claim:["taskId"],complete:["taskId","summary"],block:["taskId","reason"]},tk={create:["status","taskId","summary","reason"]},nk=b({action:I(["create","list","claim","complete","block"]),title:Z(u().min(1)).describe("Task title"),description:Z(u().min(1)).describe("Task details"),dependsOn:Z(E(u().describe("Dependency task ID"))).describe("Array of dependency task IDs"),assignee:Z(u().min(1)).describe("Optional assignee"),status:Z(I(["pending","in_progress","blocked","completed"])).describe("Optional task status filter"),taskId:Z(u()).describe("Task ID"),summary:Z(u().min(1)).describe("Completion summary"),reason:Z(u().min(1)).describe("Blocking reason")}).superRefine((e,t)=>{for(let n of Yb[e.action]){if(e[n]!==void 0)continue;t.addIssue({code:"custom",path:[n],message:`Field "${n}" is required when action=${e.action}`})}}),ok=b({agentId:u().describe("Teammate agent ID"),task:u().min(1).describe("Task instructions for the teammate"),taskId:Z(u()).describe("Optional shared task list ID"),runMode:Z(I(["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:Z(w()).describe("If true, continue the teammate conversation; otherwise start fresh")}),rk=b({status:Z(I(["queued","running","completed","failed","cancelled","interrupted"])).describe("Optional run status filter. Omit to include all statuses."),agentId:Z(u().min(1)).describe("Optional teammate ID filter. Omit to include all teammates."),includeCompleted:Z(w()).describe("Include completed/failed runs (default true)")}),ik=b({runId:u().min(1).describe("Run ID"),reason:Z(u().min(1)).describe("Optional cancellation reason")}),sk=b({runId:Z(u().min(1)).describe("Optional async run ID to await. Omit to wait for all active async runs.")}).strict(),ak=b({toAgentId:u().min(1).describe("Recipient agent ID"),subject:u().min(1).describe("Message subject"),body:u().min(1).describe("Message body"),taskId:Z(u().min(1)).describe("Optional task ID context")}),ck=b({subject:u().min(1).describe("Message subject"),body:u().min(1).describe("Message body"),taskId:Z(u().min(1)).describe("Optional task ID context")}),uk=b({unreadOnly:Z(w()).describe("Only unread messages for read action (default true)")}),lk=b({kind:I(["progress","handoff","blocked","decision","done","error"]),summary:u().min(1).describe("Update summary"),taskId:Z(u().min(1)).describe("Optional task ID context"),evidence:Z(E(u().min(1))).describe("Optional evidence links/snippets"),nextAction:Z(u().min(1)).describe("Planned next step")}),dk=b({}),pk=b({title:u().describe("Outcome title"),requiredSections:E(u()).default(Wb).describe("Required sections for finalization gate (defaults to current_state,boundary_analysis,interface_proposal)")}),mk=b({outcomeId:u().describe("Outcome ID"),section:u().describe("Section name"),sourceRunId:Z(u()).describe("Optional source run ID"),content:u().describe("Section fragment content")}),fk=b({fragmentId:u().describe("Fragment ID"),approved:w().describe("Review decision")}),gk=b({outcomeId:u().describe("Outcome ID")}),hk=b({}),yk=b({teamId:u(),teamName:u(),members:E(Jb),taskCounts:j(st,x()),unreadMessages:x(),missionLogEntries:x(),activeRuns:x(),queuedRuns:x(),outcomeCounts:j(Mn,x())}),Xb=b({id:u(),title:u(),description:u(),status:st,createdAt:le,updatedAt:le,createdBy:u(),assignee:u().optional(),dependsOn:E(u()),summary:u().optional(),isReady:w(),blockedBy:E(u())}),bk=ar("action",[b({action:V("create"),taskId:u(),status:st,ignoredFields:E(u()).optional(),note:u().optional()}),b({action:V("list"),tasks:E(Xb)}),b({action:V("claim"),taskId:u(),status:st,nextStep:u()}),b({action:V("complete"),taskId:u(),status:st}),b({action:V("block"),taskId:u(),status:st})]),xk=b({agentId:u(),mode:I(["sync","async"]),status:I(["dispatched","running","queued","joined"]),dispatched:w(),message:u(),deduped:w().optional(),runId:u().optional(),text:u().optional(),iterations:x().optional()}),Qb=b({textPreview:u(),iterations:x(),finishReason:u(),durationMs:x(),usage:b({inputTokens:x(),outputTokens:x(),cacheReadTokens:x().optional(),cacheWriteTokens:x().optional(),totalCost:x().optional()})}),Sk=b({id:u(),agentId:u(),taskId:u().optional(),status:ip,messagePreview:u(),priority:x(),retryCount:x(),maxRetries:x(),nextAttemptAt:le.optional(),continueConversation:w().optional(),startedAt:le,endedAt:le.optional(),leaseOwner:u().optional(),heartbeatAt:le.optional(),lastProgressAt:le.optional(),lastProgressMessage:u().optional(),currentActivity:u().optional(),error:u().optional(),resultSummary:Qb.optional()}),_k=b({id:u(),teamId:u(),fromAgentId:u(),toAgentId:u(),subject:u(),body:u(),taskId:u().optional(),sentAt:le,readAt:le.optional()}),vk=b({id:u(),teamId:u(),title:u(),status:Mn,requiredSections:E(u()),createdBy:u(),createdAt:le,finalizedAt:le.optional()}),Tk=b({outcomeId:u(),status:Mn,requiredSections:E(u())}),Ck=b({agentId:u(),status:u()}),kk=b({runId:u(),status:ip}),Ek=b({id:u(),toAgentId:u()}),Rk=b({delivered:x()}),Ak=b({id:u()}),Ik=b({status:u()}),wk=b({fragmentId:u(),status:u()}),Pk=b({outcomeId:u(),status:Mn});var ex;((R)=>{R.TaskStart="task_start";R.TaskEnd="task_end";R.AgentEvent="agent_event";R.TeammateSpawned="teammate_spawned";R.TeammateShutdown="teammate_shutdown";R.TeamTaskUpdated="team_task_updated";R.TeamMessage="team_message";R.TeamMissionLog="team_mission_log";R.TeamTaskCompleted="team_task_completed";R.RunStarted="run_started";R.RunQueued="run_queued";R.RunProgress="run_progress";R.RunCompleted="run_completed";R.RunFailed="run_failed";R.RunCancelled="run_cancelled";R.RunInterrupted="run_interrupted";R.OutcomeCreated="outcome_created";R.OutcomeFragmentAttached="outcome_fragment_attached";R.OutcomeFragmentReviewed="outcome_fragment_reviewed";R.OutcomeFinalized="outcome_finalized"})(ex||={});function tx(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 o of["oneOf","anyOf","allOf"]){let r=n[o];if(!Array.isArray(r)||r.length===0)continue;if(o==="allOf"){if(r.some((a)=>a&&typeof a==="object"&&a.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(r.every((s)=>s&&typeof s==="object"&&s.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 "${o}" 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 nx(e){let t=tx(e.inputSchema instanceof N?jr(e.inputSchema):e.inputSchema);return{name:e.name,resultPolicy:e.resultPolicy,description:e.description,inputSchema:t,lifecycle:e.lifecycle,executionMode:e.executionMode,timeoutMs:e.timeoutMs??30000,retryable:e.retryable??!0,maxRetries:e.maxRetries??3,execute:e.execute}}var sp=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function ox(e){let t=(e instanceof Error?e.message:String(e)).toLowerCase();return sp.some((n)=>t.includes(n))}import{existsSync as rx,mkdirSync as ix,readFileSync as sx,writeFileSync as ax}from"node:fs";import{dirname as cx,resolve as ux}from"node:path";var lx=new Set(["accesskeyid","secretaccesskey","idtoken","refreshtoken","accesstoken","access_token","refresh_token","apikey","api_key","authorization","password","secret","token","email","displayname","display_name","userinfo"]),dx=["id","balance","cost","secret"];function px(e){let t=e.toLowerCase();if(lx.has(t))return!0;for(let n of dx){if(t===n)return!0;if(t.endsWith(n)&&t.length>n.length){let o=t[t.length-n.length-1];if(o==="_"||o==="-")return!0;let r=e[e.length-n.length];if(r&&r===r.toUpperCase()&&r!==r.toLowerCase())return!0}if(t.endsWith(`_${n}`))return!0}return!1}var mx=[{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 cp(e){let t=e;for(let{pattern:n,replacement:o}of mx)t=t.replace(n,o);return t}function hi(e){if(Array.isArray(e))return e.map(hi);if(!e||typeof e!=="object")return e;return Object.fromEntries(Object.entries(e).sort(([t],[n])=>fx(t,n)).map(([t,n])=>[t,hi(n)]))}function fx(e,t){if(e<t)return-1;if(e>t)return 1;return 0}function ap(e){return JSON.stringify(hi(e))}var gx=[{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 yi(e){let t=e;for(let{pattern:n,replacement:o}of gx)t=t.replace(n,o);return t}function at(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(at(t))}catch{}return cp(e)}if(Array.isArray(e))return e.map(at);if(typeof e==="object"){let t={};for(let[n,o]of Object.entries(e))if(px(n)&&(typeof o==="string"||typeof o==="number"))t[n]="REDACTED";else t[n]=at(o);return t}return e}function hx(e){let t=new URLSearchParams(e),n=Array.from(t.entries());if(n.length===0||n.some(([r])=>r.length===0))return;let o={};for(let[r,i]of n){let s=o[r];if(s===void 0)o[r]=i;else if(Array.isArray(s))s.push(i);else o[r]=[s,i]}return o}function yx(e){return e?.toLowerCase().split(";")[0]?.trim()==="application/x-www-form-urlencoded"}function up(e,t){try{return ap(at(JSON.parse(e)))}catch{if(yx(t)){let n=hx(e);if(n)return ap(at(n))}return cp(e)}}function bx(e,t){let n={...e},o=t&&e.body!==void 0?up(e.body,e.requestContentType):void 0;if(delete n.body,delete n.requestContentType,o!==void 0)n.requestBody=o;if(typeof n.path==="string")n.path=yi(n.path);if(n.response!==void 0)n.response=at(n.response);return n}function lp(e){try{let t=new URL(e),n=`${t.protocol}//${t.host}`,o=t.pathname+t.search;return{scope:n,path:o}}catch{return{scope:"",path:e}}}function dp(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 pp(e,t){if(t?.method)return t.method.toUpperCase();if(e&&typeof e.method==="string")return e.method.toUpperCase();return"GET"}function xx(e){if(!e)return;return new Headers(e).get("content-type")??void 0}function mp(e,t){let n=xx(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 fp(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 Sx(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
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=cx(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 Sx(e,t,n){let r=[],o=[],i=globalThis.fetch;function s(d){if(d.finalized)return;d.finalized=!0;let p=new TextDecoder,m=d.chunks.map((g)=>p.decode(g,{stream:!0})).join("")+p.decode(),f;try{f=JSON.parse(m)}catch{f=m}r.push({scope:d.scope,method:d.method,path:d.path,body:d.body,requestContentType:d.requestContentType,status:d.status,response:f,responseIsBinary:!1,contentType:d.contentType})}globalThis.fetch=Object.assign(async(d,p)=>{let m=dp(d),f=pp(d,p),{scope:g,path:y}=lp(m),S=await fp(d,p),v=mp(d,p),k=await i(d,p);if(t&&!y.includes(t))return k;let M=k.headers.get("content-type")??void 0;if(!k.body)return r.push({scope:g,method:f,path:y,body:S??"",requestContentType:v,status:k.status,response:"",responseIsBinary:!1,contentType:M}),k;let R={scope:g,method:f,path:y,body:S??"",requestContentType:v,status:k.status,contentType:M,chunks:[],finalized:!1};o.push(R);let B=k.body,A=new TransformStream({transform(Te,Me){R.chunks.push(Te),Me.enqueue(Te)},flush(){s(R)}}),J=B.pipeThrough(A);return new Response(J,{status:k.status,statusText:k.statusText,headers:k.headers})},{preconnect:(d)=>{}});let a=t?`matching path "*${t}*"`:"all paths";process.stderr.write(`[VCR] Recording HTTP requests (${a}). Cassette will be saved to: ${e}
181
- `);let c=!1;go(()=>{if(c)return;c=!0,globalThis.fetch=i;for(let m of o)s(m);if(r.length===0){process.stderr.write(`[VCR] No HTTP requests${t?` matching "${t}"`:""} were recorded.
182
- `);return}let d=ax(e);ox(d,{recursive:!0});let p=r.map((m)=>yx(m,n));sx(e,JSON.stringify(p,null,2)),process.stderr.write(`[VCR] Saved ${p.length} recorded HTTP interaction(s) to ${e}
183
- `)})}function _x(e){let t=[],n=e.split(/\n\n/);for(let r of n){let o=r.trim();if(o)t.push(`${o}
180
+ `),process.exit(1);let t=ux(process.env.CLINE_VCR_CASSETTE),n=process.env.CLINE_VCR_FILTER??"",o=process.env.CLINE_VCR_INCLUDE_REQUEST_BODY==="1"||process.env.CLINE_VCR_INCLUDE_REQUEST_BODY==="true";return{mode:e,cassettePath:t,filter:n,includeRequestBody:o}}function _x(e,t,n){let o=[],r=[],i=globalThis.fetch;function s(d){if(d.finalized)return;d.finalized=!0;let p=new TextDecoder,m=d.chunks.map((g)=>p.decode(g,{stream:!0})).join("")+p.decode(),f;try{f=JSON.parse(m)}catch{f=m}o.push({scope:d.scope,method:d.method,path:d.path,body:d.body,requestContentType:d.requestContentType,status:d.status,response:f,responseIsBinary:!1,contentType:d.contentType})}globalThis.fetch=Object.assign(async(d,p)=>{let m=dp(d),f=pp(d,p),{scope:g,path:y}=lp(m),S=await fp(d,p),v=mp(d,p),k=await i(d,p);if(t&&!y.includes(t))return k;let M=k.headers.get("content-type")??void 0;if(!k.body)return o.push({scope:g,method:f,path:y,body:S??"",requestContentType:v,status:k.status,response:"",responseIsBinary:!1,contentType:M}),k;let R={scope:g,method:f,path:y,body:S??"",requestContentType:v,status:k.status,contentType:M,chunks:[],finalized:!1};r.push(R);let B=k.body,A=new TransformStream({transform(Te,Me){R.chunks.push(Te),Me.enqueue(Te)},flush(){s(R)}}),J=B.pipeThrough(A);return new Response(J,{status:k.status,statusText:k.statusText,headers:k.headers})},{preconnect:(d)=>{}});let a=t?`matching path "*${t}*"`:"all paths";process.stderr.write(`[VCR] Recording HTTP requests (${a}). Cassette will be saved to: ${e}
181
+ `);let c=!1;gr(()=>{if(c)return;c=!0,globalThis.fetch=i;for(let m of r)s(m);if(o.length===0){process.stderr.write(`[VCR] No HTTP requests${t?` matching "${t}"`:""} were recorded.
182
+ `);return}let d=cx(e);ix(d,{recursive:!0});let p=o.map((m)=>bx(m,n));ax(e,JSON.stringify(p,null,2)),process.stderr.write(`[VCR] Saved ${p.length} recorded HTTP interaction(s) to ${e}
183
+ `)})}function vx(e){let t=[],n=e.split(/\n\n/);for(let o of n){let r=o.trim();if(r)t.push(`${r}
184
184
 
185
- `)}return t}function vx(e,t){let n=new TextEncoder,r=0;return new ReadableStream({async pull(o){if(r>=e.length){o.close();return}if(r>0&&t>0)await new Promise((s)=>setTimeout(s,t));let i=e[r];if(i===void 0){o.close();return}o.enqueue(n.encode(i)),r+=1}})}async function Tx(e){if(e.recording.requestBody===void 0)return;let t=await fp(e.requestInput,e.requestInit),n=mp(e.requestInput,e.requestInit),r=up(t??"",n);if(r!==e.recording.requestBody)throw Error(`[VCR] Request body mismatch for ${e.method} ${e.path}.
185
+ `)}return t}function Tx(e,t){let n=new TextEncoder,o=0;return new ReadableStream({async pull(r){if(o>=e.length){r.close();return}if(o>0&&t>0)await new Promise((s)=>setTimeout(s,t));let i=e[o];if(i===void 0){r.close();return}r.enqueue(n.encode(i)),o+=1}})}async function Cx(e){if(e.recording.requestBody===void 0)return;let t=await fp(e.requestInput,e.requestInit),n=mp(e.requestInput,e.requestInit),o=up(t??"",n);if(o!==e.recording.requestBody)throw Error(`[VCR] Request body mismatch for ${e.method} ${e.path}.
186
186
  expected: ${e.recording.requestBody}
187
- actual: ${r}
188
- Re-record the cassette if the request change is intentional.`)}function Cx(e,t){if(!rx(e))process.stderr.write(`[VCR] Cassette file not found: ${e}
189
- `),process.exit(1);let n=JSON.parse(ix(e,"utf-8")),r=Number.parseInt(process.env.CLINE_VCR_SSE_DELAY??"100",10),o=Array(n.length).fill(!1),i=globalThis.fetch;globalThis.fetch=Object.assign(async(a,c)=>{let l=dp(a),d=pp(a,c),{path:p}=lp(l),m=yi(p);if(t&&!p.includes(t))return i(a,c);let f=n.findIndex((g,y)=>{if(o[y])return!1;let S=yi(g.path);return g.method.toUpperCase()===d&&S===m});if(f>=0){let g=n[f];if(!g)return i(a,c);await Tx({recording:g,requestInput:a,requestInit:c,method:d,path:m}),o[f]=!0;let y=typeof g.response==="string"?g.response:JSON.stringify(g.response),S=new Headers;if(g.contentType)S.set("content-type",g.contentType);else if(typeof g.response==="string"&&g.response.trimStart().startsWith("data:"))S.set("content-type","text/event-stream");else if(typeof g.response==="object")S.set("content-type","application/json");let v=S.get("content-type")?.includes("text/event-stream")??!1;if(v)S.set("cache-control","no-cache"),S.set("connection","keep-alive");if(v&&typeof g.response==="string"){let k=_x(g.response);if(k.length>1){let M=vx(k,r);return new Response(M,{status:g.status,headers:S})}}return new Response(y,{status:g.status,headers:S})}if(!t)throw Error(`[VCR] No matching recording for ${d} ${l} (path: ${m}). ${n.length} recording(s) loaded from ${e}.`);return i(a,c)},{preconnect:(a)=>{}});let s=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} ${s}
190
- `)}function kx(e){let t=xx(e);if(!t)return;if(t.mode==="record")Sx(t.cassettePath,t.filter,t.includeRequestBody);else Cx(t.cassettePath,t.filter)}export{cb as AGENT_UNEXPECTED_REASONING_TOKENS_EVENT,gy as APIKeySchema,sp as AUTH_ERROR_PATTERNS,iv as AgentConfigSchema,Lf as AgentFinishReasonSchema,ov as AgentResultSchema,Df as AgentUsageSchema,Dd as AllowedMCPServerSchema,$d as AnthropicModelSchema,Ld as AnthropicSchema,Af as ApiFormat,Ku as ApiFormatSchema,Ad as AwsBedrockCustomModelSchema,Rd as AwsBedrockModelSchema,wd as AwsBedrockSettingsSchema,Kg as CHARS_PER_TOKEN,Pn as CLINE_BUILD_ENV_ENV,qb as CLINE_CHAT_WORKSPACE_DIRECTORY_NAME,Vy as CLINE_CONNECTOR_CLI_LAUNCH_ENV,qy as CLINE_CONNECTOR_STARTING_INSTANCE_ENV,Gy as CLINE_CONNECTOR_SUPERVISED_ENV,Fd as CLINE_DEBUG_HOST_ENV,Hd as CLINE_DEBUG_PORT_BASE_ENV,Dh as CLINE_DEFAULT_MODEL_ID,xy as CLINE_DEFAULT_RPC_ADDRESS,by as CLINE_DEFAULT_RPC_PORT,ai as CLINE_ENVIRONMENTS,Dy as CLINE_ENVIRONMENT_ENV,By as CLINE_ENVIRONMENT_OVERRIDE_ENV,yy as CLINE_HUB_DEV_PORT,hy as CLINE_HUB_PORT,jy as CLINE_RUN_AS_HUB_DAEMON_ENV,Vb as CLINE_WORKSPACES_DIRECTORY_NAME,Jv as CONFIGURABLE_MODEL_TOOL_NAMES,al as CONNECTOR_CATALOG,ll as CONNECTOR_PLATFORMS,gb as CORE_SPAWN_REASONS,xv as CURRENT_HUB_PROTOCOL_VERSION,Id as ClineModelSchema,Pd as ClineSettingsSchema,Uf as ConnectorAuthorizationDecisionSchema,Bf as ConnectorAuthorizationRequestSchema,il as ConnectorEventActorSchema,sl as ConnectorEventContextSchema,ol as ConnectorHookEventNameSchema,Zf as ConnectorHookEventSchema,ho as ContributionRegistry,Uy as DEFAULT_CLINE_ENVIRONMENT,xo as DEFAULT_MAX_IMAGE_BASE64_BYTES,Se as DEFAULT_MAX_IMAGE_DECODED_BYTES,fe as DEFAULT_MAX_IMAGE_ENCODED_BYTES,Il as DEFAULT_MAX_TOTAL_MEDIA_BYTES,nT as DEFAULT_MCP_TIMEOUT_SECONDS,Kb as DEFAULT_OUTCOME_REQUIRED_SECTIONS,jg as DEFAULT_REASONING_EFFORT,rp as DEFAULT_RUNTIME_CONFIG_EXTENSIONS,Mt as EMPTY_CONTENT_TEXT,Zd as EnterpriseTelemetrySchema,rg as FEATURE_FLAGS,Ke as FeatureFlag,ng as FeatureFlagDefaultValue,El as GeneratedMediaModalitySchema,wl as GeneratedMediaSchema,Rl as GeneratedMediaSourceSchema,ii as GlobalInstructionsFileSchema,vv as HUB_CAPABILITIES,Nv as HUB_CHECKPOINT_CAPABILITY,Cv as HUB_CLIENT_TOOL_APPROVAL_CAPABILITY,Av as HUB_COMMAND_SLOW_LOG_MS,zv as HUB_COMPACTION_CAPABILITY,Mv as HUB_CUSTOM_TOOL_CAPABILITY_PREFIX,fg as HUB_DEFAULT_COMMAND_TIMEOUT_MS,Ov as HUB_HOOK_CAPABILITY_PREFIX,$v as HUB_MISTAKE_LIMIT_CAPABILITY,bl as HUB_SCHEDULE_MODES,Pv as HUB_TOOL_EXECUTOR_CAPABILITY_PREFIX,hg as HUB_TOOL_EXECUTOR_NAMES,Lv as HUB_USER_INSTRUCTIONS_SNAPSHOT_CAPABILITY,hl as HookEventNameSchema,yl as HookEventPayloadSchema,We as IMAGE_OMITTED_PLACEHOLDER,Je as IMAGE_UNSUPPORTED_PLACEHOLDER,Jd as LOOPBACK_NO_PROXY_HOSTS,zd as LiteLLMModelSchema,Nd as LiteLLMSchema,_v as MAX_CLIENT_HUB_PROTOCOL_VERSION,oT as MAX_MCP_TIMEOUT_SECONDS,Sv as MIN_CLIENT_HUB_PROTOCOL_VERSION,rT as MIN_MCP_TIMEOUT_SECONDS,Wv as MODEL_TOOL_NAMES,od as MODE_TAG_INSTRUCTIONS,Wu as ModelCapabilitySchema,bn as ModelInfoSchema,Qu as ModelMetadataSchema,el as ModelModalitiesSchema,po as ModelModalitySchema,rl as ModelOperationModeSchema,nl as ModelOperationSchema,Yu as ModelPricingSchema,lo as ModelReasoningOptionSchema,Ju as ModelStatusSchema,sb as NO_DEFAULT_CURRENT_DIRECTORY_IN_EXE_PATH_ENV,kv as ONE_TIME_SCHEDULE_CRON_PATTERN,Ev as ONE_TIME_SCHEDULE_RUN_AT_METADATA_KEY,fi as OTLP_TRACE_RELAY_MARKER,kd as OpenAiCompatibleModelSchema,Ed as OpenAiCompatibleSchema,sd as PLAN_MODE_INSTRUCTIONS,ad as PLAN_MODE_INSTRUCTIONS_MANUAL_SWITCH,tg as PLUGIN_FILE_EXTENSIONS,Ud as PromptUploadingSchema,Sy as ProviderCapabilitySchema,vy as ProviderClientSchema,_y as ProviderProtocolSchema,zt as REASONING_EFFORT_RATIOS,hn as REASONING_LEVELS,md as REMOTE_CONFIG_SESSION_BLOB_UPLOAD_METADATA_KEY,ny as REMOTE_URI_SCHEME,gi as RUNTIME_CONFIG_EXTENSION_KINDS,yn as ReasoningEffortSchema,uo as ReasoningLevelSchema,fy as RemoteConfigSchema,Bd as RemoteMCPServerSchema,In as S3AccessKeySettingsSchema,hb as SDK_ERROR_TELEMETRY_EVENT,Tl as SESSION_SEARCH_PREVIEW_MAX_LENGTH,vl as SESSION_SEARCH_TITLE_MAX_LENGTH,Bb as SESSION_STATUS_VALUES,_n as SUPPORTED_IMAGE_MEDIA_TYPES,mb as TASK_CANCELLED_EVENT,db as TASK_FIRST_CHUNK_RECEIVED_EVENT,fb as TASK_MAX_TOKENS_RECOVERY_EVENT,ub as TASK_PROVIDER_REQUEST_STARTED_EVENT,pb as TASK_PROVIDER_STREAM_FAILED_EVENT,lb as TASK_PROVIDER_STREAM_STARTED_EVENT,qC as TEAM_AWAIT_TIMEOUT_MS,Cy as TEAM_LIFECYCLE_EVENT_TYPE,Ty as TEAM_PROGRESS_EVENT_TYPE,GC as TEAM_RUN_MESSAGE_PREVIEW_LIMIT,KC as TEAM_RUN_TEXT_PREVIEW_LIMIT,QC as TEAM_TASK_IGNORED_FIELDS_BY_ACTION,$f as TOOL_REJECTION_SUFFIX,dk as TeamAttachOutcomeFragmentInputSchema,ok as TeamAwaitRunsInputSchema,sk as TeamBroadcastInputSchema,kk as TeamBroadcastToolResultSchema,rk as TeamCancelRunInputSchema,Tk as TeamCancelRunToolResultSchema,uk as TeamCleanupInputSchema,Rk as TeamCleanupToolResultSchema,lk as TeamCreateOutcomeInputSchema,_k as TeamCreateOutcomeToolResultSchema,mk as TeamFinalizeOutcomeInputSchema,wk as TeamFinalizeOutcomeToolResultSchema,fk as TeamListOutcomesInputSchema,nk as TeamListRunsInputSchema,xk as TeamMailboxMessageToolResultSchema,Qb as TeamMessageType,ck as TeamMissionLogInputSchema,Ek as TeamMissionLogToolResultSchema,Ak as TeamOutcomeFragmentToolResultSchema,Sk as TeamOutcomeToolResultSchema,ak as TeamReadMailboxInputSchema,pk as TeamReviewOutcomeFragmentInputSchema,Xb as TeamRunResultSummarySchema,tk as TeamRunTaskInputSchema,yk as TeamRunTaskToolResultSchema,bk as TeamRunToolSummarySchema,ik as TeamSendMessageInputSchema,Ck as TeamSendMessageToolResultSchema,YC as TeamShutdownTeammateInputSchema,vk as TeamSimpleAgentStatusToolResultSchema,JC as TeamSpawnTeammateInputSchema,XC as TeamStatusInputSchema,gk as TeamStatusToolResultSchema,ek as TeamTaskInputSchema,Yb as TeamTaskListItemToolResultSchema,hk as TeamTaskToolResultSchema,WC as TeamTeammateSpecSchema,Xu as ThinkingConfigSchema,fo as ToolCallRecordSchema,qv as USAGE_COST_DISPLAYS,Nf as USER_REJECTED_TOOL_REASON,Md as VertexModelSchema,Od as VertexSettingsSchema,Hb as WorkspaceInfoSchema,jb as WorkspaceManifestSchema,zy as augmentNodeCommandForDebug,Lh as buildClineSystemPrompt,Ff as buildConnectorConnectArgs,qh as buildRemoteConfigSessionBlobUploadMetadata,Yd as buildSdkErrorProperties,Sb as captureAgentUnexpectedReasoningTokens,vb as captureSdkError,_b as captureTaskLifecycleEvent,Ky as claimHubDaemonProcess,Yy as claimSupervisedConnectorProcess,Xg as clampMcpTimeoutSeconds,uy as clearMaterializedRemoteConfigRuntime,Kh as clearRemoteConfigSessionBlobUpload,Vf as connectorChannelsFromPlatforms,Pb as createClineTelemetryServiceConfig,Qd as createClineTelemetryServiceMetadata,eg as createContributionRegistry,vn as createMediaBudgetState,Tg as createModeSwitchNoticeTracker,ty as createRemoteConfigSessionMessagesArtifactUploader,Db as createSessionId,tx as createTool,fh as decodeJwtPayload,Dv as describeOutdatedHubSessions,ab as disableCurrentDirectoryExecutableSearch,Wf as disposeAll,ZC as emptyWorkspaceManifest,ib as ensureLoopbackProxyBypass,Wg as estimateRequestInputTokens,Zl as estimateTokens,bo as formatDisplayUserInput,yo as formatFileContentBlock,Mh as formatHumanReadableDate,sT as formatMcpTimeoutErrorMessage,Fg as formatMessagesForAiSdk,vg as formatModeSwitchNotice,Ag as formatSessionSearchPreview,Rg as formatSessionSearchTitle,Oh as formatUptime,xg as formatUserCommandBlock,bg as formatUserInputBlock,Ig as generatedMediaModalityFromMediaType,Ly as getClineClientIdentity,Hy as getClineEnvironmentConfig,gg as getDefaultHubCommandTimeoutMs,bh as getDefaultShell,eh as getErrorCode,Qg as getErrorMessage,rt as getPowerShellEdition,Eh as getShellArgs,Ql as getShellInvocation,Ho as getShellKind,Fb as hasRuntimeConfigExtension,So as imageBase64DecodedByteLength,Pg as imageBase64EncodedByteLength,_o as imageBase64LengthForDecodedBytes,Mg as imageFileMaxDecodedBytesForBase64Limit,kx as initVcr,Pl as isBase64Char,Ny as isBunEmbeddedModulePath,Og as isCanonicalBase64,If as isChatCompatibleModel,Gb as isChatWorkspacePath,Vo as isClineProvider,wg as isGeneratedMedia,Wy as isHubDaemonProcess,Tv as isHubProtocolCompatible,mg as isHubScheduleMode,Iv as isHubToolExecutorName,nx as isLikelyAuthError,Yg as isMcpTimeoutConfigured,wb as isOtlpTraceRelayProvider,op as isRuntimeConfigExtensionKind,Xy as isSupervisedConnectorProcess,wf as isTranscriptionModel,cl as listConnectorCatalog,Ab as markOtlpTraceRelayProvider,Ih as maskSecret,jf as mergeConnectorConnectArgs,Hg as mergeModelOptions,mo as modelHasCapability,Pf as modelProducesImages,zf as modelSupportsImageInput,Of as modelSupportsToolCalling,Jg as noopBasicLogger,Fo as normalizeJsonLikeStringsForSchema,gl as normalizePluginManifest,mi as normalizeSdkError,Sl as normalizeUserInput,gh as omitUndefinedValues,pg as parseHookEventPayload,ch as parseJsonStream,Zb as parseRuntimeConfigExtensions,xl as parseUserCommandEnvelope,_g as parseUserInputMode,py as prepareRemoteConfigRuntime,$h as processWorkspaceInfo,tb as readConnectorCliLaunchSpec,Rv as readHubScheduleMode,yd as readRemoteConfigSessionBlobUploadMetadata,eb as readStartingConnectorInstance,go as registerDisposable,Gh as registerRemoteConfigSessionBlobUpload,It as reserveImageMediaBytes,yb as resetSdkErrorRateLimiterForTests,si as resolveClineBuildEnv,Kd as resolveClineEnvironment,Vg as resolveEffectiveReasoningEffort,Mb as resolveHookSessionContext,wv as resolveHubCommandTimeoutMs,iT as resolveMcpTimeoutSeconds,vo as resolveMediaBudget,qg as resolveReasoningBudgetFromRatio,Ul as resolveReasoningEffortRatio,Ob as resolveRootSessionId,lh as safeJsonParse,uh as safeJsonStringify,Rh as sanitizeFileName,ae as sanitizeSurrogates,Gg as serializeAbortReason,$y as setClineClientIdentity,Jy as setConnectorCliLaunchSpec,Qy as setStartingConnectorInstance,ul as shouldIncludeConnectorField,_l as stripModeNotices,Ph as stripUtf8Bom,tl as supportsChatModalities,Dl as toAiSdkToolResultOutput,yh as toPosixSeparators,Ah as trimNonEmpty,wh as truncateSplit,ed as truncateStr,FC as upsertWorkspaceInfo,Mf as usesImageGenerationOperation,zg as validateAndReserveBase64Media,Pt as validateAndReserveImageMedia,Ol as validateImageMedia,zh as validateWithZod,Oy as withResolvedClineBuildEnv,kl as xmlTagsRemoval,jo as zodToJsonSchema};
187
+ actual: ${o}
188
+ Re-record the cassette if the request change is intentional.`)}function kx(e,t){if(!rx(e))process.stderr.write(`[VCR] Cassette file not found: ${e}
189
+ `),process.exit(1);let n=JSON.parse(sx(e,"utf-8")),o=Number.parseInt(process.env.CLINE_VCR_SSE_DELAY??"100",10),r=Array(n.length).fill(!1),i=globalThis.fetch;globalThis.fetch=Object.assign(async(a,c)=>{let l=dp(a),d=pp(a,c),{path:p}=lp(l),m=yi(p);if(t&&!p.includes(t))return i(a,c);let f=n.findIndex((g,y)=>{if(r[y])return!1;let S=yi(g.path);return g.method.toUpperCase()===d&&S===m});if(f>=0){let g=n[f];if(!g)return i(a,c);await Cx({recording:g,requestInput:a,requestInit:c,method:d,path:m}),r[f]=!0;let y=typeof g.response==="string"?g.response:JSON.stringify(g.response),S=new Headers;if(g.contentType)S.set("content-type",g.contentType);else if(typeof g.response==="string"&&g.response.trimStart().startsWith("data:"))S.set("content-type","text/event-stream");else if(typeof g.response==="object")S.set("content-type","application/json");let v=S.get("content-type")?.includes("text/event-stream")??!1;if(v)S.set("cache-control","no-cache"),S.set("connection","keep-alive");if(v&&typeof g.response==="string"){let k=vx(g.response);if(k.length>1){let M=Tx(k,o);return new Response(M,{status:g.status,headers:S})}}return new Response(y,{status:g.status,headers:S})}if(!t)throw Error(`[VCR] No matching recording for ${d} ${l} (path: ${m}). ${n.length} recording(s) loaded from ${e}.`);return i(a,c)},{preconnect:(a)=>{}});let s=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} ${s}
190
+ `)}function Ex(e){let t=Sx(e);if(!t)return;if(t.mode==="record")_x(t.cassettePath,t.filter,t.includeRequestBody);else kx(t.cassettePath,t.filter)}export{ub as AGENT_UNEXPECTED_REASONING_TOKENS_EVENT,hy as APIKeySchema,sp as AUTH_ERROR_PATTERNS,sv as AgentConfigSchema,Lf as AgentFinishReasonSchema,iv as AgentResultSchema,Df as AgentUsageSchema,Dd as AllowedMCPServerSchema,$d as AnthropicModelSchema,Ld as AnthropicSchema,Af as ApiFormat,Ku as ApiFormatSchema,Ad as AwsBedrockCustomModelSchema,Rd as AwsBedrockModelSchema,Id as AwsBedrockSettingsSchema,Kg as CHARS_PER_TOKEN,Pn as CLINE_BUILD_ENV_ENV,Gb as CLINE_CHAT_WORKSPACE_DIRECTORY_NAME,qy as CLINE_CONNECTOR_CLI_LAUNCH_ENV,Gy as CLINE_CONNECTOR_STARTING_INSTANCE_ENV,Ky as CLINE_CONNECTOR_SUPERVISED_ENV,Fd as CLINE_DEBUG_HOST_ENV,Hd as CLINE_DEBUG_PORT_BASE_ENV,Bh as CLINE_DEFAULT_MODEL_ID,Sy as CLINE_DEFAULT_RPC_ADDRESS,xy as CLINE_DEFAULT_RPC_PORT,ai as CLINE_ENVIRONMENTS,By as CLINE_ENVIRONMENT_ENV,Uy as CLINE_ENVIRONMENT_OVERRIDE_ENV,by as CLINE_HUB_DEV_PORT,yy as CLINE_HUB_PORT,Vy as CLINE_RUN_AS_HUB_DAEMON_ENV,qb as CLINE_WORKSPACES_DIRECTORY_NAME,Yv as CONFIGURABLE_MODEL_TOOL_NAMES,al as CONNECTOR_CATALOG,ll as CONNECTOR_PLATFORMS,hb as CORE_SPAWN_REASONS,Sv as CURRENT_HUB_PROTOCOL_VERSION,wd as ClineModelSchema,Pd as ClineSettingsSchema,Uf as ConnectorAuthorizationDecisionSchema,Bf as ConnectorAuthorizationRequestSchema,il as ConnectorEventActorSchema,sl as ConnectorEventContextSchema,rl as ConnectorHookEventNameSchema,Zf as ConnectorHookEventSchema,hr as ContributionRegistry,Zy as DEFAULT_CLINE_ENVIRONMENT,xr as DEFAULT_MAX_IMAGE_BASE64_BYTES,Se as DEFAULT_MAX_IMAGE_DECODED_BYTES,fe as DEFAULT_MAX_IMAGE_ENCODED_BYTES,wl as DEFAULT_MAX_TOTAL_MEDIA_BYTES,oT as DEFAULT_MCP_TIMEOUT_SECONDS,Wb as DEFAULT_OUTCOME_REQUIRED_SECTIONS,jg as DEFAULT_REASONING_EFFORT,op as DEFAULT_RUNTIME_CONFIG_EXTENSIONS,Mt as EMPTY_CONTENT_TEXT,Zd as EnterpriseTelemetrySchema,og as FEATURE_FLAGS,Ke as FeatureFlag,ng as FeatureFlagDefaultValue,El as GeneratedMediaModalitySchema,Il as GeneratedMediaSchema,Rl as GeneratedMediaSourceSchema,ii as GlobalInstructionsFileSchema,Tv as HUB_CAPABILITIES,$v as HUB_CHECKPOINT_CAPABILITY,kv as HUB_CLIENT_TOOL_APPROVAL_CAPABILITY,Iv as HUB_COMMAND_SLOW_LOG_MS,Nv as HUB_COMPACTION_CAPABILITY,Ov as HUB_CUSTOM_TOOL_CAPABILITY_PREFIX,fg as HUB_DEFAULT_COMMAND_TIMEOUT_MS,zv as HUB_HOOK_CAPABILITY_PREFIX,Lv as HUB_MISTAKE_LIMIT_CAPABILITY,bl as HUB_SCHEDULE_MODES,Mv as HUB_TOOL_EXECUTOR_CAPABILITY_PREFIX,hg as HUB_TOOL_EXECUTOR_NAMES,Dv as HUB_USER_INSTRUCTIONS_SNAPSHOT_CAPABILITY,hl as HookEventNameSchema,yl as HookEventPayloadSchema,We as IMAGE_OMITTED_PLACEHOLDER,Je as IMAGE_UNSUPPORTED_PLACEHOLDER,Jd as LOOPBACK_NO_PROXY_HOSTS,zd as LiteLLMModelSchema,Nd as LiteLLMSchema,vv as MAX_CLIENT_HUB_PROTOCOL_VERSION,iT as MAX_MCP_TIMEOUT_SECONDS,_v as MIN_CLIENT_HUB_PROTOCOL_VERSION,rT as MIN_MCP_TIMEOUT_SECONDS,Jv as MODEL_TOOL_NAMES,rd as MODE_TAG_INSTRUCTIONS,Wu as ModelCapabilitySchema,bn as ModelInfoSchema,Qu as ModelMetadataSchema,el as ModelModalitiesSchema,pr as ModelModalitySchema,ol as ModelOperationModeSchema,nl as ModelOperationSchema,Yu as ModelPricingSchema,dr as ModelReasoningOptionSchema,Ju as ModelStatusSchema,ab as NO_DEFAULT_CURRENT_DIRECTORY_IN_EXE_PATH_ENV,Ev as ONE_TIME_SCHEDULE_CRON_PATTERN,Rv as ONE_TIME_SCHEDULE_RUN_AT_METADATA_KEY,fi as OTLP_TRACE_RELAY_MARKER,kd as OpenAiCompatibleModelSchema,Ed as OpenAiCompatibleSchema,sd as PLAN_MODE_INSTRUCTIONS,ad as PLAN_MODE_INSTRUCTIONS_MANUAL_SWITCH,tg as PLUGIN_FILE_EXTENSIONS,Ud as PromptUploadingSchema,_y as ProviderCapabilitySchema,Ty as ProviderClientSchema,vy as ProviderProtocolSchema,zt as REASONING_EFFORT_RATIOS,hn as REASONING_LEVELS,md as REMOTE_CONFIG_SESSION_BLOB_UPLOAD_METADATA_KEY,oy as REMOTE_URI_SCHEME,gi as RUNTIME_CONFIG_EXTENSION_KINDS,yn as ReasoningEffortSchema,lr as ReasoningLevelSchema,gy as RemoteConfigSchema,Bd as RemoteMCPServerSchema,wn as S3AccessKeySettingsSchema,yb as SDK_ERROR_TELEMETRY_EVENT,Tl as SESSION_SEARCH_PREVIEW_MAX_LENGTH,vl as SESSION_SEARCH_TITLE_MAX_LENGTH,Ub as SESSION_STATUS_VALUES,_n as SUPPORTED_IMAGE_MEDIA_TYPES,fb as TASK_CANCELLED_EVENT,pb as TASK_FIRST_CHUNK_RECEIVED_EVENT,gb as TASK_MAX_TOKENS_RECOVERY_EVENT,lb as TASK_PROVIDER_REQUEST_STARTED_EVENT,mb as TASK_PROVIDER_STREAM_FAILED_EVENT,db as TASK_PROVIDER_STREAM_STARTED_EVENT,KC as TEAM_AWAIT_TIMEOUT_MS,ky as TEAM_LIFECYCLE_EVENT_TYPE,Cy as TEAM_PROGRESS_EVENT_TYPE,WC as TEAM_RUN_MESSAGE_PREVIEW_LIMIT,JC as TEAM_RUN_TEXT_PREVIEW_LIMIT,tk as TEAM_TASK_IGNORED_FIELDS_BY_ACTION,$f as TOOL_REJECTION_SUFFIX,mk as TeamAttachOutcomeFragmentInputSchema,sk as TeamAwaitRunsInputSchema,ck as TeamBroadcastInputSchema,Rk as TeamBroadcastToolResultSchema,ik as TeamCancelRunInputSchema,kk as TeamCancelRunToolResultSchema,dk as TeamCleanupInputSchema,Ik as TeamCleanupToolResultSchema,pk as TeamCreateOutcomeInputSchema,Tk as TeamCreateOutcomeToolResultSchema,gk as TeamFinalizeOutcomeInputSchema,Pk as TeamFinalizeOutcomeToolResultSchema,hk as TeamListOutcomesInputSchema,rk as TeamListRunsInputSchema,_k as TeamMailboxMessageToolResultSchema,ex as TeamMessageType,lk as TeamMissionLogInputSchema,Ak as TeamMissionLogToolResultSchema,wk as TeamOutcomeFragmentToolResultSchema,vk as TeamOutcomeToolResultSchema,uk as TeamReadMailboxInputSchema,fk as TeamReviewOutcomeFragmentInputSchema,Qb as TeamRunResultSummarySchema,ok as TeamRunTaskInputSchema,xk as TeamRunTaskToolResultSchema,Sk as TeamRunToolSummarySchema,ak as TeamSendMessageInputSchema,Ek as TeamSendMessageToolResultSchema,QC as TeamShutdownTeammateInputSchema,Ck as TeamSimpleAgentStatusToolResultSchema,XC as TeamSpawnTeammateInputSchema,ek as TeamStatusInputSchema,yk as TeamStatusToolResultSchema,nk as TeamTaskInputSchema,Xb as TeamTaskListItemToolResultSchema,bk as TeamTaskToolResultSchema,YC as TeamTeammateSpecSchema,Xu as ThinkingConfigSchema,fr as ToolCallRecordSchema,Gv as USAGE_COST_DISPLAYS,Nf as USER_REJECTED_TOOL_REASON,Md as VertexModelSchema,Od as VertexSettingsSchema,jb as WorkspaceInfoSchema,Vb as WorkspaceManifestSchema,Ny as augmentNodeCommandForDebug,Lh as buildClineSystemPrompt,Ff as buildConnectorConnectArgs,Gh as buildRemoteConfigSessionBlobUploadMetadata,Yd as buildSdkErrorProperties,_b as captureAgentUnexpectedReasoningTokens,Tb as captureSdkError,vb as captureTaskLifecycleEvent,Wy as claimHubDaemonProcess,Xy as claimSupervisedConnectorProcess,Xg as clampMcpTimeoutSeconds,ly as clearMaterializedRemoteConfigRuntime,Wh as clearRemoteConfigSessionBlobUpload,Vf as connectorChannelsFromPlatforms,Mb as createClineTelemetryServiceConfig,Qd as createClineTelemetryServiceMetadata,eg as createContributionRegistry,vn as createMediaBudgetState,Tg as createModeSwitchNoticeTracker,ny as createRemoteConfigSessionMessagesArtifactUploader,Bb as createSessionId,nx as createTool,fh as decodeJwtPayload,Bv as describeOutdatedHubSessions,cb as disableCurrentDirectoryExecutableSearch,Wf as disposeAll,HC as emptyWorkspaceManifest,sb as ensureLoopbackProxyBypass,Wg as estimateRequestInputTokens,Zl as estimateTokens,br as formatDisplayUserInput,yr as formatFileContentBlock,Mh as formatHumanReadableDate,aT as formatMcpTimeoutErrorMessage,Fg as formatMessagesForAiSdk,vg as formatModeSwitchNotice,Ag as formatSessionSearchPreview,Rg as formatSessionSearchTitle,Oh as formatUptime,xg as formatUserCommandBlock,bg as formatUserInputBlock,wg as generatedMediaModalityFromMediaType,Dy as getClineClientIdentity,jy as getClineEnvironmentConfig,gg as getDefaultHubCommandTimeoutMs,bh as getDefaultShell,eh as getErrorCode,Qg as getErrorMessage,ot as getPowerShellEdition,Eh as getShellArgs,Ql as getShellInvocation,Hr as getShellKind,Hb as hasRuntimeConfigExtension,Sr as imageBase64DecodedByteLength,Pg as imageBase64EncodedByteLength,_r as imageBase64LengthForDecodedBytes,Mg as imageFileMaxDecodedBytesForBase64Limit,Ex as initVcr,Pl as isBase64Char,$y as isBunEmbeddedModulePath,Og as isCanonicalBase64,wf as isChatCompatibleModel,Kb as isChatWorkspacePath,Vr as isClineProvider,Ig as isGeneratedMedia,Jy as isHubDaemonProcess,Cv as isHubProtocolCompatible,mg as isHubScheduleMode,Pv as isHubToolExecutorName,ox as isLikelyAuthError,Yg as isMcpTimeoutConfigured,wb as isOtlpTraceRelayProvider,rp as isRuntimeConfigExtensionKind,Qy as isSupervisedConnectorProcess,If as isTranscriptionModel,cl as listConnectorCatalog,Ib as markOtlpTraceRelayProvider,wh as maskSecret,jf as mergeConnectorConnectArgs,Hg as mergeModelOptions,mr as modelHasCapability,Pf as modelProducesImages,zf as modelSupportsImageInput,Of as modelSupportsToolCalling,Jg as noopBasicLogger,Fr as normalizeJsonLikeStringsForSchema,gl as normalizePluginManifest,mi as normalizeSdkError,Sl as normalizeUserInput,gh as omitUndefinedValues,pg as parseHookEventPayload,ch as parseJsonStream,Fb as parseRuntimeConfigExtensions,xl as parseUserCommandEnvelope,_g as parseUserInputMode,my as prepareRemoteConfigRuntime,$h as processWorkspaceInfo,nb as readConnectorCliLaunchSpec,Av as readHubScheduleMode,yd as readRemoteConfigSessionBlobUploadMetadata,tb as readStartingConnectorInstance,gr as registerDisposable,Kh as registerRemoteConfigSessionBlobUpload,wt as reserveImageMediaBytes,bb as resetSdkErrorRateLimiterForTests,si as resolveClineBuildEnv,Kd as resolveClineEnvironment,Vg as resolveEffectiveReasoningEffort,Ob as resolveHookSessionContext,wv as resolveHubCommandTimeoutMs,sT as resolveMcpTimeoutSeconds,vr as resolveMediaBudget,Dh as resolveProviderLocalCli,qg as resolveReasoningBudgetFromRatio,Ul as resolveReasoningEffortRatio,zb as resolveRootSessionId,lh as safeJsonParse,uh as safeJsonStringify,Rh as sanitizeFileName,ae as sanitizeSurrogates,Gg as serializeAbortReason,Ly as setClineClientIdentity,Yy as setConnectorCliLaunchSpec,eb as setStartingConnectorInstance,ul as shouldIncludeConnectorField,_l as stripModeNotices,Ph as stripUtf8Bom,tl as supportsChatModalities,Dl as toAiSdkToolResultOutput,yh as toPosixSeparators,Ah as trimNonEmpty,Ih as truncateSplit,ed as truncateStr,jC as upsertWorkspaceInfo,Mf as usesImageGenerationOperation,zg as validateAndReserveBase64Media,Pt as validateAndReserveImageMedia,Ol as validateImageMedia,zh as validateWithZod,zy as withResolvedClineBuildEnv,kl as xmlTagsRemoval,jr as zodToJsonSchema};