@cline/shared 0.0.92-nightly.1791773200 → 0.0.93

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((o)=>typeof o==="number");return Object.entries(e).filter(([o,r])=>t.indexOf(+o)===-1).map(([o,r])=>r)}function Ln(e,t="|"){return e.map((n)=>Un(n)).join(t)}function mt(e,t){if(typeof t==="bigint")return t.toString();return t}class vi{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 vi(e)}function Ti(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 Ci(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 ki(e,t,n){Object.defineProperty(e,t,{get(){let o=n();return te(this,t,o),o},enumerable:!0,configurable:!0})}function Ei(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)ki(e,i,()=>{let a=t._zod.def.shape[i];return o?o(a,i):a});else Ei(e,i,o?o(s.value,i):s.value)}}function xp(e,t){for(let n of Reflect.ownKeys(t)){let o=Object.getOwnPropertyDescriptor(t,n);if(!o.enumerable)continue;if(o.get)ki(e,n,()=>t[n]);else Ei(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 Ri(e){return JSON.stringify(e)}function Ai(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Dn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ue(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var wi=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 Bn(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 S(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 Un(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Pi(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]}))(),Zn={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function _p(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 vp(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:Mi(e,t)}))}function Mi(e,t){let n={};return Oe(n,e,Reflect.ownKeys(be(e))),xp(n,t),n}function Tp(e,t){if(!ze(t))throw Error("Invalid input to safeExtend: expected a plain object");return ue(e,ne(e._zod.def,{shape:Mi(e,t)}))}function Cp(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 Oi(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&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),ue(t,ne(t._zod.def,{shape:c,checks:[]}))}function kp(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 zi(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 Fn(e){let t=[];for(let n of e??[]){let o=n._zod.def;if(!/_(length|size)$|_equals$/.test(o.check))break;let r=o.maximum??o.length??o.size;if(r>=0)t.push([r,n])}return t}function Ft(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 Ep=/[\uD800-\uDBFF]/;function Ht(e){let t=e.length;if(!Ep.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 jt(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Ni(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 $i(e,t){for(let n in t){let o=Object.getOwnPropertyDescriptor(t,n);if(o.get)Object.defineProperty(e,n,{...o,enumerable:!1});else Rp(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 Vt(e,t,n){return xe(e,t,n,!1)}function Hn(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 Rp(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 Ap(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var $n,ke=!1,wp={configurable:!0,get(){ke=!0;return}};function P(e,t,n){let o=Object.getPrototypeOf(e._zod);if(t in o&&$n!==e._zod){$n=void 0;return}$n=e._zod,Object.defineProperty(o,t,{configurable:!0,get(){Object.defineProperty(this,t,wp);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=Ap(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 Pp="~constantCatch";function Li(e){let t=()=>e;return t[Pp]=!0,t}var Di;var jn={value:void 0,enumerable:!1},Bi="captureStackTrace"in Error?Error:null;function Mp(e){let t=Bi;if(t){let n=t.stackTraceLimit;if(typeof n==="number"){try{t.stackTraceLimit=0}catch{return Bi=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){jn.value=new i(f);try{Object.defineProperty(m,"_zod",jn)}finally{jn.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),_=m._zod.constr.prototype,v=y;while(v&&v!==_)v=Object.getPrototypeOf(v);let k=v??y;if(!a.has(k))a.add(k),$i(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 u=o?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function p(m){let f=o?.Parent?Mp(l):this;c(f,m);let g=f._zod.deferred;if(g){for(let _ of g)_();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"}}(Di=globalThis).__zod_globalConfig??(Di.__zod_globalConfig={});var Y=globalThis.__zod_globalConfig;function Q(e){if(e)Object.assign(Y,e);return Y}function Op(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,mt,2)),e.message}function zp(e){this._zod.message=e}var Np={get:Op,set:zp,enumerable:!0,configurable:!0},qn={value:void 0,enumerable:!1},Ui=new WeakSet([Object.prototype,Error.prototype]),Zi=(e,t)=>{e.name="$ZodError",qn.value=t,Object.defineProperty(e,"issues",qn),qn.value=void 0,Object.defineProperty(e,"message",Np);let n=Object.getPrototypeOf(e);if(!Ui.has(n))Ui.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})}})},Fi=h("$ZodError",Zi),Gn=h("$ZodError",Zi,void 0,{Parent:Error});function $p(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 Kn(e,t=(n)=>n.message){let n={},o=[];for(let r of e.issues)if(r.path.length>0)$p(n,r.path[0],()=>[]).push(t(r));else o.push(t(r));return{formErrors:o,fieldErrors:n}}function Wn(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,u=0;while(u<a.length){let l=a[u],p=u===a.length-1;if(l==="_errors"){if(p)c._errors.push(t(s));u++;continue}if(!Object.prototype.hasOwnProperty.call(c,l))Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=c[l];if(p)m._errors.push(t(s));c=m,u++}}}};return o(e),n}function Lp(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 Hi(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 ${Lp(o.path)}`);return t.join(`
2
- `)}function qt(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((u)=>pe(u,s,Q())));throw Dn(c,i?.callee??t),c}return a.value};return t},Jn=yt(Gn),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((u)=>pe(u,s,Q())));throw Dn(c,i?.callee??t),c}return a.value};return t},Yn=bt(Gn),Gt=(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?ji(e,i.issues,r):{success:!0,data:i.value}};function ji(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 Kt=(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?ji(e,i.issues,r):{success:!0,data:i.value}};var Bp=Symbol.for("zod.compile.invalid"),Up=Symbol.for("zod.compile.fallback"),Xn=(e,t,n)=>{let o=e._zod.bag.validator;if(o!==void 0){if(o(t)!==Bp)return!0;if(o.definite===!0&&n===void 0)return!1}return Zp(e,t,n)};function Zp(e,t,n){let o=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},r=e._zod.bag.fallbackRun,i;if(r)o[Up]=!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 Qn=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},Vi=(e)=>{let t=yt(e),n=(o,r,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(o,r,a,qt(n,s))};return n};var qi=(e)=>{let t=yt(e),n=(o,r,i,s)=>t(o,r,i,qt(n,s));return n};var Gi=(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,qt(n,s))};return n};var Ki=(e)=>{let t=bt(e),n=async(o,r,i,s)=>await t(o,r,i,qt(n,s));return n};var Wi=(e)=>(t,n,o)=>{let r=o?{...o,direction:"backward"}:{direction:"backward"};return Gt(e)(t,n,r)};var Ji=(e)=>(t,n,o)=>Gt(e)(t,n,o);var Yi=(e)=>async(t,n,o)=>{let r=o?{...o,direction:"backward"}:{direction:"backward"};return Kt(e)(t,n,r)};var Xi=(e)=>async(t,n,o)=>Kt(e)(t,n,o);var Qi=/^[cC][0-9a-z]{6,}$/,es=/^[0-9a-z]+$/,ts=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ns=/^[0-9a-vA-V]{20}$/,os=/^[A-Za-z0-9]{27}$/,rs=/^[a-zA-Z0-9_-]{21}$/;function is(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var ss=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var as=/^([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})$/,to=(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 cs=/^(?:[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 Fp="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function us(){return new RegExp(Fp,"u")}var ls=/^(?:(?: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])$/,ds=/^(([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 ps=/^((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])$/,ms=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,gs=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var hs=/^https?$/,ys=/^\+[1-9]\d{6,14}$/;var bs="(?:(?:\\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 Hp(e){return new RegExp(`^${e}$`)}var xs=Hp(bs);function eo(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 _s(e){return new RegExp(`^${eo(e)}$`)}function Ss(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${eo({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,o=e.local?`${n}|${eo({precision:e.precision})}`:n;return new RegExp(`^${bs}T(?:${o})$`)}var vs=/^[\s\S]{0,}$/;var no=/^-?\d+$/,xt=/^-?\d+(?:\.\d+)?$/,Ts=/^(?:true|false)$/i;var Cs=/^[^A-Z]*$/,ks=/^[^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 oo=(e)=>{let t=e.value;return!Ti(t)&&t.length!==void 0},Wt={number:"number",bigint:"bigint",object:"date"},ro=h("$ZodCheckLessThan",(e,t)=>{G.init(e,t);let n=Wt[typeof t.value];e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:Wt[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})}}),io=h("$ZodCheckGreaterThan",(e,t)=>{G.init(e,t);let n=Wt[typeof t.value];e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:Wt[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})}}),Es=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):Ci(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})}}),Rs=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 As=h("$ZodCheckMaxLength",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=oo),e._zod.check=(o)=>{let r=o.value,i=r.length;if((typeof r==="string"&&i>t.maximum?Ht(r):i)<=t.maximum)return;let a=jt(r);o.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ws=h("$ZodCheckMinLength",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=oo),e._zod.check=(o)=>{let r=o.value,i=r.length;if((typeof r==="string"&&i>=t.minimum&&i<t.minimum*2?Ht(r):i)>=t.minimum)return;let a=jt(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=oo),e._zod.check=(o)=>{let r=o.value,i=r.length,s=typeof r==="string"&&i>=t.length&&i<=t.length*2?Ht(r):i;if(s===t.length)return;let a=jt(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})}}),_t=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=()=>{})}),Ps=h("$ZodCheckRegex",(e,t)=>{_t.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})}}),Ms=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Cs),_t.init(e,t)}),Os=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ks),_t.init(e,t)}),zs=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})}}),Ns=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})}}),$s=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 Ls=h("$ZodCheckOverwrite",(e,t)=>{G.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class so{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(", ")}) {
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 Ln(e,t="|"){return e.map((n)=>Un(n)).join(t)}function mt(e,t){if(typeof t==="bigint")return t.toString();return t}class vi{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 vi(e)}function Ti(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 Ci(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 ki(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return te(this,t,r),r},enumerable:!0,configurable:!0})}function Ei(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)ki(e,i,()=>{let a=t._zod.def.shape[i];return r?r(a,i):a});else Ei(e,i,r?r(s.value,i):s.value)}}function _p(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);if(!r.enumerable)continue;if(r.get)ki(e,n,()=>t[n]);else Ei(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 Ri(e){return JSON.stringify(e)}function Ai(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Dn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ue(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Ii=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 Bn(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 Un(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Pi(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]}))(),Zn={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function vp(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 Tp(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 Cp(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:Mi(e,t)}))}function Mi(e,t){let n={};return Oe(n,e,Reflect.ownKeys(be(e))),_p(n,t),n}function kp(e,t){if(!ze(t))throw Error("Invalid input to safeExtend: expected a plain object");return ue(e,ne(e._zod.def,{shape:Mi(e,t)}))}function Ep(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 Oi(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&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),ue(t,ne(t._zod.def,{shape:c,checks:[]}))}function Rp(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 zi(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 Fn(e){let t=[];for(let n of e??[]){let r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;let o=r.maximum??r.length??r.size;if(o>=0)t.push([o,n])}return t}function Ft(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 Ap=/[\uD800-\uDBFF]/;function Ht(e){let t=e.length;if(!Ap.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 jt(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Ni(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 $i(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);if(r.get)Object.defineProperty(e,n,{...r,enumerable:!1});else Ip(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 Vt(e,t,n){return xe(e,t,n,!1)}function Hn(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 Ip(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 wp(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var $n,ke=!1,Pp={configurable:!0,get(){ke=!0;return}};function P(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&$n!==e._zod){$n=void 0;return}$n=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Pp);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 Mp(e,t,n,r){let o=wp(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 Op="~constantCatch";function Li(e){let t=()=>e;return t[Op]=!0,t}var Di;var jn={value:void 0,enumerable:!1},Bi="captureStackTrace"in Error?Error:null;function zp(e){let t=Bi;if(t){let n=t.stackTraceLimit;if(typeof n==="number"){try{t.stackTraceLimit=0}catch{return Bi=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){jn.value=new i(f);try{Object.defineProperty(m,"_zod",jn)}finally{jn.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),$i(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 u=r?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function p(m){let f=r?.Parent?zp(l):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"}}(Di=globalThis).__zod_globalConfig??(Di.__zod_globalConfig={});var Y=globalThis.__zod_globalConfig;function Q(e){if(e)Object.assign(Y,e);return Y}function Np(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,mt,2)),e.message}function $p(e){this._zod.message=e}var Lp={get:Np,set:$p,enumerable:!0,configurable:!0},qn={value:void 0,enumerable:!1},Ui=new WeakSet([Object.prototype,Error.prototype]),Zi=(e,t)=>{e.name="$ZodError",qn.value=t,Object.defineProperty(e,"issues",qn),qn.value=void 0,Object.defineProperty(e,"message",Lp);let n=Object.getPrototypeOf(e);if(!Ui.has(n))Ui.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})}})},Fi=h("$ZodError",Zi),Gn=h("$ZodError",Zi,void 0,{Parent:Error});function Dp(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 Kn(e,t=(n)=>n.message){let n={},r=[];for(let o of e.issues)if(o.path.length>0)Dp(n,o.path[0],()=>[]).push(t(o));else r.push(t(o));return{formErrors:r,fieldErrors:n}}function Wn(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,u=0;while(u<a.length){let l=a[u],p=u===a.length-1;if(l==="_errors"){if(p)c._errors.push(t(s));u++;continue}if(!Object.prototype.hasOwnProperty.call(c,l))Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=c[l];if(p)m._errors.push(t(s));c=m,u++}}}};return r(e),n}function Bp(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 Hi(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 ${Bp(r.path)}`);return t.join(`
2
+ `)}function qt(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((u)=>pe(u,s,Q())));throw Dn(c,i?.callee??t),c}return a.value};return t},Jn=yt(Gn),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((u)=>pe(u,s,Q())));throw Dn(c,i?.callee??t),c}return a.value};return t},Yn=bt(Gn),Gt=(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?ji(e,i.issues,o):{success:!0,data:i.value}};function ji(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 Kt=(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?ji(e,i.issues,o):{success:!0,data:i.value}};var Zp=Symbol.for("zod.compile.invalid"),Fp=Symbol.for("zod.compile.fallback"),Xn=(e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Zp)return!0;if(r.definite===!0&&n===void 0)return!1}return Hp(e,t,n)};function Hp(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)r[Fp]=!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 Qn=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},Vi=(e)=>{let t=yt(e),n=(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(r,o,a,qt(n,s))};return n};var qi=(e)=>{let t=yt(e),n=(r,o,i,s)=>t(r,o,i,qt(n,s));return n};var Gi=(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,qt(n,s))};return n};var Ki=(e)=>{let t=bt(e),n=async(r,o,i,s)=>await t(r,o,i,qt(n,s));return n};var Wi=(e)=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Gt(e)(t,n,o)};var Ji=(e)=>(t,n,r)=>Gt(e)(t,n,r);var Yi=(e)=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Kt(e)(t,n,o)};var Xi=(e)=>async(t,n,r)=>Kt(e)(t,n,r);var Qi=/^[cC][0-9a-z]{6,}$/,es=/^[0-9a-z]+$/,ts=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ns=/^[0-9a-vA-V]{20}$/,rs=/^[A-Za-z0-9]{27}$/,os=/^[a-zA-Z0-9_-]{21}$/;function is(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var ss=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var as=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,tr=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var cs=/^(?:[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 jp="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function us(){return new RegExp(jp,"u")}var ls=/^(?:(?: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])$/,ds=/^(([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 ps=/^((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])$/,ms=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,gs=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var hs=/^https?$/,ys=/^\+[1-9]\d{6,14}$/;var bs="(?:(?:\\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 Vp(e){return new RegExp(`^${e}$`)}var xs=Vp(bs);function er(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 Ss(e){return new RegExp(`^${er(e)}$`)}function _s(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${er({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${er({precision:e.precision})}`:n;return new RegExp(`^${bs}T(?:${r})$`)}var vs=/^[\s\S]{0,}$/;var nr=/^-?\d+$/,xt=/^-?\d+(?:\.\d+)?$/,Ts=/^(?:true|false)$/i;var Cs=/^[^A-Z]*$/,ks=/^[^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 rr=(e)=>{let t=e.value;return!Ti(t)&&t.length!==void 0},Wt={number:"number",bigint:"bigint",object:"date"},or=h("$ZodCheckLessThan",(e,t)=>{G.init(e,t);let n=Wt[typeof t.value];e._zod.check=(r)=>{if(t.inclusive?r.value<=t.value:r.value<t.value)return;r.issues.push({origin:Wt[typeof r.value]??n,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ir=h("$ZodCheckGreaterThan",(e,t)=>{G.init(e,t);let n=Wt[typeof t.value];e._zod.check=(r)=>{if(t.inclusive?r.value>=t.value:r.value>t.value)return;r.issues.push({origin:Wt[typeof r.value]??n,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Es=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):Ci(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})}}),Rs=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 As=h("$ZodCheckMaxLength",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=rr),e._zod.check=(r)=>{let o=r.value,i=o.length;if((typeof o==="string"&&i>t.maximum?Ht(o):i)<=t.maximum)return;let a=jt(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Is=h("$ZodCheckMinLength",(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=rr),e._zod.check=(r)=>{let o=r.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?Ht(o):i)>=t.minimum)return;let a=jt(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=rr),e._zod.check=(r)=>{let o=r.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?Ht(o):i;if(s===t.length)return;let a=jt(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=()=>{})}),Ps=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})}}),Ms=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Cs),St.init(e,t)}),Os=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ks),St.init(e,t)}),zs=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})}}),Ns=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})}}),$s=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 Ls=h("$ZodCheckOverwrite",(e,t)=>{G.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class sr{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(", ")}) {
4
4
  ${t.join(`
5
5
  `)}
6
- };`)(...Object.values(this.closed))}}var Bs={major:4,minor:6,patch:6};var z=h("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Bs;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,u)=>{if(a.memo)return a;let l=re(a),p;for(let m of c){if(m._zod.def.when){if(zi(a))continue;if(!m._zod.def.when(a))continue}else if(l)continue;let f=a.issues.length,g=m._zod.check(a);if(g instanceof Promise&&u?.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(Ft(a.issues,f,e),!l)l=re(a,f)});else{if(a.issues.length===f)continue;if(Ft(a.issues,f,e),!l)l=re(a,f)}}if(p)return p.then(()=>a);return a},s=(a,c,u)=>{if(re(a))return a.aborted=!0,a;let l=i(c,r,u);if(l instanceof Promise){if(u.async===!1)throw new me;return l.then((p)=>e._zod.parse(p,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(l instanceof Promise)return l.then((p)=>s(p,a,c));return s(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new me;return u.then((l)=>i(l,r,c))}return i(u,r,c)}}},{get "~standard"(){return Vt(this,"~standard",co(this))},set "~standard"(e){xe(this,"~standard",e)}}),Qs=(e,t)=>e.issues.length?{issues:e.issues.map((n)=>pe(n,t,Q()))}:{value:e.value};async function jp(e,t){let n={async:!0};return Qs(await e._zod.run({value:t,issues:[]},n),n)}function co(e){return{validate:(t)=>{let n={async:!1};try{let o=e._zod.run({value:t,issues:[]},n);if(!(o instanceof Promise))return Qs(o,n)}catch(o){}return jp(e,t)},vendor:"zod",version:1}}var Qt=h("$ZodString",(e,t)=>{z.init(e,t),e._zod.pattern=t.pattern??vs,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)=>{_t.init(e,t),Qt.init(e,t)}),ea=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=as),U.init(e,t)}),ta=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=to(o))}else t.pattern??(t.pattern=to());U.init(e,t)}),na=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=cs),U.init(e,t)}),oa=1,Yt=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 Vp(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return ra(e)||Yt;return qp(e,t)}function qp(e,t){if(!t.normalize&&t.protocol?.source===hs.source&&!/^https?:\/\//i.test(e))return oa;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse==="function")return n.parse(e)??Yt}return new URL(e)}catch{return Yt}}var Gp=/[\t\n\r]/g;function Us(e){return e.replace(Gp,"")}function Kp(e,t){return t.lastIndex=0,t.test(e.hostname)}function Wp(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var ia=h("$ZodURL",(e,t)=>{U.init(e,t),e._zod.check=(n)=>{try{let o=n.value.trim(),r=Vp(o,t);if(r===oa){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(r===Yt){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(r===!0){n.value=Us(o);return}if(t.hostname&&!Kp(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&&!Wp(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:Us(o);return}catch(o){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),sa=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=us()),U.init(e,t)}),aa=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:is(t.length)),U.init(e,t)}),ca=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Qi),U.init(e,t)}),ua=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=es),U.init(e,t)}),la=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ts),U.init(e,t)}),da=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ns),U.init(e,t)}),pa=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=os),U.init(e,t)}),ma=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ss(t)),U.init(e,t)}),fa=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=xs),U.init(e,t)}),ga=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=_s(t)),U.init(e,t)}),ha=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ss),U.init(e,t)}),ya=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ls),U.init(e,t)}),Jp=/^[0-9a-fA-F:.]+$/;function ba(e){if(!Jp.test(e))return!1;return ra(`http://[${e}]`)}var xa=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ds),U.init(e,t),e._zod.check=(n)=>{if(!ba(n.value))n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}});var _a=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ps),U.init(e,t)});function Yp(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 ba(n)}var Sa=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ms),U.init(e,t),e._zod.check=(n)=>{if(!Yp(n.value))n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function va(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 uo=/^[0-9a-zA-Z+/]*={0,2}$/,Ta=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=uo),U.init(e,t),e._zod.check=(n)=>{if(va(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),en=/^[A-Za-z0-9_-]*$/;function Xp(e){if(!en.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return va(n)}var Ca=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=en),U.init(e,t),e._zod.check=(n)=>{if(Xp(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),ka=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ys),U.init(e,t)});function Qp(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 Ea=h("$ZodJWT",(e,t)=>{U.init(e,t),e._zod.check=(n)=>{if(Qp(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});var lo=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}}),Ra=h("$ZodNumberFormat",(e,t)=>{Rs.init(e,t),lo.init(e,t)}),Aa=h("$ZodBoolean",(e,t)=>{z.init(e,t),e._zod.pattern=Ts,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 wa=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)}),Pa=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}}),Ma=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 em(e,t){let n=Fn(e._zod.def.checks);if(!n.length)return;let o=Math.min(...n.map((i)=>i[0])),r=e._zod.parse;e._zod.parse=(i,s)=>{let a=t(i.value);if(a>o&&!s?.skipChecks&&s?.direction!=="backward"){for(let[c,u]of Fn(e._zod.def.checks))if(a>c&&u._zod.def.when(i)){let l=i.issues.length;return u._zod.check(i),i.issues[l].continue=!1,Ft(i.issues,l,e),i}}return r(i,s)}}var tm=(e)=>Array.isArray(e)?e.length:-1;function Zs(e,t,n){if(e.issues.length)t.issues.push(...de(n,e.issues));t.value[n]=e.value}var Oa=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 u=i[c],l=t.element._zod.run({value:u,issues:[]},r);if(l instanceof Promise)s.push(l.then((p)=>Zs(p,o,c)));else if(Zs(l,o,c),a&&l.issues.length!==0&&re(l))break}if(s.length)return Promise.all(s).then(()=>o);return o},em(e,tm)});function Xt(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 nm=[];function za(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),o=n.length?n:nm,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=Pi(e.shape);return{...e,allKeys:r,symbolKeys:o,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Na(e,t,n,o,r,i,s){let a=[],c=r.keySet,u=r.catchall._zod,l=u.def.type,{optin:p,optout:m}=u,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(l==="never")a.push(g);continue}if(l==="never"){a.push(g);continue}let y=u.run({value:t[g],issues:[]},o);if(y instanceof Promise)e.push(y.then((_)=>Xt(_,n,g,t,p,m)));else Xt(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 om=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 u=()=>{let l={...o};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=o,Object.defineProperty(t,"shape",{get:u})}let r=ft(()=>za(t));P(e,"propValues",(u)=>{let l=u.def.shape,p={};for(let m in l){let f=l[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=(u,l)=>{a??(a=r.value);let p=u.value;if(!i(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let m=[],f=a.shape,g=l?.abortEarly,y=u.issues.length;for(let _ of a.allKeys){if(g&&u.issues.length!==y){if(re(u,y))break;y=u.issues.length}if(_==="__proto__")continue;let v=f[_],k=v._zod.optin,M=v._zod.optout,R=v._zod.run({value:p[_],issues:[]},l);if(R instanceof Promise)m.push(R.then((B)=>Xt(B,u,_,p,k,M)));else Xt(R,u,_,p,k,M)}if(!s)return m.length?Promise.all(m).then(()=>u):u;return Na(m,p,u,l,r.value,e,g===!0)}}),$a=h("$ZodObjectJIT",(e,t)=>{om.init(e,t);let n=e._zod.parse,o=ft(()=>za(t)),r=Y.memoizer,i=(f)=>{let g=o.value,y=g.symbolKeys,_=new so(["payload","ctx"],{shape:f,inst:e,memo:r,syms:y}),v=(B)=>`shape[${B}]._zod.run({ value: input[${B}], issues: [] }, ctx)`,k=(B,A)=>`
6
+ };`)(...Object.values(this.closed))}}var Bs={major:4,minor:6,patch:7};var z=h("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Bs;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,u)=>{if(a.memo)return a;let l=oe(a),p;for(let m of c){if(m._zod.def.when){if(zi(a))continue;if(!m._zod.def.when(a))continue}else if(l)continue;let f=a.issues.length,g=m._zod.check(a);if(g instanceof Promise&&u?.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(Ft(a.issues,f,e),!l)l=oe(a,f)});else{if(a.issues.length===f)continue;if(Ft(a.issues,f,e),!l)l=oe(a,f)}}if(p)return p.then(()=>a);return a},s=(a,c,u)=>{if(oe(a))return a.aborted=!0,a;let l=i(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new me;return l.then((p)=>e._zod.parse(p,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(l instanceof Promise)return l.then((p)=>s(p,a,c));return s(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new me;return u.then((l)=>i(l,o,c))}return i(u,o,c)}}},{get "~standard"(){return Vt(this,"~standard",cr(this))},set "~standard"(e){xe(this,"~standard",e)}}),Qs=(e,t)=>e.issues.length?{issues:e.issues.map((n)=>pe(n,t,Q()))}:{value:e.value};async function qp(e,t){let n={async:!0};return Qs(await e._zod.run({value:t,issues:[]},n),n)}function cr(e){return{validate:(t)=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Qs(r,n)}catch(r){}return qp(e,t)},vendor:"zod",version:1}}var Qt=h("$ZodString",(e,t)=>{z.init(e,t),e._zod.pattern=t.pattern??vs,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),Qt.init(e,t)}),ea=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=as),U.init(e,t)}),ta=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=tr(r))}else t.pattern??(t.pattern=tr());U.init(e,t)}),na=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=cs),U.init(e,t)}),ra=1,Yt=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 Gp(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return oa(e)||Yt;return Kp(e,t)}function Kp(e,t){if(!t.normalize&&t.protocol?.source===hs.source&&!/^https?:\/\//i.test(e))return ra;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse==="function")return n.parse(e)??Yt}return new URL(e)}catch{return Yt}}var Wp=/[\t\n\r]/g;function Us(e){return e.replace(Wp,"")}function Jp(e,t){return t.lastIndex=0,t.test(e.hostname)}function Yp(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var ia=h("$ZodURL",(e,t)=>{U.init(e,t),e._zod.check=(n)=>{try{let r=n.value.trim(),o=Gp(r,t);if(o===ra){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(o===Yt){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(o===!0){n.value=Us(r);return}if(t.hostname&&!Jp(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&&!Yp(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:Us(r);return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),sa=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=us()),U.init(e,t)}),aa=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:is(t.length)),U.init(e,t)}),ca=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Qi),U.init(e,t)}),ua=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=es),U.init(e,t)}),la=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ts),U.init(e,t)}),da=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ns),U.init(e,t)}),pa=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=rs),U.init(e,t)}),ma=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=_s(t)),U.init(e,t)}),fa=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=xs),U.init(e,t)}),ga=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ss(t)),U.init(e,t)}),ha=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ss),U.init(e,t)}),ya=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ls),U.init(e,t)}),Xp=/^[0-9a-fA-F:.]+$/;function ba(e){if(!Xp.test(e))return!1;return oa(`http://[${e}]`)}var xa=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ds),U.init(e,t),e._zod.check=(n)=>{if(!ba(n.value))n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}});var Sa=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ps),U.init(e,t)});function Qp(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 ba(n)}var _a=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ms),U.init(e,t),e._zod.check=(n)=>{if(!Qp(n.value))n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function va(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 ur=/^[0-9a-zA-Z+/]*={0,2}$/,Ta=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ur),U.init(e,t),e._zod.check=(n)=>{if(va(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),en=/^[A-Za-z0-9_-]*$/;function em(e){if(!en.test(e))return!1;let t=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return va(n)}var Ca=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=en),U.init(e,t),e._zod.check=(n)=>{if(em(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),ka=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ys),U.init(e,t)});function tm(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 Ea=h("$ZodJWT",(e,t)=>{U.init(e,t),e._zod.check=(n)=>{if(tm(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});var lr=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}}),Ra=h("$ZodNumberFormat",(e,t)=>{Rs.init(e,t),lr.init(e,t)}),Aa=h("$ZodBoolean",(e,t)=>{z.init(e,t),e._zod.pattern=Ts,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 Ia=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)}),Pa=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}}),Ma=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 nm(e,t){let n=Fn(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map((i)=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let a=t(i.value);if(a>r&&!s?.skipChecks&&s?.direction!=="backward"){for(let[c,u]of Fn(e._zod.def.checks))if(a>c&&u._zod.def.when(i)){let l=i.issues.length;return u._zod.check(i),i.issues[l].continue=!1,Ft(i.issues,l,e),i}}return o(i,s)}}var rm=(e)=>Array.isArray(e)?e.length:-1;function Zs(e,t,n){if(e.issues.length)t.issues.push(...de(n,e.issues));t.value[n]=e.value}var Oa=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 u=i[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)s.push(l.then((p)=>Zs(p,r,c)));else if(Zs(l,r,c),a&&l.issues.length!==0&&oe(l))break}if(s.length)return Promise.all(s).then(()=>r);return r},nm(e,rm)});function Xt(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 om=[];function za(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:om,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=Pi(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Na(e,t,n,r,o,i,s){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,{optin:p,optout:m}=u,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(l==="never")a.push(g);continue}if(l==="never"){a.push(g);continue}let y=u.run({value:t[g],issues:[]},r);if(y instanceof Promise)e.push(y.then((S)=>Xt(S,n,g,t,p,m)));else Xt(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 im=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 u=()=>{let l={...r};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=r,Object.defineProperty(t,"shape",{get:u})}let o=ft(()=>za(t));P(e,"propValues",(u)=>{let l=u.def.shape,p={};for(let m in l){let f=l[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=(u,l)=>{a??(a=o.value);let p=u.value;if(!i(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let m=[],f=a.shape,g=l?.abortEarly,y=u.issues.length;for(let S of a.allKeys){if(g&&u.issues.length!==y){if(oe(u,y))break;y=u.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:[]},l);if(R instanceof Promise)m.push(R.then((B)=>Xt(B,u,S,p,k,M)));else Xt(R,u,S,p,k,M)}if(!s)return m.length?Promise.all(m).then(()=>u):u;return Na(m,p,u,l,o.value,e,g===!0)}}),$a=h("$ZodObjectJIT",(e,t)=>{im.init(e,t);let n=e._zod.parse,r=ft(()=>za(t)),o=Y.memoizer,i=(f)=>{let g=r.value,y=g.symbolKeys,S=new sr(["payload","ctx"],{shape:f,inst:e,memo:o,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
- }`;_.write("const input = payload.value;");let M=Object.create(null),R=0;for(let B of g.allKeys)M[B]=`key_${R++}`;_.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)}]`:Ri(B),Te=`${J} in input`,Me=f[B],ct=Me?._zod?.optin,ut=ct!==void 0,zn=Me?._zod?.optout==="optional";if(_.write(`const ${A} = ${v(J)};`),ut&&zn){let lt=ct==="optional"?`${A}_present`:`${A}.value !== undefined || ${A}_present`;_.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(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)}]`:Ri(B),Te=`${J} in input`,Me=f[B],ct=Me?._zod?.optin,ut=ct!==void 0,zn=Me?._zod?.optout==="optional";if(S.write(`const ${A} = ${v(J)};`),ut&&zn){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)}
@@ -25,7 +25,7 @@ ${t.join(`
25
25
  }
26
26
  }
27
27
 
28
- `)}else if(!ut)_.write(`
28
+ `)}else if(!ut)S.write(`
29
29
  const ${A}_present = ${Te};
30
30
  if (${A}.issues.length) {${k(A,J)}
31
31
  }
@@ -46,28 +46,28 @@ ${t.join(`
46
46
  newResult[${J}] = ${A}.value;
47
47
  }
48
48
 
49
- `);else if(_.write(`
49
+ `);else if(S.write(`
50
50
  if (${A}.issues.length) {${k(A,J)}
51
51
  }
52
- `),ct==="defaulted")_.write(`newResult[${J}] = ${A}.value;`);else _.write(`
52
+ `),ct==="defaulted")S.write(`newResult[${J}] = ${A}.value;`);else S.write(`
53
53
  if (${A}.value !== undefined || ${Te}) {
54
54
  newResult[${J}] = ${A}.value;
55
55
  }
56
- `)}return _.write("payload.value = newResult;"),_.write("return payload;"),_.compile()},s,a=Ue,c=!Y.jitless,l=c&&wi.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&&l&&g?.async===!1&&g.jitless!==!0){if(!s)s=i(t.shape);if(f=s(f,g),!p)return f;return Na([],y,f,g,m,e,g?.abortEarly===!0)}return n(f,g)}});function Fs(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 po=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 Fs(s,o,e,r);return Promise.all(s).then((a)=>Fs(a,o,e,r))}});function rm(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 La=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,po.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[u,l]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(i,u))te(i,u,new Set);for(let p of l)i[u].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(()=>rm(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((u)=>o.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),r}}),Da=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,u])=>Hs(n,c,u));return Hs(n,i,s)}});function ao(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=ao(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=ao(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 Hs(e,t,n){let o=new Map,r,i=new Map,s=(u,l)=>{let p;if(u.code==="unrecognized_keys"&&!u.path?.length)r??(r=u),p=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let m=String(u.path[0]);if(!i.has(m))i.set(m,u);p=[m]}else return!1;for(let m of p){if(!o.has(m))o.set(m,{});o.get(m)[l]=!0}return!0};for(let u of t.issues)if(!s(u,"l"))e.issues.push(u);for(let u of n.issues)if(!s(u,"r"))e.issues.push(u);let a=[...o].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=r?a.filter((l)=>r.keys.includes(l)):[];if(u.length)e.issues.push({...r,keys:u});for(let l of a)if(!u.includes(l)&&i.has(l))e.issues.push(i.get(l))}let c=ao(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 mo=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=js(n,"optin"),u=js(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 l=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)=>{l[f]=y}));else if(l[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 _ 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:_,issues:[]},i);if(v instanceof Promise)a.push(v.then((k)=>Vs(k,r,f)));else Vs(v,r,f)}}if(a.length)return Promise.all(a).then(()=>qs(l,r,n,s,u));return qs(l,r,n,s,u)}});function js(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 Vs(e,t,n){if(e.issues.length)t.issues.push(...de(n,e.issues));t.value[n]=e.value}function qs(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 Ba=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 l of a)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(c.add(typeof l==="number"?l.toString():l),l==="__proto__")continue;let p=t.keyType._zod.run({value:l,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:l,path:[l],inst:e});continue}let m=p.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}}let u;for(let l in i)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;o.value[l]=i[l]}else u=u??[],u.push(l);if(u&&u.length>0)o.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{o.value=n?n.alloc(e,o,{},r):{};let c;for(let u of Reflect.ownKeys(i)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},r);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&xt.test(u)&&l.issues.length){let g=t.keyType._zod.run({value:Number(u),issues:[]},r);if(g instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(g.issues.length===0)l=g}if(l.issues.length){if(t.mode==="loose")o.value[u]=i[u];else if(a)c=c??[],c.push(u);else o.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((g)=>pe(g,r,Q())),input:u,path:[u],inst:e});continue}let m=l.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:i[u],issues:[]},r);if(f instanceof Promise)s.push(f.then((g)=>{if(g.issues.length)o.issues.push(...de(u,g.issues));o.value[m]=g.value}));else{if(f.issues.length)o.issues.push(...de(u,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 Ua=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}}),Za=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 Fa=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 Gs(e,t){return e.value=t.issues.length?void 0:t.value,e}var fo=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)=>Gs(n,i));return Gs(n,r)}return t.innerType._zod.run(n,o)}}),Ha=h("$ZodExactOptional",(e,t)=>{fo.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)}),ja=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)}}),Va=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)=>Ks(i,t));return Ks(r,t)}});function Ks(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var qa=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)}}),Ga=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)=>Ws(i,e));return Ws(r,e)}});function Ws(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 Js(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 Ka=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)=>Js(n,i,t,o));return Js(n,r,t,o)}});var go=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)=>Jt(s,t.in,o));return Jt(i,t.in,o)}let r=t.in._zod.run(n,o);if(r instanceof Promise)return r.then((i)=>Jt(i,t.out,o));return Jt(r,t.out,o)}});function Jt(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 Wa=h("$ZodPreprocess",(e,t)=>{go.init(e,t)}),Ja=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(Ys);return Ys(r)}});function Ys(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Ya=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?Jn(e._def.input,o):o,i=Reflect.apply(n,this,r);if(e._def.output)return Jn(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 Yn(e._def.input,o):o,i=await Reflect.apply(n,this,r);if(e._def.output)return await Yn(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 mo({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)),Xa=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 Qa=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)=>Xs(i,n,o,e));Xs(r,n,o,e);return}});function Xs(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 tc extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var yo="~memo",ec=[];function nc(e){return e!==null&&typeof e==="object"}function ho(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var oc=new WeakMap,St=0,on=1,vt=2;function rn(e,t,n){let o=oc.get(e);if(o!==void 0)return o?vt:St;if(t.has(e))return vt;t.add(e);let r=St,i=(l)=>{if(r!==vt&&l?._zod){let p=rn(l,t,n);if(p>r)r=p}},s=(l,p)=>{let m=St;for(let f of Reflect.ownKeys(l)){let g=Object.getOwnPropertyDescriptor(l,f);if(p&&!g.enumerable)continue;let y=g.get?on:g.value?._zod?rn(g.value,t,n):St;if(y>m)m=y}return m},a=(l)=>{if(l>r)r=l},c=e._zod.def,u=c.type;switch(u){case"object":{let l=gt(c);a(l?s(l,!0):on),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let l of c.items)i(l);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 l of c.options)i(l);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 l=c._cachedInner??(n?e._zod.innerType:void 0);a(l?rn(l,t,!1):on);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 l in c){let p=Object.getOwnPropertyDescriptor(c,l);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),im(e,r)}function im(e,t){if(t!==on)oc.set(e,t===vt);return t}function sm(e,t){let n=e.buckets.get(t);if(!n)n=new WeakMap,e.buckets.set(t,n);return n}var tn,nn=[],am={alloc(e,t,n){let o=tn;if(!o)return n;tn=void 0;let r={value:n,issues:null};return o.set(t.value,r),nn.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"&&cm(i,r.value))throw new tc;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,u)=>{if(n===void 0){let v=rn(e,new Set,!1);if(v===St){if(e._zod.parse=s,e._zod.run===a)e._zod.run=s;return s(c,u)}if(v===vt||o)n=!0;else o=!0}let l=c.value;if(!nc(l))return s(c,u);let p=u[yo];if(!p)p={buckets:new WeakMap,backEdges:void 0},u[yo]=p;let m;if(r===u)m=i;else m=sm(p,e),r=u,i=m;let f=m.get(l);if(f){if(c.value=f.value,f.issues){if(f.issues.length)c.issues.push(...ho(f.issues))}else c.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(f.value);return c}tn=m;let g=nn.length,y=s(c,u);tn=void 0;let _=nn.length>g?nn.pop():void 0;if(y instanceof Promise)return y.then((v)=>{if(_)_.issues=v.issues.length?ho(v.issues):ec;return v});if(_)_.issues=y.issues.length?ho(y.issues):ec;return y};if(e._zod.parse=a,e._zod.run===s)e._zod.run=a})}};function bo(){return am}function cm(e,t){let n=e[yo]?.backEdges;return n!==void 0&&nc(t)&&n.has(t)}var um=()=>{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=Ni(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 ${Un(i.values[0])}`;return`Invalid option: expected one of ${Ln(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":""}: ${Ln(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 xo(){return{localeError:um()}}var rc;class ic{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 sc(){return new ic}(rc=globalThis).__zod_globalRegistry??(rc.__zod_globalRegistry=sc());var Re=globalThis.__zod_globalRegistry;function ac(e){if(e.checks)e.checks=[...e.checks];return e}function cc(e,t){return new e(ac({type:"string",...S(t)}))}function uc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...S(t)})}function lc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...S(t)})}function dc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...S(t)})}function pc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...S(t)})}function mc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...S(t)})}function fc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...S(t)})}function gc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...S(t)})}function hc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...S(t)})}function yc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...S(t)})}function bc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...S(t)})}function xc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...S(t)})}function _c(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...S(t)})}function Sc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...S(t)})}function vc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...S(t)})}function Tc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...S(t)})}function Cc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...S(t)})}function kc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...S(t)})}function Ec(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...S(t)})}function Rc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...S(t)})}function Ac(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...S(t)})}function wc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...S(t)})}function Ic(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...S(t)})}function Pc(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...S(t)})}function Mc(e,t){return new e({type:"string",format:"date",check:"string_format",...S(t)})}function Oc(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...S(t)})}function zc(e,t){return new e({type:"string",format:"duration",check:"string_format",...S(t)})}function Nc(e,t){return new e(ac({type:"number",checks:[],...S(t)}))}function $c(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...S(t)})}function Lc(e,t){return new e({type:"boolean",...S(t)})}function Dc(e){return new e({type:"unknown"})}function Bc(e,t){return new e({type:"never",...S(t)})}function Uc(e,t){return new e({type:"void",...S(t)})}function Zc(e,t){return new e({type:"date",...S(t)})}function sn(e,t){return new ro({check:"less_than",...S(t),value:e,inclusive:!1})}function Fe(e,t){return new ro({check:"less_than",...S(t),value:e,inclusive:!0})}function an(e,t){return new io({check:"greater_than",...S(t),value:e,inclusive:!1})}function He(e,t){return new io({check:"greater_than",...S(t),value:e,inclusive:!0})}function cn(e,t){return new Es({check:"multiple_of",...S(t),value:e})}function un(e,t){return new As({check:"max_length",...S(t),maximum:e})}function je(e,t){return new ws({check:"min_length",...S(t),minimum:e})}function ln(e,t){return new Is({check:"length_equals",...S(t),length:e})}function _o(e,t){return new Ps({check:"string_format",format:"regex",...S(t),pattern:e})}function So(e){return new Ms({check:"string_format",format:"lowercase",...S(e)})}function vo(e){return new Os({check:"string_format",format:"uppercase",...S(e)})}function To(e,t){return new zs({check:"string_format",format:"includes",...S(t),includes:e})}function Co(e,t){return new Ns({check:"string_format",format:"starts_with",...S(t),prefix:e})}function ko(e,t){return new $s({check:"string_format",format:"ends_with",...S(t),suffix:e})}function Ae(e){return new Ls({check:"overwrite",tx:e})}function Eo(e){return Ae((t)=>t.normalize(e))}function Ro(){return Ae((e)=>e.trim())}function Ao(){return Ae((e)=>e.toLowerCase())}function wo(){return Ae((e)=>e.toUpperCase())}function Io(){return Ae((e)=>Ai(e))}function Fc(e,t,n){return new e({type:"array",element:t,...S(n)})}function Hc(e,t,n){let o=S(n);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function jc(e,t,n){return new e({type:"custom",check:"custom",fn:t,...S(n)})}function Vc(e,t){let n=lm((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 lm(e,t){let n=new G({check:"custom",...S(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 l={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);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,l)}let p=e._zod.parent;if(p){if(!s.ref)s.ref=p;D(p,t,l),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 qc(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}/${qc(f)}`}}let c="#",u=`${c}/${a}/`;if(s[1]===n&&!s[1].schema.id)return{ref:c};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+qc(l)}},i=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=r(s);if(a.def={...a.schema},u)a.defId=u;let l=a.schema;for(let p in l)delete l[p];l.$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,l=c&&Ii.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&&l&&g?.async===!1&&g.jitless!==!0){if(!s)s=i(t.shape);if(f=s(f,g),!p)return f;return Na([],y,f,g,m,e,g?.abortEarly===!0)}return n(f,g)}});function Fs(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 dr=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 Fs(s,r,e,o);return Promise.all(s).then((a)=>Fs(a,r,e,o))}});function sm(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 La=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,dr.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[u,l]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(i,u))te(i,u,new Set);for(let p of l)i[u].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(()=>sm(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((u)=>r.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),o}}),Da=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,u])=>Hs(n,c,u));return Hs(n,i,s)}});function ar(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=ar(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=ar(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 Hs(e,t,n){let r=new Map,o,i=new Map,s=(u,l)=>{let p;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),p=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let m=String(u.path[0]);if(!i.has(m))i.set(m,u);p=[m]}else return!1;for(let m of p){if(!r.has(m))r.set(m,{});r.get(m)[l]=!0}return!0};for(let u of t.issues)if(!s(u,"l"))e.issues.push(u);for(let u of n.issues)if(!s(u,"r"))e.issues.push(u);let a=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter((l)=>o.keys.includes(l)):[];if(u.length)e.issues.push({...o,keys:u});for(let l of a)if(!u.includes(l)&&i.has(l))e.issues.push(i.get(l))}let c=ar(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 pr=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=js(n,"optin"),u=js(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 l=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)=>{l[f]=y}));else if(l[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)=>Vs(k,o,f)));else Vs(v,o,f)}}if(a.length)return Promise.all(a).then(()=>qs(l,o,n,s,u));return qs(l,o,n,s,u)}});function js(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 Vs(e,t,n){if(e.issues.length)t.issues.push(...de(n,e.issues));t.value[n]=e.value}function qs(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 Ba=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 l of a)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(c.add(typeof l==="number"?l.toString():l),l==="__proto__")continue;let p=t.keyType._zod.run({value:l,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:l,path:[l],inst:e});continue}let m=p.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}}let u;for(let l in i)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;r.value[l]=i[l]}else u=u??[],u.push(l);if(u&&u.length>0)r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{r.value=n?n.alloc(e,r,{},o):{};let c;for(let u of Reflect.ownKeys(i)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&xt.test(u)&&l.issues.length){let g=t.keyType._zod.run({value:Number(u),issues:[]},o);if(g instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(g.issues.length===0)l=g}if(l.issues.length){if(t.mode==="loose")r.value[u]=i[u];else if(a)c=c??[],c.push(u);else r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((g)=>pe(g,o,Q())),input:u,path:[u],inst:e});continue}let m=l.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:i[u],issues:[]},o);if(f instanceof Promise)s.push(f.then((g)=>{if(g.issues.length)r.issues.push(...de(u,g.issues));r.value[m]=g.value}));else{if(f.issues.length)r.issues.push(...de(u,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 Ua=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}}),Za=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 Fa=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 Gs(e,t){return e.value=t.issues.length?void 0:t.value,e}var mr=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)=>Gs(n,i));return Gs(n,o)}return t.innerType._zod.run(n,r)}}),Ha=h("$ZodExactOptional",(e,t)=>{mr.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)}),ja=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)}}),Va=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)=>Ks(i,t));return Ks(o,t)}});function Ks(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var qa=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)}}),Ga=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)=>Ws(i,e));return Ws(o,e)}});function Ws(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 Js(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 Ka=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)=>Js(n,i,t,r));return Js(n,o,t,r)}});var fr=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)=>Jt(s,t.in,r));return Jt(i,t.in,r)}let o=t.in._zod.run(n,r);if(o instanceof Promise)return o.then((i)=>Jt(i,t.out,r));return Jt(o,t.out,r)}});function Jt(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 Wa=h("$ZodPreprocess",(e,t)=>{fr.init(e,t)}),Ja=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(Ys);return Ys(o)}});function Ys(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Ya=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?Jn(e._def.input,r):r,i=Reflect.apply(n,this,o);if(e._def.output)return Jn(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 Yn(e._def.input,r):r,i=await Reflect.apply(n,this,o);if(e._def.output)return await Yn(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 pr({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)),Xa=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 Qa=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)=>Xs(i,n,r,e));Xs(o,n,r,e);return}});function Xs(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 tc extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var hr="~memo",ec=[];function nc(e){return e!==null&&typeof e==="object"}function gr(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var rc=new WeakMap,_t=0,rn=1,vt=2;function on(e,t,n){let r=rc.get(e);if(r!==void 0)return r?vt:_t;if(t.has(e))return vt;t.add(e);let o=_t,i=(l)=>{if(o!==vt&&l?._zod){let p=on(l,t,n);if(p>o)o=p}},s=(l,p)=>{let m=_t;for(let f of Reflect.ownKeys(l)){let g=Object.getOwnPropertyDescriptor(l,f);if(p&&!g.enumerable)continue;let y=g.get?rn:g.value?._zod?on(g.value,t,n):_t;if(y>m)m=y}return m},a=(l)=>{if(l>o)o=l},c=e._zod.def,u=c.type;switch(u){case"object":{let l=gt(c);a(l?s(l,!0):rn),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let l of c.items)i(l);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 l of c.options)i(l);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 l=c._cachedInner??(n?e._zod.innerType:void 0);a(l?on(l,t,!1):rn);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 l in c){let p=Object.getOwnPropertyDescriptor(c,l);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),am(e,o)}function am(e,t){if(t!==rn)rc.set(e,t===vt);return t}function cm(e,t){let n=e.buckets.get(t);if(!n)n=new WeakMap,e.buckets.set(t,n);return n}var tn,nn=[],um={alloc(e,t,n){let r=tn;if(!r)return n;tn=void 0;let o={value:n,issues:null};return r.set(t.value,o),nn.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"&&lm(i,o.value))throw new tc;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,u)=>{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,u)}if(v===vt||r)n=!0;else r=!0}let l=c.value;if(!nc(l))return s(c,u);let p=u[hr];if(!p)p={buckets:new WeakMap,backEdges:void 0},u[hr]=p;let m;if(o===u)m=i;else m=cm(p,e),o=u,i=m;let f=m.get(l);if(f){if(c.value=f.value,f.issues){if(f.issues.length)c.issues.push(...gr(f.issues))}else c.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(f.value);return c}tn=m;let g=nn.length,y=s(c,u);tn=void 0;let S=nn.length>g?nn.pop():void 0;if(y instanceof Promise)return y.then((v)=>{if(S)S.issues=v.issues.length?gr(v.issues):ec;return v});if(S)S.issues=y.issues.length?gr(y.issues):ec;return y};if(e._zod.parse=a,e._zod.run===s)e._zod.run=a})}};function yr(){return um}function lm(e,t){let n=e[hr]?.backEdges;return n!==void 0&&nc(t)&&n.has(t)}var dm=()=>{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=Ni(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 ${Un(i.values[0])}`;return`Invalid option: expected one of ${Ln(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":""}: ${Ln(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 br(){return{localeError:dm()}}var oc;class ic{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 sc(){return new ic}(oc=globalThis).__zod_globalRegistry??(oc.__zod_globalRegistry=sc());var Re=globalThis.__zod_globalRegistry;function ac(e){if(e.checks)e.checks=[...e.checks];return e}function cc(e,t){return new e(ac({type:"string",..._(t)}))}function uc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}function lc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}function dc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}function pc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}function mc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}function fc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}function gc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}function hc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}function yc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}function bc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}function xc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}function Sc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}function _c(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}function vc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}function Tc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}function Cc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}function kc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}function Ec(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}function Rc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}function Ac(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}function Ic(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 Pc(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}function Mc(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}function Oc(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}function zc(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}function Nc(e,t){return new e(ac({type:"number",checks:[],..._(t)}))}function $c(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}function Lc(e,t){return new e({type:"boolean",..._(t)})}function Dc(e){return new e({type:"unknown"})}function Bc(e,t){return new e({type:"never",..._(t)})}function Uc(e,t){return new e({type:"void",..._(t)})}function Zc(e,t){return new e({type:"date",..._(t)})}function sn(e,t){return new or({check:"less_than",..._(t),value:e,inclusive:!1})}function Fe(e,t){return new or({check:"less_than",..._(t),value:e,inclusive:!0})}function an(e,t){return new ir({check:"greater_than",..._(t),value:e,inclusive:!1})}function He(e,t){return new ir({check:"greater_than",..._(t),value:e,inclusive:!0})}function cn(e,t){return new Es({check:"multiple_of",..._(t),value:e})}function un(e,t){return new As({check:"max_length",..._(t),maximum:e})}function je(e,t){return new Is({check:"min_length",..._(t),minimum:e})}function ln(e,t){return new ws({check:"length_equals",..._(t),length:e})}function xr(e,t){return new Ps({check:"string_format",format:"regex",..._(t),pattern:e})}function Sr(e){return new Ms({check:"string_format",format:"lowercase",..._(e)})}function _r(e){return new Os({check:"string_format",format:"uppercase",..._(e)})}function vr(e,t){return new zs({check:"string_format",format:"includes",..._(t),includes:e})}function Tr(e,t){return new Ns({check:"string_format",format:"starts_with",..._(t),prefix:e})}function Cr(e,t){return new $s({check:"string_format",format:"ends_with",..._(t),suffix:e})}function Ae(e){return new Ls({check:"overwrite",tx:e})}function kr(e){return Ae((t)=>t.normalize(e))}function Er(){return Ae((e)=>e.trim())}function Rr(){return Ae((e)=>e.toLowerCase())}function Ar(){return Ae((e)=>e.toUpperCase())}function Ir(){return Ae((e)=>Ai(e))}function Fc(e,t,n){return new e({type:"array",element:t,..._(n)})}function Hc(e,t,n){let r=_(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function jc(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._(n)})}function Vc(e,t){let n=pm((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 pm(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 l={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);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,l)}let p=e._zod.parent;if(p){if(!s.ref)s.ref=p;D(p,t,l),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 qc(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}/${qc(f)}`}}let c="#",u=`${c}/${a}/`;if(s[1]===n&&!s[1].schema.id)return{ref:c};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+qc(l)}},i=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=o(s);if(a.def={...a.schema},u)a.defId=u;let l=a.schema;for(let p in l)delete l[p];l.$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 u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){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 Wc(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;Wc(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 Jc=new Set(["type","properties","required","additionalProperties"]),Gc=["oneOf","anyOf"];function Kc(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 Po(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!Jc.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 u of t){let l=u.properties?.[s]??Kc(u);if(l===null||l===void 0)continue;if(!a.some((p)=>JSON.stringify(p)===JSON.stringify(l)))a.push(l)}let c=a.length===1?a[0]:Po(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=Kc(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 dm(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let r of Jc)if(r in e)return;let n=t.filter((r)=>Gc.some((i)=>Array.isArray(r[i]))),o=null;if(!n.length)o=Po(t);else{let r=n[0],i=Gc.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)=>Po([...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 u=c.def??c.schema,l={...u},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"))u.allOf=u.allOf??[],u.allOf.push(g);else Tt(u,g);if(Tt(u,l),a._zod.parent===p)for(let _ in u){if(_==="$ref"||_==="allOf")continue;if(!(_ in l))delete u[_]}if(g.$ref&&f.def)for(let _ in u){if(_==="$ref"||_==="allOf")continue;if(_ in f.def&&JSON.stringify(u[_])===JSON.stringify(f.def[_]))delete u[_]}}let m=a._zod.parent;if(m&&m!==p){o(m);let f=e.seen.get(m);if(f?.schema.$ref){if(u.$ref=f.schema.$ref,f.def)for(let g in u){if(g==="$ref"||g==="allOf")continue;if(g in f.def&&JSON.stringify(u[g])===JSON.stringify(f.def[g]))delete u[g]}}}e.override({zodSchema:a,jsonSchema:u,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())Wc(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 u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let p=a.get(l);if(p)p.push(u);else a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])dm(u)}}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 Yc=(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},Xc=(e,t)=>{Ve(e,"minimum",t),qe(e,"maximum",t)},ou=(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)},iu=(e,t)=>{e.mime=e.mime?e.mime.filter((n)=>t.includes(n)):[...t]},su=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Qc=(e,t)=>Ve(e,"minimum",t.minimum),eu=(e,t)=>qe(e,"maximum",t.maximum),tu=(e)=>(t,n)=>{su(t,n.format);let[o,r]=e[n.format];Ve(t,"minimum",o),qe(t,"maximum",r)},pm={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)=>ou(e,t.value),number_format:tu(Ut),bigint_format:tu(Zn),min_length:Qc,max_length:eu,length_equals:(e,t)=>Xc(e,t.length),min_size:Qc,max_size:eu,size_equals:(e,t)=>Xc(e,t.size),string_format:(e,t)=>{if(su(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)=>iu(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)pm[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)ou(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)iu(t,r.mime);for(let i of r.patterns??[])ru(t,i);return t}var mm={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},fm=new Map([[uo,fs],[en,gs]]),au=(e)=>fm.get(e)??e,zo=(e,t,n,o)=>{let r=n;r.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u,laxFormat:l}=W(e);if(typeof i==="number")r.minLength=i;if(typeof s==="number")r.maxLength=s;if(a){if(r.format=mm[a]??a,r.format==="")delete r.format;if(a==="time"||l)delete r.format}if(u)r.contentEncoding=u;if(c&&c.size>0){let p=[...c].map(au);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}))]}},No=(e,t,n,o)=>{let r=n,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=W(e);r.type=l?"integer":"number";let p=typeof u==="number"&&u>=(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=u,r.exclusiveMinimum=!0;else r.exclusiveMinimum=u;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,..._]=g;if(y!==void 0)r.multipleOf=y;if(_.length)r.allOf=[...r.allOf??[],..._.map((v)=>({multipleOf:v}))]}},$o=(e,t,n,o)=>{n.type="boolean"},cu=(e,t,n,o)=>{q(e,t,n,o,"BigInt cannot be represented in JSON Schema")},uu=(e,t,n,o)=>{q(e,t,n,o,"Symbols cannot be represented in JSON Schema")},lu=(e,t,n,o)=>{if(t.target==="openapi-3.0")n.type="string",n.nullable=!0,n.enum=[null];else n.type="null"},du=(e,t,n,o)=>{q(e,t,n,o,"Undefined cannot be represented in JSON Schema")},Lo=(e,t,n,o)=>{q(e,t,n,o,"Void cannot be represented in JSON Schema")},Do=(e,t,n,o)=>{n.not={}},pu=(e,t,n,o)=>{},Bo=(e,t,n,o)=>{},Uo=(e,t,n,o)=>{q(e,t,n,o,"Date cannot be represented in JSON Schema")},Zo=(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},Fo=(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}},mu=(e,t,n,o)=>{q(e,t,n,o,"NaN cannot be represented in JSON Schema")},fu=(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},gu=(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}))},hu=(e,t,n,o)=>{n.type="boolean"},Ho=(e,t,n,o)=>{q(e,t,n,o,"Custom types cannot be represented in JSON Schema")},jo=(e,t,n,o)=>{q(e,t,n,o,"Function types cannot be represented in JSON Schema")},Vo=(e,t,n,o)=>{q(e,t,n,o,"Transforms cannot be represented in JSON Schema")},yu=(e,t,n,o)=>{q(e,t,n,o,"Map cannot be represented in JSON Schema")},bu=(e,t,n,o)=>{q(e,t,n,o,"Set cannot be represented in JSON Schema")},qo=(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 Go=(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 u in s)te(r.properties,u,D(s[u],t,{...o,path:[...o.path,"properties",u]}));let c=[];for(let u of Object.keys(s)){let l=i.shape[u];if(t.io==="input"?At(l)===void 0:l._zod.optout===void 0)c.push(u)}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"]})},Ko=(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},Wo=(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=(u)=>("allOf"in u)&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)},Jo=(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,_)=>D(y,t,{...o,path:[...o.path,s,_]})),u=i.rest?D(i.rest,t,{...o,path:[...o.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;while(l>0){let y=i.items[l-1];if(!(t.io==="input"?At(y)!==void 0:y._zod.optout==="optional"))break;l--}let p=i.items.length,m=!i.rest;if(t.target==="draft-2020-12"){if(r.prefixItems=c,m)r.items=!1;else if(u)r.items=u;if(l>0)r.minItems=l;if(m)r.maxItems=p}else if(t.target==="openapi-3.0"){if(r.items={anyOf:c},u)r.items.anyOf.push(u);if(l>0)r.minItems=l;if(m)r.maxItems=p}else{if(r.items=c,m)r.additionalItems=!1;else if(u)r.additionalItems=u;if(l>0)r.minItems=l;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 Mo(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=Mo(e,g,n);return y===g?t:y}for(let g of["anyOf","oneOf"]){let y=t[g];if(!Array.isArray(y))continue;let _=y.map((v)=>Mo(e,v,n));if(_.some((v,k)=>v!==y[k]))t={...t,[g]:_}}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:u,multipleOf:l,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:no).source;return f}var Oo=new WeakMap;function gm(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 Oo.get(e)??[]){let r=e.seen.get(o),i=(r?.def??r?.schema)?.propertyNames;if(!i||i===!0||n.has(i))continue;let s=Mo(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 Yo=(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 l=D(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});r.patternProperties={};for(let p of a)te(r.patternProperties,au(p).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){r.propertyNames=D(i.keyType,t,{...o,path:[...o.path,"propertyNames"]});let l=Oo.get(t);if(!l)l=[],Oo.set(t,l),t.deferred.push(()=>gm(t));l.push(e)}r.additionalProperties=D(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let c=s._zod.values,u=t.io==="input"&&At(i.valueType)!==void 0;if(c&&!i.partial&&!u){let l=[...c].filter((p)=>typeof p==="string"||typeof p==="number");if(l.length>0)r.required=l.map(String)}},Xo=(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"}]},Qo=(e,t,n,o)=>{let r=e._zod.def;D(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType},er=Symbol();function xu(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"),er}var tr=(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=xu(r.defaultValue,e,t,n,o);if(s!==er)n.default=s},nr=(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=xu(r.defaultValue,e,t,n,o);if(s!==er)n._prefault=s},or=(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},rr=(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},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,n.readOnly=!0},sr=(e,t,n,o)=>{let r=e._zod.def;D(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType},dn=(e,t,n,o)=>{let r=e._zod.def;D(r.innerType,t,o);let i=t.seen.get(e);i.ref=r.innerType},_u=(e,t,n,o)=>{let r=e._zod.innerType;D(r,t,o);let i=t.seen.get(e);i.ref=r},nu={string:zo,number:No,boolean:$o,bigint:cu,symbol:uu,null:lu,undefined:du,void:Lo,never:Do,any:pu,unknown:Bo,date:Uo,enum:Zo,literal:Fo,nan:mu,template_literal:fu,file:gu,success:hu,custom:Ho,function:jo,transform:Vo,map:yu,set:bu,array:qo,object:Go,union:Ko,intersection:Wo,tuple:Jo,record:Yo,nullable:Xo,nonoptional:Qo,default:tr,prefault:nr,catch:or,pipe:rr,readonly:ir,promise:sr,optional:dn,lazy:_u};function Su(e,t){if("_idmap"in e){let o=e,r=kt({...t,processors:nu}),i={};for(let c of o._idmap.entries()){let[u,l]=c;D(l,r)}let s={},a={registry:o,uri:t?.uri,defs:i};r.external=a;for(let c of o._idmap.entries()){let[u,l]=c;Et(r,l),te(s,u,Rt(r,l))}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:nu});return D(e,n),Et(n,e),Rt(n,e)}var vu=new WeakSet([Object.prototype,Error.prototype]);function mn(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 Cm=(e,t)=>{Fi.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);if(vu.has(n))return;vu.add(n),mn(n,"format",(o)=>(r)=>Wn(o,r)),mn(n,"flatten",(o)=>(r)=>Kn(o,r)),mn(n,"addIssue",(o)=>(r)=>{o.issues.push(r),o.message=JSON.stringify(o.issues,mt,2)}),mn(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",Cm,void 0,{Parent:Error});var Tu=yt(oe),Cu=bt(oe),ku=Gt(oe),Eu=Kt(oe),Ru=Vi(oe),Au=qi(oe),wu=Gi(oe),Iu=Ki(oe),Pu=Wi(oe),Mu=Ji(oe),Ou=Yi(oe),zu=Xi(oe);function Em(){if(!Y.localeError)Q(xo())}function wt(){if(!Y.memoizer)Q({memoizer:bo()})}var N=h("ZodType",(e,t)=>(Em(),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(Af(e,t))},superRefine(e,t){return this.check(wf(e,t))},overwrite(e){return this.check(Ae(e))},optional(){return Lu(this)},exactOptional(){return ff(this)},nullable(){return Du(this)},nullish(){return Lu(Du(this))},nonoptional(e){return _f(this,e)},array(){return E(this)},or(e){return Ge([this,e])},and(e){return uf(this,e)},transform(e){return Bu(this,Hu(e))},default(e){return yf(this,e)},prefault(e){return xf(this,e)},catch(e){return vf(this,e)},pipe(e){return Bu(this,e)},readonly(){return kf(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 Vt(this,"~standard",{...co(this),jsonSchema:{input:Ct(this,"input"),output:Ct(this,"output")}})},set "~standard"(e){xe(this,"~standard",e)},parse:function e(t,n){return Tu(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Cu(this,t,n,{callee:e})},safeParse(e,t){return ku(this,e,t)},async safeParseAsync(e,t){return Eu(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){xe(this,"spa",e)},validate(e,t){return Xn(this,e,t)},validateAsync(e,t){return Qn(this,e,t)},encode:function e(t,n){return Ru(this,t,n,{callee:e})},decode:function e(t,n){return Au(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await wu(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Iu(this,t,n,{callee:e})},safeEncode(e,t){return Pu(this,e,t)},safeDecode(e,t){return Mu(this,e,t)},async safeEncodeAsync(e,t){return Ou(this,e,t)},async safeDecodeAsync(e,t){return zu(this,e,t)},toJSONSchema(e){return Yc(this,{})(e)},get description(){return Re.get(this)?.description},get _def(){return this._zod.def}}),Uu=h("_ZodString",(e,t)=>{Qt.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>zo(e,n,o,r)},Hn({format:(e)=>W(e).format??null,minLength:(e)=>W(e).minimum??null,maxLength:(e)=>W(e).maximum??null},{regex(...e){return this.check(_o(...e))},includes(...e){return this.check(To(...e))},startsWith(...e){return this.check(Co(...e))},endsWith(...e){return this.check(ko(...e))},min(...e){return this.check(je(...e))},max(...e){return this.check(un(...e))},length(...e){return this.check(ln(...e))},nonempty(...e){return this.check(je(1,...e))},lowercase(e){return this.check(So(e))},uppercase(e){return this.check(vo(e))},trim(){return this.check(Ro())},normalize(...e){return this.check(Eo(...e))},toLowerCase(){return this.check(Ao())},toUpperCase(){return this.check(wo())},slugify(){return this.check(Io())}})),Rm=h("ZodString",(e,t)=>{Qt.init(e,t),Uu.init(e,t)},{email(e){return this.check(uc(Mm,e))},url(e){return this.check(gc(zm,e))},jwt(e){return this.check(Ic(Wm,e))},emoji(e){return this.check(hc(Nm,e))},guid(e){return this.check(lc(Om,e))},uuid(e){return this.check(dc(fn,e))},uuidv4(e){return this.check(pc(fn,e))},uuidv6(e){return this.check(mc(fn,e))},uuidv7(e){return this.check(fc(fn,e))},nanoid(e){return this.check(yc($m,e))},cuid(e){return this.check(bc(Lm,e))},cuid2(e){return this.check(xc(Dm,e))},ulid(e){return this.check(_c(Bm,e))},base64(e){return this.check(Rc(qm,e))},base64url(e){return this.check(Ac(Gm,e))},xid(e){return this.check(Sc(Um,e))},ksuid(e){return this.check(vc(Zm,e))},ipv4(e){return this.check(Tc(Fm,e))},ipv6(e){return this.check(Cc(Hm,e))},cidrv4(e){return this.check(kc(jm,e))},cidrv6(e){return this.check(Ec(Vm,e))},e164(e){return this.check(wc(Km,e))},datetime(e){return this.check(Pc(Am,e))},date(e){return this.check(Mc(wm,e))},time(e){return this.check(Oc(Im,e))},duration(e){return this.check(zc(Pm,e))}});function d(e){return cc(Rm,e)}var F=h("ZodStringFormat",(e,t)=>{U.init(e,t),Uu.init(e,t)}),Am=h("ZodISODateTime",(e,t)=>{ma.init(e,t),F.init(e,t)}),wm=h("ZodISODate",(e,t)=>{fa.init(e,t),F.init(e,t)}),Im=h("ZodISOTime",(e,t)=>{ga.init(e,t),F.init(e,t)}),Pm=h("ZodISODuration",(e,t)=>{ha.init(e,t),F.init(e,t)}),Mm=h("ZodEmail",(e,t)=>{na.init(e,t),F.init(e,t)});var Om=h("ZodGUID",(e,t)=>{ea.init(e,t),F.init(e,t)});var fn=h("ZodUUID",(e,t)=>{ta.init(e,t),F.init(e,t)});var zm=h("ZodURL",(e,t)=>{ia.init(e,t),F.init(e,t)});var Nm=h("ZodEmoji",(e,t)=>{sa.init(e,t),F.init(e,t)});var $m=h("ZodNanoID",(e,t)=>{aa.init(e,t),F.init(e,t)});var Lm=h("ZodCUID",(e,t)=>{ca.init(e,t),F.init(e,t)});var Dm=h("ZodCUID2",(e,t)=>{ua.init(e,t),F.init(e,t)});var Bm=h("ZodULID",(e,t)=>{la.init(e,t),F.init(e,t)});var Um=h("ZodXID",(e,t)=>{da.init(e,t),F.init(e,t)});var Zm=h("ZodKSUID",(e,t)=>{pa.init(e,t),F.init(e,t)});var Fm=h("ZodIPv4",(e,t)=>{ya.init(e,t),F.init(e,t)});var Hm=h("ZodIPv6",(e,t)=>{xa.init(e,t),F.init(e,t)});var jm=h("ZodCIDRv4",(e,t)=>{_a.init(e,t),F.init(e,t)});var Vm=h("ZodCIDRv6",(e,t)=>{Sa.init(e,t),F.init(e,t)});var qm=h("ZodBase64",(e,t)=>{Ta.init(e,t),F.init(e,t)});var Gm=h("ZodBase64URL",(e,t)=>{Ca.init(e,t),F.init(e,t)});var Km=h("ZodE164",(e,t)=>{ka.init(e,t),F.init(e,t)});var Wm=h("ZodJWT",(e,t)=>{Ea.init(e,t),F.init(e,t)});var Zu=h("ZodNumber",(e,t)=>{lo.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>No(e,n,o,r),e.isFinite=!0},Hn({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(an(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(sn(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(Nu(e))},safe(e){return this.check(Nu(e))},positive(e){return this.check(an(0,e))},nonnegative(e){return this.check(He(0,e))},negative(e){return this.check(sn(0,e))},nonpositive(e){return this.check(Fe(0,e))},multipleOf(e,t){return this.check(cn(e,t))},step(e,t){return this.check(cn(e,t))},finite(){return this}}));function x(e){return Nc(Zu,e)}var Jm=h("ZodNumberFormat",(e,t)=>{Ra.init(e,t),Zu.init(e,t)});function Nu(e){return $c(Jm,e)}var Ym=h("ZodBoolean",(e,t)=>{Aa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>$o(e,n,o,r)});function I(e){return Lc(Ym,e)}var Xm=h("ZodUnknown",(e,t)=>{wa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Bo(e,n,o,r)});function K(){return Dc(Xm)}var Qm=h("ZodNever",(e,t)=>{Ia.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Do(e,n,o,r)});function ef(e){return Bc(Qm,e)}var tf=h("ZodVoid",(e,t)=>{Pa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Lo(e,n,o,r)});function nf(e){return Uc(tf,e)}var of=h("ZodDate",(e,t)=>{Ma.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Uo(e,n,o,r),e.min=(n,o)=>e.check(He(n,o)),e.max=(n,o)=>e.check(Fe(n,o))},Hn({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 gn(e){return Zc(of,e)}var rf=h("ZodArray",(e,t)=>{wt(),Oa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>qo(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(un(e,t))},length(e,t){return this.check(ln(e,t))},unwrap(){return this.element}});function E(e,t){return Fc(rf,e,t)}var sf=h("ZodObject",(e,t)=>{wt(),$a.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Go(e,n,o,r),Ip(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:ef()}))},strip(){return this.clone(ne(this._zod.def,{catchall:void 0}))},extend(e){return vp(this,e)},safeExtend(e){return Tp(this,e)},merge(e){return Cp(this,e)},pick(e){return _p(this,e)},omit(e){return Sp(this,e)},partial(...e){return Oi(ur,this,e[0])},exactPartial(...e){return Oi(ju,this,e[0],"exactPartial")},required(...e){return kp(Vu,this,e[0])}});function b(e,t){let n={type:"object",shape:e??{},...S(t)};return new sf(n)}var Fu=h("ZodUnion",(e,t)=>{po.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ko(e,n,o,r),e.options=t.options});function Ge(e,t){return new Fu({type:"union",options:e,...S(t)})}var af=h("ZodDiscriminatedUnion",(e,t)=>{Fu.init(e,t),La.init(e,t)});function cr(e,t,n){return new af({type:"union",options:t,discriminator:e,...S(n)})}var cf=h("ZodIntersection",(e,t)=>{Da.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Wo(e,n,o,r)});function uf(e,t){return new cf({type:"intersection",left:e,right:t})}var lf=h("ZodTuple",(e,t)=>{wt(),mo.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Jo(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 ur({type:"optional",innerType:t}))})}});function df(e,t,n){let o=t instanceof z,r=o?n:t;return new lf({type:"tuple",items:e,rest:o?t:null,...S(r)})}var $u=h("ZodRecord",(e,t)=>{wt(),Ba.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Yo(e,n,o,r),e.keyType=t.keyType,e.valueType=t.valueType});function j(e,t,n){if(!t||!t._zod)return new $u({type:"record",keyType:d(),valueType:e,...S(t)});return new $u({type:"record",keyType:e,valueType:t,...S(n)})}var ar=h("ZodEnum",(e,t)=>{Ua.init(e,t),N.init(e,t),e._zod.processJSONSchema=(o,r,i)=>Zo(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 ar({...t,checks:[],...S(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 ar({...t,checks:[],...S(r),entries:i})}});function w(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new ar({type:"enum",entries:n,...S(t)})}var pf=h("ZodLiteral",(e,t)=>{Za.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Fo(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 pf({type:"literal",values:Array.isArray(e)?e:[e],...S(t)})}var mf=h("ZodTransform",(e,t)=>{wt(),Fa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Vo(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 Hu(e){return new mf({type:"transform",transform:e})}var ur=h("ZodOptional",(e,t)=>{fo.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>dn(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Lu(e){return new ur({type:"optional",innerType:e})}var ju=h("ZodExactOptional",(e,t)=>{Ha.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>dn(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function ff(e){return new ju({type:"optional",innerType:e})}var gf=h("ZodNullable",(e,t)=>{ja.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 Du(e){return new gf({type:"nullable",innerType:e})}var hf=h("ZodDefault",(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,e.removeDefault=e.unwrap});function yf(e,t){return new hf({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Bn(t)}})}var bf=h("ZodPrefault",(e,t)=>{qa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>nr(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function xf(e,t){return new bf({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Bn(t)}})}var Vu=h("ZodNonOptional",(e,t)=>{Ga.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Qo(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function _f(e,t){return new Vu({type:"nonoptional",innerType:e,...S(t)})}var Sf=h("ZodCatch",(e,t)=>{Ka.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>or(e,n,o,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function vf(e,t){return new Sf({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Li(t)})}var qu=h("ZodPipe",(e,t)=>{go.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>rr(e,n,o,r),e.in=t.in,e.out=t.out});function Bu(e,t){return new qu({type:"pipe",in:e,out:t})}var Tf=h("ZodPreprocess",(e,t)=>{qu.init(e,t),Wa.init(e,t)}),Cf=h("ZodReadonly",(e,t)=>{Ja.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 kf(e){return new Cf({type:"readonly",innerType:e})}var Ef=h("ZodPromise",(e,t)=>{Xa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>sr(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function lr(e){return new Ef({type:"promise",innerType:e})}var Rf=h("ZodFunction",(e,t)=>{Ya.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>jo(e,n,o,r)});function hn(e){return new Rf({type:"function",input:Array.isArray(e?.input)?df(e?.input):e?.input??E(K()),output:e?.output??K()})}var Gu=h("ZodCustom",(e,t)=>{Qa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ho(e,n,o,r)});function se(e,t){return Hc(Gu,e??(()=>!0),t)}function Af(e,t={}){return jc(Gu,e,t)}function wf(e,t){return Vc(e,t)}function Ku(e,t){return new Tf({type:"pipe",in:Hu(e),out:t})}var yn=["none","minimal","low","medium","high","xhigh","max"],dr=w(yn),bn=dr.exclude(["none"]),If=w([...yn,"default"]).nullable(),pr=cr("type",[b({type:V("toggle")}).strict(),b({type:V("effort"),values:E(If)}).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 Wu=w(["default","openai-responses","r1"]),Pf={DEFAULT:"default",OPENAI_RESPONSES:"openai-responses",R1:"r1"},Ju=w(["images","video","tools","streaming","prompt-cache","reasoning","reasoning-effort","computer-use","global-endpoint","structured_output","temperature","files"]),Yu=w(["active","preview","deprecated","legacy"]),Xu=b({input:x().optional(),output:x().optional(),cacheWrite:x().optional(),cacheRead:x().optional()}),Qu=b({maxBudget:x().optional(),outputPrice:x().optional(),thinkingLevel:w(["low","high"]).optional()}),el=b({reasoningDefaultOn:I().optional(),apiProtocol:w(["openai-chat","openai-responses","anthropic","gemini"]).optional()}).catchall(K()),mr=w(["text","image","audio","video","pdf"]),tl=b({input:E(mr),output:E(mr)});function nl(e){return(e?.input===void 0||e.input.includes("text"))&&(e?.output===void 0||e.output.includes("text"))}var ol=w(["language","image-generation","speech-generation","video-generation","transcription","realtime"]);function Mf(e){let t=e.modalities?.input,n=e.modalities?.output;return t?.length===1&&t[0]==="audio"&&n?.length===1&&n[0]==="text"}function Of(e){return(e.operation===void 0||e.operation==="language")&&nl(e.modalities)}var rl=w(["batch","streaming"]);function zf(e){return e.modalities?.input.includes("text")===!0&&e.modalities.output.includes("image")}function Nf(e){return e.operation==="image-generation"}function fr(e,t,n){let o=e.capabilities;if(o===void 0||o.length===0)return n?.assumeWhenUnspecified??!1;return o.includes(t)}function $f(e){return fr(e,"tools",{assumeWhenUnspecified:!0})}function Lf(e){return fr(e,"images",{assumeWhenUnspecified:!0})}var xn=b({id:d(),name:d().optional(),description:d().optional(),maxTokens:x().optional(),contextWindow:x().optional(),maxInputTokens:x().optional(),capabilities:E(Ju).optional(),operation:ol.optional(),operationModes:E(rl).optional(),modalities:tl.optional(),reasoningOptions:E(pr).optional(),apiFormat:Wu.optional(),systemRole:w(["system","developer"]).optional(),temperature:x().optional(),pricing:Xu.optional(),thinkingConfig:Qu.optional(),status:Yu.optional(),deprecationNotice:d().optional(),replacedBy:d().optional(),releaseDate:d().optional(),deprecationDate:d().optional(),family:d().optional(),metadata:el.optional()});var Df="This tool call was rejected by the user and not executed.",Bf="NOT a tool or system failure. Clarify with user before proceeding.",gr=b({id:d(),name:d(),execution:w(["client","provider"]).optional(),input:K(),output:K(),error:d().optional(),durationMs:x(),startedAt:gn(),endedAt:gn()});var Uf=w(["completed","max_iterations","aborted","mistake_limit","error"]),Zf=b({inputTokens:x(),outputTokens:x(),cacheReadTokens:x().optional(),cacheWriteTokens:x().optional(),totalCost:x().optional()}),uv=b({text:d(),usage:Zf,messages:E(se()),toolCalls:E(gr),iterations:x(),finishReason:Uf,model:b({id:d(),provider:d(),info:xn.optional()}),startedAt:gn(),endedAt:gn(),durationMs:x()}),lv=b({distinctId:d().optional(),sessionId:d().optional(),providerId:d(),modelId:d(),apiKey:d().optional(),baseUrl:d().url().optional(),headers:j(d(),d()).optional(),knownModels:j(d(),xn).optional(),providerConfig:K().optional(),initialMessages:E(se()).optional(),systemPrompt:d(),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:hn().input([d()]).output(lr(d())).optional(),toolContextMetadata:j(d(),K()).optional(),execution:b({maxConsecutiveMistakes:x().int().positive().optional(),reminderAfterIterations:x().nonnegative().optional(),reminderText:d().optional(),loopDetection:Ge([V(!1),b({softThreshold:x().int().positive().optional(),hardThreshold:x().int().positive().optional()})]).optional()}).optional(),reasoningEffort:bn.optional(),thinkingBudgetTokens:x().positive().optional(),thinking:I().optional(),onEvent:hn().input([se()]).output(nf()).optional(),hooks:se().optional(),parentAgentId:d().optional(),extensions:E(se()).optional(),hookErrorMode:w(["ignore","throw"]).default("ignore"),toolPolicies:j(d(),b({enabled:I().optional(),autoApprove:I().optional()})).optional(),requestToolApproval:hn().input([b({sessionId:d(),agentId:d(),conversationId:d(),iteration:x(),toolCallId:d(),toolName:d(),input:K(),policy:b({enabled:I().optional(),autoApprove:I().optional()}).default({})})]).output(Ge([b({approved:I(),reason:d().optional()}),lr(b({approved:I(),reason:d().optional()}))])).optional(),onConsecutiveMistakeLimitReached:hn().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:d().optional()})]).output(Ge([b({action:V("continue"),guidance:d().optional()}),b({action:V("stop"),reason:d().optional()}),lr(Ge([b({action:V("continue"),guidance:d().optional()}),b({action:V("stop"),reason:d().optional()})]))])).optional(),logger:se().optional(),extensionContext:se().optional(),abortSignal:se().optional()});var il=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"]),sl=b({id:d().optional(),label:d().optional(),role:d().optional(),participantKey:d().optional(),participantLabel:d().optional(),platformUserId:d().optional(),metadata:j(d(),K()).optional()}),al=b({source:d(),sourceEvent:d(),threadId:d(),channelId:d(),isDM:I(),sessionId:d().optional(),workspaceRoot:d().optional(),metadata:j(d(),K()).optional()}),Ff=b({actor:sl,context:al,payload:j(d(),K()).optional()}),Hf=b({action:w(["allow","deny"]).default("allow"),message:d().optional(),reason:d().optional(),metadata:j(d(),K()).optional()}),jf=b({adapter:d(),botUserName:d().optional(),event:il,payload:j(d(),K()),ts:d()});var cl=[{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 ul(){return cl.map((e)=>({...e}))}function ll(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 Vf(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(!ll(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 qf(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 Gf(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=qf(a,r);if(!c.managed){i.push(a);continue}if(c.consumesNext)s+=1}return[...i,...n]}function Kf(e=dl){let t=new Set(ul().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 Wf(e){return/^\d+$/.test(e)?void 0:"Telegram user ID must contain digits only"}function Jf(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 Yf(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 dl=[{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:Wf}],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:Jf},{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:Yf}],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 pl=[];function hr(e){pl.push(e)}async function Xf(){let e=pl.splice(0);await Promise.all(e.map((t)=>{try{return(typeof t==="function"?t():t.dispose())??Promise.resolve()}catch{return Promise.resolve()}}))}var Qf=["hooks","tools","commands","rules","skills","messageBuilders","providers","automationEvents","mcp"],eg=new Set(Qf);function gl(e,t){return e.name||`extension_${String(t).padStart(4,"0")}`}function ml(e){return Array.isArray(e)&&e.every((t)=>typeof t==="string")}function fl(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 hl(e){let t=fl(e.providerIds),n=fl(e.modelIds);return{...e,...t?{providerIds:t}:{},...n?{modelIds:n}:{}}}function tg(e,t){let n=gl(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(!eg.has(a))throw Error(`Invalid manifest for extension "${n}": unsupported capability "${String(a)}"`);r.add(a)}if(Object.hasOwn(o,"providerIds")&&!ml(o.providerIds))throw Error(`Invalid manifest for extension "${n}": providerIds must be a string array when provided`);if(Object.hasOwn(o,"modelIds")&&!ml(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:hl(o)}}function ng(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 yr{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:tg(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=gl(r,o.order),s={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]},a={registerTool:(u)=>s.tools.push(u),registerCommand:(u)=>s.commands.push(u),registerRule:(u)=>{if(!o.manifest.capabilities.has("rules"))throw Error(`Invalid setup for extension "${i}": registerRule requires the "rules" capability`);s.rules.push(u)},registerMessageBuilder:(u)=>s.messageBuilder.push(u),registerProvider:(u)=>s.providers.push(u),registerAutomationEventType:(u)=>{if(!o.manifest.capabilities.has("automationEvents"))throw Error(`Invalid setup for extension "${i}": registerAutomationEventType requires the "automationEvents" capability`);s.automationEventTypes.push(ng(u,i))},registerMcpServer:(u)=>{if(!o.manifest.capabilities.has("mcp"))throw Error(`Invalid setup for extension "${i}": registerMcpServer requires the "mcp" capability`);s.mcpServers.push({...u,metadata:{...u.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(u){if(e.tolerateSetupErrors!==!0)throw u;t??=u}}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 og(e={}){return new yr(e)}var rg=[".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"},ig={[Ke.CLINE_PASS]:!1,[Ke.CODE_CLOUD_AGENTS]:!1,[Ke.CODE_ONBOARDING_GITHUB]:!1,[Ke.CLINE_COMPOSIO_BETA]:!1},sg=Object.values(Ke);var yl=w(["agent_start","agent_resume","agent_abort","agent_end","agent_error","tool_call","tool_result","prompt_submit","pre_compact","session_shutdown"]),$e=j(d(),d()),ag=b({toolName:d(),parameters:$e}),cg=b({toolName:d(),parameters:$e,result:d(),success:I(),executionTimeMs:x()}),ug=b({prompt:d(),attachments:E(d())}),lg=b({taskMetadata:$e}),dg=b({taskMetadata:$e,previousState:$e}),pg=b({taskMetadata:$e}),mg=b({taskMetadata:$e}),fg=b({taskId:d(),ulid:d(),contextSize:x(),compactionStrategy:d(),previousApiReqIndex:x(),tokensIn:x(),tokensOut:x(),tokensInCache:x(),tokensOutCache:x(),deletedRangeStart:x(),deletedRangeEnd:x(),contextJsonPath:d(),contextRawPath:d()}),bl=b({clineVersion:d(),hookName:yl,timestamp:d(),taskId:d(),sessionContext:b({rootSessionId:d().optional(),hookLogPath:d().optional()}).optional(),workspaceRoots:E(d()),workspaceInfo:se().optional(),userId:d(),agent_id:d(),parent_agent_id:d().nullable(),iteration:x().optional(),reason:d().optional(),tool_call:b({id:d(),name:d(),input:K()}).optional(),tool_result:se().optional(),turn:K().optional(),error:b({name:d(),message:d(),stack:d().optional()}).optional(),preToolUse:ag.optional(),postToolUse:cg.optional(),userPromptSubmit:ug.optional(),taskStart:lg.optional(),taskResume:dg.optional(),taskCancel:pg.optional(),taskComplete:mg.optional(),preCompact:fg.optional()}).passthrough();function gg(e){let t=bl.safeParse(e);if(!t.success)return;return t.data}var Cv="v1",kv="v1",Ev="v1",Rv=["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 _n(e){let t=/^v(\d+)$/.exec(e?.trim()??"");if(!t)return;return Number.parseInt(t[1]??"",10)}function Av(e,t="v1"){let n=_n(e.protocolVersion),o=_n(t);if(n===void 0||o===void 0)return{compatible:!1,reason:"missing_protocol"};let r=_n(e.minClientProtocolVersion)??n,i=_n(e.maxClientProtocolVersion)??n;return o>=r&&o<=i?{compatible:!0}:{compatible:!1,reason:"unsupported_protocol"}}var wv="approval.respond",Iv="0",Pv="__hubScheduleRunAt",xl=["act","plan","yolo"];function hg(e){return xl.some((t)=>t===e)}function Mv(e,t){if(!e||!Object.hasOwn(e,"mode"))return t;let n=e.mode;if(hg(n))return n;throw Error(`mode must be one of: ${xl.join(", ")}`)}var yg=30000,Ov=5000;function bg(e){switch(e){case"run.start":case"session.send_input":return null;default:return yg}}function zv(e,t){return t===void 0?bg(e):t}var xg=["readFile","search","bash","webFetch","editor","applyPatch","skills","askQuestion","submit"],_g=new Set(xg);function Nv(e){return typeof e==="string"&&_g.has(e)}var $v="tool_executor.",Lv="custom_tool.",Dv="hook.",Bv="compaction.compact",Uv="checkpoint.create",Zv="mistake_limit.decide",Fv="user_instructions.snapshot";function Hv(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 br(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 u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){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 Wc(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;Wc(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 Jc=new Set(["type","properties","required","additionalProperties"]),Gc=["oneOf","anyOf"];function Kc(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(!Jc.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 u of t){let l=u.properties?.[s]??Kc(u);if(l===null||l===void 0)continue;if(!a.some((p)=>JSON.stringify(p)===JSON.stringify(l)))a.push(l)}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=Kc(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 mm(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Jc)if(o in e)return;let n=t.filter((o)=>Gc.some((i)=>Array.isArray(o[i]))),r=null;if(!n.length)r=wr(t);else{let o=n[0],i=Gc.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 u=c.def??c.schema,l={...u},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"))u.allOf=u.allOf??[],u.allOf.push(g);else Tt(u,g);if(Tt(u,l),a._zod.parent===p)for(let S in u){if(S==="$ref"||S==="allOf")continue;if(!(S in l))delete u[S]}if(g.$ref&&f.def)for(let S in u){if(S==="$ref"||S==="allOf")continue;if(S in f.def&&JSON.stringify(u[S])===JSON.stringify(f.def[S]))delete u[S]}}let m=a._zod.parent;if(m&&m!==p){r(m);let f=e.seen.get(m);if(f?.schema.$ref){if(u.$ref=f.schema.$ref,f.def)for(let g in u){if(g==="$ref"||g==="allOf")continue;if(g in f.def&&JSON.stringify(u[g])===JSON.stringify(f.def[g]))delete u[g]}}}e.override({zodSchema:a,jsonSchema:u,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())Wc(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 u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let p=a.get(l);if(p)p.push(u);else a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])mm(u)}}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 Yc=(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},Xc=(e,t)=>{Ve(e,"minimum",t),qe(e,"maximum",t)},ru=(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)},iu=(e,t)=>{e.mime=e.mime?e.mime.filter((n)=>t.includes(n)):[...t]},su=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Qc=(e,t)=>Ve(e,"minimum",t.minimum),eu=(e,t)=>qe(e,"maximum",t.maximum),tu=(e)=>(t,n)=>{su(t,n.format);let[r,o]=e[n.format];Ve(t,"minimum",r),qe(t,"maximum",o)},fm={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)=>ru(e,t.value),number_format:tu(Ut),bigint_format:tu(Zn),min_length:Qc,max_length:eu,length_equals:(e,t)=>Xc(e,t.length),min_size:Qc,max_size:eu,size_equals:(e,t)=>Xc(e,t.size),string_format:(e,t)=>{if(su(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)=>iu(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)fm[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)ru(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)iu(t,o.mime);for(let i of o.patterns??[])ou(t,i);return t}var gm={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},hm=new Map([[ur,fs],[en,gs]]),au=(e)=>hm.get(e)??e,Or=(e,t,n,r)=>{let o=n;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u,laxFormat:l}=W(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(a){if(o.format=gm[a]??a,o.format==="")delete o.format;if(a==="time"||l)delete o.format}if(u)o.contentEncoding=u;if(c&&c.size>0){let p=[...c].map(au);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}))]}},zr=(e,t,n,r)=>{let o=n,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=W(e);o.type=l?"integer":"number";let p=typeof u==="number"&&u>=(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=u,o.exclusiveMinimum=!0;else o.exclusiveMinimum=u;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}))]}},Nr=(e,t,n,r)=>{n.type="boolean"},cu=(e,t,n,r)=>{q(e,t,n,r,"BigInt cannot be represented in JSON Schema")},uu=(e,t,n,r)=>{q(e,t,n,r,"Symbols cannot be represented in JSON Schema")},lu=(e,t,n,r)=>{if(t.target==="openapi-3.0")n.type="string",n.nullable=!0,n.enum=[null];else n.type="null"},du=(e,t,n,r)=>{q(e,t,n,r,"Undefined cannot be represented in JSON Schema")},$r=(e,t,n,r)=>{q(e,t,n,r,"Void cannot be represented in JSON Schema")},Lr=(e,t,n,r)=>{n.not={}},pu=(e,t,n,r)=>{},Dr=(e,t,n,r)=>{},Br=(e,t,n,r)=>{q(e,t,n,r,"Date cannot be represented in JSON Schema")},Ur=(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},Zr=(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}},mu=(e,t,n,r)=>{q(e,t,n,r,"NaN cannot be represented in JSON Schema")},fu=(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},gu=(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}))},hu=(e,t,n,r)=>{n.type="boolean"},Fr=(e,t,n,r)=>{q(e,t,n,r,"Custom types cannot be represented in JSON Schema")},Hr=(e,t,n,r)=>{q(e,t,n,r,"Function types cannot be represented in JSON Schema")},jr=(e,t,n,r)=>{q(e,t,n,r,"Transforms cannot be represented in JSON Schema")},yu=(e,t,n,r)=>{q(e,t,n,r,"Map cannot be represented in JSON Schema")},bu=(e,t,n,r)=>{q(e,t,n,r,"Set cannot be represented in JSON Schema")},Vr=(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 qr=(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 u in s)te(o.properties,u,D(s[u],t,{...r,path:[...r.path,"properties",u]}));let c=[];for(let u of Object.keys(s)){let l=i.shape[u];if(t.io==="input"?At(l)===void 0:l._zod.optout===void 0)c.push(u)}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"]})},Gr=(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},Kr=(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=(u)=>("allOf"in u)&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)},Wr=(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]})),u=i.rest?D(i.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;while(l>0){let y=i.items[l-1];if(!(t.io==="input"?At(y)!==void 0:y._zod.optout==="optional"))break;l--}let p=i.items.length,m=!i.rest;if(t.target==="draft-2020-12"){if(o.prefixItems=c,m)o.items=!1;else if(u)o.items=u;if(l>0)o.minItems=l;if(m)o.maxItems=p}else if(t.target==="openapi-3.0"){if(o.items={anyOf:c},u)o.items.anyOf.push(u);if(l>0)o.minItems=l;if(m)o.maxItems=p}else{if(o.items=c,m)o.additionalItems=!1;else if(u)o.additionalItems=u;if(l>0)o.minItems=l;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 Pr(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=Pr(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)=>Pr(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:u,multipleOf:l,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:nr).source;return f}var Mr=new WeakMap;function ym(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 Mr.get(e)??[]){let o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||n.has(i))continue;let s=Pr(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 Jr=(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 l=D(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let p of a)te(o.patternProperties,au(p).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=D(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});let l=Mr.get(t);if(!l)l=[],Mr.set(t,l),t.deferred.push(()=>ym(t));l.push(e)}o.additionalProperties=D(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let c=s._zod.values,u=t.io==="input"&&At(i.valueType)!==void 0;if(c&&!i.partial&&!u){let l=[...c].filter((p)=>typeof p==="string"||typeof p==="number");if(l.length>0)o.required=l.map(String)}},Yr=(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"}]},Xr=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},Qr=Symbol();function xu(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"),Qr}var eo=(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=xu(o.defaultValue,e,t,n,r);if(s!==Qr)n.default=s},to=(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=xu(o.defaultValue,e,t,n,r);if(s!==Qr)n._prefault=s},no=(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},ro=(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},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,n.readOnly=!0},io=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},dn=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},Su=(e,t,n,r)=>{let o=e._zod.innerType;D(o,t,r);let i=t.seen.get(e);i.ref=o},nu={string:Or,number:zr,boolean:Nr,bigint:cu,symbol:uu,null:lu,undefined:du,void:$r,never:Lr,any:pu,unknown:Dr,date:Br,enum:Ur,literal:Zr,nan:mu,template_literal:fu,file:gu,success:hu,custom:Fr,function:Hr,transform:jr,map:yu,set:bu,array:Vr,object:qr,union:Gr,intersection:Kr,tuple:Wr,record:Jr,nullable:Yr,nonoptional:Xr,default:eo,prefault:to,catch:no,pipe:ro,readonly:oo,promise:io,optional:dn,lazy:Su};function _u(e,t){if("_idmap"in e){let r=e,o=kt({...t,processors:nu}),i={};for(let c of r._idmap.entries()){let[u,l]=c;D(l,o)}let s={},a={registry:r,uri:t?.uri,defs:i};o.external=a;for(let c of r._idmap.entries()){let[u,l]=c;Et(o,l),te(s,u,Rt(o,l))}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:nu});return D(e,n),Et(n,e),Rt(n,e)}var vu=new WeakSet([Object.prototype,Error.prototype]);function mn(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 Em=(e,t)=>{Fi.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);if(vu.has(n))return;vu.add(n),mn(n,"format",(r)=>(o)=>Wn(r,o)),mn(n,"flatten",(r)=>(o)=>Kn(r,o)),mn(n,"addIssue",(r)=>(o)=>{r.issues.push(o),r.message=JSON.stringify(r.issues,mt,2)}),mn(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",Em,void 0,{Parent:Error});var Tu=yt(re),Cu=bt(re),ku=Gt(re),Eu=Kt(re),Ru=Vi(re),Au=qi(re),Iu=Gi(re),wu=Ki(re),Pu=Wi(re),Mu=Ji(re),Ou=Yi(re),zu=Xi(re);function Am(){if(!Y.localeError)Q(br())}function It(){if(!Y.memoizer)Q({memoizer:yr()})}var N=h("ZodType",(e,t)=>(Am(),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(wf(e,t))},superRefine(e,t){return this.check(Pf(e,t))},overwrite(e){return this.check(Ae(e))},optional(){return Lu(this)},exactOptional(){return hf(this)},nullable(){return Du(this)},nullish(){return Lu(Du(this))},nonoptional(e){return vf(this,e)},array(){return E(this)},or(e){return Ge([this,e])},and(e){return df(this,e)},transform(e){return Bu(this,Hu(e))},default(e){return xf(this,e)},prefault(e){return _f(this,e)},catch(e){return Cf(this,e)},pipe(e){return Bu(this,e)},readonly(){return Rf(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 Vt(this,"~standard",{...cr(this),jsonSchema:{input:Ct(this,"input"),output:Ct(this,"output")}})},set "~standard"(e){xe(this,"~standard",e)},parse:function e(t,n){return Tu(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Cu(this,t,n,{callee:e})},safeParse(e,t){return ku(this,e,t)},async safeParseAsync(e,t){return Eu(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){xe(this,"spa",e)},validate(e,t){return Xn(this,e,t)},validateAsync(e,t){return Qn(this,e,t)},encode:function e(t,n){return Ru(this,t,n,{callee:e})},decode:function e(t,n){return Au(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Iu(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await wu(this,t,n,{callee:e})},safeEncode(e,t){return Pu(this,e,t)},safeDecode(e,t){return Mu(this,e,t)},async safeEncodeAsync(e,t){return Ou(this,e,t)},async safeDecodeAsync(e,t){return zu(this,e,t)},toJSONSchema(e){return Yc(this,{})(e)},get description(){return Re.get(this)?.description},get _def(){return this._zod.def}}),Uu=h("_ZodString",(e,t)=>{Qt.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Or(e,n,r,o)},Hn({format:(e)=>W(e).format??null,minLength:(e)=>W(e).minimum??null,maxLength:(e)=>W(e).maximum??null},{regex(...e){return this.check(xr(...e))},includes(...e){return this.check(vr(...e))},startsWith(...e){return this.check(Tr(...e))},endsWith(...e){return this.check(Cr(...e))},min(...e){return this.check(je(...e))},max(...e){return this.check(un(...e))},length(...e){return this.check(ln(...e))},nonempty(...e){return this.check(je(1,...e))},lowercase(e){return this.check(Sr(e))},uppercase(e){return this.check(_r(e))},trim(){return this.check(Er())},normalize(...e){return this.check(kr(...e))},toLowerCase(){return this.check(Rr())},toUpperCase(){return this.check(Ar())},slugify(){return this.check(Ir())}})),Im=h("ZodString",(e,t)=>{Qt.init(e,t),Uu.init(e,t)},{email(e){return this.check(uc(zm,e))},url(e){return this.check(gc($m,e))},jwt(e){return this.check(wc(Ym,e))},emoji(e){return this.check(hc(Lm,e))},guid(e){return this.check(lc(Nm,e))},uuid(e){return this.check(dc(fn,e))},uuidv4(e){return this.check(pc(fn,e))},uuidv6(e){return this.check(mc(fn,e))},uuidv7(e){return this.check(fc(fn,e))},nanoid(e){return this.check(yc(Dm,e))},cuid(e){return this.check(bc(Bm,e))},cuid2(e){return this.check(xc(Um,e))},ulid(e){return this.check(Sc(Zm,e))},base64(e){return this.check(Rc(Km,e))},base64url(e){return this.check(Ac(Wm,e))},xid(e){return this.check(_c(Fm,e))},ksuid(e){return this.check(vc(Hm,e))},ipv4(e){return this.check(Tc(jm,e))},ipv6(e){return this.check(Cc(Vm,e))},cidrv4(e){return this.check(kc(qm,e))},cidrv6(e){return this.check(Ec(Gm,e))},e164(e){return this.check(Ic(Jm,e))},datetime(e){return this.check(Pc(wm,e))},date(e){return this.check(Mc(Pm,e))},time(e){return this.check(Oc(Mm,e))},duration(e){return this.check(zc(Om,e))}});function d(e){return cc(Im,e)}var F=h("ZodStringFormat",(e,t)=>{U.init(e,t),Uu.init(e,t)}),wm=h("ZodISODateTime",(e,t)=>{ma.init(e,t),F.init(e,t)}),Pm=h("ZodISODate",(e,t)=>{fa.init(e,t),F.init(e,t)}),Mm=h("ZodISOTime",(e,t)=>{ga.init(e,t),F.init(e,t)}),Om=h("ZodISODuration",(e,t)=>{ha.init(e,t),F.init(e,t)}),zm=h("ZodEmail",(e,t)=>{na.init(e,t),F.init(e,t)});var Nm=h("ZodGUID",(e,t)=>{ea.init(e,t),F.init(e,t)});var fn=h("ZodUUID",(e,t)=>{ta.init(e,t),F.init(e,t)});var $m=h("ZodURL",(e,t)=>{ia.init(e,t),F.init(e,t)});var Lm=h("ZodEmoji",(e,t)=>{sa.init(e,t),F.init(e,t)});var Dm=h("ZodNanoID",(e,t)=>{aa.init(e,t),F.init(e,t)});var Bm=h("ZodCUID",(e,t)=>{ca.init(e,t),F.init(e,t)});var Um=h("ZodCUID2",(e,t)=>{ua.init(e,t),F.init(e,t)});var Zm=h("ZodULID",(e,t)=>{la.init(e,t),F.init(e,t)});var Fm=h("ZodXID",(e,t)=>{da.init(e,t),F.init(e,t)});var Hm=h("ZodKSUID",(e,t)=>{pa.init(e,t),F.init(e,t)});var jm=h("ZodIPv4",(e,t)=>{ya.init(e,t),F.init(e,t)});var Vm=h("ZodIPv6",(e,t)=>{xa.init(e,t),F.init(e,t)});var qm=h("ZodCIDRv4",(e,t)=>{Sa.init(e,t),F.init(e,t)});var Gm=h("ZodCIDRv6",(e,t)=>{_a.init(e,t),F.init(e,t)});var Km=h("ZodBase64",(e,t)=>{Ta.init(e,t),F.init(e,t)});var Wm=h("ZodBase64URL",(e,t)=>{Ca.init(e,t),F.init(e,t)});var Jm=h("ZodE164",(e,t)=>{ka.init(e,t),F.init(e,t)});var Ym=h("ZodJWT",(e,t)=>{Ea.init(e,t),F.init(e,t)});var Zu=h("ZodNumber",(e,t)=>{lr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zr(e,n,r,o),e.isFinite=!0},Hn({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(an(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(sn(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(Nu(e))},safe(e){return this.check(Nu(e))},positive(e){return this.check(an(0,e))},nonnegative(e){return this.check(He(0,e))},negative(e){return this.check(sn(0,e))},nonpositive(e){return this.check(Fe(0,e))},multipleOf(e,t){return this.check(cn(e,t))},step(e,t){return this.check(cn(e,t))},finite(){return this}}));function x(e){return Nc(Zu,e)}var Xm=h("ZodNumberFormat",(e,t)=>{Ra.init(e,t),Zu.init(e,t)});function Nu(e){return $c(Xm,e)}var Qm=h("ZodBoolean",(e,t)=>{Aa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nr(e,n,r,o)});function w(e){return Lc(Qm,e)}var ef=h("ZodUnknown",(e,t)=>{Ia.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Dr(e,n,r,o)});function K(){return Dc(ef)}var tf=h("ZodNever",(e,t)=>{wa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lr(e,n,r,o)});function nf(e){return Bc(tf,e)}var rf=h("ZodVoid",(e,t)=>{Pa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$r(e,n,r,o)});function of(e){return Uc(rf,e)}var sf=h("ZodDate",(e,t)=>{Ma.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Br(e,n,r,o),e.min=(n,r)=>e.check(He(n,r)),e.max=(n,r)=>e.check(Fe(n,r))},Hn({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 gn(e){return Zc(sf,e)}var af=h("ZodArray",(e,t)=>{It(),Oa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vr(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(un(e,t))},length(e,t){return this.check(ln(e,t))},unwrap(){return this.element}});function E(e,t){return Fc(af,e,t)}var cf=h("ZodObject",(e,t)=>{It(),$a.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qr(e,n,r,o),Mp(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:nf()}))},strip(){return this.clone(ne(this._zod.def,{catchall:void 0}))},extend(e){return Cp(this,e)},safeExtend(e){return kp(this,e)},merge(e){return Ep(this,e)},pick(e){return vp(this,e)},omit(e){return Tp(this,e)},partial(...e){return Oi(co,this,e[0])},exactPartial(...e){return Oi(ju,this,e[0],"exactPartial")},required(...e){return Rp(Vu,this,e[0])}});function b(e,t){let n={type:"object",shape:e??{},..._(t)};return new cf(n)}var Fu=h("ZodUnion",(e,t)=>{dr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gr(e,n,r,o),e.options=t.options});function Ge(e,t){return new Fu({type:"union",options:e,..._(t)})}var uf=h("ZodDiscriminatedUnion",(e,t)=>{Fu.init(e,t),La.init(e,t)});function ao(e,t,n){return new uf({type:"union",options:t,discriminator:e,..._(n)})}var lf=h("ZodIntersection",(e,t)=>{Da.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Kr(e,n,r,o)});function df(e,t){return new lf({type:"intersection",left:e,right:t})}var pf=h("ZodTuple",(e,t)=>{It(),pr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wr(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 co({type:"optional",innerType:t}))})}});function mf(e,t,n){let r=t instanceof z,o=r?n:t;return new pf({type:"tuple",items:e,rest:r?t:null,..._(o)})}var $u=h("ZodRecord",(e,t)=>{It(),Ba.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jr(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function j(e,t,n){if(!t||!t._zod)return new $u({type:"record",keyType:d(),valueType:e,..._(t)});return new $u({type:"record",keyType:e,valueType:t,..._(n)})}var so=h("ZodEnum",(e,t)=>{Ua.init(e,t),N.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Ur(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 so({...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 so({...t,checks:[],..._(o),entries:i})}});function I(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new so({type:"enum",entries:n,..._(t)})}var ff=h("ZodLiteral",(e,t)=>{Za.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zr(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 ff({type:"literal",values:Array.isArray(e)?e:[e],..._(t)})}var gf=h("ZodTransform",(e,t)=>{It(),Fa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jr(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 Hu(e){return new gf({type:"transform",transform:e})}var co=h("ZodOptional",(e,t)=>{mr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dn(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Lu(e){return new co({type:"optional",innerType:e})}var ju=h("ZodExactOptional",(e,t)=>{Ha.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dn(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function hf(e){return new ju({type:"optional",innerType:e})}var yf=h("ZodNullable",(e,t)=>{ja.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 Du(e){return new yf({type:"nullable",innerType:e})}var bf=h("ZodDefault",(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,e.removeDefault=e.unwrap});function xf(e,t){return new bf({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Bn(t)}})}var Sf=h("ZodPrefault",(e,t)=>{qa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>to(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function _f(e,t){return new Sf({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Bn(t)}})}var Vu=h("ZodNonOptional",(e,t)=>{Ga.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xr(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function vf(e,t){return new Vu({type:"nonoptional",innerType:e,..._(t)})}var Tf=h("ZodCatch",(e,t)=>{Ka.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>no(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Cf(e,t){return new Tf({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Li(t)})}var qu=h("ZodPipe",(e,t)=>{fr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ro(e,n,r,o),e.in=t.in,e.out=t.out});function Bu(e,t){return new qu({type:"pipe",in:e,out:t})}var kf=h("ZodPreprocess",(e,t)=>{qu.init(e,t),Wa.init(e,t)}),Ef=h("ZodReadonly",(e,t)=>{Ja.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 Rf(e){return new Ef({type:"readonly",innerType:e})}var Af=h("ZodPromise",(e,t)=>{Xa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>io(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function uo(e){return new Af({type:"promise",innerType:e})}var If=h("ZodFunction",(e,t)=>{Ya.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hr(e,n,r,o)});function hn(e){return new If({type:"function",input:Array.isArray(e?.input)?mf(e?.input):e?.input??E(K()),output:e?.output??K()})}var Gu=h("ZodCustom",(e,t)=>{Qa.init(e,t),N.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fr(e,n,r,o)});function se(e,t){return Hc(Gu,e??(()=>!0),t)}function wf(e,t={}){return jc(Gu,e,t)}function Pf(e,t){return Vc(e,t)}function Ku(e,t){return new kf({type:"pipe",in:Hu(e),out:t})}var yn=["none","minimal","low","medium","high","xhigh","max"],lo=I(yn),bn=lo.exclude(["none"]),Mf=I([...yn,"default"]).nullable(),po=ao("type",[b({type:V("toggle")}).strict(),b({type:V("effort"),values:E(Mf)}).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 Wu=I(["default","openai-responses","r1"]),Of={DEFAULT:"default",OPENAI_RESPONSES:"openai-responses",R1:"r1"},Ju=I(["images","video","tools","streaming","prompt-cache","reasoning","reasoning-effort","computer-use","global-endpoint","structured_output","temperature","files"]),Yu=I(["active","preview","deprecated","legacy"]),Xu=b({input:x().optional(),output:x().optional(),cacheWrite:x().optional(),cacheRead:x().optional()}),Qu=b({maxBudget:x().optional(),outputPrice:x().optional(),thinkingLevel:I(["low","high"]).optional()}),el=b({reasoningDefaultOn:w().optional(),apiProtocol:I(["openai-chat","openai-responses","anthropic","gemini"]).optional()}).catchall(K()),mo=I(["text","image","audio","video","pdf"]),tl=b({input:E(mo),output:E(mo)});function nl(e){return(e?.input===void 0||e.input.includes("text"))&&(e?.output===void 0||e.output.includes("text"))}var rl=I(["language","image-generation","speech-generation","video-generation","transcription","realtime"]);function zf(e){let t=e.modalities?.input,n=e.modalities?.output;return t?.length===1&&t[0]==="audio"&&n?.length===1&&n[0]==="text"}function Nf(e){return(e.operation===void 0||e.operation==="language")&&nl(e.modalities)}var ol=I(["batch","streaming"]);function $f(e){return e.modalities?.input.includes("text")===!0&&e.modalities.output.includes("image")}function Lf(e){return e.operation==="image-generation"}function fo(e,t,n){let r=e.capabilities;if(r===void 0||r.length===0)return n?.assumeWhenUnspecified??!1;return r.includes(t)}function Df(e){return fo(e,"tools",{assumeWhenUnspecified:!0})}function Bf(e){return fo(e,"images",{assumeWhenUnspecified:!0})}var xn=b({id:d(),name:d().optional(),description:d().optional(),maxTokens:x().optional(),contextWindow:x().optional(),maxInputTokens:x().optional(),capabilities:E(Ju).optional(),operation:rl.optional(),operationModes:E(ol).optional(),modalities:tl.optional(),reasoningOptions:E(po).optional(),apiFormat:Wu.optional(),systemRole:I(["system","developer"]).optional(),temperature:x().optional(),pricing:Xu.optional(),thinkingConfig:Qu.optional(),status:Yu.optional(),deprecationNotice:d().optional(),replacedBy:d().optional(),releaseDate:d().optional(),deprecationDate:d().optional(),family:d().optional(),metadata:el.optional()});var Uf="This tool call was rejected by the user and not executed.",Zf="NOT a tool or system failure. Clarify with user before proceeding.",go=b({id:d(),name:d(),execution:I(["client","provider"]).optional(),input:K(),output:K(),error:d().optional(),durationMs:x(),startedAt:gn(),endedAt:gn()});var Ff=I(["completed","max_iterations","aborted","mistake_limit","error"]),Hf=b({inputTokens:x(),outputTokens:x(),cacheReadTokens:x().optional(),cacheWriteTokens:x().optional(),totalCost:x().optional()}),dv=b({text:d(),usage:Hf,messages:E(se()),toolCalls:E(go),iterations:x(),finishReason:Ff,model:b({id:d(),provider:d(),info:xn.optional()}),startedAt:gn(),endedAt:gn(),durationMs:x()}),pv=b({distinctId:d().optional(),sessionId:d().optional(),providerId:d(),modelId:d(),apiKey:d().optional(),baseUrl:d().url().optional(),headers:j(d(),d()).optional(),knownModels:j(d(),xn).optional(),providerConfig:K().optional(),initialMessages:E(se()).optional(),systemPrompt:d(),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:hn().input([d()]).output(uo(d())).optional(),toolContextMetadata:j(d(),K()).optional(),execution:b({maxConsecutiveMistakes:x().int().positive().optional(),reminderAfterIterations:x().nonnegative().optional(),reminderText:d().optional(),loopDetection:Ge([V(!1),b({softThreshold:x().int().positive().optional(),hardThreshold:x().int().positive().optional()})]).optional()}).optional(),reasoningEffort:bn.optional(),thinkingBudgetTokens:x().positive().optional(),thinking:w().optional(),onEvent:hn().input([se()]).output(of()).optional(),hooks:se().optional(),parentAgentId:d().optional(),extensions:E(se()).optional(),hookErrorMode:I(["ignore","throw"]).default("ignore"),toolPolicies:j(d(),b({enabled:w().optional(),autoApprove:w().optional()})).optional(),requestToolApproval:hn().input([b({sessionId:d(),agentId:d(),conversationId:d(),iteration:x(),toolCallId:d(),toolName:d(),input:K(),policy:b({enabled:w().optional(),autoApprove:w().optional()}).default({})})]).output(Ge([b({approved:w(),reason:d().optional()}),uo(b({approved:w(),reason:d().optional()}))])).optional(),onConsecutiveMistakeLimitReached:hn().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:d().optional()})]).output(Ge([b({action:V("continue"),guidance:d().optional()}),b({action:V("stop"),reason:d().optional()}),uo(Ge([b({action:V("continue"),guidance:d().optional()}),b({action:V("stop"),reason:d().optional()})]))])).optional(),logger:se().optional(),extensionContext:se().optional(),abortSignal:se().optional()});var il=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"]),sl=b({id:d().optional(),label:d().optional(),role:d().optional(),participantKey:d().optional(),participantLabel:d().optional(),platformUserId:d().optional(),metadata:j(d(),K()).optional()}),al=b({source:d(),sourceEvent:d(),threadId:d(),channelId:d(),isDM:w(),sessionId:d().optional(),workspaceRoot:d().optional(),metadata:j(d(),K()).optional()}),jf=b({actor:sl,context:al,payload:j(d(),K()).optional()}),Vf=b({action:I(["allow","deny"]).default("allow"),message:d().optional(),reason:d().optional(),metadata:j(d(),K()).optional()}),qf=b({adapter:d(),botUserName:d().optional(),event:il,payload:j(d(),K()),ts:d()});var cl=[{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 ul(){return cl.map((e)=>({...e}))}function ll(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 Gf(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(!ll(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 Kf(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 Wf(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=Kf(a,o);if(!c.managed){i.push(a);continue}if(c.consumesNext)s+=1}return[...i,...n]}function Jf(e=dl){let t=new Set(ul().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 Yf(e){return/^\d+$/.test(e)?void 0:"Telegram user ID must contain digits only"}function Xf(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 Qf(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 dl=[{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:Yf}],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:Xf},{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:Qf}],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 pl=[];function ho(e){pl.push(e)}async function eg(){let e=pl.splice(0);await Promise.all(e.map((t)=>{try{return(typeof t==="function"?t():t.dispose())??Promise.resolve()}catch{return Promise.resolve()}}))}var tg=["hooks","tools","commands","rules","skills","messageBuilders","providers","automationEvents","mcp"],ng=new Set(tg);function gl(e,t){return e.name||`extension_${String(t).padStart(4,"0")}`}function ml(e){return Array.isArray(e)&&e.every((t)=>typeof t==="string")}function fl(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 hl(e){let t=fl(e.providerIds),n=fl(e.modelIds);return{...e,...t?{providerIds:t}:{},...n?{modelIds:n}:{}}}function rg(e,t){let n=gl(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(!ng.has(a))throw Error(`Invalid manifest for extension "${n}": unsupported capability "${String(a)}"`);o.add(a)}if(Object.hasOwn(r,"providerIds")&&!ml(r.providerIds))throw Error(`Invalid manifest for extension "${n}": providerIds must be a string array when provided`);if(Object.hasOwn(r,"modelIds")&&!ml(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:hl(r)}}function og(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 yo{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:rg(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=gl(o,r.order),s={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]},a={registerTool:(u)=>s.tools.push(u),registerCommand:(u)=>s.commands.push(u),registerRule:(u)=>{if(!r.manifest.capabilities.has("rules"))throw Error(`Invalid setup for extension "${i}": registerRule requires the "rules" capability`);s.rules.push(u)},registerMessageBuilder:(u)=>s.messageBuilder.push(u),registerProvider:(u)=>s.providers.push(u),registerAutomationEventType:(u)=>{if(!r.manifest.capabilities.has("automationEvents"))throw Error(`Invalid setup for extension "${i}": registerAutomationEventType requires the "automationEvents" capability`);s.automationEventTypes.push(og(u,i))},registerMcpServer:(u)=>{if(!r.manifest.capabilities.has("mcp"))throw Error(`Invalid setup for extension "${i}": registerMcpServer requires the "mcp" capability`);s.mcpServers.push({...u,metadata:{...u.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(u){if(e.tolerateSetupErrors!==!0)throw u;t??=u}}if(t&&e.tolerateSetupErrors!==!0)throw t;for(let r of n)this.registry.tools.push(...r.tools),this.registry.commands.push(...r.commands),this.registry.rules.push(...r.rules),this.registry.messageBuilder.push(...r.messageBuilder),this.registry.providers.push(...r.providers),this.registry.automationEventTypes.push(...r.automationEventTypes),this.registry.mcpServers.push(...r.mcpServers);if(this.phase="activate",t)throw t}activate(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase==="setup")throw Error("Contribution registry setup must complete before activation");if(this.phase!=="activate")return;this.phase="run"}async initialize(e={}){this.resolve(),this.validate();try{await this.setup(e)}finally{if(this.phase==="activate")this.activate()}}isActivated(){return this.phase==="run"}getRegistrySnapshot(){return{tools:[...this.registry.tools],commands:[...this.registry.commands],rules:[...this.registry.rules],messageBuilder:[...this.registry.messageBuilder],providers:[...this.registry.providers],automationEventTypes:[...this.registry.automationEventTypes],mcpServers:[...this.registry.mcpServers]}}getRegisteredTools(){return[...this.registry.tools]}getRegisteredRules(){return[...this.registry.rules]}getRegisteredAutomationEventTypes(){return[...this.registry.automationEventTypes]}getRegisteredMcpServers(){return[...this.registry.mcpServers]}getValidatedExtensions(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();return this.normalized.slice().sort((e,t)=>e.order-t.order).map(({extension:e})=>e)}}function ig(e={}){return new yo(e)}var sg=[".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"},ag={[Ke.CLINE_PASS]:!1,[Ke.CODE_CLOUD_AGENTS]:!1,[Ke.CODE_ONBOARDING_GITHUB]:!1,[Ke.CLINE_COMPOSIO_BETA]:!1},cg=Object.values(Ke);var yl=I(["agent_start","agent_resume","agent_abort","agent_end","agent_error","tool_call","tool_result","prompt_submit","pre_compact","session_shutdown"]),$e=j(d(),d()),ug=b({toolName:d(),parameters:$e}),lg=b({toolName:d(),parameters:$e,result:d(),success:w(),executionTimeMs:x()}),dg=b({prompt:d(),attachments:E(d())}),pg=b({taskMetadata:$e}),mg=b({taskMetadata:$e,previousState:$e}),fg=b({taskMetadata:$e}),gg=b({taskMetadata:$e}),hg=b({taskId:d(),ulid:d(),contextSize:x(),compactionStrategy:d(),previousApiReqIndex:x(),tokensIn:x(),tokensOut:x(),tokensInCache:x(),tokensOutCache:x(),deletedRangeStart:x(),deletedRangeEnd:x(),contextJsonPath:d(),contextRawPath:d()}),bl=b({clineVersion:d(),hookName:yl,timestamp:d(),taskId:d(),sessionContext:b({rootSessionId:d().optional(),hookLogPath:d().optional()}).optional(),workspaceRoots:E(d()),workspaceInfo:se().optional(),userId:d(),agent_id:d(),parent_agent_id:d().nullable(),iteration:x().optional(),reason:d().optional(),tool_call:b({id:d(),name:d(),input:K()}).optional(),tool_result:se().optional(),turn:K().optional(),error:b({name:d(),message:d(),stack:d().optional()}).optional(),preToolUse:ug.optional(),postToolUse:lg.optional(),userPromptSubmit:dg.optional(),taskStart:pg.optional(),taskResume:mg.optional(),taskCancel:fg.optional(),taskComplete:gg.optional(),preCompact:hg.optional()}).passthrough();function yg(e){let t=bl.safeParse(e);if(!t.success)return;return t.data}var Ev="v1",Rv="v1",Av="v1",Iv=["client.register","client.list","session.create","session.list","session.get","session.run","session.abort","schedule.create","schedule.list","task.create","task.list","task.get","task.update","task.approve","task.cancel","task.run","task.automation.get","task.automation.set","settings.get","settings.set","connector.start","connector.stop","connector.supervised","run.enqueue","run.list","hub.drain","hub.status","plugins.list","plugins.status","plugins.reload","stream.replay"];function Sn(e){let t=/^v(\d+)$/.exec(e?.trim()??"");if(!t)return;return Number.parseInt(t[1]??"",10)}function wv(e,t="v1"){let n=Sn(e.protocolVersion),r=Sn(t);if(n===void 0||r===void 0)return{compatible:!1,reason:"missing_protocol"};let o=Sn(e.minClientProtocolVersion)??n,i=Sn(e.maxClientProtocolVersion)??n;return r>=o&&r<=i?{compatible:!0}:{compatible:!1,reason:"unsupported_protocol"}}var Pv="approval.respond",Mv="0",Ov="__hubScheduleRunAt",xl=["act","plan","yolo"];function bg(e){return xl.some((t)=>t===e)}function zv(e,t){if(!e||!Object.hasOwn(e,"mode"))return t;let n=e.mode;if(bg(n))return n;throw Error(`mode must be one of: ${xl.join(", ")}`)}var xg=30000,Nv=5000;function Sg(e){switch(e){case"run.start":case"session.send_input":return null;default:return xg}}function $v(e,t){return t===void 0?Sg(e):t}var _g=["readFile","search","bash","webFetch","editor","applyPatch","skills","askQuestion","submit"],vg=new Set(_g);function Lv(e){return typeof e==="string"&&vg.has(e)}var Dv="tool_executor.",Bv="custom_tool.",Uv="hook.",Zv="compaction.compact",Fv="checkpoint.create",Hv="mistake_limit.decide",jv="user_instructions.snapshot";function Vv(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 bo(e,t){return`<file_content path="${e}">
59
59
  ${t}
60
- </file_content>`}function Sg(e,t="act"){return`<user_input mode="${t}">${e}</user_input>`}function vg(e,t){return`<user_command slash="${t}">${e}</user_command>`}var Tg=/<user_input\b[^>]*\bmode="(act|plan|yolo)"/;function Cg(e){let t=Tg.exec(e??"");return t?t[1]:void 0}function kg(e,t){return`<mode_notice>The user switched from ${e} mode to ${t} mode before sending this message.</mode_notice>`}function Eg(){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 Rg(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 Ag(e,t){return new RegExp(`${t}="([^"]+)"`,"i").exec(e)?.[1]?.trim()||void 0}function _l(e){if(!e?.trim())return;let t=Rg(e,"user_command");if(!t)return;let n=Ag(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=El(t,n);t=(o!==t?o:t.replace(new RegExp(`<${n}[^>]*>`,"g"),"")).trim()}return t}function vl(e){if(!e?.trim())return"";return wg(e,"mode_notice").trim()}function wg(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 xr(e){let t=vl(Sl(e)),n=_l(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 Tl=240,Cl=480;function kl(e,t){let n=e.replace(/\s+/gu," ").trim();if(n.length<=t)return n;return`${n.slice(0,t-1).trimEnd()}…`}function Ig(e){return kl(xr(e),Tl)}function Pg(e,t){let n=t?.trim()??"",o=e.toLowerCase(),r=o==="user"||o==="session"?xr(n):n;return kl(r,Cl)}function El(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]",Rl=w(["image","audio","video","file"]),Al=cr("type",[b({type:V("base64"),data:d().min(1)}),b({type:V("url"),url:d().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:d().min(1)})]);function wl(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:d().min(1),modality:Rl,mediaType:d().min(1),source:Al,name:d().min(1).optional(),sizeBytes:x().int().nonnegative().optional()}).refine((e)=>wl(e.mediaType)===e.modality,{message:"Generated media modality must match its media type",path:["modality"]});function Mg(e){return Il.safeParse(e).success}function Og(e){return wl(e)}var vn=["image/png","image/jpeg","image/gif","image/webp"],_r=5242880,fe=_r,_e=6291456,Pl=8388608;function zg(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 Ng(e=_r){return Math.floor(e*3/4)}function vr(e){return Math.ceil(e/3)*4}function Tr(e={}){return{maxImageEncodedBytes:e.maxImageEncodedBytes??fe,maxImageDecodedBytes:e.maxImageDecodedBytes??_e,maxTotalMediaBytes:e.maxTotalMediaBytes??Pl}}function Tn(){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,o){let r=Tr(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 Ml(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===47}function $g(e){return e.length>0&&Cr(e,0,e.length)}function Lg(e,t,n){let o=Ol(e),r=o.end-o.start;if(r===0)return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let i=Tr(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(!Cr(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 Cr(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(!Ml(e.charCodeAt(i)))return!1;for(let i=r;i<n;i++)if(e.charCodeAt(i)!==61)return!1;return!0}function Dg(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 Ol(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 Bg(e,t,n){if(!Dg(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 zl(e,t,n={}){let o=n.maxEncodedBytes??fe,r=n.maxDecodedBytes??_e,i=new Set(n.supportedMediaTypes??vn),s=e?.toLowerCase(),a=Ol(t),{start:c,end:u}=a,l=Bg(t,a.start,a.end);if(l){if(s&&s!==l.mediaType)return{ok:!1,reason:"media_type_mismatch",message:`Image media type ${e} does not match data URL type ${l.mediaType}`};s=l.mediaType,c=l.base64Start,u=l.base64End}if(!s||!i.has(s))return{ok:!1,reason:"unsupported_media_type",message:`Unsupported image media type: ${e??"unknown"}`};let p=u-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(!Cr(t,c,u))return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};let m=t.slice(c,u),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=zl(e,t,{maxEncodedBytes:n.maxImageEncodedBytes,maxDecodedBytes:n.maxImageDecodedBytes});if(!r.ok)return Sn(o,r.reason),r;let i=It(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",Ug="[image attached]",Zg="[generated image]";function Fg(e){return`[generated ${e}]`}function Cn(e){return{type:"text",text:`[generated ${e.modality} unavailable to this model]`}}function kr(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 Hg(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 Nl(e){return It(fe,0,{maxImageEncodedBytes:fe,maxImageDecodedBytes:_e},e)===null}function Ll(e){try{return new URL(e).protocol}catch{return}}function Er(e,t){let n=Pt(e.mediaType,e.data,{maxImageEncodedBytes:fe,maxImageDecodedBytes:_e},t);if(!n.ok)return Le();return Dl(n.base64,n.mediaType)}function Dl(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 Rr(e,t){if(e.image instanceof URL){if(e.image.protocol==="data:"){let s=Pt(e.mediaType,e.image.href,{maxImageEncodedBytes:fe,maxImageDecodedBytes:_e},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(!Nl(t))return Le();return Ye(e.image,e.mediaType)}if(typeof e.image==="string"){let s=Ll(e.image);if(s==="http:"||s==="https:"){if(!Nl(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:_e},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=vr(n),r=e.mediaType?.toLowerCase()??"image/png";if(!vn.includes(r)||It(o,n,{maxImageEncodedBytes:fe,maxImageDecodedBytes:_e},t))return Le();return Ye(e.image,r)}function jg(e,t){if(!t)return!0;if(e.modality==="file")return e.mediaType==="application/pdf"&&t.includes("pdf");return t.includes(e.modality)}function $l(e,t,n){if(!jg(e,n))return Cn(e);if(e.modality==="image"){if(e.source.type==="artifact")return Cn(e);return Rr({type:"image",image:e.source.type==="url"?e.source.url:e.source.data,mediaType:e.mediaType},t)}if(e.source.type==="artifact")return Cn(e);if(e.source.type==="url"){let o=Ll(e.source.url);if(o!=="http:"&&o!=="https:"&&o!=="data:")return Cn(e)}return Ye(e.source.type==="url"?e.source.url:e.source.data,e.mediaType)}function Ar(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 l=[],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){l.push(i),p=!0,m=!0;continue}let _={type:"image",data:y.data,mediaType:y.mediaType},v=Er(_,n);if(v.type==="file")t.push({type:"image",data:v.data.data,mediaType:v.mediaType});else l.push(v.text);p=!0,m=!0;continue}if(y.type==="image"){l.push(We),p=!0,m=!0;continue}if(y.type==="text"&&typeof y.text==="string"){l.push(y.text),p=!0;continue}}let g=Ar(f,t,n,o);l.push(g.value),p||=g.changed,m||=g.mediaChanged}return{value:p?l: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 l={type:"image",data:s.data,mediaType:s.mediaType},p=Er(l,n);if(p.type==="file")return t.push({type:"image",data:p.data.data,mediaType:p.mediaType}),{value:Ug,changed:!0,mediaChanged:!0};return{value:p.text,changed:!0,mediaChanged:!0}}return{value:We,changed:!0,mediaChanged:!0}}let a={},c=!1,u=!1;for(let[l,p]of Object.entries(s)){let m=Ar(p,t,n,o);a[l]=m.value,c||=m.changed,u||=m.mediaChanged}return{value:c?a:e,changed:c,mediaChanged:u}}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 Bl(e,t=!1,n=Tn(),o){let r=o?.supportsImages??!0;if(typeof e==="string")return{type:t?"error-text":"text",value:ae(e)};if(!t&&Hg(e))return{type:"content",value:e.map((i)=>i.type==="image"?r?Er(i,n):{type:"text",text:Je}:{type:"text",text:ae(i.text)})};if(e!==null&&typeof e==="object"){let i=[],s=Ar(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)=>Dl(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 Vg(e,t,n){let o=n?.assistantToolCallArgKey??"input",r=n?.supportedInputModalities,i=!r||r.includes("image"),s=[],a=Tn(),c=[],u=()=>c.splice(0).map((p)=>p.type==="image"?i?Rr(p,a):{type:"text",text:Je}:$l(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 l of t){let p=l.content;if(typeof p==="string"){let y=l.role==="user"&&c.length>0?u():[];if(y.length>0){s.push({role:l.role,content:[{type:"text",text:p.trim().length>0?ae(p):Mt},...y]});continue}if(p.trim().length===0){s.push({role:l.role,content:[{type:"text",text:Mt}]});continue}s.push({role:l.role,content:ae(p)});continue}let m=[],f=[];if(p.length===0){s.push({role:l.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(l.role==="assistant")c.push(y),m.push({type:"text",text:Zg});else m.push(i?Rr(y,a):{type:"text",text:Je});break;case"media":if(l.role==="assistant")c.push(y),m.push({type:"text",text:Fg(y.media.modality)});else m.push($l(y.media,a,r));break;case"file":m.push({type:"text",text:br(y.path,ae(y.content))});break;case"tool-call":if(l.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:Bl(y.output,y.isError??!1,a,{supportsImages:i})});break}}let g=f.length>0;if(l.role==="user"&&!g&&c.length>0)m.push(...u());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)kr(s,{role:l.role,content:m});if(g)kr(s,{role:"tool",content:f})}if(c.length>0)kr(s,{role:"user",content:u()});return s}var Yv=["show","hide","subscription"];function Ul(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function qg(e,t){if(!e&&!t)return;let n=e?.metadata,o=t?.metadata,r={...e??{},...t??{}};if(Ul(n)&&Ul(o))r.metadata={...n,...o};return r}var eT=["web_search","image_generation"],tT=["web_search"];var zt={max:1,xhigh:0.95,high:0.8,medium:0.5,low:0.2,minimal:0.1,none:0},Gg=void 0;function Kg(e,t){if(typeof e==="string"&&e.toLowerCase()in zt)return e.toLowerCase();return t?void 0:void 0}function Zl(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 Wg(e){let t=Zl(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 Jg(e){return e instanceof Error?{name:e.name,message:e.message}:e}var Yg=3;function Fl(e){return Math.max(1,Math.ceil(e/3))}function wr(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 Xg(e){let t;try{t=JSON.stringify({systemPrompt:e.systemPrompt,messages:e.messages,tools:e.tools})}catch{t=[wr(e.systemPrompt),wr(e.messages),wr(e.tools)].join(`
61
- `)}return Fl(t.length)}var Qg={debug:()=>{},log:()=>{},error:()=>{}};var aT=60,cT=1,uT=3600;function eh(e){return typeof e==="number"&&Number.isFinite(e)}function th(e){return Math.min(Math.max(e,1),3600)}function lT(e){if(!eh(e))return 60;return th(e)}function dT(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 nh(e){if(e instanceof Error)return e.message;return String(e)}function oh(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 Hl(e){return/^[0-9A-Fa-f]$/.test(e)}function ve(e){return e>="0"&&e<="9"}function jl(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 kn(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"||e==="$"||e>="0"&&e<="9"}var Pr=/^(http|https|ftp|mailto|file|data|irc):\/\/$/,Mr=/^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;function Or(e){return`,[]/{}
63
- +`.includes(e)}function zr(e){return et(e)||rh.test(e)}var rh=/^[[{\w-]$/;function Nr(e){return e===`
64
- `||e==="\r"||e==="\t"||e==="\b"||e==="\f"}function Se(e,t){let n=e.charCodeAt(t);return n===32||n===10||n===9||n===13}function Vl(e,t){let n=e.charCodeAt(t);return n===32||n===9||n===13}function ql(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 $r(e)||En(e)}function $r(e){return e==='"'||e==="“"||e==="”"}function Lr(e){return e==='"'}function En(e){return e==="'"||e==="‘"||e==="’"||e==="`"||e==="´"}function Dr(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(!Se(e,n-1))return e+t;while(Se(e,n-1))n--;return e.substring(0,n)+t+e.substring(n)}function Gl(e,t,n){return e.substring(0,t)+e.substring(t+n)}function Kl(e){return/[,\n][ \t\r]*$/.test(e)}var ih={"&quot;":'"',"&amp;":"&","&lt;":"<","&gt;":">","&apos;":"'"},Br=12;function Ur(e){if(e.charAt(0)!=="&")return null;let t=e.indexOf(";");if(t===-1)return null;let n=e.substring(0,t+1),o=ih[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 Wl(e){return e!==null&&e.char==='"'}function Jl(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 Yl(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 Xl={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},sh={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
65
- `,r:"\r",t:"\t"};function Zr(e){let t=0,n="";if(u(["```","[```","{```"]),!i())hp();u(["```","```]","```}"]);let r=p(",");if(r)s();if(zr(e[t])&&Kl(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()||_()||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?Se:Vl,O="";while(!0)if(C(e,t))O+=e[t],t++;else if(ql(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&&!ah(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 u(T){if(l(T)){if(Ir(e[t]))while(t<e.length&&kn(e[t]))t++;return s(),!0}return!1}function l(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 yp();break}s();let he=p(":"),Be=t>=e.length;if(!he)if(zr(e[t])||Be)n=ce(n,":");else xi();if(!i())if(he||Be)n+="null";else xi();T=!1}if(e[t]==="}")n+="}",t++;else n=ce(n,"}");return!0}return!1}function _(){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 Tg(e,t="act"){return`<user_input mode="${t}">${e}</user_input>`}function Cg(e,t){return`<user_command slash="${t}">${e}</user_command>`}var kg=/<user_input\b[^>]*\bmode="(act|plan|yolo)"/;function Eg(e){let t=kg.exec(e??"");return t?t[1]:void 0}function Rg(e,t){return`<mode_notice>The user switched from ${e} mode to ${t} mode before sending this message.</mode_notice>`}function Ag(){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 Ig(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 wg(e,t){return new RegExp(`${t}="([^"]+)"`,"i").exec(e)?.[1]?.trim()||void 0}function Sl(e){if(!e?.trim())return;let t=Ig(e,"user_command");if(!t)return;let n=wg(t.attrs,"slash");if(!n)return;return{slash:n,content:t.content.trim()}}function _l(e){if(!e?.trim())return"";let t=e.trim();for(let n of["user_input","user_command"]){let r=El(t,n);t=(r!==t?r:t.replace(new RegExp(`<${n}[^>]*>`,"g"),"")).trim()}return t}function vl(e){if(!e?.trim())return"";return Pg(e,"mode_notice").trim()}function Pg(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 xo(e){let t=vl(_l(e)),n=Sl(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 Tl=240,Cl=480;function kl(e,t){let n=e.replace(/\s+/gu," ").trim();if(n.length<=t)return n;return`${n.slice(0,t-1).trimEnd()}…`}function Mg(e){return kl(xo(e),Tl)}function Og(e,t){let n=t?.trim()??"",r=e.toLowerCase(),o=r==="user"||r==="session"?xo(n):n;return kl(o,Cl)}function El(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]",Rl=I(["image","audio","video","file"]),Al=ao("type",[b({type:V("base64"),data:d().min(1)}),b({type:V("url"),url:d().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:d().min(1)})]);function Il(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:d().min(1),modality:Rl,mediaType:d().min(1),source:Al,name:d().min(1).optional(),sizeBytes:x().int().nonnegative().optional()}).refine((e)=>Il(e.mediaType)===e.modality,{message:"Generated media modality must match its media type",path:["modality"]});function zg(e){return wl.safeParse(e).success}function Ng(e){return Il(e)}var vn=["image/png","image/jpeg","image/gif","image/webp"],So=5242880,fe=So,Se=6291456,Pl=8388608;function $g(e){return e.length}function _o(e){let t=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.floor(e.length*3/4)-t}function Lg(e=So){return Math.floor(e*3/4)}function vo(e){return Math.ceil(e/3)*4}function To(e={}){return{maxImageEncodedBytes:e.maxImageEncodedBytes??fe,maxImageDecodedBytes:e.maxImageDecodedBytes??Se,maxTotalMediaBytes:e.maxTotalMediaBytes??Pl}}function Tn(){return{totalEncodedBytes:0,keptImages:0,omittedImages:0,omittedReasons:{}}}function _n(e,t){e.omittedImages+=1,e.omittedReasons[t]=(e.omittedReasons[t]??0)+1}function wt(e,t,n,r){let o=To(n);if(e>o.maxImageEncodedBytes){let i={ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${o.maxImageEncodedBytes} byte encoded limit`};return _n(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 _n(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 _n(r,i.reason),i}return r.totalEncodedBytes+=e,r.keptImages+=1,null}function Ml(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===47}function Dg(e){return e.length>0&&Co(e,0,e.length)}function Bg(e,t,n){let r=Ol(e),o=r.end-r.start;if(o===0)return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let i=To(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(!Co(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:_o(s)}}function Co(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(!Ml(e.charCodeAt(i)))return!1;for(let i=o;i<n;i++)if(e.charCodeAt(i)!==61)return!1;return!0}function Ug(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 Ol(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 Zg(e,t,n){if(!Ug(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 zl(e,t,n={}){let r=n.maxEncodedBytes??fe,o=n.maxDecodedBytes??Se,i=new Set(n.supportedMediaTypes??vn),s=e?.toLowerCase(),a=Ol(t),{start:c,end:u}=a,l=Zg(t,a.start,a.end);if(l){if(s&&s!==l.mediaType)return{ok:!1,reason:"media_type_mismatch",message:`Image media type ${e} does not match data URL type ${l.mediaType}`};s=l.mediaType,c=l.base64Start,u=l.base64End}if(!s||!i.has(s))return{ok:!1,reason:"unsupported_media_type",message:`Unsupported image media type: ${e??"unknown"}`};let p=u-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(!Co(t,c,u))return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};let m=t.slice(c,u),f=_o(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=zl(e,t,{maxEncodedBytes:n.maxImageEncodedBytes,maxDecodedBytes:n.maxImageDecodedBytes});if(!o.ok)return _n(r,o.reason),o;let i=wt(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",Fg="[image attached]",Hg="[generated image]";function jg(e){return`[generated ${e}]`}function Cn(e){return{type:"text",text:`[generated ${e.modality} unavailable to this model]`}}function ko(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 Vg(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 Nl(e){return wt(fe,0,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},e)===null}function Ll(e){try{return new URL(e).protocol}catch{return}}function Eo(e,t){let n=Pt(e.mediaType,e.data,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},t);if(!n.ok)return Le();return Dl(n.base64,n.mediaType)}function Dl(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 Ro(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(!Nl(t))return Le();return Ye(e.image,e.mediaType)}if(typeof e.image==="string"){let s=Ll(e.image);if(s==="http:"||s==="https:"){if(!Nl(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=vo(n),o=e.mediaType?.toLowerCase()??"image/png";if(!vn.includes(o)||wt(r,n,{maxImageEncodedBytes:fe,maxImageDecodedBytes:Se},t))return Le();return Ye(e.image,o)}function qg(e,t){if(!t)return!0;if(e.modality==="file")return e.mediaType==="application/pdf"&&t.includes("pdf");return t.includes(e.modality)}function $l(e,t,n){if(!qg(e,n))return Cn(e);if(e.modality==="image"){if(e.source.type==="artifact")return Cn(e);return Ro({type:"image",image:e.source.type==="url"?e.source.url:e.source.data,mediaType:e.mediaType},t)}if(e.source.type==="artifact")return Cn(e);if(e.source.type==="url"){let r=Ll(e.source.url);if(r!=="http:"&&r!=="https:"&&r!=="data:")return Cn(e)}return Ye(e.source.type==="url"?e.source.url:e.source.data,e.mediaType)}function Ao(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 l=[],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){l.push(i),p=!0,m=!0;continue}let S={type:"image",data:y.data,mediaType:y.mediaType},v=Eo(S,n);if(v.type==="file")t.push({type:"image",data:v.data.data,mediaType:v.mediaType});else l.push(v.text);p=!0,m=!0;continue}if(y.type==="image"){l.push(We),p=!0,m=!0;continue}if(y.type==="text"&&typeof y.text==="string"){l.push(y.text),p=!0;continue}}let g=Ao(f,t,n,r);l.push(g.value),p||=g.changed,m||=g.mediaChanged}return{value:p?l: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 l={type:"image",data:s.data,mediaType:s.mediaType},p=Eo(l,n);if(p.type==="file")return t.push({type:"image",data:p.data.data,mediaType:p.mediaType}),{value:Fg,changed:!0,mediaChanged:!0};return{value:p.text,changed:!0,mediaChanged:!0}}return{value:We,changed:!0,mediaChanged:!0}}let a={},c=!1,u=!1;for(let[l,p]of Object.entries(s)){let m=Ao(p,t,n,r);a[l]=m.value,c||=m.changed,u||=m.mediaChanged}return{value:c?a:e,changed:c,mediaChanged:u}}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 Bl(e,t=!1,n=Tn(),r){let o=r?.supportsImages??!0;if(typeof e==="string")return{type:t?"error-text":"text",value:ae(e)};if(!t&&Vg(e))return{type:"content",value:e.map((i)=>i.type==="image"?o?Eo(i,n):{type:"text",text:Je}:{type:"text",text:ae(i.text)})};if(e!==null&&typeof e==="object"){let i=[],s=Ao(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)=>Dl(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 Gg(e,t,n){let r=n?.assistantToolCallArgKey??"input",o=n?.supportedInputModalities,i=!o||o.includes("image"),s=[],a=Tn(),c=[],u=()=>c.splice(0).map((p)=>p.type==="image"?i?Ro(p,a):{type:"text",text:Je}:$l(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 l of t){let p=l.content;if(typeof p==="string"){let y=l.role==="user"&&c.length>0?u():[];if(y.length>0){s.push({role:l.role,content:[{type:"text",text:p.trim().length>0?ae(p):Mt},...y]});continue}if(p.trim().length===0){s.push({role:l.role,content:[{type:"text",text:Mt}]});continue}s.push({role:l.role,content:ae(p)});continue}let m=[],f=[];if(p.length===0){s.push({role:l.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(l.role==="assistant")c.push(y),m.push({type:"text",text:Hg});else m.push(i?Ro(y,a):{type:"text",text:Je});break;case"media":if(l.role==="assistant")c.push(y),m.push({type:"text",text:jg(y.media.modality)});else m.push($l(y.media,a,o));break;case"file":m.push({type:"text",text:bo(y.path,ae(y.content))});break;case"tool-call":if(l.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:Bl(y.output,y.isError??!1,a,{supportsImages:i})});break}}let g=f.length>0;if(l.role==="user"&&!g&&c.length>0)m.push(...u());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)ko(s,{role:l.role,content:m});if(g)ko(s,{role:"tool",content:f})}if(c.length>0)ko(s,{role:"user",content:u()});return s}var Qv=["show","hide","subscription"];function Ul(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Kg(e,t){if(!e&&!t)return;let n=e?.metadata,r=t?.metadata,o={...e??{},...t??{}};if(Ul(n)&&Ul(r))o.metadata={...n,...r};return o}var nT=["web_search","image_generation"],rT=["web_search"];var zt={max:1,xhigh:0.95,high:0.8,medium:0.5,low:0.2,minimal:0.1,none:0},Wg=void 0;function Jg(e,t){if(typeof e==="string"&&e.toLowerCase()in zt)return e.toLowerCase();return t?void 0:void 0}function Zl(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 Yg(e){let t=Zl(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 Xg(e){return e instanceof Error?{name:e.name,message:e.message}:e}var Qg=3;function Fl(e){return Math.max(1,Math.ceil(e/3))}var Hl=1600;function jl(){let e=0;return{replacer:(n,r)=>{if(r===null||typeof r!=="object"||r.type!=="image")return r;let o=r;if(typeof o.data==="string")return e+=1,{...o,data:""};if("image"in o)return e+=1,{...o,image:""};return r},imageCount:()=>e}}function Io(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 eh(e){let{replacer:t,imageCount:n}=jl(),r,o=0;try{r=JSON.stringify({systemPrompt:e.systemPrompt,messages:e.messages,tools:e.tools},t),o=n()}catch{r=[Io(e.systemPrompt),Io(e.messages),Io(e.tools)].join(`
61
+ `)}return Fl(r.length)+o*Hl}var th={debug:()=>{},log:()=>{},error:()=>{}};var uT=60,lT=1,dT=3600;function nh(e){return typeof e==="number"&&Number.isFinite(e)}function rh(e){return Math.min(Math.max(e,1),3600)}function pT(e){if(!nh(e))return 60;return rh(e)}function mT(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 oh(e){if(e instanceof Error)return e.message;return String(e)}function ih(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 Vl(e){return/^[0-9A-Fa-f]$/.test(e)}function ve(e){return e>="0"&&e<="9"}function ql(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 kn(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"||e==="$"||e>="0"&&e<="9"}var Po=/^(http|https|ftp|mailto|file|data|irc):\/\/$/,Mo=/^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;function Oo(e){return`,[]/{}
63
+ +`.includes(e)}function zo(e){return et(e)||sh.test(e)}var sh=/^[[{\w-]$/;function No(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 Gl(e,t){let n=e.charCodeAt(t);return n===32||n===9||n===13}function Kl(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 $o(e)||En(e)}function $o(e){return e==='"'||e==="“"||e==="”"}function Lo(e){return e==='"'}function En(e){return e==="'"||e==="‘"||e==="’"||e==="`"||e==="´"}function Do(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 Wl(e,t,n){return e.substring(0,t)+e.substring(t+n)}function Jl(e){return/[,\n][ \t\r]*$/.test(e)}var ah={"&quot;":'"',"&amp;":"&","&lt;":"<","&gt;":">","&apos;":"'"},Bo=12;function Uo(e){if(e.charAt(0)!=="&")return null;let t=e.indexOf(";");if(t===-1)return null;let n=e.substring(0,t+1),r=ah[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 Yl(e){return e!==null&&e.char==='"'}function Xl(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 Ql(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 ed={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},ch={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
65
+ `,r:"\r",t:"\t"};function Zo(e){let t=0,n="";if(u(["```","[```","{```"]),!i())bp();u(["```","```]","```}"]);let o=p(",");if(o)s();if(zo(e[t])&&Jl(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:Gl,O="";while(!0)if(C(e,t))O+=e[t],t++;else if(Kl(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&&!uh(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 u(T){if(l(T)){if(wo(e[t]))while(t<e.length&&kn(e[t]))t++;return s(),!0}return!1}function l(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 xp();break}s();let he=p(":"),Be=t>=e.length;if(!he)if(zo(e[t])||Be)n=ce(n,":");else xi();if(!i())if(he||Be)n+="null";else xi();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]==="&"?Ur(e.slice(t,t+Br)):null,Be=Wl(he)||Jl(he);if(et(e[t])||Be){let _i=Lr(e[t])?Lr:Dr(e[t])?Dr:En(e[t])?En:$r,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]==="&"?Ur(e.slice(t,t+Br)):null;if(ye&&he?ye.char===he.char:_i(e[t])){let H=t,Nn=L.length;if(L+='"',t+=ye?ye.length:1,n+=L,s(!1),T||t>=e.length||Qe(e[t])&&!Yl(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,Nn)}\\${L.substring(Nn)}`}else if(T&&Or(e[t])){if(e[t-1]===":"&&Pr.test(e.substring(Lt+1,t+2)))while(t<e.length&&Mr.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(Nr(H))L+=Xl[H];else L+=H;t+=ye.length}else if(e[t]==="\\"){let H=e.charAt(t+1);if(sh[H]!==void 0)L+=e.slice(t,t+2),t+=2;else if(H==="u"){let Ce=2;while(Ce<6&&Hl(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 bp()}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(Nr(H))L+=Xl[H],t++;else{if(!jl(H))zn(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=Gl(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&&!kn(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&&kn(e[t]))t++;let O=t;while(Se(e,O))O++;if(e[O]==="("){if(t=O+1,i(),e[t]===")"){if(t++,e[t]===";")t++}return!0}}while(t<e.length&&!Or(e[t])&&!et(e[t])&&(!T||e[t]!==":"))t++;if(e[t-1]===":"&&Pr.test(e.substring(C,t+2)))while(t<e.length&&Mr.test(e[t]))t++;if(t>C){while(Se(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&&Se(e,C))C--;return C}function ct(T){let C=T+1;while(C<e.length&&Se(e,C))C++;return C>=e.length||Qe(e[C])}function ut(){return t>=e.length||Qe(e[t])||Se(e,t)}function zn(T){throw new we(`Invalid character ${JSON.stringify(T)}`,t)}function lt(){throw new we(`Unexpected character ${JSON.stringify(e[t])}`,t)}function hp(){throw new we("Unexpected end of json string",e.length)}function yp(){throw new we("Object key expected",t)}function xi(){throw new we("Colon expected",t)}function bp(){let T=e.slice(t,t+6);throw new we(`Invalid unicode character "${T}"`,t)}}function ah(e,t){return e[t]==="*"&&e[t+1]==="/"}function ch(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 uh=/^\{\s*"([A-Za-z0-9_.$-]+)"\s*:\s*([\s\S]+?)\s*\}$/;function lh(e){let t=e.match(uh);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 dh(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(!ch(t))try{return JSON.parse(Zr(t))}catch{}return lh(t)??e}function ph(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 mh(e){try{return JSON.parse(e)}catch{return}}function nt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function fh(e){let t=e.type;if(typeof t==="string")return[t];return Array.isArray(t)?t.filter((n)=>typeof n==="string"):[]}function Fr(e,t){if(fh(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)&&Fr(i,t)))return!0}return!1}function gh(e,t){if(typeof e!=="string")return e;let n=e.trim(),o=Fr(t,"array"),r=Fr(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 Hr(e,t){let n=gh(e,t);if(Array.isArray(n)){let s=t.items;if(!nt(s))return n;let a=!1,c=n.map((u)=>{let l=Hr(u,s);return a||=l!==u,l});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=Hr(n[s],a);if(c!==n[s])i[s]=c,r=!0}return r?i:n}function hh(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 yh(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=hh(i);return s?JSON.parse(s):null}catch{return null}}function bh(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}import xh from"node:path";function _h(e){return e.split(xh.sep).join("/")}function Ql(e){let t=e.replaceAll("\\","/"),n=t.lastIndexOf("/");return(n>=0?t.slice(n+1):t).toLowerCase()}function Sh(e){return e==="win32"?"powershell":"/bin/bash"}function jr(e){let t=Ql(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 vh=new Set(["-nologo","-noninteractive","-noprofile"]),Th="-noprofile";function Ch(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 kh(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=Ql(e);if(t==="powershell"||t==="powershell.exe")return"windows";if(t==="pwsh"||t==="pwsh.exe")return"core";return}function Eh(e,t){let n=kh(e);if(!n)return;let o=(n.quote==="'"?n.body.replaceAll("''","'"):Ch(n.body,t)).trim();return o.length>0?o:void 0}function Rh(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 u=s?Eh(a[2],r):void 0;return u===void 0?void 0:{executable:o,script:u}}if(!vh.has(c))return;if(c===Th)s=!0;i=a[2]}}function Ah(e,t){if(!/[\\/:]/.test(t)&&ot(t)===ot(e))return e;return t}function ed(e,t){switch(jr(e)){case"powershell":{let n={executable:e,script:t};for(;;){let o=Rh(n.script,n.executable);if(!o)break;n={executable:Ah(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 wh(e,t){if(jr(e)==="powershell")return["-NoProfile","-NonInteractive","-Command",t];return ed(e,t).args}function Ih(e){return e.toLowerCase().replace(/[^\w.-]+/g,"_")}function Ph(e){let t=e?.trim();return t?t:void 0}function td(e,t){if(e.length<=t)return e;return`${e.slice(0,t-1)}…`}function Mh(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}…`:td(e,n)}function Oh(e){if(e.length<=8)return"****";return`${e.slice(0,4)}...${e.slice(-4)}`}function zh(e){return e.charCodeAt(0)===65279?e.slice(1):e}function Nh(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 $h(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 Lh(e,t){let n=e.safeParse(t);if(!n.success)throw Error(Hi(n.error));return n.data}function Vr(e){return Su(e)}function qr(e){return e==="cline"||e==="cline-pass"}var nd=`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]==="&"?Uo(e.slice(t,t+Bo)):null,Be=Yl(he)||Xl(he);if(et(e[t])||Be){let Si=Lo(e[t])?Lo:Do(e[t])?Do:En(e[t])?En:$o,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]==="&"?Uo(e.slice(t,t+Bo)):null;if(ye&&he?ye.char===he.char:Si(e[t])){let H=t,Nn=L.length;if(L+='"',t+=ye?ye.length:1,n+=L,s(!1),T||t>=e.length||Qe(e[t])&&!Ql(L,e[t])||et(e[t])&&!ct(t)||ve(e[t]))return M(),!0;if(e[t]==="\\")lt();let Ce=Me(H-1),_i=e.charAt(Ce);if(_i===",")return t=Lt,n=n.substring(0,Dt),k(!1,Ce);if(Qe(_i))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,Nn)}\\${L.substring(Nn)}`}else if(T&&Oo(e[t])){if(e[t-1]===":"&&Po.test(e.substring(Lt+1,t+2)))while(t<e.length&&Mo.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(No(H))L+=ed[H];else L+=H;t+=ye.length}else if(e[t]==="\\"){let H=e.charAt(t+1);if(ch[H]!==void 0)L+=e.slice(t,t+2),t+=2;else if(H==="u"){let Ce=2;while(Ce<6&&Vl(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 Sp()}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(No(H))L+=ed[H],t++;else{if(!ql(H))zn(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=Wl(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&&!kn(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&&kn(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&&!Oo(e[t])&&!et(e[t])&&(!T||e[t]!==":"))t++;if(e[t-1]===":"&&Po.test(e.substring(C,t+2)))while(t<e.length&&Mo.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 zn(T){throw new Ie(`Invalid character ${JSON.stringify(T)}`,t)}function lt(){throw new Ie(`Unexpected character ${JSON.stringify(e[t])}`,t)}function bp(){throw new Ie("Unexpected end of json string",e.length)}function xp(){throw new Ie("Object key expected",t)}function xi(){throw new Ie("Colon expected",t)}function Sp(){let T=e.slice(t,t+6);throw new Ie(`Invalid unicode character "${T}"`,t)}}function uh(e,t){return e[t]==="*"&&e[t+1]==="/"}function lh(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 dh=/^\{\s*"([A-Za-z0-9_.$-]+)"\s*:\s*([\s\S]+?)\s*\}$/;function ph(e){let t=e.match(dh);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 mh(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(!lh(t))try{return JSON.parse(Zo(t))}catch{}return ph(t)??e}function fh(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 gh(e){try{return JSON.parse(e)}catch{return}}function nt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function hh(e){let t=e.type;if(typeof t==="string")return[t];return Array.isArray(t)?t.filter((n)=>typeof n==="string"):[]}function Fo(e,t){if(hh(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)&&Fo(i,t)))return!0}return!1}function yh(e,t){if(typeof e!=="string")return e;let n=e.trim(),r=Fo(t,"array"),o=Fo(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 Ho(e,t){let n=yh(e,t);if(Array.isArray(n)){let s=t.items;if(!nt(s))return n;let a=!1,c=n.map((u)=>{let l=Ho(u,s);return a||=l!==u,l});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=Ho(n[s],a);if(c!==n[s])i[s]=c,o=!0}return o?i:n}function bh(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 xh(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=bh(i);return s?JSON.parse(s):null}catch{return null}}function Sh(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}import _h from"node:path";function vh(e){return e.split(_h.sep).join("/")}function td(e){let t=e.replaceAll("\\","/"),n=t.lastIndexOf("/");return(n>=0?t.slice(n+1):t).toLowerCase()}function Th(e){return e==="win32"?"powershell":"/bin/bash"}function jo(e){let t=td(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 Ch=new Set(["-nologo","-noninteractive","-noprofile"]),kh="-noprofile";function Eh(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 Rh(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=td(e);if(t==="powershell"||t==="powershell.exe")return"windows";if(t==="pwsh"||t==="pwsh.exe")return"core";return}function Ah(e,t){let n=Rh(e);if(!n)return;let r=(n.quote==="'"?n.body.replaceAll("''","'"):Eh(n.body,t)).trim();return r.length>0?r:void 0}function Ih(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 u=s?Ah(a[2],o):void 0;return u===void 0?void 0:{executable:r,script:u}}if(!Ch.has(c))return;if(c===kh)s=!0;i=a[2]}}function wh(e,t){if(!/[\\/:]/.test(t)&&rt(t)===rt(e))return e;return t}function nd(e,t){switch(jo(e)){case"powershell":{let n={executable:e,script:t};for(;;){let r=Ih(n.script,n.executable);if(!r)break;n={executable:wh(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 Ph(e,t){if(jo(e)==="powershell")return["-NoProfile","-NonInteractive","-Command",t];return nd(e,t).args}function Mh(e){return e.toLowerCase().replace(/[^\w.-]+/g,"_")}function Oh(e){let t=e?.trim();return t?t:void 0}function rd(e,t){if(e.length<=t)return e;return`${e.slice(0,t-1)}…`}function zh(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}…`:rd(e,n)}function Nh(e){if(e.length<=8)return"****";return`${e.slice(0,4)}...${e.slice(-4)}`}function $h(e){return e.charCodeAt(0)===65279?e.slice(1):e}function Lh(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 Dh(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 Bh(e,t){let n=e.safeParse(t);if(!n.success)throw Error(Hi(n.error));return n.data}function Vo(e){return _u(e)}function qo(e){return e==="cline"||e==="cline-pass"}var od=`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.
@@ -102,7 +102,7 @@ When you have completed the task, please provide a summary of what you did and a
102
102
 
103
103
  If user asked a simple question without any coding context, answer it directly without using any tools.
104
104
  {{CLINE_RULES}}
105
- {{CLINE_METADATA}}`;var od=`You are Cline, a careful and helpful coding agent that works in the background.
105
+ {{CLINE_METADATA}}`;var id=`You are Cline, a careful and helpful coding agent that works in the background.
106
106
  You are tasked to solve an issue reported by the user who you cannot communicate with directly.
107
107
  Your goal is to utilize the tools at your disposal to investigate and answer the question according to user's instructions with the aim to verify that the issue is resolved.
108
108
 
@@ -141,9 +141,9 @@ 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 Gr={ACT:nd,YOLO:od};var Kr="# Workspace Configuration",id=`# Plan / Act Modes
144
+ {{CLINE_METADATA}}`;var Go={ACT:od,YOLO:id};var Ko="# Workspace Configuration",ad=`# Plan / Act Modes
145
145
 
146
- User messages arrive wrapped in a <user_input mode="..."> tag. The mode attribute is the interaction mode the user was in when they sent that message: "plan" means plan-mode constraints applied (explore, analyze, and align on a plan -- no edits or state-changing commands), while "act" (or "yolo") means implementation was allowed. If the mode attribute changes between messages, the user switched modes -- the newest message's mode is what governs right now, regardless of what earlier messages allowed. A <mode_notice> block inside a message marks exactly when such a switch happened.`,sd=`# Plan Mode
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.`,cd=`# Plan Mode
147
147
 
148
148
  You are in Plan mode. Your role is to explore, analyze, and plan -- not to execute.
149
149
 
@@ -154,37 +154,37 @@ You are in Plan mode. Your role is to explore, analyze, and plan -- not to execu
154
154
  - Do NOT edit files, write code, run destructive commands, or make any changes
155
155
  - Do NOT implement anything -- focus on understanding and alignment first
156
156
 
157
- The run_commands tool remains available in plan mode strictly for read-only inspection -- listing files, searching (grep), reading configs, inspecting git history and diffs, checking tool versions, and the like. Never use it to change anything: no creating, modifying, or deleting files, no writing scripts that make changes, and no state-changing commands (installs, migrations, database or schema changes, container commands that mutate state, etc.). File-editing commands (rm/mv/cp, in-place edits like sed -i, output redirection to files outside /tmp, git commands that change the working tree, package installs) are hard-blocked in plan mode: they are not executed and return a tool error instead, so do not attempt them. If the task requires a mutation, put it in the plan; it happens only after the user switches to act mode.`,ad=`${sd}
157
+ The run_commands tool remains available in plan mode strictly for read-only inspection -- listing files, searching (grep), reading configs, inspecting git history and diffs, checking tool versions, and the like. Never use it to change anything: no creating, modifying, or deleting files, no writing scripts that make changes, and no state-changing commands (installs, migrations, database or schema changes, container commands that mutate state, etc.). File-editing commands (rm/mv/cp, in-place edits like sed -i, output redirection to files outside /tmp, git commands that change the working tree, package installs) are hard-blocked in plan mode: they are not executed and return a tool error instead, so do not attempt them. If the task requires a mutation, put it in the plan; it happens only after the user switches to act mode.`,ud=`${cd}
158
158
 
159
- Once the user has reviewed your plan and explicitly approved it in a follow-up message, use the switch_to_act_mode tool to switch to act mode and begin implementation. Calling switch_to_act_mode immediately starts execution, so never call it in the same turn you present a plan and never treat the original task request as approval -- end your turn after presenting the plan and wait for the user's response.`,cd=`${sd}
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.`,ld=`${cd}
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 Dh(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 Bh(e){return JSON.stringify({workspaces:{[e.rootPath]:{hint:e.hint,associatedRemoteUrls:e.associatedRemoteUrls?.map(Dh),latestGitCommitHash:e.latestGitCommitHash,latestGitBranchName:e.latestGitBranchName}}},null,2)}function rd(e,t,n){if(n?.trim()?.includes(Kr))return n.trim();let o=n||JSON.stringify({workspaces:{[e]:{hint:t||e.split("/").at(-1)||e}}},null,2);return`
162
- ${Kr}
163
- ${o}`}function Uh(e){let{ide:t="Terminal Shell",mode:n,platform:o="unknown",workspaceName:r,metadata:i,rules:s,overridePrompt:a,providerId:c,planModeSwitchTool:u=!0}=e,l=e.workspaceRoot??e.rootPath??"",p=qr(c||"");if(a?.trim()){let g=a.trim();if(p&&i?.trim()&&!g.includes(Kr))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 Uh(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 Zh(e){return JSON.stringify({workspaces:{[e.rootPath]:{hint:e.hint,associatedRemoteUrls:e.associatedRemoteUrls?.map(Uh),latestGitCommitHash:e.latestGitCommitHash,latestGitBranchName:e.latestGitBranchName}}},null,2)}function sd(e,t,n){if(n?.trim()?.includes(Ko))return n.trim();let r=n||JSON.stringify({workspaces:{[e]:{hint:t||e.split("/").at(-1)||e}}},null,2);return`
162
+ ${Ko}
163
+ ${r}`}function Fh(e){let{ide:t="Terminal Shell",mode:n,platform:r="unknown",workspaceName:o,metadata:i,rules:s,overridePrompt:a,providerId:c,planModeSwitchTool:u=!0}=e,l=e.workspaceRoot??e.rootPath??"",p=qo(c||"");if(a?.trim()){let g=a.trim();if(p&&i?.trim()&&!g.includes(Ko))return`${g}
164
164
 
165
- ${rd(l,r,i)}`.trim();return g}let m=n==="yolo"?Gr.YOLO:Gr.ACT,f=[s,n==="yolo"?void 0:id,n==="plan"?u?ad:cd:void 0].filter(Boolean).join(`
165
+ ${sd(l,o,i)}`.trim();return g}let m=n==="yolo"?Go.YOLO:Go.ACT,f=[s,n==="yolo"?void 0:ad,n==="plan"?u?ud:ld:void 0].filter(Boolean).join(`
166
166
 
167
- `);return m.replace("{{PLATFORM_NAME}}",o).replace("{{CWD}}",l).replace("{{CURRENT_DATE}}",new Date().toLocaleDateString()).replace("{{IDE_NAME}}",t).replace("{{CLINE_METADATA}}",p?rd(l,r,i):"").replace("{{CLINE_RULES}}",f).trim()}function Zh(e){return e?.metadata?.apiKeyOptional===!0}function Fh(e){let t=e?.metadata?.localCliCommand;if(typeof t!=="string"||!t.trim())return;return{command:t.trim(),docsUrl:e?.docsUrl}}var Hh="anthropic/claude-sonnet-5.5";import ge from"node:fs/promises";import Wr from"node:path";async function jh(e){try{return await ge.access(e),!0}catch{return!1}}class Jr{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(Wr.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 Rn{async writeText(e,t){await ge.mkdir(Wr.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 jh(e))return;let t=await ge.readdir(e);await Promise.all(t.map((n)=>ge.rm(Wr.join(e,n),{recursive:!0,force:!0})))}}import{createHmac as Kh}from"node:crypto";import{basename as Wh}from"node:path";var Xr=new TextEncoder,Vh={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"},qh=new Set(["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"]);class An{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 pd(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 pd{constructor({method:e,url:t,headers:n,body:o,accessKeyId:r,secretAccessKey:i,sessionToken:s,service:a,region:c,cache:u,datetime:l,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,_;if(!a||!c)[y,_]=Gh(this.url,this.headers);if(this.service=a||y||"",this.region=c||_||"us-east-1",this.cache=u||new Map,this.datetime=l||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||!qh.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=dd(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)=>dd(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 Yr(await Nt(n,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,Yr(await ud(await this.canonicalString()))].join(`
167
+ `);return m.replace("{{PLATFORM_NAME}}",r).replace("{{CWD}}",l).replace("{{CURRENT_DATE}}",new Date().toLocaleDateString()).replace("{{IDE_NAME}}",t).replace("{{CLINE_METADATA}}",p?sd(l,o,i):"").replace("{{CLINE_RULES}}",f).trim()}function Hh(e){return e?.metadata?.apiKeyOptional===!0}function jh(e){let t=e?.metadata?.localCliCommand;if(typeof t!=="string"||!t.trim())return;return{command:t.trim(),docsUrl:e?.docsUrl}}var Vh="anthropic/claude-sonnet-5.5";import ge from"node:fs/promises";import Wo from"node:path";async function qh(e){try{return await ge.access(e),!0}catch{return!1}}class Jo{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(Wo.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 Rn{async writeText(e,t){await ge.mkdir(Wo.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 qh(e))return;let t=await ge.readdir(e);await Promise.all(t.map((n)=>ge.rm(Wo.join(e,n),{recursive:!0,force:!0})))}}import{createHmac as Jh}from"node:crypto";import{basename as Yh}from"node:path";var Xo=new TextEncoder,Gh={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"},Kh=new Set(["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"]);class An{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 fd(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 fd{constructor({method:e,url:t,headers:n,body:r,accessKeyId:o,secretAccessKey:i,sessionToken:s,service:a,region:c,cache:u,datetime:l,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]=Wh(this.url,this.headers);if(this.service=a||y||"",this.region=c||S||"us-east-1",this.cache=u||new Map,this.datetime=l||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||!Kh.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=md(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)=>md(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 Yo(await Nt(n,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,Yo(await dd(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=Yr(await ud(this.body||""))}return e}}async function Nt(e,t){let n=await crypto.subtle.importKey("raw",typeof e==="string"?Xr.encode(e):e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return crypto.subtle.sign("HMAC",n,Xr.encode(t))}async function ud(e){return crypto.subtle.digest("SHA-256",typeof e==="string"?Xr.encode(e):e)}var ld=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function Yr(e){let t=new Uint8Array(e),n="";for(let o=0;o<t.length;o++){let r=t[o];n+=ld[r>>>4&15],n+=ld[r&15]}return n}function dd(e){return e.replace(/[!'()*]/g,(t)=>"%"+t.charCodeAt(0).toString(16).toUpperCase())}function Gh(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[Vh[i]||i,s||""]}var fd="enterprise.blobUpload",wn=new Map;function Qr(e,t){return{adapterType:e,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,region:t.region,bucket:t.bucket,endpoint:t.endpoint,accountId:t.accountId}}function gd(e){return{adapterType:e.adapterType,bucket:e.bucket,region:e.region,endpoint:e.endpoint,accountId:e.accountId}}function Jh(e){if(!e||e.enabled!==!0)return;if(e.type==="s3_access_keys"&&e.s3AccessSettings)return Qr("s3",e.s3AccessSettings);if(e.type==="r2_access_keys"&&e.r2AccessSettings)return Qr("r2",e.r2AccessSettings);if(e.type==="azure_access_keys"&&e.azureAccessSettings)return Qr("azure",e.azureAccessSettings);return}function hd(e){return Jh(e?.enterpriseTelemetry?.promptUploading)}function Yh(e,t){let n=hd(e);if(!n)return;return{version:1,storage:gd(n),userDistinctId:t}}function Xh(e,t,n){let o=hd(t);if(!o){wn.delete(e);return}return wn.set(e,o),{version:1,storage:gd(o),userDistinctId:n}}function Qh(e){wn.delete(e)}function yd(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 ey(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 yd(new An({region:r,accessKeyId:n,secretAccessKey:o}),i,t)}function ty(e){let{accountId:t,endpoint:n,bucket:o,accessKeyId:r,secretAccessKey:i}=e;if(!n&&!t||!o||!r||!i)return;return yd(new An({accessKeyId:r,secretAccessKey:i}),e.endpoint??`https://${t}.r2.cloudflarestorage.com`,o)}function ny(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}`,u=[n,"","",i,"",s,"","","","","","",a,c].join(`
173
- `),l=Buffer.from(t,"base64"),p=Kh("sha256",l).update(u,"utf8").digest("base64");return`SharedKey ${e}:${p}`}function oy(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(),u=Buffer.from(s,"utf8"),l={"x-ms-date":c,"x-ms-version":"2024-11-04","x-ms-blob-type":"BlockBlob","Content-Type":"application/json; charset=utf-8","Content-Length":u.byteLength.toString()};l.Authorization=ny(t,n,"PUT",a,l);let p=await fetch(`${r}${a}`,{method:"PUT",body:u,headers:l});if(!p.ok){let m=await p.text().catch(()=>"");throw Error(`Failed to write ${i}: ${p.status} ${m}`.trim())}}}}function ry(e){if(e.adapterType==="s3")return ey(e);if(e.adapterType==="r2")return ty(e);if(e.adapterType==="azure")return oy(e);return}function md(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function bd(e){let t=e?.metadata?.[fd];if(!md(t))return;let n=t.storage;if(!md(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 iy(e,t,n){return["sessions",n.userDistinctId?.trim()||"unknown",e,t?.endsWith("messages.json")?"messages.json":Wh(t)].filter((i)=>Boolean(i?.trim())).join("/")}function sy(){let e=new Map;return{async uploadMessagesFile({sessionId:t,path:n,contents:o,row:r}){let i=bd(r);if(!i)return;let s=wn.get(t);if(!s)return;let a=JSON.stringify(s),c=e.get(a);if(!c){if(c=ry(s),!c)return;e.set(a,c)}await c.write(iy(t,n,i),o)}}}function ei(e,t,n){return{id:`remote-config:${e}:${n}:${t.name}`,name:t.name,kind:e,contents:t.contents,alwaysEnabled:t.alwaysEnabled}}var ay="remote://";function xd(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 cy(e){let t=e?.globalRules?.map((o,r)=>ei("rule",o,`${r}`))??[],n=e?.globalWorkflows?.map((o,r)=>ei("workflow",o,`${r}`))??[];return[...t,...n]}function uy(e){return[...cy(e.remoteConfig),...e.managedInstructions??[]]}function ly(e){return e.map((t)=>{let n=`## ${t.name}`,o=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=Yo(await dd(this.body||""))}return e}}async function Nt(e,t){let n=await crypto.subtle.importKey("raw",typeof e==="string"?Xo.encode(e):e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return crypto.subtle.sign("HMAC",n,Xo.encode(t))}async function dd(e){return crypto.subtle.digest("SHA-256",typeof e==="string"?Xo.encode(e):e)}var pd=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function Yo(e){let t=new Uint8Array(e),n="";for(let r=0;r<t.length;r++){let o=t[r];n+=pd[o>>>4&15],n+=pd[o&15]}return n}function md(e){return e.replace(/[!'()*]/g,(t)=>"%"+t.charCodeAt(0).toString(16).toUpperCase())}function Wh(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[Gh[i]||i,s||""]}var hd="enterprise.blobUpload",In=new Map;function Qo(e,t){return{adapterType:e,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,region:t.region,bucket:t.bucket,endpoint:t.endpoint,accountId:t.accountId}}function yd(e){return{adapterType:e.adapterType,bucket:e.bucket,region:e.region,endpoint:e.endpoint,accountId:e.accountId}}function Xh(e){if(!e||e.enabled!==!0)return;if(e.type==="s3_access_keys"&&e.s3AccessSettings)return Qo("s3",e.s3AccessSettings);if(e.type==="r2_access_keys"&&e.r2AccessSettings)return Qo("r2",e.r2AccessSettings);if(e.type==="azure_access_keys"&&e.azureAccessSettings)return Qo("azure",e.azureAccessSettings);return}function bd(e){return Xh(e?.enterpriseTelemetry?.promptUploading)}function Qh(e,t){let n=bd(e);if(!n)return;return{version:1,storage:yd(n),userDistinctId:t}}function ey(e,t,n){let r=bd(t);if(!r){In.delete(e);return}return In.set(e,r),{version:1,storage:yd(r),userDistinctId:n}}function ty(e){In.delete(e)}function xd(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 ny(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 xd(new An({region:o,accessKeyId:n,secretAccessKey:r}),i,t)}function ry(e){let{accountId:t,endpoint:n,bucket:r,accessKeyId:o,secretAccessKey:i}=e;if(!n&&!t||!r||!o||!i)return;return xd(new An({accessKeyId:o,secretAccessKey:i}),e.endpoint??`https://${t}.r2.cloudflarestorage.com`,r)}function oy(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}`,u=[n,"","",i,"",s,"","","","","","",a,c].join(`
173
+ `),l=Buffer.from(t,"base64"),p=Jh("sha256",l).update(u,"utf8").digest("base64");return`SharedKey ${e}:${p}`}function iy(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(),u=Buffer.from(s,"utf8"),l={"x-ms-date":c,"x-ms-version":"2024-11-04","x-ms-blob-type":"BlockBlob","Content-Type":"application/json; charset=utf-8","Content-Length":u.byteLength.toString()};l.Authorization=oy(t,n,"PUT",a,l);let p=await fetch(`${o}${a}`,{method:"PUT",body:u,headers:l});if(!p.ok){let m=await p.text().catch(()=>"");throw Error(`Failed to write ${i}: ${p.status} ${m}`.trim())}}}}function sy(e){if(e.adapterType==="s3")return ny(e);if(e.adapterType==="r2")return ry(e);if(e.adapterType==="azure")return iy(e);return}function gd(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Sd(e){let t=e?.metadata?.[hd];if(!gd(t))return;let n=t.storage;if(!gd(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 ay(e,t,n){return["sessions",n.userDistinctId?.trim()||"unknown",e,t?.endsWith("messages.json")?"messages.json":Yh(t)].filter((i)=>Boolean(i?.trim())).join("/")}function cy(){let e=new Map;return{async uploadMessagesFile({sessionId:t,path:n,contents:r,row:o}){let i=Sd(o);if(!i)return;let s=In.get(t);if(!s)return;let a=JSON.stringify(s),c=e.get(a);if(!c){if(c=sy(s),!c)return;e.set(a,c)}await c.write(ay(t,n,i),r)}}}function ei(e,t,n){return{id:`remote-config:${e}:${n}:${t.name}`,name:t.name,kind:e,contents:t.contents,alwaysEnabled:t.alwaysEnabled}}var uy="remote://";function _d(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 ly(e){let t=e?.globalRules?.map((r,o)=>ei("rule",r,`${o}`))??[],n=e?.globalWorkflows?.map((r,o)=>ei("workflow",r,`${o}`))??[];return[...t,...n]}function dy(e){return[...ly(e.remoteConfig),...e.managedInstructions??[]]}function py(e){return e.map((t)=>{let n=`## ${t.name}`,r=t.alwaysEnabled?`_Always enabled_
174
174
  `:"";return`${n}
175
175
 
176
- ${o}${t.contents.trim()}`}).join(`
176
+ ${r}${t.contents.trim()}`}).join(`
177
177
 
178
- `)}function ti(e,t){return e.filter((n)=>n.kind===t)}class ni{async materialize(e){let t=uy(e.bundle),n=ti(t,"rule"),o=ti(t,"workflow"),r=ti(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,ly(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}/${xd(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}/${xd(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 dy="remote-config";function oi(e){let t=e.pluginName??dy,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 _d(e){return{workflowsDirectories:[e.workflowsPath],skillsDirectories:[e.skillsPath]}}function py(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 vd(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 In(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(!vd(n))return;let o=Object.entries(n).filter((r)=>typeof r[1]==="string");return o.length>0?Object.fromEntries(o):void 0}function my(e){if(!vd(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: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 ii{name="remote-config";resolveTelemetry(e,t){return{...py(e.remoteConfig),...my(e.telemetry)}}}async function fy(e){let t=oi(e),n=e.artifactStore??new Rn;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 Td(e){return e?.claims}function Cd(e,t){if(!e)return[];if(t.claimsMapper)return t.claimsMapper.mapClaimsToRoles(e);return e.roles??[]}function gy(e,t){return{...e,metadata:{...e.metadata??{},paths:t}}}class kd{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=Td(t),i=Cd(r,this.options);return{bundle:t,materialized:n,telemetry:o,roles:i,claims:r}}}function hy(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 yy(e){let t=oi({workspacePath:e.workspacePath,pluginName:e.pluginName}),n=e.bundleStore??new Jr(t.bundleCachePath),o=e.artifactStore??new Rn,r=e.materializer??new ni,i=e.telemetryAdapter??new ii,s,a,c=[],u,l=!1,p=!1;if(e.controlPlane){let f=new kd({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,u=g.claims,p=!0}catch(g){if(e.useCachedBundle!==!1)s=await n.read(),l=Boolean(s);if(!s)throw g}}else if(e.useCachedBundle!==!1)s=await n.read(),l=Boolean(s);if(!s&&e.requireBundle)throw Error("Remote config runtime preparation requires a bundle");if(s){let f=gy(s,t);if(await n.write(f),!p)await r.materialize({bundle:f,paths:t,artifactStore:o});u??=Td(f),c=c.length>0?c:Cd(u,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=_d(t);return{pluginName:t.pluginName,pluginDefinition:hy({name:t.pluginName}),paths:t,bundle:s,telemetry:a,roles:c,claims:u,usedCachedBundle:l,workflowsDirectories:m.workflowsDirectories,skillsDirectories:m.skillsDirectories}}var Ed=b({id:d(),temperature:x().optional(),maxTokens:x().optional(),contextWindow:x().optional(),inputPrice:x().optional(),outputPrice:x().optional(),supportsImages:I().optional()}),Rd=b({models:E(Ed).optional(),openAiBaseUrl:d().optional(),openAiHeaders:j(d(),d()).optional(),azureApiVersion:d().optional(),azureIdentity:I().optional()}),Ad=b({id:d(),thinkingBudgetTokens:x().optional()}),wd=b({name:d(),baseModelId:d(),thinkingBudgetTokens:x().optional()}),Id=b({models:E(Ad).optional(),customModels:E(wd).optional(),awsRegion:d().optional(),awsUseCrossRegionInference:I().optional(),awsUseGlobalInference:I().optional(),awsBedrockUsePromptCache:I().optional(),awsBedrockEndpoint:d().optional()}),Pd=b({id:d()}),Md=b({models:E(Pd).optional()}),Od=b({id:d(),thinkingBudgetTokens:x().optional()}),zd=b({models:E(Od).optional(),vertexProjectId:d().optional(),vertexRegion:d().optional()}),Nd=b({id:d(),thinkingBudgetTokens:x().optional(),promptCachingEnabled:I().optional()}),$d=b({models:E(Nd).optional(),baseUrl:d().optional()}),Ld=b({id:d(),thinkingBudgetTokens:x().optional()}),Dd=b({models:E(Ld).optional(),baseUrl:d().optional()}),by=b({OpenAiCompatible:Rd.optional(),AwsBedrock:Id.optional(),Cline:Md.optional(),Vertex:zd.optional(),LiteLLM:$d.optional(),Anthropic:Dd.optional()}),Bd=b({id:d()}),Ud=b({name:d(),url:d(),alwaysEnabled:I().optional(),headers:j(d(),d()).optional()}),si=b({alwaysEnabled:I(),name:d(),contents:d()}),Pn=b({bucket:d(),accessKeyId:d(),secretAccessKey:d(),region:d().optional(),endpoint:d().optional(),accountId:d().optional()}),Zd=b({enabled:I().optional(),type:Ge([V("s3_access_keys"),V("r2_access_keys"),V("azure_access_keys")]).optional(),s3AccessSettings:Pn.optional(),r2AccessSettings:Pn.optional(),azureAccessSettings:Pn.optional()}),Fd=b({promptUploading:Zd.optional()}),xy=b({version:d(),providerSettings:by.optional(),telemetryEnabled:I().optional(),kanbanEnabled:I().optional(),mcpMarketplaceEnabled:I().optional(),allowedMCPServers:E(Bd).optional(),remoteMCPServers:E(Ud).optional(),blockPersonalRemoteMCPServers:I().optional(),yoloModeAllowed:I().optional(),openTelemetryEnabled:I().optional(),openTelemetryMetricsExporter:d().optional(),openTelemetryLogsExporter:d().optional(),openTelemetryOtlpProtocol:d().optional(),openTelemetryOtlpEndpoint:d().optional(),openTelemetryOtlpHeaders:j(d(),d()).optional(),openTelemetryOtlpMetricsProtocol:d().optional(),openTelemetryOtlpMetricsEndpoint:d().optional(),openTelemetryOtlpMetricsHeaders:j(d(),d()).optional(),openTelemetryOtlpLogsProtocol:d().optional(),openTelemetryOtlpLogsEndpoint:d().optional(),openTelemetryOtlpLogsHeaders:j(d(),d()).optional(),openTelemetryMetricExportInterval:x().optional(),openTelemetryOtlpInsecure:I().optional(),openTelemetryLogBatchSize:x().optional(),openTelemetryLogBatchTimeout:x().optional(),openTelemetryLogMaxQueueSize:x().optional(),enterpriseTelemetry:Fd.optional(),globalRules:E(si).optional(),globalWorkflows:E(si).optional()}),_y=j(d(),d());var Sy=25463,vy=25466,Ty=4317;var Cy="127.0.0.1:4317";var ky=w(["reasoning","prompt-cache","tools","provider-tools","oauth","temperature","files","streaming","vision","computer-use","local-auth","popular"]),Ey=w(["anthropic","gemini","openai-chat","openai-responses","openai-r1","ai-sdk"]),Ry=w(["anthropic","ai-sdk","ai-sdk-community","openai","openai-compatible","openai-r1","gemini","bedrock","custom","fetch","vertex"]);var Ay="runtime.team.progress.v1",wy="runtime.team.lifecycle.v1";import{basename as Iy}from"node:path";var Mn="CLINE_BUILD_ENV",Hd="CLINE_DEBUG_HOST",jd="CLINE_DEBUG_PORT_BASE";function Vd(e){let t=e?.trim().toLowerCase();if(t==="development"||t==="production")return t;return}function Py(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 My(e){if(!e?.trim())return!1;let t=Iy(e).toLowerCase();return t==="node"||t==="node.exe"||t==="bun"||t==="bun.exe"}function Oy(e){return e.some((t)=>t==="--inspect"||t.startsWith("--inspect=")||t==="--inspect-brk"||t.startsWith("--inspect-brk="))}function zy(e){return e.some((t)=>t==="--enable-source-maps")}function Ny(e){return e[Hd]?.trim()||"127.0.0.1"}function $y(e){let t=e[jd]?.trim();if(!t)return;let n=Number.parseInt(t,10);return Number.isInteger(n)&&n>0?n:void 0}function Ly(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 ai(e={}){let t=e.env??process.env,n=e.execArgv??process.execArgv,o=Vd(t[Mn]);if(o)return o;let r=t.NODE_ENV?.trim().toLowerCase();if(r==="production")return"production";if(r==="development")return"development";return Py(n)?"development":"production"}function Dy(e=process.env,t={}){if(Vd(e[Mn]))return e;return{...e,[Mn]:ai({env:e,execArgv:t.execArgv})}}function By(e,t={}){if(e.length===0||!My(e[0]))return[...e];if(ai(t)!=="development")return[...e];let n=t.env??process.env,o=[...n.NODE_OPTIONS?.split(/\s+/).filter(Boolean)??[],...e.slice(1)],r=[];if(!Oy(o)){let i=Ny(n),s=$y(n),a=s===void 0?0:s+Ly(t.debugRole);r.push(`--inspect=${i}:${a}`)}if(!zy(o))r.push("--enable-source-maps");return[e[0],...r,...e.slice(1)]}function Uy(e){let t=e?.trim();if(!t)return!1;if(t.startsWith("/$bunfs/"))return!0;return t.replace(/\\/g,"/").toLowerCase().startsWith("b:/~bun/")}function qd(){return globalThis}function Zy(e){qd().__clineClientIdentity=e}function Fy(){return qd().__clineClientIdentity}var Hy="CLINE_ENVIRONMENT",jy="CLINE_ENVIRONMENT_OVERRIDE",ci={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"}},Vy="production";function Gd(e){let t=e?.trim().toLowerCase();if(t==="production"||t==="staging"||t==="local")return t;return}function Kd(){if(typeof process>"u"||!process?.env)return{};return process.env}function Wd(){let e=Kd();return Gd(e.CLINE_ENVIRONMENT_OVERRIDE)??Gd(e.CLINE_ENVIRONMENT)??"production"}function qy(e){if(typeof e==="string")return ci[e];return ci[Wd()]}function Gy(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 Ky(e){let t=qy(e);return Gy(t,Kd())}var Wy="CLINE_RUN_AS_HUB_DAEMON",Jy="CLINE_CONNECTOR_CLI_LAUNCH",Yy="CLINE_CONNECTOR_STARTING_INSTANCE",Xy="CLINE_CONNECTOR_SUPERVISED",ui;function Qy(e=process.env){return ui=e.CLINE_RUN_AS_HUB_DAEMON==="1",delete e.CLINE_RUN_AS_HUB_DAEMON,ui}function eb(e){if(e)return e.CLINE_RUN_AS_HUB_DAEMON==="1";return ui??process.env.CLINE_RUN_AS_HUB_DAEMON==="1"}function tb(e,t=process.env){t.CLINE_CONNECTOR_CLI_LAUNCH=JSON.stringify(e)}var li;function nb(e=process.env){return li=e.CLINE_CONNECTOR_SUPERVISED==="1",delete e.CLINE_CONNECTOR_SUPERVISED,li}function ob(e){if(e)return e.CLINE_CONNECTOR_SUPERVISED==="1";return li??process.env.CLINE_CONNECTOR_SUPERVISED==="1"}function rb(e,t=process.env){t.CLINE_CONNECTOR_STARTING_INSTANCE=JSON.stringify(e)}function ib(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 sb(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 ab=["HTTP_PROXY","http_proxy","HTTPS_PROXY","https_proxy","ALL_PROXY","all_proxy"],Yd=["localhost","127.0.0.1","::1","[::1]"];function cb(e){for(let t of ab){let n=e[t]?.trim();if(n)return n}return}function di(e){return(e??"").split(",").map((t)=>t.trim()).filter((t)=>t.length>0)}function ub(e,t){let n=[],o=new Set;for(let r of[...di(e),...di(t),...Yd]){let i=r.toLowerCase();if(i!=="*"&&!o.has(i))o.add(i),n.push(r)}return n.join(",")}function Jd(e){return di(e).includes("*")}function lb(e=process.env){if(!cb(e))return;let t=Jd(e.NO_PROXY),n=Jd(e.no_proxy);if(t&&n)return;let o=ub(e.NO_PROXY,e.no_proxy);if(!t)e.NO_PROXY=o;if(!n)e.no_proxy=o}var db="NoDefaultCurrentDirectoryInExePath";function pb(e={}){let{env:t=process.env,platform:n=process.platform}=e;if(n!=="win32")return;t.NoDefaultCurrentDirectoryInExePath="1"}var mb="agent.reasoning.unexpected_tokens",fb="task.provider_request_started",gb="task.provider_stream_started",hb="task.first_chunk_received",yb="task.provider_stream_failed",bb="task.cancelled",xb="task.max_tokens_recovery",_b=["initial","crash_restart","rollout_fallback","rollout_demotion","user_restart"],Sb="sdk.error";var De=new Map;function vb(){De.clear()}function Tb(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 Cb(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 kb(e,t){e?.capture({event:"agent.reasoning.unexpected_tokens",properties:mi({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 Eb(e,t){if(!e)return;e.capture({event:t.event,properties:mi({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?{}:fi(t.error,t.messageLimit),error_class:t.errorClass})})}function Rb(e,t){if(!e)return!1;let n=t.event??"sdk.error",o=Xd(t),r=0;try{let i=Cb(Tb(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 Xd(e){return mi({...e.context??{},component:e.component,operation:e.operation,severity:e.severity??"error",handled:e.handled??!0,...fi(e.error,e.messageLimit,e.errorMessage)})}function mi(e){let t={};for(let[n,o]of Object.entries(e))if(o!==void 0)t[n]=o;return t}function fi(e,t=500,n){let o=Ib(e)?e:void 0,r=e instanceof Error?e:void 0,i=$t(n)??$t(r?.message)??$t(o?.message)??Pb(e)??"Unknown error",s=Mb(o?.code),a=pi(o?.status)??pi(o?.statusCode)??pi(o?.responseStatus);return{error_type:r?.name?.trim()||$t(o?.name)||r?.constructor?.name||"Error",error_message:wb(Ab(i),t),...s!==void 0?{error_code:s}:{},...a!==void 0?{error_status:a}:{}}}function Ab(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 wb(e,t){let n=Math.max(1,Math.floor(t));return e.length>n?e.substring(0,n):e}function Ib(e){return typeof e==="object"&&e!==null}function $t(e){return typeof e==="string"&&e.trim().length>0?e:void 0}function Pb(e){if(e instanceof Error)return;let t=typeof e==="string"?e:String(e);return t==="[object Object]"?void 0:$t(t)}function Mb(e){if(typeof e==="string"&&e.trim().length>0)return e;if(typeof e==="number"&&Number.isFinite(e))return e;return}function pi(e){return typeof e==="number"&&Number.isFinite(e)?e:void 0}var gi="_clineOtlpTraceRelay";function Ob(e){e[gi]=!0}function zb(e){return!!e&&typeof e==="object"&&e[gi]===!0}function Qd(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 Nb(){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?Qd(process.env.OTEL_EXPORTER_OTLP_HEADERS):void 0}}function ep(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 $b(e={}){return{...Nb(),...e,metadata:ep(e.metadata)}}function tp(e){let t=e?.trim();return t?t:void 0}function Lb(e,t){if(!e)return;let n=typeof e==="function"?e(t):e;if(!n)return;let o=tp(n.rootSessionId);if(!o)return;return{rootSessionId:o}}function Db(e){return tp(e?.rootSessionId)}import{webcrypto as np}from"node:crypto";var Bb=128,Pe,it;function Ub(e){if(e<0)throw RangeError("Wrong ID size");try{if(!Pe||Pe.length<e)Pe=Buffer.allocUnsafe(e*Bb),np.getRandomValues(Pe),it=0;else if(it+e>Pe.length)np.getRandomValues(Pe),it=0}catch(t){throw Pe=void 0,t}it+=e}function Zb(e){return Ub(e|=0),Pe.subarray(it-e,it)}function Fb(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),u=s;while(u--)if(a+=e[c[u]&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 op(e,t=21){return Fb(e,t,Zb)}function Hb(e="",t=""){let n=op("1234567890abcdefghijklmnopqrstuvwxyz",10);return`${e}${Date.now()}_${n(5)}${t}`}var jb=["idle","running","pending","completed","failed","cancelled"];var hi=["rules","skills","workflows","plugins","hooks"],rp=hi,Vb=new Set(hi);function ip(e){return typeof e==="string"&&Vb.has(e)}function qb(e){if(!Array.isArray(e))return;let t=e.map((n)=>typeof n==="string"?n.trim():"").filter(ip);return[...new Set(t)]}function Gb(e,t){return new Set(e??rp).has(t)}var Kb=b({rootPath:d().min(1),hint:d().min(1).optional(),associatedRemoteUrls:E(d().min(1)).optional(),latestGitCommitHash:d().min(1).optional(),latestGitBranchName:d().min(1).optional()}),Wb=b({currentWorkspacePath:d().min(1).optional(),workspaces:j(d().min(1),Kb)});function GC(){return{workspaces:{}}}function KC(e,t){let n={...e,workspaces:{...e.workspaces,[t.rootPath]:t}};if(!n.currentWorkspacePath)n.currentWorkspacePath=t.rootPath;return Wb.parse(n)}var Jb="workspaces",Yb="chat";function Xb(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 Qb=["current_state","boundary_analysis","interface_proposal"],XC=3600000,QC=240,ek=400,le=Ku((e)=>e instanceof Date?e.toISOString():e,d().datetime()),st=w(["pending","in_progress","blocked","completed"]),sp=w(["queued","running","completed","failed","cancelled","interrupted"]),On=w(["draft","in_review","finalized"]),ex=b({agentId:d(),role:w(["lead","teammate"]),description:d().optional(),status:w(["idle","running","stopped"])}),tk=b({agentId:d(),rolePrompt:d(),modelId:d().optional(),maxIterations:x().optional()});function Z(e){return Ku((t)=>t===null?void 0:t,e.optional())}var nk=b({agentId:d().min(1).describe("Teammate identifier"),rolePrompt:d().min(1).describe("System prompt describing teammate role")}).strict(),ok=b({agentId:d().min(1).describe("Teammate identifier"),reason:Z(d().min(1)).describe("Optional shutdown reason")}),rk=b({}),tx={create:["title","description"],list:[],claim:["taskId"],complete:["taskId","summary"],block:["taskId","reason"]},ik={create:["status","taskId","summary","reason"]},sk=b({action:w(["create","list","claim","complete","block"]),title:Z(d().min(1)).describe("Task title"),description:Z(d().min(1)).describe("Task details"),dependsOn:Z(E(d().describe("Dependency task ID"))).describe("Array of dependency task IDs"),assignee:Z(d().min(1)).describe("Optional assignee"),status:Z(w(["pending","in_progress","blocked","completed"])).describe("Optional task status filter"),taskId:Z(d()).describe("Task ID"),summary:Z(d().min(1)).describe("Completion summary"),reason:Z(d().min(1)).describe("Blocking reason")}).superRefine((e,t)=>{for(let n of tx[e.action]){if(e[n]!==void 0)continue;t.addIssue({code:"custom",path:[n],message:`Field "${n}" is required when action=${e.action}`})}}),ak=b({agentId:d().describe("Teammate agent ID"),task:d().min(1).describe("Task instructions for the teammate"),taskId:Z(d()).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")}),ck=b({status:Z(w(["queued","running","completed","failed","cancelled","interrupted"])).describe("Optional run status filter. Omit to include all statuses."),agentId:Z(d().min(1)).describe("Optional teammate ID filter. Omit to include all teammates."),includeCompleted:Z(I()).describe("Include completed/failed runs (default true)")}),uk=b({runId:d().min(1).describe("Run ID"),reason:Z(d().min(1)).describe("Optional cancellation reason")}),lk=b({runId:Z(d().min(1)).describe("Optional async run ID to await. Omit to wait for all active async runs.")}).strict(),dk=b({toAgentId:d().min(1).describe("Recipient agent ID"),subject:d().min(1).describe("Message subject"),body:d().min(1).describe("Message body"),taskId:Z(d().min(1)).describe("Optional task ID context")}),pk=b({subject:d().min(1).describe("Message subject"),body:d().min(1).describe("Message body"),taskId:Z(d().min(1)).describe("Optional task ID context")}),mk=b({unreadOnly:Z(I()).describe("Only unread messages for read action (default true)")}),fk=b({kind:w(["progress","handoff","blocked","decision","done","error"]),summary:d().min(1).describe("Update summary"),taskId:Z(d().min(1)).describe("Optional task ID context"),evidence:Z(E(d().min(1))).describe("Optional evidence links/snippets"),nextAction:Z(d().min(1)).describe("Planned next step")}),gk=b({}),hk=b({title:d().describe("Outcome title"),requiredSections:E(d()).default(Qb).describe("Required sections for finalization gate (defaults to current_state,boundary_analysis,interface_proposal)")}),yk=b({outcomeId:d().describe("Outcome ID"),section:d().describe("Section name"),sourceRunId:Z(d()).describe("Optional source run ID"),content:d().describe("Section fragment content")}),bk=b({fragmentId:d().describe("Fragment ID"),approved:I().describe("Review decision")}),xk=b({outcomeId:d().describe("Outcome ID")}),_k=b({}),Sk=b({teamId:d(),teamName:d(),members:E(ex),taskCounts:j(st,x()),unreadMessages:x(),missionLogEntries:x(),activeRuns:x(),queuedRuns:x(),outcomeCounts:j(On,x())}),nx=b({id:d(),title:d(),description:d(),status:st,createdAt:le,updatedAt:le,createdBy:d(),assignee:d().optional(),dependsOn:E(d()),summary:d().optional(),isReady:I(),blockedBy:E(d())}),vk=cr("action",[b({action:V("create"),taskId:d(),status:st,ignoredFields:E(d()).optional(),note:d().optional()}),b({action:V("list"),tasks:E(nx)}),b({action:V("claim"),taskId:d(),status:st,nextStep:d()}),b({action:V("complete"),taskId:d(),status:st}),b({action:V("block"),taskId:d(),status:st})]),Tk=b({agentId:d(),mode:w(["sync","async"]),status:w(["dispatched","running","queued","joined"]),dispatched:I(),message:d(),deduped:I().optional(),runId:d().optional(),text:d().optional(),iterations:x().optional()}),ox=b({textPreview:d(),iterations:x(),finishReason:d(),durationMs:x(),usage:b({inputTokens:x(),outputTokens:x(),cacheReadTokens:x().optional(),cacheWriteTokens:x().optional(),totalCost:x().optional()})}),Ck=b({id:d(),agentId:d(),taskId:d().optional(),status:sp,messagePreview:d(),priority:x(),retryCount:x(),maxRetries:x(),nextAttemptAt:le.optional(),continueConversation:I().optional(),startedAt:le,endedAt:le.optional(),leaseOwner:d().optional(),heartbeatAt:le.optional(),lastProgressAt:le.optional(),lastProgressMessage:d().optional(),currentActivity:d().optional(),error:d().optional(),resultSummary:ox.optional()}),kk=b({id:d(),teamId:d(),fromAgentId:d(),toAgentId:d(),subject:d(),body:d(),taskId:d().optional(),sentAt:le,readAt:le.optional()}),Ek=b({id:d(),teamId:d(),title:d(),status:On,requiredSections:E(d()),createdBy:d(),createdAt:le,finalizedAt:le.optional()}),Rk=b({outcomeId:d(),status:On,requiredSections:E(d())}),Ak=b({agentId:d(),status:d()}),wk=b({runId:d(),status:sp}),Ik=b({id:d(),toAgentId:d()}),Pk=b({delivered:x()}),Mk=b({id:d()}),Ok=b({status:d()}),zk=b({fragmentId:d(),status:d()}),Nk=b({outcomeId:d(),status:On});var rx;((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"})(rx||={});function ix(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 sx(e){let t=ix(e.inputSchema instanceof N?Vr(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 ap=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function ax(e){let t=(e instanceof Error?e.message:String(e)).toLowerCase();return ap.some((n)=>t.includes(n))}import{existsSync as cx,mkdirSync as ux,readFileSync as lx,writeFileSync as dx}from"node:fs";import{dirname as px,resolve as mx}from"node:path";var fx=new Set(["accesskeyid","secretaccesskey","idtoken","refreshtoken","accesstoken","access_token","refresh_token","apikey","api_key","authorization","password","secret","token","email","displayname","display_name","userinfo"]),gx=["id","balance","cost","secret"];function hx(e){let t=e.toLowerCase();if(fx.has(t))return!0;for(let n of gx){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 yx=[{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 up(e){let t=e;for(let{pattern:n,replacement:o}of yx)t=t.replace(n,o);return t}function yi(e){if(Array.isArray(e))return e.map(yi);if(!e||typeof e!=="object")return e;return Object.fromEntries(Object.entries(e).sort(([t],[n])=>bx(t,n)).map(([t,n])=>[t,yi(n)]))}function bx(e,t){if(e<t)return-1;if(e>t)return 1;return 0}function cp(e){return JSON.stringify(yi(e))}var xx=[{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 bi(e){let t=e;for(let{pattern:n,replacement:o}of xx)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 up(e)}if(Array.isArray(e))return e.map(at);if(typeof e==="object"){let t={};for(let[n,o]of Object.entries(e))if(hx(n)&&(typeof o==="string"||typeof o==="number"))t[n]="REDACTED";else t[n]=at(o);return t}return e}function _x(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 Sx(e){return e?.toLowerCase().split(";")[0]?.trim()==="application/x-www-form-urlencoded"}function lp(e,t){try{return cp(at(JSON.parse(e)))}catch{if(Sx(t)){let n=_x(e);if(n)return cp(at(n))}return up(e)}}function vx(e,t){let n={...e},o=t&&e.body!==void 0?lp(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=bi(n.path);if(n.response!==void 0)n.response=at(n.response);return n}function dp(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 pp(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 mp(e,t){if(t?.method)return t.method.toUpperCase();if(e&&typeof e.method==="string")return e.method.toUpperCase();return"GET"}function Tx(e){if(!e)return;return new Headers(e).get("content-type")??void 0}function fp(e,t){let n=Tx(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 gp(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 Cx(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 ti(e,t){return e.filter((n)=>n.kind===t)}class ni{async materialize(e){let t=dy(e.bundle),n=ti(t,"rule"),r=ti(t,"workflow"),o=ti(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,py(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}/${_d(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}/${_d(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 my="remote-config";function ri(e){let t=e.pluginName??my,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 vd(e){return{workflowsDirectories:[e.workflowsPath],skillsDirectories:[e.skillsPath]}}function fy(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 Cd(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 Td(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 oi(e,t){let n=e[t];if(!Cd(n))return;let r=Object.entries(n).filter((o)=>typeof o[1]==="string");return r.length>0?Object.fromEntries(r):void 0}function gy(e){if(!Cd(e))return;let t={enabled:Td(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:wn(e,"metricExportInterval"),otlpInsecure:Td(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 ii{name="remote-config";resolveTelemetry(e,t){return{...fy(e.remoteConfig),...gy(e.telemetry)}}}async function hy(e){let t=ri(e),n=e.artifactStore??new Rn;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 kd(e){return e?.claims}function Ed(e,t){if(!e)return[];if(t.claimsMapper)return t.claimsMapper.mapClaimsToRoles(e);return e.roles??[]}function yy(e,t){return{...e,metadata:{...e.metadata??{},paths:t}}}class Rd{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=kd(t),i=Ed(o,this.options);return{bundle:t,materialized:n,telemetry:r,roles:i,claims:o}}}function by(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 xy(e){let t=ri({workspacePath:e.workspacePath,pluginName:e.pluginName}),n=e.bundleStore??new Jo(t.bundleCachePath),r=e.artifactStore??new Rn,o=e.materializer??new ni,i=e.telemetryAdapter??new ii,s,a,c=[],u,l=!1,p=!1;if(e.controlPlane){let f=new Rd({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,u=g.claims,p=!0}catch(g){if(e.useCachedBundle!==!1)s=await n.read(),l=Boolean(s);if(!s)throw g}}else if(e.useCachedBundle!==!1)s=await n.read(),l=Boolean(s);if(!s&&e.requireBundle)throw Error("Remote config runtime preparation requires a bundle");if(s){let f=yy(s,t);if(await n.write(f),!p)await o.materialize({bundle:f,paths:t,artifactStore:r});u??=kd(f),c=c.length>0?c:Ed(u,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=vd(t);return{pluginName:t.pluginName,pluginDefinition:by({name:t.pluginName}),paths:t,bundle:s,telemetry:a,roles:c,claims:u,usedCachedBundle:l,workflowsDirectories:m.workflowsDirectories,skillsDirectories:m.skillsDirectories}}var Ad=b({id:d(),temperature:x().optional(),maxTokens:x().optional(),contextWindow:x().optional(),inputPrice:x().optional(),outputPrice:x().optional(),supportsImages:w().optional()}),Id=b({models:E(Ad).optional(),openAiBaseUrl:d().optional(),openAiHeaders:j(d(),d()).optional(),azureApiVersion:d().optional(),azureIdentity:w().optional()}),wd=b({id:d(),thinkingBudgetTokens:x().optional()}),Pd=b({name:d(),baseModelId:d(),thinkingBudgetTokens:x().optional()}),Md=b({models:E(wd).optional(),customModels:E(Pd).optional(),awsRegion:d().optional(),awsUseCrossRegionInference:w().optional(),awsUseGlobalInference:w().optional(),awsBedrockUsePromptCache:w().optional(),awsBedrockEndpoint:d().optional()}),Od=b({id:d()}),zd=b({models:E(Od).optional()}),Nd=b({id:d(),thinkingBudgetTokens:x().optional()}),$d=b({models:E(Nd).optional(),vertexProjectId:d().optional(),vertexRegion:d().optional()}),Ld=b({id:d(),thinkingBudgetTokens:x().optional(),promptCachingEnabled:w().optional()}),Dd=b({models:E(Ld).optional(),baseUrl:d().optional()}),Bd=b({id:d(),thinkingBudgetTokens:x().optional()}),Ud=b({models:E(Bd).optional(),baseUrl:d().optional()}),Sy=b({OpenAiCompatible:Id.optional(),AwsBedrock:Md.optional(),Cline:zd.optional(),Vertex:$d.optional(),LiteLLM:Dd.optional(),Anthropic:Ud.optional()}),Zd=b({id:d()}),Fd=b({name:d(),url:d(),alwaysEnabled:w().optional(),headers:j(d(),d()).optional()}),si=b({alwaysEnabled:w(),name:d(),contents:d()}),Pn=b({bucket:d(),accessKeyId:d(),secretAccessKey:d(),region:d().optional(),endpoint:d().optional(),accountId:d().optional()}),Hd=b({enabled:w().optional(),type:Ge([V("s3_access_keys"),V("r2_access_keys"),V("azure_access_keys")]).optional(),s3AccessSettings:Pn.optional(),r2AccessSettings:Pn.optional(),azureAccessSettings:Pn.optional()}),jd=b({promptUploading:Hd.optional()}),_y=b({version:d(),providerSettings:Sy.optional(),telemetryEnabled:w().optional(),kanbanEnabled:w().optional(),mcpMarketplaceEnabled:w().optional(),allowedMCPServers:E(Zd).optional(),remoteMCPServers:E(Fd).optional(),blockPersonalRemoteMCPServers:w().optional(),yoloModeAllowed:w().optional(),openTelemetryEnabled:w().optional(),openTelemetryMetricsExporter:d().optional(),openTelemetryLogsExporter:d().optional(),openTelemetryOtlpProtocol:d().optional(),openTelemetryOtlpEndpoint:d().optional(),openTelemetryOtlpHeaders:j(d(),d()).optional(),openTelemetryOtlpMetricsProtocol:d().optional(),openTelemetryOtlpMetricsEndpoint:d().optional(),openTelemetryOtlpMetricsHeaders:j(d(),d()).optional(),openTelemetryOtlpLogsProtocol:d().optional(),openTelemetryOtlpLogsEndpoint:d().optional(),openTelemetryOtlpLogsHeaders:j(d(),d()).optional(),openTelemetryMetricExportInterval:x().optional(),openTelemetryOtlpInsecure:w().optional(),openTelemetryLogBatchSize:x().optional(),openTelemetryLogBatchTimeout:x().optional(),openTelemetryLogMaxQueueSize:x().optional(),enterpriseTelemetry:jd.optional(),globalRules:E(si).optional(),globalWorkflows:E(si).optional()}),vy=j(d(),d());var Ty=25463,Cy=25466,ky=4317;var Ey="127.0.0.1:4317";var Ry=I(["reasoning","prompt-cache","tools","provider-tools","oauth","temperature","files","streaming","vision","computer-use","local-auth","popular"]),Ay=I(["anthropic","gemini","openai-chat","openai-responses","openai-r1","ai-sdk"]),Iy=I(["anthropic","ai-sdk","ai-sdk-community","openai","openai-compatible","openai-r1","gemini","bedrock","custom","fetch","vertex"]);var wy="runtime.team.progress.v1",Py="runtime.team.lifecycle.v1";import{basename as My}from"node:path";var Mn="CLINE_BUILD_ENV",Vd="CLINE_DEBUG_HOST",qd="CLINE_DEBUG_PORT_BASE";function Gd(e){let t=e?.trim().toLowerCase();if(t==="development"||t==="production")return t;return}function Oy(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 zy(e){if(!e?.trim())return!1;let t=My(e).toLowerCase();return t==="node"||t==="node.exe"||t==="bun"||t==="bun.exe"}function Ny(e){return e.some((t)=>t==="--inspect"||t.startsWith("--inspect=")||t==="--inspect-brk"||t.startsWith("--inspect-brk="))}function $y(e){return e.some((t)=>t==="--enable-source-maps")}function Ly(e){return e[Vd]?.trim()||"127.0.0.1"}function Dy(e){let t=e[qd]?.trim();if(!t)return;let n=Number.parseInt(t,10);return Number.isInteger(n)&&n>0?n:void 0}function By(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 ai(e={}){let t=e.env??process.env,n=e.execArgv??process.execArgv,r=Gd(t[Mn]);if(r)return r;let o=t.NODE_ENV?.trim().toLowerCase();if(o==="production")return"production";if(o==="development")return"development";return Oy(n)?"development":"production"}function Uy(e=process.env,t={}){if(Gd(e[Mn]))return e;return{...e,[Mn]:ai({env:e,execArgv:t.execArgv})}}function Zy(e,t={}){if(e.length===0||!zy(e[0]))return[...e];if(ai(t)!=="development")return[...e];let n=t.env??process.env,r=[...n.NODE_OPTIONS?.split(/\s+/).filter(Boolean)??[],...e.slice(1)],o=[];if(!Ny(r)){let i=Ly(n),s=Dy(n),a=s===void 0?0:s+By(t.debugRole);o.push(`--inspect=${i}:${a}`)}if(!$y(r))o.push("--enable-source-maps");return[e[0],...o,...e.slice(1)]}function Fy(e){let t=e?.trim();if(!t)return!1;if(t.startsWith("/$bunfs/"))return!0;return t.replace(/\\/g,"/").toLowerCase().startsWith("b:/~bun/")}function Kd(){return globalThis}function Hy(e){Kd().__clineClientIdentity=e}function jy(){return Kd().__clineClientIdentity}var Vy="CLINE_ENVIRONMENT",qy="CLINE_ENVIRONMENT_OVERRIDE",ci={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"}},Gy="production";function Wd(e){let t=e?.trim().toLowerCase();if(t==="production"||t==="staging"||t==="local")return t;return}function Jd(){if(typeof process>"u"||!process?.env)return{};return process.env}function Yd(){let e=Jd();return Wd(e.CLINE_ENVIRONMENT_OVERRIDE)??Wd(e.CLINE_ENVIRONMENT)??"production"}function Ky(e){if(typeof e==="string")return ci[e];return ci[Yd()]}function Wy(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=Ky(e);return Wy(t,Jd())}var Yy="CLINE_RUN_AS_HUB_DAEMON",Xy="CLINE_CONNECTOR_CLI_LAUNCH",Qy="CLINE_CONNECTOR_STARTING_INSTANCE",eb="CLINE_CONNECTOR_SUPERVISED",ui;function tb(e=process.env){return ui=e.CLINE_RUN_AS_HUB_DAEMON==="1",delete e.CLINE_RUN_AS_HUB_DAEMON,ui}function nb(e){if(e)return e.CLINE_RUN_AS_HUB_DAEMON==="1";return ui??process.env.CLINE_RUN_AS_HUB_DAEMON==="1"}function rb(e,t=process.env){t.CLINE_CONNECTOR_CLI_LAUNCH=JSON.stringify(e)}var li;function ob(e=process.env){return li=e.CLINE_CONNECTOR_SUPERVISED==="1",delete e.CLINE_CONNECTOR_SUPERVISED,li}function ib(e){if(e)return e.CLINE_CONNECTOR_SUPERVISED==="1";return li??process.env.CLINE_CONNECTOR_SUPERVISED==="1"}function sb(e,t=process.env){t.CLINE_CONNECTOR_STARTING_INSTANCE=JSON.stringify(e)}function ab(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 cb(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 ub=["HTTP_PROXY","http_proxy","HTTPS_PROXY","https_proxy","ALL_PROXY","all_proxy"],Qd=["localhost","127.0.0.1","::1","[::1]"];function lb(e){for(let t of ub){let n=e[t]?.trim();if(n)return n}return}function di(e){return(e??"").split(",").map((t)=>t.trim()).filter((t)=>t.length>0)}function db(e,t){let n=[],r=new Set;for(let o of[...di(e),...di(t),...Qd]){let i=o.toLowerCase();if(i!=="*"&&!r.has(i))r.add(i),n.push(o)}return n.join(",")}function Xd(e){return di(e).includes("*")}function pb(e=process.env){if(!lb(e))return;let t=Xd(e.NO_PROXY),n=Xd(e.no_proxy);if(t&&n)return;let r=db(e.NO_PROXY,e.no_proxy);if(!t)e.NO_PROXY=r;if(!n)e.no_proxy=r}var mb="NoDefaultCurrentDirectoryInExePath";function fb(e={}){let{env:t=process.env,platform:n=process.platform}=e;if(n!=="win32")return;t.NoDefaultCurrentDirectoryInExePath="1"}var gb="agent.reasoning.unexpected_tokens",hb="task.provider_request_started",yb="task.provider_stream_started",bb="task.first_chunk_received",xb="task.provider_stream_failed",Sb="task.cancelled",_b="task.max_tokens_recovery",vb=["initial","crash_restart","rollout_fallback","rollout_demotion","user_restart"],Tb="sdk.error";var De=new Map;function Cb(){De.clear()}function kb(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 Eb(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 Rb(e,t){e?.capture({event:"agent.reasoning.unexpected_tokens",properties:mi({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 Ab(e,t){if(!e)return;e.capture({event:t.event,properties:mi({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?{}:fi(t.error,t.messageLimit),error_class:t.errorClass})})}function Ib(e,t){if(!e)return!1;let n=t.event??"sdk.error",r=ep(t),o=0;try{let i=Eb(kb(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 ep(e){return mi({...e.context??{},component:e.component,operation:e.operation,severity:e.severity??"error",handled:e.handled??!0,...fi(e.error,e.messageLimit,e.errorMessage)})}function mi(e){let t={};for(let[n,r]of Object.entries(e))if(r!==void 0)t[n]=r;return t}function fi(e,t=500,n){let r=Mb(e)?e:void 0,o=e instanceof Error?e:void 0,i=$t(n)??$t(o?.message)??$t(r?.message)??Ob(e)??"Unknown error",s=zb(r?.code),a=pi(r?.status)??pi(r?.statusCode)??pi(r?.responseStatus);return{error_type:o?.name?.trim()||$t(r?.name)||o?.constructor?.name||"Error",error_message:Pb(wb(i),t),...s!==void 0?{error_code:s}:{},...a!==void 0?{error_status:a}:{}}}function wb(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 Pb(e,t){let n=Math.max(1,Math.floor(t));return e.length>n?e.substring(0,n):e}function Mb(e){return typeof e==="object"&&e!==null}function $t(e){return typeof e==="string"&&e.trim().length>0?e:void 0}function Ob(e){if(e instanceof Error)return;let t=typeof e==="string"?e:String(e);return t==="[object Object]"?void 0:$t(t)}function zb(e){if(typeof e==="string"&&e.trim().length>0)return e;if(typeof e==="number"&&Number.isFinite(e))return e;return}function pi(e){return typeof e==="number"&&Number.isFinite(e)?e:void 0}var gi="_clineOtlpTraceRelay";function Nb(e){e[gi]=!0}function $b(e){return!!e&&typeof e==="object"&&e[gi]===!0}function tp(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 Lb(){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?tp(process.env.OTEL_EXPORTER_OTLP_HEADERS):void 0}}function np(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 Db(e={}){return{...Lb(),...e,metadata:np(e.metadata)}}function rp(e){let t=e?.trim();return t?t:void 0}function Bb(e,t){if(!e)return;let n=typeof e==="function"?e(t):e;if(!n)return;let r=rp(n.rootSessionId);if(!r)return;return{rootSessionId:r}}function Ub(e){return rp(e?.rootSessionId)}import{webcrypto as op}from"node:crypto";var Zb=128,Pe,it;function Fb(e){if(e<0)throw RangeError("Wrong ID size");try{if(!Pe||Pe.length<e)Pe=Buffer.allocUnsafe(e*Zb),op.getRandomValues(Pe),it=0;else if(it+e>Pe.length)op.getRandomValues(Pe),it=0}catch(t){throw Pe=void 0,t}it+=e}function Hb(e){return Fb(e|=0),Pe.subarray(it-e,it)}function jb(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),u=s;while(u--)if(a+=e[c[u]&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 ip(e,t=21){return jb(e,t,Hb)}function Vb(e="",t=""){let n=ip("1234567890abcdefghijklmnopqrstuvwxyz",10);return`${e}${Date.now()}_${n(5)}${t}`}var qb=["idle","running","pending","completed","failed","cancelled"];var hi=["rules","skills","workflows","plugins","hooks"],sp=hi,Gb=new Set(hi);function ap(e){return typeof e==="string"&&Gb.has(e)}function Kb(e){if(!Array.isArray(e))return;let t=e.map((n)=>typeof n==="string"?n.trim():"").filter(ap);return[...new Set(t)]}function Wb(e,t){return new Set(e??sp).has(t)}var Jb=b({rootPath:d().min(1),hint:d().min(1).optional(),associatedRemoteUrls:E(d().min(1)).optional(),latestGitCommitHash:d().min(1).optional(),latestGitBranchName:d().min(1).optional()}),Yb=b({currentWorkspacePath:d().min(1).optional(),workspaces:j(d().min(1),Jb)});function WC(){return{workspaces:{}}}function JC(e,t){let n={...e,workspaces:{...e.workspaces,[t.rootPath]:t}};if(!n.currentWorkspacePath)n.currentWorkspacePath=t.rootPath;return Yb.parse(n)}var Xb="workspaces",Qb="chat";function ex(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 tx=["current_state","boundary_analysis","interface_proposal"],ek=3600000,tk=240,nk=400,le=Ku((e)=>e instanceof Date?e.toISOString():e,d().datetime()),st=I(["pending","in_progress","blocked","completed"]),cp=I(["queued","running","completed","failed","cancelled","interrupted"]),On=I(["draft","in_review","finalized"]),nx=b({agentId:d(),role:I(["lead","teammate"]),description:d().optional(),status:I(["idle","running","stopped"])}),rk=b({agentId:d(),rolePrompt:d(),modelId:d().optional(),maxIterations:x().optional()});function Z(e){return Ku((t)=>t===null?void 0:t,e.optional())}var ok=b({agentId:d().min(1).describe("Teammate identifier"),rolePrompt:d().min(1).describe("System prompt describing teammate role")}).strict(),ik=b({agentId:d().min(1).describe("Teammate identifier"),reason:Z(d().min(1)).describe("Optional shutdown reason")}),sk=b({}),rx={create:["title","description"],list:[],claim:["taskId"],complete:["taskId","summary"],block:["taskId","reason"]},ak={create:["status","taskId","summary","reason"]},ck=b({action:I(["create","list","claim","complete","block"]),title:Z(d().min(1)).describe("Task title"),description:Z(d().min(1)).describe("Task details"),dependsOn:Z(E(d().describe("Dependency task ID"))).describe("Array of dependency task IDs"),assignee:Z(d().min(1)).describe("Optional assignee"),status:Z(I(["pending","in_progress","blocked","completed"])).describe("Optional task status filter"),taskId:Z(d()).describe("Task ID"),summary:Z(d().min(1)).describe("Completion summary"),reason:Z(d().min(1)).describe("Blocking reason")}).superRefine((e,t)=>{for(let n of rx[e.action]){if(e[n]!==void 0)continue;t.addIssue({code:"custom",path:[n],message:`Field "${n}" is required when action=${e.action}`})}}),uk=b({agentId:d().describe("Teammate agent ID"),task:d().min(1).describe("Task instructions for the teammate"),taskId:Z(d()).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")}),lk=b({status:Z(I(["queued","running","completed","failed","cancelled","interrupted"])).describe("Optional run status filter. Omit to include all statuses."),agentId:Z(d().min(1)).describe("Optional teammate ID filter. Omit to include all teammates."),includeCompleted:Z(w()).describe("Include completed/failed runs (default true)")}),dk=b({runId:d().min(1).describe("Run ID"),reason:Z(d().min(1)).describe("Optional cancellation reason")}),pk=b({runId:Z(d().min(1)).describe("Optional async run ID to await. Omit to wait for all active async runs.")}).strict(),mk=b({toAgentId:d().min(1).describe("Recipient agent ID"),subject:d().min(1).describe("Message subject"),body:d().min(1).describe("Message body"),taskId:Z(d().min(1)).describe("Optional task ID context")}),fk=b({subject:d().min(1).describe("Message subject"),body:d().min(1).describe("Message body"),taskId:Z(d().min(1)).describe("Optional task ID context")}),gk=b({unreadOnly:Z(w()).describe("Only unread messages for read action (default true)")}),hk=b({kind:I(["progress","handoff","blocked","decision","done","error"]),summary:d().min(1).describe("Update summary"),taskId:Z(d().min(1)).describe("Optional task ID context"),evidence:Z(E(d().min(1))).describe("Optional evidence links/snippets"),nextAction:Z(d().min(1)).describe("Planned next step")}),yk=b({}),bk=b({title:d().describe("Outcome title"),requiredSections:E(d()).default(tx).describe("Required sections for finalization gate (defaults to current_state,boundary_analysis,interface_proposal)")}),xk=b({outcomeId:d().describe("Outcome ID"),section:d().describe("Section name"),sourceRunId:Z(d()).describe("Optional source run ID"),content:d().describe("Section fragment content")}),Sk=b({fragmentId:d().describe("Fragment ID"),approved:w().describe("Review decision")}),_k=b({outcomeId:d().describe("Outcome ID")}),vk=b({}),Tk=b({teamId:d(),teamName:d(),members:E(nx),taskCounts:j(st,x()),unreadMessages:x(),missionLogEntries:x(),activeRuns:x(),queuedRuns:x(),outcomeCounts:j(On,x())}),ox=b({id:d(),title:d(),description:d(),status:st,createdAt:le,updatedAt:le,createdBy:d(),assignee:d().optional(),dependsOn:E(d()),summary:d().optional(),isReady:w(),blockedBy:E(d())}),Ck=ao("action",[b({action:V("create"),taskId:d(),status:st,ignoredFields:E(d()).optional(),note:d().optional()}),b({action:V("list"),tasks:E(ox)}),b({action:V("claim"),taskId:d(),status:st,nextStep:d()}),b({action:V("complete"),taskId:d(),status:st}),b({action:V("block"),taskId:d(),status:st})]),kk=b({agentId:d(),mode:I(["sync","async"]),status:I(["dispatched","running","queued","joined"]),dispatched:w(),message:d(),deduped:w().optional(),runId:d().optional(),text:d().optional(),iterations:x().optional()}),ix=b({textPreview:d(),iterations:x(),finishReason:d(),durationMs:x(),usage:b({inputTokens:x(),outputTokens:x(),cacheReadTokens:x().optional(),cacheWriteTokens:x().optional(),totalCost:x().optional()})}),Ek=b({id:d(),agentId:d(),taskId:d().optional(),status:cp,messagePreview:d(),priority:x(),retryCount:x(),maxRetries:x(),nextAttemptAt:le.optional(),continueConversation:w().optional(),startedAt:le,endedAt:le.optional(),leaseOwner:d().optional(),heartbeatAt:le.optional(),lastProgressAt:le.optional(),lastProgressMessage:d().optional(),currentActivity:d().optional(),error:d().optional(),resultSummary:ix.optional()}),Rk=b({id:d(),teamId:d(),fromAgentId:d(),toAgentId:d(),subject:d(),body:d(),taskId:d().optional(),sentAt:le,readAt:le.optional()}),Ak=b({id:d(),teamId:d(),title:d(),status:On,requiredSections:E(d()),createdBy:d(),createdAt:le,finalizedAt:le.optional()}),Ik=b({outcomeId:d(),status:On,requiredSections:E(d())}),wk=b({agentId:d(),status:d()}),Pk=b({runId:d(),status:cp}),Mk=b({id:d(),toAgentId:d()}),Ok=b({delivered:x()}),zk=b({id:d()}),Nk=b({status:d()}),$k=b({fragmentId:d(),status:d()}),Lk=b({outcomeId:d(),status:On});var sx;((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"})(sx||={});function ax(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 cx(e){let t=ax(e.inputSchema instanceof N?Vo(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 up=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function ux(e){let t=(e instanceof Error?e.message:String(e)).toLowerCase();return up.some((n)=>t.includes(n))}import{existsSync as lx,mkdirSync as dx,readFileSync as px,writeFileSync as mx}from"node:fs";import{dirname as fx,resolve as gx}from"node:path";var hx=new Set(["accesskeyid","secretaccesskey","idtoken","refreshtoken","accesstoken","access_token","refresh_token","apikey","api_key","authorization","password","secret","token","email","displayname","display_name","userinfo"]),yx=["id","balance","cost","secret"];function bx(e){let t=e.toLowerCase();if(hx.has(t))return!0;for(let n of yx){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 xx=[{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 dp(e){let t=e;for(let{pattern:n,replacement:r}of xx)t=t.replace(n,r);return t}function yi(e){if(Array.isArray(e))return e.map(yi);if(!e||typeof e!=="object")return e;return Object.fromEntries(Object.entries(e).sort(([t],[n])=>Sx(t,n)).map(([t,n])=>[t,yi(n)]))}function Sx(e,t){if(e<t)return-1;if(e>t)return 1;return 0}function lp(e){return JSON.stringify(yi(e))}var _x=[{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 bi(e){let t=e;for(let{pattern:n,replacement:r}of _x)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 dp(e)}if(Array.isArray(e))return e.map(at);if(typeof e==="object"){let t={};for(let[n,r]of Object.entries(e))if(bx(n)&&(typeof r==="string"||typeof r==="number"))t[n]="REDACTED";else t[n]=at(r);return t}return e}function vx(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 Tx(e){return e?.toLowerCase().split(";")[0]?.trim()==="application/x-www-form-urlencoded"}function pp(e,t){try{return lp(at(JSON.parse(e)))}catch{if(Tx(t)){let n=vx(e);if(n)return lp(at(n))}return dp(e)}}function Cx(e,t){let n={...e},r=t&&e.body!==void 0?pp(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=bi(n.path);if(n.response!==void 0)n.response=at(n.response);return n}function mp(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 fp(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 gp(e,t){if(t?.method)return t.method.toUpperCase();if(e&&typeof e.method==="string")return e.method.toUpperCase();return"GET"}function kx(e){if(!e)return;return new Headers(e).get("content-type")??void 0}function hp(e,t){let n=kx(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 yp(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 Ex(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=mx(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 kx(e,t,n){let o=[],r=[],i=globalThis.fetch;function s(l){if(l.finalized)return;l.finalized=!0;let p=new TextDecoder,m=l.chunks.map((g)=>p.decode(g,{stream:!0})).join("")+p.decode(),f;try{f=JSON.parse(m)}catch{f=m}o.push({scope:l.scope,method:l.method,path:l.path,body:l.body,requestContentType:l.requestContentType,status:l.status,response:f,responseIsBinary:!1,contentType:l.contentType})}globalThis.fetch=Object.assign(async(l,p)=>{let m=pp(l),f=mp(l,p),{scope:g,path:y}=dp(m),_=await gp(l,p),v=fp(l,p),k=await i(l,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:_??"",requestContentType:v,status:k.status,response:"",responseIsBinary:!1,contentType:M}),k;let R={scope:g,method:f,path:y,body:_??"",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:(l)=>{}});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;hr(()=>{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 l=px(e);ux(l,{recursive:!0});let p=o.map((m)=>vx(m,n));dx(e,JSON.stringify(p,null,2)),process.stderr.write(`[VCR] Saved ${p.length} recorded HTTP interaction(s) to ${e}
183
- `)})}function Ex(e){let t=[],n=e.split(/\n\n/);for(let o of n){let r=o.trim();if(r)t.push(`${r}
180
+ `),process.exit(1);let t=gx(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 Rx(e,t,n){let r=[],o=[],i=globalThis.fetch;function s(l){if(l.finalized)return;l.finalized=!0;let p=new TextDecoder,m=l.chunks.map((g)=>p.decode(g,{stream:!0})).join("")+p.decode(),f;try{f=JSON.parse(m)}catch{f=m}r.push({scope:l.scope,method:l.method,path:l.path,body:l.body,requestContentType:l.requestContentType,status:l.status,response:f,responseIsBinary:!1,contentType:l.contentType})}globalThis.fetch=Object.assign(async(l,p)=>{let m=fp(l),f=gp(l,p),{scope:g,path:y}=mp(m),S=await yp(l,p),v=hp(l,p),k=await i(l,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:(l)=>{}});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;ho(()=>{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 l=fx(e);dx(l,{recursive:!0});let p=r.map((m)=>Cx(m,n));mx(e,JSON.stringify(p,null,2)),process.stderr.write(`[VCR] Saved ${p.length} recorded HTTP interaction(s) to ${e}
183
+ `)})}function Ax(e){let t=[],n=e.split(/\n\n/);for(let r of n){let o=r.trim();if(o)t.push(`${o}
184
184
 
185
- `)}return t}function Rx(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 Ax(e){if(e.recording.requestBody===void 0)return;let t=await gp(e.requestInput,e.requestInit),n=fp(e.requestInput,e.requestInit),o=lp(t??"",n);if(o!==e.recording.requestBody)throw Error(`[VCR] Request body mismatch for ${e.method} ${e.path}.
185
+ `)}return t}function Ix(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 wx(e){if(e.recording.requestBody===void 0)return;let t=await yp(e.requestInput,e.requestInit),n=hp(e.requestInput,e.requestInit),r=pp(t??"",n);if(r!==e.recording.requestBody)throw Error(`[VCR] Request body mismatch for ${e.method} ${e.path}.
186
186
  expected: ${e.recording.requestBody}
187
- actual: ${o}
188
- Re-record the cassette if the request change is intentional.`)}function wx(e,t){if(!cx(e))process.stderr.write(`[VCR] Cassette file not found: ${e}
189
- `),process.exit(1);let n=JSON.parse(lx(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 u=pp(a),l=mp(a,c),{path:p}=dp(u),m=bi(p);if(t&&!p.includes(t))return i(a,c);let f=n.findIndex((g,y)=>{if(r[y])return!1;let _=bi(g.path);return g.method.toUpperCase()===l&&_===m});if(f>=0){let g=n[f];if(!g)return i(a,c);await Ax({recording:g,requestInput:a,requestInit:c,method:l,path:m}),r[f]=!0;let y=typeof g.response==="string"?g.response:JSON.stringify(g.response),_=new Headers;if(g.contentType)_.set("content-type",g.contentType);else if(typeof g.response==="string"&&g.response.trimStart().startsWith("data:"))_.set("content-type","text/event-stream");else if(typeof g.response==="object")_.set("content-type","application/json");let v=_.get("content-type")?.includes("text/event-stream")??!1;if(v)_.set("cache-control","no-cache"),_.set("connection","keep-alive");if(v&&typeof g.response==="string"){let k=Ex(g.response);if(k.length>1){let M=Rx(k,o);return new Response(M,{status:g.status,headers:_})}}return new Response(y,{status:g.status,headers:_})}if(!t)throw Error(`[VCR] No matching recording for ${l} ${u} (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 Ix(e){let t=Cx(e);if(!t)return;if(t.mode==="record")kx(t.cassettePath,t.filter,t.includeRequestBody);else wx(t.cassettePath,t.filter)}export{mb as AGENT_UNEXPECTED_REASONING_TOKENS_EVENT,_y as APIKeySchema,ap as AUTH_ERROR_PATTERNS,lv as AgentConfigSchema,Uf as AgentFinishReasonSchema,uv as AgentResultSchema,Zf as AgentUsageSchema,Bd as AllowedMCPServerSchema,Ld as AnthropicModelSchema,Dd as AnthropicSchema,Pf as ApiFormat,Wu as ApiFormatSchema,wd as AwsBedrockCustomModelSchema,Ad as AwsBedrockModelSchema,Id as AwsBedrockSettingsSchema,Yg as CHARS_PER_TOKEN,Mn as CLINE_BUILD_ENV_ENV,Yb as CLINE_CHAT_WORKSPACE_DIRECTORY_NAME,Jy as CLINE_CONNECTOR_CLI_LAUNCH_ENV,Yy as CLINE_CONNECTOR_STARTING_INSTANCE_ENV,Xy as CLINE_CONNECTOR_SUPERVISED_ENV,Hd as CLINE_DEBUG_HOST_ENV,jd as CLINE_DEBUG_PORT_BASE_ENV,Hh as CLINE_DEFAULT_MODEL_ID,Cy as CLINE_DEFAULT_RPC_ADDRESS,Ty as CLINE_DEFAULT_RPC_PORT,ci as CLINE_ENVIRONMENTS,Hy as CLINE_ENVIRONMENT_ENV,jy as CLINE_ENVIRONMENT_OVERRIDE_ENV,vy as CLINE_HUB_DEV_PORT,Sy as CLINE_HUB_PORT,Wy as CLINE_RUN_AS_HUB_DAEMON_ENV,Jb as CLINE_WORKSPACES_DIRECTORY_NAME,tT as CONFIGURABLE_MODEL_TOOL_NAMES,cl as CONNECTOR_CATALOG,dl as CONNECTOR_PLATFORMS,_b as CORE_SPAWN_REASONS,Cv as CURRENT_HUB_PROTOCOL_VERSION,Pd as ClineModelSchema,Md as ClineSettingsSchema,Hf as ConnectorAuthorizationDecisionSchema,Ff as ConnectorAuthorizationRequestSchema,sl as ConnectorEventActorSchema,al as ConnectorEventContextSchema,il as ConnectorHookEventNameSchema,jf as ConnectorHookEventSchema,yr as ContributionRegistry,Vy as DEFAULT_CLINE_ENVIRONMENT,_r as DEFAULT_MAX_IMAGE_BASE64_BYTES,_e as DEFAULT_MAX_IMAGE_DECODED_BYTES,fe as DEFAULT_MAX_IMAGE_ENCODED_BYTES,Pl as DEFAULT_MAX_TOTAL_MEDIA_BYTES,aT as DEFAULT_MCP_TIMEOUT_SECONDS,Qb as DEFAULT_OUTCOME_REQUIRED_SECTIONS,Gg as DEFAULT_REASONING_EFFORT,rp as DEFAULT_RUNTIME_CONFIG_EXTENSIONS,Mt as EMPTY_CONTENT_TEXT,Fd as EnterpriseTelemetrySchema,sg as FEATURE_FLAGS,Ke as FeatureFlag,ig as FeatureFlagDefaultValue,Rl as GeneratedMediaModalitySchema,Il as GeneratedMediaSchema,Al as GeneratedMediaSourceSchema,si as GlobalInstructionsFileSchema,Rv as HUB_CAPABILITIES,Uv as HUB_CHECKPOINT_CAPABILITY,wv as HUB_CLIENT_TOOL_APPROVAL_CAPABILITY,Ov as HUB_COMMAND_SLOW_LOG_MS,Bv as HUB_COMPACTION_CAPABILITY,Lv as HUB_CUSTOM_TOOL_CAPABILITY_PREFIX,yg as HUB_DEFAULT_COMMAND_TIMEOUT_MS,Dv as HUB_HOOK_CAPABILITY_PREFIX,Zv as HUB_MISTAKE_LIMIT_CAPABILITY,xl as HUB_SCHEDULE_MODES,$v as HUB_TOOL_EXECUTOR_CAPABILITY_PREFIX,xg as HUB_TOOL_EXECUTOR_NAMES,Fv as HUB_USER_INSTRUCTIONS_SNAPSHOT_CAPABILITY,yl as HookEventNameSchema,bl as HookEventPayloadSchema,We as IMAGE_OMITTED_PLACEHOLDER,Je as IMAGE_UNSUPPORTED_PLACEHOLDER,Yd as LOOPBACK_NO_PROXY_HOSTS,Nd as LiteLLMModelSchema,$d as LiteLLMSchema,Ev as MAX_CLIENT_HUB_PROTOCOL_VERSION,uT as MAX_MCP_TIMEOUT_SECONDS,kv as MIN_CLIENT_HUB_PROTOCOL_VERSION,cT as MIN_MCP_TIMEOUT_SECONDS,eT as MODEL_TOOL_NAMES,id as MODE_TAG_INSTRUCTIONS,Ju as ModelCapabilitySchema,xn as ModelInfoSchema,el as ModelMetadataSchema,tl as ModelModalitiesSchema,mr as ModelModalitySchema,rl as ModelOperationModeSchema,ol as ModelOperationSchema,Xu as ModelPricingSchema,pr as ModelReasoningOptionSchema,Yu as ModelStatusSchema,db as NO_DEFAULT_CURRENT_DIRECTORY_IN_EXE_PATH_ENV,Iv as ONE_TIME_SCHEDULE_CRON_PATTERN,Pv as ONE_TIME_SCHEDULE_RUN_AT_METADATA_KEY,gi as OTLP_TRACE_RELAY_MARKER,Ed as OpenAiCompatibleModelSchema,Rd as OpenAiCompatibleSchema,ad as PLAN_MODE_INSTRUCTIONS,cd as PLAN_MODE_INSTRUCTIONS_MANUAL_SWITCH,rg as PLUGIN_FILE_EXTENSIONS,Zd as PromptUploadingSchema,ky as ProviderCapabilitySchema,Ry as ProviderClientSchema,Ey as ProviderProtocolSchema,zt as REASONING_EFFORT_RATIOS,yn as REASONING_LEVELS,fd as REMOTE_CONFIG_SESSION_BLOB_UPLOAD_METADATA_KEY,ay as REMOTE_URI_SCHEME,hi as RUNTIME_CONFIG_EXTENSION_KINDS,bn as ReasoningEffortSchema,dr as ReasoningLevelSchema,xy as RemoteConfigSchema,Ud as RemoteMCPServerSchema,Pn as S3AccessKeySettingsSchema,Sb as SDK_ERROR_TELEMETRY_EVENT,Cl as SESSION_SEARCH_PREVIEW_MAX_LENGTH,Tl as SESSION_SEARCH_TITLE_MAX_LENGTH,jb as SESSION_STATUS_VALUES,vn as SUPPORTED_IMAGE_MEDIA_TYPES,bb as TASK_CANCELLED_EVENT,hb as TASK_FIRST_CHUNK_RECEIVED_EVENT,xb as TASK_MAX_TOKENS_RECOVERY_EVENT,fb as TASK_PROVIDER_REQUEST_STARTED_EVENT,yb as TASK_PROVIDER_STREAM_FAILED_EVENT,gb as TASK_PROVIDER_STREAM_STARTED_EVENT,XC as TEAM_AWAIT_TIMEOUT_MS,wy as TEAM_LIFECYCLE_EVENT_TYPE,Ay as TEAM_PROGRESS_EVENT_TYPE,QC as TEAM_RUN_MESSAGE_PREVIEW_LIMIT,ek as TEAM_RUN_TEXT_PREVIEW_LIMIT,ik as TEAM_TASK_IGNORED_FIELDS_BY_ACTION,Bf as TOOL_REJECTION_SUFFIX,yk as TeamAttachOutcomeFragmentInputSchema,lk as TeamAwaitRunsInputSchema,pk as TeamBroadcastInputSchema,Pk as TeamBroadcastToolResultSchema,uk as TeamCancelRunInputSchema,wk as TeamCancelRunToolResultSchema,gk as TeamCleanupInputSchema,Ok as TeamCleanupToolResultSchema,hk as TeamCreateOutcomeInputSchema,Rk as TeamCreateOutcomeToolResultSchema,xk as TeamFinalizeOutcomeInputSchema,Nk as TeamFinalizeOutcomeToolResultSchema,_k as TeamListOutcomesInputSchema,ck as TeamListRunsInputSchema,kk as TeamMailboxMessageToolResultSchema,rx as TeamMessageType,fk as TeamMissionLogInputSchema,Mk as TeamMissionLogToolResultSchema,zk as TeamOutcomeFragmentToolResultSchema,Ek as TeamOutcomeToolResultSchema,mk as TeamReadMailboxInputSchema,bk as TeamReviewOutcomeFragmentInputSchema,ox as TeamRunResultSummarySchema,ak as TeamRunTaskInputSchema,Tk as TeamRunTaskToolResultSchema,Ck as TeamRunToolSummarySchema,dk as TeamSendMessageInputSchema,Ik as TeamSendMessageToolResultSchema,ok as TeamShutdownTeammateInputSchema,Ak as TeamSimpleAgentStatusToolResultSchema,nk as TeamSpawnTeammateInputSchema,rk as TeamStatusInputSchema,Sk as TeamStatusToolResultSchema,sk as TeamTaskInputSchema,nx as TeamTaskListItemToolResultSchema,vk as TeamTaskToolResultSchema,tk as TeamTeammateSpecSchema,Qu as ThinkingConfigSchema,gr as ToolCallRecordSchema,Yv as USAGE_COST_DISPLAYS,Df as USER_REJECTED_TOOL_REASON,Od as VertexModelSchema,zd as VertexSettingsSchema,Kb as WorkspaceInfoSchema,Wb as WorkspaceManifestSchema,By as augmentNodeCommandForDebug,Uh as buildClineSystemPrompt,Vf as buildConnectorConnectArgs,Yh as buildRemoteConfigSessionBlobUploadMetadata,Xd as buildSdkErrorProperties,kb as captureAgentUnexpectedReasoningTokens,Rb as captureSdkError,Eb as captureTaskLifecycleEvent,Qy as claimHubDaemonProcess,nb as claimSupervisedConnectorProcess,th as clampMcpTimeoutSeconds,fy as clearMaterializedRemoteConfigRuntime,Qh as clearRemoteConfigSessionBlobUpload,Kf as connectorChannelsFromPlatforms,$b as createClineTelemetryServiceConfig,ep as createClineTelemetryServiceMetadata,og as createContributionRegistry,Tn as createMediaBudgetState,Eg as createModeSwitchNoticeTracker,sy as createRemoteConfigSessionMessagesArtifactUploader,Hb as createSessionId,sx as createTool,yh as decodeJwtPayload,Hv as describeOutdatedHubSessions,pb as disableCurrentDirectoryExecutableSearch,Xf as disposeAll,GC as emptyWorkspaceManifest,lb as ensureLoopbackProxyBypass,Xg as estimateRequestInputTokens,Fl as estimateTokens,xr as formatDisplayUserInput,br as formatFileContentBlock,Nh as formatHumanReadableDate,dT as formatMcpTimeoutErrorMessage,Vg as formatMessagesForAiSdk,kg as formatModeSwitchNotice,Pg as formatSessionSearchPreview,Ig as formatSessionSearchTitle,$h as formatUptime,vg as formatUserCommandBlock,Sg as formatUserInputBlock,Og as generatedMediaModalityFromMediaType,Fy as getClineClientIdentity,Ky as getClineEnvironmentConfig,bg as getDefaultHubCommandTimeoutMs,Sh as getDefaultShell,oh as getErrorCode,nh as getErrorMessage,ot as getPowerShellEdition,wh as getShellArgs,ed as getShellInvocation,jr as getShellKind,Gb as hasRuntimeConfigExtension,Sr as imageBase64DecodedByteLength,zg as imageBase64EncodedByteLength,vr as imageBase64LengthForDecodedBytes,Ng as imageFileMaxDecodedBytesForBase64Limit,Ix as initVcr,Ml as isBase64Char,Uy as isBunEmbeddedModulePath,$g as isCanonicalBase64,Of as isChatCompatibleModel,Xb as isChatWorkspacePath,qr as isClineProvider,Mg as isGeneratedMedia,eb as isHubDaemonProcess,Av as isHubProtocolCompatible,hg as isHubScheduleMode,Nv as isHubToolExecutorName,ax as isLikelyAuthError,eh as isMcpTimeoutConfigured,zb as isOtlpTraceRelayProvider,ip as isRuntimeConfigExtensionKind,ob as isSupervisedConnectorProcess,Mf as isTranscriptionModel,ul as listConnectorCatalog,Ob as markOtlpTraceRelayProvider,Oh as maskSecret,Gf as mergeConnectorConnectArgs,qg as mergeModelOptions,fr as modelHasCapability,zf as modelProducesImages,Lf as modelSupportsImageInput,$f as modelSupportsToolCalling,Qg as noopBasicLogger,Hr as normalizeJsonLikeStringsForSchema,hl as normalizePluginManifest,fi as normalizeSdkError,Sl as normalizeUserInput,bh as omitUndefinedValues,gg as parseHookEventPayload,dh as parseJsonStream,qb as parseRuntimeConfigExtensions,_l as parseUserCommandEnvelope,Cg as parseUserInputMode,yy as prepareRemoteConfigRuntime,Bh as processWorkspaceInfo,sb as readConnectorCliLaunchSpec,Mv as readHubScheduleMode,bd as readRemoteConfigSessionBlobUploadMetadata,ib as readStartingConnectorInstance,hr as registerDisposable,Xh as registerRemoteConfigSessionBlobUpload,It as reserveImageMediaBytes,vb as resetSdkErrorRateLimiterForTests,ai as resolveClineBuildEnv,Wd as resolveClineEnvironment,Kg as resolveEffectiveReasoningEffort,Lb as resolveHookSessionContext,zv as resolveHubCommandTimeoutMs,lT as resolveMcpTimeoutSeconds,Tr as resolveMediaBudget,Zh as resolveProviderApiKeyOptional,Fh as resolveProviderLocalCli,Wg as resolveReasoningBudgetFromRatio,Zl as resolveReasoningEffortRatio,Db as resolveRootSessionId,mh as safeJsonParse,ph as safeJsonStringify,Ih as sanitizeFileName,ae as sanitizeSurrogates,Jg as serializeAbortReason,Zy as setClineClientIdentity,tb as setConnectorCliLaunchSpec,rb as setStartingConnectorInstance,ll as shouldIncludeConnectorField,vl as stripModeNotices,zh as stripUtf8Bom,nl as supportsChatModalities,Bl as toAiSdkToolResultOutput,_h as toPosixSeparators,Ph as trimNonEmpty,Mh as truncateSplit,td as truncateStr,KC as upsertWorkspaceInfo,Nf as usesImageGenerationOperation,Lg as validateAndReserveBase64Media,Pt as validateAndReserveImageMedia,zl as validateImageMedia,Lh as validateWithZod,Dy as withResolvedClineBuildEnv,El as xmlTagsRemoval,Vr as zodToJsonSchema};
187
+ actual: ${r}
188
+ Re-record the cassette if the request change is intentional.`)}function Px(e,t){if(!lx(e))process.stderr.write(`[VCR] Cassette file not found: ${e}
189
+ `),process.exit(1);let n=JSON.parse(px(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 u=fp(a),l=gp(a,c),{path:p}=mp(u),m=bi(p);if(t&&!p.includes(t))return i(a,c);let f=n.findIndex((g,y)=>{if(o[y])return!1;let S=bi(g.path);return g.method.toUpperCase()===l&&S===m});if(f>=0){let g=n[f];if(!g)return i(a,c);await wx({recording:g,requestInput:a,requestInit:c,method:l,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=Ax(g.response);if(k.length>1){let M=Ix(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 ${l} ${u} (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 Mx(e){let t=Ex(e);if(!t)return;if(t.mode==="record")Rx(t.cassettePath,t.filter,t.includeRequestBody);else Px(t.cassettePath,t.filter)}export{gb as AGENT_UNEXPECTED_REASONING_TOKENS_EVENT,vy as APIKeySchema,up as AUTH_ERROR_PATTERNS,pv as AgentConfigSchema,Ff as AgentFinishReasonSchema,dv as AgentResultSchema,Hf as AgentUsageSchema,Zd as AllowedMCPServerSchema,Bd as AnthropicModelSchema,Ud as AnthropicSchema,Of as ApiFormat,Wu as ApiFormatSchema,Pd as AwsBedrockCustomModelSchema,wd as AwsBedrockModelSchema,Md as AwsBedrockSettingsSchema,Qg as CHARS_PER_TOKEN,Mn as CLINE_BUILD_ENV_ENV,Qb as CLINE_CHAT_WORKSPACE_DIRECTORY_NAME,Xy as CLINE_CONNECTOR_CLI_LAUNCH_ENV,Qy as CLINE_CONNECTOR_STARTING_INSTANCE_ENV,eb as CLINE_CONNECTOR_SUPERVISED_ENV,Vd as CLINE_DEBUG_HOST_ENV,qd as CLINE_DEBUG_PORT_BASE_ENV,Vh as CLINE_DEFAULT_MODEL_ID,Ey as CLINE_DEFAULT_RPC_ADDRESS,ky as CLINE_DEFAULT_RPC_PORT,ci as CLINE_ENVIRONMENTS,Vy as CLINE_ENVIRONMENT_ENV,qy as CLINE_ENVIRONMENT_OVERRIDE_ENV,Cy as CLINE_HUB_DEV_PORT,Ty as CLINE_HUB_PORT,Yy as CLINE_RUN_AS_HUB_DAEMON_ENV,Xb as CLINE_WORKSPACES_DIRECTORY_NAME,rT as CONFIGURABLE_MODEL_TOOL_NAMES,cl as CONNECTOR_CATALOG,dl as CONNECTOR_PLATFORMS,vb as CORE_SPAWN_REASONS,Ev as CURRENT_HUB_PROTOCOL_VERSION,Od as ClineModelSchema,zd as ClineSettingsSchema,Vf as ConnectorAuthorizationDecisionSchema,jf as ConnectorAuthorizationRequestSchema,sl as ConnectorEventActorSchema,al as ConnectorEventContextSchema,il as ConnectorHookEventNameSchema,qf as ConnectorHookEventSchema,yo as ContributionRegistry,Gy as DEFAULT_CLINE_ENVIRONMENT,So as DEFAULT_MAX_IMAGE_BASE64_BYTES,Se as DEFAULT_MAX_IMAGE_DECODED_BYTES,fe as DEFAULT_MAX_IMAGE_ENCODED_BYTES,Pl as DEFAULT_MAX_TOTAL_MEDIA_BYTES,uT as DEFAULT_MCP_TIMEOUT_SECONDS,tx as DEFAULT_OUTCOME_REQUIRED_SECTIONS,Wg as DEFAULT_REASONING_EFFORT,sp as DEFAULT_RUNTIME_CONFIG_EXTENSIONS,Mt as EMPTY_CONTENT_TEXT,Hl as ESTIMATED_TOKENS_PER_IMAGE,jd as EnterpriseTelemetrySchema,cg as FEATURE_FLAGS,Ke as FeatureFlag,ag as FeatureFlagDefaultValue,Rl as GeneratedMediaModalitySchema,wl as GeneratedMediaSchema,Al as GeneratedMediaSourceSchema,si as GlobalInstructionsFileSchema,Iv as HUB_CAPABILITIES,Fv as HUB_CHECKPOINT_CAPABILITY,Pv as HUB_CLIENT_TOOL_APPROVAL_CAPABILITY,Nv as HUB_COMMAND_SLOW_LOG_MS,Zv as HUB_COMPACTION_CAPABILITY,Bv as HUB_CUSTOM_TOOL_CAPABILITY_PREFIX,xg as HUB_DEFAULT_COMMAND_TIMEOUT_MS,Uv as HUB_HOOK_CAPABILITY_PREFIX,Hv as HUB_MISTAKE_LIMIT_CAPABILITY,xl as HUB_SCHEDULE_MODES,Dv as HUB_TOOL_EXECUTOR_CAPABILITY_PREFIX,_g as HUB_TOOL_EXECUTOR_NAMES,jv as HUB_USER_INSTRUCTIONS_SNAPSHOT_CAPABILITY,yl as HookEventNameSchema,bl as HookEventPayloadSchema,We as IMAGE_OMITTED_PLACEHOLDER,Je as IMAGE_UNSUPPORTED_PLACEHOLDER,Qd as LOOPBACK_NO_PROXY_HOSTS,Ld as LiteLLMModelSchema,Dd as LiteLLMSchema,Av as MAX_CLIENT_HUB_PROTOCOL_VERSION,dT as MAX_MCP_TIMEOUT_SECONDS,Rv as MIN_CLIENT_HUB_PROTOCOL_VERSION,lT as MIN_MCP_TIMEOUT_SECONDS,nT as MODEL_TOOL_NAMES,ad as MODE_TAG_INSTRUCTIONS,Ju as ModelCapabilitySchema,xn as ModelInfoSchema,el as ModelMetadataSchema,tl as ModelModalitiesSchema,mo as ModelModalitySchema,ol as ModelOperationModeSchema,rl as ModelOperationSchema,Xu as ModelPricingSchema,po as ModelReasoningOptionSchema,Yu as ModelStatusSchema,mb as NO_DEFAULT_CURRENT_DIRECTORY_IN_EXE_PATH_ENV,Mv as ONE_TIME_SCHEDULE_CRON_PATTERN,Ov as ONE_TIME_SCHEDULE_RUN_AT_METADATA_KEY,gi as OTLP_TRACE_RELAY_MARKER,Ad as OpenAiCompatibleModelSchema,Id as OpenAiCompatibleSchema,ud as PLAN_MODE_INSTRUCTIONS,ld as PLAN_MODE_INSTRUCTIONS_MANUAL_SWITCH,sg as PLUGIN_FILE_EXTENSIONS,Hd as PromptUploadingSchema,Ry as ProviderCapabilitySchema,Iy as ProviderClientSchema,Ay as ProviderProtocolSchema,zt as REASONING_EFFORT_RATIOS,yn as REASONING_LEVELS,hd as REMOTE_CONFIG_SESSION_BLOB_UPLOAD_METADATA_KEY,uy as REMOTE_URI_SCHEME,hi as RUNTIME_CONFIG_EXTENSION_KINDS,bn as ReasoningEffortSchema,lo as ReasoningLevelSchema,_y as RemoteConfigSchema,Fd as RemoteMCPServerSchema,Pn as S3AccessKeySettingsSchema,Tb as SDK_ERROR_TELEMETRY_EVENT,Cl as SESSION_SEARCH_PREVIEW_MAX_LENGTH,Tl as SESSION_SEARCH_TITLE_MAX_LENGTH,qb as SESSION_STATUS_VALUES,vn as SUPPORTED_IMAGE_MEDIA_TYPES,Sb as TASK_CANCELLED_EVENT,bb as TASK_FIRST_CHUNK_RECEIVED_EVENT,_b as TASK_MAX_TOKENS_RECOVERY_EVENT,hb as TASK_PROVIDER_REQUEST_STARTED_EVENT,xb as TASK_PROVIDER_STREAM_FAILED_EVENT,yb as TASK_PROVIDER_STREAM_STARTED_EVENT,ek as TEAM_AWAIT_TIMEOUT_MS,Py as TEAM_LIFECYCLE_EVENT_TYPE,wy as TEAM_PROGRESS_EVENT_TYPE,tk as TEAM_RUN_MESSAGE_PREVIEW_LIMIT,nk as TEAM_RUN_TEXT_PREVIEW_LIMIT,ak as TEAM_TASK_IGNORED_FIELDS_BY_ACTION,Zf as TOOL_REJECTION_SUFFIX,xk as TeamAttachOutcomeFragmentInputSchema,pk as TeamAwaitRunsInputSchema,fk as TeamBroadcastInputSchema,Ok as TeamBroadcastToolResultSchema,dk as TeamCancelRunInputSchema,Pk as TeamCancelRunToolResultSchema,yk as TeamCleanupInputSchema,Nk as TeamCleanupToolResultSchema,bk as TeamCreateOutcomeInputSchema,Ik as TeamCreateOutcomeToolResultSchema,_k as TeamFinalizeOutcomeInputSchema,Lk as TeamFinalizeOutcomeToolResultSchema,vk as TeamListOutcomesInputSchema,lk as TeamListRunsInputSchema,Rk as TeamMailboxMessageToolResultSchema,sx as TeamMessageType,hk as TeamMissionLogInputSchema,zk as TeamMissionLogToolResultSchema,$k as TeamOutcomeFragmentToolResultSchema,Ak as TeamOutcomeToolResultSchema,gk as TeamReadMailboxInputSchema,Sk as TeamReviewOutcomeFragmentInputSchema,ix as TeamRunResultSummarySchema,uk as TeamRunTaskInputSchema,kk as TeamRunTaskToolResultSchema,Ek as TeamRunToolSummarySchema,mk as TeamSendMessageInputSchema,Mk as TeamSendMessageToolResultSchema,ik as TeamShutdownTeammateInputSchema,wk as TeamSimpleAgentStatusToolResultSchema,ok as TeamSpawnTeammateInputSchema,sk as TeamStatusInputSchema,Tk as TeamStatusToolResultSchema,ck as TeamTaskInputSchema,ox as TeamTaskListItemToolResultSchema,Ck as TeamTaskToolResultSchema,rk as TeamTeammateSpecSchema,Qu as ThinkingConfigSchema,go as ToolCallRecordSchema,Qv as USAGE_COST_DISPLAYS,Uf as USER_REJECTED_TOOL_REASON,Nd as VertexModelSchema,$d as VertexSettingsSchema,Jb as WorkspaceInfoSchema,Yb as WorkspaceManifestSchema,Zy as augmentNodeCommandForDebug,Fh as buildClineSystemPrompt,Gf as buildConnectorConnectArgs,Qh as buildRemoteConfigSessionBlobUploadMetadata,ep as buildSdkErrorProperties,Rb as captureAgentUnexpectedReasoningTokens,Ib as captureSdkError,Ab as captureTaskLifecycleEvent,tb as claimHubDaemonProcess,ob as claimSupervisedConnectorProcess,rh as clampMcpTimeoutSeconds,hy as clearMaterializedRemoteConfigRuntime,ty as clearRemoteConfigSessionBlobUpload,Jf as connectorChannelsFromPlatforms,Db as createClineTelemetryServiceConfig,np as createClineTelemetryServiceMetadata,ig as createContributionRegistry,jl as createImageAwareReplacer,Tn as createMediaBudgetState,Ag as createModeSwitchNoticeTracker,cy as createRemoteConfigSessionMessagesArtifactUploader,Vb as createSessionId,cx as createTool,xh as decodeJwtPayload,Vv as describeOutdatedHubSessions,fb as disableCurrentDirectoryExecutableSearch,eg as disposeAll,WC as emptyWorkspaceManifest,pb as ensureLoopbackProxyBypass,eh as estimateRequestInputTokens,Fl as estimateTokens,xo as formatDisplayUserInput,bo as formatFileContentBlock,Lh as formatHumanReadableDate,mT as formatMcpTimeoutErrorMessage,Gg as formatMessagesForAiSdk,Rg as formatModeSwitchNotice,Og as formatSessionSearchPreview,Mg as formatSessionSearchTitle,Dh as formatUptime,Cg as formatUserCommandBlock,Tg as formatUserInputBlock,Ng as generatedMediaModalityFromMediaType,jy as getClineClientIdentity,Jy as getClineEnvironmentConfig,Sg as getDefaultHubCommandTimeoutMs,Th as getDefaultShell,ih as getErrorCode,oh as getErrorMessage,rt as getPowerShellEdition,Ph as getShellArgs,nd as getShellInvocation,jo as getShellKind,Wb as hasRuntimeConfigExtension,_o as imageBase64DecodedByteLength,$g as imageBase64EncodedByteLength,vo as imageBase64LengthForDecodedBytes,Lg as imageFileMaxDecodedBytesForBase64Limit,Mx as initVcr,Ml as isBase64Char,Fy as isBunEmbeddedModulePath,Dg as isCanonicalBase64,Nf as isChatCompatibleModel,ex as isChatWorkspacePath,qo as isClineProvider,zg as isGeneratedMedia,nb as isHubDaemonProcess,wv as isHubProtocolCompatible,bg as isHubScheduleMode,Lv as isHubToolExecutorName,ux as isLikelyAuthError,nh as isMcpTimeoutConfigured,$b as isOtlpTraceRelayProvider,ap as isRuntimeConfigExtensionKind,ib as isSupervisedConnectorProcess,zf as isTranscriptionModel,ul as listConnectorCatalog,Nb as markOtlpTraceRelayProvider,Nh as maskSecret,Wf as mergeConnectorConnectArgs,Kg as mergeModelOptions,fo as modelHasCapability,$f as modelProducesImages,Bf as modelSupportsImageInput,Df as modelSupportsToolCalling,th as noopBasicLogger,Ho as normalizeJsonLikeStringsForSchema,hl as normalizePluginManifest,fi as normalizeSdkError,_l as normalizeUserInput,Sh as omitUndefinedValues,yg as parseHookEventPayload,mh as parseJsonStream,Kb as parseRuntimeConfigExtensions,Sl as parseUserCommandEnvelope,Eg as parseUserInputMode,xy as prepareRemoteConfigRuntime,Zh as processWorkspaceInfo,cb as readConnectorCliLaunchSpec,zv as readHubScheduleMode,Sd as readRemoteConfigSessionBlobUploadMetadata,ab as readStartingConnectorInstance,ho as registerDisposable,ey as registerRemoteConfigSessionBlobUpload,wt as reserveImageMediaBytes,Cb as resetSdkErrorRateLimiterForTests,ai as resolveClineBuildEnv,Yd as resolveClineEnvironment,Jg as resolveEffectiveReasoningEffort,Bb as resolveHookSessionContext,$v as resolveHubCommandTimeoutMs,pT as resolveMcpTimeoutSeconds,To as resolveMediaBudget,Hh as resolveProviderApiKeyOptional,jh as resolveProviderLocalCli,Yg as resolveReasoningBudgetFromRatio,Zl as resolveReasoningEffortRatio,Ub as resolveRootSessionId,gh as safeJsonParse,fh as safeJsonStringify,Mh as sanitizeFileName,ae as sanitizeSurrogates,Xg as serializeAbortReason,Hy as setClineClientIdentity,rb as setConnectorCliLaunchSpec,sb as setStartingConnectorInstance,ll as shouldIncludeConnectorField,vl as stripModeNotices,$h as stripUtf8Bom,nl as supportsChatModalities,Bl as toAiSdkToolResultOutput,vh as toPosixSeparators,Oh as trimNonEmpty,zh as truncateSplit,rd as truncateStr,JC as upsertWorkspaceInfo,Lf as usesImageGenerationOperation,Bg as validateAndReserveBase64Media,Pt as validateAndReserveImageMedia,zl as validateImageMedia,Bh as validateWithZod,Uy as withResolvedClineBuildEnv,El as xmlTagsRemoval,Vo as zodToJsonSchema};